Merge pull request #955 from haverland/rolling

fix https://github.com/jomjol/AI-on-the-edge-device/issues/921#issuec…
This commit is contained in:
jomjol
2022-08-29 18:15:11 +02:00
committed by GitHub
3 changed files with 13 additions and 4 deletions

View File

@@ -232,15 +232,15 @@ int ClassFlowCNNGeneral::ZeigerEvalHybridNeu(float zahl, float zahl_vorgaenger,
} }
// bleibt nur >= 9.5 --> noch kein Nulldurchgang --> 2.8 --> 2, und 3.1 --> 2 // bleibt nur >= 9.5 --> noch kein Nulldurchgang --> 2.8 --> 2, und 3.1 --> 2
// hier auf 4 reduziert, da erst ab Vorgänder 9 anfängt umzustellen. Bei 9.5 Vorgänger kann die aktuelle // alles <=x.6 kann als aktuelle Zahl gelten im Übergang. Bei 9.5 Vorgänger kann die aktuelle
// Zahl noch x.4 - x.5 sein. // Zahl noch x.6 - x.7 sein.
if (ergebnis_nachkomma >= 4) if (ergebnis_nachkomma <= 6)
result = ergebnis_vorkomma; result = ergebnis_vorkomma;
else else
result = (ergebnis_vorkomma - 1 + 10) % 10; result = (ergebnis_vorkomma - 1 + 10) % 10;
if (debugdetailgeneral) LogFile.WriteToFile("ClassFlowCNNGeneral::ZeigerEvalHybridNeu - KEIN Analoger Vorgänger, >= 9.5 --> noch kein Nulldurchgang = " + std::to_string(result) + if (debugdetailgeneral) LogFile.WriteToFile("ClassFlowCNNGeneral::ZeigerEvalHybridNeu - KEIN Analoger Vorgänger, >= 9.5 --> noch kein Nulldurchgang = " + std::to_string(result) +
" zahl: " + std::to_string(zahl) + " zahl_vorgaenger = " + std::to_string(zahl_vorgaenger)+ " eval_vorgaenger = " + std::to_string(eval_vorgaenger) + " DigitalUnschaerfe = " + std::to_string(DigitalUnschaerfe)); " zahl: " + std::to_string(zahl) + " zahl_vorgaenger = " + std::to_string(zahl_vorgaenger)+ " eval_vorgaenger = " + std::to_string(eval_vorgaenger) + " DigitalUnschaerfe = " + std::to_string(DigitalUnschaerfe) + " ergebnis_nachkomma = " + std::to_string(ergebnis_nachkomma));
return result; return result;
} }

View File

@@ -129,6 +129,7 @@ void ClassLogFile::WriteToFile(std::string info, bool _time)
std::string logpath = logroot + "/" + buffer; std::string logpath = logroot + "/" + buffer;
WriteToDedicatedFile(logpath, info, _time); WriteToDedicatedFile(logpath, info, _time);
printf((info + "\n").c_str());
} }
std::string ClassLogFile::GetCurrentFileName() std::string ClassLogFile::GetCurrentFileName()

View File

@@ -158,6 +158,14 @@ void test_doFlow() {
expected = "194.9089"; expected = "194.9089";
result = process_doFlow(analogs, digits); result = process_doFlow(analogs, digits);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str()); TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
// Fehler bei V11.2.0
// https://github.com/jomjol/AI-on-the-edge-device/issues/921#issuecomment-1229552041
digits = { 2.9, 7.0, 7.0, 9.1, 8.1, 8.5}; // 376.9884(1) als falsches Ergebnis
analogs = { 4.1 };
expected = "377988.4";
result = process_doFlow(analogs, digits);
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
} }