Rolling 20220211

This commit is contained in:
jomjol
2022-02-11 21:38:40 +01:00
parent 45a71981c8
commit 379f4585e3
22 changed files with 124 additions and 54 deletions

View File

@@ -54,7 +54,12 @@ In other cases you can contact the developer via email: <img src="https://raw.gi
##### Rolling (2022-02-08) ##### Rolling (2022-02-11)
- Updated digital neural network file (`dig-s2-q-20220211.tflite`)
- Corrected rounding in `CheckDigitIncreaseConsistency` algorithm
Rolling (2022-02-08)
- added Wifi RSSI to MQTT information - added Wifi RSSI to MQTT information

View File

@@ -21,22 +21,12 @@ ClassFlowCNNGeneral::ClassFlowCNNGeneral(ClassFlowAlignment *_flowalign, t_CNNTy
previousElement = NULL; previousElement = NULL;
SaveAllFiles = false; SaveAllFiles = false;
disabled = false; disabled = false;
// extendedResolution = false;
isLogImageSelect = false; isLogImageSelect = false;
CNNType = AutoDetect; CNNType = AutoDetect;
CNNType = _cnntype; CNNType = _cnntype;
flowpostalignment = _flowalign; flowpostalignment = _flowalign;
} }
/*
int ClassFlowCNNGeneral::AnzahlROIs(int _analog = 0)
{
int zw = GENERAL[_analog]->ROI.size();
if (extendedResolution && (CNNType != Digital)) zw++; // da letzte Ziffer inkl Nachhkomma, es sei denn, das Nachkomma gibt es nicht (Digital)
return zw;
}
*/
string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution = false) string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution = false)
{ {
string result = ""; string result = "";
@@ -78,7 +68,6 @@ string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution
if (CNNType == DigitalHyprid) if (CNNType == DigitalHyprid)
{ {
// int ergebnis_nachkomma = -1;
int zif_akt = -1; int zif_akt = -1;
float zahl = GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result_float; float zahl = GENERAL[_analog]->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 ClassFlowCNNGeneral::ZeigerEvalHybrid(float zahl, float zahl_vorgaenger, int eval_vorgaenger)
{ {
int ergebnis_nachkomma = ((int) floor(zahl * 10)) % 10; 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 if (zahl_vorgaenger < 0) // keine Vorzahl vorhanden !!! --> Runde die Zahl
{ {
@@ -206,13 +194,6 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph)
) // Paragraph passt nicht ) // Paragraph passt nicht
return false; 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] == ';') if (aktparamgraph[0] == ';')
{ {
disabled = true; disabled = true;
@@ -273,14 +254,6 @@ bool ClassFlowCNNGeneral::ReadParameter(FILE* pfile, string& aktparamgraph)
if (toUpper(zerlegt[1]) == "TRUE") if (toUpper(zerlegt[1]) == "TRUE")
SaveAllFiles = 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) general* ClassFlowCNNGeneral::GetGENERAL(string _name, bool _create = true)
{ {
string _analog, _roi; string _analog, _roi;
@@ -338,6 +310,7 @@ general* ClassFlowCNNGeneral::GetGENERAL(string _name, bool _create = true)
roi* neuroi = new roi; roi* neuroi = new roi;
neuroi->name = _roi; neuroi->name = _roi;
_ret->ROI.push_back(neuroi); _ret->ROI.push_back(neuroi);
printf("GetGENERAL - GENERAL %s - roi %s\n", _analog.c_str(), _roi.c_str()); printf("GetGENERAL - GENERAL %s - roi %s\n", _analog.c_str(), _roi.c_str());
@@ -482,6 +455,10 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time)
CNNType = Digital; CNNType = Digital;
printf("TFlite-Type set to Digital\n"); printf("TFlite-Type set to Digital\n");
break; break;
case 20:
CNNType = DigitalHyprid10;
printf("TFlite-Type set to DigitalHyprid10\n");
break;
case 22: case 22:
CNNType = DigitalHyprid; CNNType = DigitalHyprid;
printf("TFlite-Type set to DigitalHyprid\n"); printf("TFlite-Type set to DigitalHyprid\n");
@@ -489,7 +466,6 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time)
default: default:
printf("ERROR ERROR ERROR - tflite passt nicht zur Firmware - ERROR ERROR ERROR\n"); printf("ERROR ERROR ERROR - tflite passt nicht zur Firmware - ERROR ERROR ERROR\n");
} }
// flowpostprocessing->UpdateNachkommaDecimalShift();
} }
for (int _ana = 0; _ana < GENERAL.size(); ++_ana) 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); _zwres = "Result General(DigitalHyprid)" + to_string(i) + ": " + to_string(GENERAL[_ana]->ROI[i]->result_float);
if (debugdetailgeneral) LogFile.WriteToFile(_zwres); 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) if (isLogImage)
LogImage(logPath, GENERAL[_ana]->ROI[i]->name, &GENERAL[_ana]->ROI[i]->result_float, NULL, time, GENERAL[_ana]->ROI[i]->image_org); LogImage(logPath, GENERAL[_ana]->ROI[i]->name, &GENERAL[_ana]->ROI[i]->result_float, NULL, time, GENERAL[_ana]->ROI[i]->image_org);
} break; } break;
@@ -575,7 +575,6 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time)
bool ClassFlowCNNGeneral::isExtendedResolution(int _number) bool ClassFlowCNNGeneral::isExtendedResolution(int _number)
{ {
// if (extendedResolution && !(CNNType == Digital))
if (!(CNNType == Digital)) if (!(CNNType == Digital))
return true; return true;
@@ -616,13 +615,9 @@ std::vector<HTMLInfo*> ClassFlowCNNGeneral::GetHTMLInfo()
zw->image = GENERAL[_ana]->ROI[i]->image; zw->image = GENERAL[_ana]->ROI[i]->image;
zw->image_org = GENERAL[_ana]->ROI[i]->image_org; zw->image_org = GENERAL[_ana]->ROI[i]->image_org;
// printf("Push %s\n", zw->filename.c_str());
result.push_back(zw); result.push_back(zw);
} }
// printf("größe: %d\n", result.size());
return result; return result;
} }

