From 409ac0ea82dd5c1d9f170f2f01be263ed97759bf Mon Sep 17 00:00:00 2001 From: CaCO3 Date: Sun, 1 Sep 2024 22:23:18 +0200 Subject: [PATCH 1/4] renamed Digital to Digit --- .github/label-commenter-config.yaml | 4 +- Changelog.md | 50 +++++----- .../ClassFlowAlignment.cpp | 2 +- .../ClassFlowCNNGeneral.cpp | 82 ++++++++-------- .../jomjol_flowcontroll/ClassFlowCNNGeneral.h | 21 ++--- .../jomjol_flowcontroll/ClassFlowControll.cpp | 16 ++-- .../jomjol_flowcontroll/ClassFlowControll.h | 6 +- .../ClassFlowDefineTypes.h | 8 +- .../jomjol_flowcontroll/ClassFlowMQTT.cpp | 2 +- .../ClassFlowPostProcessing.cpp | 42 ++++----- .../ClassFlowPostProcessing.h | 2 +- .../jomjol_flowcontroll/MainFlowControl.cpp | 6 +- code/components/jomjol_helper/psram.cpp | 10 +- code/components/jomjol_helper/psram.h | 2 +- .../jomjol_logfile/ClassLogFile.cpp | 4 +- code/components/jomjol_logfile/ClassLogFile.h | 4 +- code/components/jomjol_mqtt/server_mqtt.cpp | 4 +- code/include/defines.h | 14 +-- code/main/server_main.cpp | 2 +- .../test_PointerEvalAnalogToDigitNew.cpp | 4 +- .../test_cnnflowcontroll.cpp | 24 ++--- .../test_flow_postrocess_helper.cpp | 8 +- .../test_flow_postrocess_helper.h | 8 +- .../test_flow_pp_negative.cpp | 14 +-- .../test_flowpostprocessing.cpp | 94 +++++++++---------- .../test_getReadoutRawString.cpp | 2 +- param-docs/parameter-pages/MQTT/MainTopic.md | 2 +- .../NUMBER.AnalogDigitalTransitionStart.md | 2 +- sd-card/config/config.ini | 2 +- sd-card/html/edit_alignment.html | 4 +- sd-card/html/edit_config_template.html | 12 +-- sd-card/html/index.html | 2 +- sd-card/html/readconfigparam.js | 2 +- sd-card/html/setup.html | 2 +- 34 files changed, 225 insertions(+), 238 deletions(-) diff --git a/.github/label-commenter-config.yaml b/.github/label-commenter-config.yaml index e2d08f5ad..856a37e9d 100644 --- a/.github/label-commenter-config.yaml +++ b/.github/label-commenter-config.yaml @@ -115,9 +115,9 @@ labeled: issue: body: | - See [Digital Digits](https://jomjol.github.io/neural-network-digital-counter-readout) resp. [Analogue Pointers](https://jomjol.github.io/neural-network-analog-needle-readout) for an overview of all trained data. + See [Digits](https://jomjol.github.io/neural-network-digital-counter-readout) resp. [Analogue Pointers](https://jomjol.github.io/neural-network-analog-needle-readout) for an overview of all trained data. If your type is not contained it can be added to our training material, see [here](https://jomjol.github.io/AI-on-the-edge-device-docs/collect-new-images/). discussion: body: | - See [Digital Digits](https://jomjol.github.io/neural-network-digital-counter-readout) resp. [Analogue Pointers](https://jomjol.github.io/neural-network-analog-needle-readout) for an overview of all trained data. + See [Analog counters](https://jomjol.github.io/neural-network-digital-counter-readout) resp. [Analogue Pointers](https://jomjol.github.io/neural-network-analog-needle-readout) for an overview of all trained data. If your type is not contained it can be added to our training material, see [here](https://jomjol.github.io/AI-on-the-edge-device-docs/collect-new-images/). diff --git a/Changelog.md b/Changelog.md index 8a8f853cb..4e6cd0cf7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -23,7 +23,7 @@ For a full list of changes see [Full list of changes](https://github.com/jomjol/ - Add Firmware Version to MQTT #### Bug Fixes -- Reverted "Implemented late analog / digital transition [#2778](https://github.com/jomjol/AI-on-the-edge-device/pull/2778) (introduced in `v15.5`) as is seems to cause issues for many users. +- Reverted "Implemented late analog / digit transition [#2778](https://github.com/jomjol/AI-on-the-edge-device/pull/2778) (introduced in `v15.5`) as is seems to cause issues for many users. ## [15.6.0] - 2024-02-09 @@ -42,7 +42,7 @@ For a full list of changes see [Full list of changes](https://github.com/jomjol/ - Update PlattformIO to v6.5.0, which means esp-idf to v5.1 - Enhance busy notification - - Implemented late analog / digital transition + - Implemented late analog / digit transition #### Fixed @@ -202,7 +202,7 @@ For a full list of changes see [Full list of changes](https://github.com/jomjol/ :bangbang: **Attention:** Update your configuration! - Hybrid CNN network to `dig-cont_0611_s3` - Analog CNN network to `ana-cont-11.0.5` and `ana-clas100-1.5.7` - - Digital CNN network to `dig-class100-1.6.0` + - Digit CNN network to `dig-class100-1.6.0` - Various Web interface Improvements/Enhancements: - Restructured Menu (Needs cache clearing to be applied) - Enhanced `Previous Value` page @@ -338,7 +338,7 @@ For a full list of changes see [Full list of changes](https://github.com/jomjol/ - Improved OTA Update mechanism (only working after installation for next update) - Added data logging in `/log/data` - One day per file and each measurement is on one line - Format: csv - comma separated - - Content: `time`, `name-of-number`, `raw-value`, `return-value`, `pre-value`, `change-rate`, `change-absolute`, `error-text`, `cnn-digital`, `cnn-analog` + - Content: `time`, `name-of-number`, `raw-value`, `return-value`, `pre-value`, `change-rate`, `change-absolute`, `error-text`, `cnn-digit`, `cnn-analog` - Show graph of values direct in the user interface (thanks to [@rdmueller](https://github.com/rdmueller)) - Using new data logging (see above) @@ -356,10 +356,10 @@ For a full list of changes see [Full list of changes](https://github.com/jomjol/ - Updated OTA functionality (more robust, but not fully bullet prove yet) - Updated Espressif library to `espressif32@v5.2.0` - [#1176](https://github.com/jomjol/AI-on-the-edge-device/discussions/1176) accept minor negative values (-0.2) if extended resolution is enabled -- [#1143](https://github.com/jomjol/AI-on-the-edge-device/issues/1143) added config parameter `AnalogDigitalTransitionStart`. It can setup very early and very late digit transition starts. +- [#1143](https://github.com/jomjol/AI-on-the-edge-device/issues/1143) added config parameter `AnalogDigTransitionStart`. It can setup very early and very late digit transition starts. - New version of `dig-class100` (v1.4.0): added images of heliowatt powermeter - NEW v13.0.2: Update Tool "Logfile downloader and combiner" to handle the new csv file format. -- NEW v13.0.2: MQTT: Added MQTT topic `status` (Digitalization Status), Timezone to MQTT topic `timestamp`.# +- NEW v13.0.2: MQTT: Added MQTT topic `status` (Digitization Status), Timezone to MQTT topic `timestamp`.# - NEW v13.0.2: Logging: Disable heap logs by default, cleanup - NEW v13.0.7: - log NTP server name @@ -484,7 +484,7 @@ Intermediate Digits - Updated analog neural network file (`ana-cont_11.3.0_s2.tflite` - default, `ana-class100_0120_s1_q.tflite`) -- Updated digital neural network file (`dig-cont_0570_s3.tflite` - default, `dig-class100_0120_s2_q.tflite`) +- Updated digit neural network file (`dig-cont_0570_s3.tflite` - default, `dig-class100_0120_s2_q.tflite`) - Added automated filtering of tflite-file in the graphical configuration (thanks to @**[caco3](https://github.com/caco3)**) @@ -496,8 +496,8 @@ Intermediate Digits Intermediate Digits -- New and improved consistency check (especially with analog and digital counters mixed) -- Bug Fix: digital counter algorithm +- New and improved consistency check (especially with analog and digit counters mixed) +- Bug Fix: digit counter algorithm ## [11.0.1](https://github.com/jomjol/AI-on-the-edge-device/releases/tag/v11.0.1), 2022-08-18 @@ -537,7 +537,7 @@ Stability Increase - `config.ini`: removal of modelsize (readout from tflite) -- Updated analog neural network file (`ana1000s2.tflite`) & digital neural network file (`dig1400s2q.tflite`) +- Updated analog neural network file (`ana1000s2.tflite`) & digit neural network file (`dig1400s2q.tflite`) - TFMicro/Lite: Update (espressif Version 20220716) @@ -573,7 +573,7 @@ Stability Increase - In the future the new files will also be copied to the `firmware` directory of the repository - Added Wifi RSSI to MQTT information - Updated analog neural network file (`ana-s3-q-20220105.tflite`) -- Updated digital neural network file (`dig-s1-q-20220102.tflite`) +- Updated digit neural network file (`dig-s1-q-20220102.tflite`) - Updated build environment to `Espressif 3.5.0` ## [10.3.0] - (2022-01-29) @@ -639,7 +639,7 @@ Stability Increase - Update analog neural network (ana-s3-q-20220105.tflite) -- Update digital neural network (dig-s1-q-20220102.tflite) +- Update digit neural network (dig-s1-q-20220102.tflite) - Increased web-server buffers @@ -676,7 +676,7 @@ External Illumination - Direct JSON access: `http://IP-ADRESS/json` - Error message in log file in case camera error during startup - Upgrade analog CNN to v9.1.0 -- Upgrade digital CNN to v13.3.0 (added new images) +- Upgrade digit CNN to v13.3.0 (added new images) - html: support of different ports ## [9.1.1] - External Illumination (2021-11-16) @@ -701,7 +701,7 @@ External Illumination ### Changed -- Upgrade digital CNN to v13.1.0 (added new images) +- Upgrade digit CNN to v13.1.0 (added new images) - bug fix: wlan password with space, double digit output ## [8.4.0] - Multi Meter Support (2021-09-25) @@ -731,7 +731,7 @@ External Illumination ### Changed -- Upgrade digital CNN to v12.1.0 (added new images) +- Upgrade digit CNN to v12.1.0 (added new images) - Dedicated NaN handling, internal refactoring (CNN-Handling) - HTML: confirmation after config.ini update - Bug fixing @@ -753,7 +753,7 @@ External Illumination - GPIO: using the general mqtt main topic for GPIO -- Upgrade digital CNN to v12.0.0 (added new images) +- Upgrade digit CNN to v12.0.0 (added new images) - Update tfmicro to new master (2021-08-07) - Bug fix: remove text in mqtt value, remove connect limit in wlan reconnet @@ -789,7 +789,7 @@ External Illumination - Update wlan handling to esp-idf 4.1 -- Upgrade digital CNN to v8.7.0 (added new images) +- Upgrade digit CNN to v8.7.0 (added new images) - Bug fix: MQTT, WLAN, LED-Controll, GPIO usage, fixed IP, calculation flow rate @@ -800,7 +800,7 @@ External Illumination - NEW: 7.0.1: bug fix wlan password with "=" -- Upgrade digital CNN to v8.5.0 (added new images) +- Upgrade digit CNN to v8.5.0 (added new images) - New MQTT topics: flow rate (units/minute), time stamp (last correct read readout) @@ -817,7 +817,7 @@ External Illumination - NEW 6.7.1: Improved stability of camera (back to v6.6.1) - remove black strips and areas -- Upgrade digital CNN to v8.3.0 (added new type of digits) +- Upgrade digit CNN to v8.3.0 (added new type of digits) - Internal update: TFlite (v2.5), esp32cam, startup sequence @@ -838,7 +838,7 @@ External Illumination ### Changed -- Upgrade digital CNN to v8.2.0 (added new type of digits) +- Upgrade digit CNN to v8.2.0 (added new type of digits) - Supporting alignment structures in ROI definition @@ -874,7 +874,7 @@ External Illumination - Determination of fixed illumination settings during startup - speed up of 5s in each run -- Update digital CNN to v8.1.1 (additional digital images trained) +- Update digit CNN to v8.1.1 (additional digit images trained) - Extended error message in MQTT error message @@ -886,7 +886,7 @@ External Illumination ### Changed -- Disabling of analog / digital counters in configuration +- Disabling of analog / digit counters in configuration - Improved Alignment Algorithm (`AlignmentAlgo` = `Default`, `Accurate` , `Fast`) @@ -906,7 +906,7 @@ External Illumination - MQTT: Last Will Testament (LWT) implemented: "connection lost" in case of connection lost to `TopicError` - Disabled `CheckDigitIncreaseConsistency` in default configuration - must now be explicit enabled if needed -- Update digital CNN to v7.2.1 (additional digital images trained) +- Update digit CNN to v7.2.1 (additional digit images trained) - Setting of arbitrary time server in `config.ini` - Option for fixed IP-, DNS-Settings in `wlan.ini` - Increased stability (internal image and camera handling) @@ -940,7 +940,7 @@ External Illumination - standardized access to current logfile via `http://IP-ADRESS/logfileact` -- Update digital CNN to v7.2.0, analog CNN to 6.3.0 +- Update digit CNN to v7.2.0, analog CNN to 6.3.0 - Bug fixing: truncation error, CheckDigitConsistency & PreValue implementation @@ -959,7 +959,7 @@ External Illumination ### Changed -- Update digital CNN to v6.5.0 and HTML (Info to hostname, IP, ssid) +- Update digit CNN to v6.5.0 and HTML (Info to hostname, IP, ssid) - New implementation of "checkDigitConsistency" also for digits diff --git a/code/components/jomjol_flowcontroll/ClassFlowAlignment.cpp b/code/components/jomjol_flowcontroll/ClassFlowAlignment.cpp index 5933e8d7e..2324fd3cf 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowAlignment.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowAlignment.cpp @@ -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); } diff --git a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp index a6030a1c6..8ccba87a4 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp @@ -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 AnalogDigitTransitionStart) { 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, AnalogDigitTransitionStart); } 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 AnalogDigitTransitionStart) { 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>AnalogDigitTransitionStart || 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 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); } } diff --git a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h index 8c3baac6a..da8e261e2 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h +++ b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h @@ -11,10 +11,10 @@ enum t_CNNType { AutoDetect, Analogue, Analogue100, - Digital, - DigitalHyprid10, + Digit, + DigitHyprid10, DoubleHyprid10, - Digital100, + Digit100, None }; @@ -26,15 +26,6 @@ class ClassFlowCNNGeneral : std::vector 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 @@ class ClassFlowCNNGeneral : 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 AnalogDigitTransitionStart); + int PointerEvalHybridNew(float zahl, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors = false, float AnalogDigitTransitionStart=9.2); @@ -61,7 +52,7 @@ class ClassFlowCNNGeneral : 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 AnalogDigitTransitionStart=9.2); string getReadoutRawString(int _analog); diff --git a/code/components/jomjol_flowcontroll/ClassFlowControll.cpp b/code/components/jomjol_flowcontroll/ClassFlowControll.cpp index 51578e1ce..474a86ec8 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowControll.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowControll.cpp @@ -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 ClassFlowControll::GetAllDigital() +std::vector 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 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 = GetAllDigital(); - ESP_LOGD(TAG, "After getClassFlowControll::GetAllDigital"); + htmlinfo = GetAllDigit(); + ESP_LOGD(TAG, "After getClassFlowControll::GetAllDigit"); for (int i = 0; i < htmlinfo.size(); ++i) { diff --git a/code/components/jomjol_flowcontroll/ClassFlowControll.h b/code/components/jomjol_flowcontroll/ClassFlowControll.h index 4e8e2f167..40b5ba112 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowControll.h +++ b/code/components/jomjol_flowcontroll/ClassFlowControll.h @@ -61,7 +61,7 @@ class ClassFlowControll : 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 @@ class ClassFlowControll : std::string* getActStatus(); void setActStatus(std::string _aktstatus); - std::vector GetAllDigital(); + std::vector GetAllDigit(); std::vector GetAllAnalog(); - t_CNNType GetTypeDigital(); + t_CNNType GetTypeDigit(); t_CNNType GetTypeAnalog(); #ifdef ENABLE_MQTT diff --git a/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h b/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h index 786713203..08842f0f7 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h +++ b/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h @@ -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 AnalogDigitTransitionStart; // AnalogDigitTransitionStartValue; 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 diff --git a/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp b/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp index 797491f6e..b1162f837 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowMQTT.cpp @@ -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) diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp index a55b4653b..a4463958d 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp @@ -382,7 +382,7 @@ void ClassFlowPostProcessing::handleDecimalSeparator(string _decsep, string _val } } -void ClassFlowPostProcessing::handleAnalogDigitalTransitionStart(string _decsep, string _value) { +void ClassFlowPostProcessing::handleAnalogDigitTransitionStart(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]->AnalogDigitTransitionStart = _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) == "AnalogDigitTRANSITIONSTART") && (splitted.size() > 1)) { + handleAnalogDigitTransitionStart(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->AnalogDigitTransitionStart=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]->AnalogDigitTransitionStart) + 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; diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h index 8782a317b..7b753a4f6 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h @@ -39,7 +39,7 @@ class ClassFlowPostProcessing : 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 handleAnalogDigitTransitionStart(string _decsep, string _value); void handleAllowNegativeRate(string _decsep, string _value); void handleChangeRateThreshold(string _decsep, string _value); diff --git a/code/components/jomjol_flowcontroll/MainFlowControl.cpp b/code/components/jomjol_flowcontroll/MainFlowControl.cpp index 684e3caf2..04b955129 100644 --- a/code/components/jomjol_flowcontroll/MainFlowControl.cpp +++ b/code/components/jomjol_flowcontroll/MainFlowControl.cpp @@ -674,17 +674,17 @@ esp_err_t handler_wasserzaehler(httpd_req_t *req) } else { - /* Digital ROIs */ + /* Digit ROIs */ txt = ""; txt += "

Recognized Digit ROIs (previous round)

\n"; txt += "\n"; std::vector 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)) diff --git a/code/components/jomjol_helper/psram.cpp b/code/components/jomjol_helper/psram.cpp index ce6c1c032..d2caf8565 100644 --- a/code/components/jomjol_helper/psram.cpp +++ b/code/components/jomjol_helper/psram.cpp @@ -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 } diff --git a/code/components/jomjol_helper/psram.h b/code/components/jomjol_helper/psram.h index 880e883ac..71a5436f2 100644 --- a/code/components/jomjol_helper/psram.h +++ b/code/components/jomjol_helper/psram.h @@ -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); diff --git a/code/components/jomjol_logfile/ClassLogFile.cpp b/code/components/jomjol_logfile/ClassLogFile.cpp index b4ec02c9b..3420e6a9a 100644 --- a/code/components/jomjol_logfile/ClassLogFile.cpp +++ b/code/components/jomjol_logfile/ClassLogFile.cpp @@ -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); diff --git a/code/components/jomjol_logfile/ClassLogFile.h b/code/components/jomjol_logfile/ClassLogFile.h index b3ade1cd7..7ce4058e1 100644 --- a/code/components/jomjol_logfile/ClassLogFile.h +++ b/code/components/jomjol_logfile/ClassLogFile.h @@ -39,8 +39,8 @@ class ClassLogFile 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(); diff --git a/code/components/jomjol_mqtt/server_mqtt.cpp b/code/components/jomjol_mqtt/server_mqtt.cpp index 7c7591d0b..adc68e211 100644 --- a/code/components/jomjol_mqtt/server_mqtt.cpp +++ b/code/components/jomjol_mqtt/server_mqtt.cpp @@ -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 diff --git a/code/include/defines.h b/code/include/defines.h index 1ea34e03d..ee5f2c44c 100644 --- a/code/include/defines.h +++ b/code/include/defines.h @@ -187,15 +187,11 @@ //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 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 diff --git a/code/main/server_main.cpp b/code/main/server_main.cpp index ef24fd199..5d9d16f70 100644 --- a/code/main/server_main.cpp +++ b/code/main/server_main.cpp @@ -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; diff --git a/code/test/components/jomjol-flowcontroll/test_PointerEvalAnalogToDigitNew.cpp b/code/test/components/jomjol-flowcontroll/test_PointerEvalAnalogToDigitNew.cpp index 825298ff7..69847981b 100644 --- a/code/test/components/jomjol-flowcontroll/test_PointerEvalAnalogToDigitNew.cpp +++ b/code/test/components/jomjol-flowcontroll/test_PointerEvalAnalogToDigitNew.cpp @@ -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 diff --git a/code/test/components/jomjol-flowcontroll/test_cnnflowcontroll.cpp b/code/test/components/jomjol-flowcontroll/test_cnnflowcontroll.cpp index dac99de13..10d4a28d1 100644 --- a/code/test/components/jomjol-flowcontroll/test_cnnflowcontroll.cpp +++ b/code/test/components/jomjol-flowcontroll/test_cnnflowcontroll.cpp @@ -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)); diff --git a/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp b/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp index a5676b074..024145c91 100644 --- a/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp +++ b/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp @@ -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* 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]->AnalogDigitTransitionStart = _analogdigitTransistionStart; } } } diff --git a/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.h b/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.h index af74e05da..7ca2d076f 100644 --- a/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.h +++ b/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.h @@ -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 analog, std::vector digits, t_CNNType digType = Digital100, +UnderTestPost* init_do_flow(std::vector analog, std::vector 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 analog, std::vector 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 analog, std::vector digits, t_CNNType digType = Digital100, +std::string process_doFlow(std::vector analog, std::vector digits, t_CNNType digType = Digit100, bool checkConsistency=false, bool extendedResolution=false, int decimal_shift=0); /** diff --git a/code/test/components/jomjol-flowcontroll/test_flow_pp_negative.cpp b/code/test/components/jomjol-flowcontroll/test_flow_pp_negative.cpp index 914fa032a..ace52e0cf 100644 --- a/code/test/components/jomjol-flowcontroll/test_flow_pp_negative.cpp +++ b/code/test/components/jomjol-flowcontroll/test_flow_pp_negative.cpp @@ -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); diff --git a/code/test/components/jomjol-flowcontroll/test_flowpostprocessing.cpp b/code/test/components/jomjol-flowcontroll/test_flowpostprocessing.cpp index 64df42a65..6cfbec463 100644 --- a/code/test/components/jomjol-flowcontroll/test_flowpostprocessing.cpp +++ b/code/test/components/jomjol-flowcontroll/test_flowpostprocessing.cpp @@ -178,7 +178,7 @@ void test_doFlowPP2() { std::vector digits = { 1.0, 9.0, 9.0}; // Übergang wurde um 1 erhöht (200, statt 199) std::vector 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()); } diff --git a/code/test/components/jomjol-flowcontroll/test_getReadoutRawString.cpp b/code/test/components/jomjol-flowcontroll/test_getReadoutRawString.cpp index 6ee19aceb..410b2f7a2 100644 --- a/code/test/components/jomjol-flowcontroll/test_getReadoutRawString.cpp +++ b/code/test/components/jomjol-flowcontroll/test_getReadoutRawString.cpp @@ -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()); diff --git a/param-docs/parameter-pages/MQTT/MainTopic.md b/param-docs/parameter-pages/MQTT/MainTopic.md index 837b42eea..390a3d56f 100644 --- a/param-docs/parameter-pages/MQTT/MainTopic.md +++ b/param-docs/parameter-pages/MQTT/MainTopic.md @@ -8,7 +8,7 @@ The single value will be published with the following key: `MAINTOPIC/NUMBER/RES With: - `NUMBER`: The name of the value (a meter might have more than one value). - The names get defined in the analog and digital ROI configuration (defaults to `main`). + The names get defined in the analog and digit ROI configuration (defaults to `main`). - `RESULT_TOPIC`: Automatically filled with the right name, eg. `value`, `rate`, `timestamp`, `error`, .... The general connection status can be found in `MAINTOPIC/CONNECTION`. diff --git a/param-docs/parameter-pages/PostProcessing/NUMBER.AnalogDigitalTransitionStart.md b/param-docs/parameter-pages/PostProcessing/NUMBER.AnalogDigitalTransitionStart.md index d04831aa0..375a2acdd 100644 --- a/param-docs/parameter-pages/PostProcessing/NUMBER.AnalogDigitalTransitionStart.md +++ b/param-docs/parameter-pages/PostProcessing/NUMBER.AnalogDigitalTransitionStart.md @@ -1,4 +1,4 @@ -# Parameter `.AnalogDigitalTransitionStart` +# Parameter `.AnalogDigitTransitionStart` Default Value: `9.2` This can be used if you have wrong values, but the recognition of the individual ROIs are correct. diff --git a/sd-card/config/config.ini b/sd-card/config/config.ini index 54a164158..484e6ad47 100644 --- a/sd-card/config/config.ini +++ b/sd-card/config/config.ini @@ -65,7 +65,7 @@ main.ana4 155 328 92 92 false [PostProcessing] main.DecimalShift = 0 -main.AnalogDigitalTransitionStart = 9.2 +main.AnalogDigitTransitionStart = 9.2 main.ChangeRateThreshold = 2 PreValueUse = true PreValueAgeStartup = 720 diff --git a/sd-card/html/edit_alignment.html b/sd-card/html/edit_alignment.html index a515a0ffe..79892d496 100644 --- a/sd-card/html/edit_alignment.html +++ b/sd-card/html/edit_alignment.html @@ -275,7 +275,7 @@

Alignment Markers

} catch (error){} - document.getElementById("overlaytext").innerHTML = "Device is busy, waiting until the Digitalization Round got completed (this can take several minutes)...

