180 lines
7.6 KiB
C#
180 lines
7.6 KiB
C#
using System;
|
|
using TBF.BenchControl.GenericDevices;
|
|
using TBF.Boxes;
|
|
|
|
namespace TBF.BenchControl.Sequences
|
|
{
|
|
public class ProcessData
|
|
{
|
|
public static IBenchInfo BenchInfo;
|
|
public static IErrorFlags ErrorFlagsComp;
|
|
public static Output.DB.SensusOracle.Database OracleDB;
|
|
public static Output.SensusTestInfo[] TestInfos;
|
|
|
|
public static FloatBox AmbTemp = new FloatBox() { Name = "Ambient Temperature", Format = "F1" }; /// [Celsius]
|
|
public static FloatBox AmbPress = new FloatBox() { Name = "Ambient Pressure", Format = "F0", Factor = 1000 }; /// [bar], printed by ToString() in [mbar]
|
|
public static FloatBox AmbHumi = new FloatBox() { Name = "Ambient Humidity", Format = "F1" }; /// [%]
|
|
public static DoubleBox TempUp = new DoubleBox() { Name = "Temperature Up", Format = "F2" }; /// [°C]
|
|
public static DoubleBox TempDown = new DoubleBox() { Name = "Temperature Dn", Format = "F2" }; /// [°C]
|
|
public static DoubleBox TempDiv = new DoubleBox() { Name = "Temperature Div", Format = "F2" }; /// [°C]
|
|
public static FloatBox PressUp = new FloatBox() { Name = "Pressure Up", Format = "F2" }; /// [bar]
|
|
public static FloatBox PressDown = new FloatBox() { Name = "Pressure Dn", Format = "F2" }; /// [bar]
|
|
public static FloatBox PressDelta = new FloatBox() { Name = "Pressure Delta", Format = "F2" }; /// [bar]
|
|
|
|
public static float LtrPerRefPulse; /// to calculate the ref.volume
|
|
public static int RefPulses;
|
|
public static int RefPulsesDelta;
|
|
public static DoubleBox RefFreq = new DoubleBox() { Name = "RefFreq", Format = "F2" };
|
|
public static DoubleBox RefFlow = new DoubleBox() { Name = "RefFlow", Format = "F2" }; /// [m3/h]
|
|
|
|
public static DoubleBox Mass = new DoubleBox() { Name = "Mass", Format = "F3" }; /// [kg]
|
|
public static DoubleBox StartMass = new DoubleBox() { Name = "Start Mass", Format = "F3" }; /// [kg]
|
|
public static DoubleBox EndMass = new DoubleBox() { Name = "End Mass", Format = "F3" }; /// [kg]
|
|
|
|
public static DateTime TestStartTime;
|
|
public static DateTime TestEndTime;
|
|
|
|
public static double StartTime;
|
|
public static double EndTime;
|
|
|
|
/// Heat meters only
|
|
public static DoubleBox TempRefHi1 = new DoubleBox() { Name = "T hi ac 1", Format = "F3" }; /// [°C]
|
|
public static DoubleBox TempRefHi2 = new DoubleBox() { Name = "T hi ac 2", Format = "F3" }; /// [°C]
|
|
public static DoubleBox TempRefLo1 = new DoubleBox() { Name = "T lo ac 1", Format = "F3" }; /// [°C]
|
|
public static DoubleBox TempRefLo2 = new DoubleBox() { Name = "T lo ac 2", Format = "F3" }; /// [°C]
|
|
|
|
public static Results.BatchResults BatchRslts;
|
|
|
|
public static IRegisterReader[] RegisterReaders;
|
|
///
|
|
static ProcessData()
|
|
{
|
|
///
|
|
/// RegisterReaders should never be null, RegisterReader.Length should be Config.Data.WMsCount
|
|
/// RegisterReader[i] where i = 0..Config.Data.WMsCount-1 may be null and should always be tested
|
|
///
|
|
RegisterReaders = new IRegisterReader[Config.Data.WMsCount];
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// To clear process values at the beginning of each test
|
|
/// </summary>
|
|
protected void ClearProcessValues()
|
|
{
|
|
for (int i = 0; i < Config.Data.WMsCount; i++)
|
|
{
|
|
if (RegisterReaders[i] != null) RegisterReaders[i].Clear();
|
|
}
|
|
|
|
RefPulses = 0;
|
|
RefFreq.Clear();
|
|
RefFlow.Clear();
|
|
Mass.Clear();
|
|
StartMass.Clear();
|
|
EndMass.Clear();
|
|
}
|
|
|
|
|
|
///
|
|
/// Statistics of 'continuous' variables (temperature, pressure, flow, etc.)
|
|
///
|
|
public static Statistics AmbTempStat = new Statistics(new Plotter("Ambient temperature"));
|
|
public static Statistics AmbPressStat = new Statistics(new Plotter("Ambient pressure"));
|
|
public static Statistics AmbHumiStat = new Statistics(new Plotter("Ambient humidity"));
|
|
|
|
public static Statistics TempUpStat = new Statistics(0, 7, true, new Plotter("Temperature up"));
|
|
public static Statistics TempDownStat = new Statistics(0, 7, true, new Plotter("Temperature down"));
|
|
public static Statistics TempDiffStat = new Statistics(0, 7, true);
|
|
public static Statistics TempDivStat = new Statistics(0, 7, true, new Plotter("Temperature div"));
|
|
public static Statistics PressUpStat = new Statistics(5, 7, true, new Plotter("Pressure up"));
|
|
public static Statistics PressDownStat = new Statistics(5, 7, true, new Plotter("Pressure down"));
|
|
public static Statistics PressDeltaStat = new Statistics(5, 7, true);
|
|
public static Statistics RefFlowStat = new Statistics(5, 7, true, new Plotter("Flow"));
|
|
|
|
public static Statistics TempRefHiStat = new Statistics();
|
|
public static Statistics TempRefLoStat = new Statistics();
|
|
public static Statistics Energy = new Statistics();
|
|
public static Statistics VolumeForEnergy = new Statistics();
|
|
public static int lastEnergyUpdateTime;
|
|
|
|
public static Statistics DiverterStart = new Statistics(new Plotter("Div start"));
|
|
public static Statistics DiverterEnd = new Statistics(new Plotter("Div end"));
|
|
|
|
public static int machineTimeStart;
|
|
public static int lastMachineTime;
|
|
|
|
protected static void StartNewStatistics(int machineTime, int batchNr, string testName, int repetition, int skippedSamplesCount)
|
|
{
|
|
machineTimeStart = machineTime;
|
|
lastMachineTime = machineTime;
|
|
|
|
AmbTempStat.Start (batchNr, testName, repetition);
|
|
AmbPressStat.Start(batchNr, testName, repetition);
|
|
AmbHumiStat.Start (batchNr, testName, repetition);
|
|
|
|
TempUpStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
|
TempDownStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
|
TempDiffStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
|
TempDivStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
|
PressUpStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
|
PressDownStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
|
PressDeltaStat.Start(batchNr, testName, repetition, skippedSamplesCount);
|
|
RefFlowStat.Start (batchNr, testName, repetition, skippedSamplesCount);
|
|
|
|
TempRefHiStat.Start (batchNr, testName, repetition);
|
|
TempRefLoStat.Start (batchNr, testName, repetition);
|
|
Energy.Start (batchNr, testName, repetition);
|
|
VolumeForEnergy.Start(batchNr, testName, repetition);
|
|
lastEnergyUpdateTime = 0;
|
|
}
|
|
|
|
protected static void UpdateAllStatistics(int machineTime)
|
|
{
|
|
int timeDelta = machineTime - lastMachineTime;
|
|
|
|
AmbTempStat.Update(AmbTemp);
|
|
AmbPressStat.Update(AmbPress);
|
|
AmbHumiStat.Update(AmbHumi);
|
|
|
|
TempUpStat.Update(TempUp);
|
|
TempDownStat.Update(TempDown);
|
|
TempDiffStat.Update(Math.Abs(TempUp.Val - TempDown.Val));
|
|
TempDivStat.Update(TempDiv);
|
|
PressUpStat.Update(PressUp);
|
|
PressDownStat.Update(PressDown);
|
|
PressDeltaStat.Update(PressDelta);
|
|
RefFlowStat.Update(RefFlow);
|
|
|
|
if (BatchRslts.Batch.HeatMeter)
|
|
{
|
|
TempRefHiStat.Update((TempRefHi1.Val + TempRefHi2.Val) / 2);
|
|
TempRefLoStat.Update((TempRefLo1.Val + TempRefLo2.Val) / 2);
|
|
}
|
|
|
|
lastMachineTime = machineTime;
|
|
}
|
|
|
|
protected static void StopRecordingStatistics()
|
|
{
|
|
AmbTempStat.Stop();
|
|
AmbPressStat.Stop();
|
|
AmbHumiStat.Stop();
|
|
|
|
TempUpStat.Stop();
|
|
TempDownStat.Stop();
|
|
TempDiffStat.Stop();
|
|
TempDivStat.Stop();
|
|
PressUpStat.Stop();
|
|
PressDownStat.Stop();
|
|
PressDeltaStat.Stop();
|
|
RefFlowStat.Stop();
|
|
|
|
TempRefHiStat.Stop();
|
|
TempRefLoStat.Stop();
|
|
Energy.Stop();
|
|
VolumeForEnergy.Stop();
|
|
}
|
|
}
|
|
}
|