View File

@@ -3,7 +3,6 @@
#include"ClassFlowDefineTypes.h" #include"ClassFlowDefineTypes.h"
#include "ClassFlowAlignment.h" #include "ClassFlowAlignment.h"
// #include "ClassFlowPostProcessing.h"
enum t_CNNType { enum t_CNNType {
@@ -11,6 +10,7 @@ enum t_CNNType {
Analogue, Analogue,
Digital, Digital,
DigitalHyprid, DigitalHyprid,
DigitalHyprid10,
None None
}; };
@@ -50,7 +50,6 @@ public:
std::vector<HTMLInfo*> GetHTMLInfo(); std::vector<HTMLInfo*> GetHTMLInfo();
// int AnzahlROIs(int _analog);
int getAnzahlGENERAL(); int getAnzahlGENERAL();
general* GetGENERAL(int _analog); general* GetGENERAL(int _analog);
general* GetGENERAL(string _name, bool _create); general* GetGENERAL(string _name, bool _create);
@@ -59,8 +58,6 @@ public:
bool isExtendedResolution(int _number = 0); bool isExtendedResolution(int _number = 0);
// void setPostprocessing(ClassFlowPostProcessing *_fpp){flowpostprocessing = _fpp;};
void UpdateNameNumbers(std::vector<std::string> *_name_numbers); void UpdateNameNumbers(std::vector<std::string> *_name_numbers);
t_CNNType getCNNType(){return CNNType;}; t_CNNType getCNNType(){return CNNType;};

View File

@@ -16,10 +16,16 @@ struct general {
std::vector<roi*> ROI; std::vector<roi*> ROI;
}; };
enum t_RateType {
AbsoluteChange,
RateChange
};
struct NumberPost { struct NumberPost {
float MaxRateValue; float MaxRateValue;
bool useMaxRateValue; bool useMaxRateValue;
t_RateType RateType;
bool ErrorMessage; bool ErrorMessage;
bool PreValueOkay; bool PreValueOkay;
bool AllowNegativeRates; bool AllowNegativeRates;

View File

@@ -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) void ClassFlowPostProcessing::handleMaxRateValue(string _decsep, string _value)
{ {
string _digit, _decpos; string _digit, _decpos;
@@ -379,6 +412,10 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
{ {
handleMaxRateValue(zerlegt[0], zerlegt[1]); handleMaxRateValue(zerlegt[0], zerlegt[1]);
} }
if ((toUpper(_param) == "MAXRATETYPE") && (zerlegt.size() > 1))
{
handleMaxRateType(zerlegt[0], zerlegt[1]);
}
if ((toUpper(_param) == "PREVALUEUSE") && (zerlegt.size() > 1)) if ((toUpper(_param) == "PREVALUEUSE") && (zerlegt.size() > 1))
{ {
@@ -476,6 +513,7 @@ void ClassFlowPostProcessing::InitNUMBERS()
_number->PreValueOkay = false; _number->PreValueOkay = false;
_number->AllowNegativeRates = false; _number->AllowNegativeRates = false;
_number->MaxRateValue = 0.1; _number->MaxRateValue = 0.1;
_number->RateType = AbsoluteChange;
_number->useMaxRateValue = false; _number->useMaxRateValue = false;
_number->checkDigitIncreaseConsistency = false; _number->checkDigitIncreaseConsistency = false;
_number->DecimalShift = 0; _number->DecimalShift = 0;
@@ -648,11 +686,17 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
} }
double difference = difftime(imagetime, NUMBERS[j]->lastvalue); // in Sekunden 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]->FlowRateAct = (NUMBERS[j]->Value - NUMBERS[j]->PreValue) / difference;
NUMBERS[j]->ReturnRateValue = std::to_string(NUMBERS[j]->FlowRateAct); 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]->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; NUMBERS[j]->Value = NUMBERS[j]->PreValue;
@@ -820,14 +864,14 @@ float ClassFlowPostProcessing::checkDigitConsistency(float input, int _decilamsh
while (pot <= pot_max) while (pot <= pot_max)
{ {
zw = input / pow(10, pot-1); 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); zw = _preValue / pow(10, pot-1);
olddigit_before = ((int) zw + 10) % 10; olddigit_before = ((int) round(zw) + 10) % 10;
zw = input / pow(10, pot); zw = input / pow(10, pot);
aktdigit = ((int) zw + 10) % 10; aktdigit = ((int) round(zw) + 10) % 10;
zw = _preValue / pow(10, pot); zw = _preValue / pow(10, pot);
olddigit = ((int) zw + 10) % 10; olddigit = ((int) round(zw) + 10) % 10;
no_nulldurchgang = (olddigit_before <= aktdigit_before); no_nulldurchgang = (olddigit_before <= aktdigit_before);

View File

@@ -8,6 +8,7 @@
#include <string> #include <string>
class ClassFlowPostProcessing : class ClassFlowPostProcessing :
public ClassFlow public ClassFlow
{ {
@@ -38,7 +39,9 @@ protected:
void InitNUMBERS(); void InitNUMBERS();
void handleDecimalSeparator(string _decsep, string _value); void handleDecimalSeparator(string _decsep, string _value);
void handleMaxRateValue(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);

View File

@@ -1,4 +1,4 @@
const char* GIT_REV="ac3409f"; const char* GIT_REV="45a7198";
const char* GIT_TAG=""; const char* GIT_TAG="";
const char* GIT_BRANCH="rolling"; const char* GIT_BRANCH="rolling";
const char* BUILD_TIME="2022-02-08 19:19"; const char* BUILD_TIME="2022-02-11 20:05";

View File

@@ -1,4 +1,4 @@
const char* GIT_REV="ac3409f"; const char* GIT_REV="45a7198";
const char* GIT_TAG=""; const char* GIT_TAG="";
const char* GIT_BRANCH="rolling"; const char* GIT_BRANCH="rolling";
const char* BUILD_TIME="2022-02-08 19:19"; const char* BUILD_TIME="2022-02-11 20:05";

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -21,7 +21,7 @@ FlipImageSize = false
/config/ref1.jpg 442 142 /config/ref1.jpg 442 142
[Digits] [Digits]
Model = /config/dig-s1-q-20220206.tflite Model = /config/dig-s2-q-20220211.tflite
;LogImageLocation = /log/digit ;LogImageLocation = /log/digit
;LogfileRetentionInDays = 3 ;LogfileRetentionInDays = 3
ModelInputSize = 20 32 ModelInputSize = 20 32

Binary file not shown.

View File

@@ -503,7 +503,24 @@ textarea {
<input type="number" id="PostProcessing_MaxRateValue_value1" size="13" min="0" step="any"> <input type="number" id="PostProcessing_MaxRateValue_value1" size="13" min="0" step="any">
</td> </td>
<td style="font-size: 80%;"> <td style="font-size: 80%;">
Maximum change of reading per minute Maximum change of a reading - if threated as absolute or relative change see next parameter.
</td>
</tr>
<tr>
<td width="20px" style="padding-left: 40px;">
<input type="checkbox" id="PostProcessing_MaxRateType_enabled" value="1" onclick = 'InvertEnableItem("PostProcessing", "MaxRateType")' unchecked >
</td>
<td width="200px">
<class id="PostProcessing_MaxRateType_text" style="color:black;">MaxRateType</class>
</td>
<td>
<select id="PostProcessing_MaxRateType_value1">
<option value="AbsoluteChange" >AbsoluteChange</option>
<option value="RateChange" selected>RateChange</option>
</select>
</td>
<td style="font-size: 80%;">
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).
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -1697,6 +1714,7 @@ function UpdateInputIndividual()
{ {
ReadParameter(param, "PostProcessing", "DecimalShift", true, NUNBERSAkt) ReadParameter(param, "PostProcessing", "DecimalShift", true, NUNBERSAkt)
ReadParameter(param, "PostProcessing", "MaxRateValue", true, NUNBERSAkt) ReadParameter(param, "PostProcessing", "MaxRateValue", true, NUNBERSAkt)
ReadParameter(param, "PostProcessing", "MaxRateType", true, NUNBERSAkt)
ReadParameter(param, "PostProcessing", "ExtendedResolution", true, NUNBERSAkt) ReadParameter(param, "PostProcessing", "ExtendedResolution", true, NUNBERSAkt)
ReadParameter(param, "PostProcessing", "IgnoreLeadingNaN", true, NUNBERSAkt) ReadParameter(param, "PostProcessing", "IgnoreLeadingNaN", true, NUNBERSAkt)
} }
@@ -1705,6 +1723,7 @@ function UpdateInputIndividual()
NUNBERSAkt = sel.selectedIndex; NUNBERSAkt = sel.selectedIndex;
WriteParameter(param, category, "PostProcessing", "DecimalShift", true, NUNBERSAkt); WriteParameter(param, category, "PostProcessing", "DecimalShift", true, NUNBERSAkt);
WriteParameter(param, category, "PostProcessing", "MaxRateValue", 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", "ExtendedResolution", true, NUNBERSAkt);
WriteParameter(param, category, "PostProcessing", "IgnoreLeadingNaN", true, NUNBERSAkt); WriteParameter(param, category, "PostProcessing", "IgnoreLeadingNaN", true, NUNBERSAkt);
} }

View File

@@ -13,7 +13,7 @@ function getbasepath(){
{ {
// host = "http://192.168.2.219"; // jomjol interner test // host = "http://192.168.2.219"; // jomjol interner test
// host = "http://192.168.178.46"; // 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 = "http://192.168.43.191";
// host = "."; // jomjol interner localhost // host = "."; // jomjol interner localhost

View File

@@ -107,6 +107,7 @@ function ParseConfig() {
ParamAddValue(param, catname, "PreValueAgeStartup"); ParamAddValue(param, catname, "PreValueAgeStartup");
ParamAddValue(param, catname, "AllowNegativeRates"); ParamAddValue(param, catname, "AllowNegativeRates");
ParamAddValue(param, catname, "MaxRateValue", 1, true); ParamAddValue(param, catname, "MaxRateValue", 1, true);
ParamAddValue(param, catname, "MaxRateType", 1, true);
ParamAddValue(param, catname, "ExtendedResolution", 1, true); ParamAddValue(param, catname, "ExtendedResolution", 1, true);
ParamAddValue(param, catname, "IgnoreLeadingNaN", 1, true); ParamAddValue(param, catname, "IgnoreLeadingNaN", 1, true);
ParamAddValue(param, catname, "ErrorMessage"); ParamAddValue(param, catname, "ErrorMessage");

View File

@@ -1 +1 @@
13.0.0 13.1.0