Sequences.FloatStatistics -> Sequences.Statistics: use double internally, provide double Sum property.

This commit is contained in:
Milan Hanajik 2016-08-19 11:54:30 +02:00
parent 50194001d9
commit ef5bbe737c
4 changed files with 45 additions and 23 deletions

View File

@ -41,7 +41,9 @@ namespace TBF.BenchControl.Operations
/// <summary>Start this operation</summary>
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++)
{

View File

@ -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()

View File

@ -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
/// </summary>
/// <param name="value">New value</param>
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++;
}
/// <summary>
/// Updates statistics
/// </summary>
/// <param name="value">New boxed value</param>
public void Update(TBF.Boxes.DoubleBox box)
{
Update(box.Val);
}
/// <summary>
/// Updates statistics
/// </summary>

View File

@ -516,7 +516,7 @@
<Compile Include="BenchControl\Output\FileWriters\Basic\WriterCfgCtrl.designer.cs">
<DependentUpon>WriterCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Sequences\FloatStatistics.cs" />
<Compile Include="BenchControl\Sequences\Statistics.cs" />
<Compile Include="BenchControl\Sequences\ProcessData.cs" />
<Compile Include="BenchControl\TestMethods\Adjustment\WMErrorsForm12.cs">
<SubType>Form</SubType>