diff --git a/TestBenchFramework/BenchControl/Operations/ReadMoreRegistersOp.cs b/TestBenchFramework/BenchControl/Operations/ReadMoreRegistersOp.cs index 06d7e92d2..b915cd588 100644 --- a/TestBenchFramework/BenchControl/Operations/ReadMoreRegistersOp.cs +++ b/TestBenchFramework/BenchControl/Operations/ReadMoreRegistersOp.cs @@ -41,7 +41,9 @@ namespace TBF.BenchControl.Operations /// Start this operation public void Start() { + int oriRefPulses = Sequences.ProcessData.RefPulses; Sequences.ProcessData.RefPulses = StateMachine.ControlBoard.EtPulses(0); + Sequences.ProcessData.RefPulsesDelta = Sequences.ProcessData.RefPulses - oriRefPulses; for (int i = 0; i < readersCount; i++) { @@ -55,7 +57,9 @@ namespace TBF.BenchControl.Operations bool allDone = true; bool anyError = false; + int oriRefPulses = Sequences.ProcessData.RefPulses; Sequences.ProcessData.RefPulses = StateMachine.ControlBoard.EtPulses(0); + Sequences.ProcessData.RefPulsesDelta = Sequences.ProcessData.RefPulses - oriRefPulses; for (int i = 0; i < readersCount; i++) { diff --git a/TestBenchFramework/BenchControl/Sequences/ProcessData.cs b/TestBenchFramework/BenchControl/Sequences/ProcessData.cs index ec9a963eb..a9d3e17b7 100644 --- a/TestBenchFramework/BenchControl/Sequences/ProcessData.cs +++ b/TestBenchFramework/BenchControl/Sequences/ProcessData.cs @@ -19,6 +19,7 @@ namespace TBF.BenchControl.Sequences public static float LtrPerRefPulse; /// to calculate the ref.volume public static int RefPulses; + public static int RefPulsesDelta; public static FloatBox RefFreq = new FloatBox() { Name = "RefFreq", Format = "F2" }; public static FloatBox RefFlow = new FloatBox() { Name = "RefFlow", Format = "F2" }; /// [m3/h] @@ -68,15 +69,18 @@ namespace TBF.BenchControl.Sequences /// /// Statistics of 'continuous' variables (temperature, pressure, flow, etc.) /// - public static FloatStatistics AmbientTempStat = new FloatStatistics(); - public static FloatStatistics AmbientPressureStat = new FloatStatistics(); - public static FloatStatistics AmbientHumidityStat = new FloatStatistics(); - public static FloatStatistics TempInStat = new FloatStatistics(); - public static FloatStatistics TempOutStat = new FloatStatistics(); - public static FloatStatistics TempDivStat = new FloatStatistics(); - public static FloatStatistics PressureUpStat = new FloatStatistics(); - public static FloatStatistics PressureDownStat = new FloatStatistics(); - public static FloatStatistics RefFlowStat = new FloatStatistics(); + public static Statistics AmbientTempStat = new Statistics(); + public static Statistics AmbientPressureStat = new Statistics(); + public static Statistics AmbientHumidityStat = new Statistics(); + public static Statistics TempInStat = new Statistics(); + public static Statistics TempOutStat = new Statistics(); + public static Statistics TempDivStat = new Statistics(); + public static Statistics PressureUpStat = new Statistics(); + public static Statistics PressureDownStat = new Statistics(); + public static Statistics RefFlowStat = new Statistics(); + + public static Statistics Energy = new Statistics(); + public static int lastEnergyUpdateTime; protected static void ClearAllStatistics() { @@ -89,6 +93,9 @@ namespace TBF.BenchControl.Sequences PressureUpStat.Clear(); PressureDownStat.Clear(); RefFlowStat.Clear(); + + Energy.Clear(); + lastEnergyUpdateTime = 0; } protected static void UpdateAllStatistics() diff --git a/TestBenchFramework/BenchControl/Sequences/FloatStatistics.cs b/TestBenchFramework/BenchControl/Sequences/Statistics.cs similarity index 53% rename from TestBenchFramework/BenchControl/Sequences/FloatStatistics.cs rename to TestBenchFramework/BenchControl/Sequences/Statistics.cs index ab093f0c3..3d1e0af1b 100644 --- a/TestBenchFramework/BenchControl/Sequences/FloatStatistics.cs +++ b/TestBenchFramework/BenchControl/Sequences/Statistics.cs @@ -2,24 +2,26 @@ namespace TBF.BenchControl.Sequences { - public class FloatStatistics + public class Statistics { - float first; - float last; - float min; - float max; - float sum; + double first; + double last; + double min; + double max; + double sum; UInt32 count; - public float First { get { return first; } } - public float Last { get { return last; } } - public float Min { get { return min; } } - public float Max { get { return max; } } - public float Average { get { if (Count > 0) return sum / (float)count; else return 0; } } + public float First { get { return (float)first; } } + public float Last { get { return (float)last; } } + public float Min { get { return (float)min; } } + public float Max { get { return (float)max; } } + public float Average { get { if (Count > 0) return (float)(sum / (double)count); else return 0; } } public UInt32 Count { get { return count; } } + public double Sum { get { return sum; } } - public FloatStatistics() + + public Statistics() { Clear(); } @@ -41,7 +43,7 @@ namespace TBF.BenchControl.Sequences /// Updates statistics /// /// New value - public void Update(float value) + public void Update(double value) { if (count == 0) first = value; last = value; @@ -51,6 +53,15 @@ namespace TBF.BenchControl.Sequences count++; } + /// + /// Updates statistics + /// + /// New boxed value + public void Update(TBF.Boxes.DoubleBox box) + { + Update(box.Val); + } + /// /// Updates statistics /// diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj index 7d5307570..e0f7461db 100644 --- a/TestBenchFramework/TBF.csproj +++ b/TestBenchFramework/TBF.csproj @@ -516,7 +516,7 @@ WriterCfgCtrl.cs - + Form