Renamed digital to digit (#3219)

* renamed Digital to Digit

* added param migration

* Update .github/label-commenter-config.yaml

* renamed AnalogDigitTransition* to AnalogToDigitTransition*

---------

Co-authored-by: CaCO3 <caco@ruinelli.ch>
This commit is contained in:
CaCO3
2024-09-29 22:10:10 +02:00
committed by GitHub
parent 5496573369
commit f6bdd48bca
35 changed files with 228 additions and 236 deletions

View File

@@ -243,7 +243,7 @@ bool ClassFlowAlignment::doFlow(string time)
DrawRef(ImageTMP);
}
flowctrl.DigitalDrawROI(ImageTMP);
flowctrl.DigitDrawROI(ImageTMP);
flowctrl.AnalogDrawROI(ImageTMP);
ImageTMP->writeToMemoryAsJPG((ImageData *)AlgROI, 90);
}

View File

@@ -35,7 +35,7 @@ ClassFlowCNNGeneral::ClassFlowCNNGeneral(ClassFlowAlignment *_flowalign, t_CNNTy
imagesRetention = 5;
}
string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution, int prev, float _before_narrow_Analog, float analogDigitalTransitionStart) {
string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution, int prev, float _before_narrow_Analog, float AnalogToDigitTransitionStart) {
string result = "";
if (GENERAL[_analog]->ROI.size() == 0) {
@@ -63,7 +63,7 @@ string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution
return result;
}
if (CNNType == Digital) {
if (CNNType == Digit) {
for (int i = 0; i < GENERAL[_analog]->ROI.size(); ++i) {
if (GENERAL[_analog]->ROI[i]->result_klasse >= 10) {
result = result + "N";
@@ -75,7 +75,7 @@ string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution
return result;
}
if ((CNNType == DoubleHyprid10) || (CNNType == Digital100)) {
if ((CNNType == DoubleHyprid10) || (CNNType == Digit100)) {
float number = GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result_float;
// NaN?
if (number >= 0) {
@@ -90,7 +90,7 @@ string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution
}
else {
if (_before_narrow_Analog >= 0) {
prev = PointerEvalHybridNew(GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result_float, _before_narrow_Analog, prev, true, analogDigitalTransitionStart);
prev = PointerEvalHybridNew(GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result_float, _before_narrow_Analog, prev, true, AnalogToDigitTransitionStart);
}
else {
prev = PointerEvalHybridNew(GENERAL[_analog]->ROI[GENERAL[_analog]->ROI.size() - 1]->result_float, prev, prev);
@@ -101,7 +101,7 @@ string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution
}
else {
result = "N";
if (_extendedResolution && (CNNType != Digital)) {
if (_extendedResolution && (CNNType != Digit)) {
result = "NN";
}
}
@@ -135,13 +135,13 @@ string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution
* 0.1 => 0 (eval_predecessors)
* The 0 makes a 9.9 to 0 (eval_predecessors)
* The 0 makes a 9.8 to 0
* @param Analog_Predecessors false/true if the last ROI is an analog or digital ROI (default=false)
* @param Analog_Predecessors false/true if the last ROI is an analog or digit ROI (default=false)
* runs in special handling because analog is much less precise
* @param digitalAnalogTransitionStart start of the transitionlogic begins on number_of_predecessor (default=9.2)
* @param digitAnalogTransitionStart start of the transitionlogic begins on number_of_predecessor (default=9.2)
*
* @return int the determined number of the current ROI
*/
int ClassFlowCNNGeneral::PointerEvalHybridNew(float number, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors, float digitalAnalogTransitionStart) {
int ClassFlowCNNGeneral::PointerEvalHybridNew(float number, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors, float digitAnalogTransitionStart) {
int result;
int result_after_decimal_point = ((int) floor(number * 10)) % 10;
int result_before_decimal_point = ((int) floor(number) + 10) % 10;
@@ -153,21 +153,21 @@ int ClassFlowCNNGeneral::PointerEvalHybridNew(float number, float number_of_pred
result = (int) ((int) trunc(round((number+10 % 10)*100)) ) / 100;
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - No predecessor - Result = " + std::to_string(result) +
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digital_Uncertainty = " + std::to_string(Digital_Uncertainty));
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digit_Uncertainty = " + std::to_string(Digit_Uncertainty));
return result;
}
if (Analog_Predecessors) {
result = PointerEvalAnalogToDigitNew(number, number_of_predecessors, eval_predecessors, digitalAnalogTransitionStart);
result = PointerEvalAnalogToDigitNew(number, number_of_predecessors, eval_predecessors, digitAnalogTransitionStart);
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - Analog predecessor, evaluation over PointerEvalAnalogNew = " + std::to_string(result) +
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digital_Uncertainty = " + std::to_string(Digital_Uncertainty));
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digit_Uncertainty = " + std::to_string(Digit_Uncertainty));
return result;
}
if ((number_of_predecessors >= Digital_Transition_Area_Predecessor ) && (number_of_predecessors <= (10.0 - Digital_Transition_Area_Predecessor))) {
// no digit change, because predecessor is far enough away (0+/-DigitalTransitionRangePredecessor) --> number is rounded
if ((number_of_predecessors >= Digit_Transition_Area_Predecessor ) && (number_of_predecessors <= (10.0 - Digit_Transition_Area_Predecessor))) {
// no digit change, because predecessor is far enough away (0+/-DigitTransitionRangePredecessor) --> number is rounded
// Band around the digit --> Round off, as digit reaches inaccuracy in the frame
if ((result_after_decimal_point <= DigitalBand) || (result_after_decimal_point >= (10-DigitalBand))) {
if ((result_after_decimal_point <= DigitBand) || (result_after_decimal_point >= (10-DigitBand))) {
result = ((int) round(number) + 10) % 10;
}
else {
@@ -175,7 +175,7 @@ int ClassFlowCNNGeneral::PointerEvalHybridNew(float number, float number_of_pred
}
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - NO analogue predecessor, no change of digits, as pre-decimal point far enough away = " + std::to_string(result) +
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digital_Uncertainty = " + std::to_string(Digital_Uncertainty));
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digit_Uncertainty = " + std::to_string(Digit_Uncertainty));
return result;
}
@@ -192,16 +192,16 @@ int ClassFlowCNNGeneral::PointerEvalHybridNew(float number, float number_of_pred
result = result_before_decimal_point % 10;
}
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - NO analogue predecessor, zero crossing has taken placen = " + std::to_string(result) +
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digital_Uncertainty = " + std::to_string(Digital_Uncertainty));
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digit_Uncertainty = " + std::to_string(Digit_Uncertainty));
return result;
}
// remains only >= 9.x --> no zero crossing yet --> 2.8 --> 2,
// and from 9.7(DigitalTransitionRangeLead) 3.1 --> 2
// and from 9.7(DigitTransitionRangeLead) 3.1 --> 2
// everything >=x.4 can be considered as current number in transition. With 9.x predecessor the current
// number can still be x.6 - x.7.
// Preceding (else - branch) does not already happen from 9.
if (Digital_Transition_Area_Forward>=number_of_predecessors || result_after_decimal_point >= 4) {
if (Digit_Transition_Area_Forward>=number_of_predecessors || result_after_decimal_point >= 4) {
// The current digit, like the previous digit, does not yet have a zero crossing.
result = result_before_decimal_point % 10;
}
@@ -212,39 +212,39 @@ int ClassFlowCNNGeneral::PointerEvalHybridNew(float number, float number_of_pred
}
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalHybridNew - O analogue predecessor, >= 9.5 --> no zero crossing yet = " + std::to_string(result) +
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digital_Uncertainty = " + std::to_string(Digital_Uncertainty) + " result_after_decimal_point = " + std::to_string(result_after_decimal_point));
" number: " + std::to_string(number) + " number_of_predecessors = " + std::to_string(number_of_predecessors)+ " eval_predecessors = " + std::to_string(eval_predecessors) + " Digit_Uncertainty = " + std::to_string(Digit_Uncertainty) + " result_after_decimal_point = " + std::to_string(result_after_decimal_point));
return result;
}
int ClassFlowCNNGeneral::PointerEvalAnalogToDigitNew(float number, float numeral_preceder, int eval_predecessors, float analogDigitalTransitionStart) {
int ClassFlowCNNGeneral::PointerEvalAnalogToDigitNew(float number, float numeral_preceder, int eval_predecessors, float AnalogToDigitTransitionStart) {
int result;
int result_after_decimal_point = ((int) floor(number * 10)) % 10;
int result_before_decimal_point = ((int) floor(number) + 10) % 10;
bool roundedUp = false;
// Within the digital inequalities
if ((result_after_decimal_point >= (10-Digital_Uncertainty * 10)) // Band around the digit --> Round off, as digit reaches inaccuracy in the frame
// Within the digit inequalities
if ((result_after_decimal_point >= (10-Digit_Uncertainty * 10)) // Band around the digit --> Round off, as digit reaches inaccuracy in the frame
|| (eval_predecessors <= 4 && result_after_decimal_point>=6)) { // or digit runs after (analogue =0..4, digit >=6)
result = (int) (round(number) + 10) % 10;
roundedUp = true;
// before/ after decimal point, because we adjust the number based on the uncertainty.
result_after_decimal_point = ((int) floor(result * 10)) % 10;
result_before_decimal_point = ((int) floor(result) + 10) % 10;
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigitNew - Digital Uncertainty - Result = " + std::to_string(result) +
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigitNew - Digit Uncertainty - Result = " + std::to_string(result) +
" number: " + std::to_string(number) + " numeral_preceder: " + std::to_string(numeral_preceder) +
" erg before comma: " + std::to_string(result_before_decimal_point) +
" erg after comma: " + std::to_string(result_after_decimal_point));
}
else {
result = (int) ((int) trunc(number) + 10) % 10;
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigitNew - NO digital Uncertainty - Result = " + std::to_string(result) +
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigitNew - NO digit Uncertainty - Result = " + std::to_string(result) +
" number: " + std::to_string(number) + " numeral_preceder = " + std::to_string(numeral_preceder));
}
// No zero crossing has taken place.
// Only eval_predecessors used because numeral_preceder could be wrong here.
// numeral_preceder<=0.1 & eval_predecessors=9 corresponds to analogue was reset because of previous analogue that are not yet at 0.
if ((eval_predecessors>=6 && (numeral_preceder>analogDigitalTransitionStart || numeral_preceder<=0.2) && roundedUp)) {
if ((eval_predecessors>=6 && (numeral_preceder>AnalogToDigitTransitionStart || numeral_preceder<=0.2) && roundedUp)) {
result = ((result_before_decimal_point+10) - 1) % 10;
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "PointerEvalAnalogToDigitNew - Nulldurchgang noch nicht stattgefunden = " + std::to_string(result) +
" number: " + std::to_string(number) +
@@ -593,17 +593,17 @@ bool ClassFlowCNNGeneral::getNetworkParameter() {
ESP_LOGD(TAG, "TFlite-Type set to DoubleHyprid10");
break;
case 11:
CNNType = Digital;
ESP_LOGD(TAG, "TFlite-Type set to Digital");
CNNType = Digit;
ESP_LOGD(TAG, "TFlite-Type set to Digit");
break;
/* case 20:
CNNType = DigitalHyprid10;
ESP_LOGD(TAG, "TFlite-Type set to DigitalHyprid10");
CNNType = DigitHyprid10;
ESP_LOGD(TAG, "TFlite-Type set to DigitHyprid10");
break;
*/
// case 22:
// CNNType = DigitalHyprid;
// ESP_LOGD(TAG, "TFlite-Type set to DigitalHyprid");
// CNNType = DigitHyprid;
// ESP_LOGD(TAG, "TFlite-Type set to DigitHyprid");
// break;
case 100:
if (modelxsize==32 && modelysize == 32) {
@@ -611,8 +611,8 @@ bool ClassFlowCNNGeneral::getNetworkParameter() {
ESP_LOGD(TAG, "TFlite-Type set to Analogue100");
}
else {
CNNType = Digital100;
ESP_LOGD(TAG, "TFlite-Type set to Digital");
CNNType = Digit100;
ESP_LOGD(TAG, "TFlite-Type set to Digit");
}
break;
default:
@@ -686,8 +686,8 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time) {
}
} break;
case Digital:
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: Digital");
case Digit:
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: Digit");
{
GENERAL[n]->ROI[roi]->result_klasse = 0;
GENERAL[n]->ROI[roi]->result_klasse = tflite->GetClassFromImageBasis(GENERAL[n]->ROI[roi]->image);
@@ -778,10 +778,10 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time) {
}
}
} break;
case Digital100:
case Digit100:
case Analogue100:
{
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: Digital100 or Analogue100");
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "CNN Type: Digit100 or Analogue100");
int _num;
float _result_save_file;
@@ -829,7 +829,7 @@ bool ClassFlowCNNGeneral::doNeuralNetwork(string time) {
}
bool ClassFlowCNNGeneral::isExtendedResolution(int _number) {
if (CNNType == Digital) {
if (CNNType == Digit) {
return false;
}
@@ -861,7 +861,7 @@ std::vector<HTMLInfo*> ClassFlowCNNGeneral::GetHTMLInfo() {
zw->filename_org = GENERAL[_ana]->name + "_" + GENERAL[_ana]->ROI[i]->name + ".jpg";
}
if (CNNType == Digital) {
if (CNNType == Digit) {
zw->val = GENERAL[_ana]->ROI[i]->result_klasse;
}
else {
@@ -927,7 +927,7 @@ string ClassFlowCNNGeneral::getReadoutRawString(int _analog)
rt = rt + "," + RundeOutput(GENERAL[_analog]->ROI[i]->result_float, 1);
}
if (CNNType == Digital) {
if (CNNType == Digit) {
if (GENERAL[_analog]->ROI[i]->result_klasse >= 10) {
rt = rt + ",N";
}
@@ -936,7 +936,7 @@ string ClassFlowCNNGeneral::getReadoutRawString(int _analog)
}
}
if ((CNNType == DoubleHyprid10) || (CNNType == Digital100)) {
if ((CNNType == DoubleHyprid10) || (CNNType == Digit100)) {
rt = rt + "," + RundeOutput(GENERAL[_analog]->ROI[i]->result_float, 1);
}
}

View File

@@ -11,10 +11,10 @@ enum t_CNNType {
AutoDetect,
Analogue,
Analogue100,
Digital,
DigitalHyprid10,
Digit,
DigitHyprid10,
DoubleHyprid10,
Digital100,
Digit100,
None
};
@@ -26,15 +26,6 @@ protected:
std::vector<general*> GENERAL;
float CNNGoodThreshold;
//moved to define.h
//float Analog_error = 3.0;
//float AnalogToDigtalFehler = 0.8;
//float Digital_Uncertainty = 0.2;
//int DigitalBand = 3;
//float Digital_Transition_Range_Predecessor = 2;
//float Digital_Transition_Area_Predecessor = 0.7; // 9.3 - 0.7
//float Digital_Transition_Area_Forward = 9.7; // Pre-run zero crossing only happens from approx. 9.7 onwards
string cnnmodelfile;
int modelxsize, modelysize, modelchannel;
bool isLogImageSelect;
@@ -44,8 +35,8 @@ protected:
bool SaveAllFiles;
int PointerEvalAnalogNew(float zahl, int numeral_preceder);
int PointerEvalAnalogToDigitNew(float zahl, float numeral_preceder, int eval_predecessors, float analogDigitalTransitionStart);
int PointerEvalHybridNew(float zahl, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors = false, float analogDigitalTransitionStart=9.2);
int PointerEvalAnalogToDigitNew(float zahl, float numeral_preceder, int eval_predecessors, float AnalogToDigitTransitionStart);
int PointerEvalHybridNew(float zahl, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors = false, float AnalogToDigitTransitionStart=9.2);
@@ -61,7 +52,7 @@ public:
bool doFlow(string time);
string getHTMLSingleStep(string host);
string getReadout(int _analog, bool _extendedResolution = false, int prev = -1, float _before_narrow_Analog = -1, float analogDigitalTransitionStart=9.2);
string getReadout(int _analog, bool _extendedResolution = false, int prev = -1, float _before_narrow_Analog = -1, float AnalogToDigitTransitionStart=9.2);
string getReadoutRawString(int _analog);

View File

@@ -96,7 +96,7 @@ std::string ClassFlowControll::TranslateAktstatus(std::string _input)
}
if (_input.compare("ClassFlowCNNGeneral") == 0) {
return ("Digitalization of ROIs");
return ("Digitization of ROIs");
}
#ifdef ENABLE_MQTT
@@ -126,10 +126,10 @@ std::string ClassFlowControll::TranslateAktstatus(std::string _input)
return "Unkown Status";
}
std::vector<HTMLInfo*> ClassFlowControll::GetAllDigital()
std::vector<HTMLInfo*> ClassFlowControll::GetAllDigit()
{
if (flowdigit) {
ESP_LOGD(TAG, "ClassFlowControll::GetAllDigital - flowdigit != NULL");
ESP_LOGD(TAG, "ClassFlowControll::GetAllDigit - flowdigit != NULL");
return flowdigit->GetHTMLInfo();
}
@@ -147,7 +147,7 @@ std::vector<HTMLInfo*> ClassFlowControll::GetAllAnalog()
return empty;
}
t_CNNType ClassFlowControll::GetTypeDigital()
t_CNNType ClassFlowControll::GetTypeDigit()
{
if (flowdigit) {
return flowdigit->getCNNType();
@@ -166,7 +166,7 @@ t_CNNType ClassFlowControll::GetTypeAnalog()
}
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
void ClassFlowControll::DigitalDrawROI(CImageBasis *_zw)
void ClassFlowControll::DigitDrawROI(CImageBasis *_zw)
{
if (flowdigit) {
flowdigit->DrawROI(_zw);
@@ -326,7 +326,7 @@ void ClassFlowControll::InitFlow(std::string config)
// printf("Name: %s\n", cfc->name().c_str());
if (cfc) {
ESP_LOGD(TAG, "Start ReadParameter (%s)", line.c_str());
ESP_LOGE(TAG, "Start ReadParameter (%s)", line.c_str());
cfc->ReadParameter(pFile, line);
}
else {
@@ -841,8 +841,8 @@ esp_err_t ClassFlowControll::GetJPGStream(std::string _fn, httpd_req_t *req)
else {
std::vector<HTMLInfo*> htmlinfo;
htmlinfo = GetAllDigital();
ESP_LOGD(TAG, "After getClassFlowControll::GetAllDigital");
htmlinfo = GetAllDigit();
ESP_LOGD(TAG, "After getClassFlowControll::GetAllDigit");
for (int i = 0; i < htmlinfo.size(); ++i)
{

View File

@@ -61,7 +61,7 @@ public:
string TranslateAktstatus(std::string _input);
#ifdef ALGROI_LOAD_FROM_MEM_AS_JPG
void DigitalDrawROI(CImageBasis *_zw);
void DigitDrawROI(CImageBasis *_zw);
void AnalogDrawROI(CImageBasis *_zw);
#endif
@@ -77,10 +77,10 @@ public:
std::string* getActStatus();
void setActStatus(std::string _aktstatus);
std::vector<HTMLInfo*> GetAllDigital();
std::vector<HTMLInfo*> GetAllDigit();
std::vector<HTMLInfo*> GetAllAnalog();
t_CNNType GetTypeDigital();
t_CNNType GetTypeDigit();
t_CNNType GetTypeAnalog();
#ifdef ENABLE_MQTT

View File

@@ -33,7 +33,7 @@ enum t_RateType {
/**
* Holds all properties and settings of a sequence. A sequence is a set of digital and/or analog ROIs that are combined to
* Holds all properties and settings of a sequence. A sequence is a set of digit and/or analog ROIs that are combined to
* provide one meter reading (value).
* FIXME: can be renamed to `Sequence`
*/
@@ -60,10 +60,10 @@ struct NumberPost {
string ReturnPreValue; // lastValidValueStr; corrected return value without error message
string ErrorMessageText; // errorMessage; Error message for consistency checks
int AnzahlAnalog; // numAnalogRoi; number of analog ROIs used in this sequence
int AnzahlDigital; // numDigitalRoi; number of digital ROIs used in this sequence
int AnzahlDigit; // numDigitRoi; number of digit ROIs used in this sequence
int DecimalShift; // decimalShift; each increment shifts the decimal separator by one digit; value=value*10^decimalShift; pos. value shifts to the right
int DecimalShiftInitial; // decimalShiftInitial; same as decimalShift but is a const to reset decimalShift after calculations
float AnalogDigitalTransitionStart; // analogDigitalTransitionStartValue; FIXME: need a better description; When is the digit > x.1, i.e. when does it start to tilt?
float AnalogToDigitTransitionStart; // AnalogToDigitTransitionStartValue; FIXME: need a better description; When is the digit > x.1, i.e. when does it start to tilt?
int Nachkomma; // decimalPlaces; usually defined by the number of analog ROIs; affected by DecimalShift
string FieldV1; // influxdbFieldName_v1; Name of the Field in InfluxDBv1
@@ -74,7 +74,7 @@ struct NumberPost {
bool isExtendedResolution; // extendResolution; Adds the decimal place of the least significant analog ROI to the value
general *digit_roi; // digitalRoi; set of digital ROIs for the sequence
general *digit_roi; // digitRoi; set of digit ROIs for the sequence
general *analog_roi; // analogRoi; set of analog ROIs for the sequence
string name; // name; Designation for the sequence

View File

@@ -286,7 +286,7 @@ bool ClassFlowMQTT::doFlow(string zwtime)
if (resultchangabs.length() > 0) {
success |= MQTTPublish(namenumber + "changeabsolut", resultchangabs, qos, SetRetainFlag); // Legacy API
success |= MQTTPublish(namenumber + "rate_per_digitalization_round", resultchangabs, qos, SetRetainFlag);
success |= MQTTPublish(namenumber + "rate_per_Digitization_round", resultchangabs, qos, SetRetainFlag);
}
if (resultraw.length() > 0)

View File

@@ -382,7 +382,7 @@ void ClassFlowPostProcessing::handleDecimalSeparator(string _decsep, string _val
}
}
void ClassFlowPostProcessing::handleAnalogDigitalTransitionStart(string _decsep, string _value) {
void ClassFlowPostProcessing::handleAnalogToDigitTransitionStart(string _decsep, string _value) {
string _digit, _decpos;
int _pospunkt = _decsep.find_first_of(".");
// ESP_LOGD(TAG, "Name: %s, Pospunkt: %d", _decsep.c_str(), _pospunkt);
@@ -403,7 +403,7 @@ void ClassFlowPostProcessing::handleAnalogDigitalTransitionStart(string _decsep,
// Set to default first (if nothing else is set)
if ((_digit == "default") || (NUMBERS[j]->name == _digit)) {
NUMBERS[j]->AnalogDigitalTransitionStart = _zwdc;
NUMBERS[j]->AnalogToDigitTransitionStart = _zwdc;
}
}
@@ -564,8 +564,8 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
handleDecimalSeparator(splitted[0], splitted[1]);
}
if ((toUpper(_param) == "ANALOGDIGITALTRANSITIONSTART") && (splitted.size() > 1)) {
handleAnalogDigitalTransitionStart(splitted[0], splitted[1]);
if ((toUpper(_param) == "AnalogToDigitTransitionStart") && (splitted.size() > 1)) {
handleAnalogToDigitTransitionStart(splitted[0], splitted[1]);
}
if ((toUpper(_param) == "MAXRATEVALUE") && (splitted.size() > 1)) {
@@ -648,10 +648,10 @@ void ClassFlowPostProcessing::InitNUMBERS() {
}
if (_number->digit_roi) {
_number->AnzahlDigital = _number->digit_roi->ROI.size();
_number->AnzahlDigit = _number->digit_roi->ROI.size();
}
else {
_number->AnzahlDigital = 0;
_number->AnzahlDigit = 0;
}
_number->analog_roi = NULL;
@@ -677,7 +677,7 @@ void ClassFlowPostProcessing::InitNUMBERS() {
_number->DecimalShift = 0;
_number->DecimalShiftInitial = 0;
_number->isExtendedResolution = false;
_number->AnalogDigitalTransitionStart=9.2;
_number->AnalogToDigitTransitionStart=9.2;
_number->ChangeRateThreshold = 2;
_number->Value = 0; // last value read out, incl. corrections
@@ -693,7 +693,7 @@ void ClassFlowPostProcessing::InitNUMBERS() {
}
for (int i = 0; i < NUMBERS.size(); ++i) {
ESP_LOGD(TAG, "Number %s, Anz DIG: %d, Anz ANA %d", NUMBERS[i]->name.c_str(), NUMBERS[i]->AnzahlDigital, NUMBERS[i]->AnzahlAnalog);
ESP_LOGD(TAG, "Number %s, Anz DIG: %d, Anz ANA %d", NUMBERS[i]->name.c_str(), NUMBERS[i]->AnzahlDigit, NUMBERS[i]->AnzahlAnalog);
}
}
@@ -804,7 +804,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime) {
if (NUMBERS[j]->digit_roi) {
if (NUMBERS[j]->analog_roi) {
NUMBERS[j]->ReturnRawValue = flowDigit->getReadout(j, false, previous_value, NUMBERS[j]->analog_roi->ROI[0]->result_float, NUMBERS[j]->AnalogDigitalTransitionStart) + NUMBERS[j]->ReturnRawValue;
NUMBERS[j]->ReturnRawValue = flowDigit->getReadout(j, false, previous_value, NUMBERS[j]->analog_roi->ROI[0]->result_float, NUMBERS[j]->AnalogToDigitTransitionStart) + NUMBERS[j]->ReturnRawValue;
}
else {
NUMBERS[j]->ReturnRawValue = flowDigit->getReadout(j, NUMBERS[j]->isExtendedResolution, previous_value); // Extended Resolution only if there are no analogue digits
@@ -812,7 +812,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime) {
}
#ifdef SERIAL_DEBUG
ESP_LOGD(TAG, "After digital->getReadout: ReturnRaw %s", NUMBERS[j]->ReturnRawValue.c_str());
ESP_LOGD(TAG, "After digit->getReadout: ReturnRaw %s", NUMBERS[j]->ReturnRawValue.c_str());
#endif
NUMBERS[j]->ReturnRawValue = ShiftDecimal(NUMBERS[j]->ReturnRawValue, NUMBERS[j]->DecimalShift);
@@ -868,8 +868,8 @@ bool ClassFlowPostProcessing::doFlow(string zwtime) {
if (NUMBERS[j]->checkDigitIncreaseConsistency) {
if (flowDigit) {
if (flowDigit->getCNNType() != Digital) {
ESP_LOGD(TAG, "checkDigitIncreaseConsistency = true - ignored due to wrong CNN-Type (not Digital Classification)");
if (flowDigit->getCNNType() != Digit) {
ESP_LOGD(TAG, "checkDigitIncreaseConsistency = true - ignored due to wrong CNN-Type (not Digit Classification)");
}
else {
NUMBERS[j]->Value = checkDigitConsistency(NUMBERS[j]->Value, NUMBERS[j]->DecimalShift, NUMBERS[j]->analog_roi != NULL, NUMBERS[j]->PreValue);
@@ -877,7 +877,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime) {
}
else {
#ifdef SERIAL_DEBUG
ESP_LOGD(TAG, "checkDigitIncreaseConsistency = true - no digital numbers defined!");
ESP_LOGD(TAG, "checkDigitIncreaseConsistency = true - no digit numbers defined!");
#endif
}
}
@@ -990,7 +990,7 @@ void ClassFlowPostProcessing::WriteDataLog(int _index) {
}
string analog = "";
string digital = "";
string digit = "";
string timezw = "";
char buffer[80];
struct tm* timeinfo = localtime(&NUMBERS[_index]->timeStampLastValue);
@@ -1002,20 +1002,20 @@ void ClassFlowPostProcessing::WriteDataLog(int _index) {
}
if (flowDigit) {
digital = flowDigit->getReadoutRawString(_index);
digit = flowDigit->getReadoutRawString(_index);
}
LogFile.WriteToData(timezw, NUMBERS[_index]->name, NUMBERS[_index]->ReturnRawValue, NUMBERS[_index]->ReturnValue, NUMBERS[_index]->ReturnPreValue,
NUMBERS[_index]->ReturnRateValue, NUMBERS[_index]->ReturnChangeAbsolute, NUMBERS[_index]->ErrorMessageText, digital, analog);
NUMBERS[_index]->ReturnRateValue, NUMBERS[_index]->ReturnChangeAbsolute, NUMBERS[_index]->ErrorMessageText, digit, analog);
ESP_LOGD(TAG, "WriteDataLog: %s, %s, %s, %s, %s", NUMBERS[_index]->ReturnRawValue.c_str(), NUMBERS[_index]->ReturnValue.c_str(), NUMBERS[_index]->ErrorMessageText.c_str(), digital.c_str(), analog.c_str());
ESP_LOGD(TAG, "WriteDataLog: %s, %s, %s, %s, %s", NUMBERS[_index]->ReturnRawValue.c_str(), NUMBERS[_index]->ReturnValue.c_str(), NUMBERS[_index]->ErrorMessageText.c_str(), digit.c_str(), analog.c_str());
}
void ClassFlowPostProcessing::UpdateNachkommaDecimalShift() {
for (int j = 0; j < NUMBERS.size(); ++j) {
// There are only digital digits
// There are only digits
if (NUMBERS[j]->digit_roi && !NUMBERS[j]->analog_roi) {
// ESP_LOGD(TAG, "Nurdigital");
// ESP_LOGD(TAG, "Nurdigit");
NUMBERS[j]->DecimalShift = NUMBERS[j]->DecimalShiftInitial;
// Extended resolution is on and should also be used for this digit.
@@ -1037,9 +1037,9 @@ void ClassFlowPostProcessing::UpdateNachkommaDecimalShift() {
NUMBERS[j]->Nachkomma = -NUMBERS[j]->DecimalShift;
}
// digital + analog
// digit + analog
if (NUMBERS[j]->digit_roi && NUMBERS[j]->analog_roi) {
// ESP_LOGD(TAG, "Nur digital + analog");
// ESP_LOGD(TAG, "Nur digit + analog");
NUMBERS[j]->DecimalShift = NUMBERS[j]->DecimalShiftInitial;
NUMBERS[j]->Nachkomma = NUMBERS[j]->analog_roi->ROI.size() - NUMBERS[j]->DecimalShift;

View File

@@ -39,7 +39,7 @@ protected:
void handleMaxRateValue(string _decsep, string _value);
void handleDecimalExtendedResolution(string _decsep, string _value);
void handleMaxRateType(string _decsep, string _value);
void handleAnalogDigitalTransitionStart(string _decsep, string _value);
void handleAnalogToDigitTransitionStart(string _decsep, string _value);
void handleAllowNegativeRate(string _decsep, string _value);
void handleChangeRateThreshold(string _decsep, string _value);

View File

@@ -674,17 +674,17 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req)
}
else
{
/* Digital ROIs */
/* Digit ROIs */
txt = "<body style=\"font-family: arial\">";
txt += "<hr><h3>Recognized Digit ROIs (previous round)</h3>\n";
txt += "<table style=\"border-spacing: 5px\"><tr style=\"text-align: center; vertical-align: top;\">\n";
std::vector<HTMLInfo *> htmlinfodig;
htmlinfodig = flowctrl.GetAllDigital();
htmlinfodig = flowctrl.GetAllDigit();
for (int i = 0; i < htmlinfodig.size(); ++i)
{
if (flowctrl.GetTypeDigital() == Digital)
if (flowctrl.GetTypeDigit() == Digit)
{
// Numbers greater than 10 and less than 0 indicate NaN, since a Roi can only have values from 0 to 9.
if ((htmlinfodig[i]->val >= 10) || (htmlinfodig[i]->val < 0))

View File

@@ -120,15 +120,15 @@ void psram_free_shared_temp_image_memory(void) {
/*******************************************************************
* Memory used in Digitalization Steps
* Memory used in Digitization Steps
* During this step we only use the shared part of the PSRAM for the
* Tensor Arena and one of the Models.
* The shared memory is large enough for the largest model and the
* Tensor Arena. Therefore we do not need to monitor the usage.
*******************************************************************/
void *psram_get_shared_tensor_arena_memory(void) {
if ((sharedMemoryInUseFor == "") || (sharedMemoryInUseFor == "Digitalization_Model")) {
sharedMemoryInUseFor = "Digitalization_Tensor";
if ((sharedMemoryInUseFor == "") || (sharedMemoryInUseFor == "Digitization_Model")) {
sharedMemoryInUseFor = "Digitization_Tensor";
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Allocating Tensor Arena (" + std::to_string(TENSOR_ARENA_SIZE) + " bytes, use shared memory in PSRAM)...");
return shared_region; // Use 1th part of the shared memory for Tensor
}
@@ -140,8 +140,8 @@ void *psram_get_shared_tensor_arena_memory(void) {
void *psram_get_shared_model_memory(void) {
if ((sharedMemoryInUseFor == "") || (sharedMemoryInUseFor == "Digitalization_Tensor")) {
sharedMemoryInUseFor = "Digitalization_Model";
if ((sharedMemoryInUseFor == "") || (sharedMemoryInUseFor == "Digitization_Tensor")) {
sharedMemoryInUseFor = "Digitization_Model";
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Allocating Model memory (" + std::to_string(MAX_MODEL_SIZE) + " bytes, use shared memory in PSRAM)...");
return (uint8_t *)shared_region + TENSOR_ARENA_SIZE; // Use 2nd part of the shared memory (after Tensor Arena) for the model
}

View File

@@ -20,7 +20,7 @@ void psram_free_shared_stbi_memory(void *p);
void *psram_reserve_shared_tmp_image_memory(void);
void psram_free_shared_temp_image_memory(void);
/* Memory used in Digitalization Steps */
/* Memory used in Digitization Steps */
void *psram_get_shared_tensor_arena_memory(void);
void *psram_get_shared_model_memory(void);
void psram_free_shared_tensor_arena_and_model_memory(void);

View File

@@ -32,7 +32,7 @@ void ClassLogFile::WriteHeapInfo(std::string _id)
}
void ClassLogFile::WriteToData(std::string _timestamp, std::string _name, std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ReturnRateValue, std::string _ReturnChangeAbsolute, std::string _ErrorMessageText, std::string _digital, std::string _analog)
void ClassLogFile::WriteToData(std::string _timestamp, std::string _name, std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ReturnRateValue, std::string _ReturnChangeAbsolute, std::string _ErrorMessageText, std::string _digit, std::string _analog)
{
ESP_LOGD(TAG, "Start WriteToData");
time_t rawtime;
@@ -67,7 +67,7 @@ void ClassLogFile::WriteToData(std::string _timestamp, std::string _name, std::s
fputs(_ReturnChangeAbsolute.c_str(), pFile);
fputs(",", pFile);
fputs(_ErrorMessageText.c_str(), pFile);
fputs(_digital.c_str(), pFile);
fputs(_digit.c_str(), pFile);
fputs(_analog.c_str(), pFile);
fputs("\n", pFile);

View File

@@ -39,8 +39,8 @@ public:
void RemoveOldLogFile();
void RemoveOldDataLog();
// void WriteToData(std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ErrorMessageText, std::string _digital, std::string _analog);
void WriteToData(std::string _timestamp, std::string _name, std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ReturnRateValue, std::string _ReturnChangeAbsolute, std::string _ErrorMessageText, std::string _digital, std::string _analog);
// void WriteToData(std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ErrorMessageText, std::string _digit, std::string _analog);
void WriteToData(std::string _timestamp, std::string _name, std::string _ReturnRawValue, std::string _ReturnValue, std::string _ReturnPreValue, std::string _ReturnRateValue, std::string _ReturnChangeAbsolute, std::string _ErrorMessageText, std::string _digit, std::string _analog);
std::string GetCurrentFileName();

View File

@@ -188,10 +188,10 @@ bool MQTThomeassistantDiscovery(int qos) {
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "value", "Value", "gauge", valueUnit, meterType, "total_increasing", "", qos);
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "raw", "Raw Value", "raw", "", "", "", "diagnostic", qos);
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "error", "Error", "alert-circle-outline", "", "", "", "diagnostic", qos);
/* Not announcing "rate" as it is better to use rate_per_time_unit resp. rate_per_digitalization_round */
/* Not announcing "rate" as it is better to use rate_per_time_unit resp. rate_per_Digitization_round */
// allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate", "Rate (Unit/Minute)", "swap-vertical", "", "", "", ""); // Legacy, always Unit per Minute
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate_per_time_unit", "Rate (" + rateUnit + ")", "swap-vertical", rateUnit, "", "measurement", "", qos);
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate_per_digitalization_round", "Change since last digitalization round", "arrow-expand-vertical", valueUnit, "", "measurement", "", qos); // correctly the Unit is Unit/Interval!
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "rate_per_Digitization_round", "Change since last Digitization round", "arrow-expand-vertical", valueUnit, "", "measurement", "", qos); // correctly the Unit is Unit/Interval!
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "timestamp", "Timestamp", "clock-time-eight-outline", "", "timestamp", "", "diagnostic", qos);
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "json", "JSON", "code-json", "", "", "", "diagnostic", qos);
allSendsSuccessed |= sendHomeAssistantDiscoveryTopic(group, "problem", "Problem", "alert-outline", "", "problem", "", "", qos); // Special binary sensor which is based on error topic

View File

@@ -176,13 +176,13 @@
//ClassFlowCNNGeneral
#define Analog_error 3
#define AnalogToDigtalFehler 0.8
#define Digital_Uncertainty 0.2
#define DigitalBand 3
#define Digital_Transition_Range_Predecessor 2
#define Digital_Transition_Area_Predecessor 0.7 // 9.3 - 0.7
#define Digital_Transition_Area_Forward 9.7 // Pre-run zero crossing only happens from approx. 9.7 onwards
#define AnalogToDigtalFehler 0.8
#define Digit_Uncertainty 0.2
#define DigitBand 3
#define Digit_Transition_Range_Predecessor 2
#define Digit_Transition_Area_Predecessor 0.7 // 9.3 - 0.7
#define Digit_Transition_Area_Forward 9.7 // Pre-run zero crossing only happens from approx. 9.7 onwards
//#define DEBUG_DETAIL_ON

View File

@@ -602,6 +602,7 @@ void migrateConfiguration(void) {
}
if (section == "[PostProcessing]") {
migrated = migrated | replaceString(configLines[i], "AnalogDigitalTransitionStart", "AnalogToDigitTransitionStart"); // Rename it
migrated = migrated | replaceString(configLines[i], ";PreValueUse = true", ";PreValueUse = false"); // Set it to its default value
migrated = migrated | replaceString(configLines[i], ";PreValueUse", "PreValueUse"); // Enable it

View File

@@ -357,7 +357,7 @@ esp_err_t img_tmp_virtual_handler(httpd_req_t *req)
if (filetosend == "raw.jpg")
return GetRawJPG(req);
// Serve alg.jpg, alg_roi.jpg or digital and analog ROIs
// Serve alg.jpg, alg_roi.jpg or digit and analog ROIs
if (ESP_OK == GetJPG(filetosend, req))
return ESP_OK;

View File

@@ -20,7 +20,7 @@ class UnderTestCNNGeneral : public ClassFlowCNNGeneral {
*/
void test_analogToDigit_Standard() {
UnderTestCNNGeneral* undertest = new UnderTestCNNGeneral(nullptr, Digital100);
UnderTestCNNGeneral* undertest = new UnderTestCNNGeneral(nullptr, Digit100);
// 4.8 is a "hanging" 5, i.e. it has not jumped over to 5.0.
// A "hanging digit" should still be rounded from Transition.
@@ -59,7 +59,7 @@ void test_analogToDigit_Standard() {
}
void test_analogToDigit_Transition() {
UnderTestCNNGeneral* undertest = new UnderTestCNNGeneral(nullptr, Digital100);
UnderTestCNNGeneral* undertest = new UnderTestCNNGeneral(nullptr, Digit100);
// https://github.com/jomjol/AI-on-the-edge-device/issues/921#issuecomment-1222672175
// Default: dig=3.9, ana=9.7 => erg=3

View File

@@ -16,7 +16,7 @@ class UnderTestCNN : public ClassFlowCNNGeneral {
*/
void test_ZeigerEval()
{
UnderTestCNN undertest = UnderTestCNN(nullptr, Digital100);
UnderTestCNN undertest = UnderTestCNN(nullptr, Digit100);
// the 5.2 is already above 5.0 and the previous digit too (3)
printf("Test 5.2, 3\n");
@@ -29,11 +29,11 @@ void test_ZeigerEval()
TEST_ASSERT_EQUAL(4, undertest.PointerEvalAnalogNew(5.2, 9));
printf("Test 4.4, 9\n");
// the 4.4 (digital100) is not above 5 and the previous digit (analog) too (9.3)
// the 4.4 (Digit100) is not above 5 and the previous digit (analog) too (9.3)
TEST_ASSERT_EQUAL(4, undertest.PointerEvalAnalogNew(4.4, 9));
printf("Test 4.5, 0\n");
// the 4.5 (digital100) is not above 5 and the previous digit (analog) too (9.6)
// the 4.5 (Digit100) is not above 5 and the previous digit (analog) too (9.6)
TEST_ASSERT_EQUAL(4, undertest.PointerEvalAnalogNew(4.5, 0));
}
@@ -42,7 +42,7 @@ void test_ZeigerEval()
* @brief test if all combinations of digit
* evaluation are running correctly
*
* Desciption on call undertest.PointerEvalHybridNew(float number, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors, float digitalAnalogTransitionStart)
* Desciption on call undertest.PointerEvalHybridNew(float number, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors, float digitAnalogTransitionStart)
* @param number: is the current ROI as float value from recognition
* @param number_of_predecessors: is the last (lower) ROI as float from recognition
* @param eval_predecessors: is the evaluated number. Sometimes a much lower value can change higer values
@@ -50,16 +50,16 @@ void test_ZeigerEval()
* 0.1 => 0 (eval_predecessors)
* The 0 makes a 9.9 to 0 (eval_predecessors)
* The 0 makes a 9.8 to 0
* @param Analog_Predecessors false/true if the last ROI is an analog or digital ROI (default=false)
* @param Analog_Predecessors false/true if the last ROI is an analog or digit ROI (default=false)
* runs in special handling because analog is much less precise
* @param digitalAnalogTransitionStart start of the transitionlogic begins on number_of_predecessor (default=9.2)
* @param digitAnalogTransitionStart start of the transitionlogic begins on number_of_predecessor (default=9.2)
*
*
*
*
*/
void test_ZeigerEvalHybrid() {
UnderTestCNN undertest = UnderTestCNN(nullptr, Digital100);
UnderTestCNN undertest = UnderTestCNN(nullptr, Digit100);
// the 5.2 and no previous should round down
printf("PointerEvalHybridNew(5.2, 0, -1)\n");
@@ -93,17 +93,17 @@ void test_ZeigerEvalHybrid() {
// the 5.7 with previous and the previous >=9.5 should trunc to 5
TEST_ASSERT_EQUAL(5, undertest.PointerEvalHybridNew(5.7, 9.6, 9));
// the 4.5 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.6)
// the 4.5 (Digit100) is not above 5 and the previous digit (analog) not over Zero (9.6)
TEST_ASSERT_EQUAL(4, undertest.PointerEvalHybridNew(4.5, 9.6, 0));
// the 4.5 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.6)
// the 4.5 (Digit100) is not above 5 and the previous digit (analog) not over Zero (9.6)
TEST_ASSERT_EQUAL(4, undertest.PointerEvalHybridNew(4.5, 9.6, 9));
// the 4.5 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.5)
// the 4.5 (Digit100) is not above 5 and the previous digit (analog) not over Zero (9.5)
TEST_ASSERT_EQUAL(4, undertest.PointerEvalHybridNew(4.5, 9.5, 9));
// 59.96889 - Pre: 58.94888
// 8.6 : 9.8 : 6.7
// the 4.4 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.5)
// the 4.4 (Digit100) is not above 5 and the previous digit (analog) not over Zero (9.5)
TEST_ASSERT_EQUAL(8, undertest.PointerEvalHybridNew(8.6, 9.8, 9));
// pre = 9.9 (0.0 raw)
@@ -111,7 +111,7 @@ void test_ZeigerEvalHybrid() {
TEST_ASSERT_EQUAL(2, undertest.PointerEvalHybridNew(1.8, 9.0, 9));
// if a digit have an early transition and the pointer is < 9.0
// prev (pointer) = 6.2, but on digital readout = 6.0 (prev is int parameter)
// prev (pointer) = 6.2, but on digit readout = 6.0 (prev is int parameter)
// zahl = 4.6
TEST_ASSERT_EQUAL(4, undertest.PointerEvalHybridNew(4.6, 6.0, 6));

View File

@@ -37,9 +37,9 @@ std::string process_doFlow(UnderTestPost* _underTestPost) {
* @brief setup flow like it runs after recognition.
*
* @param analog the analog recognitions as array begins with the highest ROI
* @param digits the digital regocnitions as array begins with the highest ROI
* @param digType type of the model defaults do Digital100
* @param checkConsistency for Digital type only. Not relvant for newer models
* @param digits the digit regocnitions as array begins with the highest ROI
* @param digType type of the model defaults do Digit100
* @param checkConsistency for Digit type only. Not relvant for newer models
* @param extendedResolution the lowest ROI will directly used (9.7 => 9.7) if false 9.7 => 9
* @param decimal_shift the decimal point offset. -3 corresponds to x.yyy
* @return std::string the value result
@@ -162,7 +162,7 @@ void setAnalogdigitTransistionStart(UnderTestPost* _underTestPost, float _analog
std::vector<NumberPost*>* NUMBERS = _underTestPost->GetNumbers();
for (int _n = 0; _n < (*NUMBERS).size(); ++_n) {
ESP_LOGD(TAG, "Setting decimal shift on number: %d to %f", _n, _analogdigitTransistionStart);
(*NUMBERS)[_n]->AnalogDigitalTransitionStart = _analogdigitTransistionStart;
(*NUMBERS)[_n]->AnalogToDigitTransitionStart = _analogdigitTransistionStart;
}
}
}

View File

@@ -33,13 +33,13 @@ UnderTestPost* setUpClassFlowPostprocessing(t_CNNType digType, t_CNNType anaType
*
* @param analog the analog recognitions
* @param digits the digit recognitions
* @param digType the digit model type (default Digital100)
* @param digType the digit model type (default Digit100)
* @param checkConsistency sets property checkConsistency (default = false)
* @param extendedResolution sets property extendedResolution (default = false)
* @param decimal_shift set property decimal_shift (Nachkommastellen, default = 0)
* @return UnderTestPost* the created testobject
*/
UnderTestPost* init_do_flow(std::vector<float> analog, std::vector<float> digits, t_CNNType digType = Digital100,
UnderTestPost* init_do_flow(std::vector<float> analog, std::vector<float> digits, t_CNNType digType = Digit100,
bool checkConsistency=false, bool extendedResolution=false, int decimal_shift=0);
/**
@@ -47,13 +47,13 @@ UnderTestPost* init_do_flow(std::vector<float> analog, std::vector<float> digits
*
* @param analog the analog recognitions
* @param digits the digit recognitions
* @param digType the digit model type (default Digital100)
* @param digType the digit model type (default Digit100)
* @param checkConsistency sets property checkConsistency (default = false)
* @param extendedResolution sets property extendedResolution (default = false)
* @param decimal_shift set property decimal_shift (Nachkommastellen, default = 0)
* @return std::string the return value of do_Flow is the Value as string
*/
std::string process_doFlow(std::vector<float> analog, std::vector<float> digits, t_CNNType digType = Digital100,
std::string process_doFlow(std::vector<float> analog, std::vector<float> digits, t_CNNType digType = Digit100,
bool checkConsistency=false, bool extendedResolution=false, int decimal_shift=0);
/**

View File

@@ -20,7 +20,7 @@ void testNegative() {
// extendResolution=false
// da kein negativ, sollte kein Error auftreten
UnderTestPost* underTestPost = init_do_flow(analogs, digits, Digital100, false, false, 0);
UnderTestPost* underTestPost = init_do_flow(analogs, digits, Digit100, false, false, 0);
setAllowNegatives(underTestPost, false);
setPreValue(underTestPost, preValue);
std::string result = process_doFlow(underTestPost);
@@ -31,7 +31,7 @@ void testNegative() {
// extendResolution=true
// da negativ im Rahmen (letzte Stelle -0.2 > ergebnis), kein Error
// Aber der PreValue wird gesetzt
underTestPost = init_do_flow(analogs, digits, Digital100, false, true, 0);
underTestPost = init_do_flow(analogs, digits, Digit100, false, true, 0);
setAllowNegatives(underTestPost, false);
setPreValue(underTestPost, preValue_extended);
result = process_doFlow(underTestPost);
@@ -42,7 +42,7 @@ void testNegative() {
// extendResolution=true
// Tolleranz überschritten, Error wird gesetzt, kein ReturnValue
preValue_extended = 16.988; // zu groß
underTestPost = init_do_flow(analogs, digits, Digital100, false, true, 0);
underTestPost = init_do_flow(analogs, digits, Digit100, false, true, 0);
setAllowNegatives(underTestPost, false);
setPreValue(underTestPost, preValue_extended);
result = process_doFlow(underTestPost);
@@ -53,7 +53,7 @@ void testNegative() {
// extendResolution=false
// value < (preValue -.01)
preValue = 17.00; // zu groß
underTestPost = init_do_flow(analogs, digits, Digital100, false, false, 0);
underTestPost = init_do_flow(analogs, digits, Digit100, false, false, 0);
setAllowNegatives(underTestPost, false);
setPreValue(underTestPost, preValue);
result = process_doFlow(underTestPost);
@@ -65,7 +65,7 @@ void testNegative() {
// value > (preValue -.01)
// ist im Rahmen der Ungenauigkeit (-1 auf letzter Stelle)
preValue = 16.99; // zu groß
underTestPost = init_do_flow(analogs, digits, Digital100, false, false, 0);
underTestPost = init_do_flow(analogs, digits, Digit100, false, false, 0);
setAllowNegatives(underTestPost, false);
setPreValue(underTestPost, preValue);
result = process_doFlow(underTestPost);
@@ -77,7 +77,7 @@ void testNegative() {
// value < preValue
// Aber Prüfung abgeschaltet => kein Fehler
preValue = 17.99; // zu groß
underTestPost = init_do_flow(analogs, digits, Digital100, false, false, 0);
underTestPost = init_do_flow(analogs, digits, Digit100, false, false, 0);
setAllowNegatives(underTestPost, true);
setPreValue(underTestPost, preValue_extended);
result = process_doFlow(underTestPost);
@@ -105,7 +105,7 @@ void testNegative_Issues() {
// value < preValue
// Prüfung eingeschaltet => Fehler
preValue = 22018.09; // zu groß
UnderTestPost* underTestPost = init_do_flow(analogs, digits, Digital100, false, false, -2);
UnderTestPost* underTestPost = init_do_flow(analogs, digits, Digit100, false, false, -2);
setAllowNegatives(underTestPost, false);
setPreValue(underTestPost, preValue_extended);
std::string result = process_doFlow(underTestPost);

View File

@@ -178,7 +178,7 @@ void test_doFlowPP2() {
std::vector<float> digits = { 1.0, 9.0, 9.0}; // Übergang wurde um 1 erhöht (200, statt 199)
std::vector<float> analogs = { 7.1, 4.8, 8.3};
const char* expected = "199.748";
std::string result = process_doFlow(analogs, digits, Digital);
std::string result = process_doFlow(analogs, digits, Digit);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// Fehler bei Rolling (2002-09-09)
@@ -191,15 +191,15 @@ void test_doFlowPP2() {
// expected_extended= "32289.4198";
// extendResolution=false, checkConsistency=false
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
result = process_doFlow(analogs, digits, Digit100, false, false, -3);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// checkConsistency=true und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// Fehler Rolling (2022-09-10)
@@ -210,20 +210,20 @@ void test_doFlowPP2() {
expected_extended= "83.99401";
// checkConsistency=false
result = process_doFlow(analogs, digits, Digital100, false);
result = process_doFlow(analogs, digits, Digit100, false);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=true
result = process_doFlow(analogs, digits, Digital100, true);
result = process_doFlow(analogs, digits, Digit100, true);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true);
result = process_doFlow(analogs, digits, Digit100, false, true);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// checkConsistency=true und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true);
result = process_doFlow(analogs, digits, Digit100, false, true);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// Fehler Rolling (2022-09-10)
@@ -234,16 +234,16 @@ void test_doFlowPP2() {
expected_extended= "123235.6";
// checkConsistency=true
result = process_doFlow(analogs, digits, Digital100, false, false);
result = process_doFlow(analogs, digits, Digit100, false, false);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=true
result = process_doFlow(analogs, digits, Digital100, true, false);
result = process_doFlow(analogs, digits, Digit100, true, false);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true);
result = process_doFlow(analogs, digits, Digit100, false, true);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// Fehler bei V11.2.0
@@ -254,11 +254,11 @@ void test_doFlowPP2() {
expected_extended= "3249.4692";
// checkConsistency=true
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
result = process_doFlow(analogs, digits, Digit100, false, false, -3);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// Fehler bei V11.2.0
@@ -269,11 +269,11 @@ void test_doFlowPP2() {
expected_extended= "269.92272";
// extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, false);
result = process_doFlow(analogs, digits, Digit100, false, false);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true);
result = process_doFlow(analogs, digits, Digit100, false, true);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// Fehler bei V11.3.1
@@ -284,11 +284,11 @@ void test_doFlowPP2() {
expected_extended= "169.35935";
// extendResolution=false
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
result = process_doFlow(analogs, digits, Digit100, false, false, -3);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// Fehler bei V12.0.1
@@ -299,11 +299,11 @@ void test_doFlowPP2() {
expected_extended= "211.03555";
// extendResolution=false
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
result = process_doFlow(analogs, digits, Digit100, false, false, -3);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// Fehler bei V12.0.1
@@ -314,11 +314,11 @@ void test_doFlowPP2() {
expected_extended= "245.9386";
// extendResolution=false
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
result = process_doFlow(analogs, digits, Digit100, false, false, 0);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// Fehler bei V12.0.1
@@ -329,11 +329,11 @@ void test_doFlowPP2() {
expected_extended= "245.9386";
// extendResolution=false
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
result = process_doFlow(analogs, digits, Digit100, false, false, 0);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
}
@@ -346,11 +346,11 @@ void test_doFlowPP3() {
const char* expected_extended= "247.2045";
// extendResolution=false
std::string result = process_doFlow(analogs, digits, Digital100, false, false, 0);
std::string result = process_doFlow(analogs, digits, Digit100, false, false, 0);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
@@ -362,11 +362,11 @@ void test_doFlowPP3() {
expected_extended= "142.92690";
// extendResolution=false
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
result = process_doFlow(analogs, digits, Digit100, false, false, 0);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
@@ -379,14 +379,14 @@ void test_doFlowPP3() {
expected_extended= "170.05287";
// extendResolution=false
UnderTestPost* undertestPost = init_do_flow(analogs, digits, Digital100, false, false, -3);
UnderTestPost* undertestPost = init_do_flow(analogs, digits, Digit100, false, false, -3);
setAnalogdigitTransistionStart(undertestPost, 7.7);
result = process_doFlow(undertestPost);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
delete undertestPost;
// checkConsistency=false und extendResolution=true
undertestPost = init_do_flow(analogs, digits, Digital100, false, true, -3);
undertestPost = init_do_flow(analogs, digits, Digit100, false, true, -3);
setAnalogdigitTransistionStart(undertestPost, 7.7);
result = process_doFlow(undertestPost);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
@@ -400,11 +400,11 @@ void test_doFlowPP3() {
expected_extended= "91.88174";
// extendResolution=false
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
result = process_doFlow(analogs, digits, Digit100, false, false, 0);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
@@ -416,11 +416,11 @@ void test_doFlowPP3() {
expected_extended= "92.38320";
// extendResolution=false
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
result = process_doFlow(analogs, digits, Digit100, false, false, 0);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// Fehler V11.3.0
@@ -431,11 +431,11 @@ void test_doFlowPP3() {
expected_extended= "7472.7594";
// extendResolution=false
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
result = process_doFlow(analogs, digits, Digit100, false, false, -3);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// Fehler V12.0.1
@@ -446,11 +446,11 @@ void test_doFlowPP3() {
expected_extended= "577.86490";
// extendResolution=false
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
result = process_doFlow(analogs, digits, Digit100, false, false, 0);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
@@ -462,11 +462,11 @@ void test_doFlowPP3() {
expected_extended= "211.03580";
// extendResolution=false
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
result = process_doFlow(analogs, digits, Digit100, false, false, -3);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// Fehler V12.0.1
@@ -477,11 +477,11 @@ void test_doFlowPP3() {
expected_extended= "126.9231";
// extendResolution=false
result = process_doFlow(analogs, digits, Digital100, false, false, 0);
result = process_doFlow(analogs, digits, Digit100, false, false, 0);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, 0);
result = process_doFlow(analogs, digits, Digit100, false, true, 0);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// Fehler V12.0.1
@@ -492,11 +492,11 @@ void test_doFlowPP3() {
expected_extended= "386.05672";
// extendResolution=false
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
result = process_doFlow(analogs, digits, Digit100, false, false, -3);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
result = process_doFlow(analogs, digits, Digit100, false, true, -3);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
// Fehler V12.0.1
@@ -508,14 +508,14 @@ void test_doFlowPP3() {
expected_extended= "171.24178";
// extendResolution=false
undertestPost = init_do_flow(analogs, digits, Digital100, false, false, -3);
undertestPost = init_do_flow(analogs, digits, Digit100, false, false, -3);
setAnalogdigitTransistionStart(undertestPost, 7.7);
result = process_doFlow(undertestPost);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
delete undertestPost;
// checkConsistency=false und extendResolution=true
undertestPost = init_do_flow(analogs, digits, Digital100, false, true, -3);
undertestPost = init_do_flow(analogs, digits, Digit100, false, true, -3);
setAnalogdigitTransistionStart(undertestPost, 7.7);
result = process_doFlow(undertestPost);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
@@ -533,11 +533,11 @@ void test_doFlowPP4() {
const char* expected_extended= "717.01658";
// extendResolution=false
std::string result = process_doFlow(analogs, digits, Digital100, false, false);
std::string result = process_doFlow(analogs, digits, Digit100, false, false);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// checkConsistency=false und extendResolution=true
result = process_doFlow(analogs, digits, Digital100, false, true);
result = process_doFlow(analogs, digits, Digit100, false, true);
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
}

View File

@@ -5,7 +5,7 @@
void test_getReadoutRawString() {
// no ROIs setted up
UnderTestPost* _undertestPost = setUpClassFlowPostprocessing(Digital100, Analogue100);
UnderTestPost* _undertestPost = setUpClassFlowPostprocessing(Digit100, Analogue100);
string result = _undertestPost->flowAnalog->getReadoutRawString(0);
TEST_ASSERT_EQUAL_STRING("", result.c_str());