2016-01-03 01:05:35 +00:00
|
|
|
|
using System;
|
2019-03-20 16:39:01 +00:00
|
|
|
|
using System.Collections.Generic;
|
2016-01-03 01:05:35 +00:00
|
|
|
|
using TBF.BenchControl.GenericDevices;
|
2015-12-20 19:48:50 +00:00
|
|
|
|
using TBF.Boxes;
|
|
|
|
|
|
|
|
|
|
|
|
namespace TBF.BenchControl.Sequences
|
|
|
|
|
|
{
|
|
|
|
|
|
public class ProcessData
|
|
|
|
|
|
{
|
2019-09-14 08:44:20 +00:00
|
|
|
|
public static IBackupAndSecurity BackupAndSecurity;
|
|
|
|
|
|
public static IBenchInfo BenchInfo;
|
2017-08-19 10:07:57 +00:00
|
|
|
|
public static IErrorFlags ErrorFlagsComp;
|
2018-09-11 11:39:33 +00:00
|
|
|
|
public static Output.DB.SensusOracle.Database OracleDB;
|
2019-03-20 16:39:01 +00:00
|
|
|
|
public static IList<Output.SensusTestInfo> RawTestInfos; /// Incomplete raw test infos from Oracle DB
|
|
|
|
|
|
public static Output.SensusTestInfo[] CompleteTestInfos; /// Complete TBF test infos obtained as a best mathch
|
2015-12-20 19:48:50 +00:00
|
|
|
|
|
2016-10-18 16:48:20 +00:00
|
|
|
|
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]
|
|
|
|
|
|
|
2019-04-11 11:45:28 +00:00
|
|
|
|
public static double LtrPerRefPulse; /// to calculate the ref.volume
|
2016-10-07 14:22:36 +00:00
|
|
|
|
public static int RefPulses;
|
|
|
|
|
|
public static int RefPulsesDelta;
|
|
|
|
|
|
public static DoubleBox RefFreq = new DoubleBox() { Name = "RefFreq", Format = "F2" };
|
2016-10-18 16:48:20 +00:00
|
|
|
|
public static DoubleBox RefFlow = new DoubleBox() { Name = "RefFlow", Format = "F2" }; /// [m3/h]
|
2016-10-07 14:22:36 +00:00
|
|
|
|
|
2016-10-18 16:48:20 +00:00
|
|
|
|
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]
|
2016-10-07 14:22:36 +00:00
|
|
|
|
|
|
|
|
|
|
public static DateTime TestStartTime;
|
|
|
|
|
|
public static DateTime TestEndTime;
|
2016-01-02 16:53:57 +00:00
|
|
|
|
|
2017-06-07 14:22:18 +00:00
|
|
|
|
public static double StartTime;
|
|
|
|
|
|
public static double EndTime;
|
|
|
|
|
|
|
2016-08-23 10:24:05 +00:00
|
|
|
|
/// Heat meters only
|
2016-10-18 16:48:20 +00:00
|
|
|
|
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]
|
2016-08-23 10:24:05 +00:00
|
|
|
|
|
2016-01-02 16:53:57 +00:00
|
|
|
|
public static Results.BatchResults BatchRslts;
|
2016-01-03 01:05:35 +00:00
|
|
|
|
|
2016-02-13 07:18:49 +00:00
|
|
|
|
public static IRegisterReader[] RegisterReaders;
|
2019-08-15 06:59:51 +00:00
|
|
|
|
|
2019-08-26 15:33:41 +00:00
|
|
|
|
public static bool IsQ2PreCorrectionCalculated;
|
|
|
|
|
|
public static int CalculatedQ2PreCorrectionLR;
|
|
|
|
|
|
public static int CalculatedQ2PreCorrectionRL;
|
2016-07-07 09:08:25 +00:00
|
|
|
|
///
|
2016-02-13 07:18:49 +00:00
|
|
|
|
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];
|
2019-08-15 06:59:51 +00:00
|
|
|
|
|
2019-08-26 15:33:41 +00:00
|
|
|
|
IsQ2PreCorrectionCalculated = false;
|
|
|
|
|
|
CalculatedQ2PreCorrectionLR = 0;
|
|
|
|
|
|
CalculatedQ2PreCorrectionRL = 0;
|
2016-07-07 09:08:25 +00:00
|
|
|
|
}
|
2016-02-13 07:18:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// To clear process values at the beginning of each test
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
protected void ClearProcessValues()
|
|
|
|
|
|
{
|
2016-07-07 09:08:25 +00:00
|
|
|
|
for (int i = 0; i < Config.Data.WMsCount; i++)
|
2016-02-13 07:18:49 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (RegisterReaders[i] != null) RegisterReaders[i].Clear();
|
2016-07-07 09:08:25 +00:00
|
|
|
|
}
|
2016-02-13 07:18:49 +00:00
|
|
|
|
|
2016-02-15 21:48:44 +00:00
|
|
|
|
RefPulses = 0;
|
2016-02-13 07:18:49 +00:00
|
|
|
|
RefFreq.Clear();
|
|
|
|
|
|
RefFlow.Clear();
|
|
|
|
|
|
Mass.Clear();
|
|
|
|
|
|
StartMass.Clear();
|
|
|
|
|
|
EndMass.Clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
///
|
2016-01-04 16:55:39 +00:00
|
|
|
|
/// Statistics of 'continuous' variables (temperature, pressure, flow, etc.)
|
2016-01-03 01:05:35 +00:00
|
|
|
|
///
|
2018-02-11 15:31:25 +00:00
|
|
|
|
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"));
|
|
|
|
|
|
|
2018-02-12 21:26:18 +00:00
|
|
|
|
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"));
|
2018-02-11 15:31:25 +00:00
|
|
|
|
|
|
|
|
|
|
public static Statistics TempRefHiStat = new Statistics();
|
|
|
|
|
|
public static Statistics TempRefLoStat = new Statistics();
|
|
|
|
|
|
public static Statistics Energy = new Statistics();
|
2016-08-21 20:07:20 +00:00
|
|
|
|
public static Statistics VolumeForEnergy = new Statistics();
|
2016-08-19 09:54:30 +00:00
|
|
|
|
public static int lastEnergyUpdateTime;
|
2016-01-03 01:05:35 +00:00
|
|
|
|
|
2018-06-08 12:52:34 +00:00
|
|
|
|
public static Statistics DiverterStart = new Statistics(new Plotter("Div start"));
|
|
|
|
|
|
public static Statistics DiverterEnd = new Statistics(new Plotter("Div end"));
|
|
|
|
|
|
|
2017-05-18 11:22:11 +00:00
|
|
|
|
public static int machineTimeStart;
|
|
|
|
|
|
public static int lastMachineTime;
|
|
|
|
|
|
|
2018-10-11 08:20:44 +00:00
|
|
|
|
protected static void StartNewStatistics(int machineTime, int batchNr, string testName, int repetition, int skippedSamplesCount)
|
2016-01-03 01:05:35 +00:00
|
|
|
|
{
|
2018-06-08 12:52:34 +00:00
|
|
|
|
machineTimeStart = machineTime;
|
2018-10-11 08:20:44 +00:00
|
|
|
|
lastMachineTime = machineTime;
|
2017-05-18 11:22:11 +00:00
|
|
|
|
|
2018-10-11 08:20:44 +00:00
|
|
|
|
AmbTempStat.Start (batchNr, testName, repetition);
|
2018-02-11 15:31:25 +00:00
|
|
|
|
AmbPressStat.Start(batchNr, testName, repetition);
|
2018-10-11 08:20:44 +00:00
|
|
|
|
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);
|
2018-02-11 15:31:25 +00:00
|
|
|
|
VolumeForEnergy.Start(batchNr, testName, repetition);
|
2016-08-19 09:54:30 +00:00
|
|
|
|
lastEnergyUpdateTime = 0;
|
2018-06-08 12:52:34 +00:00
|
|
|
|
}
|
2016-01-03 01:05:35 +00:00
|
|
|
|
|
2017-05-18 11:22:11 +00:00
|
|
|
|
protected static void UpdateAllStatistics(int machineTime)
|
2016-01-03 01:05:35 +00:00
|
|
|
|
{
|
2017-05-18 11:22:11 +00:00
|
|
|
|
int timeDelta = machineTime - lastMachineTime;
|
|
|
|
|
|
|
2016-10-18 16:48:20 +00:00
|
|
|
|
AmbTempStat.Update(AmbTemp);
|
|
|
|
|
|
AmbPressStat.Update(AmbPress);
|
|
|
|
|
|
AmbHumiStat.Update(AmbHumi);
|
2017-08-21 10:36:37 +00:00
|
|
|
|
|
|
|
|
|
|
TempUpStat.Update(TempUp);
|
2016-10-18 16:48:20 +00:00
|
|
|
|
TempDownStat.Update(TempDown);
|
2017-08-21 10:36:37 +00:00
|
|
|
|
TempDiffStat.Update(Math.Abs(TempUp.Val - TempDown.Val));
|
2016-01-03 01:05:35 +00:00
|
|
|
|
TempDivStat.Update(TempDiv);
|
2016-10-18 16:48:20 +00:00
|
|
|
|
PressUpStat.Update(PressUp);
|
|
|
|
|
|
PressDownStat.Update(PressDown);
|
|
|
|
|
|
PressDeltaStat.Update(PressDelta);
|
2017-08-21 10:36:37 +00:00
|
|
|
|
RefFlowStat.Update(RefFlow);
|
2016-10-11 23:23:38 +00:00
|
|
|
|
|
|
|
|
|
|
if (BatchRslts.Batch.HeatMeter)
|
|
|
|
|
|
{
|
2016-10-18 16:48:20 +00:00
|
|
|
|
TempRefHiStat.Update((TempRefHi1.Val + TempRefHi2.Val) / 2);
|
|
|
|
|
|
TempRefLoStat.Update((TempRefLo1.Val + TempRefLo2.Val) / 2);
|
2016-10-11 23:23:38 +00:00
|
|
|
|
}
|
2017-05-18 11:22:11 +00:00
|
|
|
|
|
|
|
|
|
|
lastMachineTime = machineTime;
|
2016-01-03 01:05:35 +00:00
|
|
|
|
}
|
2018-02-11 15:31:25 +00:00
|
|
|
|
|
|
|
|
|
|
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();
|
2018-06-08 12:52:34 +00:00
|
|
|
|
}
|
2015-12-20 19:48:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|