diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 33e07316f..6daac0800 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.1.1709.0")] -[assembly: AssemblyFileVersion("3.1.1709.0")] +[assembly: AssemblyVersion("3.1.1734.0")] +[assembly: AssemblyFileVersion("3.1.1734.0")] diff --git a/TBF/Rig/ControlBoard/IControlBoard.cs b/TBF/Rig/ControlBoard/IControlBoard.cs index 4b9fbd980..a1e2d6d96 100644 --- a/TBF/Rig/ControlBoard/IControlBoard.cs +++ b/TBF/Rig/ControlBoard/IControlBoard.cs @@ -66,7 +66,7 @@ namespace TBF.Rig.ControlBoard /// Error .............. unspecified error while running a test /// /// Operation running a test - IOperation StandingStartStopTestOp(Test test, double qFrom, double qTo, int pulsesCount, bool withDiverter); + IOperation StandingStartStopTestOp(Test test, int pulsesCount, bool withDiverter); /// diff --git a/TBF/Rig/ControlBoard/Papouch/PapouchCB.cs b/TBF/Rig/ControlBoard/Papouch/PapouchCB.cs index df241caf9..5a51423dc 100644 --- a/TBF/Rig/ControlBoard/Papouch/PapouchCB.cs +++ b/TBF/Rig/ControlBoard/Papouch/PapouchCB.cs @@ -441,7 +441,7 @@ namespace TBF.Rig.ControlBoard.Papouch /// Start a standing start-stop test /// /// Operation - public IOperation StandingStartStopTestOp(Test test, double qFrom, double qTo, int pulsesCount, bool withDiverter) + public IOperation StandingStartStopTestOp(Test test, int pulsesCount, bool withDiverter) { currentTest = test; return new Operations.ReturnGivenEventOp(Event.TestInProgress); diff --git a/TBF/Rig/ControlBoard/Uni/StandingStartStopTestOp.cs b/TBF/Rig/ControlBoard/Uni/StandingStartStopTestOp.cs index b66826729..747f0a1d0 100644 --- a/TBF/Rig/ControlBoard/Uni/StandingStartStopTestOp.cs +++ b/TBF/Rig/ControlBoard/Uni/StandingStartStopTestOp.cs @@ -12,15 +12,26 @@ namespace TBF.Rig.ControlBoard.Uni private static readonly ILog log = LogManager.GetLogger(typeof(StandingStartStopTestOp)); public override string ToString() { return string.Format("StandingStartStopTestOp()"); } - /// Arguments of the constructor - readonly UniCB uniCB; - readonly TBF.Rig.Uni.RegValve.RegValve regV; + /// + /// Set by the constructor + /// + readonly UniCB uniCB; readonly TBF.Rig.Uni.FlowMeter.FlowMeter flowMeter; readonly TBF.Rig.Uni.Diverter.Diverter diverter; - readonly double qFrom; - readonly double qTo; - readonly int pulsesCount; /// Number of reference pulses for a complete test - readonly bool withDiverter; /// Test with diverter (and scale) + readonly int pulsesCount; /// Number of reference pulses for a complete test + readonly bool withDiverter; /// Test with diverter (and scale) + + /// + /// Internal state of this operation + /// + enum OpState + { + StartingTest, + TestInProgress, + TestCompleted, + } + + OpState opState; /// /// Operation for a Standing start-stop test (constructor) @@ -36,18 +47,13 @@ namespace TBF.Rig.ControlBoard.Uni /// Flow lower limit /// Flow upper limit /// Test duration - number of reference flow meter pulses - public StandingStartStopTestOp(UniCB cb, OutputPath devices, double qFrom, double qTo, int pulsesCount, bool withDiverter) + public StandingStartStopTestOp(UniCB cb, OutputPath devices, int pulsesCount, bool withDiverter) { this.uniCB = cb; flowMeter = devices.FlowMeter as TBF.Rig.Uni.FlowMeter.FlowMeter; if (flowMeter == null) throw new ArgumentNullException("Invalid flow meter"); - regV = devices.RegValve as TBF.Rig.Uni.RegValve.RegValve; - if (regV == null) throw new ArgumentNullException("Invalid regulation valve"); - - this.qFrom = qFrom; - this.qTo = qTo; this.pulsesCount = pulsesCount; this.withDiverter = withDiverter; @@ -60,22 +66,12 @@ namespace TBF.Rig.ControlBoard.Uni log.Debug(this.ToString()); } - /// Internal states of this operation - enum OpState - { - StartingTest, - TestInProgress, - TestCompleted, - } - - OpState opState; - /// /// Start this operation /// public void Start() { - log.InfoFormat("Op.Start() RV#={0} Et#={1} Qfrom={2} Qto={3}", regV.Idx1, flowMeter.Idx1, qFrom, qTo); + log.InfoFormat("Start() Et#={0} pulses={1} withDiverter={2}", flowMeter.Idx1, pulsesCount, withDiverter); /// Start the test (and the flow measurement) uniCB.StartTest(false, flowMeter.Idx1, (withDiverter ? diverter.DiverterNr : 0), 0, @@ -96,30 +92,12 @@ namespace TBF.Rig.ControlBoard.Uni /// public Event Run() { - log.DebugFormat("Op.Run() opState={0}", opState); + log.DebugFormat("Run() opState={0}", opState); switch (opState) { case OpState.StartingTest: - if (qFrom < 0 || qFrom >= qTo || qTo > 1.25 * flowMeter.NominalFlow) - { - return Event.OpArgumentError; /// Invalid qFrom, qTo - } - - if (!flowMeter.MsrmntAvailable || flowMeter.ReadFlow() == 0) // Measured flow is 0 - { - return Event.StartingTest; /// Flow regulation cannot be started - } - - /// Start flow regulation - double reqFlowAve = (qFrom + qTo) / 2; - double reqFlowLo = (0.7 * qFrom) + (0.3 * reqFlowAve); /// Move the lower limit 15% of the range up - double reqFlowHi = (0.7 * qTo) + (0.3 * reqFlowAve); /// Move the upper limit 15% of the range down - /// - uniCB.SetFlow(false, regV.Idx1, 2000 * reqFlowLo / flowMeter.NominalFlow, - 2000 * reqFlowHi / flowMeter.NominalFlow); - opState = OpState.TestInProgress; return Event.TestInProgress; @@ -143,7 +121,7 @@ namespace TBF.Rig.ControlBoard.Uni /// public void Stop() { - log.Info("Op.Stop()"); + log.Info("Stop()"); uniCB.StopAll(false); } } diff --git a/TBF/Rig/ControlBoard/Uni/UniCB.cs b/TBF/Rig/ControlBoard/Uni/UniCB.cs index 1d5109671..50efed19f 100644 --- a/TBF/Rig/ControlBoard/Uni/UniCB.cs +++ b/TBF/Rig/ControlBoard/Uni/UniCB.cs @@ -652,9 +652,9 @@ namespace TBF.Rig.ControlBoard.Uni /// Start a standing start-stop test /// /// Operation running a test - public IOperation StandingStartStopTestOp(Test test, double qFrom, double qTo, int pulsesCount, bool withDiverter) + public IOperation StandingStartStopTestOp(Test test, int pulsesCount, bool withDiverter) { - return new StandingStartStopTestOp(this, devices, qFrom, qTo, pulsesCount, withDiverter); + return new StandingStartStopTestOp(this, devices, pulsesCount, withDiverter); } /// diff --git a/TBF/Rig/TestMethods/StandingStartMassCollection/StandingStartMassCollectionSeq.cs b/TBF/Rig/TestMethods/StandingStartMassCollection/StandingStartMassCollectionSeq.cs index 3139072bf..47d1d2741 100644 --- a/TBF/Rig/TestMethods/StandingStartMassCollection/StandingStartMassCollectionSeq.cs +++ b/TBF/Rig/TestMethods/StandingStartMassCollection/StandingStartMassCollectionSeq.cs @@ -105,6 +105,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection } IList e; /// Events from currently running operations + int waterMetersCount = Math.Min(BenchInfo.WaterMetersCount, sensPath.RegisterReaders.Length); DateTimeBox timeStampStart = new DateTimeBox(); DateTimeBox timeStampEnd = new DateTimeBox(); int tMass1 = 0; @@ -448,8 +449,6 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection /// Temperature is withing required range at this point /// - IOperation testInProgress = cBrd.StandingStartStopTestOp(test, test.Qfrom, test.Qto, 2 * totalPulses, true); - //----------------------------------------------------------------- Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start); //----------------------------------------------------------------- @@ -461,6 +460,10 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } + + IOperation testInProgress = cBrd.StandingStartStopTestOp(test, 2 * totalPulses, true); + IOperation controlFlowOp = cBrd.SetFlowOp(test.Qfrom, test.Qto, RefFlow, int.MaxValue); + State.Create(string.Format("{0}({1}) : Start the standing start/stop test", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperations(readTempPressOps) @@ -580,7 +583,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection } else { - for (int i = 0; i < Common.Data.WMsCount; i++) + for (int i = 0; i < waterMetersCount; i++) { GenericDevices.IRegReader rr = sensPath.RegisterReaders[i]; @@ -667,6 +670,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection .AddOperations(readTempPressOps) .AddOperation(cBrd.OpenStartValveOp(timeStampStart)) .AddOperation(testInProgress) + .AddOperation(controlFlowOp) .AddOperation(processDataLoggingOp) .EnterState(); do { @@ -749,6 +753,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperations(readTempPressOps) + .AddOperation(testInProgress) .AddOperation(scale.ReadStableMassOp(ref EndMass, test.TimeStop2Mass, test.MassMethod, test.MassRepeats, test.MassSpread)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec)) .AddOperation(processDataLoggingOp) @@ -875,7 +880,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection } else { - for (int i = 0; i < Common.Data.WMsCount; i++) + for (int i = 0; i < waterMetersCount; i++) { GenericDevices.IRegReader rr = sensPath.RegisterReaders[i];