diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValve.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValve.cs index 4c921f1dd..a765b0b0d 100644 --- a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValve.cs +++ b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValve.cs @@ -129,7 +129,7 @@ namespace TBF.BenchControl.Elde.RegulValve /// SetFlowOp instance public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow, int timeout) { - return new SetFlowOp(ControlBoard, this, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout); + return new SetFlowOp(ControlBoard, this, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, RegulValveCfg.ReTryCommands, timeout); } /// @@ -144,7 +144,7 @@ namespace TBF.BenchControl.Elde.RegulValve /// SetFlowOp instance public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow, int timeout, float filterConstant) { - return new SetFlowOp(ControlBoard, this, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout, true); + return new SetFlowOp(ControlBoard, this, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, RegulValveCfg.ReTryCommands, timeout, true); } /// diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs index 69017199b..7a5e51eeb 100644 --- a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs +++ b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfg.cs @@ -21,8 +21,9 @@ namespace TBF.BenchControl.Elde.RegulValve public int AdcValueClosed; /// 0..1023 public int AdcValueOpen; /// 0..1023 public int StableTimeMs; /// 200..1500 ms - public bool StoredPositionReuse; /// true = store and re-use previous regulation valve positions public int FlowStableSec; /// 0..60 sec + public bool StoredPositionReuse; /// true = store and re-use previous regulation valve positions + public bool ReTryCommands; /// /// Stabilization time when setting the flow: 0=200ms, step 50ms, max. 1.5 sec. @@ -45,21 +46,23 @@ namespace TBF.BenchControl.Elde.RegulValve AdcValueClosed = 100; AdcValueOpen = 500; StableTimeMs = 500; - StoredPositionReuse = false; FlowStableSec = 5; + StoredPositionReuse = false; + ReTryCommands = false; } public string ToString(int i) { - return string.Format("Name={0}, Parent={1}, Idx1={2}, ADC-Closed={3}, ADC-Open={4}, StabTm={5}ms, PosReuse={6}, FlowStable={7}s", + return string.Format("Name={0}, Parent={1}, Idx1={2}, ADC-Closed={3}, ADC-Open={4}, StabTm={5}ms, FlowStable={6}s, PosReuse={7}, ReTryCmds={8}", Name, (string.IsNullOrEmpty(ParentName) ? "-" : ParentName), Idx1, AdcValueClosed, AdcValueOpen, StableTimeMs, + FlowStableSec, StoredPositionReuse, - FlowStableSec); + ReTryCommands); } } } diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.Designer.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.Designer.cs index c9f2b5a76..173760d25 100644 --- a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.Designer.cs +++ b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.Designer.cs @@ -69,6 +69,7 @@ namespace TBF.BenchControl.Elde.RegulValve this.label4 = new System.Windows.Forms.Label(); this.categoryComboBox = new System.Windows.Forms.ComboBox(); this.categoryLabel = new System.Windows.Forms.Label(); + this.reTryCommandsCheckBox = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -81,7 +82,7 @@ namespace TBF.BenchControl.Elde.RegulValve this.positionTextBox.Location = new System.Drawing.Point(138, 114); this.positionTextBox.Name = "positionTextBox"; this.positionTextBox.Size = new System.Drawing.Size(46, 20); - this.positionTextBox.TabIndex = 7; + this.positionTextBox.TabIndex = 8; // // positionLabel // @@ -89,7 +90,7 @@ namespace TBF.BenchControl.Elde.RegulValve this.positionLabel.Location = new System.Drawing.Point(28, 117); this.positionLabel.Name = "positionLabel"; this.positionLabel.Size = new System.Drawing.Size(18, 13); - this.positionLabel.TabIndex = 6; + this.positionLabel.TabIndex = 7; this.positionLabel.Text = "ID"; // // parentNameLabel @@ -133,7 +134,7 @@ namespace TBF.BenchControl.Elde.RegulValve this.adcClosedLabel.Location = new System.Drawing.Point(28, 141); this.adcClosedLabel.Name = "adcClosedLabel"; this.adcClosedLabel.Size = new System.Drawing.Size(93, 13); - this.adcClosedLabel.TabIndex = 8; + this.adcClosedLabel.TabIndex = 9; this.adcClosedLabel.Text = "ADC when Closed"; // // adcClosedTextBox @@ -142,7 +143,7 @@ namespace TBF.BenchControl.Elde.RegulValve this.adcClosedTextBox.Location = new System.Drawing.Point(138, 138); this.adcClosedTextBox.Name = "adcClosedTextBox"; this.adcClosedTextBox.Size = new System.Drawing.Size(46, 20); - this.adcClosedTextBox.TabIndex = 9; + this.adcClosedTextBox.TabIndex = 10; // // adcOpenTextBox // @@ -150,7 +151,7 @@ namespace TBF.BenchControl.Elde.RegulValve this.adcOpenTextBox.Location = new System.Drawing.Point(138, 162); this.adcOpenTextBox.Name = "adcOpenTextBox"; this.adcOpenTextBox.Size = new System.Drawing.Size(46, 20); - this.adcOpenTextBox.TabIndex = 11; + this.adcOpenTextBox.TabIndex = 12; // // adcOpenLabel // @@ -158,7 +159,7 @@ namespace TBF.BenchControl.Elde.RegulValve this.adcOpenLabel.Location = new System.Drawing.Point(28, 165); this.adcOpenLabel.Name = "adcOpenLabel"; this.adcOpenLabel.Size = new System.Drawing.Size(87, 13); - this.adcOpenLabel.TabIndex = 10; + this.adcOpenLabel.TabIndex = 11; this.adcOpenLabel.Text = "ADC when Open"; // // parentNameComboBox @@ -174,10 +175,10 @@ namespace TBF.BenchControl.Elde.RegulValve // this.storedPosReuseCheckBox.AutoSize = true; this.storedPosReuseCheckBox.Enabled = false; - this.storedPosReuseCheckBox.Location = new System.Drawing.Point(31, 213); + this.storedPosReuseCheckBox.Location = new System.Drawing.Point(31, 239); this.storedPosReuseCheckBox.Name = "storedPosReuseCheckBox"; this.storedPosReuseCheckBox.Size = new System.Drawing.Size(162, 17); - this.storedPosReuseCheckBox.TabIndex = 14; + this.storedPosReuseCheckBox.TabIndex = 17; this.storedPosReuseCheckBox.Text = "Enable stored position re-use"; this.storedPosReuseCheckBox.UseVisualStyleBackColor = true; // @@ -187,7 +188,7 @@ namespace TBF.BenchControl.Elde.RegulValve this.stableTimeTextBox.Location = new System.Drawing.Point(138, 186); this.stableTimeTextBox.Name = "stableTimeTextBox"; this.stableTimeTextBox.Size = new System.Drawing.Size(46, 20); - this.stableTimeTextBox.TabIndex = 13; + this.stableTimeTextBox.TabIndex = 14; // // stableTimeLabel // @@ -195,13 +196,13 @@ namespace TBF.BenchControl.Elde.RegulValve this.stableTimeLabel.Location = new System.Drawing.Point(28, 189); this.stableTimeLabel.Name = "stableTimeLabel"; this.stableTimeLabel.Size = new System.Drawing.Size(81, 13); - this.stableTimeLabel.TabIndex = 12; + this.stableTimeLabel.TabIndex = 13; this.stableTimeLabel.Text = "Stable time [ms]"; // // flowStableSecTextBox // this.flowStableSecTextBox.Enabled = false; - this.flowStableSecTextBox.Location = new System.Drawing.Point(138, 237); + this.flowStableSecTextBox.Location = new System.Drawing.Point(138, 210); this.flowStableSecTextBox.Name = "flowStableSecTextBox"; this.flowStableSecTextBox.Size = new System.Drawing.Size(46, 20); this.flowStableSecTextBox.TabIndex = 16; @@ -209,7 +210,7 @@ namespace TBF.BenchControl.Elde.RegulValve // flowStableSecLabel // this.flowStableSecLabel.AutoSize = true; - this.flowStableSecLabel.Location = new System.Drawing.Point(28, 240); + this.flowStableSecLabel.Location = new System.Drawing.Point(28, 213); this.flowStableSecLabel.Name = "flowStableSecLabel"; this.flowStableSecLabel.Size = new System.Drawing.Size(74, 13); this.flowStableSecLabel.TabIndex = 15; @@ -226,7 +227,7 @@ namespace TBF.BenchControl.Elde.RegulValve this.groupBox1.Location = new System.Drawing.Point(10, 398); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(280, 59); - this.groupBox1.TabIndex = 18; + this.groupBox1.TabIndex = 19; this.groupBox1.TabStop = false; this.groupBox1.Text = "Measured value 1"; // @@ -293,7 +294,7 @@ namespace TBF.BenchControl.Elde.RegulValve this.groupBox2.Location = new System.Drawing.Point(10, 462); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(280, 59); - this.groupBox2.TabIndex = 19; + this.groupBox2.TabIndex = 20; this.groupBox2.TabStop = false; this.groupBox2.Text = "Measured value 2"; // @@ -356,7 +357,7 @@ namespace TBF.BenchControl.Elde.RegulValve this.groupBox3.Location = new System.Drawing.Point(10, 527); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(280, 60); - this.groupBox3.TabIndex = 20; + this.groupBox3.TabIndex = 21; this.groupBox3.TabStop = false; this.groupBox3.Text = "Regulation valve"; // @@ -412,8 +413,8 @@ namespace TBF.BenchControl.Elde.RegulValve this.categoryComboBox.FormattingEnabled = true; this.categoryComboBox.Location = new System.Drawing.Point(138, 90); this.categoryComboBox.Name = "categoryComboBox"; - this.categoryComboBox.Size = new System.Drawing.Size(81, 21); - this.categoryComboBox.TabIndex = 5; + this.categoryComboBox.Size = new System.Drawing.Size(130, 21); + this.categoryComboBox.TabIndex = 6; // // categoryLabel // @@ -421,13 +422,25 @@ namespace TBF.BenchControl.Elde.RegulValve this.categoryLabel.Location = new System.Drawing.Point(28, 93); this.categoryLabel.Name = "categoryLabel"; this.categoryLabel.Size = new System.Drawing.Size(49, 13); - this.categoryLabel.TabIndex = 4; + this.categoryLabel.TabIndex = 5; this.categoryLabel.Text = "Category"; // + // reTryCommandsCheckBox + // + this.reTryCommandsCheckBox.AutoSize = true; + this.reTryCommandsCheckBox.Enabled = false; + this.reTryCommandsCheckBox.Location = new System.Drawing.Point(31, 262); + this.reTryCommandsCheckBox.Name = "reTryCommandsCheckBox"; + this.reTryCommandsCheckBox.Size = new System.Drawing.Size(108, 17); + this.reTryCommandsCheckBox.TabIndex = 18; + this.reTryCommandsCheckBox.Text = "Re-try commands"; + this.reTryCommandsCheckBox.UseVisualStyleBackColor = true; + // // RegulValveCfgCtrl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.reTryCommandsCheckBox); this.Controls.Add(this.categoryComboBox); this.Controls.Add(this.categoryLabel); this.Controls.Add(this.groupBox4); @@ -505,5 +518,6 @@ namespace TBF.BenchControl.Elde.RegulValve private System.Windows.Forms.Label label4; private System.Windows.Forms.ComboBox categoryComboBox; private System.Windows.Forms.Label categoryLabel; + private System.Windows.Forms.CheckBox reTryCommandsCheckBox; } } diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.cs index 57301b7d4..988695085 100644 --- a/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.cs +++ b/TestBenchFramework/BenchControl/Elde/RegulValve/RegulValveCfgCtrl.cs @@ -81,8 +81,9 @@ namespace TBF.BenchControl.Elde.RegulValve adcClosedTextBox.Text = config.AdcValueClosed.ToString(); adcOpenTextBox.Text = config.AdcValueOpen.ToString(); stableTimeTextBox.Text = config.StableTimeMs.ToString(); - storedPosReuseCheckBox.Checked = config.StoredPositionReuse; flowStableSecTextBox.Text = config.FlowStableSec.ToString(); + storedPosReuseCheckBox.Checked = config.StoredPositionReuse; + reTryCommandsCheckBox.Checked = config.ReTryCommands; adcTextBox1.Text = adc1.ToString(); adcTextBox2.Text = adc2.ToString(); @@ -99,8 +100,9 @@ namespace TBF.BenchControl.Elde.RegulValve adcClosedTextBox.Enabled = true; adcOpenTextBox.Enabled = true; stableTimeTextBox.Enabled = true; - storedPosReuseCheckBox.Enabled = true; flowStableSecTextBox.Enabled = true; + storedPosReuseCheckBox.Enabled = true; + reTryCommandsCheckBox.Enabled = true; } public CfgUpdateFlags VerifyCfg(ref string message) @@ -214,13 +216,6 @@ namespace TBF.BenchControl.Elde.RegulValve flags |= CfgUpdateFlags.AnyChange; } - bool btmp = storedPosReuseCheckBox.Checked; - if (config.StoredPositionReuse != btmp) - { - config.StoredPositionReuse = btmp; - flags |= CfgUpdateFlags.RestartRqrd; - } - tmp = int.Parse(flowStableSecTextBox.Text); if (config.FlowStableSec != tmp) { @@ -228,6 +223,20 @@ namespace TBF.BenchControl.Elde.RegulValve flags |= CfgUpdateFlags.AnyChange; } + bool btmp = storedPosReuseCheckBox.Checked; + if (config.StoredPositionReuse != btmp) + { + config.StoredPositionReuse = btmp; + flags |= CfgUpdateFlags.RestartRqrd; + } + + btmp = reTryCommandsCheckBox.Checked; + if (config.ReTryCommands != btmp) + { + config.ReTryCommands = btmp; + flags |= CfgUpdateFlags.RestartRqrd; + } + if ((flags & CfgUpdateFlags.AnyChange) != 0) { RegulValve.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config)); diff --git a/TestBenchFramework/BenchControl/Elde/RegulValve/SetFlowOp.cs b/TestBenchFramework/BenchControl/Elde/RegulValve/SetFlowOp.cs index 3ecdc46bf..9a7f0faa3 100644 --- a/TestBenchFramework/BenchControl/Elde/RegulValve/SetFlowOp.cs +++ b/TestBenchFramework/BenchControl/Elde/RegulValve/SetFlowOp.cs @@ -31,6 +31,7 @@ namespace TBF.BenchControl.Elde.RegulValve readonly float pidCoef; readonly int timeout; readonly bool leaveMeasurementRunning; + readonly bool reTryCommands; readonly float nominalFlow; @@ -43,12 +44,12 @@ namespace TBF.BenchControl.Elde.RegulValve ValveMoveToPosition1, /// Wait 1 takt ValveMoveToPosition2, /// This is actual move to position ValveMoveToPosition3, /// Wait 1 takt - ValveMoveToPosition4, /// Verify + CheckStatePosition, /// Verify SettingPosition, ValveMoveToFlow1, /// Wait 1 takt ValveMoveToFlow2, /// This is actual move to flow ValveMoveToFlow3, /// Wait 1 takt - ValveMoveToFlow4, /// Verify + CheckStateFlow, /// Verify SettingFlow, FlowReached, SendCommandAgain, @@ -77,8 +78,8 @@ namespace TBF.BenchControl.Elde.RegulValve /// true = Leave the measurement running after op. stop /// Only Elde.Valve flow are used, other flow on the lists are ignored public SetFlowOp(ControlBoardDev controlBoard, IRegulValve _regulValve, IFlowMeter flowMeter, - float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow, - int timeout, bool leaveMeasurementRunning) + float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow, + bool reTryCmds, int timeout, bool leaveMeasurementRunning) { if (controlBoard == null) throw new ArgumentNullException("ctrlBoard"); this.controlBoard = controlBoard; @@ -107,6 +108,7 @@ namespace TBF.BenchControl.Elde.RegulValve this.reqFlowAve = (reqFlowLo + reqFlowHi) / 2.0f; this.pidCoef = pidCoef; this.measuredFlow = measuredFlow; + this.reTryCommands = reTryCmds; this.timeout = timeout; @@ -120,8 +122,8 @@ namespace TBF.BenchControl.Elde.RegulValve /// Events: FlowSet /// public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IFlowMeter flowMeter, - float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow, int timeout) - : this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout, false) + float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow, bool reTryCmds, int timeout) + : this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, reTryCmds, timeout, false) { } @@ -130,8 +132,8 @@ namespace TBF.BenchControl.Elde.RegulValve /// Events: FlowSet /// public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IFlowMeter flowMeter, - float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow) - : this(controlBoard, regValve, flowMeter, requiredFlowLo, pidCoef, requiredFlowHi, measuredFlow, int.MaxValue, false) + float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow, bool reTryCmds) + : this(controlBoard, regValve, flowMeter, requiredFlowLo, pidCoef, requiredFlowHi, measuredFlow, reTryCmds, int.MaxValue, false) { } @@ -209,7 +211,10 @@ namespace TBF.BenchControl.Elde.RegulValve double flowMtrFreq = controlBoard.ReferenceFreq; double flow = flowMtrFreq * nominalFlow / 2000.0; - if (measuredFlow != null) measuredFlow.Val = flow; + if (flowMtrFreq != 0) + { + if (measuredFlow != null) measuredFlow.Val = flow; + } log.InfoFormat("SetFlowOp:Run() rv#={0} pos={1}% freq={2} flow={3} opState={4}", regulValveNr, rvPosition.ToString("F1"), flowMtrFreq, flow, opState); @@ -262,10 +267,17 @@ namespace TBF.BenchControl.Elde.RegulValve } else if (opState == OpState.ValveMoveToPosition3) { - opState = OpState.ValveMoveToPosition4; + if (reTryCommands) + { + opState = OpState.CheckStatePosition; + } + else + { + opState = OpState.SettingPosition; + } return Event.None; } - else if (opState == OpState.ValveMoveToPosition4) /// Verify + else if (opState == OpState.CheckStatePosition) /// Verify { if (((ulong)controlBoard.StatusP & (ulong)StatusP.RefPulsesMsrmnt) == 0) { @@ -342,10 +354,17 @@ namespace TBF.BenchControl.Elde.RegulValve } else if (opState == OpState.ValveMoveToFlow3) { - opState = OpState.ValveMoveToFlow4; + if (reTryCommands) + { + opState = OpState.CheckStateFlow; + } + else + { + opState = OpState.SettingFlow; + } return Event.None; } - else if (opState == OpState.ValveMoveToFlow4) /// Verify the flow setting + else if (opState == OpState.CheckStateFlow) /// Verify the flow setting { if (regulValveNr != CoaxValveNr && (((ulong)controlBoard.StatusP & (ulong)StatusP.RefPulsesMsrmnt) == 0 || (controlBoard.RegulValveState(regulValveNr) & RegulValveState.PwOrFreqRegul) != RegulValveState.PwOrFreqRegul)) diff --git a/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs b/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs index 469d2ff86..a60266054 100644 --- a/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs +++ b/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs @@ -137,11 +137,11 @@ namespace TBF.BenchControl.Sequences Bridge.Bench2UI(ButtonsEtc.StopBtnEn); - State state = State.Create("SequenceBase : Opening the emptying valve") - .AddOperation(checkUiOp) - .AddOperation(StateMachine.ControlBoard.SetValvesOp(emptyTankValve, null)); - foreach (var op in extraOperations) state.AddOperation(op); - state.EnterState(); + State.Create("SequenceBase : Opening the emptying valve") + .AddOperation(checkUiOp) + .AddOperation(StateMachine.ControlBoard.SetValvesOp(emptyTankValve, null)) + .AddOperations(extraOperations) + .EnterState(); do { e = StateMachine.WaitRunDevsRunOps(); @@ -150,12 +150,12 @@ namespace TBF.BenchControl.Sequences do { - state = State.Create("SequenceBase : Emptying the tank") - .AddOperation(checkUiOp) - .AddOperation(balance.ReadMassOp(ref Mass)) - .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()); - foreach (var op in extraOperations) state.AddOperation(op); - state.EnterState(); + State.Create("SequenceBase : Emptying the tank") + .AddOperation(checkUiOp) + .AddOperation(balance.ReadMassOp(ref Mass)) + .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) + .AddOperations(extraOperations) + .EnterState(); do { e = StateMachine.WaitRunDevsRunOps(); @@ -177,13 +177,13 @@ namespace TBF.BenchControl.Sequences // // Quit emptying // - state = State.Create("SequenceBase : Closing the emptying valve") - .AddOperation(checkUiOp) - .AddOperation(balance.ReadMassOp(ref Mass)) - .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) - .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, emptyTankValve)); - foreach (var op in extraOperations) state.AddOperation(op); - state.EnterState(); + State.Create("SequenceBase : Closing the emptying valve") + .AddOperation(checkUiOp) + .AddOperation(balance.ReadMassOp(ref Mass)) + .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) + .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, emptyTankValve)) + .AddOperations(extraOperations) + .EnterState(); do { e = StateMachine.WaitRunDevsRunOps(); @@ -193,13 +193,13 @@ namespace TBF.BenchControl.Sequences while (!e.Contains(Event.ValvesSet) || !e.Contains(Event.BalanceDone)); - state = State.Create("SequenceBase : Updating the weight") - .AddOperation(checkUiOp) - .AddOperation(balance.ReadMassOp(ref Mass)) - .AddOperation(new Operations.TimerOp(5)) - .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()); - foreach (var op in extraOperations) state.AddOperation(op); - state.EnterState(); + State.Create("SequenceBase : Updating the weight") + .AddOperation(checkUiOp) + .AddOperation(balance.ReadMassOp(ref Mass)) + .AddOperation(new Operations.TimerOp(5)) + .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) + .AddOperations(extraOperations) + .EnterState(); do { e = StateMachine.WaitRunDevsRunOps(); diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs index c5a6766a9..1642a1762 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs @@ -124,9 +124,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection //------------------------------------------------ Bridge.OnActivity(this, Strings.Checking_tank_capacity); //------------------------------------------------ - bool tankEmptyingInProgress = test.Emptying; + bool emptyTheTank = test.Emptying; - if (!tankEmptyingInProgress) /// If condition met => skip measuring and force emptying + if (!emptyTheTank) /// If condition met => skip measuring and force emptying { /// /// Measure the weight and skip emptying if there is enough room in the tank @@ -146,11 +146,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection double estimatedEndMass = Mass.Val + test.Volume; if (estimatedEndMass >= outPath.Balance.Capacity * Constants.TankFullFactor) { - tankEmptyingInProgress = true; + emptyTheTank = true; } } /// - if (tankEmptyingInProgress) + if (emptyTheTank) { State.Create("FlyingStartMassCollection : Opening the emptying valve") .AddOperation(checkUiOp) @@ -177,8 +177,29 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection heatMetersPromptOp = new Operations.MessageBoxOp(heatMetersTestParams.Prompt); } + /// + /// Start the pump, set feeding regulation valves + /// + IList startFeedingOperations = new List(); + if (inPath.Pump != null) startFeedingOperations.Add(cBrd.SetValvesOp(inPath.Pump, null)); - if (inPath.Pump != null) + //for (int i = 0; i < inPath.RegulValves.Count; i++) + //{ + // GenericDevices.IRegulValve rv = inPath.RegulValves[i]; + // float position = inPath.RegulValvesPct[i]; + // if (rv.IsCoax) + // { + // startFeedingOperations.Add(rv.SetRegulValvePositionOp(position, position, 60)); + // } + // else + // { + // float lo = Math.Max(0, position - 2.0f); + // float hi = Math.Min(100.0f, position + 2.0f); + // startFeedingOperations.Add(rv.SetRegulValvePositionOp(lo, hi, 60)); + // } + //} + + if (startFeedingOperations.Count > 0) { //------------------------------------------------ Bridge.OnActivity(this, Strings.Starting_the_pump); @@ -187,10 +208,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection /// State.Create("FlyingStartMassCollection : Starting the pump") .AddOperation(checkUiOp) - .AddOperation(cBrd.SetValvesOp(inPath.Pump, null)) .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) .AddOperation(heatMetersPromptOp) - .EnterState(); + .AddOperations(startFeedingOperations) + .EnterState(); do { e = StateMachine.WaitRunDevsRunOps(); @@ -355,7 +376,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection } - if (tankEmptyingInProgress) + if (emptyTheTank) { //------------------------------------------------ Bridge.OnActivity(this, Strings.Closing_the_tank); @@ -378,7 +399,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } } - tankEmptyingInProgress = false; + emptyTheTank = false; } if (test.TimeFlow2Mass > 0) diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index 5a71dbfa0..d27691dfa 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.11.364.1")] -[assembly: AssemblyFileVersion("2.11.364.1")] +[assembly: AssemblyVersion("2.11.365.1")] +[assembly: AssemblyFileVersion("2.11.365.1")]