mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-07 12:06:58 +03:00
add @Plawasan test cases. Works now with setable analogdigitTransistionstart
This commit is contained in:
@@ -228,7 +228,7 @@ int ClassFlowCNNGeneral::ZeigerEvalAnalogToDigitNeu(float zahl, float ziffer_vor
|
|||||||
// Kein Nulldurchgang hat stattgefunden.
|
// Kein Nulldurchgang hat stattgefunden.
|
||||||
// Nur eval_vorgaenger verwendet, da ziffer_vorgaenger hier falsch sein könnte.
|
// Nur eval_vorgaenger verwendet, da ziffer_vorgaenger hier falsch sein könnte.
|
||||||
// ziffer_vorgaenger<=0.1 & eval_vorgaenger=9 entspricht analog wurde zurückgesetzt wegen vorhergehender analog, die noch nicht auf 0 sind.
|
// ziffer_vorgaenger<=0.1 & eval_vorgaenger=9 entspricht analog wurde zurückgesetzt wegen vorhergehender analog, die noch nicht auf 0 sind.
|
||||||
if ((eval_vorgaenger>=9 && (ziffer_vorgaenger>analogDigitalTransitionStart || ziffer_vorgaenger<=0.2) && roundedUp)
|
if ((eval_vorgaenger>=6 && (ziffer_vorgaenger>analogDigitalTransitionStart || ziffer_vorgaenger<=0.2) && roundedUp)
|
||||||
// digit läuft dem Analog vor. Darf aber erst passieren, wenn
|
// digit läuft dem Analog vor. Darf aber erst passieren, wenn
|
||||||
// digit wirklich schnon los läuft, deshalb 9
|
// digit wirklich schnon los läuft, deshalb 9
|
||||||
|| (eval_vorgaenger>9 && ziffer_vorgaenger>analogDigitalTransitionStart && ergebnis_nachkomma<=1))
|
|| (eval_vorgaenger>9 && ziffer_vorgaenger>analogDigitalTransitionStart && ergebnis_nachkomma<=1))
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class ClassFlowCNNGeneral :
|
|||||||
public ClassFlowImage
|
public ClassFlowImage
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
bool debugdetailgeneral = true;
|
bool debugdetailgeneral = false;
|
||||||
t_CNNType CNNType;
|
t_CNNType CNNType;
|
||||||
std::vector<general*> GENERAL;
|
std::vector<general*> GENERAL;
|
||||||
float CNNGoodThreshold;
|
float CNNGoodThreshold;
|
||||||
|
|||||||
@@ -93,4 +93,12 @@ void test_analogToDigit_Transition() {
|
|||||||
// Besonderheit:
|
// Besonderheit:
|
||||||
TEST_ASSERT_EQUAL_INT(5, undertest->ZeigerEvalAnalogToDigitNeu( 5.9, 9.4, 9, 9.2));
|
TEST_ASSERT_EQUAL_INT(5, undertest->ZeigerEvalAnalogToDigitNeu( 5.9, 9.4, 9, 9.2));
|
||||||
|
|
||||||
|
// https://github.com/jomjol/AI-on-the-edge-device/issues/1110#issuecomment-1282168030
|
||||||
|
// Standard: dig=1.8, ana=7.8 => erg=9
|
||||||
|
// Transition = ja
|
||||||
|
// Nulldurchgang = nein
|
||||||
|
// Versatz = nein
|
||||||
|
// Besonderheit: Digit läuft mit Analog mit. Deshalb 1.8 (vs. 7.8)
|
||||||
|
TEST_ASSERT_EQUAL_INT(1, undertest->ZeigerEvalAnalogToDigitNeu( 1.8, 7.8, 7, 7.7));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,3 +142,13 @@ void setDecimalShift(UnderTestPost* _underTestPost, int _decimal_shift) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setAnalogdigitTransistionStart(UnderTestPost* _underTestPost, float _analogdigitTransistionStart) {
|
||||||
|
if (_analogdigitTransistionStart!=0) {
|
||||||
|
std::vector<NumberPost*>* NUMBERS = _underTestPost->GetNumbers();
|
||||||
|
for (int _n = 0; _n < (*NUMBERS).size(); ++_n) {
|
||||||
|
printf("Setting decimal shift on number: %d to %f\n", _n, _analogdigitTransistionStart);
|
||||||
|
(*NUMBERS)[_n]->AnalogDigitalTransitionStart = _analogdigitTransistionStart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -99,4 +99,12 @@ void setExtendedResolution(UnderTestPost* _UnderTestPost, bool _extendedResoluti
|
|||||||
*/
|
*/
|
||||||
void setDecimalShift(UnderTestPost* _UnderTestPost, int decimal_shift);
|
void setDecimalShift(UnderTestPost* _UnderTestPost, int decimal_shift);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the Analogdigit Transistion Start
|
||||||
|
*
|
||||||
|
* @param _underTestPost the testobject
|
||||||
|
* @param _analogdigitTransistionStart the analog to digit transition start
|
||||||
|
*/
|
||||||
|
void setAnalogdigitTransistionStart(UnderTestPost* _underTestPost, float _analogdigitTransistionStart);
|
||||||
|
|
||||||
#endif // TEST_FLOW_H
|
#endif // TEST_FLOW_H
|
||||||
|
|||||||
@@ -366,21 +366,24 @@ void test_doFlow() {
|
|||||||
// Fehler bei V12.0.1
|
// Fehler bei V12.0.1
|
||||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/1110#issuecomment-1262626388
|
// https://github.com/jomjol/AI-on-the-edge-device/issues/1110#issuecomment-1262626388
|
||||||
digits = { 1.2, 6.8, 0.0, 0.0, 5.0, 2.8}; //170.05387 als falsches Ergebnis
|
digits = { 1.2, 6.8, 0.0, 0.0, 5.0, 2.8}; //170.05387 als falsches Ergebnis
|
||||||
|
// letztes digit läuft mit analog zeiger mit. Hier nur lösbar mit setAnalogdigitTransistionStart=7.7
|
||||||
analogs = { 8.7};
|
analogs = { 8.7};
|
||||||
// Aktuell nicht sicher, ob doch
|
expected = "170.0528";
|
||||||
expected = "170.0538";
|
expected_extended= "170.05287";
|
||||||
expected_extended= "170.05387";
|
|
||||||
//expected = "170.0528";
|
|
||||||
//expected_extended= "170.05287";
|
|
||||||
|
|
||||||
// extendResolution=false
|
// extendResolution=false
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, false, -3);
|
UnderTestPost* undertestPost = init_do_flow(analogs, digits, Digital100, false, false, -3);
|
||||||
|
setAnalogdigitTransistionStart(undertestPost, 7.7);
|
||||||
|
result = process_doFlow(undertestPost);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||||
|
delete undertestPost;
|
||||||
|
|
||||||
// checkConsistency=false und extendResolution=true
|
// checkConsistency=false und extendResolution=true
|
||||||
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
undertestPost = init_do_flow(analogs, digits, Digital100, false, true, -3);
|
||||||
|
setAnalogdigitTransistionStart(undertestPost, 7.7);
|
||||||
|
result = process_doFlow(undertestPost);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
delete undertestPost;
|
||||||
|
|
||||||
// Fehler bei rolling post V12.0.1
|
// Fehler bei rolling post V12.0.1
|
||||||
// lokal watermeter1
|
// lokal watermeter1
|
||||||
@@ -459,7 +462,57 @@ void test_doFlow() {
|
|||||||
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
result = process_doFlow(analogs, digits, Digital100, false, true, -3);
|
||||||
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
|
// Fehler V12.0.1
|
||||||
|
// https://github.com/jomjol/AI-on-the-edge-device/issues/1143#issuecomment-1281231468
|
||||||
|
digits = { 1.0, 1.9, 6.0}; // 125.923 als falsches Ergebnis
|
||||||
|
analogs = {9.3, 2.3, 3.1};
|
||||||
|
expected = "126.923";
|
||||||
|
expected_extended= "126.9231";
|
||||||
|
|
||||||
|
// extendResolution=false
|
||||||
|
result = process_doFlow(analogs, digits, Digital100, 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);
|
||||||
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
|
// Fehler V12.0.1
|
||||||
|
// https://github.com/jomjol/AI-on-the-edge-device/issues/1110#issuecomment-1282168030
|
||||||
|
digits = { 3.0, 8.1, 5.9, 0.0, 5.0, 6.7}; // 386.05672 als richtiges Ergebnis. Letztes digit schein mit dem Analogzeiger mitzulaufen
|
||||||
|
analogs = {7.2};
|
||||||
|
expected = "386.0567";
|
||||||
|
expected_extended= "386.05672";
|
||||||
|
|
||||||
|
// extendResolution=false
|
||||||
|
result = process_doFlow(analogs, digits, Digital100, 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);
|
||||||
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
|
||||||
|
// Fehler V12.0.1
|
||||||
|
// https://github.com/jomjol/AI-on-the-edge-device/issues/1110#issuecomment-1282168030
|
||||||
|
digits = { 1.2, 7.0, 1.2, 2.0, 4.0, 1.8}; // 171.24278 als falsches Ergebnis.
|
||||||
|
// Test ist nur erfolgreich mit Veränderung des AnalogdigitTransistionStart
|
||||||
|
analogs = {7.8};
|
||||||
|
expected = "171.2417";
|
||||||
|
expected_extended= "171.24178";
|
||||||
|
|
||||||
|
// extendResolution=false
|
||||||
|
undertestPost = init_do_flow(analogs, digits, Digital100, 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);
|
||||||
|
setAnalogdigitTransistionStart(undertestPost, 7.7);
|
||||||
|
result = process_doFlow(undertestPost);
|
||||||
|
TEST_ASSERT_EQUAL_STRING(expected_extended, result.c_str());
|
||||||
|
delete undertestPost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user