IFlowMeter.ReadFlow() and IFlowMeter.ReadFrequency() added, ReadFlowOp and SetFlowOp modified, ver. 2.17.768
This commit is contained in:
parent
57977ae8b6
commit
5f7b4443c2
@ -43,6 +43,10 @@ namespace TBF.BenchControl.Dummy.FlowMeter
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
|
||||
public double ReadFlow() { return 1.23; }
|
||||
public double ReadFrequency() { return 1.23 * 2000.0 / (double)NominalFlow; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: FlowDone, Error
|
||||
/// </summary>
|
||||
|
||||
@ -13,20 +13,23 @@ namespace TBF.BenchControl.Dummy.FlowMeter
|
||||
public override string ToString() { return string.Format("ReadFlowOp(.,{0},{1},.)", eventDone); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly Event eventDone;
|
||||
DoubleBox flow;
|
||||
readonly FlowMeter flowMeter;
|
||||
readonly DoubleBox flowBox;
|
||||
readonly Event eventDone;
|
||||
|
||||
/// <summary>
|
||||
/// Events: FlowInDone, FlowOutDone or Error
|
||||
/// </summary>
|
||||
/// <param name="flowMeter">Flow meter reference</param>
|
||||
/// <param name="flow">Reference to the measured flow variable, value is in bar</param>
|
||||
/// <param name="flowBox">Reference to the measured flow variable, value is in bar</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadFlowOp(FlowMeter flowMeter, ref DoubleBox flow, Event eventDone)
|
||||
public ReadFlowOp(FlowMeter flowMeter, ref DoubleBox flowBox, Event eventDone)
|
||||
{
|
||||
if (flowMeter == null) throw new ArgumentNullException("flowMeter");
|
||||
|
||||
this.flowMeter = flowMeter;
|
||||
this.eventDone = eventDone;
|
||||
this.flow = flow;
|
||||
this.flowBox = flowBox;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
@ -46,7 +49,7 @@ namespace TBF.BenchControl.Dummy.FlowMeter
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
flow.Val = 1.23f;
|
||||
if (flowBox != null) flowBox.Val = flowMeter.ReadFlow();
|
||||
return eventDone;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -14,13 +14,10 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
public override string ToString() { return string.Format("FlowMeter({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly FlowMeterCfg flowMeterCfg;
|
||||
readonly ControlBoardDev controlBoard;
|
||||
|
||||
public int Idx1 { get { return flowMeterCfg.Idx1; } }
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
|
||||
public int Idx1 { get { return flowMeterCfg.Idx1; } }
|
||||
public float NominalFlow { get { return flowMeterCfg.NominalFlow; } }
|
||||
|
||||
public float LtrPerPulse { get { return flowMeterCfg.NominalFlow / 7200.0f; } }
|
||||
|
||||
public float LtrPerPulseCorrected(double flow)
|
||||
@ -32,7 +29,6 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
return (float)(LtrPerPulse * correctedFlow / flow);
|
||||
}
|
||||
|
||||
|
||||
public FlowMeter()
|
||||
{
|
||||
}
|
||||
@ -42,16 +38,19 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
{
|
||||
flowMeterCfg = cfg as FlowMeterCfg;
|
||||
|
||||
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
/// Prepare data for SendCalibData() control board component method
|
||||
if (Idx1 >= ControlBoard.EtCalib.Length) throw new Exception("Flowmeter " + Name + " parameter 'Idx1' is out of range");
|
||||
ControlBoard.EtCalib[Idx1] = flowMeterCfg.NominalFlow;
|
||||
if (Idx1 >= controlBoard.EtCalib.Length) throw new Exception("Flowmeter " + Name + " parameter 'Idx1' is out of range");
|
||||
controlBoard.EtCalib[Idx1] = flowMeterCfg.NominalFlow;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public double ReadFlow() { return controlBoard.ReferenceFlow; }
|
||||
public double ReadFrequency() { return controlBoard.ReferenceFreq; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: FlowDone, Error
|
||||
/// </summary>
|
||||
@ -59,7 +58,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadFlowOp(ref DoubleBox flow)
|
||||
{
|
||||
return new ReadFlowOp(this, ref flow);
|
||||
return new ReadFlowOp(this, controlBoard, ref flow);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -70,7 +69,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadFlowOp(ref DoubleBox flow, Event flowDone)
|
||||
{
|
||||
return new ReadFlowOp(this, ref flow, flowDone);
|
||||
return new ReadFlowOp(this, controlBoard, ref flow, flowDone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,69 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FlowMeter
|
||||
{
|
||||
public class ReadFlowOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadFlowOp));
|
||||
public override string ToString() { return string.Format("ReadFlowOp(.,{0},{1},.)", eventDone, flowMeterNr); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly int flowMeterNr;
|
||||
readonly Event eventDone;
|
||||
DoubleBox flow;
|
||||
|
||||
/// <summary>
|
||||
/// Events: FlowInDone, FlowOutDone or Error
|
||||
/// </summary>
|
||||
/// <param name="flowMeter">Flow meter reference</param>
|
||||
/// <param name="flow">Reference to the measured flow variable, value is in bar</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadFlowOp(FlowMeter flowMeter, ref DoubleBox flow, Event eventDone)
|
||||
{
|
||||
if (flowMeter == null) throw new ArgumentNullException("flowMeter");
|
||||
this.controlBoard = flowMeter.ControlBoard;
|
||||
this.flowMeterNr = flowMeter.Idx1;
|
||||
this.eventDone = eventDone;
|
||||
this.flow = flow;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadFlowOp(FlowMeter flowMeter, ref DoubleBox flow)
|
||||
: this(flowMeter, ref flow, Event.FlowMeasurementDone)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.FlowInDone or Event.FlowOutDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (flowMeterNr == (int)(controlBoard.StatusP & StatusP.RefFlowMeterMask))
|
||||
{
|
||||
flow.Val = controlBoard.ReferenceFlow;
|
||||
return eventDone;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Event.Error;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -14,13 +14,11 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
|
||||
public override string ToString() { return string.Format("FlowMeterTwins({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly FlowMeterCfg flowMeterCfg;
|
||||
|
||||
public int Idx1 { get { return 0; } }
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
readonly ControlBoardDev controlBoard;
|
||||
public readonly TBF.BenchControl.Elde.FlowMeter.FlowMeter FlowMeter1;
|
||||
public readonly TBF.BenchControl.Elde.FlowMeter.FlowMeter FlowMeter2;
|
||||
|
||||
public int Idx1 { get { return 0; } }
|
||||
public float NominalFlow { get { return flowMeterCfg.NominalFlow; } }
|
||||
|
||||
/// The nominal flowed of a pair of flow meters is reached at 4000Hz
|
||||
@ -43,8 +41,8 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
|
||||
{
|
||||
flowMeterCfg = cfg as FlowMeterCfg;
|
||||
|
||||
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
FlowMeter1 = (TBF.BenchControl.Elde.FlowMeter.FlowMeter)TbfComponents.FindComponent(flowMeterCfg.FlowMeter1, components);
|
||||
if (FlowMeter1 == null) throw new Exception("Cannot find FlowMeter1 component");
|
||||
@ -52,13 +50,16 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
|
||||
FlowMeter2 = (TBF.BenchControl.Elde.FlowMeter.FlowMeter)TbfComponents.FindComponent(flowMeterCfg.FlowMeter2, components);
|
||||
if (FlowMeter2 == null) throw new Exception("Cannot find FlowMeter2 component");
|
||||
|
||||
ControlBoard.EtCalib[Idx1] = flowMeterCfg.NominalFlow; /// Idx1==0 for FlowMeterTwins
|
||||
controlBoard.EtCalib[Idx1] = flowMeterCfg.NominalFlow; /// Idx1==0 for FlowMeterTwins
|
||||
|
||||
/// Prepare data for SendCalibData() control board component method
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public double ReadFlow() { return controlBoard.ReferenceFlow; }
|
||||
public double ReadFrequency() { return controlBoard.ReferenceFreq; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: FlowDone, Error
|
||||
/// </summary>
|
||||
@ -66,7 +67,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
|
||||
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadFlowOp(ref DoubleBox flow)
|
||||
{
|
||||
return new ReadFlowOp(this, ref flow);
|
||||
return new ReadFlowOp(this, controlBoard, ref flow);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -77,7 +78,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
|
||||
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadFlowOp(ref DoubleBox flow, Event flowDone)
|
||||
{
|
||||
return new ReadFlowOp(this, ref flow, flowDone);
|
||||
return new ReadFlowOp(this, controlBoard, ref flow, flowDone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,69 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FlowMeterTwins
|
||||
{
|
||||
public class ReadFlowOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadFlowOp));
|
||||
public override string ToString() { return string.Format("ReadFlowOp(.,{0},{1},.)", eventDone, flowMeterNr); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly int flowMeterNr;
|
||||
readonly Event eventDone;
|
||||
DoubleBox flow;
|
||||
|
||||
/// <summary>
|
||||
/// Events: FlowInDone, FlowOutDone or Error
|
||||
/// </summary>
|
||||
/// <param name="flowMeter">Flow meter reference</param>
|
||||
/// <param name="flow">Reference to the measured flow variable, value is in bar</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadFlowOp(FlowMeter flowMeter, ref DoubleBox flow, Event eventDone)
|
||||
{
|
||||
if (flowMeter == null) throw new ArgumentNullException("flowMeter");
|
||||
this.controlBoard = flowMeter.ControlBoard;
|
||||
this.flowMeterNr = flowMeter.Idx1;
|
||||
this.eventDone = eventDone;
|
||||
this.flow = flow;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadFlowOp(FlowMeter flowMeter, ref DoubleBox flow)
|
||||
: this(flowMeter, ref flow, Event.FlowMeasurementDone)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.FlowInDone or Event.FlowOutDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (flowMeterNr == (int)(controlBoard.StatusP & StatusP.RefFlowMeterMask))
|
||||
{
|
||||
flow.Val = controlBoard.ReferenceFlow;
|
||||
return eventDone;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Event.Error;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
70
TestBenchFramework/BenchControl/Elde/ReadFlowOp.cs
Normal file
70
TestBenchFramework/BenchControl/Elde/ReadFlowOp.cs
Normal file
@ -0,0 +1,70 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
{
|
||||
public class ReadFlowOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadFlowOp));
|
||||
public override string ToString() { return string.Format("ReadFlowOp({0},.,.,{1})", flowMeter.Idx1, eventDone); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly GenericDevices.IFlowMeter flowMeter;
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly DoubleBox flowBox;
|
||||
readonly Event eventDone;
|
||||
|
||||
/// <summary>
|
||||
/// Events: FlowInDone, FlowOutDone or Error
|
||||
/// </summary>
|
||||
/// <param name="flowMeter">Flow meter reference</param>
|
||||
/// <param name="flowBox">Reference to the measured flow variable, value is in bar</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadFlowOp(GenericDevices.IFlowMeter flowMeter, ControlBoardDev controlBoard, ref DoubleBox flowBox, Event eventDone)
|
||||
{
|
||||
if (flowMeter == null || controlBoard == null) throw new ArgumentNullException();
|
||||
|
||||
this.flowMeter = flowMeter;
|
||||
this.controlBoard = controlBoard;
|
||||
this.eventDone = eventDone;
|
||||
this.flowBox = flowBox;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadFlowOp(GenericDevices.IFlowMeter flowMeter, ControlBoardDev controlBoard, ref DoubleBox flowBox)
|
||||
: this(flowMeter, controlBoard, ref flowBox, Event.FlowMeasurementDone)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.FlowInDone or Event.FlowOutDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if ((int)(controlBoard.StatusP & StatusP.RefFlowMeterMask) == flowMeter.Idx1)
|
||||
{
|
||||
flowBox.Val = flowMeter.ReadFlow();
|
||||
return eventDone;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Event.Error;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -24,7 +24,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly Elde.RegulValve.RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly int flowMeterNr;
|
||||
readonly IFlowMeter flowMeter;
|
||||
readonly float finalReqFlowLo;
|
||||
readonly float finalReqFlowHi;
|
||||
readonly float reqFlowAve;
|
||||
@ -62,7 +62,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
float targetPositionHi;
|
||||
|
||||
int expireTime;
|
||||
DoubleBox measuredFlow;
|
||||
DoubleBox flowBox;
|
||||
int flowWithinBoundsTime;
|
||||
|
||||
|
||||
@ -71,7 +71,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// Events: FlowSet, FlowTimeOut
|
||||
/// </summary>
|
||||
/// <param name="controlBoard">Control board device</param>
|
||||
/// <param name="_regulValve">Regulation valve component</param>
|
||||
/// <param name="regulValve">Regulation valve component</param>
|
||||
/// <param name="flowMeter">Flowmeter component</param>
|
||||
/// <param name="requiredFlowLo">Lower limit of the flow to be achieved in [m3/h]</param>
|
||||
/// <param name="requiredFlowHi">Upper limit of the flow to be achieved in [m3/h]</param>
|
||||
@ -79,29 +79,19 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve _regulValve, IFlowMeter flowMeter,
|
||||
float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow,
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regulValve, IFlowMeter flowMeter,
|
||||
float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox flowBox,
|
||||
bool reTryCmds, int timeout, bool leaveMeasurementRunning)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
|
||||
regulValve = _regulValve as Elde.RegulValve.RegulValve;
|
||||
if (regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
|
||||
this.regulValve = regulValve as Elde.RegulValve.RegulValve;
|
||||
if (this.regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
|
||||
regulValveNr = this.regulValve.Idx1;
|
||||
|
||||
if (flowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
this.flowMeterNr = (flowMeter as Elde.FlowMeter.FlowMeter).Idx1;
|
||||
}
|
||||
else if (flowMeter is Elde.FlowMeterTwins.FlowMeter)
|
||||
{
|
||||
this.flowMeterNr = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentNullException("flowMeter is null or not Elde");
|
||||
}
|
||||
if (flowMeter == null) throw new ArgumentNullException("flowMeter");
|
||||
this.flowMeter = flowMeter;
|
||||
|
||||
nominalFlow = flowMeter.NominalFlow;
|
||||
|
||||
@ -109,7 +99,10 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
this.finalReqFlowHi = requiredFlowHi;
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
|
||||
this.pidCoef = pidCoef;
|
||||
this.measuredFlow = measuredFlow;
|
||||
|
||||
if (flowBox == null) throw new ArgumentNullException("flowBox");
|
||||
this.flowBox = flowBox;
|
||||
|
||||
this.reTryCommands = reTryCmds;
|
||||
|
||||
this.timeout = timeout;
|
||||
@ -124,8 +117,8 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IFlowMeter flowMeter,
|
||||
float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow, bool reTryCmds, int timeout)
|
||||
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, reTryCmds, timeout, false)
|
||||
float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox flowbox, bool reTryCmds, int timeout)
|
||||
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, flowbox, reTryCmds, timeout, false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -134,8 +127,8 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IFlowMeter flowMeter,
|
||||
float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox measuredFlow, bool reTryCmds)
|
||||
: this(controlBoard, regValve, flowMeter, requiredFlowLo, pidCoef, requiredFlowHi, measuredFlow, reTryCmds, int.MaxValue, false)
|
||||
float requiredFlowLo, float requiredFlowHi, float pidCoef, DoubleBox flowbox, bool reTryCmds)
|
||||
: this(controlBoard, regValve, flowMeter, requiredFlowLo, pidCoef, requiredFlowHi, flowbox, reTryCmds, int.MaxValue, false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -175,14 +168,14 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
double flowMtrFreq = controlBoard.ReferenceFreq;
|
||||
double flowMtrFreq = flowMeter.ReadFrequency();
|
||||
currentReqFlowLo = reqFlowAve;
|
||||
currentReqFlowHi = reqFlowAve;
|
||||
double flow = flowMeter.ReadFlow();
|
||||
///
|
||||
if (flowMtrFreq != 0)
|
||||
if (flow != 0)
|
||||
{
|
||||
double flow = flowMtrFreq * nominalFlow / 2000.0;
|
||||
if (measuredFlow != null) measuredFlow.Val = flow;
|
||||
flowBox.Val = flow;
|
||||
if (flow >= reqFlowAve) currentReqFlowLo = finalReqFlowLo;
|
||||
if (flow <= reqFlowAve) currentReqFlowHi = finalReqFlowHi;
|
||||
}
|
||||
@ -197,14 +190,14 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(reqFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
{
|
||||
log.InfoFormat("SetFlowOp:Start() rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
|
||||
regulValveNr, flowMeterNr, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
|
||||
regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
|
||||
|
||||
opState = OpState.ValveMoveToPosition1;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.InfoFormat("SetFlowOp:Start() rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3}",
|
||||
regulValveNr, flowMeterNr, currentReqFlowLo, currentReqFlowHi);
|
||||
regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi);
|
||||
|
||||
opState = OpState.ValveMoveToFlow1;
|
||||
}
|
||||
@ -215,7 +208,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
TestMethods tm = 0;
|
||||
StopDevs sd = 0;
|
||||
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
|
||||
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, controlBoard.Route,
|
||||
int.MaxValue, int.MaxValue, tm,
|
||||
0.0f, (int)pidCoef, 0, sd);
|
||||
}
|
||||
@ -227,12 +220,12 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
public Event Run()
|
||||
{
|
||||
float rvPosition = controlBoard.RValvePosition(regulValveNr);
|
||||
double flowMtrFreq = controlBoard.ReferenceFreq;
|
||||
double flow = flowMtrFreq * nominalFlow / 2000.0;
|
||||
double flowMtrFreq = flowMeter.ReadFrequency();
|
||||
double flow = flowMeter.ReadFlow();
|
||||
|
||||
if (flowMtrFreq != 0)
|
||||
if (flow != 0)
|
||||
{
|
||||
if (measuredFlow != null) measuredFlow.Val = flow;
|
||||
flowBox.Val = flow;
|
||||
if (flow >= reqFlowAve) currentReqFlowLo = finalReqFlowLo;
|
||||
if (flow <= reqFlowAve) currentReqFlowHi = finalReqFlowHi;
|
||||
}
|
||||
@ -248,14 +241,14 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(reqFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
{
|
||||
log.InfoFormat("Run(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
|
||||
regulValveNr, flowMeterNr, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
|
||||
regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
|
||||
|
||||
opState = OpState.ValveMoveToPosition1;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.InfoFormat("Run(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3}",
|
||||
regulValveNr, flowMeterNr, currentReqFlowLo, currentReqFlowHi);
|
||||
regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi);
|
||||
|
||||
opState = OpState.ValveMoveToFlow1;
|
||||
}
|
||||
@ -266,7 +259,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
TestMethods tm = 0;
|
||||
StopDevs sd = 0;
|
||||
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
|
||||
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, controlBoard.Route,
|
||||
int.MaxValue, int.MaxValue, tm,
|
||||
0.0f, (int)pidCoef, 0, sd);
|
||||
return Event.None;
|
||||
@ -362,7 +355,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
}
|
||||
|
||||
log.InfoFormat("Run(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3}",
|
||||
regulValveNr, flowMeterNr, currentReqFlowLo, currentReqFlowHi);
|
||||
regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi);
|
||||
|
||||
float freqLo = 2000.0f * currentReqFlowLo / nominalFlow;
|
||||
float freqHi = 2000.0f * currentReqFlowHi / nominalFlow;
|
||||
@ -496,7 +489,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// Stop measurement
|
||||
TestMethods tm = 0;
|
||||
StopDevs sd = StopDevs.RegValveRegulation;
|
||||
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route,
|
||||
controlBoard.SendCommand(Command.Stop, flowMeter.Idx1, controlBoard.Route,
|
||||
50000, 50000, tm,
|
||||
0.0f, (int)pidCoef, 0, sd);
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ namespace TBF.BenchControl.GenericDevices
|
||||
float LtrPerPulseCorrected(double flow);
|
||||
|
||||
/// <summary>
|
||||
/// 1 based index of the reference flowmeter
|
||||
/// Reference flow meter communicated to the board: 1-based index, 0 for flow meter twins
|
||||
/// </summary>
|
||||
int Idx1 { get; }
|
||||
|
||||
@ -39,6 +39,18 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// </summary>
|
||||
IList<Config.Entities.MeasurementCorrection> Corrections { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns current flow value in [m3/h]
|
||||
/// </summary>
|
||||
/// <returns>Flow in m3/h</returns>
|
||||
double ReadFlow();
|
||||
|
||||
/// <summary>
|
||||
/// Returns current flow meter frequency value in [Hz]
|
||||
/// </summary>
|
||||
/// <returns>Frequency in Hz</returns>
|
||||
double ReadFrequency();
|
||||
|
||||
/// <summary>
|
||||
/// Events: FlowDone, Error
|
||||
/// </summary>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using Config.Entities;
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.17.767.0")]
|
||||
[assembly: AssemblyFileVersion("2.17.767.0")]
|
||||
[assembly: AssemblyVersion("2.17.768.0")]
|
||||
[assembly: AssemblyFileVersion("2.17.768.0")]
|
||||
|
||||
@ -478,6 +478,7 @@
|
||||
<Compile Include="BenchControl\Elde\PressureMeterInternal\ReadPressureOp.cs" />
|
||||
<Compile Include="BenchControl\Elde\ExecuteCommandOp.cs" />
|
||||
<Compile Include="BenchControl\Elde\ReadDiverterTransitionOp.cs" />
|
||||
<Compile Include="BenchControl\Elde\ReadFlowOp.cs" />
|
||||
<Compile Include="BenchControl\Elde\RegulValveCoax\ChangeValvePositionOp.cs" />
|
||||
<Compile Include="BenchControl\Elde\RegulValveCoax\RegulValve.cs" />
|
||||
<Compile Include="BenchControl\Elde\RegulValveCoax\RegulValveCfg.cs" />
|
||||
@ -1225,7 +1226,6 @@
|
||||
<DependentUpon>FlowMeterCfgCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\Elde\FlowMeterTwins\FlowMeterFactory.cs" />
|
||||
<Compile Include="BenchControl\Elde\FlowMeterTwins\ReadFlowOp.cs" />
|
||||
<Compile Include="BenchControl\Elde\PumpTandem\Pump.cs" />
|
||||
<Compile Include="BenchControl\Elde\PumpTandem\PumpCfg.cs" />
|
||||
<Compile Include="BenchControl\Elde\PumpTandem\PumpCfgCtrl.cs">
|
||||
@ -1524,7 +1524,6 @@
|
||||
<Compile Include="BenchControl\Elde\PressureMeter\PressureMeter.cs" />
|
||||
<Compile Include="BenchControl\Elde\PressureMeter\PressureMeterCfg.cs" />
|
||||
<Compile Include="BenchControl\Elde\PressureMeter\PressureMeterFactory.cs" />
|
||||
<Compile Include="BenchControl\Elde\FlowMeter\ReadFlowOp.cs" />
|
||||
<Compile Include="BenchControl\Elde\PressureMeter\ReadPressureOp.cs" />
|
||||
<Compile Include="BenchControl\Elde\TempMeter\ReadTempOp.cs" />
|
||||
<Compile Include="BenchControl\Elde\RegulValve\RegulValve.cs" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user