BenchControl.Uni.Diverter/FlowMeter/RegReader added, etc. (many changes and refactorization).
This commit is contained in:
parent
5325d7f6ee
commit
4cf4192ebb
@ -664,9 +664,9 @@ namespace DeviceTest
|
||||
int previousOperation = 0;
|
||||
|
||||
|
||||
if (tbfComponent1forOp is TBF.BenchControl.Modbus.Meret.PressureMeter.PressureMeter)
|
||||
if (tbfComponent1forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
|
||||
{
|
||||
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Meret.PressureMeter.PressureMeter).ReadPressureOp(ref floatBox);
|
||||
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter).ReadPressureOp(ref floatBox);
|
||||
}
|
||||
else if (tbfComponent1forOp is TBF.BenchControl.Network.Camera.CLP1611.Camera)
|
||||
{
|
||||
@ -703,9 +703,9 @@ namespace DeviceTest
|
||||
}
|
||||
|
||||
|
||||
if (tbfComponent2forOp is TBF.BenchControl.Modbus.Meret.PressureMeter.PressureMeter)
|
||||
if (tbfComponent2forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
|
||||
{
|
||||
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.Meret.PressureMeter.PressureMeter).ReadPressureOp(ref floatBox);
|
||||
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter).ReadPressureOp(ref floatBox);
|
||||
}
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Network.Camera.CLP1611.Camera)
|
||||
{
|
||||
@ -742,9 +742,9 @@ namespace DeviceTest
|
||||
}
|
||||
|
||||
|
||||
if (tbfComponent3forOp is TBF.BenchControl.Modbus.Meret.PressureMeter.PressureMeter)
|
||||
if (tbfComponent3forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
|
||||
{
|
||||
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.Meret.PressureMeter.PressureMeter).ReadPressureOp(ref floatBox);
|
||||
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter).ReadPressureOp(ref floatBox);
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Network.Camera.CLP1611.Camera)
|
||||
{
|
||||
|
||||
@ -43,22 +43,22 @@ namespace TBF.BenchControl.BuiltIn
|
||||
foreach (var vlv in VOpen)
|
||||
{
|
||||
/// Skip the delay evaluation and update in case the valve/pump have not changed
|
||||
if (vlv is Valve.Valve && ((vlv as Valve.Valve).Mask & changed) == 0) continue;
|
||||
if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Elde.PumpWithFM.Pump && ((vlv as Elde.PumpWithFM.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Danfoss.VLT2800.Pump && ((vlv as Danfoss.VLT2800.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Modbus.Danfoss.VLT.Pump && ((vlv as Modbus.Danfoss.VLT.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Valve.Valve && ((vlv as Valve.Valve).Mask & changed) == 0) continue;
|
||||
if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Elde.PumpWithFM.Pump && ((vlv as Elde.PumpWithFM.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Danfoss.VLT2800.Pump && ((vlv as Danfoss.VLT2800.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Modbus.PumpFM.DanfossVLT.Pump && ((vlv as Modbus.PumpFM.DanfossVLT.Pump).Mask & changed) == 0) continue;
|
||||
|
||||
if ((vlv != null) && (vlv.Delay > max)) max = vlv.Delay;
|
||||
}
|
||||
foreach (var vlv in VClose)
|
||||
{
|
||||
/// Skip the delay evaluation and update in case the valve/pump have not changed
|
||||
if (vlv is Valve.Valve && ((vlv as Valve.Valve).Mask & changed) == 0) continue;
|
||||
if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Elde.PumpWithFM.Pump && ((vlv as Elde.PumpWithFM.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Danfoss.VLT2800.Pump && ((vlv as Danfoss.VLT2800.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Modbus.Danfoss.VLT.Pump && ((vlv as Modbus.Danfoss.VLT.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Valve.Valve && ((vlv as Valve.Valve).Mask & changed) == 0) continue;
|
||||
if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Elde.PumpWithFM.Pump && ((vlv as Elde.PumpWithFM.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Danfoss.VLT2800.Pump && ((vlv as Danfoss.VLT2800.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Modbus.PumpFM.DanfossVLT.Pump && ((vlv as Modbus.PumpFM.DanfossVLT.Pump).Mask & changed) == 0) continue;
|
||||
|
||||
if ((vlv != null) && (vlv.Delay > max)) max = vlv.Delay;
|
||||
}
|
||||
@ -155,22 +155,22 @@ namespace TBF.BenchControl.BuiltIn
|
||||
point.MasksOpen = 0;
|
||||
foreach (var valve in point.VOpen)
|
||||
{
|
||||
if (valve is Valve.Valve) point.MasksOpen |= (valve as Valve.Valve).Mask;
|
||||
if (valve is Pump.Pump) point.MasksOpen |= (valve as Pump.Pump).Mask;
|
||||
if (valve is Elde.PumpWithFM.Pump) point.MasksOpen |= (valve as Elde.PumpWithFM.Pump).Mask;
|
||||
if (valve is Danfoss.VLT2800.Pump) point.MasksOpen |= (valve as Danfoss.VLT2800.Pump).Mask;
|
||||
if (valve is Modbus.Danfoss.VLT.Pump) point.MasksOpen |= (valve as Modbus.Danfoss.VLT.Pump).Mask;
|
||||
if (valve is PumpTandem.Pump) point.MasksOpen |= (valve as PumpTandem.Pump).Mask;
|
||||
if (valve is Valve.Valve) point.MasksOpen |= (valve as Valve.Valve).Mask;
|
||||
if (valve is Pump.Pump) point.MasksOpen |= (valve as Pump.Pump).Mask;
|
||||
if (valve is Elde.PumpWithFM.Pump) point.MasksOpen |= (valve as Elde.PumpWithFM.Pump).Mask;
|
||||
if (valve is Danfoss.VLT2800.Pump) point.MasksOpen |= (valve as Danfoss.VLT2800.Pump).Mask;
|
||||
if (valve is Modbus.PumpFM.DanfossVLT.Pump) point.MasksOpen |= (valve as Modbus.PumpFM.DanfossVLT.Pump).Mask;
|
||||
if (valve is PumpTandem.Pump) point.MasksOpen |= (valve as PumpTandem.Pump).Mask;
|
||||
}
|
||||
point.MasksClose = 0;
|
||||
foreach (var valve in point.VClose)
|
||||
{
|
||||
if (valve is Valve.Valve) point.MasksClose |= (valve as Valve.Valve).Mask;
|
||||
if (valve is Pump.Pump) point.MasksClose |= (valve as Pump.Pump).Mask;
|
||||
if (valve is Elde.PumpWithFM.Pump) point.MasksClose |= (valve as Elde.PumpWithFM.Pump).Mask;
|
||||
if (valve is Danfoss.VLT2800.Pump) point.MasksClose |= (valve as Danfoss.VLT2800.Pump).Mask;
|
||||
if (valve is Modbus.Danfoss.VLT.Pump) point.MasksClose |= (valve as Modbus.Danfoss.VLT.Pump).Mask;
|
||||
if (valve is PumpTandem.Pump) point.MasksClose |= (valve as PumpTandem.Pump).Mask;
|
||||
if (valve is Valve.Valve) point.MasksClose |= (valve as Valve.Valve).Mask;
|
||||
if (valve is Pump.Pump) point.MasksClose |= (valve as Pump.Pump).Mask;
|
||||
if (valve is Elde.PumpWithFM.Pump) point.MasksClose |= (valve as Elde.PumpWithFM.Pump).Mask;
|
||||
if (valve is Danfoss.VLT2800.Pump) point.MasksClose |= (valve as Danfoss.VLT2800.Pump).Mask;
|
||||
if (valve is Modbus.PumpFM.DanfossVLT.Pump) point.MasksClose |= (valve as Modbus.PumpFM.DanfossVLT.Pump).Mask;
|
||||
if (valve is PumpTandem.Pump) point.MasksClose |= (valve as PumpTandem.Pump).Mask;
|
||||
}
|
||||
point.TimeSec += timeShift;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2021 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
|
||||
@ -9,9 +9,9 @@ namespace TBF.BenchControl
|
||||
{
|
||||
public CfgChangeCmd Command;
|
||||
public int Id; /// Either Idx1(RV) or BitPosition (Div) to identify the component
|
||||
public int Response;
|
||||
public Int16 Response;
|
||||
|
||||
public CmdResponseArgs(CfgChangeCmd command, int id, int response)
|
||||
public CmdResponseArgs(CfgChangeCmd command, int id, Int16 response)
|
||||
{
|
||||
Command = command;
|
||||
Id = id;
|
||||
|
||||
@ -13,9 +13,9 @@ using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public class ControlBoardDev : ComponentBase, IControlBoard
|
||||
public class CBoard : ComponentBase, IControlBoard
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ControlBoardDev));
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CBoard));
|
||||
public override string ToString() { return string.Format("ControlBoard({0})", Cfg.ToString(1)); }
|
||||
|
||||
const int FiltersCount = 8;
|
||||
@ -333,14 +333,14 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
}
|
||||
}
|
||||
|
||||
public ControlBoardDev()
|
||||
public CBoard()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public ControlBoardDev(Generic.IComponentCfg cfg)
|
||||
public CBoard(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
controlBoardCfg = cfg as ControlBoardCfg;
|
||||
|
||||
@ -14,9 +14,9 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
/// <summary>Max. number of components of this class in the system</summary>
|
||||
public int MaxCount { get { return 1; } }
|
||||
|
||||
public IComponent DummyComponent() { return new ControlBoardDev(); }
|
||||
public IComponent DummyComponent() { return new CBoard(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new ControlBoardDev(cfg); }
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new CBoard(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new ControlBoardCfg(this); }
|
||||
|
||||
@ -24,7 +24,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
|
||||
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
|
||||
{
|
||||
return new ControlBoardDev((ControlBoardCfg)config);
|
||||
return new CBoard((ControlBoardCfg)config);
|
||||
}
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
@ -32,6 +32,6 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
return ComponentCfgBase.CreateFromDbEntity(ControlBoardCfg.Serializer, component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { ControlBoardDev.ResetStaticProperties(); }
|
||||
public void ResetStaticProperties() { CBoard.ResetStaticProperties(); }
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
public override string ToString() { return string.Format("ExecuteCommandOp( command={0}, testMethod={1} )", commandOnStartOp, testMethod); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly Command commandOnStartOp;
|
||||
readonly Command commandOnStopOp;
|
||||
readonly TestMethods testMethod;
|
||||
@ -40,7 +40,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
/// <param name="testMethod">Test method</param>
|
||||
/// <param name="refPulses">Test duration in number of reference flowmeter pulses</param>
|
||||
/// <param name="filterConstant">Specifies filter for watermeter pulses</param>
|
||||
public ExecuteCommandOp(ControlBoardDev controlBoard, Command commandOnStartOp, Command commandOnStopOp, TestMethods testMethod)
|
||||
public ExecuteCommandOp(CBoard controlBoard, Command commandOnStartOp, Command commandOnStopOp, TestMethods testMethod)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("controlBoardDev");
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
public override string ToString() { return string.Format("QueryMeasurementEndOp()"); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
|
||||
bool done;
|
||||
|
||||
@ -20,7 +20,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
/// Events: MeasurementCompleted
|
||||
/// </summary>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public QueryMeasurementEndOp(ControlBoardDev controlBoardDev)
|
||||
public QueryMeasurementEndOp(CBoard controlBoardDev)
|
||||
{
|
||||
if (controlBoardDev == null) throw new ArgumentNullException("controlBoardDev");
|
||||
this.controlBoard = controlBoardDev;
|
||||
|
||||
@ -19,7 +19,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
float[] samples;
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly GenericDevices.IDiverter div;
|
||||
readonly bool toTank;
|
||||
readonly int runsCountWhenSendingCmd;
|
||||
@ -43,7 +43,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
/// <param name="method">Test method</param>
|
||||
/// <param name="refPulses">Test duration in number of reference flowmeter pulses</param>
|
||||
/// <param name="filterConstant">Specifies filter for watermeter pulses</param>
|
||||
public ReadDiverterTransitionOp(ControlBoardDev controlBoard, GenericDevices.IDiverter div, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, bool toTank,
|
||||
public ReadDiverterTransitionOp(CBoard controlBoard, GenericDevices.IDiverter div, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, bool toTank,
|
||||
Sequences.Statistics plotter, int batchNr, string testName, int repetition)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("controlBoardDev");
|
||||
|
||||
@ -14,7 +14,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
|
||||
/// Set by the constructor
|
||||
readonly GenericDevices.IFlowMeter flowMeter;
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly DoubleBox flowBox;
|
||||
readonly Event eventDone;
|
||||
|
||||
@ -24,7 +24,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
/// <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)
|
||||
public ReadFlowOp(GenericDevices.IFlowMeter flowMeter, CBoard controlBoard, ref DoubleBox flowBox, Event eventDone)
|
||||
{
|
||||
if (flowMeter == null || controlBoard == null) throw new ArgumentNullException();
|
||||
|
||||
@ -35,7 +35,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadFlowOp(GenericDevices.IFlowMeter flowMeter, ControlBoardDev controlBoard, ref DoubleBox flowBox)
|
||||
public ReadFlowOp(GenericDevices.IFlowMeter flowMeter, CBoard controlBoard, ref DoubleBox flowBox)
|
||||
: this(flowMeter, controlBoard, ref flowBox, Event.FlowMeasurementDone)
|
||||
{
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
public override string ToString() { return string.Format("StartMeasurementOp(ref={0},pulses={1})", flowMeterNr, totalRefPulses); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly IRegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly int regulValveStableTime;
|
||||
@ -54,7 +54,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
/// <param name="method">Test method</param>
|
||||
/// <param name="totalRefPulses">Test duration in number of reference flowmeter pulses</param>
|
||||
/// <param name="filterConstant">Specifies filter for watermeter pulses</param>
|
||||
public StartMeasurementOp(ControlBoardDev controlBoard, OutputPath outputPath, TestMethods method,
|
||||
public StartMeasurementOp(CBoard controlBoard, OutputPath outputPath, TestMethods method,
|
||||
double requiredFlowLo, double requiredFlowHi, int refPulses, int delayBeforeFlowRegulation = 0)
|
||||
: this(controlBoard, outputPath, method, requiredFlowLo, requiredFlowHi, refPulses, refPulses, delayBeforeFlowRegulation)
|
||||
{
|
||||
@ -69,7 +69,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
/// <param name="method">Test method</param>
|
||||
/// <param name="refPulses">Test duration in number of reference flowmeter pulses</param>
|
||||
/// <param name="filterConstant">Specifies filter for watermeter pulses</param>
|
||||
public StartMeasurementOp(ControlBoardDev controlBoard, OutputPath outputPath, TestMethods method,
|
||||
public StartMeasurementOp(CBoard controlBoard, OutputPath outputPath, TestMethods method,
|
||||
double requiredFlowLo, double requiredFlowHi, int totalRefPulses, int massRefPulses, int delayBeforeFlowRegulation = 0)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("controlBoardDev");
|
||||
|
||||
@ -12,7 +12,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
public override string ToString() { return string.Format("StopFlowRegulationOp(.)"); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly int flowMeterNr;
|
||||
|
||||
/// <summary>
|
||||
@ -20,7 +20,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
/// Events: None or PreviousStopped
|
||||
/// </summary>
|
||||
/// <param name="controlBoardDev">Control board component reference</param>
|
||||
public StopFlowRegulationOp(ControlBoardDev controlBoardDev)
|
||||
public StopFlowRegulationOp(CBoard controlBoardDev)
|
||||
{
|
||||
if (controlBoardDev == null) throw new ArgumentNullException("controlBoardDev");
|
||||
this.controlBoard = controlBoardDev;
|
||||
|
||||
@ -12,7 +12,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
public override string ToString() { return string.Format("StopPreviousOp(.)"); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
|
||||
///
|
||||
/// Internal states of this operation
|
||||
@ -31,7 +31,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
/// Events: None or PreviousStopped
|
||||
/// </summary>
|
||||
/// <param name="controlBoardDev">Control board component reference</param>
|
||||
public StopPreviousOp(ControlBoardDev controlBoardDev)
|
||||
public StopPreviousOp(CBoard controlBoardDev)
|
||||
{
|
||||
if (controlBoardDev == null) throw new ArgumentNullException("controlBoardDev");
|
||||
this.controlBoard = controlBoardDev;
|
||||
|
||||
@ -1,182 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using Dirichlet.Numerics;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.ControlBoard.New
|
||||
{
|
||||
public class CBoard : ComponentBase, IControlBoard
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CBoard));
|
||||
public override string ToString() { return string.Format("CBoard({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly CBoardCfg cBoardCfg;
|
||||
|
||||
public OutputPath Devices
|
||||
{
|
||||
set { devices = value; }
|
||||
get { return devices; }
|
||||
}
|
||||
OutputPath devices;
|
||||
|
||||
public CBoard()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public CBoard(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
cBoardCfg = cfg as CBoardCfg;
|
||||
|
||||
}
|
||||
|
||||
public void SpecifyInvertedValves(UInt128 valvesToInvert)
|
||||
{
|
||||
this.valvesToInvert = valvesToInvert;
|
||||
this.benchModelRoute = valvesToInvert;
|
||||
}
|
||||
|
||||
|
||||
public void Initialize() { }
|
||||
public void RunDeviceBefore() { }
|
||||
public void RunDeviceAfter() { }
|
||||
public void StopDevice() { }
|
||||
public void StopDevice2() { }
|
||||
|
||||
|
||||
///
|
||||
/// IControlBoard interface
|
||||
///
|
||||
|
||||
/// <summary>
|
||||
/// Route: 128-bit word representing the current state of all valves and pumps
|
||||
/// </summary>
|
||||
public UInt128 Route { get { return benchModelRoute; } }
|
||||
UInt128 benchModelRoute;
|
||||
UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
|
||||
readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
|
||||
|
||||
public UInt64 DigitalInputs { get { return 0; } }
|
||||
|
||||
public double RefFrequency { get { return 0; } }
|
||||
public double RefFlow { get { return 0; } }
|
||||
|
||||
///
|
||||
/// Last test result
|
||||
///
|
||||
public int RefPulses { get { return 0; } }
|
||||
public double TestTime { get { return 1.0; } }
|
||||
public int RefPulsesWM(int wmNr1) { return (wmNr1 > 0 && wmNr1 <= Config.Data.WMsCount) ? 0 : 0; }
|
||||
public int PulsesWM(int wmNr1) { return (wmNr1 > 0 && wmNr1 <= Config.Data.WMsCount) ? 0 : 0; }
|
||||
public double TestTimeWM(int wmNr1) { return (wmNr1 > 0 && wmNr1 <= Config.Data.WMsCount) ? 1.0 : 1.0; }
|
||||
|
||||
|
||||
public void UpdateUI(string sParam, int iParam, double value) { }
|
||||
public void ClearProcessValues() { }
|
||||
|
||||
public UInt128 SetValves(UInt128 valvesToOpen, UInt128 valvesToClose, IList<BuiltIn.ValveEx.Valve> extendedValves)
|
||||
{
|
||||
return routeMask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open one valve and/or close one valve.
|
||||
/// Events: ValvesSet
|
||||
/// </summary>
|
||||
/// <param name="valveOpen">Valve to be opened</param>
|
||||
/// <param name="valveClose">Valve to be closed</param>
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation SetValvesOp(IValve valveOpen, IValve valveClose)
|
||||
{
|
||||
return new BuiltIn.SetValvesOp(this, valveOpen, valveClose);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open and/or close multiple valves.
|
||||
/// Events: ValvesSet
|
||||
/// </summary>
|
||||
/// <param name="valvesOpen">A list of valves to be opened</param>
|
||||
/// <param name="valvesClose">A list of valves to be closed</param>
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation SetValvesOp(IList<IValve> valvesOpen, IList<IValve> valvesClose)
|
||||
{
|
||||
return new BuiltIn.SetValvesOp(this, valvesOpen, valvesClose);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open start/stop valve.
|
||||
/// Events: ValvesSet, ValvesBusy, Error
|
||||
/// </summary>
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation OpenStartValveOp()
|
||||
{
|
||||
return new BuiltIn.SetValvesOp(this, true, devices);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Close start/stop valve.
|
||||
/// Events: ValvesSet, ValvesBusy, Error
|
||||
/// </summary>
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation CloseStartValveOp()
|
||||
{
|
||||
return new BuiltIn.SetValvesOp(this, false, devices);
|
||||
}
|
||||
|
||||
public float ValveOpenCloseTime { get { return 0.1f; } }
|
||||
|
||||
|
||||
public IOperation SetFlowOp(double reqrdFlowLo, double reqrdFlowHi, TBF.Boxes.DoubleBox measuredFlow, int timeout)
|
||||
{
|
||||
return null; /// TODO
|
||||
}
|
||||
|
||||
public IOperation StopFlowRegulationOp()
|
||||
{
|
||||
return null; /// TODO
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start a test, Events: MeasurementStarted
|
||||
/// </summary>
|
||||
/// <param name="iParam">Int32 parameter 1</param>
|
||||
/// <param name="dParam1">Double parameter 1 (alternative lower flow limit)</param>
|
||||
/// <param name="dParam2">Double parameter 2 (alternative upper flow limit)</param>
|
||||
/// <returns>Operation</returns>
|
||||
public IOperation StartTestOp(Test test, int iParam = 0, double dParam1 = 0, double dParam2 = 0)
|
||||
{
|
||||
return null; /// TODO
|
||||
}
|
||||
|
||||
public IOperation QueryMeasurementEndOp()
|
||||
{
|
||||
return null; /// TODO
|
||||
}
|
||||
|
||||
public IOperation StopMeasurementOp()
|
||||
{
|
||||
return null; /// TODO
|
||||
}
|
||||
|
||||
public IOperation ReadDiverterTransitionOp(bool isStart, Sequences.Statistics plotter, int batchNr, string testName, int repetition)
|
||||
{
|
||||
return null; /// TODO
|
||||
}
|
||||
|
||||
public IOperation StopPreviousOp()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.ControlBoard.New
|
||||
{
|
||||
public class CBoardCfg : ComponentCfgBase, IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CBoardCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new CBoardCfgCtrl(); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int ComPortNr;
|
||||
public int VirtualValvesRangeLo;
|
||||
public int VirtualValvesRangeHi;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
CBoardCfg()
|
||||
{
|
||||
Name = "CB";
|
||||
ParentName = string.Empty;
|
||||
ComPortNr = 1;
|
||||
VirtualValvesRangeLo = 50;
|
||||
VirtualValvesRangeHi = 59;
|
||||
}
|
||||
|
||||
public CBoardCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Com{1}, VVRangeLo={2}, VVRangeHi={3}", Name, ComPortNr, VirtualValvesRangeLo, VirtualValvesRangeHi);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,155 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.ControlBoard.New
|
||||
{
|
||||
partial class CBoardCfgCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.comPortNrLabel = new System.Windows.Forms.Label();
|
||||
this.comPortNrTextBox = new System.Windows.Forms.TextBox();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.vValveRangeLoTextBox = new System.Windows.Forms.TextBox();
|
||||
this.vValveRangeLoLabel = new System.Windows.Forms.Label();
|
||||
this.vValveRangeHiTextBox = new System.Windows.Forms.TextBox();
|
||||
this.vValveRangeHiLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// comPortNrLabel
|
||||
//
|
||||
this.comPortNrLabel.AutoSize = true;
|
||||
this.comPortNrLabel.Location = new System.Drawing.Point(42, 85);
|
||||
this.comPortNrLabel.Name = "comPortNrLabel";
|
||||
this.comPortNrLabel.Size = new System.Drawing.Size(95, 13);
|
||||
this.comPortNrLabel.TabIndex = 0;
|
||||
this.comPortNrLabel.Text = "Serial port number:";
|
||||
//
|
||||
// comPortNrTextBox
|
||||
//
|
||||
this.comPortNrTextBox.Enabled = false;
|
||||
this.comPortNrTextBox.Location = new System.Drawing.Point(166, 82);
|
||||
this.comPortNrTextBox.Name = "comPortNrTextBox";
|
||||
this.comPortNrTextBox.Size = new System.Drawing.Size(80, 20);
|
||||
this.comPortNrTextBox.TabIndex = 1;
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(163, 26);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 2;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(42, 60);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 3;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(166, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(80, 20);
|
||||
this.nameTextBox.TabIndex = 4;
|
||||
//
|
||||
// vValveRangeLoTextBox
|
||||
//
|
||||
this.vValveRangeLoTextBox.Enabled = false;
|
||||
this.vValveRangeLoTextBox.Location = new System.Drawing.Point(166, 107);
|
||||
this.vValveRangeLoTextBox.Name = "vValveRangeLoTextBox";
|
||||
this.vValveRangeLoTextBox.Size = new System.Drawing.Size(80, 20);
|
||||
this.vValveRangeLoTextBox.TabIndex = 6;
|
||||
//
|
||||
// vValveRangeLoLabel
|
||||
//
|
||||
this.vValveRangeLoLabel.AutoSize = true;
|
||||
this.vValveRangeLoLabel.Location = new System.Drawing.Point(42, 110);
|
||||
this.vValveRangeLoLabel.Name = "vValveRangeLoLabel";
|
||||
this.vValveRangeLoLabel.Size = new System.Drawing.Size(118, 13);
|
||||
this.vValveRangeLoLabel.TabIndex = 5;
|
||||
this.vValveRangeLoLabel.Text = "Virtual valves range Lo:";
|
||||
//
|
||||
// vValveRangeHiTextBox
|
||||
//
|
||||
this.vValveRangeHiTextBox.Enabled = false;
|
||||
this.vValveRangeHiTextBox.Location = new System.Drawing.Point(166, 132);
|
||||
this.vValveRangeHiTextBox.Name = "vValveRangeHiTextBox";
|
||||
this.vValveRangeHiTextBox.Size = new System.Drawing.Size(80, 20);
|
||||
this.vValveRangeHiTextBox.TabIndex = 8;
|
||||
//
|
||||
// vValveRangeHiLabel
|
||||
//
|
||||
this.vValveRangeHiLabel.AutoSize = true;
|
||||
this.vValveRangeHiLabel.Location = new System.Drawing.Point(42, 135);
|
||||
this.vValveRangeHiLabel.Name = "vValveRangeHiLabel";
|
||||
this.vValveRangeHiLabel.Size = new System.Drawing.Size(116, 13);
|
||||
this.vValveRangeHiLabel.TabIndex = 7;
|
||||
this.vValveRangeHiLabel.Text = "Virtual valves range Hi:";
|
||||
//
|
||||
// ControlBoardCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.vValveRangeHiTextBox);
|
||||
this.Controls.Add(this.vValveRangeHiLabel);
|
||||
this.Controls.Add(this.vValveRangeLoTextBox);
|
||||
this.Controls.Add(this.vValveRangeLoLabel);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Controls.Add(this.comPortNrTextBox);
|
||||
this.Controls.Add(this.comPortNrLabel);
|
||||
this.Name = "ControlBoardCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.ControlBoardCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label comPortNrLabel;
|
||||
private System.Windows.Forms.TextBox comPortNrTextBox;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.TextBox vValveRangeLoTextBox;
|
||||
private System.Windows.Forms.Label vValveRangeLoLabel;
|
||||
private System.Windows.Forms.TextBox vValveRangeHiTextBox;
|
||||
private System.Windows.Forms.Label vValveRangeHiLabel;
|
||||
}
|
||||
}
|
||||
@ -1,105 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.ControlBoard.New
|
||||
{
|
||||
public partial class CBoardCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
CBoardCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as CBoardCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public CBoardCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ControlBoardCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
comPortNrTextBox.Text = config.ComPortNr.ToString();
|
||||
vValveRangeLoTextBox.Text = config.VirtualValvesRangeLo.ToString();
|
||||
vValveRangeHiTextBox.Text = config.VirtualValvesRangeHi.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
comPortNrTextBox.Enabled = true;
|
||||
vValveRangeLoTextBox.Enabled = true;
|
||||
vValveRangeHiTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify current user controls for validity.
|
||||
/// Called when user wants to close/save the configuration.
|
||||
/// </summary>
|
||||
/// <returns>See VerifyFlags</returns>
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
int dummy;
|
||||
if (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy <= 0 || dummy > 999)
|
||||
{
|
||||
message += "Control board serial port number is invalid";
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
}
|
||||
if (!int.TryParse(vValveRangeLoTextBox.Text, out dummy) || dummy < 0 || dummy > 63)
|
||||
{
|
||||
message += "Virtual valves range Lo is invalid";
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
}
|
||||
if (!int.TryParse(vValveRangeHiTextBox.Text, out dummy) || dummy < 0 || dummy > 63)
|
||||
{
|
||||
message += "Virtual valves range Hi is invalid";
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save settings to the configuration class.
|
||||
/// </summary>
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
this.Name = nameTextBox.Text;
|
||||
this.config.ComPortNr = int.Parse(comPortNrTextBox.Text);
|
||||
this.config.VirtualValvesRangeLo = int.Parse(vValveRangeLoTextBox.Text);
|
||||
this.config.VirtualValvesRangeHi = int.Parse(vValveRangeHiTextBox.Text);
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.ControlBoard.New
|
||||
{
|
||||
public class CBoardFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
/// <summary>Max. number of components of this class in the system</summary>
|
||||
public int MaxCount { get { return 1; } }
|
||||
|
||||
public IComponent DummyComponent() { return new CBoard(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new CBoard(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new CBoardCfg(this); }
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl() { return new CBoardCfgCtrl(); }
|
||||
|
||||
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
|
||||
{
|
||||
return new CBoard((CBoardCfg)config);
|
||||
}
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(CBoardCfg.Serializer, component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { }
|
||||
}
|
||||
}
|
||||
@ -39,20 +39,32 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
Queue<IOutputMessage> msgQueue;
|
||||
|
||||
/// Received data
|
||||
GeneralData generalData;
|
||||
public GeneralData Data;
|
||||
DivTransitionData divTransitionData;
|
||||
ScopeAnalyzerData scopeAnalyzerData;
|
||||
SwitchCountersData switchCounterData;
|
||||
|
||||
|
||||
UInt128 benchModelRoute;
|
||||
public UInt128 Route { set; get; } /// State of valves, test bench route
|
||||
///
|
||||
public UInt64 DigitalInputs { set; get; } /// Inputs
|
||||
|
||||
public UInt64 State { get { return Data.State; } } /// Control board state
|
||||
public UInt64 DigitalInputs { get { return Data.Vstupy; } } /// Digital inputs
|
||||
public UInt128 Route { get { return Data.Vystupy; } } /// Test bench route: states of valves
|
||||
|
||||
public Int16 AnalogInput(int channel)
|
||||
{
|
||||
if (Data.AnalogInput != null && channel >= 0 && channel < Data.AnalogInput.Length)
|
||||
{
|
||||
return Data.AnalogInput[channel];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Values valid during a test
|
||||
public double RefFrequency { set; get; }
|
||||
public double RefFlow { set; get; }
|
||||
public double RefFrequency { get { return Data.ReferenceFreq[0]; } }
|
||||
|
||||
public double RefFlow
|
||||
{
|
||||
get { return (Devices != null && Devices.FlowMeter != null) ? Devices.FlowMeter.ReadFlow() : 0.0; }
|
||||
}
|
||||
|
||||
/// Last test results
|
||||
public double TestTime { set; get; }
|
||||
@ -91,7 +103,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
#endif
|
||||
cBoardCfg = cfg as CBoardCfg;
|
||||
|
||||
generalData = new GeneralData();
|
||||
Data = new GeneralData();
|
||||
divTransitionData = null;
|
||||
scopeAnalyzerData = null;
|
||||
switchCounterData = null;
|
||||
@ -114,7 +126,6 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
public void SpecifyInvertedValves(UInt128 valvesToInvert)
|
||||
{
|
||||
this.valvesToInvert = valvesToInvert;
|
||||
this.benchModelRoute = valvesToInvert;
|
||||
}
|
||||
|
||||
#region IDevice interface
|
||||
@ -185,7 +196,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
else if (GeneralData.FrameFitsData(rcvdData, cumulativeSums, rcvdBytesCount, offset))
|
||||
{
|
||||
/// Regular data received
|
||||
generalData.UpdateData(rcvdData, offset);
|
||||
Data.UpdateData(rcvdData, offset);
|
||||
string s = Telegram.LogTelegram("General data ", rcvdData, offset, GeneralData.MessageLen);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
@ -399,5 +410,17 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void DiverterToTank(int divNr1)
|
||||
{
|
||||
}
|
||||
|
||||
public void DiverterToSink(int divNr1)
|
||||
{
|
||||
}
|
||||
|
||||
public void ReadDiverterTransition(int divNr1)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,8 +44,8 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
public void InitializeAll()
|
||||
{
|
||||
ComPortNr = 1;
|
||||
VirtValvesRangeLo = 50;
|
||||
VirtValvesRangeHi = 59;
|
||||
VirtValvesRangeLo = 90;
|
||||
VirtValvesRangeHi = 99;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
|
||||
@ -21,7 +21,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
public enum StatusP : ulong
|
||||
{
|
||||
/// byte 0
|
||||
FlowmtrIdMask = 0x7, /// bits 0,1,2
|
||||
FlowmtrNrMask = 0x7, /// bits 0,1,2
|
||||
TestInProgress = 0x8, /// bit 3
|
||||
TestCompleted = 0x10, /// bit 4
|
||||
ReadingCounters = 0x20, /// bit 5
|
||||
@ -44,6 +44,11 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
TimeoutOccured = 0x100000000, /// bit 32 (after 40s without communication)
|
||||
MeretAddresses = 0x200000000, /// bit 33
|
||||
ScopeBufferFull = 0x400000000, /// bit 34
|
||||
/// byte 5
|
||||
/// byte 6
|
||||
Flowmtr1Active = 0x1000000000000, /// bit 48
|
||||
Flowmtr2Active = 0x2000000000000, /// bit 49
|
||||
Flowmtr3Active = 0x4000000000000, /// bit 50
|
||||
}
|
||||
|
||||
public enum Command : byte
|
||||
@ -67,15 +72,26 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
CalibrationMode = 128,
|
||||
}
|
||||
|
||||
public enum StopParam : byte
|
||||
public enum StopDevs : byte
|
||||
{
|
||||
StopEtalon = 1,
|
||||
StopDiverter = 2,
|
||||
StopDirectGate = 8,
|
||||
StopTimer = 16,
|
||||
StartStopMethod = 32,
|
||||
None = 0,
|
||||
Reference = 0x01, /// bit 0
|
||||
Diverter = 0x02, /// bit 1
|
||||
GatePulse = 0x08, /// bit 3
|
||||
TimeMeasurement = 0x10, /// bit 4
|
||||
BypassDevCoupled2Div = 0x20, /// bit 5
|
||||
RegValveRegulation = 0x80, /// bit 7
|
||||
All = 0xFF,
|
||||
}
|
||||
|
||||
public enum TestMethods
|
||||
{
|
||||
Diverter = 0x01, /// bit 0: 1=Mass method (diverters are used), 0=Volume method
|
||||
FixedStart = 0x02, /// bit 1: 1=fixed start method, 0=flying start method
|
||||
Synchro = 0x04, /// bit 2: 1=Synchro method, 0=Pulse counting
|
||||
MassAndContinue = 0x10, /// bit 4: 1=Method with mass measurement followed by a volume method
|
||||
}
|
||||
|
||||
public enum ValveChgFlag : byte
|
||||
{
|
||||
DoNotChange = 0,
|
||||
@ -85,8 +101,17 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
|
||||
public enum RegValveMode : byte
|
||||
{
|
||||
Mode0 = 0,
|
||||
Mode1 = 1,
|
||||
Mode2 = 2,
|
||||
None = 0,
|
||||
PulseWidth = 1, /// Pulse width 0.05 .. 2 sec.
|
||||
TargetPosition = 2, /// Low and high position (=DAC value) limits (0..100%) are specified
|
||||
TargetFrequency = 3, /// Low and high frequency limits (0..2000Hz,0..2200Hz) are specified
|
||||
Stop = 4, /// Stop regulation
|
||||
}
|
||||
|
||||
public enum RegValveState : byte
|
||||
{
|
||||
Idle = 0,
|
||||
PwOrFreqRegul = 2,
|
||||
DacValueRegul = 3,
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new CBoard(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new CBoardCfg(this.GetType().Namespace.Substring(32), this); }
|
||||
public IComponentCfg DefaultConfig() { return new CBoardCfg("UniCB", this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
|
||||
@ -10,26 +10,24 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
public const byte MessageCode = (byte)' ';
|
||||
|
||||
/// General data
|
||||
public ulong Status; /// byte 5..9, 5 bytes = 40 bits
|
||||
public uint Status5;
|
||||
public uint Status6; /// Parallel flow meters mask: bit0=0x01=Et1, bit1=0x02=Et2, bit2=0x04=Et3
|
||||
public ulong State; /// bytes 5,6,7,8,9,80,81 = 7 bytes = 56 bits
|
||||
public uint Chyby485;
|
||||
public ulong Vystupy;
|
||||
public uint[] StavDA = new uint[2];
|
||||
public float[] ReferenceFreq = new float[4];
|
||||
public uint[] EtPulses = new uint[Const.WMsCount + 1]; /// EtPulses[0]=total pulses, EtPulses[1..WMsCount] gated et.pulses for respective WM
|
||||
public double[] ReferenceFreq = new double[4];
|
||||
public uint[] EtPulses = new uint[Const.WMsCount + 1]; /// EtPulses[0]=total pulses, EtPulses[1..WMsCount] gated et.pulses for respective WM
|
||||
public uint EtPulsesK;
|
||||
public uint EtPulses2;
|
||||
public uint EtPulses3;
|
||||
public uint[] WMeterPuls = new uint[Const.WMsCount + 1]; /// WMsCount = 20
|
||||
public double[] ImpulseTime = new double[Const.WMsCount + 1]; /// WMsCount = 20
|
||||
public uint[] RegVStatus = new uint[Const.RVsCount + 1 + 1]; /// RVsCount = 8, posledny rValveStatus[9] je prudovy
|
||||
public uint[] WMeterPuls = new uint[Const.WMsCount + 1]; /// WMsCount = 20
|
||||
public double[] ImpulseTime = new double[Const.WMsCount + 1]; /// WMsCount = 20
|
||||
public uint[] RegVStatus = new uint[Const.RVsCount + 1 + 1]; /// RVsCount = 8, posledny rValveStatus[9] je prudovy
|
||||
public float[] RegVMoveTime = new float[Const.RVsCount];
|
||||
public int DivTime;
|
||||
public double Ttime; /// s
|
||||
public double TimeRef; /// s
|
||||
public double Ttime; /// s
|
||||
public double TimeRef; /// s
|
||||
public ulong Vstupy;
|
||||
public int[] AnalogyRaw = new int[Const.ADCsCount];
|
||||
public Int16[] AnalogInput = new Int16[Const.ADCsCount];
|
||||
public int[] TemperatureRaw = new int[8];
|
||||
|
||||
|
||||
@ -66,12 +64,12 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
/// <param name="data">Received data</param>
|
||||
/// <param name="offs">Offset to the files</param>
|
||||
/// <returns></returns>
|
||||
short GetInt16(byte[] data, int offs) { return BitConverter.ToInt16(data, offs); }
|
||||
ushort GetUInt16(byte[] data, int offs) { return BitConverter.ToUInt16(data, offs); }
|
||||
uint GetUInt24(byte[] data, int offs) { return BitConverter.ToUInt32(data, offs) & 0x00FFFFFF; }
|
||||
uint GetUInt32(byte[] data, int offs) { return BitConverter.ToUInt32(data, offs); }
|
||||
ulong GetUInt40(byte[] data, int offs) { return BitConverter.ToUInt64(data, offs) & 0x000000FFFFFFFFFF; }
|
||||
ulong GetUInt64(byte[] data, int offs) { return BitConverter.ToUInt64(data, offs); }
|
||||
Int16 GetInt16(byte[] data, int offs) { return BitConverter.ToInt16(data, offs); }
|
||||
UInt16 GetUInt16(byte[] data, int offs) { return BitConverter.ToUInt16(data, offs); }
|
||||
UInt32 GetUInt24(byte[] data, int offs) { return BitConverter.ToUInt32(data, offs) & 0x00FFFFFF; }
|
||||
UInt32 GetUInt32(byte[] data, int offs) { return BitConverter.ToUInt32(data, offs); }
|
||||
UInt64 GetUInt40(byte[] data, int offs) { return BitConverter.ToUInt64(data, offs) & 0x000000FFFFFFFFFF; }
|
||||
UInt64 GetUInt64(byte[] data, int offs) { return BitConverter.ToUInt64(data, offs); }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -81,7 +79,10 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
/// <param name="offs">Offset of the message</param>
|
||||
public void UpdateData(byte[] data, int offs)
|
||||
{
|
||||
Status = GetUInt40(data, offs + (int)Poz.Status); /// Byte 5,6,7,8,9
|
||||
State = GetUInt40(data, offs + (int)Poz.State) | /// Byte 5,6,7,8,9,80,81
|
||||
((ulong)data[offs + (int)Poz.Stat5] << 40) |
|
||||
((ulong)data[offs + (int)Poz.Stat6] << 48);
|
||||
|
||||
Vystupy = GetUInt64(data, offs + (int)Poz.Vyst); /// Byte 10 .. 17
|
||||
StavDA[1] = GetUInt16(data, offs + (int)Poz.SDA2); /// Byte 18,19
|
||||
Vstupy = GetUInt40(data, offs + (int)Poz.Vst); /// Byte 20,21,22,23,24
|
||||
@ -89,7 +90,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
/// A/D converters: Feedback from RV-s and diverters
|
||||
for (int i = 0; i < Const.ADCsCount; i++) /// Byte 25 .. 56
|
||||
{
|
||||
AnalogyRaw[i] = GetInt16(data, offs + (int)Poz.Analogy + 2 * i);
|
||||
AnalogInput[i] = GetInt16(data, offs + (int)Poz.Analogy + 2 * i);
|
||||
}
|
||||
|
||||
/// Groch temperature meters
|
||||
@ -101,8 +102,6 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
EtPulses[0] = GetUInt24(data, offs + (int)Poz.Et1); /// Byte 73,74,75
|
||||
EtPulsesK = GetUInt24(data, offs + (int)Poz.EtK); /// Byte 76,77,78
|
||||
byte spare1 = data[offs + (int)Poz.spare1]; /// byte 79
|
||||
Status5 = data[offs + (int)Poz.Stat5]; /// Byte 80
|
||||
Status6 = data[offs + (int)Poz.Stat6]; /// Byte 81
|
||||
byte spare2 = data[offs + (int)Poz.spare2]; /// byte 82
|
||||
|
||||
for (int i = 0; i < Const.RVsCount; i++) /// Byte 83 .. 90
|
||||
@ -110,7 +109,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
RegVStatus[i + 1] = ((uint)data[offs + (int)Poz.RVs + i] >> 3) & 7;
|
||||
}
|
||||
/// 4-20 mA reg. valve
|
||||
uint stavRegQ = (uint)((Status >> 16) & 0xFF);
|
||||
uint stavRegQ = (uint)((State >> 16) & 0xFF);
|
||||
RegVStatus[Const.RVsCount + 1] = (stavRegQ >> 4) & 2;
|
||||
|
||||
/// This must preceed processing bytes 91 .. 250 as Ttime is used there
|
||||
@ -123,7 +122,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
int ix2 = offs + (int)Poz.CTR1;
|
||||
for (int wmNr = 1; wmNr <= Const.WMsCount; wmNr++, ix1 += 6, ix2 += 2)
|
||||
{
|
||||
if ((Status & (ulong)StatusP.SynchroMethod) != 0)
|
||||
if ((State & (ulong)StatusP.SynchroMethod) != 0)
|
||||
{
|
||||
ushort pulses = GetUInt16(data, ix2);
|
||||
WMeterPuls[wmNr] = pulses;
|
||||
@ -154,15 +153,23 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
ReferenceFreq[0] = (par2[0] != 0) ? (5.0f * par1[0] / par2[0]) : 0.0f;
|
||||
ReferenceFreq[1] = ReferenceFreq[2] = ReferenceFreq[3] = 0;
|
||||
///
|
||||
if ((Status & (ulong)StatusP.TestWithRefFlowmtr) != 0 && (Status & (ulong)StatusP.FlowmtrIdMask) == 0)
|
||||
if ((State & (ulong)StatusP.TestWithRefFlowmtr) != 0 && (State & (ulong)StatusP.FlowmtrNrMask) == 0)
|
||||
{
|
||||
/// Measurement with parallel flowmeters
|
||||
if ((Status6 & 0x01) != 0)
|
||||
if ((State & (ulong)StatusP.Flowmtr1Active) != 0)
|
||||
{
|
||||
ReferenceFreq[1] = ReferenceFreq[0];
|
||||
if ((Status6 & 0x02) != 0)
|
||||
}
|
||||
|
||||
if ((State & (ulong)StatusP.Flowmtr2Active) != 0)
|
||||
{
|
||||
ReferenceFreq[2] = (par2[1] != 0) ? (5.0f * par1[1] / par2[1]) : 0.0f;
|
||||
if ((Status6 & 0x04) != 0)
|
||||
}
|
||||
|
||||
if ((State & (ulong)StatusP.Flowmtr3Active) != 0)
|
||||
{
|
||||
ReferenceFreq[3] = (par2[2] != 0) ? (5.0f * par1[2] / par2[2]) : 0.0f;
|
||||
}
|
||||
|
||||
ReferenceFreq[0] = ReferenceFreq[1] + ReferenceFreq[2] + ReferenceFreq[3];
|
||||
}
|
||||
@ -188,8 +195,8 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
/// </summary>
|
||||
public enum Poz : int
|
||||
{
|
||||
Status = 5, /// 5 .. 9
|
||||
Vyst = Status + 5, /// 10 .. 17
|
||||
State = 5, /// 5 .. 9
|
||||
Vyst = State + 5, /// 10 .. 17
|
||||
SDA2 = Vyst + 8, /// 18,19
|
||||
Vst = SDA2 + 2, /// 20 .. 24
|
||||
Analogy = Vst + 5, /// 25 .. 56
|
||||
|
||||
@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.CoverTest
|
||||
|
||||
readonly CoverTestCfg coverTestCfg;
|
||||
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly int bitPosition; /// 0 .. 63
|
||||
readonly ulong mask; /// derived from bitPosition in the constructor
|
||||
readonly ulong target;
|
||||
@ -36,7 +36,7 @@ namespace TBF.BenchControl.Elde.CoverTest
|
||||
{
|
||||
coverTestCfg = cfg as CoverTestCfg;
|
||||
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
controlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
bitPosition = coverTestCfg.BitPosition;
|
||||
|
||||
@ -35,7 +35,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
readonly DiverterCfg diverterCfg;
|
||||
public SchematicDrawing.IDrawingItem DrawingItem { get { return diverterCfg as SchematicDrawing.IDrawingItem; } }
|
||||
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly UInt128 mask; /// derived from bitPosition in the constructor
|
||||
public int AdcNr { get { return diverterCfg.AdcNr; } }
|
||||
|
||||
@ -72,7 +72,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
{
|
||||
diverterCfg = cfg as DiverterCfg;
|
||||
|
||||
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as ControlBoardDev;
|
||||
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as CBoard;
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
if (cfg.DebugLevel != Config.Entities.DebugMode.Off)
|
||||
@ -195,8 +195,8 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
public void Initialize() { }
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
int adcValue = (int)controlBoard.AnalogInputRaw(diverterCfg.AdcNr, 0);
|
||||
Handlers.OnAdcChanged(this, new CmdResponseArgs(CfgChangeCmd.GetAdc, diverterCfg.BitNr, adcValue));
|
||||
short adcValue = (short)controlBoard.AnalogInputRaw(diverterCfg.AdcNr, 0);
|
||||
Handlers.OnAdcChanged(this, new CmdResponseArgs(CfgChangeCmd.GetAdc, diverterCfg.BitNr, adcValue));
|
||||
}
|
||||
public void RunDeviceAfter() { }
|
||||
public void StopDevice() { }
|
||||
@ -245,8 +245,8 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
}
|
||||
else if (args.Command == CfgChangeCmd.GetAdc1 || args.Command == CfgChangeCmd.GetAdc2)
|
||||
{
|
||||
int adcValue = (int)controlBoard.AnalogInputRaw(diverterCfg.AdcNr, 0);
|
||||
DiverterCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(args.Command, diverterCfg.BitNr, adcValue));
|
||||
short adcValue = (short)controlBoard.AnalogInputRaw(diverterCfg.AdcNr, 0);
|
||||
DiverterCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(args.Command, diverterCfg.BitNr, adcValue));
|
||||
}
|
||||
else if (args.Command == CfgChangeCmd.DivToTank)
|
||||
{
|
||||
|
||||
@ -8,11 +8,11 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
{
|
||||
public class SwitchDiverterOp : IOperation
|
||||
{
|
||||
ControlBoardDev controlBoard;
|
||||
CBoard controlBoard;
|
||||
bool toTank;
|
||||
int flowMtrNr;
|
||||
|
||||
public SwitchDiverterOp(ControlBoardDev controlBoard, bool toTank, int flowMtrNr)
|
||||
public SwitchDiverterOp(CBoard controlBoard, bool toTank, int flowMtrNr)
|
||||
{
|
||||
this.controlBoard = controlBoard;
|
||||
this.toTank = toTank;
|
||||
|
||||
@ -18,7 +18,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
readonly FlowMeterCfg flowMeterCfg;
|
||||
public SchematicDrawing.IDrawingItem DrawingItem { get { return flowMeterCfg as SchematicDrawing.IDrawingItem; } }
|
||||
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
|
||||
public int Idx1 { get { return flowMeterCfg.Idx1; } }
|
||||
public double NominalFlow { get { return flowMeterCfg.NominalFlow; } }
|
||||
@ -53,7 +53,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
{
|
||||
flowMeterCfg = cfg as FlowMeterCfg;
|
||||
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
controlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
/// Prepare data for SendCalibData() control board component method
|
||||
|
||||
@ -16,7 +16,7 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
|
||||
public override string ToString() { return string.Format("FlowMeter({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly FlowMeterCfg flowMeterCfg;
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly IFlowMeter flowMeter1;
|
||||
readonly IFlowMeter flowMeter2;
|
||||
readonly IFlowMeter flowMeter3;
|
||||
@ -111,7 +111,7 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
|
||||
{
|
||||
flowMeterCfg = cfg as FlowMeterCfg;
|
||||
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
controlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
if (!string.IsNullOrEmpty(flowMeterCfg.Flowmeter1)) flowMeter1 = TbfComponents.FindComponent(flowMeterCfg.Flowmeter1, components) as IFlowMeter;
|
||||
|
||||
@ -15,7 +15,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
|
||||
public override string ToString() { return string.Format("FlowMeter({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly FlowMeterCfg flowMeterCfg;
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard cBoard;
|
||||
|
||||
public int Idx1 { get { return flowMeterCfg.Idx1; } }
|
||||
public double NominalFlow { get { return flowMeterCfg.NominalFlow; } }
|
||||
@ -37,18 +37,18 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
|
||||
{
|
||||
flowMeterCfg = cfg as FlowMeterCfg;
|
||||
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
cBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (cBoard == 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] = (float)flowMeterCfg.NominalFlow;
|
||||
if (Idx1 >= cBoard.EtCalib.Length) throw new Exception("Flowmeter " + Name + " parameter 'Idx1' is out of range");
|
||||
cBoard.EtCalib[Idx1] = (float)flowMeterCfg.NominalFlow;
|
||||
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
public double ReadFlow() { return controlBoard.RefFlow; }
|
||||
public double ReadFrequency() { return controlBoard.RefFrequency; }
|
||||
public double ReadFlow() { return cBoard.RefFlow; }
|
||||
public double ReadFrequency() { return cBoard.RefFrequency; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: FlowDone, Error
|
||||
@ -57,7 +57,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
|
||||
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadFlowOp(ref DoubleBox flow)
|
||||
{
|
||||
return new ReadFlowOp(this, controlBoard, ref flow);
|
||||
return new ReadFlowOp(this, cBoard, ref flow);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -68,7 +68,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
|
||||
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadFlowOp(ref DoubleBox flow, Event flowDone)
|
||||
{
|
||||
return new ReadFlowOp(this, controlBoard, ref flow, flowDone);
|
||||
return new ReadFlowOp(this, cBoard, ref flow, flowDone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
|
||||
public override string ToString() { return string.Format("FlowMeterTwins({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly FlowMeterCfg flowMeterCfg;
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
public readonly Elde.FlowMeter.FlowMeter FlowMeter1;
|
||||
public readonly Elde.FlowMeter.FlowMeter FlowMeter2;
|
||||
|
||||
@ -43,7 +43,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
|
||||
{
|
||||
flowMeterCfg = cfg as FlowMeterCfg;
|
||||
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
controlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
FlowMeter1 = TbfComponents.FindComponent(flowMeterCfg.FlowMeter1, components) as Elde.FlowMeter.FlowMeter;
|
||||
|
||||
@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
readonly PressureMeterCfg pressureMeterCfg;
|
||||
public SchematicDrawing.IDrawingItem DrawingItem { get { return pressureMeterCfg as SchematicDrawing.IDrawingItem; } }
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
public readonly CBoard ControlBoard;
|
||||
|
||||
public readonly int Idx0; /// 0..3
|
||||
public readonly byte RS485Address; /// 0..255
|
||||
@ -33,7 +33,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
{
|
||||
pressureMeterCfg = cfg as PressureMeterCfg;
|
||||
|
||||
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
ControlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
Idx0 = pressureMeterCfg.Idx0;
|
||||
|
||||
@ -18,7 +18,7 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
readonly PressureMeterCfg pressureMeterCfg;
|
||||
public SchematicDrawing.IDrawingItem DrawingItem { get { return pressureMeterCfg as SchematicDrawing.IDrawingItem; } }
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
public readonly CBoard ControlBoard;
|
||||
|
||||
public int Idx0 { get { return pressureMeterCfg.Idx0; } } /// 0..7
|
||||
|
||||
@ -31,7 +31,7 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
{
|
||||
pressureMeterCfg = cfg as PressureMeterCfg;
|
||||
|
||||
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
ControlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
/// Prepare data for SendCalibData() control board component method
|
||||
|
||||
@ -25,7 +25,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
|
||||
public int LagOpening { get { return 0; } }
|
||||
public int LagClosing { get { return 0; } }
|
||||
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly int bitPosition; /// 0 .. 63
|
||||
int FMIndex; /// 0 .. FMPumpsCount-1
|
||||
|
||||
@ -88,7 +88,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
|
||||
{
|
||||
pumpCfg = cfg as PumpCfg;
|
||||
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
controlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
bitPosition = pumpCfg.BitNr;
|
||||
|
||||
@ -17,7 +17,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
}
|
||||
|
||||
/// Set by the constructor
|
||||
readonly TBF.BenchControl.ControlBoard.Legacy.ControlBoardDev controlBoard;
|
||||
readonly TBF.BenchControl.ControlBoard.Legacy.CBoard controlBoard;
|
||||
readonly RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly float timePulseSec;
|
||||
@ -34,7 +34,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public ChangeRegulValvePositionOp(TBF.BenchControl.ControlBoard.IControlBoard cb, RegulValve rv, float timePulseSec)
|
||||
{
|
||||
controlBoard = cb as TBF.BenchControl.ControlBoard.Legacy.ControlBoardDev;
|
||||
controlBoard = cb as TBF.BenchControl.ControlBoard.Legacy.CBoard;
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
|
||||
regulValve = rv as RegulValve;
|
||||
|
||||
@ -23,7 +23,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
IDictionary<double, float> dict;
|
||||
public IDictionary<double, float> Dict { get { return dict; } }
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
public readonly CBoard ControlBoard;
|
||||
|
||||
public ValveCategory Category { get { return RegulValveCfg.Category; } }
|
||||
public int Idx1 { get { return RegulValveCfg.Idx1; } } /// 1..7
|
||||
@ -93,8 +93,8 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
}
|
||||
else if (args.Command == CfgChangeCmd.GetAdc1 || args.Command == CfgChangeCmd.GetAdc2)
|
||||
{
|
||||
int adcValue = (int)ControlBoard.AnalogInputRaw(adcChannel, 0);
|
||||
RegulValveCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(args.Command, Idx1, adcValue));
|
||||
short adcValue = (short)ControlBoard.AnalogInputRaw(adcChannel, 0);
|
||||
RegulValveCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(args.Command, Idx1, adcValue));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -112,7 +112,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
{
|
||||
RegulValveCfg = cfg as RegulValveCfg;
|
||||
|
||||
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
ControlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
this.dict = new Dictionary<double, float>();
|
||||
@ -152,7 +152,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
public void Initialize() { }
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
int adcValue = (int)ControlBoard.AnalogInputRaw(adcChannel, 0);
|
||||
short adcValue = (short)ControlBoard.AnalogInputRaw(adcChannel, 0);
|
||||
Handlers.OnAdcChanged(this, new CmdResponseArgs(CfgChangeCmd.GetAdc, Idx1, adcValue));
|
||||
}
|
||||
public void RunDeviceAfter() { }
|
||||
|
||||
@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
}
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly Elde.RegulValve.RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly IFlowMeter flowMeter;
|
||||
@ -78,7 +78,7 @@ 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, double requiredFlowLo, double requiredFlowHi,
|
||||
public SetFlowOp(CBoard controlBoard, IRegulValve regulValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox flowBox, bool reTryCmds, int timeout, bool leaveMeasurementRunning)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
@ -114,7 +114,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// Set required water flow - Do not leave the measurement running.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
public SetFlowOp(CBoard controlBoard, IRegulValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox flowbox, bool reTryCmds, int timeout)
|
||||
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, flowbox, reTryCmds, timeout, false)
|
||||
{
|
||||
@ -124,7 +124,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// Set required water flow - No timeout.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
public SetFlowOp(CBoard controlBoard, IRegulValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox flowbox, bool reTryCmds)
|
||||
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, flowbox, reTryCmds, int.MaxValue, false)
|
||||
{
|
||||
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
OpState opState;
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly float posLoPct;
|
||||
@ -54,7 +54,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// <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 SetRegulValvePositionOp(ControlBoardDev controlBoard, RegulValve regulValve, float posLoPct, float posHiPct, int timeout)
|
||||
public SetRegulValvePositionOp(CBoard controlBoard, RegulValve regulValve, float posLoPct, float posHiPct, int timeout)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
@ -75,7 +75,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// Set required water flow - no timeout.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetRegulValvePositionOp(ControlBoardDev controlBoard, RegulValve regValve, float posLoPct, float posHiPct)
|
||||
public SetRegulValvePositionOp(CBoard controlBoard, RegulValve regValve, float posLoPct, float posHiPct)
|
||||
: this(controlBoard, regValve, posLoPct, posHiPct, int.MaxValue)
|
||||
{
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
}
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly float timePulseSec;
|
||||
@ -33,7 +33,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
/// <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 ChangeRegulValvePositionOp(ControlBoardDev controlBoard, RegulValve _regulValve, float timePulseSec)
|
||||
public ChangeRegulValvePositionOp(CBoard controlBoard, RegulValve _regulValve, float timePulseSec)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
|
||||
@ -22,7 +22,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
IDictionary<double, float> dict;
|
||||
public IDictionary<double, float> Dict { get { return dict; } }
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
public readonly CBoard ControlBoard;
|
||||
|
||||
public ValveCategory Category { get { return RegulValveCfg.Category; } }
|
||||
public int Idx1 { get { return RegulValveCfg.Idx1; } } /// 1..7
|
||||
@ -59,7 +59,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
{
|
||||
RegulValveCfg = cfg as RegulValveCfg;
|
||||
|
||||
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
ControlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
this.dict = new Dictionary<double, float>();
|
||||
|
||||
@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
}
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly Elde.RegulValveCoax.RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly int flowMeterNr;
|
||||
@ -77,7 +77,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
/// <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,
|
||||
public SetFlowOp(CBoard controlBoard, IRegulValve _regulValve, IFlowMeter flowMeter,
|
||||
double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow,
|
||||
bool reTryCmds, int timeout, bool leaveMeasurementRunning)
|
||||
{
|
||||
@ -121,7 +121,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
/// Set required water flow - Do not leave the measurement running.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
public SetFlowOp(CBoard controlBoard, IRegulValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox measuredFlow, bool reTryCmds, int timeout)
|
||||
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, reTryCmds, timeout, false)
|
||||
{
|
||||
@ -131,7 +131,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
/// Set required water flow - No timeout.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
public SetFlowOp(CBoard controlBoard, IRegulValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox measuredFlow, bool reTryCmds)
|
||||
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, reTryCmds, int.MaxValue, false)
|
||||
{
|
||||
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
OpState opState;
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly float posLoPct;
|
||||
@ -54,7 +54,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
/// <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 SetRegulValvePositionOp(ControlBoardDev controlBoard, RegulValve regulValve, float posLoPct, float posHiPct, int timeout)
|
||||
public SetRegulValvePositionOp(CBoard controlBoard, RegulValve regulValve, float posLoPct, float posHiPct, int timeout)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
@ -75,7 +75,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
/// Set required water flow - no timeout.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetRegulValvePositionOp(ControlBoardDev controlBoard, RegulValve regValve, float posLoPct, float posHiPct)
|
||||
public SetRegulValvePositionOp(CBoard controlBoard, RegulValve regValve, float posLoPct, float posHiPct)
|
||||
: this(controlBoard, regValve, posLoPct, posHiPct, int.MaxValue)
|
||||
{
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
}
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly Elde.RegulValve.RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly float timePulseSec;
|
||||
@ -33,7 +33,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// <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 ChangeRegulValvePositionOp(ControlBoardDev controlBoard, IRegulValve _regulValve, float timePulseSec)
|
||||
public ChangeRegulValvePositionOp(CBoard controlBoard, IRegulValve _regulValve, float timePulseSec)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
|
||||
@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
IDictionary<double, float> dict;
|
||||
public IDictionary<double, float> Dict { get { return dict; } }
|
||||
|
||||
ControlBoardDev controlBoard { get { return regulValve.ControlBoard; } }
|
||||
CBoard controlBoard { get { return regulValve.ControlBoard; } }
|
||||
public ValveCategory Category { get { return RegulValveTandemCfg.Category; } }
|
||||
|
||||
readonly RegulValve.RegulValve regulValve;
|
||||
|
||||
@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
}
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly Elde.RegulValve.RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly Elde.RegulValve.RegulValve fixedRV;
|
||||
@ -76,7 +76,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// <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 regV, IRegulValve fxdRV, float fxdPctLo, float fxdPctHi,
|
||||
public SetFlowOp(CBoard controlBoard, IRegulValve regV, IRegulValve fxdRV, float fxdPctLo, float fxdPctHi,
|
||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow,
|
||||
int timeout, bool leaveMeasurementRunning)
|
||||
{
|
||||
@ -126,7 +126,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// Set required water flow - Do not leave the measurement running.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IRegulValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||
public SetFlowOp(CBoard controlBoard, IRegulValve regValve, IRegulValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
||||
: this(controlBoard, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, false)
|
||||
{
|
||||
@ -136,7 +136,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// Set required water flow - No timeout.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IRegulValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||
public SetFlowOp(CBoard controlBoard, IRegulValve regValve, IRegulValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow)
|
||||
: this(controlBoard, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, int.MaxValue, false)
|
||||
{
|
||||
|
||||
@ -18,7 +18,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
}
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly CBoard controlBoard;
|
||||
readonly Elde.RegulValve.RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly float posLoPct;
|
||||
@ -40,7 +40,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// <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 SetRegulValvePositionOp(ControlBoardDev controlBoard, IRegulValve regV, float posLoPct, float posHiPct, int timeout)
|
||||
public SetRegulValvePositionOp(CBoard controlBoard, IRegulValve regV, float posLoPct, float posHiPct, int timeout)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
@ -61,7 +61,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// Set required water flow - no timeout.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetRegulValvePositionOp(ControlBoardDev controlBoard, RegulValveTandem regValve, float posLoPct, float posHiPct)
|
||||
public SetRegulValvePositionOp(CBoard controlBoard, RegulValveTandem regValve, float posLoPct, float posHiPct)
|
||||
: this(controlBoard, regValve, posLoPct, posHiPct, int.MaxValue)
|
||||
{
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.TempMeter
|
||||
readonly TempMeterCfg tempMtrCfg;
|
||||
public SchematicDrawing.IDrawingItem DrawingItem { get { return tempMtrCfg as SchematicDrawing.IDrawingItem; } }
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
public readonly CBoard ControlBoard;
|
||||
|
||||
public int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..15
|
||||
public double A1 { get { return tempMtrCfg.A1; } }
|
||||
@ -37,7 +37,7 @@ namespace TBF.BenchControl.Elde.TempMeter
|
||||
{
|
||||
tempMtrCfg = cfg as TempMeterCfg;
|
||||
|
||||
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
ControlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
/// Prepare data for SendCalibData() control board component method
|
||||
|
||||
@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.TempMeterInternal
|
||||
readonly TempMeterCfg tempMtrCfg;
|
||||
public SchematicDrawing.IDrawingItem DrawingItem { get { return tempMtrCfg as SchematicDrawing.IDrawingItem; } }
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
public readonly CBoard ControlBoard;
|
||||
|
||||
public int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..7
|
||||
|
||||
@ -32,7 +32,7 @@ namespace TBF.BenchControl.Elde.TempMeterInternal
|
||||
{
|
||||
tempMtrCfg = cfg as TempMeterCfg;
|
||||
|
||||
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
ControlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
/// Prepare data for SendCalibData() control board component method
|
||||
|
||||
@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.TempMeterMeret
|
||||
readonly TempMeterCfg tempMtrCfg;
|
||||
public SchematicDrawing.IDrawingItem DrawingItem { get { return tempMtrCfg as SchematicDrawing.IDrawingItem; } }
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
public readonly CBoard ControlBoard;
|
||||
|
||||
public TempMeter() {}
|
||||
|
||||
@ -28,7 +28,7 @@ namespace TBF.BenchControl.Elde.TempMeterMeret
|
||||
{
|
||||
tempMtrCfg = cfg as TempMeterCfg;
|
||||
|
||||
ControlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as ControlBoardDev;
|
||||
ControlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as CBoard;
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
/// Prepare data for SendCalibData() control board component method
|
||||
|
||||
@ -8,7 +8,7 @@ using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.CometAmbient
|
||||
namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
{
|
||||
/// <summary>
|
||||
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
|
||||
@ -6,7 +6,7 @@ using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.CometAmbient
|
||||
namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
{
|
||||
public class AmbientCfg : ComponentCfgBase, Generic.IChildComponentCfg
|
||||
{
|
||||
@ -1,7 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Modbus.CometAmbient
|
||||
namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
{
|
||||
partial class AmbientCfgCtrl
|
||||
{
|
||||
@ -7,7 +7,7 @@ using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.UI.Bench.Components;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.CometAmbient
|
||||
namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
{
|
||||
public partial class AmbientCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
@ -4,7 +4,7 @@
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.CometAmbient
|
||||
namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
@ -4,7 +4,7 @@
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Meret.PressureMeter
|
||||
namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
@ -8,7 +8,7 @@ using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Meret.PressureMeter
|
||||
namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
{
|
||||
public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter, IDevice, IDrawingItCmpntWithMeasuredVal
|
||||
{
|
||||
@ -7,7 +7,7 @@ using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Meret.PressureMeter
|
||||
namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
{
|
||||
public class PressureMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg, IDrawingItemWithMeasuredVal
|
||||
{
|
||||
@ -7,7 +7,7 @@ using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.UI.Bench.Components;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Meret.PressureMeter
|
||||
namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
{
|
||||
public partial class PressureMeterCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
@ -1,7 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.Modbus.Meret.PressureMeter
|
||||
namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
{
|
||||
partial class PressureMeterCfgCtrl
|
||||
{
|
||||
@ -5,7 +5,7 @@ using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Meret.PressureMeter
|
||||
namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
{
|
||||
public class ReadPressureOp : IOperation
|
||||
{
|
||||
@ -4,7 +4,7 @@
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Danfoss.VLT
|
||||
namespace TBF.BenchControl.Modbus.PumpFM.DanfossVLT
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
@ -13,7 +13,7 @@ using SchematicDrawing;
|
||||
using TBF.BenchControl.ControlBoard;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Danfoss.VLT
|
||||
namespace TBF.BenchControl.Modbus.PumpFM.DanfossVLT
|
||||
{
|
||||
/// <summary>
|
||||
/// See page 20 of MG10S202 Operational Instructions Modbus RTU
|
||||
@ -7,7 +7,7 @@ using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Danfoss.VLT
|
||||
namespace TBF.BenchControl.Modbus.PumpFM.DanfossVLT
|
||||
{
|
||||
public class PumpCfg : ComponentCfgBase, Generic.IChildComponentCfg, IRouteBasedDrawingItem, IDrawingItemWithSetpoint
|
||||
{
|
||||
@ -7,7 +7,7 @@ using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.UI.Bench.Components;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Danfoss.VLT
|
||||
namespace TBF.BenchControl.Modbus.PumpFM.DanfossVLT
|
||||
{
|
||||
public partial class PumpCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
@ -1,7 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.Modbus.Danfoss.VLT
|
||||
namespace TBF.BenchControl.Modbus.PumpFM.DanfossVLT
|
||||
{
|
||||
partial class PumpCfgCtrl
|
||||
{
|
||||
27
TBF/BenchControl/Modbus/TempMeter/Groch/Factory.cs
Normal file
27
TBF/BenchControl/Modbus/TempMeter/Groch/Factory.cs
Normal file
@ -0,0 +1,27 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Groch
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public void ResetStaticProperties() { TempMeter.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new TempMeter(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new TempMeter(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new TempMeterCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(TempMeterCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
62
TBF/BenchControl/Modbus/TempMeter/Groch/ReadTempOp.cs
Normal file
62
TBF/BenchControl/Modbus/TempMeter/Groch/ReadTempOp.cs
Normal file
@ -0,0 +1,62 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Groch
|
||||
{
|
||||
public class ReadTempOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadTempOp));
|
||||
public override string ToString() { return string.Format("ReadTempOp({0},.,{1})", tempMeter.Name, eventDone); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly TempMeter tempMeter;
|
||||
readonly DoubleBox temp; /// Box for the measured value
|
||||
readonly Event eventDone;
|
||||
|
||||
/// <summary>
|
||||
/// Events: TempDone or Error
|
||||
/// </summary>
|
||||
/// <param name="tempMeter">TempMeter reference</param>
|
||||
/// <param name="temp">Reference to the variable, value is in degree Celsius</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadTempOp(TempMeter tempMeter, ref DoubleBox temp, Event eventDone)
|
||||
{
|
||||
if (tempMeter == null) throw new ArgumentNullException("tempMeter");
|
||||
this.tempMeter = tempMeter;
|
||||
this.temp = temp;
|
||||
this.eventDone = eventDone;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public ReadTempOp(TempMeter tempMeter, ref DoubleBox temp)
|
||||
: this(tempMeter, ref temp, Event.TempDone)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
if (temp != null) temp.Val = tempMeter.ReadTemperature();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.TempInDone, Event.TempOutDone or Event.TempDivDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (temp != null) temp.Val = tempMeter.ReadTemperature();
|
||||
return eventDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
122
TBF/BenchControl/Modbus/TempMeter/Groch/TempMeter.cs
Normal file
122
TBF/BenchControl/Modbus/TempMeter/Groch/TempMeter.cs
Normal file
@ -0,0 +1,122 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Groch
|
||||
{
|
||||
public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItCmpnt
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter));
|
||||
public override string ToString() { return string.Format("TempMeter({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly TempMeterCfg tempMtrCfg;
|
||||
public SchematicDrawing.IDrawingItem DrawingItem { get { return tempMtrCfg as SchematicDrawing.IDrawingItem; } }
|
||||
|
||||
public readonly CBoard ControlBoard;
|
||||
|
||||
public int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..15
|
||||
public double A1 { get { return tempMtrCfg.A1; } }
|
||||
public double A2 { get { return tempMtrCfg.A2; } }
|
||||
public double A3 { get { return tempMtrCfg.A3; } }
|
||||
public double A4 { get { return tempMtrCfg.A4; } }
|
||||
public double A5 { get { return tempMtrCfg.A5; } }
|
||||
|
||||
public TempMeter()
|
||||
{
|
||||
}
|
||||
|
||||
public TempMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
tempMtrCfg = cfg as TempMeterCfg;
|
||||
|
||||
ControlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
/// Prepare data for SendCalibData() control board component method
|
||||
ControlBoard.TempCalibData[Idx0, 0] = (float)A1;
|
||||
ControlBoard.TempCalibData[Idx0, 1] = (float)A2;
|
||||
ControlBoard.TempCalibData[Idx0, 2] = (float)A3;
|
||||
ControlBoard.TempCalibData[Idx0, 3] = (float)A4;
|
||||
ControlBoard.TempCalibData[Idx0, 4] = (float)A5;
|
||||
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
|
||||
public IList<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
DateTime calibrationDue = tempMtrCfg.CalibValidDate;
|
||||
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
|
||||
|
||||
if (calibrationDue > TBF.UI.Constants.MinDate)
|
||||
{
|
||||
/// Calibration due date calendar event
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
|
||||
if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
|
||||
{
|
||||
/// Weekly reminders (last 5 weeks)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
false));
|
||||
}
|
||||
if (DateTime.Now.Date <= calibrationDue.Date)
|
||||
{
|
||||
/// Daily reminders (last 5 days)
|
||||
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name,
|
||||
string.Format(Strings.Calibration_due_date_is_0,
|
||||
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
|
||||
true));
|
||||
}
|
||||
}
|
||||
return calendarEvents;
|
||||
}
|
||||
|
||||
public double ReadTemperature()
|
||||
{
|
||||
if (Cfg.DebugLevel == Config.Entities.DebugMode.Normal)
|
||||
{
|
||||
return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections);
|
||||
}
|
||||
else if (Cfg.DebugLevel == Config.Entities.DebugMode.Simulate)
|
||||
{
|
||||
return tempMtrCfg.DefaultTemperature;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: TempDone, Error
|
||||
/// </summary>
|
||||
/// <param name="temp">Reference to a variable for the temperature in Celsius</param>
|
||||
/// <returns>ReadTempOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadTempOp(ref DoubleBox temp)
|
||||
{
|
||||
return new ReadTempOp(this, ref temp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: tempDone, Error
|
||||
/// </summary>
|
||||
/// <param name="temp">Reference to a variable for the temperature in Celsius</param>
|
||||
/// <param name="tempDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadTempOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadTempOp(ref DoubleBox temp, Event tempDone)
|
||||
{
|
||||
return new ReadTempOp(this, ref temp, tempDone);
|
||||
}
|
||||
}
|
||||
}
|
||||
94
TBF/BenchControl/Modbus/TempMeter/Groch/TempMeterCfg.cs
Normal file
94
TBF/BenchControl/Modbus/TempMeter/Groch/TempMeterCfg.cs
Normal file
@ -0,0 +1,94 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Groch
|
||||
{
|
||||
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg, IDrawingItemWithMeasuredVal
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new TempMeterCfgCtrl(); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int Idx0; /// 0 .. 15
|
||||
public double A1;
|
||||
public double A2;
|
||||
public double A3;
|
||||
public double A4;
|
||||
public double A5;
|
||||
public double DefaultTemperature;
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
public string CalibCertificateNr { get; set; }
|
||||
public DateTime CalibDate { get; set; }
|
||||
public DateTime CalibValidDate { get; set; }
|
||||
|
||||
/// Schematic drawing info
|
||||
public SchematicDrawing.Shape Shape { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public Sz Sz { get; set; }
|
||||
public Orient Orient { get; set; }
|
||||
public bool Flip { get; set; }
|
||||
public int LblX { get; set; }
|
||||
public int LblY { get; set; }
|
||||
public Orient LblOrient { get; set; }
|
||||
public int MsrdX { get; set; }
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
public Config.Unit MsrdUnits { get; set; }
|
||||
public string MsrdFormat { get; set; }
|
||||
public double MsrdValLimLo { get; set; }
|
||||
public double MsrdValLimHi { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
TempMeterCfg()
|
||||
{
|
||||
GNodes = new List<GNode>();
|
||||
}
|
||||
|
||||
public TempMeterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Shape = Shape.TempM;
|
||||
Sz = Sz.M;
|
||||
MsrdUnits = Config.Unit.C;
|
||||
MsrdFormat = "{0:F1} °C";
|
||||
|
||||
Factory = factory;
|
||||
Name = "T";
|
||||
ParentName = "CB";
|
||||
Idx0 = 0;
|
||||
A1 = 0;
|
||||
A2 = 0;
|
||||
A3 = 0;
|
||||
A4 = 0;
|
||||
A5 = 0;
|
||||
DefaultTemperature = 20.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, Idx0={2}, A1={3}, A2={4}, A3={5}, A4={6}, A5={7}, Default={8}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
Idx0,
|
||||
A1, A2, A3, A4, A5, DefaultTemperature);
|
||||
}
|
||||
}
|
||||
}
|
||||
285
TBF/BenchControl/Modbus/TempMeter/Groch/TempMeterCfgCtrl.Designer.cs
generated
Normal file
285
TBF/BenchControl/Modbus/TempMeter/Groch/TempMeterCfgCtrl.Designer.cs
generated
Normal file
@ -0,0 +1,285 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Groch
|
||||
{
|
||||
partial class TempMeterCfgCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.positionTextBox = new System.Windows.Forms.TextBox();
|
||||
this.positionLabel = new System.Windows.Forms.Label();
|
||||
this.parentNameLabel = new System.Windows.Forms.Label();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.a1TextBox = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.a2TextBox = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.a3TextBox = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.a5TextBox = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.a4TextBox = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.defaultTempTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.importButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// positionTextBox
|
||||
//
|
||||
this.positionTextBox.Enabled = false;
|
||||
this.positionTextBox.Location = new System.Drawing.Point(130, 83);
|
||||
this.positionTextBox.Name = "positionTextBox";
|
||||
this.positionTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.positionTextBox.TabIndex = 6;
|
||||
//
|
||||
// positionLabel
|
||||
//
|
||||
this.positionLabel.AutoSize = true;
|
||||
this.positionLabel.Location = new System.Drawing.Point(20, 86);
|
||||
this.positionLabel.Name = "positionLabel";
|
||||
this.positionLabel.Size = new System.Drawing.Size(44, 13);
|
||||
this.positionLabel.TabIndex = 5;
|
||||
this.positionLabel.Text = "Position";
|
||||
//
|
||||
// parentNameLabel
|
||||
//
|
||||
this.parentNameLabel.AutoSize = true;
|
||||
this.parentNameLabel.Location = new System.Drawing.Point(20, 61);
|
||||
this.parentNameLabel.Name = "parentNameLabel";
|
||||
this.parentNameLabel.Size = new System.Drawing.Size(69, 13);
|
||||
this.parentNameLabel.TabIndex = 3;
|
||||
this.parentNameLabel.Text = "Parent Name";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(130, 34);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(20, 37);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(127, 10);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// a1TextBox
|
||||
//
|
||||
this.a1TextBox.Enabled = false;
|
||||
this.a1TextBox.Location = new System.Drawing.Point(130, 107);
|
||||
this.a1TextBox.Name = "a1TextBox";
|
||||
this.a1TextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.a1TextBox.TabIndex = 9;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(20, 110);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(20, 13);
|
||||
this.label1.TabIndex = 8;
|
||||
this.label1.Text = "A1";
|
||||
//
|
||||
// a2TextBox
|
||||
//
|
||||
this.a2TextBox.Enabled = false;
|
||||
this.a2TextBox.Location = new System.Drawing.Point(130, 128);
|
||||
this.a2TextBox.Name = "a2TextBox";
|
||||
this.a2TextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.a2TextBox.TabIndex = 11;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(20, 131);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(20, 13);
|
||||
this.label2.TabIndex = 10;
|
||||
this.label2.Text = "A2";
|
||||
//
|
||||
// a3TextBox
|
||||
//
|
||||
this.a3TextBox.Enabled = false;
|
||||
this.a3TextBox.Location = new System.Drawing.Point(130, 149);
|
||||
this.a3TextBox.Name = "a3TextBox";
|
||||
this.a3TextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.a3TextBox.TabIndex = 13;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(20, 152);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(20, 13);
|
||||
this.label3.TabIndex = 12;
|
||||
this.label3.Text = "A3";
|
||||
//
|
||||
// a5TextBox
|
||||
//
|
||||
this.a5TextBox.Enabled = false;
|
||||
this.a5TextBox.Location = new System.Drawing.Point(130, 191);
|
||||
this.a5TextBox.Name = "a5TextBox";
|
||||
this.a5TextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.a5TextBox.TabIndex = 17;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(20, 194);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(20, 13);
|
||||
this.label5.TabIndex = 16;
|
||||
this.label5.Text = "A5";
|
||||
//
|
||||
// a4TextBox
|
||||
//
|
||||
this.a4TextBox.Enabled = false;
|
||||
this.a4TextBox.Location = new System.Drawing.Point(130, 170);
|
||||
this.a4TextBox.Name = "a4TextBox";
|
||||
this.a4TextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.a4TextBox.TabIndex = 15;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(20, 173);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(20, 13);
|
||||
this.label4.TabIndex = 14;
|
||||
this.label4.Text = "A4";
|
||||
//
|
||||
// parentNameComboBox
|
||||
//
|
||||
this.parentNameComboBox.Enabled = false;
|
||||
this.parentNameComboBox.FormattingEnabled = true;
|
||||
this.parentNameComboBox.Location = new System.Drawing.Point(130, 58);
|
||||
this.parentNameComboBox.Name = "parentNameComboBox";
|
||||
this.parentNameComboBox.Size = new System.Drawing.Size(160, 21);
|
||||
this.parentNameComboBox.TabIndex = 4;
|
||||
//
|
||||
// defaultTempTextBox
|
||||
//
|
||||
this.defaultTempTextBox.Enabled = false;
|
||||
this.defaultTempTextBox.Location = new System.Drawing.Point(130, 217);
|
||||
this.defaultTempTextBox.Name = "defaultTempTextBox";
|
||||
this.defaultTempTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.defaultTempTextBox.TabIndex = 19;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(20, 220);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(100, 13);
|
||||
this.label6.TabIndex = 18;
|
||||
this.label6.Text = "Default temperature";
|
||||
//
|
||||
// importButton
|
||||
//
|
||||
this.importButton.Enabled = false;
|
||||
this.importButton.Location = new System.Drawing.Point(182, 81);
|
||||
this.importButton.Name = "importButton";
|
||||
this.importButton.Size = new System.Drawing.Size(108, 23);
|
||||
this.importButton.TabIndex = 7;
|
||||
this.importButton.Text = "Import A1 ... A5";
|
||||
this.importButton.UseVisualStyleBackColor = true;
|
||||
this.importButton.Click += new System.EventHandler(this.importButton_Click);
|
||||
//
|
||||
// TempMeterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.importButton);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.defaultTempTextBox);
|
||||
this.Controls.Add(this.parentNameComboBox);
|
||||
this.Controls.Add(this.a5TextBox);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.a4TextBox);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.a3TextBox);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.a2TextBox);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.a1TextBox);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.positionTextBox);
|
||||
this.Controls.Add(this.positionLabel);
|
||||
this.Controls.Add(this.parentNameLabel);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "TempMeterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(350, 240);
|
||||
this.Load += new System.EventHandler(this.TempMeterCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox positionTextBox;
|
||||
private System.Windows.Forms.Label positionLabel;
|
||||
private System.Windows.Forms.Label parentNameLabel;
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.TextBox a1TextBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox a2TextBox;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox a3TextBox;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox a5TextBox;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox a4TextBox;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.ComboBox parentNameComboBox;
|
||||
private System.Windows.Forms.TextBox defaultTempTextBox;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Button importButton;
|
||||
}
|
||||
}
|
||||
214
TBF/BenchControl/Modbus/TempMeter/Groch/TempMeterCfgCtrl.cs
Normal file
214
TBF/BenchControl/Modbus/TempMeter/Groch/TempMeterCfgCtrl.cs
Normal file
@ -0,0 +1,214 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.UI.Bench.Components;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Groch
|
||||
{
|
||||
public partial class TempMeterCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
static string lastImportFileName;
|
||||
|
||||
ComponentParametersDlg parent;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
TempMeterCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as TempMeterCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public TempMeterCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void TempMeterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
parent = ParentForm as ComponentParametersDlg;
|
||||
if (parent == null) return;
|
||||
|
||||
if (parent.CmpntEntities != null)
|
||||
{
|
||||
foreach (var cmpnt in parent.CmpntEntities)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
|
||||
positionTextBox.Text = config.Idx0.ToString();
|
||||
a1TextBox.Text = config.A1.ToString();
|
||||
a2TextBox.Text = config.A2.ToString();
|
||||
a3TextBox.Text = config.A3.ToString();
|
||||
a4TextBox.Text = config.A4.ToString();
|
||||
a5TextBox.Text = config.A5.ToString();
|
||||
defaultTempTextBox.Text = config.DefaultTemperature.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
parentNameComboBox.Enabled = true;
|
||||
positionTextBox.Enabled = true;
|
||||
importButton.Enabled = true;
|
||||
a1TextBox.Enabled = true;
|
||||
a2TextBox.Enabled = true;
|
||||
a3TextBox.Enabled = true;
|
||||
a4TextBox.Enabled = true;
|
||||
a5TextBox.Enabled = true;
|
||||
defaultTempTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
int dummy;
|
||||
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Parent Name'";
|
||||
}
|
||||
if (!int.TryParse(positionTextBox.Text, out dummy) || dummy < 0 || dummy > 15)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Position' should be between 0 and 15";
|
||||
}
|
||||
|
||||
double fdummy;
|
||||
if (!Utils.TryParseEDouble(a1TextBox.Text, out fdummy))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'A1' is not valid";
|
||||
}
|
||||
|
||||
if (!Utils.TryParseEDouble(a2TextBox.Text, out fdummy))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'A2' is not valid";
|
||||
}
|
||||
|
||||
if (!Utils.TryParseEDouble(a3TextBox.Text, out fdummy))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'A3' is not valid";
|
||||
}
|
||||
|
||||
if (!Utils.TryParseEDouble(a4TextBox.Text, out fdummy))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'A4' is not valid";
|
||||
}
|
||||
|
||||
if (!Utils.TryParseEDouble(a5TextBox.Text, out fdummy))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'A5' is not valid";
|
||||
}
|
||||
|
||||
if (!Utils.TryParseEDouble(defaultTempTextBox.Text, out fdummy))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Default temperature' is not valid";
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
|
||||
config.Idx0 = int.Parse(positionTextBox.Text);
|
||||
bool updateOk = Utils.TryParseEDouble(a1TextBox.Text, out config.A1) &&
|
||||
Utils.TryParseEDouble(a2TextBox.Text, out config.A2) &&
|
||||
Utils.TryParseEDouble(a3TextBox.Text, out config.A3) &&
|
||||
Utils.TryParseEDouble(a4TextBox.Text, out config.A4) &&
|
||||
Utils.TryParseEDouble(a5TextBox.Text, out config.A5) &&
|
||||
Utils.TryParseEDouble(defaultTempTextBox.Text, out config.DefaultTemperature);
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
private void importButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
if (!string.IsNullOrEmpty(lastImportFileName)) dlg.FileName = lastImportFileName;
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
using (TextReader reader = new StreamReader(dlg.FileName))
|
||||
{
|
||||
try
|
||||
{
|
||||
string startOfLine = string.Format("Calch{0} =", positionTextBox.Text);
|
||||
bool channelFound = false;
|
||||
string line;
|
||||
|
||||
do
|
||||
{
|
||||
line = reader.ReadLine();
|
||||
if (!string.IsNullOrEmpty(line) && (line.IndexOf(startOfLine) == 0))
|
||||
{
|
||||
string[] factors = line.Substring(startOfLine.Length).Split(new char[] { ',' });
|
||||
int count = factors.Length;
|
||||
double tmp;
|
||||
if (count >= 1 && Utils.TryParseEDouble(factors[0].Trim(), out tmp)) a1TextBox.Text = factors[0].Trim();
|
||||
if (count >= 2 && Utils.TryParseEDouble(factors[1].Trim(), out tmp)) a2TextBox.Text = factors[1].Trim();
|
||||
if (count >= 3 && Utils.TryParseEDouble(factors[2].Trim(), out tmp)) a3TextBox.Text = factors[2].Trim();
|
||||
if (count >= 4 && Utils.TryParseEDouble(factors[3].Trim(), out tmp)) a4TextBox.Text = factors[3].Trim();
|
||||
if (count >= 5 && Utils.TryParseEDouble(factors[4].Trim(), out tmp)) a5TextBox.Text = factors[4].Trim();
|
||||
channelFound = true;
|
||||
lastImportFileName = dlg.FileName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (line != null);
|
||||
|
||||
if (!channelFound)
|
||||
{
|
||||
MessageBox.Show(string.Format("Calibration factors for channel {0} not found.", positionTextBox.Text),
|
||||
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Wrong file format, import failed.",
|
||||
"Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,7 +4,7 @@
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Meret.TempMeter
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Meret
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
@ -5,7 +5,7 @@ using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Meret.TempMeter
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Meret
|
||||
{
|
||||
public class ReadTempOp : IOperation
|
||||
{
|
||||
@ -8,7 +8,7 @@ using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Meret.TempMeter
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Meret
|
||||
{
|
||||
public class TempMeter : ComponentBase, GenericDevices.ITempMeter, IDevice, IDrawingItCmpntWithMeasuredVal
|
||||
{
|
||||
@ -7,7 +7,7 @@ using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Meret.TempMeter
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Meret
|
||||
{
|
||||
public class TempMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg, IDrawingItemWithMeasuredVal
|
||||
{
|
||||
@ -7,7 +7,7 @@ using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.UI.Bench.Components;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Meret.TempMeter
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Meret
|
||||
{
|
||||
public partial class TempMeterCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
@ -1,7 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.Modbus.Meret.TempMeter
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Meret
|
||||
{
|
||||
partial class TempMeterCfgCtrl
|
||||
{
|
||||
@ -17,11 +17,11 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.RegisterReader
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new RegisterReader(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new RegisterReaderCfg(this); }
|
||||
public IComponentCfg DefaultConfig() { return new RRCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(RegisterReaderCfg.Serializer, component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(RRCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,12 +10,12 @@ using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.RegisterReaders.KPackE.RegisterReader
|
||||
{
|
||||
public class RegisterReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg
|
||||
public class RRCfg : ComponentCfgBase, Generic.IChildComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RegisterReaderCfg) })[0];
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RRCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new RegisterReaderCfgCtrl(); }
|
||||
public IComponentCfgCtrl GetControl() { return new RRCfgCtrl(); }
|
||||
|
||||
/// <summary> Procedure parameters </summary>
|
||||
[XmlIgnore]
|
||||
@ -24,14 +24,14 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.RegisterReader
|
||||
public override IParamsProvider CreateProcParamsProvider() { return new ProcedureParams(true); }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
RegisterReaderCfg()
|
||||
RRCfg()
|
||||
{
|
||||
Name = "RF-Register";
|
||||
ParentName = "Radio";
|
||||
ProcParams = new ProcedureParams(true);
|
||||
}
|
||||
|
||||
public RegisterReaderCfg(IComponentFactory factory)
|
||||
public RRCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
@ -9,24 +9,24 @@ using TBF.UI.Bench.Components;
|
||||
|
||||
namespace TBF.BenchControl.RegisterReaders.KPackE.RegisterReader
|
||||
{
|
||||
public partial class RegisterReaderCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
public partial class RRCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
ComponentParametersDlg parent;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
RegisterReaderCfg config;
|
||||
RRCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as RegisterReaderCfg;
|
||||
config = value as RRCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public RegisterReaderCfgCtrl()
|
||||
public RRCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
///
|
||||
namespace TBF.BenchControl.RegisterReaders.KPackE.RegisterReader
|
||||
{
|
||||
partial class RegisterReaderCfgCtrl
|
||||
partial class RRCfgCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -13,9 +13,9 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.RegisterReader
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(RegisterReader));
|
||||
public override string ToString() { return string.Format("KPackE.RegisterReader({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly RegisterReaderCfg registerReaderCfg;
|
||||
readonly RRCfg registerReaderCfg;
|
||||
readonly Radio.Radio radio;
|
||||
readonly TBF.BenchControl.ControlBoard.Legacy.ControlBoardDev controlBoard;
|
||||
readonly TBF.BenchControl.ControlBoard.Legacy.CBoard controlBoard;
|
||||
|
||||
|
||||
public int Position
|
||||
@ -84,13 +84,13 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.RegisterReader
|
||||
public RegisterReader(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
registerReaderCfg = cfg as RegisterReaderCfg;
|
||||
registerReaderCfg = cfg as RRCfg;
|
||||
|
||||
/// Control board is used to read reference flowmeter pulses
|
||||
radio = (Radio.Radio)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (radio == null) throw new Exception(string.Format("Cannot find a parent of {0}", Name));
|
||||
|
||||
controlBoard = StateMachine.ControlBoard as TBF.BenchControl.ControlBoard.Legacy.ControlBoardDev;
|
||||
controlBoard = StateMachine.ControlBoard as TBF.BenchControl.ControlBoard.Legacy.CBoard;
|
||||
if (controlBoard == null) throw new Exception("Missing ELDE control board");
|
||||
|
||||
Clear();
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
|
||||
namespace TBF.BenchControl.RegisterReaders.PulsesFromUniCB
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "RegisterReader"; } }
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public void ResetStaticProperties() { RegisterReader.ResetStaticProperties(); }
|
||||
@ -17,11 +17,11 @@ namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new RegisterReader(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new RegisterReaderCfg("Sick", this); }
|
||||
public IComponentCfg DefaultConfig() { return new RRCfg("Puls", this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(RegisterReaderCfg.Serializer, component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(RRCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,18 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
|
||||
namespace TBF.BenchControl.RegisterReaders.PulsesFromUniCB
|
||||
{
|
||||
public class RegisterReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg
|
||||
public class RRCfg : ComponentCfgBase, Generic.IChildComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RegisterReaderCfg) })[0];
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RRCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new RegisterReaderCfgCtrl(); }
|
||||
public IComponentCfgCtrl GetControl() { return new RRCfgCtrl(); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
@ -21,22 +21,22 @@ namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
|
||||
|
||||
/// <summary> Procedure parameters </summary>
|
||||
[XmlIgnore]
|
||||
public RRProcedureParams ProcParams;
|
||||
public RRProcParams ProcParams;
|
||||
public override IParamsProvider GetRuntimeProcParamsProvider() { return ProcParams; }
|
||||
public override IParamsProvider CreateProcParamsProvider() { return new RRProcedureParams(true); }
|
||||
public override IParamsProvider CreateProcParamsProvider() { return new RRProcParams(true); }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
RegisterReaderCfg()
|
||||
RRCfg()
|
||||
{
|
||||
ProcParams = new RRProcedureParams(true);
|
||||
ProcParams = new RRProcParams(true);
|
||||
}
|
||||
|
||||
public RegisterReaderCfg(string name, IComponentFactory factory)
|
||||
public RRCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = "CB";
|
||||
ParentName = "UniCB";
|
||||
Position = 1;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
@ -7,26 +7,26 @@ using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.UI.Bench.Components;
|
||||
|
||||
namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
|
||||
namespace TBF.BenchControl.RegisterReaders.PulsesFromUniCB
|
||||
{
|
||||
public partial class RegisterReaderCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
public partial class RRCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
ComponentParametersDlg parent;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
RegisterReaderCfg config;
|
||||
RRCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as RegisterReaderCfg;
|
||||
config = value as RRCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public RegisterReaderCfgCtrl()
|
||||
public RRCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
@ -40,7 +40,7 @@ namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
|
||||
{
|
||||
foreach (var cmpnt in parent.CmpntEntities)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Uni.Factory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
@ -1,9 +1,9 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
|
||||
namespace TBF.BenchControl.RegisterReaders.PulsesFromUniCB
|
||||
{
|
||||
partial class RegisterReaderCfgCtrl
|
||||
partial class RRCfgCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
@ -9,11 +9,11 @@ using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
|
||||
namespace TBF.BenchControl.RegisterReaders.PulsesFromUniCB
|
||||
{
|
||||
public class RRProcedureParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
|
||||
public class RRProcParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RRProcedureParams) })[0];
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RRProcParams) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public double PulsesPerLtr; /// [l^-1]
|
||||
@ -80,7 +80,7 @@ namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(RRProcedureParams prms)
|
||||
void CopyContentTo(RRProcParams prms)
|
||||
{
|
||||
prms.PulsesPerLtr = this.PulsesPerLtr;
|
||||
prms.Filter = this.Filter;
|
||||
@ -88,7 +88,7 @@ namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
|
||||
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
RRProcedureParams pars = new RRProcedureParams();
|
||||
RRProcParams pars = new RRProcParams();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
@ -98,7 +98,7 @@ namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
{
|
||||
RRProcedureParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as RRProcedureParams;
|
||||
RRProcParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as RRProcParams;
|
||||
|
||||
procedureParamsEntity = dbEntity;
|
||||
componentName = dbEntity.CmpntName;
|
||||
@ -112,16 +112,16 @@ namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
|
||||
}
|
||||
|
||||
|
||||
public RRProcedureParams()
|
||||
public RRProcParams()
|
||||
{
|
||||
}
|
||||
|
||||
public RRProcedureParams(bool initialize)
|
||||
public RRProcParams(bool initialize)
|
||||
{
|
||||
if (initialize) InitializeAll();
|
||||
}
|
||||
|
||||
public RRProcedureParams(ComponentProcedure procedureParamsEntity, string componentName, Procedure procedure)
|
||||
public RRProcParams(ComponentProcedure procedureParamsEntity, string componentName, Procedure procedure)
|
||||
{
|
||||
this.procedureParamsEntity = procedureParamsEntity;
|
||||
this.componentName = componentName;
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -7,14 +7,14 @@ using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
|
||||
namespace TBF.BenchControl.RegisterReaders.PulsesFromUniCB
|
||||
{
|
||||
public class RegisterReader : ComponentBase, GenericDevices.IRegReader, IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(RegisterReader));
|
||||
public override string ToString() { return string.Format("RegisterReader({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly RegisterReaderCfg registerReaderCfg;
|
||||
readonly RRCfg registerReaderCfg;
|
||||
|
||||
public int Position { get { return registerReaderCfg.Position; } } /// 1 .. Config.Data.WMsCount
|
||||
|
||||
@ -45,7 +45,7 @@ namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
|
||||
public RegisterReader(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
registerReaderCfg = cfg as RegisterReaderCfg;
|
||||
registerReaderCfg = cfg as RRCfg;
|
||||
|
||||
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as TBF.BenchControl.ControlBoard.IControlBoard;
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
@ -6,9 +6,9 @@ using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.RegisterReaders.StandingStartStop
|
||||
{
|
||||
public class RegisterReaderFactory : IComponentFactory
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "RegisterReader for standing start/stop"; } }
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public void ResetStaticProperties() { RegisterReader.ResetStaticProperties(); }
|
||||
@ -17,11 +17,11 @@ namespace TBF.BenchControl.RegisterReaders.StandingStartStop
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new RegisterReader(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new RegisterReaderCfg(this); }
|
||||
public IComponentCfg DefaultConfig() { return new RRCfg("Man", this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(RegisterReaderCfg.Serializer, component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(RRCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,31 +10,31 @@ using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.RegisterReaders.StandingStartStop
|
||||
{
|
||||
public class RegisterReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg
|
||||
public class RRCfg : ComponentCfgBase, Generic.IChildComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RegisterReaderCfg) })[0];
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RRCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new RegisterReaderCfgCtrl(); }
|
||||
public IComponentCfgCtrl GetControl() { return new RRCfgCtrl(); }
|
||||
|
||||
/// <summary> Procedure parameters </summary>
|
||||
[XmlIgnore]
|
||||
public RRProcedureParams ProcParams;
|
||||
public RRProcParams ProcParams;
|
||||
public override IParamsProvider GetRuntimeProcParamsProvider() { return ProcParams; }
|
||||
public override IParamsProvider CreateProcParamsProvider() { return new RRProcedureParams(true); }
|
||||
public override IParamsProvider CreateProcParamsProvider() { return new RRProcParams(true); }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
RegisterReaderCfg()
|
||||
RRCfg()
|
||||
{
|
||||
Name = "Dummy";
|
||||
ParentName = "CB";
|
||||
ProcParams = new RRProcedureParams(true);
|
||||
ProcParams = new RRProcParams(true);
|
||||
}
|
||||
|
||||
public RegisterReaderCfg(IComponentFactory factory)
|
||||
public RRCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = "UniCB";
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
@ -3,7 +3,7 @@
|
||||
///
|
||||
namespace TBF.BenchControl.RegisterReaders.StandingStartStop
|
||||
{
|
||||
partial class RegisterReaderCfgCtrl
|
||||
partial class RRCfgCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@ -9,24 +9,24 @@ using TBF.UI.Bench.Components;
|
||||
|
||||
namespace TBF.BenchControl.RegisterReaders.StandingStartStop
|
||||
{
|
||||
public partial class RegisterReaderCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
public partial class RRCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
ComponentParametersDlg parent;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
RegisterReaderCfg config;
|
||||
RRCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as RegisterReaderCfg;
|
||||
config = value as RRCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public RegisterReaderCfgCtrl()
|
||||
public RRCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
@ -40,7 +40,7 @@ namespace TBF.BenchControl.RegisterReaders.StandingStartStop
|
||||
{
|
||||
foreach (var cmpnt in parent.CmpntEntities)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Uni.Factory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
@ -11,9 +11,9 @@ using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.RegisterReaders.StandingStartStop
|
||||
{
|
||||
public class RRProcedureParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
|
||||
public class RRProcParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RRProcedureParams) })[0];
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RRProcParams) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public double PulsesPerLtr; /// Target low limit of the flow increase or decrease
|
||||
@ -69,14 +69,14 @@ namespace TBF.BenchControl.RegisterReaders.StandingStartStop
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(RRProcedureParams prms)
|
||||
void CopyContentTo(RRProcParams prms)
|
||||
{
|
||||
prms.PulsesPerLtr = this.PulsesPerLtr;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
RRProcedureParams pars = new RRProcedureParams();
|
||||
RRProcParams pars = new RRProcParams();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
@ -86,7 +86,7 @@ namespace TBF.BenchControl.RegisterReaders.StandingStartStop
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
{
|
||||
RRProcedureParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as RRProcedureParams;
|
||||
RRProcParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as RRProcParams;
|
||||
|
||||
procedureParamsEntity = dbEntity;
|
||||
componentName = dbEntity.CmpntName;
|
||||
@ -100,16 +100,16 @@ namespace TBF.BenchControl.RegisterReaders.StandingStartStop
|
||||
}
|
||||
|
||||
|
||||
public RRProcedureParams()
|
||||
public RRProcParams()
|
||||
{
|
||||
}
|
||||
|
||||
public RRProcedureParams(bool initialize)
|
||||
public RRProcParams(bool initialize)
|
||||
{
|
||||
if (initialize) InitializeAll();
|
||||
}
|
||||
|
||||
public RRProcedureParams(ComponentProcedure procedureParamsEntity, string componentName, Procedure procedure)
|
||||
public RRProcParams(ComponentProcedure procedureParamsEntity, string componentName, Procedure procedure)
|
||||
{
|
||||
this.procedureParamsEntity = procedureParamsEntity;
|
||||
this.componentName = componentName;
|
||||
@ -13,7 +13,7 @@ namespace TBF.BenchControl.RegisterReaders.StandingStartStop
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(RegisterReader));
|
||||
public override string ToString() { return string.Format("FixedStartRegisterReader({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly RegisterReaderCfg registerReaderCfg;
|
||||
readonly RRCfg registerReaderCfg;
|
||||
readonly ControlBoard.IControlBoard controlBoard;
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ namespace TBF.BenchControl.RegisterReaders.StandingStartStop
|
||||
public RegisterReader(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
registerReaderCfg = cfg as RegisterReaderCfg;
|
||||
registerReaderCfg = cfg as RRCfg;
|
||||
|
||||
/// Control board is used to read reference flowmeter pulses
|
||||
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as ControlBoard.IControlBoard;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user