diff --git a/README.md b/README.md index af2db0b2..300a3752 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,12 @@ In other cases you can contact the developer via email: ROI[GENERAL[_analog]->ROI.size() - 1]->result_float; @@ -127,7 +116,6 @@ string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution int ClassFlowCNNGeneral::ZeigerEvalHybrid(float zahl, float zahl_vorgaenger, int eval_vorgaenger) { int ergebnis_nachkomma = ((int) floor(zahl * 10)) % 10; -// int ergebnis_vorkomma = ((int) floor(zahl)) % 10; if (zahl_vorgaenger < 0) // keine Vorzahl vorhanden !!! --> Runde die Zahl { @@ -206,13 +194,6 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph) ) // Paragraph passt nicht return false; - -/* - if ((aktparamgraph.compare("[Analog]") != 0) && (aktparamgraph.compare(";[Analog]") != 0) - && (aktparamgraph.compare("[Digit]") != 0) && (aktparamgraph.compare(";[Digit]"))) // Paragraph passt nicht - return false; -*/ - if (aktparamgraph[0] == ';') { disabled = true; @@ -273,14 +254,6 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph) if (toUpper(zerlegt[1]) == "TRUE") SaveAllFiles = true; } - -/* - if ((toUpper(zerlegt[0]) == "EXTENDEDRESOLUTION") && (zerlegt.size() > 1)) - { - if (toUpper(zerlegt[1]) == "TRUE") - extendedResolution = true; - } -*/ } @@ -303,7 +276,6 @@ general* ClassFlowCNNGeneral::FindGENERAL(string _name_number) } - general* ClassFlowCNNGeneral::GetGENERAL(string _name, bool _create = true) { string _analog, _roi; @@ -338,6 +310,7 @@ general* ClassFlowCNNGeneral::GetGENERAL(string _name, bool _create = true) roi* neuroi = new roi; neuroi->name = _roi; + _ret->ROI.push_back(neuroi); printf("GetGENERAL - GENERAL %s - roi %s\n", _analog.c_str(), _roi.c_str()); @@ -482,6 +455,10 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time) CNNType = Digital; printf("TFlite-Type set to Digital\n"); break; + case 20: + CNNType = DigitalHyprid10; + printf("TFlite-Type set to DigitalHyprid10\n"); + break; case 22: CNNType = DigitalHyprid; printf("TFlite-Type set to DigitalHyprid\n"); @@ -489,7 +466,6 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time) default: printf("ERROR ERROR ERROR - tflite passt nicht zur Firmware - ERROR ERROR ERROR\n"); } -// flowpostprocessing->UpdateNachkommaDecimalShift(); } for (int _ana = 0; _ana < GENERAL.size(); ++_ana) @@ -559,6 +535,30 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time) _zwres = "Result General(DigitalHyprid)" + to_string(i) + ": " + to_string(GENERAL[_ana]->ROI[i]->result_float); if (debugdetailgeneral) LogFile.WriteToFile(_zwres); + if (isLogImage) + LogImage(logPath, GENERAL[_ana]->ROI[i]->name, &GENERAL[_ana]->ROI[i]->result_float, NULL, time, GENERAL[_ana]->ROI[i]->image_org); + } break; + case DigitalHyprid10: + { + int _num, _nachkomma; + + tflite->LoadInputImageBasis(GENERAL[_ana]->ROI[i]->image); + tflite->Invoke(); + if (debugdetailgeneral) LogFile.WriteToFile("Nach Invoke"); + + _num = tflite->GetOutClassification(0, 9); + _nachkomma = tflite->GetOutClassification(10, 19); + + + string _zwres = "Nach Invoke - Nummer: " + to_string(_num) + " Nachkomma: " + to_string(_nachkomma); + if (debugdetailgeneral) LogFile.WriteToFile(_zwres); + + GENERAL[_ana]->ROI[i]->result_float = fmod((double) _num + (((double)_nachkomma)-5)/10 + (double) 10, 10); + + printf("Result General(DigitalHyprid)%i: %f\n", i, GENERAL[_ana]->ROI[i]->result_float); + _zwres = "Result General(DigitalHyprid)" + to_string(i) + ": " + to_string(GENERAL[_ana]->ROI[i]->result_float); + if (debugdetailgeneral) LogFile.WriteToFile(_zwres); + if (isLogImage) LogImage(logPath, GENERAL[_ana]->ROI[i]->name, &GENERAL[_ana]->ROI[i]->result_float, NULL, time, GENERAL[_ana]->ROI[i]->image_org); } break; @@ -575,7 +575,6 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time) bool ClassFlowCNNGeneral::isExtendedResolution(int _number) { -// if (extendedResolution && !(CNNType == Digital)) if (!(CNNType == Digital)) return true; @@ -616,13 +615,9 @@ std::vector ClassFlowCNNGeneral::GetHTMLInfo() zw->image = GENERAL[_ana]->ROI[i]->image; zw->image_org = GENERAL[_ana]->ROI[i]->image_org; -// printf("Push %s\n", zw->filename.c_str()); - result.push_back(zw); } -// printf("größe: %d\n", result.size()); - return result; } diff --git a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h index f06d7b72..ef0a6cd1 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h +++ b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h @@ -3,7 +3,6 @@ #include"ClassFlowDefineTypes.h" #include "ClassFlowAlignment.h" -// #include "ClassFlowPostProcessing.h" enum t_CNNType { @@ -11,6 +10,7 @@ enum t_CNNType { Analogue, Digital, DigitalHyprid, + DigitalHyprid10, None }; @@ -50,7 +50,6 @@ public: std::vector GetHTMLInfo(); -// int AnzahlROIs(int _analog); int getAnzahlGENERAL(); general* GetGENERAL(int _analog); general* GetGENERAL(string _name, bool _create); @@ -59,8 +58,6 @@ public: bool isExtendedResolution(int _number = 0); -// void setPostprocessing(ClassFlowPostProcessing *_fpp){flowpostprocessing = _fpp;}; - void UpdateNameNumbers(std::vector *_name_numbers); t_CNNType getCNNType(){return CNNType;}; diff --git a/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h b/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h index 6c914c94..1b4e03df 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h +++ b/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h @@ -16,10 +16,16 @@ struct general { std::vector ROI; }; +enum t_RateType { + AbsoluteChange, + RateChange + }; + struct NumberPost { float MaxRateValue; bool useMaxRateValue; + t_RateType RateType; bool ErrorMessage; bool PreValueOkay; bool AllowNegativeRates; diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp index 3b383b03..05d61e2d 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp @@ -304,6 +304,39 @@ void ClassFlowPostProcessing::handleDecimalSeparator(string _decsep, string _val } } + + +void ClassFlowPostProcessing::handleMaxRateType(string _decsep, string _value) +{ + string _digit, _decpos; + int _pospunkt = _decsep.find_first_of("."); +// printf("Name: %s, Pospunkt: %d\n", _decsep.c_str(), _pospunkt); + if (_pospunkt > -1) + _digit = _decsep.substr(0, _pospunkt); + else + _digit = "default"; + + for (int j = 0; j < NUMBERS.size(); ++j) + { + t_RateType _rt = AbsoluteChange; + + if (toUpper(_value) == "RATECHANGE") + _rt = RateChange; + + if (_digit == "default") // erstmal auf default setzen (falls sonst nichts gesetzt) + { + NUMBERS[j]->RateType = _rt; + } + + if (NUMBERS[j]->name == _digit) + { + NUMBERS[j]->RateType = _rt; + } + } +} + + + void ClassFlowPostProcessing::handleMaxRateValue(string _decsep, string _value) { string _digit, _decpos; @@ -379,6 +412,10 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph) { handleMaxRateValue(zerlegt[0], zerlegt[1]); } + if ((toUpper(_param) == "MAXRATETYPE") && (zerlegt.size() > 1)) + { + handleMaxRateType(zerlegt[0], zerlegt[1]); + } if ((toUpper(_param) == "PREVALUEUSE") && (zerlegt.size() > 1)) { @@ -476,6 +513,7 @@ void ClassFlowPostProcessing::InitNUMBERS() _number->PreValueOkay = false; _number->AllowNegativeRates = false; _number->MaxRateValue = 0.1; + _number->RateType = AbsoluteChange; _number->useMaxRateValue = false; _number->checkDigitIncreaseConsistency = false; _number->DecimalShift = 0; @@ -648,11 +686,17 @@ bool ClassFlowPostProcessing::doFlow(string zwtime) } double difference = difftime(imagetime, NUMBERS[j]->lastvalue); // in Sekunden - difference /= 60; // in Minuten + difference /= 60; NUMBERS[j]->FlowRateAct = (NUMBERS[j]->Value - NUMBERS[j]->PreValue) / difference; NUMBERS[j]->ReturnRateValue = std::to_string(NUMBERS[j]->FlowRateAct); + + float _ratedifference; + if (NUMBERS[j]->RateType == RateChange) + _ratedifference = (NUMBERS[j]->Value - NUMBERS[j]->PreValue) / difference; + else + _ratedifference = (NUMBERS[j]->Value - NUMBERS[j]->PreValue); - if (NUMBERS[j]->useMaxRateValue && (abs(NUMBERS[j]->FlowRateAct) > NUMBERS[j]->MaxRateValue)) + if (NUMBERS[j]->useMaxRateValue && (abs(_ratedifference) > NUMBERS[j]->MaxRateValue)) { NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "Rate too high - Read: " + RundeOutput(NUMBERS[j]->Value, NUMBERS[j]->Nachkomma) + " - Pre: " + RundeOutput(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma); NUMBERS[j]->Value = NUMBERS[j]->PreValue; @@ -820,14 +864,14 @@ float ClassFlowPostProcessing::checkDigitConsistency(float input, int _decilamsh while (pot <= pot_max) { zw = input / pow(10, pot-1); - aktdigit_before = ((int) zw + 10) % 10; + aktdigit_before = ((int) round(zw) + 10) % 10; zw = _preValue / pow(10, pot-1); - olddigit_before = ((int) zw + 10) % 10; + olddigit_before = ((int) round(zw) + 10) % 10; zw = input / pow(10, pot); - aktdigit = ((int) zw + 10) % 10; + aktdigit = ((int) round(zw) + 10) % 10; zw = _preValue / pow(10, pot); - olddigit = ((int) zw + 10) % 10; + olddigit = ((int) round(zw) + 10) % 10; no_nulldurchgang = (olddigit_before <= aktdigit_before); diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h index 23a87124..aa50a85c 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h @@ -8,6 +8,7 @@ #include + class ClassFlowPostProcessing : public ClassFlow { @@ -38,7 +39,9 @@ protected: void InitNUMBERS(); void handleDecimalSeparator(string _decsep, string _value); void handleMaxRateValue(string _decsep, string _value); - void handleDecimalExtendedResolution(string _decsep, string _value); + void handleDecimalExtendedResolution(string _decsep, string _value); + void handleMaxRateType(string _decsep, string _value); + diff --git a/code/main/version.cpp b/code/main/version.cpp index 39c8a9f3..1fa4205c 100644 --- a/code/main/version.cpp +++ b/code/main/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="ac3409f"; +const char* GIT_REV="45a7198"; const char* GIT_TAG=""; const char* GIT_BRANCH="rolling"; -const char* BUILD_TIME="2022-02-08 19:19"; \ No newline at end of file +const char* BUILD_TIME="2022-02-11 20:05"; \ No newline at end of file diff --git a/code/version.cpp b/code/version.cpp index 39c8a9f3..1fa4205c 100644 --- a/code/version.cpp +++ b/code/version.cpp @@ -1,4 +1,4 @@ -const char* GIT_REV="ac3409f"; +const char* GIT_REV="45a7198"; const char* GIT_TAG=""; const char* GIT_BRANCH="rolling"; -const char* BUILD_TIME="2022-02-08 19:19"; \ No newline at end of file +const char* BUILD_TIME="2022-02-11 20:05"; \ No newline at end of file diff --git a/firmware/ana-s1-q-20220129.tflite b/firmware/ana-s1-q-20220129.tflite deleted file mode 100644 index c3e4a6ee..00000000 Binary files a/firmware/ana-s1-q-20220129.tflite and /dev/null differ diff --git a/firmware/ana-s3-q-20220105.tflite b/firmware/ana-s3-q-20220105.tflite new file mode 100644 index 00000000..5718b1ec Binary files /dev/null and b/firmware/ana-s3-q-20220105.tflite differ diff --git a/firmware/bootloader.bin b/firmware/bootloader.bin index c90624d9..44312d4d 100644 Binary files a/firmware/bootloader.bin and b/firmware/bootloader.bin differ diff --git a/firmware/dig-s1-q-20220206.tflite b/firmware/dig-s1-q-20220206.tflite deleted file mode 100644 index 077e2c70..00000000 Binary files a/firmware/dig-s1-q-20220206.tflite and /dev/null differ diff --git a/firmware/dig-s2-q-20220211.tflite b/firmware/dig-s2-q-20220211.tflite new file mode 100644 index 00000000..26cb56eb Binary files /dev/null and b/firmware/dig-s2-q-20220211.tflite differ diff --git a/firmware/firmware.bin b/firmware/firmware.bin index 57eae964..0c52f7df 100644 Binary files a/firmware/firmware.bin and b/firmware/firmware.bin differ diff --git a/firmware/html.zip b/firmware/html.zip index 160f9642..dac0c892 100644 Binary files a/firmware/html.zip and b/firmware/html.zip differ diff --git a/sd-card/config/config.ini b/sd-card/config/config.ini index 224c5988..9c3c1005 100644 --- a/sd-card/config/config.ini +++ b/sd-card/config/config.ini @@ -21,7 +21,7 @@ FlipImageSize = false /config/ref1.jpg 442 142 [Digits] -Model = /config/dig-s1-q-20220206.tflite +Model = /config/dig-s2-q-20220211.tflite ;LogImageLocation = /log/digit ;LogfileRetentionInDays = 3 ModelInputSize = 20 32 diff --git a/sd-card/config/dig-s1-q-20220206.tflite b/sd-card/config/dig-s1-q-20220206.tflite deleted file mode 100644 index 077e2c70..00000000 Binary files a/sd-card/config/dig-s1-q-20220206.tflite and /dev/null differ diff --git a/sd-card/config/dig-s2-q-20220211.tflite b/sd-card/config/dig-s2-q-20220211.tflite new file mode 100644 index 00000000..26cb56eb Binary files /dev/null and b/sd-card/config/dig-s2-q-20220211.tflite differ diff --git a/sd-card/html/edit_config_param.html b/sd-card/html/edit_config_param.html index 5e50f47d..1c9a6a2b 100644 --- a/sd-card/html/edit_config_param.html +++ b/sd-card/html/edit_config_param.html @@ -503,7 +503,24 @@ textarea { - Maximum change of reading per minute + Maximum change of a reading - if threated as absolute or relative change see next parameter. + + + + + + + + MaxRateType + + + + + + Defines if the change rate compared to the previous value is calculated as absolute change (AbsoluteChange) or as rate normalized to the intervall (RateChange = change/minute). @@ -1697,6 +1714,7 @@ function UpdateInputIndividual() { ReadParameter(param, "PostProcessing", "DecimalShift", true, NUNBERSAkt) ReadParameter(param, "PostProcessing", "MaxRateValue", true, NUNBERSAkt) + ReadParameter(param, "PostProcessing", "MaxRateType", true, NUNBERSAkt) ReadParameter(param, "PostProcessing", "ExtendedResolution", true, NUNBERSAkt) ReadParameter(param, "PostProcessing", "IgnoreLeadingNaN", true, NUNBERSAkt) } @@ -1705,6 +1723,7 @@ function UpdateInputIndividual() NUNBERSAkt = sel.selectedIndex; WriteParameter(param, category, "PostProcessing", "DecimalShift", true, NUNBERSAkt); WriteParameter(param, category, "PostProcessing", "MaxRateValue", true, NUNBERSAkt); + WriteParameter(param, category, "PostProcessing", "MaxRateType", true, NUNBERSAkt); WriteParameter(param, category, "PostProcessing", "ExtendedResolution", true, NUNBERSAkt); WriteParameter(param, category, "PostProcessing", "IgnoreLeadingNaN", true, NUNBERSAkt); } diff --git a/sd-card/html/gethost.js b/sd-card/html/gethost.js index 101660e0..751e4b11 100644 --- a/sd-card/html/gethost.js +++ b/sd-card/html/gethost.js @@ -13,7 +13,7 @@ function getbasepath(){ { // host = "http://192.168.2.219"; // jomjol interner test // host = "http://192.168.178.46"; // jomjol interner test - host = "http://192.168.178.60"; // jomjol interner Real + host = "http://192.168.178.62"; // jomjol interner Real // host = "http://192.168.43.191"; // host = "."; // jomjol interner localhost diff --git a/sd-card/html/readconfigparam.js b/sd-card/html/readconfigparam.js index 1b16a681..adaf490c 100644 --- a/sd-card/html/readconfigparam.js +++ b/sd-card/html/readconfigparam.js @@ -107,6 +107,7 @@ function ParseConfig() { ParamAddValue(param, catname, "PreValueAgeStartup"); ParamAddValue(param, catname, "AllowNegativeRates"); ParamAddValue(param, catname, "MaxRateValue", 1, true); + ParamAddValue(param, catname, "MaxRateType", 1, true); ParamAddValue(param, catname, "ExtendedResolution", 1, true); ParamAddValue(param, catname, "IgnoreLeadingNaN", 1, true); ParamAddValue(param, catname, "ErrorMessage"); diff --git a/sd-card/html/version.txt b/sd-card/html/version.txt index 70045d3c..03c39bfe 100644 --- a/sd-card/html/version.txt +++ b/sd-card/html/version.txt @@ -1 +1 @@ -13.0.0 \ No newline at end of file +13.1.0 \ No newline at end of file