From e3f1f2711bcd31449cc42d5cccf494143f392038 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Wed, 23 Aug 2023 18:18:00 +0200 Subject: [PATCH] Start/stop valve switch time measurement implemented in StandingStart... test methods, ver. 3.8.2100 --- Results/Entities/TestRslt.cs | 4 +- TBF/Properties/AssemblyInfo.cs | 4 +- TBF/Rig/BuiltIn/SetValvesOp.cs | 36 ++++++++-- TBF/Rig/ControlBoard/Papouch/PapouchCB.cs | 8 +-- TBF/Rig/ControlBoard/Uni/Enums.cs | 4 +- TBF/Rig/ControlBoard/Uni/GeneralData.cs | 70 ++++++++++--------- TBF/Rig/ControlBoard/Uni/UniCB.cs | 12 ++-- TBF/Rig/GenericDevices/IErrorFlags.cs | 4 +- TBF/Rig/GenericDevices/IValveControl.cs | 4 +- .../StandingStart/StandingStartSeq.cs | 17 ++--- .../StandingStartMassCollWODirSeq.cs | 17 ++--- .../StandingStartMassCollectionSeq.cs | 17 ++--- 12 files changed, 106 insertions(+), 91 deletions(-) diff --git a/Results/Entities/TestRslt.cs b/Results/Entities/TestRslt.cs index 30248393a..0f6be17f5 100644 --- a/Results/Entities/TestRslt.cs +++ b/Results/Entities/TestRslt.cs @@ -50,12 +50,12 @@ namespace Results.Entities public virtual double VolumeMaster { get; set; } /// [l] Volume from the master flow meter public virtual double ErrorMaster { get; set; } /// [%] Error of the master flow meter - public virtual float DiverterStart { get; set; } /// [s] Diverter switch time when test starts + public virtual float DiverterStart { get; set; } /// [s] Diverter switch time or a start/stop valve open time when the test starts public virtual float DivStart10 { get; set; } /// [s] Diverter switch time when test starts at level 10 (e.g. 10%) (not mapped to DB) public virtual float DivStart50 { get; set; } /// [s] Diverter switch time when test starts at level 50 (e.g. 50%) (not mapped to DB) public virtual float DivStart90 { get; set; } /// [s] Diverter switch time when test starts at level 90 (e.g. 90%) (not mapped to DB) - public virtual float DiverterEnd { get; set; } /// [s] Diverter switch time when test ends + public virtual float DiverterEnd { get; set; } /// [s] Diverter switch time or a start/stop valve close time when the test ends public virtual float DivEnd90 { get; set; } /// [s] Diverter switch time when test starts at level 90 (e.g. 90%) (not mapped to DB) public virtual float DivEnd50 { get; set; } /// [s] Diverter switch time when test starts at level 50 (e.g. 50%) (not mapped to DB) public virtual float DivEnd10 { get; set; } /// [s] Diverter switch time when test starts at level 10 (e.g. 10%) (not mapped to DB) diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index a5af192ab..3269b3a08 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("3.8.2097.0")] -[assembly: AssemblyFileVersion("3.8.2097.0")] +[assembly: AssemblyVersion("3.8.2100.0")] +[assembly: AssemblyFileVersion("3.8.2100.0")] diff --git a/TBF/Rig/BuiltIn/SetValvesOp.cs b/TBF/Rig/BuiltIn/SetValvesOp.cs index afa42b80e..35c868bcd 100644 --- a/TBF/Rig/BuiltIn/SetValvesOp.cs +++ b/TBF/Rig/BuiltIn/SetValvesOp.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2020 Sensus Slovensko a.s. +/// Copyright (c) 2013-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -18,8 +18,10 @@ namespace TBF.Rig.BuiltIn /// Set by the constructor IControlBoard cb; DateTimeBox timeStamp; + FloatBox switchTime; + int startStopValveBitNr = 0; - IList switchPointsRaw; + IList switchPointsRaw; IList switchPoints; int nextIx; int swStartTime; @@ -165,21 +167,37 @@ namespace TBF.Rig.BuiltIn { } - /// + /// /// OPEN or CLOSE start/stop valve and associated valves and/or pumps. /// Events: ValvesSet - /// - /// Control board device + /// + /// Control board device /// true: open start valve, false: close start valve /// OutputPath specifying the start valve and associated valves/pumps /// Time stamp of the real valve switch (open or close) - /// Only Elde.Valve valves are used, other valves on the lists are ignored + /// Only Elde.Valve valves are used, other valves on the lists are ignored public SetValvesOp(IControlBoard cb, bool open, OutputPath outPath, DateTimeBox timeStamp) + : this(cb, open, outPath, timeStamp, null) + { + } + + /// + /// OPEN or CLOSE start/stop valve and associated valves and/or pumps. + /// Events: ValvesSet + /// + /// Control board device + /// true: open start valve, false: close start valve + /// OutputPath specifying the start valve and associated valves/pumps + /// Time stamp of the real valve switch (open or close) + /// Only Elde.Valve valves are used, other valves on the lists are ignored + public SetValvesOp(IControlBoard cb, bool open, OutputPath outPath, DateTimeBox timeStamp, FloatBox switchTime) { this.cb = cb; if (this.cb == null) throw new ArgumentNullException("ctrlBoard"); this.timeStamp = timeStamp; + this.switchTime = switchTime; + this.startStopValveBitNr = outPath.StartValve1 is Valve.Valve ? (outPath.StartValve1 as Valve.Valve).BitPosition : 0; IList none = new List(); /// An empty list of valves switchPointsRaw = new List(); @@ -286,6 +304,10 @@ namespace TBF.Rig.BuiltIn /// Start this operation public void Stop() { - } + if (switchTime != null && startStopValveBitNr >= 16 && startStopValveBitNr <= 23 && cb is ControlBoard.Uni.UniCB) + { + switchTime.Val = (cb as ControlBoard.Uni.UniCB).Data.ValveSwitchTime[startStopValveBitNr - 16]; + } + } } } diff --git a/TBF/Rig/ControlBoard/Papouch/PapouchCB.cs b/TBF/Rig/ControlBoard/Papouch/PapouchCB.cs index 7b47dd683..d54dc06c4 100644 --- a/TBF/Rig/ControlBoard/Papouch/PapouchCB.cs +++ b/TBF/Rig/ControlBoard/Papouch/PapouchCB.cs @@ -399,8 +399,8 @@ namespace TBF.Rig.ControlBoard.Papouch /// Events: ValvesSet, ValvesBusy, Error /// /// Created operation - public IOperation OpenStartValveOp() { return OpenStartValveOp(null); } - public IOperation OpenStartValveOp(DateTimeBox openTimeStamp) + public IOperation OpenStartValveOp() { return OpenStartValveOp(null, null); } + public IOperation OpenStartValveOp(DateTimeBox openTimeStamp, FloatBox switchTime) { IOperation op = new BuiltIn.SetValvesOp(this, true, devices, openTimeStamp); log.DebugFormat("{0}.OpenStartValveOp({1}) returns {2}", Name, devices.StartValve1.Name, (op != null) ? op.ToString() : "null"); @@ -412,8 +412,8 @@ namespace TBF.Rig.ControlBoard.Papouch /// Events: ValvesSet, ValvesBusy, Error /// /// Created operation - public IOperation CloseStartValveOp() { return CloseStartValveOp(null); } - public IOperation CloseStartValveOp(DateTimeBox closeTimeStamp) + public IOperation CloseStartValveOp() { return CloseStartValveOp(null, null); } + public IOperation CloseStartValveOp(DateTimeBox closeTimeStamp, FloatBox switchTime) { IOperation op = new BuiltIn.SetValvesOp(this, false, devices, closeTimeStamp); log.DebugFormat("{0}.CloseStartValveOp({1}) returns {2}", Name, devices.StartValve1.Name, (op != null) ? op.ToString() : "null"); diff --git a/TBF/Rig/ControlBoard/Uni/Enums.cs b/TBF/Rig/ControlBoard/Uni/Enums.cs index 9d1613afa..820026301 100644 --- a/TBF/Rig/ControlBoard/Uni/Enums.cs +++ b/TBF/Rig/ControlBoard/Uni/Enums.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2021 Sensus Slovensko a.s. +/// Copyright (c) 2021-2023 Sensus Slovensko a.s. /// namespace TBF.Rig.ControlBoard.Uni { @@ -9,7 +9,7 @@ namespace TBF.Rig.ControlBoard.Uni public const int WMsCount = 20; /// water meters count public const int ADCsCount = 16; /// ADCs count: feedback from RV-s and diverters public const int RVsCount = 8; /// 0..7 - public const int FlowmtrsCount = 7; /// ID=1..7, ID=0 ... flowmeters 1,2,3 parallel + public const int StStopVlvsCount = 8; /// Start/Stop valves count with feedback and switch time measurement public const int DivertersCount = 5; /// 1..5 public const double TimeResolution = 0.0002; /// [s] } diff --git a/TBF/Rig/ControlBoard/Uni/GeneralData.cs b/TBF/Rig/ControlBoard/Uni/GeneralData.cs index 80e68777c..1e360cd27 100644 --- a/TBF/Rig/ControlBoard/Uni/GeneralData.cs +++ b/TBF/Rig/ControlBoard/Uni/GeneralData.cs @@ -28,10 +28,11 @@ namespace TBF.Rig.ControlBoard.Uni public int[] WMeterPuls = new int[Const.WMsCount + 1]; /// WMsCount = 20 public double[] ImpulseTime = new double[Const.WMsCount + 1]; /// WMsCount = 20 public uint[] RegVStatus = new uint[Const.RVsCount + 1 + 1]; /// RVsCount = 8, posledny rValveStatus[9] je prudovy - public float[] RegVMoveTime = new float[Const.RVsCount]; + public float[] ValveSwitchTime = new float[Const.StStopVlvsCount]; + /// time in [s], resolution 10 ms public int DivTime; - public double Ttime; /// s - public double TimeRef; /// s + public double Ttime; /// [s] + public double TimeRef; /// [s] public ulong Vstupy; public Int16[] AnalogInput = new Int16[Const.ADCsCount]; public int[] TemperatureRaw = new int[8]; @@ -192,11 +193,12 @@ namespace TBF.Rig.ControlBoard.Uni byte spare4 = data[offs + (int)Poz.spare4]; /// Byte 272 Chyby485 = GetUInt16(data, offs + (int)Poz.Chyb485); /// Byte 273, 274 !!!!!!!!!!!!!!! uint timeRefRaw = GetUInt24(data, offs + (int)Poz.Tim2); /// Byte 274,275,276 !!!!!!!!!!!!!!! - TimeRef = Convert.ToDouble(timeRefRaw) / 1000.0; /// convert to [s] + TimeRef = Convert.ToDouble(timeRefRaw) / 1000.0; /// convert to [s] - for (int i = 0; i < Const.RVsCount; i++) /// Byte 278 .. 293 + for (int i = 0; i < Const.StStopVlvsCount; i++) /// Byte 278 .. 293 { - RegVMoveTime[i] = 10 * GetUInt16(data, offs + (int)Poz.CasKoh + 2*i); + ValveSwitchTime[i] = + 0.01f * GetUInt16(data, offs + (int)Poz.CasKoh + 2*i); /// float in [s], resolution 10 ms } EtPulses2 = Convert.ToInt32(GetUInt24(data, offs + (int)Poz.ETX2)); /// Byte 294,295,296 @@ -268,33 +270,33 @@ namespace TBF.Rig.ControlBoard.Uni /// public enum Poz : int { - State = 5, /// 5 .. 9 - Vyst = State + 5, /// 10 .. 17 - SDA2 = Vyst + 8, /// 18,19 - Vst = SDA2 + 2, /// 20 .. 24 - Analogy = Vst + 5, /// 25 .. 56 - Groch = Analogy + 2 * Const.ADCsCount, /// 57 (16 analog inputs) - Et1 = Groch + 16, /// 73,74,75 - EtK = Et1 + 3, /// 76,77,78 - spare1 = EtK + 3, /// 79 - Stat5 = spare1 + 1, /// 80 - Stat6 = Stat5 + 1, /// 81 - spare2 = Stat6 + 1, /// 82 - RVs = spare2 + 1, /// 83 - CT1 = RVs + 8, /// 91 - CTR1 = CT1 + 6 * Const.WMsCount, /// 211 - Ttime = CTR1 + 2 * Const.WMsCount, /// 251 - SDA = Ttime + 4, /// 255 - spare3 = SDA + 2, /// 257 - Per1 = spare3 + 1, /// 258 - Per2 = Per1 + 4, /// 262 - Per3 = Per2 + 4, /// 266 - CasKl = Per3 + 5, /// 271 - spare4 = CasKl + 1, /// 272 - Chyb485 = spare4 + 1, /// 273 - Tim2 = Chyb485 + 1, /// 274 - CasKoh = Tim2 + 4, /// 278 - ETX2 = CasKoh + 2 * Const.RVsCount, /// 294 - ETX3 = ETX2 + 3, /// 297 + State = 5, /// 5 .. 9 + Vyst = State + 5, /// 10 .. 17 + SDA2 = Vyst + 8, /// 18,19 + Vst = SDA2 + 2, /// 20 .. 24 + Analogy = Vst + 5, /// 25 .. 56 + Groch = Analogy + 2 * Const.ADCsCount, /// 57 (16 analog inputs) + Et1 = Groch + 16, /// 73,74,75 + EtK = Et1 + 3, /// 76,77,78 + spare1 = EtK + 3, /// 79 + Stat5 = spare1 + 1, /// 80 + Stat6 = Stat5 + 1, /// 81 + spare2 = Stat6 + 1, /// 82 + RVs = spare2 + 1, /// 83 + CT1 = RVs + 8, /// 91 + CTR1 = CT1 + 6 * Const.WMsCount, /// 211 + Ttime = CTR1 + 2 * Const.WMsCount, /// 251 + SDA = Ttime + 4, /// 255 + spare3 = SDA + 2, /// 257 + Per1 = spare3 + 1, /// 258 + Per2 = Per1 + 4, /// 262 + Per3 = Per2 + 4, /// 266 + CasKl = Per3 + 5, /// 271 + spare4 = CasKl + 1, /// 272 + Chyb485 = spare4 + 1, /// 273 + Tim2 = Chyb485 + 1, /// 274 + CasKoh = Tim2 + 4, /// 278 + ETX2 = CasKoh + 2 * Const.StStopVlvsCount, /// 294 + ETX3 = ETX2 + 3, /// 297 } } diff --git a/TBF/Rig/ControlBoard/Uni/UniCB.cs b/TBF/Rig/ControlBoard/Uni/UniCB.cs index a6ccd9ee9..cedcc4353 100644 --- a/TBF/Rig/ControlBoard/Uni/UniCB.cs +++ b/TBF/Rig/ControlBoard/Uni/UniCB.cs @@ -762,10 +762,10 @@ namespace TBF.Rig.ControlBoard.Uni /// Events: ValvesSet, ValvesBusy, Error /// /// Created operation - public IOperation OpenStartValveOp() { return OpenStartValveOp(null); } - public IOperation OpenStartValveOp(DateTimeBox openTimeStamp) + public IOperation OpenStartValveOp() { return OpenStartValveOp(null, null); } + public IOperation OpenStartValveOp(DateTimeBox openTimeStamp, FloatBox switchTime) { - return new BuiltIn.SetValvesOp(this, true, devices, openTimeStamp); + return new BuiltIn.SetValvesOp(this, true, devices, openTimeStamp, switchTime); } /// @@ -773,10 +773,10 @@ namespace TBF.Rig.ControlBoard.Uni /// Events: ValvesSet, ValvesBusy, Error /// /// Created operation - public IOperation CloseStartValveOp() { return CloseStartValveOp(null); } - public IOperation CloseStartValveOp(DateTimeBox closeTimeStamp) + public IOperation CloseStartValveOp() { return CloseStartValveOp(null, null); } + public IOperation CloseStartValveOp(DateTimeBox closeTimeStamp, FloatBox switchTime) { - return new BuiltIn.SetValvesOp(this, false, devices, closeTimeStamp); + return new BuiltIn.SetValvesOp(this, false, devices, closeTimeStamp, switchTime); } #endregion diff --git a/TBF/Rig/GenericDevices/IErrorFlags.cs b/TBF/Rig/GenericDevices/IErrorFlags.cs index 58d770b07..b35de0adc 100644 --- a/TBF/Rig/GenericDevices/IErrorFlags.cs +++ b/TBF/Rig/GenericDevices/IErrorFlags.cs @@ -16,8 +16,8 @@ namespace TBF.Rig.GenericDevices /// A valid test result /// true = diverter was used (times apply) /// true = start/stop valve was used (times apply) - /// Diverter or valve switch time in s on test start - /// Diverter or valve switch time in s on test end + /// Diverter or valve switch time in [s] on test start + /// Diverter or valve switch time in [s] on test end /// Similar to error flags, contains only warnings /// Error flags long GetErrorFlags(TestRslt testRslt, bool diverter, bool startStopValve, float switchTimeStart, float switchTimeEnd, out long infoFlags, out bool stopCycle); diff --git a/TBF/Rig/GenericDevices/IValveControl.cs b/TBF/Rig/GenericDevices/IValveControl.cs index 36ba0047e..ee4e0bdc3 100644 --- a/TBF/Rig/GenericDevices/IValveControl.cs +++ b/TBF/Rig/GenericDevices/IValveControl.cs @@ -43,7 +43,7 @@ namespace TBF.Rig.GenericDevices /// /// Created operation IOperation OpenStartValveOp(); - IOperation OpenStartValveOp(DateTimeBox openTimeStamp); + IOperation OpenStartValveOp(DateTimeBox openTimeStamp, FloatBox switchTime); /// /// Close start/stop valve. @@ -51,6 +51,6 @@ namespace TBF.Rig.GenericDevices /// /// Created operation IOperation CloseStartValveOp(); - IOperation CloseStartValveOp(DateTimeBox closeTimeStamp); + IOperation CloseStartValveOp(DateTimeBox closeTimeStamp, FloatBox switchTime); } } diff --git a/TBF/Rig/TestMethods/StandingStart/StandingStartSeq.cs b/TBF/Rig/TestMethods/StandingStart/StandingStartSeq.cs index 3c8ada37a..9ea2cc844 100644 --- a/TBF/Rig/TestMethods/StandingStart/StandingStartSeq.cs +++ b/TBF/Rig/TestMethods/StandingStart/StandingStartSeq.cs @@ -78,6 +78,8 @@ namespace TBF.Rig.TestMethods.StandingStart int waterMetersCount = Math.Min(BenchInfo.WaterMetersCount, sensPath.RegisterReaders.Length); DateTimeBox timeStampStart = new DateTimeBox(); DateTimeBox timeStampEnd = new DateTimeBox(); + FloatBox startSwitchTime = new FloatBox(); + FloatBox stopSwitchTime = new FloatBox(); checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null); @@ -112,9 +114,6 @@ namespace TBF.Rig.TestMethods.StandingStart Event retVal = Event.Done; - float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms - float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms - int totalPulses = Convert.ToInt32(test.Volume / outPath.FlowMeter.LtrPerPulse); ///============================================================================================ @@ -563,7 +562,7 @@ namespace TBF.Rig.TestMethods.StandingStart State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperations(readTempPressOps) - .AddOperation(cBrd.OpenStartValveOp(timeStampStart)) + .AddOperation(cBrd.OpenStartValveOp(timeStampStart, startSwitchTime)) .AddOperation(testInProgress) .AddOperation(controlFlowOp) .AddOperation(processDataLoggingOp) @@ -614,7 +613,6 @@ namespace TBF.Rig.TestMethods.StandingStart while (cBrd.RefPulses < initialPulsesCount + totalPulses && !e.Contains(Event.TestCompleted) && !e.Contains(Event.Next)); /// Measurement loop end - switchTimeStart = 0.001f * cBrd.ValveOpenCloseTime; log.WarnFormat("Start valve switch time on test start = {0} ms", cBrd.ValveOpenCloseTime); StopRecordingStatistics(); EndTime = (double)StateMachine.Time; @@ -624,7 +622,7 @@ namespace TBF.Rig.TestMethods.StandingStart .AddOperation(checkUiOp) .AddOperations(readTempPressOps) .AddOperation(testInProgress) - .AddOperation(cBrd.CloseStartValveOp(timeStampEnd)) + .AddOperation(cBrd.CloseStartValveOp(timeStampEnd, stopSwitchTime)) .AddOperation(processDataLoggingOp) .EnterState(); do { @@ -641,7 +639,6 @@ namespace TBF.Rig.TestMethods.StandingStart if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } - switchTimeEnd = 0.001f * cBrd.ValveOpenCloseTime; log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime); TestEndTime = DateTime.Now; @@ -830,10 +827,10 @@ namespace TBF.Rig.TestMethods.StandingStart tstRslt.FlowMin = Convert.ToSingle(tstRslt.ConstMaster * RefFlowStat.Min / tstRslt.ConstMasterRaw); tstRslt.FlowMax = Convert.ToSingle(tstRslt.ConstMaster * RefFlowStat.Max / tstRslt.ConstMasterRaw); - tstRslt.DiverterStart = switchTimeStart; - tstRslt.DiverterEnd = switchTimeEnd; + tstRslt.DiverterStart = startSwitchTime.Val; + tstRslt.DiverterEnd = stopSwitchTime.Val; long infoFlags = 0; - tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, true, switchTimeStart, switchTimeEnd, out infoFlags, out stopCycle) : 0; + tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, true, startSwitchTime.Val, stopSwitchTime.Val, out infoFlags, out stopCycle) : 0; tstRslt.InfoFlags = infoFlags; if (compound) diff --git a/TBF/Rig/TestMethods/StandingStartMassCollWODiv/StandingStartMassCollWODirSeq.cs b/TBF/Rig/TestMethods/StandingStartMassCollWODiv/StandingStartMassCollWODirSeq.cs index 3f80c823f..6c3131dd7 100644 --- a/TBF/Rig/TestMethods/StandingStartMassCollWODiv/StandingStartMassCollWODirSeq.cs +++ b/TBF/Rig/TestMethods/StandingStartMassCollWODiv/StandingStartMassCollWODirSeq.cs @@ -93,6 +93,8 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollWODiv int waterMetersCount = Math.Min(BenchInfo.WaterMetersCount, sensPath.RegisterReaders.Length); DateTimeBox timeStampStart = new DateTimeBox(); DateTimeBox timeStampEnd = new DateTimeBox(); + FloatBox startSwitchTime = new FloatBox(); + FloatBox stopSwitchTime = new FloatBox(); int tMass1 = 0; int tMass2 = 0; checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state @@ -129,9 +131,6 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollWODiv Event retVal = Event.Done; - float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms - float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms - int totalPulses = Convert.ToInt32(test.Volume / outPath.FlowMeter.LtrPerPulse); ///============================================================================================ @@ -553,7 +552,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollWODiv State.Create(string.Format("{0}({1}) : Start the test, open the start/stop valve", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperations(readTempPressOps) - .AddOperation(cBrd.OpenStartValveOp(timeStampStart)) + .AddOperation(cBrd.OpenStartValveOp(timeStampStart, startSwitchTime)) .AddOperation(testInProgress) .AddOperation(controlFlowOp) .AddOperation(processDataLoggingOp) @@ -580,7 +579,6 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollWODiv while (cBrd.RefPulses < initialPulsesCount + totalPulses && !e.Contains(Event.TestCompleted) && !e.Contains(Event.Next)); /// Measurement loop end - switchTimeStart = 0.001f * cBrd.ValveOpenCloseTime; log.WarnFormat("Start valve switch time on test start = {0} ms", cBrd.ValveOpenCloseTime); StopRecordingStatistics(); EndTime = (double)StateMachine.Time; @@ -590,7 +588,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollWODiv .AddOperation(checkUiOp) .AddOperations(readTempPressOps) .AddOperation(testInProgress) - .AddOperation(cBrd.CloseStartValveOp(timeStampEnd)) + .AddOperation(cBrd.CloseStartValveOp(timeStampEnd, stopSwitchTime)) .AddOperation(processDataLoggingOp) .EnterState(); do { @@ -599,7 +597,6 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollWODiv } while (e.Contains(Event.ValvesBusy)); - switchTimeEnd = 0.001f * cBrd.ValveOpenCloseTime; log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime); if (heatMetersPath == null) @@ -830,11 +827,11 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollWODiv tstRslt.FlowMin = (float)RefFlowStat.Min; tstRslt.FlowMax = (float)RefFlowStat.Max; - tstRslt.DiverterStart = switchTimeStart; - tstRslt.DiverterEnd = switchTimeEnd; + tstRslt.DiverterStart = startSwitchTime.Val; + tstRslt.DiverterEnd = stopSwitchTime.Val; long infoFlags = 0; - tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, true, switchTimeStart, switchTimeEnd, out infoFlags, out stopCycle) : 0; + tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, true, startSwitchTime.Val, stopSwitchTime.Val, out infoFlags, out stopCycle) : 0; tstRslt.InfoFlags = infoFlags; /// diff --git a/TBF/Rig/TestMethods/StandingStartMassCollection/StandingStartMassCollectionSeq.cs b/TBF/Rig/TestMethods/StandingStartMassCollection/StandingStartMassCollectionSeq.cs index 126941da9..c80ff78c8 100644 --- a/TBF/Rig/TestMethods/StandingStartMassCollection/StandingStartMassCollectionSeq.cs +++ b/TBF/Rig/TestMethods/StandingStartMassCollection/StandingStartMassCollectionSeq.cs @@ -102,6 +102,8 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection int waterMetersCount = Math.Min(BenchInfo.WaterMetersCount, sensPath.RegisterReaders.Length); DateTimeBox timeStampStart = new DateTimeBox(); DateTimeBox timeStampEnd = new DateTimeBox(); + FloatBox startSwitchTime = new FloatBox(); + FloatBox stopSwitchTime = new FloatBox(); int tMass1 = 0; int tMass2 = 0; checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state @@ -138,9 +140,6 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection Event retVal = Event.Done; - float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms - float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms - int totalPulses = Convert.ToInt32(test.Volume / outPath.FlowMeter.LtrPerPulse); ///============================================================================================ @@ -652,7 +651,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection State.Create(string.Format("{0}({1}) : Start the test, open the start/stop valve", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperations(readTempPressOps) - .AddOperation(cBrd.OpenStartValveOp(timeStampStart)) + .AddOperation(cBrd.OpenStartValveOp(timeStampStart, startSwitchTime)) .AddOperation(testInProgress) .AddOperation(controlFlowOp) .AddOperation(processDataLoggingOp) @@ -703,7 +702,6 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection while (cBrd.RefPulses < initialPulsesCount + totalPulses && !e.Contains(Event.TestCompleted) && !e.Contains(Event.Next)); /// Measurement loop end - switchTimeStart = 0.001f * cBrd.ValveOpenCloseTime; log.WarnFormat("Start valve switch time on test start = {0} ms", cBrd.ValveOpenCloseTime); StopRecordingStatistics(); EndTime = (double)StateMachine.Time; @@ -713,7 +711,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection .AddOperation(checkUiOp) .AddOperations(readTempPressOps) .AddOperation(testInProgress) - .AddOperation(cBrd.CloseStartValveOp(timeStampEnd)) + .AddOperation(cBrd.CloseStartValveOp(timeStampEnd, stopSwitchTime)) .AddOperation(processDataLoggingOp) .EnterState(); do { @@ -722,7 +720,6 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection } while (e.Contains(Event.ValvesBusy)); - switchTimeEnd = 0.001f * cBrd.ValveOpenCloseTime; log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime); if (heatMetersPath == null) @@ -973,11 +970,11 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection tstRslt.FlowMin = (float)RefFlowStat.Min; tstRslt.FlowMax = (float)RefFlowStat.Max; - tstRslt.DiverterStart = switchTimeStart; - tstRslt.DiverterEnd = switchTimeEnd; + tstRslt.DiverterStart = startSwitchTime.Val; + tstRslt.DiverterEnd = stopSwitchTime.Val; long infoFlags = 0; - tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, true, switchTimeStart, switchTimeEnd, out infoFlags, out stopCycle) : 0; + tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, true, startSwitchTime.Val, stopSwitchTime.Val, out infoFlags, out stopCycle) : 0; tstRslt.InfoFlags = infoFlags; if (compound)