diff --git a/TBF/BenchControl/Sequences/SequenceBase.cs b/TBF/BenchControl/Sequences/SequenceBase.cs
index 2bd9d6e76..a8ff0965b 100644
--- a/TBF/BenchControl/Sequences/SequenceBase.cs
+++ b/TBF/BenchControl/Sequences/SequenceBase.cs
@@ -1520,12 +1520,127 @@ namespace TBF.BenchControl.Sequences
}
+ ///
+ /// Create a simulated test result (single meter).
+ ///
+ /// Test to be simulated
+ /// Test result
+ public void MakeSimulatedTrivial(Config.Entities.Test test, int repetitionNr, int part)
+ {
+ string fullTestName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
+
+ Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(fullTestName, part);
+ Results.Utils.GetCounterStates(tstRslt, Program.LocalSettings.Counters);
+
+ if (tstRslt == null) return; /// Prevent program crash in certain cases
+
+ tstRslt.AmbTempMean = 20.0f;
+ tstRslt.AmbPressMean = 1.0f;
+ tstRslt.AmbHumiMean = 50.0f;
+ tstRslt.PressUpStart = 1.0f;
+ tstRslt.PressDownStart = 1.0f;
+ tstRslt.TempUpStart = 20.0f;
+ tstRslt.TempDownStart = 20.0f;
+ tstRslt.TempDivStart = 20.0f;
+ tstRslt.PressUpEnd = 1.0f;
+ tstRslt.PressDownEnd = 1.0f;
+ tstRslt.TempUpEnd = 20.0f;
+ tstRslt.TempDownEnd = 20.0f;
+ tstRslt.TempDivEnd = 20.0f;
+ tstRslt.PressUpMean = 1.0f;
+ tstRslt.PressDownMean = 1.0f;
+ tstRslt.TempUpMean = 20.0f;
+ tstRslt.TempDownMean = 20.0f;
+ tstRslt.TempDivMean = 20.0f;
+ tstRslt.PressUpMin = 1.0f;
+ tstRslt.PressDownMin = 1.0f;
+ tstRslt.TempUpMin = 20.0f;
+ tstRslt.TempDownMin = 20.0f;
+ tstRslt.TempDivMin = 20.0f;
+ tstRslt.PressUpMax = 1.0f;
+ tstRslt.PressDownMax = 1.0f;
+ tstRslt.TempUpMax = 20.0f;
+ tstRslt.TempDownMax = 20.0f;
+ tstRslt.TempDivMax = 20.0f;
+ tstRslt.ConductMin = Conductivity.Val;
+ tstRslt.ConductMax = Conductivity.Val;
+
+ tstRslt.DensityIn = Config.Formulas.RealDensity();
+ tstRslt.DensityLine = Config.Formulas.RealDensity();
+ tstRslt.DensityDiv = Config.Formulas.RealDensity();
+
+ tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
+ tstRslt.StartTime = DateTime.Now;
+ tstRslt.EndTime = DateTime.Now + new TimeSpan(0, 0, 1);
+ tstRslt.FlowSetTime = 10;
+ tstRslt.TestTime = tstRslt.TargetTime();
+ tstRslt.PulsesMaster = (outPath.FlowMeter.LtrPerPulse > 1E-6) ? (1.0075 * tstRslt.TargetVolume() / outPath.FlowMeter.LtrPerPulse) : 1;
+ tstRslt.MassStartRaw = 0;
+ tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections);
+ tstRslt.MassEndRaw = tstRslt.TargetVolume() * Config.Formulas.RealDensity() / 1000.0f;
+ tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections);
+ tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime;
+ tstRslt.FlowVolume = 3.6 * outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster / tstRslt.TestTime;
+ tstRslt.MassOfEvapWater = 0;
+ tstRslt.VolumeCTV = 1000 * tstRslt.Batch.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine; /// [l] commercially true volume
+ tstRslt.VolumeMaster = outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
+ tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
+ tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, 0); /// Corrected master pulses per liter
+ tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (outPath.FlowMeter.LtrPerPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
+
+ tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
+
+ tstRslt.FlowMean = (float)RefFlowStat.Average;
+ tstRslt.FlowStart = (float)RefFlowStat.First;
+ tstRslt.FlowEnd = (float)RefFlowStat.Last;
+ tstRslt.FlowMin = (float)RefFlowStat.Min;
+ tstRslt.FlowMax = (float)RefFlowStat.Max;
+
+ for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
+ {
+ float errorPct = 0;
+
+ Results.Entities.MeterTestRslt meterRslt = ProcessData.BatchRslts.GetMeterTestRslt(fullTestName, i, CompoundMeterId.Single);
+ IRegReader regReader = sensPath.RegisterReaders[i];
+
+ if (meterRslt != null && regReader != null)
+ {
+ meterRslt.VolumeMeter = tstRslt.TargetVolume() * (1.0 + 0.01 * errorPct);
+
+ meterRslt.PulsesMeter = regReader.PulsesPerLtr * meterRslt.VolumeMeter;
+ meterRslt.PulsesMaster = tstRslt.PulsesMaster;
+ meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
+ meterRslt.VolumeStart = 0;
+ meterRslt.VolumeEnd = meterRslt.VolumeMeter;
+ meterRslt.VolumeRef = tstRslt.TargetVolume();
+ meterRslt.TimestampStart = 0;
+ meterRslt.TimestampEnd = tstRslt.TargetTime();
+ meterRslt.TestTime = tstRslt.TargetTime();
+ meterRslt.Error = errorPct;
+ meterRslt.Passed = true;
+ meterRslt.TestDone = true;
+ tstRslt.TestDone = true;
+ }
+ }
+
+ tstRslt.Components = Results.Entities.Components
+ .UpdateList(BatchRslts.ComponentsList,
+ new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
+ (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
+ inPath.Pump != null ? inPath.Pump.Name : string.Empty,
+ outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
+ outPath.Scale != null ? outPath.Scale.Name : string.Empty,
+ outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
+ outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
+ }
+
+
///
/// Create a simulated test result (single meter).
///
/// Test to be simulated
/// Test result
- protected void MakeSimulated(Config.Entities.Test test, int repetitionNr, int part, float errorPctBase)
+ public void MakeSimulated(Config.Entities.Test test, int repetitionNr, int part, float errorPctBase)
{
string fullTestName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/Single/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/Single/Component.cs
index e04bc70b7..031abd9d6 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/Single/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/Single/Component.cs
@@ -5,6 +5,8 @@ using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
+using TBF.BenchControl.Sequences;
+using TBF.UiBridge;
namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.Single
{
@@ -33,7 +35,18 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.Single
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new FlyingStartMassCollectionSeq()).Execute(test, repetNr, isLastRepetition, null, null, DebugLevel);
- }
+ if (DebugLevel == DebugMode.Normal)
+ {
+ return (new FlyingStartMassCollectionSeq()).Execute(test, repetNr, isLastRepetition, null, null, DebugLevel);
+ }
+ else
+ {
+ /// DebugLevel == DebugMode.Simulate
+ (new FlyingStartMassCollectionSeq()).MakeSimulatedTrivial(test, repetNr, test.Part);
+ Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Progress.Completed));
+ Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(Results.Utils.GetTestName(test.Name, 1, 1), 0)));
+ return new List { Event.Done };
+ }
+ }
}
}
diff --git a/TBF/BenchControl/TestMethods/LeakTest/TestMethod.cs b/TBF/BenchControl/TestMethods/LeakTest/TestMethod.cs
index 96aad7600..442334aee 100644
--- a/TBF/BenchControl/TestMethods/LeakTest/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/LeakTest/TestMethod.cs
@@ -6,6 +6,8 @@ using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl;
+using TBF.BenchControl.Sequences;
+using TBF.UiBridge;
namespace TBF.BenchControl.TestMethods.LeakTest
{
@@ -34,7 +36,18 @@ namespace TBF.BenchControl.TestMethods.LeakTest
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new LeakTestSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams);
- }
+ if (DebugLevel == DebugMode.Normal)
+ {
+ return (new LeakTestSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams);
+ }
+ else
+ {
+ /// DebugLevel == DebugMode.Simulate
+ (new LeakTestSeq()).MakeSimulatedTrivial(test, repetNr, test.Part);
+ Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Progress.Completed));
+ Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(Results.Utils.GetTestName(test.Name, 1, 1), 0)));
+ return new List { Event.Done };
+ }
+ }
}
}
diff --git a/TBF/BenchControl/TestMethods/PMaxTest/TestMethod.cs b/TBF/BenchControl/TestMethods/PMaxTest/TestMethod.cs
index 3d582b4f3..bfaa2f230 100644
--- a/TBF/BenchControl/TestMethods/PMaxTest/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/PMaxTest/TestMethod.cs
@@ -1,11 +1,13 @@
///
-/// Copyright (c) 2013-2016 Sensus Metering Systems
+/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl;
+using TBF.BenchControl.Sequences;
+using TBF.UiBridge;
namespace TBF.BenchControl.TestMethods.PMaxTest
{
@@ -37,7 +39,18 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new PMaxTestSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams);
+ if (DebugLevel == DebugMode.Normal)
+ {
+ return (new PMaxTestSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams);
+ }
+ else
+ {
+ /// DebugLevel == DebugMode.Simulate
+ (new PMaxTestSeq()).MakeSimulatedTrivial(test, repetNr, test.Part);
+ Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Progress.Completed));
+ Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(Results.Utils.GetTestName(test.Name, 1, 1), 0)));
+ return new List { Event.Done };
+ }
}
}
}
diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/TestMethod.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/TestMethod.cs
index 0f71a05f2..f2032c4ba 100644
--- a/TBF/BenchControl/TestMethods/iPerlCommunication/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/iPerlCommunication/TestMethod.cs
@@ -7,6 +7,8 @@ using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.BenchControl;
+using TBF.BenchControl.Sequences;
+using TBF.UiBridge;
namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
@@ -122,7 +124,18 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new iPerlCommunicationSeq()).Execute(test, repetNr, testMethodCfg, testMethodCfg.TestParams);
- }
+ if (DebugLevel == DebugMode.Normal)
+ {
+ return (new iPerlCommunicationSeq()).Execute(test, repetNr, testMethodCfg, testMethodCfg.TestParams);
+ }
+ else
+ {
+ /// DebugLevel == DebugMode.Simulate
+ (new iPerlCommunicationSeq()).MakeSimulatedTrivial(test, repetNr, test.Part);
+ Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Progress.Completed));
+ Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(Results.Utils.GetTestName(test.Name, 1, 1), 0)));
+ return new List { Event.Done };
+ }
+ }
}
}