Current step: " + xhttp.responseText; + document.getElementById("overlaytext").innerHTML = "Device is busy, waiting until the Digitization Round got completed (this can take several minutes)...

Current step: " + xhttp.responseText; console.log("Device is busy, waiting 5s then checking again..."); await sleep(5000); } @@ -473,7 +473,7 @@

Alignment Markers

} catch (error){} - document.getElementById("overlaytext").innerHTML = "Device is busy, waiting until the Digitalization Round got completed (this can take several minutes)...

Current step: " + xhttp.responseText; + document.getElementById("overlaytext").innerHTML = "Device is busy, waiting until the Digitization Round got completed (this can take several minutes)...

Current step: " + xhttp.responseText; console.log("Device is busy, waiting 5s then checking again..."); await sleep(5000); } diff --git a/sd-card/html/edit_config_template.html b/sd-card/html/edit_config_template.html index 6861843e0..bb0d01511 100644 --- a/sd-card/html/edit_config_template.html +++ b/sd-card/html/edit_config_template.html @@ -932,15 +932,15 @@

- + +

- + @@ -2190,7 +2190,7 @@

- $TOOLTIP_PostProcessing_NUMBER.AnalogDigitalTransitionStart$TOOLTIP_PostProcessing_NUMBER.AnalogDigitTransitionStart

