diff --git a/TBF/Rig/ControlBoard/Uni/StandingStartStopTestOp.cs b/TBF/Rig/ControlBoard/Uni/StandingStartStopTestOp.cs index f2732345c..edfa9c3b7 100644 --- a/TBF/Rig/ControlBoard/Uni/StandingStartStopTestOp.cs +++ b/TBF/Rig/ControlBoard/Uni/StandingStartStopTestOp.cs @@ -5,6 +5,7 @@ using System; using System.Reflection; using System.Text; using System.Windows.Forms; +using Common; using log4net; using TBF.Rig.GenericDevices; @@ -24,6 +25,9 @@ namespace TBF.Rig.ControlBoard.Uni readonly TBF.Rig.Uni.Diverter.Diverter diverter; readonly int pulsesCount; /// Number of reference pulses for a complete test readonly bool withDiverter; /// Test with diverter (and scale) + + private DateTime startTimeForSimulation; + private bool simulationTimerStarted = false; /// /// Internal state of this operation @@ -183,6 +187,28 @@ namespace TBF.Rig.ControlBoard.Uni { log.DebugFormat("Run() opState={0}", opState); + //Simulation of processing time 25 seconds + if (uniCB.DebugLevel == DebugMode.Simulate) + { + if (opState == OpState.StartingTest) + { + startTimeForSimulation = DateTime.Now; + simulationTimerStarted = false; + } + if (opState == OpState.TestInProgress) + { + if (!simulationTimerStarted) + { + startTimeForSimulation = DateTime.Now; + simulationTimerStarted = true; + } + else if (DateTime.Now - startTimeForSimulation > TimeSpan.FromSeconds(25)) + { + return Event.TestCompleted; + } + } + } + switch (opState) { case OpState.StartingTest: diff --git a/TBF/Rig/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TBF/Rig/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs index 5f0264456..35cf0a3ba 100644 --- a/TBF/Rig/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs +++ b/TBF/Rig/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs @@ -691,7 +691,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection tstRslt.TimeBtwnMassMsrmnts = tMass2 - tMass1; tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; tstRslt.VolumeMaster = tstRslt.ConstMasterRaw * tstRslt.PulsesMaster; /// [l] volume from the master flow meter - double flowMID = 3.6 * tstRslt.VolumeMaster / tstRslt.TestTime; /// [m3/h] flow before correction from the master flow meter + double flowMID = tstRslt.TestTime == 0 ? 0 : 3.6 * tstRslt.VolumeMaster / tstRslt.TestTime; /// [m3/h] flow before correction from the master flow meter /// Corrected data tstRslt.MassStart = MeasurementCorrection.CorrectedValue(tstRslt.MassStartRaw, scale.Corrections); @@ -708,7 +708,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection; tstRslt.VolumeCTV /= tstRslt.TestTime; } - tstRslt.Flow = 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime; /// Flow from VolumeCTV and time + tstRslt.Flow = tstRslt.TestTime==0 ? 0 : 3.6 * tstRslt.VolumeCTV / tstRslt.TestTime; /// Flow from VolumeCTV and time tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.ConstMaster = (tstRslt.PulsesMaster != 0) ? (tstRslt.VolumeCTV / tstRslt.PulsesMaster) : tstRslt.ConstMasterCorr; /// Master pulses per liter from the measured mass @@ -719,9 +719,14 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection { tstRslt.TestTimeCorrection = outPath.Diverter.TestTimeCorrection(flowMID); tstRslt.MassCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection; - tstRslt.MassCTV /= tstRslt.TestTime; + if (tstRslt.TestTime!= 0) + tstRslt.MassCTV /= tstRslt.TestTime; + else + { + tstRslt.MassCTV = 0; + } } - tstRslt.MassFlow = 3.6 * tstRslt.MassCTV / tstRslt.TestTime; /// Flow from MassCTV and time + tstRslt.MassFlow = tstRslt.TestTime == 0 ? 0 : 3.6 * tstRslt.MassCTV / tstRslt.TestTime; /// Flow from MassCTV and time tstRslt.MassErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.MassCTV); tstRslt.MassConstMaster = (tstRslt.PulsesMaster != 0) ? (tstRslt.MassCTV / tstRslt.PulsesMaster) : tstRslt.ConstMasterCorr; @@ -1016,8 +1021,8 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection meterRslt.VolumeEnd = dstrReader.VolumeLtrEnd; /// liter meterRslt.VolumeMeter = Math.Abs(dstrReader.VolumeLtrEnd - dstrReader.VolumeLtrStart); - meterRslt.VolumeRef = tstRslt.VolumeCTV * meterRslt.TestTime / tstRslt.TestTime; - meterRslt.PulsesMaster = + meterRslt.VolumeRef = tstRslt.TestTime==0? tstRslt.VolumeCTV : tstRslt.VolumeCTV * meterRslt.TestTime / tstRslt.TestTime; + meterRslt.PulsesMaster = tstRslt.TestTime == 0? tstRslt.PulsesMaster : tstRslt.PulsesMaster * meterRslt.TestTime / tstRslt.TestTime; }