Changes for Xylem Nanjing, ver. 3.1.1676

This commit is contained in:
Milan Hanajik
2021-06-18 15:35:46 +02:00
parent f1ef16e1a3
commit 827a9f7c58
837 changed files with 46518 additions and 5851 deletions
@@ -5,15 +5,18 @@ using System;
using System.Collections.Generic;
using System.Text;
using log4net;
using Common;
using Config.Entities;
using TBF.Rig;
using TBF.Boxes;
using TBF.Resources;
using TBF.UiBridge;
using TBF.Rig.GenericDevices;
using TBF.Rig.Sequences;
namespace TBF.Rig.TestMethods.DiverterTest
{
public class DiverterTestSeq : Sequences.SequenceBase
public class DiverterTestSeq : SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(DiverterTestSeq));
@@ -217,7 +220,7 @@ namespace TBF.Rig.TestMethods.DiverterTest
Bridge.OnActivity(this, Strings.Starting_the_pump);
//------------------------------------------------
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.FlowSetting));
int flowSetTime0 = StateMachine.Time;
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
@@ -230,8 +233,8 @@ namespace TBF.Rig.TestMethods.DiverterTest
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.FlowSetting));
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -248,8 +251,8 @@ namespace TBF.Rig.TestMethods.DiverterTest
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.FlowSetting));
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -282,8 +285,8 @@ namespace TBF.Rig.TestMethods.DiverterTest
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.FlowSetting));
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -300,8 +303,8 @@ namespace TBF.Rig.TestMethods.DiverterTest
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.FlowSetting));
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -448,10 +451,10 @@ namespace TBF.Rig.TestMethods.DiverterTest
///
/// Initialize cumulated reference and water metert pulses
///
int[] cumulativeEtPulses = new int[Config.Data.WMsCount + 1]; /// 0 .. Config.Data.WMsCount
int[] cumulativeWMPulses = new int[Config.Data.WMsCount + 1]; /// 1 .. Config.Data.WMsCount
double[] cumulativeTestTime = new double[Config.Data.WMsCount + 1]; /// 0 .. Config.Data.WMsCount
for (int i = 0; i <= Config.Data.WMsCount; i++)
int[] cumulativeEtPulses = new int[ProcessData.WMsCount + 1]; /// 0 .. ProcessData.WMsCount
int[] cumulativeWMPulses = new int[ProcessData.WMsCount + 1]; /// 1 .. ProcessData.WMsCount
double[] cumulativeTestTime = new double[ProcessData.WMsCount + 1]; /// 0 .. ProcessData.WMsCount
for (int i = 0; i <= ProcessData.WMsCount; i++)
{
cumulativeEtPulses[i] = 0;
if (i > 0) cumulativeWMPulses[i] = 0;
@@ -509,8 +512,8 @@ namespace TBF.Rig.TestMethods.DiverterTest
RefFlow.Val = outPath.FlowMeter.ReadFlow();
UpdateAllStatistics(StateMachine.Time);
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Progress.Test));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.Test));
}
while (!e.Contains(Event.TestCompleted) && !e.Contains(Event.Next));
@@ -537,7 +540,7 @@ namespace TBF.Rig.TestMethods.DiverterTest
/// Accumulate partial pulses
cumulativeEtPulses[0] += cBrd.RefPulses;
cumulativeTestTime[0] += cBrd.TestTime;
for (int i = 1; i <= Config.Data.WMsCount; i++)
for (int i = 1; i <= ProcessData.WMsCount; i++)
{
cumulativeEtPulses[i] += cBrd.RefPulsesWM(i);
cumulativeWMPulses[i] += cBrd.PulsesWM(i);
@@ -640,7 +643,7 @@ namespace TBF.Rig.TestMethods.DiverterTest
///
cumulativeEtPulses[0] += cBrd.RefPulses;
cumulativeTestTime[0] += cBrd.TestTime;
for (int i = 1; i <= Config.Data.WMsCount; i++)
for (int i = 1; i <= ProcessData.WMsCount; i++)
{
cumulativeEtPulses[i] += cBrd.RefPulsesWM(i);
cumulativeWMPulses[i] += cBrd.PulsesWM(i);
@@ -666,9 +669,9 @@ namespace TBF.Rig.TestMethods.DiverterTest
tstRslt.TimeBtwnMassMsrmnts = tMass2 - tMass1;
tstRslt.PulsesMaster = Convert.ToDouble(cumulativeEtPulses[0]); /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = StartMass.Val;
tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, scale.Corrections);
tstRslt.MassStart = MeasurementCorrection.CorrectedValue(tstRslt.MassStartRaw, scale.Corrections);
tstRslt.MassEndRaw = EndMass.Val;
tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, scale.Corrections);
tstRslt.MassEnd = MeasurementCorrection.CorrectedValue(tstRslt.MassEndRaw, scale.Corrections);
tstRslt.MassOfEvapWater = (double)tstRslt.TimeBtwnMassMsrmnts * outPath.Scale.EvaporationRate(tstRslt.TempDivMean);
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart + tstRslt.MassOfEvapWater) / tstRslt.TestTime; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
@@ -684,7 +687,7 @@ namespace TBF.Rig.TestMethods.DiverterTest
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
/// Calculated master pulses per liter
tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
tstRslt.FlowMean = (float)RefFlowStat.Average;
tstRslt.FlowStart = (float)RefFlowStat.First;
@@ -715,7 +718,7 @@ namespace TBF.Rig.TestMethods.DiverterTest
if (!test.IsPartCompatible(Utils.PartNr(i + 1, BatchRslts.Batch.Compound))) continue;
/// MetersKind.Single meters
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Common.CompoundMeterId.Single);
GenericDevices.IRegReader regReader = sensPath.RegisterReaders[i];
GenericDevices.IRegReaderDatastream dstrReader = regReader as GenericDevices.IRegReaderDatastream;
TestMethods.iPerlCommunication.iPerlHead.IperlHead iPerl = regReader as TestMethods.iPerlCommunication.iPerlHead.IperlHead;
@@ -797,7 +800,7 @@ namespace TBF.Rig.TestMethods.DiverterTest
}
}
meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.VolumeCTV, tstRslt.TestTime) + test.Uncertainty)
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.VolumeCTV, tstRslt.TestTime) - test.Uncertainty)
@@ -837,7 +840,7 @@ namespace TBF.Rig.TestMethods.DiverterTest
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt));
}
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.TransitionAfter));
/// Append the results to the CSV-file
allResults.Info(TestResult2CsvLine(testName, test.Part));