mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-10 13:36:54 +03:00
Version
This commit is contained in:
@@ -329,9 +329,15 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
|
||||
return true;
|
||||
}
|
||||
|
||||
zw = ErsetzteN(ReturnRawValue);
|
||||
zw = ErsetzteN(ReturnRawValue);
|
||||
|
||||
|
||||
Value = std::stof(zw);
|
||||
if (checkDigitIncreaseConsistency)
|
||||
{
|
||||
// Value = checkDigitConsistency(Value, DecimalShift, isanalog);
|
||||
}
|
||||
|
||||
zwvalue = RundeOutput(Value, AnzahlAnalog - DecimalShift);
|
||||
|
||||
if ((!AllowNegativeRates) && (Value < PreValue))
|
||||
@@ -413,39 +419,40 @@ string ClassFlowPostProcessing::ErsetzteN(string input)
|
||||
return input;
|
||||
}
|
||||
|
||||
string ClassFlowPostProcessing::checkDigitConsistency(string input, int _decilamshift, int lastvalueanalog){
|
||||
/*
|
||||
if (checkDigitIncreaseConsistency && lastvalueanalog > -1)
|
||||
{
|
||||
int zifferIST;
|
||||
// int substrakt = 0;
|
||||
bool lastcorrected = false;
|
||||
for (int i = input.length() - 1; i >= 0; --i)
|
||||
{
|
||||
zifferIST = input[i] - 48; //std::stoi(std::string(input[i]));
|
||||
if (lastcorrected)
|
||||
{
|
||||
zifferIST--;
|
||||
input[i] = zifferIST + 48;
|
||||
lastcorrected = false;
|
||||
}
|
||||
float ClassFlowPostProcessing::checkDigitConsistency(float input, int _decilamshift, bool _isanalog){
|
||||
int aktdigit, olddigit;
|
||||
int aktdigit_before, olddigit_before;
|
||||
int pot, pot_max;
|
||||
float zw;
|
||||
|
||||
pot = posPunkt - i - 1;
|
||||
zw = PreValue / pow(10, pot);
|
||||
ziffer = ((int) zw) % 10;
|
||||
if (zifferIST < ziffer)
|
||||
{
|
||||
if (lastvalueanalog >= 7)
|
||||
{
|
||||
input[i] = ziffer + 48;
|
||||
lastvalueanalog = ziffer;
|
||||
lastcorrected = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
pot = _decilamshift;
|
||||
if (!_isanalog) // falls es keine analogwerte gibt, kann die letzte nicht bewerte werden
|
||||
{
|
||||
pot++;
|
||||
}
|
||||
*/
|
||||
pot_max = ((int) log10(input)) + 1;
|
||||
|
||||
while (pot <= pot_max)
|
||||
{
|
||||
zw = input / pow(10, pot-1);
|
||||
aktdigit_before = ((int) zw) % 10;
|
||||
zw = PreValue / pow(10, pot-1);
|
||||
olddigit_before = ((int) zw) % 10;
|
||||
|
||||
zw = input / pow(10, pot);
|
||||
aktdigit = ((int) zw) % 10;
|
||||
zw = PreValue / pow(10, pot);
|
||||
olddigit = ((int) zw) % 10;
|
||||
|
||||
if (aktdigit != olddigit) {
|
||||
if (olddigit_before >= aktdigit_before) // stelle vorher hat noch keinen Nulldurchgang --> nachfolgestelle sollte sich nicht verändern
|
||||
{
|
||||
input = input + ((float) (olddigit - aktdigit)) * pow(10, pot); // Neue Digit wird durch alte Digit ersetzt;
|
||||
}
|
||||
}
|
||||
|
||||
pot++;
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user