RegValve.ChangeRegValvePositionOp fixed

This commit is contained in:
Milan Hanajik
2023-03-30 12:07:59 +02:00
parent 9a5ee99a82
commit 1ecf528ff0
2 changed files with 13 additions and 21 deletions
@@ -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
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
/// <param name="timeout">Timeout in sec. for setting the flow</param>
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
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
/// <summary>Start this operation</summary>
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);
}
/// <summary>Run this operation</summary>
@@ -64,9 +59,6 @@ namespace TBF.Rig.Uni.RegValve
/// </returns>
public Event Run()
{
//float positionPct = controlBoard.RValvePosition(regulValveNr);
//log.WarnFormat("RV#={0}, actPos={1}%", regulValveNr, positionPct.ToString("F1"));
return Event.PositionReached;
}