@@ -329,9 +329,15 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
329329 return true ;
330330 }
331331
332- zw = ErsetzteN (ReturnRawValue);
332+ zw = ErsetzteN (ReturnRawValue);
333+
333334
334335 Value = std::stof (zw);
336+ if (checkDigitIncreaseConsistency)
337+ {
338+ // Value = checkDigitConsistency(Value, DecimalShift, isanalog);
339+ }
340+
335341 zwvalue = RundeOutput (Value, AnzahlAnalog - DecimalShift);
336342
337343 if ((!AllowNegativeRates) && (Value < PreValue))
@@ -413,39 +419,40 @@ string ClassFlowPostProcessing::ErsetzteN(string input)
413419 return input;
414420}
415421
416- string ClassFlowPostProcessing::checkDigitConsistency (string input, int _decilamshift, int lastvalueanalog){
417- /*
418- if (checkDigitIncreaseConsistency && lastvalueanalog > -1)
422+ float ClassFlowPostProcessing::checkDigitConsistency (float input, int _decilamshift, bool _isanalog){
423+ int aktdigit, olddigit;
424+ int aktdigit_before, olddigit_before;
425+ int pot, pot_max;
426+ float zw;
427+
428+ pot = _decilamshift;
429+ if (!_isanalog) // falls es keine analogwerte gibt, kann die letzte nicht bewerte werden
419430 {
420- int zifferIST;
421- // int substrakt = 0;
422- bool lastcorrected = false;
423- for (int i = input.length() - 1; i >= 0; --i)
424- {
425- zifferIST = input[i] - 48; //std::stoi(std::string(input[i]));
426- if (lastcorrected)
427- {
428- zifferIST--;
429- input[i] = zifferIST + 48;
430- lastcorrected = false;
431- }
431+ pot++;
432+ }
433+ pot_max = ((int ) log10 (input)) + 1 ;
434+
435+ while (pot <= pot_max)
436+ {
437+ zw = input / pow (10 , pot-1 );
438+ aktdigit_before = ((int ) zw) % 10 ;
439+ zw = PreValue / pow (10 , pot-1 );
440+ olddigit_before = ((int ) zw) % 10 ;
441+
442+ zw = input / pow (10 , pot);
443+ aktdigit = ((int ) zw) % 10 ;
444+ zw = PreValue / pow (10 , pot);
445+ olddigit = ((int ) zw) % 10 ;
432446
433- pot = posPunkt - i - 1;
434- zw = PreValue / pow(10, pot);
435- ziffer = ((int) zw) % 10;
436- if (zifferIST < ziffer)
447+ if (aktdigit != olddigit) {
448+ if (olddigit_before <= aktdigit_before) // stelle vorher hat noch keinen Nulldurchgang --> nachfolgestelle sollte sich nicht verändern
437449 {
438- if (lastvalueanalog >= 7)
439- {
440- input[i] = ziffer + 48;
441- lastvalueanalog = ziffer;
442- lastcorrected = true;
443- }
450+ input = input + ((float ) (olddigit - aktdigit)) * pow (10 , pot); // Neue Digit wird durch alte Digit ersetzt;
444451 }
445-
446-
447452 }
453+
454+ pot++;
448455 }
449- */
456+
450457 return input;
451458}
0 commit comments