Sfoglia il codice sorgente

Bug fix DecimalShift

jomjol 5 anni fa
parent
commit
df80124c57

+ 8 - 6
code/lib/jomjol_flowcontroll/ClassFlowPostProcessing.cpp

@@ -20,7 +20,7 @@ string ClassFlowPostProcessing::GetPreValue()
         if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
         if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
         {
         {
             int AnzahlNachkomma = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
             int AnzahlNachkomma = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
-            result =  RundeOutput(PreValue, AnzahlNachkomma + DecimalShift);
+            result =  RundeOutput(PreValue, AnzahlNachkomma - DecimalShift);
         }
         }
     }
     }
 
 
@@ -79,11 +79,10 @@ bool ClassFlowPostProcessing::LoadPreValue(void)
         if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
         if (((*ListFlowControll)[i])->name().compare("ClassFlowAnalog") == 0)
         {
         {
             int AnzahlNachkomma = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
             int AnzahlNachkomma = ((ClassFlowAnalog*)(*ListFlowControll)[i])->AnzahlROIs();
-            ReturnValue = RundeOutput(Value, AnzahlNachkomma + DecimalShift);
+            ReturnValue = RundeOutput(Value, AnzahlNachkomma - DecimalShift);
             ReturnValueNoError = ReturnValue;
             ReturnValueNoError = ReturnValue;
         }
         }
     }
     }
-
     
     
     return true;
     return true;
 }
 }
@@ -172,6 +171,9 @@ bool ClassFlowPostProcessing::ReadParameter(FILE* pfile, string& aktparamgraph)
         if ((toUpper(zerlegt[0]) == "DECIMALSHIFT") && (zerlegt.size() > 1))
         if ((toUpper(zerlegt[0]) == "DECIMALSHIFT") && (zerlegt.size() > 1))
         {
         {
             DecimalShift = stoi(zerlegt[1]);
             DecimalShift = stoi(zerlegt[1]);
+            if (PreValueUse){
+                PreValueOkay = LoadPreValue();
+            }
         }
         }
 
 
         if ((toUpper(zerlegt[0]) == "PREVALUEUSE") && (zerlegt.size() > 1))
         if ((toUpper(zerlegt[0]) == "PREVALUEUSE") && (zerlegt.size() > 1))
@@ -342,13 +344,13 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
         zw = zw + analog;
         zw = zw + analog;
 
 
     Value = std::stof(zw);
     Value = std::stof(zw);
-    zwvalue = RundeOutput(Value, AnzahlNachkomma + DecimalShift);
+    zwvalue = RundeOutput(Value, AnzahlNachkomma - DecimalShift);
 
 
     if ((!AllowNegativeRates) && (Value < PreValue))
     if ((!AllowNegativeRates) && (Value < PreValue))
     {
     {
         error = "Negative Rate - Returned old value - read value: " + zwvalue;
         error = "Negative Rate - Returned old value - read value: " + zwvalue;
         Value = PreValue;
         Value = PreValue;
-        zwvalue = RundeOutput(Value, AnzahlNachkomma + DecimalShift);
+        zwvalue = RundeOutput(Value, AnzahlNachkomma - DecimalShift);
     }
     }
     else
     else
     {
     {
@@ -356,7 +358,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime)
         {
         {
             error = "Rate too high - Returned old value - read value: " + zwvalue;
             error = "Rate too high - Returned old value - read value: " + zwvalue;
             Value = PreValue;
             Value = PreValue;
-            zwvalue = RundeOutput(Value, AnzahlNachkomma + DecimalShift);
+            zwvalue = RundeOutput(Value, AnzahlNachkomma - DecimalShift);
         }
         }
     }
     }
 
 

BIN
firmware/firmware.bin