From 1ecf528ff0e989af74b2fb436a682f1538f0222f Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Wed, 29 Mar 2023 18:11:15 +0200 Subject: [PATCH] RegValve.ChangeRegValvePositionOp fixed --- .../Uni/RegValve/ChangeRegValvePositionOp.cs | 32 +++++++------------ TBF/Rig/Uni/RegValve/SetRegValvePositionOp.cs | 2 +- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/TBF/Rig/Uni/RegValve/ChangeRegValvePositionOp.cs b/TBF/Rig/Uni/RegValve/ChangeRegValvePositionOp.cs index 3eb94a3c1..07efc054d 100644 --- a/TBF/Rig/Uni/RegValve/ChangeRegValvePositionOp.cs +++ b/TBF/Rig/Uni/RegValve/ChangeRegValvePositionOp.cs @@ -1,9 +1,10 @@ /// -/// Copyright (c) 2021 Sensus Slovensko a.s. +/// Copyright (c) 2021-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; using log4net; +using TBF.Rig.ControlBoard.Uni; using TBF.Rig.GenericDevices; namespace TBF.Rig.Uni.RegValve @@ -13,12 +14,12 @@ namespace TBF.Rig.Uni.RegValve private static readonly ILog log = LogManager.GetLogger(typeof(ChangeRegValvePositionOp)); public override string ToString() { - return string.Format("ChangeRegValvePositionOp({0},{1}s)", regulValve.Name, timePulseSec.ToString("F2")); + return string.Format("ChangeRegValvePositionOp({0},{1}s)", regV.Name, timePulseSec.ToString("F2")); } /// Set by the constructor - readonly TBF.Rig.ControlBoard.Uni.UniCB controlBoard; - readonly RegValve regulValve; + readonly UniCB uniCB; + readonly RegValve regV; readonly int regulValveNr; readonly double timePulseSec; @@ -32,14 +33,14 @@ namespace TBF.Rig.Uni.RegValve /// Upper limit of the position to be achieved /// Timeout in sec. for setting the flow /// Only Elde.Valve flow are used, other flow on the lists are ignored - public ChangeRegValvePositionOp(TBF.Rig.ControlBoard.IControlBoard cb, RegValve rv, double timePulseSec) + public ChangeRegValvePositionOp(UniCB uniCB, RegValve regV, double timePulseSec) { - controlBoard = cb as TBF.Rig.ControlBoard.Uni.UniCB; - if (controlBoard == null) throw new ArgumentNullException("ctrlBoard"); + this.uniCB = uniCB; + if (this.uniCB == null) throw new ArgumentNullException("ctrlBoard"); - regulValve = rv as RegValve; - if (regulValve == null) throw new ArgumentNullException("regValve is null or not Elde"); - regulValveNr = this.regulValve.Idx1; + this.regV = regV as RegValve; + if (this.regV == null) throw new ArgumentNullException("regValve is null or not Uni"); + regulValveNr = this.regV.Idx1; this.timePulseSec = timePulseSec; @@ -49,13 +50,7 @@ namespace TBF.Rig.Uni.RegValve /// Start this operation public void Start() { - //double positionPct = controlBoard.RValvePosition(regulValveNr); - //log.WarnFormat("RV#={0}, actPos={1}%", regulValveNr, positionPct.ToString("F1")); - - //controlBoard.ValveMove(regulValveNr, - // TBF.Rig.ControlBoard.Legacy.RegulValveMode.PulseWidth, - // new double[2] { timePulseSec, timePulseSec }, - // regulValve.StableTime); + uniCB.RegVlvIncrMove(false, regulValveNr, timePulseSec); } /// Run this operation @@ -64,9 +59,6 @@ namespace TBF.Rig.Uni.RegValve /// public Event Run() { - //float positionPct = controlBoard.RValvePosition(regulValveNr); - //log.WarnFormat("RV#={0}, actPos={1}%", regulValveNr, positionPct.ToString("F1")); - return Event.PositionReached; } diff --git a/TBF/Rig/Uni/RegValve/SetRegValvePositionOp.cs b/TBF/Rig/Uni/RegValve/SetRegValvePositionOp.cs index 4d3665dc0..c81e97844 100644 --- a/TBF/Rig/Uni/RegValve/SetRegValvePositionOp.cs +++ b/TBF/Rig/Uni/RegValve/SetRegValvePositionOp.cs @@ -57,7 +57,7 @@ namespace TBF.Rig.Uni.RegValve if (this.uniCB == null) throw new ArgumentNullException("ctrlBoard"); this.regV = regV as RegValve; - if (this.regV == null) throw new ArgumentNullException("regValve is null or not Elde"); + if (this.regV == null) throw new ArgumentNullException("regValve is null or not Uni"); this.regValveNr = this.regV.Idx1; this.posLoPct = posLoPct;