Digitizer - AI on the edge

-

An ESP32 all inclusive neural network recognition system for meter digitalization

+

An ESP32 all inclusive neural network recognition system for meter Digitization

diff --git a/sd-card/html/readconfigparam.js b/sd-card/html/readconfigparam.js index d3ee78425..ec1047ede 100644 --- a/sd-card/html/readconfigparam.js +++ b/sd-card/html/readconfigparam.js @@ -173,7 +173,7 @@ function ParseConfig() { category[catname]["found"] = false; param[catname] = new Object(); ParamAddValue(param, catname, "DecimalShift", 1, true); - ParamAddValue(param, catname, "AnalogDigitalTransitionStart", 1, true, "9.2"); + ParamAddValue(param, catname, "AnalogDigitTransitionStart", 1, true, "9.2"); ParamAddValue(param, catname, "ChangeRateThreshold", 1, true, "2"); // ParamAddValue(param, catname, "PreValueUse", 1, true, "true"); ParamAddValue(param, catname, "PreValueUse"); diff --git a/sd-card/html/setup.html b/sd-card/html/setup.html index 3c94bf9ba..a51c6ffa8 100644 --- a/sd-card/html/setup.html +++ b/sd-card/html/setup.html @@ -71,7 +71,7 @@

Digitizer - AI on the edge - Initial setup

-

An ESP32 all inclusive neural network recognition system for meter digitalization

+

An ESP32 all inclusive neural network recognition system for meter Digitization

From dab9e428e10a35499e411fae0a7b11eb34989ba5 Mon Sep 17 00:00:00 2001 From: CaCO3 Date: Sun, 1 Sep 2024 22:25:54 +0200 Subject: [PATCH 2/4] added param migration --- code/main/main.cpp | 1 + ...lTransitionStart.md => NUMBER.AnalogDigitTransitionStart.md} | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) rename param-docs/parameter-pages/PostProcessing/{NUMBER.AnalogDigitalTransitionStart.md => NUMBER.AnalogDigitTransitionStart.md} (82%) diff --git a/code/main/main.cpp b/code/main/main.cpp index 6e474514b..11f286b49 100644 --- a/code/main/main.cpp +++ b/code/main/main.cpp @@ -591,6 +591,7 @@ void migrateConfiguration(void) { } if (section == "[PostProcessing]") { + migrated = migrated | replaceString(configLines[i], "AnalogDigitalTransitionStart", "AnalogDigitTransitionStart"); // 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 diff --git a/param-docs/parameter-pages/PostProcessing/NUMBER.AnalogDigitalTransitionStart.md b/param-docs/parameter-pages/PostProcessing/NUMBER.AnalogDigitTransitionStart.md similarity index 82% rename from param-docs/parameter-pages/PostProcessing/NUMBER.AnalogDigitalTransitionStart.md rename to param-docs/parameter-pages/PostProcessing/NUMBER.AnalogDigitTransitionStart.md index 375a2acdd..90bb4f326 100644 --- a/param-docs/parameter-pages/PostProcessing/NUMBER.AnalogDigitalTransitionStart.md +++ b/param-docs/parameter-pages/PostProcessing/NUMBER.AnalogDigitTransitionStart.md @@ -4,6 +4,6 @@ Default Value: `9.2` This can be used if you have wrong values, but the recognition of the individual ROIs are correct. Look for the start of changing of the first digit and note the analog pointer value behind. Set it here. Only used on combination of digits and analog pointers. -See [here](../Watermeter-specific-analog---digital-transition) for details. +See [here](../Watermeter-specific-analog---digit-transition) for details. Range: `6.0` .. `9.9`. From 0cb1885f624044e60bd6eba78185dbd9856cdd6f Mon Sep 17 00:00:00 2001 From: CaCO3 Date: Sun, 29 Sep 2024 21:31:20 +0200 Subject: [PATCH 3/4] Update .github/label-commenter-config.yaml --- .github/label-commenter-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/label-commenter-config.yaml b/.github/label-commenter-config.yaml index 856a37e9d..e8bb86d69 100644 --- a/.github/label-commenter-config.yaml +++ b/.github/label-commenter-config.yaml @@ -119,5 +119,5 @@ If your type is not contained it can be added to our training material, see [here](https://jomjol.github.io/AI-on-the-edge-device-docs/collect-new-images/). discussion: body: | - See [Analog counters](https://jomjol.github.io/neural-network-digital-counter-readout) resp. [Analogue Pointers](https://jomjol.github.io/neural-network-analog-needle-readout) for an overview of all trained data. + See [Digits](https://jomjol.github.io/neural-network-digital-counter-readout) resp. [Analogue Pointers](https://jomjol.github.io/neural-network-analog-needle-readout) for an overview of all trained data. If your type is not contained it can be added to our training material, see [here](https://jomjol.github.io/AI-on-the-edge-device-docs/collect-new-images/). From 595def1ca06a0e8a9bb4b0394c9df143b85c1bee Mon Sep 17 00:00:00 2001 From: CaCO3 Date: Sun, 29 Sep 2024 21:53:52 +0200 Subject: [PATCH 4/4] renamed AnalogDigitTransition* to AnalogToDigitTransition* --- .../jomjol_flowcontroll/ClassFlowCNNGeneral.cpp | 8 ++++---- .../jomjol_flowcontroll/ClassFlowCNNGeneral.h | 6 +++--- .../jomjol_flowcontroll/ClassFlowDefineTypes.h | 2 +- .../jomjol_flowcontroll/ClassFlowPostProcessing.cpp | 12 ++++++------ .../jomjol_flowcontroll/ClassFlowPostProcessing.h | 2 +- code/main/main.cpp | 2 +- .../test_flow_postrocess_helper.cpp | 2 +- sd-card/html/edit_config_template.html | 12 ++++++------ sd-card/html/readconfigparam.js | 2 +- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp index 8ccba87a4..146063f3d 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.cpp @@ -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 AnalogDigitTransitionStart) { +string ClassFlowCNNGeneral::getReadout(int _analog = 0, bool _extendedResolution, int prev, float _before_narrow_Analog, float AnalogToDigitTransitionStart) { string result = ""; if (GENERAL[_analog]->ROI.size() == 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, AnalogDigitTransitionStart); + 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); @@ -216,7 +216,7 @@ int ClassFlowCNNGeneral::PointerEvalHybridNew(float number, float number_of_pred return result; } -int ClassFlowCNNGeneral::PointerEvalAnalogToDigitNew(float number, float numeral_preceder, int eval_predecessors, float AnalogDigitTransitionStart) { +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; @@ -244,7 +244,7 @@ int ClassFlowCNNGeneral::PointerEvalAnalogToDigitNew(float number, float numeral // 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>AnalogDigitTransitionStart || 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) + diff --git a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h index da8e261e2..9946d551a 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h +++ b/code/components/jomjol_flowcontroll/ClassFlowCNNGeneral.h @@ -35,8 +35,8 @@ class ClassFlowCNNGeneral : bool SaveAllFiles; int PointerEvalAnalogNew(float zahl, int numeral_preceder); - int PointerEvalAnalogToDigitNew(float zahl, float numeral_preceder, int eval_predecessors, float AnalogDigitTransitionStart); - int PointerEvalHybridNew(float zahl, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors = false, float AnalogDigitTransitionStart=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); @@ -52,7 +52,7 @@ class ClassFlowCNNGeneral : bool doFlow(string time); string getHTMLSingleStep(string host); - string getReadout(int _analog, bool _extendedResolution = false, int prev = -1, float _before_narrow_Analog = -1, float AnalogDigitTransitionStart=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); diff --git a/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h b/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h index 08842f0f7..63e8afe16 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h +++ b/code/components/jomjol_flowcontroll/ClassFlowDefineTypes.h @@ -63,7 +63,7 @@ struct NumberPost { 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 AnalogDigitTransitionStart; // AnalogDigitTransitionStartValue; 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 diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp index a4463958d..db4a3778b 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp @@ -382,7 +382,7 @@ void ClassFlowPostProcessing::handleDecimalSeparator(string _decsep, string _val } } -void ClassFlowPostProcessing::handleAnalogDigitTransitionStart(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::handleAnalogDigitTransitionStart(string _decsep, s // Set to default first (if nothing else is set) if ((_digit == "default") || (NUMBERS[j]->name == _digit)) { - NUMBERS[j]->AnalogDigitTransitionStart = _zwdc; + NUMBERS[j]->AnalogToDigitTransitionStart = _zwdc; } } @@ -564,8 +564,8 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph) handleDecimalSeparator(splitted[0], splitted[1]); } - if ((toUpper(_param) == "AnalogDigitTRANSITIONSTART") && (splitted.size() > 1)) { - handleAnalogDigitTransitionStart(splitted[0], splitted[1]); + if ((toUpper(_param) == "AnalogToDigitTransitionStart") && (splitted.size() > 1)) { + handleAnalogToDigitTransitionStart(splitted[0], splitted[1]); } if ((toUpper(_param) == "MAXRATEVALUE") && (splitted.size() > 1)) { @@ -677,7 +677,7 @@ void ClassFlowPostProcessing::InitNUMBERS() { _number->DecimalShift = 0; _number->DecimalShiftInitial = 0; _number->isExtendedResolution = false; - _number->AnalogDigitTransitionStart=9.2; + _number->AnalogToDigitTransitionStart=9.2; _number->ChangeRateThreshold = 2; _number->Value = 0; // last value read out, incl. corrections @@ -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]->AnalogDigitTransitionStart) + 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 diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h index 7b753a4f6..e16aa618c 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.h @@ -39,7 +39,7 @@ class ClassFlowPostProcessing : void handleMaxRateValue(string _decsep, string _value); void handleDecimalExtendedResolution(string _decsep, string _value); void handleMaxRateType(string _decsep, string _value); - void handleAnalogDigitTransitionStart(string _decsep, string _value); + void handleAnalogToDigitTransitionStart(string _decsep, string _value); void handleAllowNegativeRate(string _decsep, string _value); void handleChangeRateThreshold(string _decsep, string _value); diff --git a/code/main/main.cpp b/code/main/main.cpp index 9e6ac3925..0340e50f6 100644 --- a/code/main/main.cpp +++ b/code/main/main.cpp @@ -602,7 +602,7 @@ void migrateConfiguration(void) { } if (section == "[PostProcessing]") { - migrated = migrated | replaceString(configLines[i], "AnalogDigitalTransitionStart", "AnalogDigitTransitionStart"); // Rename it + 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 diff --git a/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp b/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp index 024145c91..466d4bd63 100644 --- a/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp +++ b/code/test/components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp @@ -162,7 +162,7 @@ void setAnalogdigitTransistionStart(UnderTestPost* _underTestPost, float _analog std::vector* 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]->AnalogDigitTransitionStart = _analogdigitTransistionStart; + (*NUMBERS)[_n]->AnalogToDigitTransitionStart = _analogdigitTransistionStart; } } } diff --git a/sd-card/html/edit_config_template.html b/sd-card/html/edit_config_template.html index 1ebeba81e..585faf642 100644 --- a/sd-card/html/edit_config_template.html +++ b/sd-card/html/edit_config_template.html @@ -932,15 +932,15 @@

- + + - - $TOOLTIP_PostProcessing_NUMBER.AnalogDigitTransitionStart + $TOOLTIP_PostProcessing_NUMBER.AnalogToDigitTransitionStart @@ -2188,7 +2188,7 @@