ControlBoards, IControlBoard iface, Devices, test methods.
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dirichlet.Numerics;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Pump
|
||||
namespace TBF.BenchControl.BuiltIn.Pump
|
||||
{
|
||||
public class Pump : ComponentBase, GenericDevices.IPump, GenericDevices.IValve
|
||||
{
|
||||
@@ -27,7 +28,7 @@ namespace TBF.BenchControl.Elde.Pump
|
||||
public float Power { get { return State ? 100.0f : 0; } }
|
||||
|
||||
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly IControlBoard controlBoard;
|
||||
readonly int bitPosition; /// 0 .. 127
|
||||
|
||||
public readonly UInt128 Mask; /// derived from bitPosition in the constructor
|
||||
@@ -42,7 +43,7 @@ namespace TBF.BenchControl.Elde.Pump
|
||||
{
|
||||
pumpCfg = cfg as PumpCfg;
|
||||
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as IControlBoard;
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
bitPosition = pumpCfg.BitPosition;
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Pump
|
||||
namespace TBF.BenchControl.BuiltIn.Pump
|
||||
{
|
||||
public class PumpCfg : ComponentCfgBase, IChildComponentCfg
|
||||
{
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Elde.Pump
|
||||
namespace TBF.BenchControl.BuiltIn.Pump
|
||||
{
|
||||
partial class PumpCfgCtrl
|
||||
{
|
||||
+2
-2
@@ -6,7 +6,7 @@ using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Pump
|
||||
namespace TBF.BenchControl.BuiltIn.Pump
|
||||
{
|
||||
public partial class PumpCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
@@ -39,7 +39,7 @@ namespace TBF.BenchControl.Elde.Pump
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (cmpnt.ClassName.Contains("ControlBoard"))
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Pump
|
||||
namespace TBF.BenchControl.BuiltIn.Pump
|
||||
{
|
||||
public class PumpFactory : IComponentFactory
|
||||
{
|
||||
+5
-4
@@ -1,12 +1,13 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dirichlet.Numerics;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
|
||||
namespace TBF.BenchControl.Elde.PumpTandem
|
||||
namespace TBF.BenchControl.BuiltIn.PumpTandem
|
||||
{
|
||||
public class Pump : ComponentBase, GenericDevices.IPumpFM, GenericDevices.IValve, IOperation
|
||||
{
|
||||
@@ -61,12 +62,12 @@ namespace TBF.BenchControl.Elde.PumpTandem
|
||||
pumpFm1 = pump1 as GenericDevices.IPumpFM;
|
||||
pumpFm2 = pump2 as GenericDevices.IPumpFM;
|
||||
|
||||
if (pump1 is Elde.Pump.Pump) { mask1 = (pump1 as Elde.Pump.Pump).Mask; }
|
||||
if (pump1 is BuiltIn.Pump.Pump) { mask1 = (pump1 as BuiltIn.Pump.Pump).Mask; }
|
||||
else if (pump1 is Elde.PumpWithFM.Pump) { mask1 = (pump1 as Elde.PumpWithFM.Pump).Mask; }
|
||||
else if (pump1 is Danfoss.VLT2800.Pump) { mask1 = (pump1 as Danfoss.VLT2800.Pump).Mask; }
|
||||
else { mask1 = 0; }
|
||||
|
||||
if (pump2 is Elde.Pump.Pump) { mask2 = (pump2 as Elde.Pump.Pump).Mask; }
|
||||
if (pump2 is BuiltIn.Pump.Pump) { mask2 = (pump2 as BuiltIn.Pump.Pump).Mask; }
|
||||
else if (pump2 is Elde.PumpWithFM.Pump) { mask2 = (pump2 as Elde.PumpWithFM.Pump).Mask; }
|
||||
else if (pump2 is Danfoss.VLT2800.Pump) { mask2 = (pump2 as Danfoss.VLT2800.Pump).Mask; }
|
||||
else { mask2 = 0; }
|
||||
+1
-1
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.PumpTandem
|
||||
namespace TBF.BenchControl.BuiltIn.PumpTandem
|
||||
{
|
||||
public class PumpCfg : ComponentCfgBase, IChildComponentCfg
|
||||
{
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Elde.PumpTandem
|
||||
namespace TBF.BenchControl.BuiltIn.PumpTandem
|
||||
{
|
||||
partial class PumpCfgCtrl
|
||||
{
|
||||
+3
-3
@@ -6,7 +6,7 @@ using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.PumpTandem
|
||||
namespace TBF.BenchControl.BuiltIn.PumpTandem
|
||||
{
|
||||
public partial class PumpCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
@@ -39,10 +39,10 @@ namespace TBF.BenchControl.Elde.PumpTandem
|
||||
{
|
||||
foreach (var cmpnt in parentDlg.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.Pump.PumpFactory ||
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is BuiltIn.Pump.PumpFactory ||
|
||||
TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.PumpWithFM.PumpFactory ||
|
||||
TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Danfoss.VLT2800.PumpFactory ||
|
||||
TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.PumpTandem.PumpFactory)
|
||||
TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is BuiltIn.PumpTandem.PumpFactory)
|
||||
{
|
||||
pump1ComboBox.Items.Add(cmpnt.Name);
|
||||
pump2ComboBox.Items.Add(cmpnt.Name);
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.PumpTandem
|
||||
namespace TBF.BenchControl.BuiltIn.PumpTandem
|
||||
{
|
||||
public class PumpFactory : IComponentFactory
|
||||
{
|
||||
@@ -1,20 +1,21 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using Dirichlet.Numerics;
|
||||
using TBF.BenchControl.ControlBoard;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.BuiltIn
|
||||
{
|
||||
public class SetValvesOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(SetValvesOp));
|
||||
|
||||
/// Set by the constructor
|
||||
ControlBoardDev controlBoard;
|
||||
IControlBoard controlBoard;
|
||||
|
||||
class SwitchPoint
|
||||
{
|
||||
@@ -42,9 +43,9 @@ namespace TBF.BenchControl.Elde
|
||||
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 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 PumpWithFM.Pump && ((vlv as PumpWithFM.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 != null) && (vlv.Delay > max)) max = vlv.Delay;
|
||||
@@ -52,9 +53,9 @@ namespace TBF.BenchControl.Elde
|
||||
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 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 PumpWithFM.Pump && ((vlv as PumpWithFM.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 != null) && (vlv.Delay > max)) max = vlv.Delay;
|
||||
@@ -135,8 +136,8 @@ namespace TBF.BenchControl.Elde
|
||||
}
|
||||
else
|
||||
{
|
||||
lastAdded.VOpen = ValveBase.Merge(lastAdded.VOpen, first.VOpen);
|
||||
lastAdded.VClose = ValveBase.Merge(lastAdded.VClose, first.VClose);
|
||||
lastAdded.VOpen = ValveBase.Merge(lastAdded.VOpen, first.VOpen);
|
||||
lastAdded.VClose = ValveBase.Merge(lastAdded.VClose, first.VClose);
|
||||
}
|
||||
unsorted.Remove(first);
|
||||
}
|
||||
@@ -152,20 +153,20 @@ namespace TBF.BenchControl.Elde
|
||||
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 PumpWithFM.Pump) point.MasksOpen |= (valve as PumpWithFM.Pump).Mask;
|
||||
if (valve is Danfoss.VLT2800.Pump) point.MasksOpen |= (valve as Danfoss.VLT2800.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 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 PumpWithFM.Pump) point.MasksClose |= (valve as PumpWithFM.Pump).Mask;
|
||||
if (valve is Danfoss.VLT2800.Pump) point.MasksClose |= (valve as Danfoss.VLT2800.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 PumpTandem.Pump) point.MasksClose |= (valve as PumpTandem.Pump).Mask;
|
||||
}
|
||||
point.TimeSec += timeShift;
|
||||
}
|
||||
@@ -176,14 +177,14 @@ namespace TBF.BenchControl.Elde
|
||||
/// Open and/or close multiple valves.
|
||||
/// Events: ValvesSet
|
||||
/// </summary>
|
||||
/// <param name="controlBoard">Control board device</param>
|
||||
/// <param name="cb">Control board device</param>
|
||||
/// <param name="valvesOpen">A list of opening master valves</param>
|
||||
/// <param name="valvesClose">A list of closing master valves</param>
|
||||
/// <remarks>Only Elde.Valve valves are used, other valves on the lists are ignored</remarks>
|
||||
public SetValvesOp(ControlBoardDev controlBoard, IList<IValve> valvesOpen, IList<IValve> valvesClose)
|
||||
public SetValvesOp(IControlBoard cb, IList<IValve> valvesOpen, IList<IValve> valvesClose)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
controlBoard = cb;
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
|
||||
if (valvesOpen == null) valvesOpen = new List<IValve>();
|
||||
if (valvesClose == null) valvesClose = new List<IValve>();
|
||||
@@ -199,12 +200,12 @@ namespace TBF.BenchControl.Elde
|
||||
/// Open one valve and/or close one valve.
|
||||
/// Events: ValvesSet
|
||||
/// </summary>
|
||||
/// <param name="controlBoard">Control board device</param>
|
||||
/// <param name="cb">Control board device</param>
|
||||
/// <param name="valveOpen">Valve to be opened</param>
|
||||
/// <param name="valveClose">Valve to be closed</param>
|
||||
/// <remarks>Only Elde.Valve valves are used, other valves on the lists are ignored</remarks>
|
||||
public SetValvesOp(ControlBoardDev controlBoard, IValve valveOpen, IValve valveClose)
|
||||
: this(controlBoard, ValveBase.MakeList(valveOpen), ValveBase.MakeList(valveClose))
|
||||
public SetValvesOp(IControlBoard cb, IValve valveOpen, IValve valveClose)
|
||||
: this(cb, ValveBase.MakeList(valveOpen), ValveBase.MakeList(valveClose))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -213,49 +214,61 @@ namespace TBF.BenchControl.Elde
|
||||
/// Events: ValvesSet
|
||||
/// </summary>
|
||||
/// <param name="controlBoard">Control board device</param>
|
||||
/// <param name="close">true: close start valve, false: open start valve</param>
|
||||
/// <param name="open">true: open start valve, false: close start valve</param>
|
||||
/// <param name="outPath">OutputPath specifying the start valve and associated valves/pumps</param>
|
||||
/// <remarks>Only Elde.Valve valves are used, other valves on the lists are ignored</remarks>
|
||||
public SetValvesOp(ControlBoardDev controlBoard, bool close, OutputPath outPath)
|
||||
public SetValvesOp(IControlBoard cb, bool open, OutputPath outPath)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
controlBoard = cb;
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
|
||||
IList<IValve> none = new List<IValve>(); /// An empty list of valves
|
||||
switchPointsRaw = new List<SwitchPoint>();
|
||||
|
||||
if (close)
|
||||
if (open)
|
||||
{
|
||||
if (outPath.InvertSV1) AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve1), none, 0);
|
||||
else AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve1), 0);
|
||||
if (outPath.InvertSV1)
|
||||
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve1), 0); /// close SV1
|
||||
else
|
||||
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve1), none, 0); /// open SV1
|
||||
|
||||
if (outPath.StartValve2 != null)
|
||||
{
|
||||
if (outPath.InvertSV2) AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve2), none, outPath.LagSV2);
|
||||
else AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve2), outPath.LagSV2);
|
||||
if (outPath.InvertSV2)
|
||||
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve2), -outPath.LagSV2); /// close SV2 after lag
|
||||
else
|
||||
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve2), none, -outPath.LagSV2); /// open SV2 after lag
|
||||
}
|
||||
|
||||
if (outPath.StartValve3 != null)
|
||||
{
|
||||
if (outPath.InvertSV3) AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve3), none, outPath.LagSV3);
|
||||
else AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve3), outPath.LagSV3);
|
||||
if (outPath.InvertSV3)
|
||||
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve3), -outPath.LagSV3); /// close SV3 after lag
|
||||
else
|
||||
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve3), none, -outPath.LagSV3); /// open SV3 after lag
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (outPath.InvertSV1) AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve1), 0);
|
||||
else AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve1), none, 0);
|
||||
if (outPath.InvertSV1)
|
||||
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve1), none, 0); /// open SV1
|
||||
else
|
||||
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve1), 0); /// close SV1
|
||||
|
||||
if (outPath.StartValve2 != null)
|
||||
{
|
||||
if (outPath.InvertSV2) AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve2), -outPath.LagSV2);
|
||||
else AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve2), none, -outPath.LagSV2);
|
||||
if (outPath.InvertSV2)
|
||||
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve2), none, outPath.LagSV2); /// open SV2 after lag
|
||||
else
|
||||
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve2), outPath.LagSV2); /// close SV2 after lag
|
||||
}
|
||||
|
||||
if (outPath.StartValve3 != null)
|
||||
{
|
||||
if (outPath.InvertSV3) AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve3), -outPath.LagSV3);
|
||||
else AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve3), none, -outPath.LagSV3);
|
||||
if (outPath.InvertSV3)
|
||||
AddSwitchPoints(switchPointsRaw, ValveBase.MakeList(outPath.StartValve3), none, outPath.LagSV3); /// open SV3 after lag
|
||||
else
|
||||
AddSwitchPoints(switchPointsRaw, none, ValveBase.MakeList(outPath.StartValve3), outPath.LagSV3); /// close SV3 after lag
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,8 +294,7 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
if (nextIx >= switchPoints.Count)
|
||||
{
|
||||
if (StateMachine.Time >= swStartTime + maxDelayTime) return Event.ValvesSet;
|
||||
else return Event.ValvesBusy;
|
||||
return (StateMachine.Time >= swStartTime + maxDelayTime) ? Event.ValvesSet : Event.ValvesBusy;
|
||||
}
|
||||
|
||||
if (StateMachine.Time >= swStartTime + switchPoints[nextIx].TimeSec)
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,16 +7,16 @@ using Dirichlet.Numerics;
|
||||
using log4net;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Valve
|
||||
namespace TBF.BenchControl.BuiltIn.Valve
|
||||
{
|
||||
public class Valve : GenericDevices.ValveBase, IValve
|
||||
public class Valve : ValveBase, IValve
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Valve));
|
||||
public override string ToString() { return string.Format("Valve({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly ValveCfg valveCfg;
|
||||
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly TBF.BenchControl.ControlBoard.IControlBoard controlBoard;
|
||||
|
||||
public ValveCategory Category { get { return valveCfg.Category; } }
|
||||
public int Delay { get { return valveCfg.OpenCloseTime; } }
|
||||
@@ -43,7 +43,7 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
{
|
||||
valveCfg = cfg as ValveCfg;
|
||||
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as TBF.BenchControl.ControlBoard.IControlBoard;
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
if (valveCfg.BitPosition < 0 || valveCfg.BitPosition >= 128)
|
||||
+1
-1
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Valve
|
||||
namespace TBF.BenchControl.BuiltIn.Valve
|
||||
{
|
||||
public class ValveCfg : ComponentCfgBase, IChildComponentCfg
|
||||
{
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Elde.Valve
|
||||
namespace TBF.BenchControl.BuiltIn.Valve
|
||||
{
|
||||
partial class ValveCfgCtrl
|
||||
{
|
||||
+4
-4
@@ -6,7 +6,7 @@ using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Valve
|
||||
namespace TBF.BenchControl.BuiltIn.Valve
|
||||
{
|
||||
public partial class ValveCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
@@ -47,11 +47,11 @@ namespace TBF.BenchControl.Elde.Valve
|
||||
coupledToComboBox.Items.Add("---");
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
{
|
||||
if (cmpnt.ClassName.Contains("ControlBoard"))
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.Valve.ValveFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is BuiltIn.Valve.ValveFactory)
|
||||
{
|
||||
coupledToComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Valve
|
||||
namespace TBF.BenchControl.BuiltIn.Valve
|
||||
{
|
||||
public class ValveFactory : IComponentFactory
|
||||
{
|
||||
+6
-5
@@ -3,8 +3,9 @@
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
namespace TBF.BenchControl.BuiltIn
|
||||
{
|
||||
public class ValveBase : ComponentBase
|
||||
{
|
||||
@@ -32,7 +33,7 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// <summary>
|
||||
/// Process the list of components and return masters valves
|
||||
/// </summary>
|
||||
public static IList<IValve> MasterValves(IList<Generic.IComponent> cmpnts)
|
||||
public static IList<IValve> GetMasterValves(IList<Generic.IComponent> cmpnts)
|
||||
{
|
||||
IList<IValve> result = new List<IValve>();
|
||||
foreach (var cmpnt in cmpnts)
|
||||
@@ -60,12 +61,12 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// <summary>
|
||||
/// Process the list of components and return extended valves
|
||||
/// </summary>
|
||||
public static IList<Elde.ValveEx.Valve> ExtendedValves(IList<Generic.IComponent> cmpnts)
|
||||
public static IList<BuiltIn.ValveEx.Valve> ExtendedValves(IList<Generic.IComponent> cmpnts)
|
||||
{
|
||||
IList<Elde.ValveEx.Valve> result = new List<Elde.ValveEx.Valve>();
|
||||
IList<BuiltIn.ValveEx.Valve> result = new List<BuiltIn.ValveEx.Valve>();
|
||||
foreach (var cmpnt in cmpnts)
|
||||
{
|
||||
if (cmpnt is Elde.ValveEx.Valve) result.Add(cmpnt as Elde.ValveEx.Valve);
|
||||
if (cmpnt is BuiltIn.ValveEx.Valve) result.Add(cmpnt as BuiltIn.ValveEx.Valve);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -7,7 +7,7 @@ using log4net;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using Dirichlet.Numerics;
|
||||
|
||||
namespace TBF.BenchControl.Elde.ValveEx
|
||||
namespace TBF.BenchControl.BuiltIn.ValveEx
|
||||
{
|
||||
public class Valve : ComponentBase, Generic.IComponent
|
||||
{
|
||||
@@ -16,7 +16,7 @@ namespace TBF.BenchControl.Elde.ValveEx
|
||||
|
||||
readonly ValveCfg valveCfg;
|
||||
|
||||
public readonly UInt128 Mask; /// derived from bitPosition in the constructor
|
||||
public readonly UInt128 Mask; /// derived from bitPosition in the constructor
|
||||
///
|
||||
public readonly IValve[] InputValves;
|
||||
|
||||
@@ -41,12 +41,18 @@ namespace TBF.BenchControl.Elde.ValveEx
|
||||
InputValves = new IValve[valveCfg.InputValvesCount];
|
||||
InputValves[0] = TbfComponents.FindComponent(valveCfg.Input1, components) as IValve;
|
||||
InputValves[1] = TbfComponents.FindComponent(valveCfg.Input2, components) as IValve;
|
||||
if (InputValves.Length > 2)
|
||||
InputValves[2] = TbfComponents.FindComponent(valveCfg.Input3, components) as IValve;
|
||||
if (InputValves.Length > 3)
|
||||
InputValves[3] = TbfComponents.FindComponent(valveCfg.Input4, components) as IValve;
|
||||
if (InputValves.Length > 4)
|
||||
InputValves[4] = TbfComponents.FindComponent(valveCfg.Input5, components) as IValve;
|
||||
if (InputValves.Length > 2)
|
||||
{
|
||||
InputValves[2] = TbfComponents.FindComponent(valveCfg.Input3, components) as IValve;
|
||||
}
|
||||
if (InputValves.Length > 3)
|
||||
{
|
||||
InputValves[3] = TbfComponents.FindComponent(valveCfg.Input4, components) as IValve;
|
||||
}
|
||||
if (InputValves.Length > 4)
|
||||
{
|
||||
InputValves[4] = TbfComponents.FindComponent(valveCfg.Input5, components) as IValve;
|
||||
}
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.ValveEx
|
||||
namespace TBF.BenchControl.BuiltIn.ValveEx
|
||||
{
|
||||
public class ValveCfg : ComponentCfgBase, IComponentCfg
|
||||
{
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Elde.ValveEx
|
||||
namespace TBF.BenchControl.BuiltIn.ValveEx
|
||||
{
|
||||
partial class ValveCfgCtrl
|
||||
{
|
||||
+1
-1
@@ -7,7 +7,7 @@ using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.ValveEx
|
||||
namespace TBF.BenchControl.BuiltIn.ValveEx
|
||||
{
|
||||
public partial class ValveCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.ValveEx
|
||||
namespace TBF.BenchControl.BuiltIn.ValveEx
|
||||
{
|
||||
public class ValveFactory : IComponentFactory
|
||||
{
|
||||
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Config.Entities;
|
||||
using Dirichlet.Numerics;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.ControlBoard
|
||||
{
|
||||
public interface IControlBoard : IDevice, IValveControl
|
||||
{
|
||||
void InitializeComponent(object thirdPartyComponent, UInt128 valvesToInvert, double[] tankCapacities);
|
||||
|
||||
/// <summary>
|
||||
/// Display value in a third party component, update UI
|
||||
/// </summary>
|
||||
/// <param name="sParam">String parameter</param>
|
||||
/// <param name="iParam">Integer parameter</param>
|
||||
/// <param name="value">Value to be displayed</param>
|
||||
void UpdateUI(string sParam, int iParam, double value);
|
||||
|
||||
/// <summary>
|
||||
/// Called on beginning of a test
|
||||
/// </summary>
|
||||
void ClearProcessValues();
|
||||
|
||||
|
||||
///
|
||||
/// Values valid always
|
||||
///
|
||||
UInt128 Route { get; } /// State of valves
|
||||
UInt64 DigitalInputs { get; } /// Inputs
|
||||
|
||||
///
|
||||
/// Values valid during a test
|
||||
///
|
||||
double RefFrequency { get; }
|
||||
double RefFlow { get; }
|
||||
|
||||
///
|
||||
/// Last test results
|
||||
///
|
||||
double TestTime { get; }
|
||||
int RefPulses { get; }
|
||||
|
||||
double TestTimeWM(int wmNr1);
|
||||
int RefPulsesWM(int wmNr1);
|
||||
int PulsesWM(int wmNr1);
|
||||
|
||||
float ValveOpenCloseTime { get; } /// Start valve open or close time in sec
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Select devices used for control and measurement
|
||||
/// </summary>
|
||||
/// <param name="outPath"></param>
|
||||
OutputPath Devices { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns operation which sets the flow. Events:
|
||||
/// </summary>
|
||||
/// <param name="flowLimLo">Lower flow limit</param>
|
||||
/// <param name="flowLimHi">Upper flow limit</param>
|
||||
/// <param name="measuredFlow">Reference to calss keeping current flow value</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <returns>Operation</returns>
|
||||
IOperation SetFlowOp(double flowLimLo, double flowLimHi, TBF.Boxes.DoubleBox measuredFlow, int timeout);
|
||||
|
||||
IOperation StopFlowRegulationOp();
|
||||
|
||||
/// <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>
|
||||
IOperation StartTestOp(Test test, int iParam = 0, double dParam1 = 0, double dParam2 = 0);
|
||||
|
||||
IOperation ReadDiverterTransitionOp(bool isStart, Sequences.Statistics plotter, int batchNr, string testName, int repetition);
|
||||
|
||||
/// <summary>
|
||||
/// Returns operation with events: Event.MeasurementCompleted or Event.None
|
||||
/// </summary>
|
||||
/// <returns>Operation</returns>
|
||||
IOperation QueryMeasurementEndOp();
|
||||
|
||||
IOperation StopPreviousOp();
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public enum Command
|
||||
{
|
||||
+1
-1
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public class ControlBoardCfg : ComponentCfgBase, IComponentCfg
|
||||
{
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
partial class ControlBoardCfgCtrl
|
||||
{
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public partial class ControlBoardCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
+216
-62
@@ -1,19 +1,19 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.IO.Ports;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using Dirichlet.Numerics;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public class ControlBoardDev : ComponentBase, IDevice, IValveControl
|
||||
public class ControlBoardDev : ComponentBase, IControlBoard
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ControlBoardDev));
|
||||
public override string ToString() { return string.Format("ControlBoard({0})", Cfg.ToString(1)); }
|
||||
@@ -43,11 +43,9 @@ namespace TBF.BenchControl.Elde
|
||||
/// prsNr0 = 0 .. nrPressureMeters-1 (zero based)
|
||||
///
|
||||
public StatusP StatusP { get { return controlCom.StatusP; } }
|
||||
public int EtPulses(int wmNr1) { return controlCom.EtPulses(wmNr1); }
|
||||
public int EtPulsesK { get { return controlCom.EtPulsesK; } }
|
||||
public int EtPulses2 { get { return controlCom.EtPulses2; } } /// DEWA_300: pulses from I12
|
||||
public int EtPulses3 { get { return controlCom.EtPulses3; } } /// DEWA_300: pulses from I13
|
||||
public UInt16 WMeterPulses(int wmNr1) { return controlCom.WMeterPulses(wmNr1); }
|
||||
public int WMeterReference(int wmNr0) { return controlCom.WMeterReference(wmNr0); }
|
||||
public uint RegulValveDAC(int rvNr0) { return controlCom.RegulValveDAC(rvNr0); }
|
||||
public float Pressure(int prsNr0) { return controlCom.Pressure(prsNr0); }
|
||||
@@ -55,13 +53,11 @@ namespace TBF.BenchControl.Elde
|
||||
public RegulValveState RegulValveState(int rvNr1) { return (RegulValveState)controlCom.RegulValveState(rvNr1); }
|
||||
public UInt128 RRoute { get { return controlCom.RRoute; } }
|
||||
public uint DivTime(int id) { return controlCom.DivTime(id); }
|
||||
public float TTime { get { return controlCom.TTime; } }
|
||||
public float ImpulseTime(int wmNr1) { return controlCom.ImpulseTime(wmNr1); }
|
||||
public uint FmState { get { return controlCom.FmState; } }
|
||||
public uint BeginState(int wmNr0) { return controlCom.BeginState(wmNr0); }
|
||||
public double ReferenceFreq { get { return controlCom.ReferenceFreq; } } /// In [Hz] 0..2500, nom.=2000
|
||||
public double RefFrequency { get { return controlCom.ReferenceFreq; } } /// In [Hz] 0..2500, nom.=2000
|
||||
public double ReferenceFreqs(int i) { return controlCom.ReferenceFreqs(i); }
|
||||
public double ReferenceFlow { get { return controlCom.ReferenceFlow; } }
|
||||
public double RefFlow { get { return controlCom.ReferenceFlow; } }
|
||||
public float RValvePosition(int rvNr1) { return controlCom.RValvePosition(rvNr1); }
|
||||
public float DivSamples(int time, int divIx0) { return controlCom.DivSamples(time, divIx0); } /// Time unit is 2 ms
|
||||
public int ScopeSamples(int i, int j, int k) { return controlCom.ScopeSamples(i, j, k); }
|
||||
@@ -81,6 +77,16 @@ namespace TBF.BenchControl.Elde
|
||||
bool previousEmergencyStop;
|
||||
|
||||
|
||||
///
|
||||
/// IControlBoard interface
|
||||
///
|
||||
public int RefPulses { get { return controlCom.EtPulses(0); } }
|
||||
public double TestTime { get { return (double)controlCom.TTime; } }
|
||||
public int RefPulsesWM(int wmNr1) { return (wmNr1 > 0 && wmNr1 <= Config.Data.WMsCount) ? controlCom.EtPulses(wmNr1) : 0; }
|
||||
public int PulsesWM(int wmNr1) { return (wmNr1 > 0 && wmNr1 <= Config.Data.WMsCount) ? unwrappedWMPulses[wmNr1] : 0; }
|
||||
public double TestTimeWM(int wmNr1) { return (wmNr1 > 0 && wmNr1 <= Config.Data.WMsCount) ? (double)controlCom.ImpulseTime(wmNr1) : 0; }
|
||||
|
||||
|
||||
public void DiverterToTank(int flowMtrNr)
|
||||
{
|
||||
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Start, flowMtrNr, int.MaxValue, int.MaxValue, TestMethods.Diverter | TestMethods.Synchro, StopDevs.None));
|
||||
@@ -169,12 +175,53 @@ namespace TBF.BenchControl.Elde
|
||||
UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
|
||||
readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
|
||||
|
||||
|
||||
public OutputPath Devices
|
||||
{
|
||||
set { devices = value; }
|
||||
get { return devices; }
|
||||
}
|
||||
OutputPath devices;
|
||||
|
||||
|
||||
int[] filters;
|
||||
float[] FMFreq;
|
||||
int regConst;
|
||||
int shortImp;
|
||||
|
||||
|
||||
private int[] unwrappedWMPulses; /// Initialized to zeros
|
||||
///
|
||||
private void UnwrapPulses()
|
||||
{
|
||||
for (int i = 1; i <= Config.Data.WMsCount; i++)
|
||||
{
|
||||
UInt16 lowerWord = controlCom.WMeterPulses(i);
|
||||
int uncorrected = (int)(((uint)unwrappedWMPulses[i] & 0xFFFF0000) | lowerWord);
|
||||
if (Math.Abs(uncorrected - unwrappedWMPulses[i]) <= Int16.MaxValue)
|
||||
{
|
||||
unwrappedWMPulses[i] = uncorrected;
|
||||
}
|
||||
else if (Math.Abs(uncorrected + 65536 - unwrappedWMPulses[i]) <= Int16.MaxValue)
|
||||
{
|
||||
unwrappedWMPulses[i] = uncorrected + 65536;
|
||||
}
|
||||
else if (Math.Abs(uncorrected - 65536 - unwrappedWMPulses[i]) <= Int16.MaxValue)
|
||||
{
|
||||
unwrappedWMPulses[i] = uncorrected - 65536;
|
||||
}
|
||||
}
|
||||
}
|
||||
///
|
||||
public void ClearProcessValues()
|
||||
{
|
||||
for (int i = 1; i <= Config.Data.WMsCount; i++)
|
||||
{
|
||||
unwrappedWMPulses[i] = 0;
|
||||
}
|
||||
UnwrapPulses();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set values to be applied during a test
|
||||
@@ -266,9 +313,19 @@ namespace TBF.BenchControl.Elde
|
||||
}
|
||||
|
||||
|
||||
public void SetReservoirTemp(int nr, float temp)
|
||||
/// <summary>
|
||||
/// Display value in ELDE component, update UI
|
||||
/// </summary>
|
||||
/// <param name="sParam">String parameter</param>
|
||||
/// <param name="iParam">Integer parameter</param>
|
||||
/// <param name="value">Value to be displayed</param>
|
||||
public void UpdateUI(string sParam, int iParam, double value)
|
||||
{
|
||||
controlCom.SetReservoirTemp(nr, temp);
|
||||
if (sParam == "ReservoirTemp")
|
||||
{
|
||||
controlCom.SetReservoirTemp(iParam, (float)value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public ControlBoardDev()
|
||||
@@ -283,6 +340,9 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
controlBoardCfg = cfg as ControlBoardCfg;
|
||||
|
||||
/// Buffers used in UnwrapPulses() and PulsesWM(wmNr1)
|
||||
unwrappedWMPulses = new int[Config.Data.WMsCount + 1];
|
||||
|
||||
cbCommandQueue = new Queue<SendCommandArgs>();
|
||||
lastSentFilters = new uint[FiltersCount];
|
||||
|
||||
@@ -311,21 +371,8 @@ namespace TBF.BenchControl.Elde
|
||||
/// <summary>
|
||||
/// Specific pre-initialization for control board only
|
||||
/// </summary>
|
||||
/// <param name="ctrlBrdComponent"></param>
|
||||
public void InitializeComponent(
|
||||
#if DN100
|
||||
ControlCom2VB.ControlCom2panel ctrlBrdComponent,
|
||||
#elif MUNICH || FUZHOU_150
|
||||
ControlComponent3Munich.UserControl1 ctrlBrdComponent,
|
||||
#elif FUZHOU_300
|
||||
ControlComponent3F300.UserControl1 ctrlBrdComponent,
|
||||
#elif IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN || GELSENWASSER || SLM_150 || PETERSBURG_200
|
||||
ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent,
|
||||
#else /// all newer benches
|
||||
ControlComponent_Torino2015.UserControl1 ctrlBrdComponent,
|
||||
#endif
|
||||
UInt128 valvesToInvert,
|
||||
double[] tankCapacities)
|
||||
/// <param name="eldeComponent"></param>
|
||||
public void InitializeComponent(object eldeComponent, UInt128 valvesToInvert, double[] tankCapacities)
|
||||
{
|
||||
this.valvesToInvert = valvesToInvert;
|
||||
this.benchModelRoute = valvesToInvert;
|
||||
@@ -336,7 +383,9 @@ namespace TBF.BenchControl.Elde
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Default number of scales (and BalanceRange length) is 2.
|
||||
controlCom = new ControlComWrap(eldeComponent);
|
||||
|
||||
/// Default number of scales (and BalanceRange length) is 2.
|
||||
/// If there are more scales, BalanceRange length is larger.
|
||||
int scalesCnt = Math.Max(2, tankCapacities.Length);
|
||||
BalanceRange = new uint[scalesCnt];
|
||||
@@ -344,7 +393,6 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
BalanceRange[i] = (uint)((i < tankCapacities.Length) ? tankCapacities[i] : 0);
|
||||
}
|
||||
controlCom = new ControlComWrap(ctrlBrdComponent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +428,8 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
if (DebugLevel == DebugMode.Simulate) return;
|
||||
controlCom.RunDeviceBefore();
|
||||
}
|
||||
UnwrapPulses();
|
||||
}
|
||||
|
||||
///
|
||||
/// Used in RunDeviceAfter() when sending commands
|
||||
@@ -532,7 +581,7 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="valvesToOpen">'ulong' with bits of valves to open set to '1'</param>
|
||||
/// <param name="valvesToClose">'ulong' with bits of valves to close set to '1'</param>
|
||||
/// <returns>'ulong' with bits of valves that have changed set to '1'</returns>
|
||||
public UInt128 SetValves(UInt128 valvesToOpen, UInt128 valvesToClose, IList<Elde.ValveEx.Valve> extendedValves)
|
||||
public UInt128 SetValves(UInt128 valvesToOpen, UInt128 valvesToClose, IList<TBF.BenchControl.BuiltIn.ValveEx.Valve> extendedValves)
|
||||
{
|
||||
UInt128 oldRoute = benchModelRoute;
|
||||
benchModelRoute = (((benchModelRoute ^ valvesToInvert) | valvesToOpen) & (~valvesToClose)) ^ valvesToInvert;
|
||||
@@ -575,7 +624,7 @@ namespace TBF.BenchControl.Elde
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation SetValvesOp(IValve valveOpen, IValve valveClose)
|
||||
{
|
||||
return new SetValvesOp(this, valveOpen, valveClose);
|
||||
return new BuiltIn.SetValvesOp(this, valveOpen, valveClose);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -587,28 +636,138 @@ namespace TBF.BenchControl.Elde
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation SetValvesOp(IList<IValve> valvesOpen, IList<IValve> valvesClose)
|
||||
{
|
||||
return new SetValvesOp(this, valvesOpen, valvesClose);
|
||||
return new BuiltIn.SetValvesOp(this, valvesOpen, valvesClose);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the measurement.
|
||||
/// Events: MeasurementStarted
|
||||
/// Open start/stop valve.
|
||||
/// Events: ValvesSet, ValvesBusy, Error
|
||||
/// </summary>
|
||||
/// <param name="flowMeter">Flow meter</param>
|
||||
/// <param name="readers">An array of register readers</param>
|
||||
/// <param name="refPulses">Number of reference pulses to complete the test</param>
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation StartMeasurementOp(OutputPath outputPath, TestMethods method,
|
||||
double requiredFlowLo, double requiredFlowHi, int refPulses)
|
||||
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 IOperation SetFlowOp(double reqrdFlowLo, double reqrdFlowHi, TBF.Boxes.DoubleBox measuredFlow, int timeout)
|
||||
{
|
||||
if (Devices.RegulValve == null || Devices.FlowMeter == null) return null;
|
||||
|
||||
return Devices.RegulValve.SetFlowOp(Devices.FlowMeter, reqrdFlowLo, reqrdFlowHi, measuredFlow, timeout);
|
||||
}
|
||||
|
||||
|
||||
/// <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)
|
||||
{
|
||||
if (controlBoardCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
return new Operations.ReturnGivenEventOp(Event.MeasurementStarted);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new StartMeasurementOp(this, outputPath, method, requiredFlowLo, requiredFlowHi, refPulses);
|
||||
}
|
||||
if (controlBoardCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
return new Operations.ReturnGivenEventOp(Event.MeasurementStarted);
|
||||
}
|
||||
|
||||
/// Get total number of pulses
|
||||
int totalPulses = Convert.ToInt32(Math.Round(test.Volume / devices.FlowMeter.LtrPerPulse));
|
||||
|
||||
/// Get method class string
|
||||
string methodClass;
|
||||
if (!StateMachine.TestMethod2Class.TryGetValue(test.Name, out methodClass)) return null;
|
||||
|
||||
if (methodClass.Contains("TestMethods.Adjustment."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.CombinedWithDetection."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), dParam1, dParam2, totalPulses);
|
||||
}
|
||||
if (methodClass == "TestMethods.DiverterTest")
|
||||
{
|
||||
if (iParam == 0) return null;
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, totalPulses / iParam);
|
||||
}
|
||||
if (methodClass == "TestMethods.Dummy")
|
||||
{
|
||||
}
|
||||
if (methodClass == "TestMethods.Endurance")
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FixedStart."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FixedStartAdvanced."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FixedStartDefferedEval."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FixedStartMassCollDeferredEval."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, 2 * totalPulses);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FixedStartMassCollection."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.FixedStart), test.Qfrom, test.Qto, 2 * totalPulses);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FixedStartTankCollection."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, (totalPulses * 5 / 4));
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FlyingStart."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FlyingStartFirstRepetWithMassColl."))
|
||||
{
|
||||
TestMethods tm = (iParam == 1) ? (TestMethods.Diverter | TestMethods.Synchro) : TestMethods.Synchro;
|
||||
return new StartMeasurementOp(this, devices, tm, test.Qfrom, test.Qto, totalPulses);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FlyingStartMassCollComparative."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, totalPulses);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FlyingStartMassCollection."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, totalPulses);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FlyingStartMassCollProlonged."))
|
||||
{
|
||||
if (iParam == 0) return null;
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, totalPulses, iParam);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FlyingStartTankCollection."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, totalPulses);
|
||||
}
|
||||
if (methodClass == "TestMethods.PulsesTest")
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses);
|
||||
}
|
||||
if (methodClass == "TestMethods.PulsesTestManual")
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -619,7 +778,7 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="readers">An array of register readers</param>
|
||||
/// <param name="refPulses">Number of reference pulses to complete the test</param>
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation StartProlongedMeasurementOp(OutputPath outputPath, TestMethods method,
|
||||
public IOperation StartProlongedMeasurementOp(OutputPath outputPath,
|
||||
double requiredFlowLo, double requiredFlowHi,
|
||||
int totalRefPulses, int massRefPulses)
|
||||
{
|
||||
@@ -629,7 +788,8 @@ namespace TBF.BenchControl.Elde
|
||||
}
|
||||
else
|
||||
{
|
||||
return new StartMeasurementOp(this, outputPath, method, requiredFlowLo, requiredFlowHi, totalRefPulses, massRefPulses);
|
||||
return new StartMeasurementOp(this, outputPath, TestMethods.Diverter | TestMethods.Synchro | TestMethods.MassAndContinue,
|
||||
requiredFlowLo, requiredFlowHi, totalRefPulses, massRefPulses);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -646,17 +806,11 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="testName">Test name (without repetitions)</param>
|
||||
/// <param name="repetition">Repetition number</param>
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation ReadDiverterTransitionOp(IDiverter div, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, bool toTank,
|
||||
Sequences.Statistics plotter, int batchNr, string testName, int repetition)
|
||||
public IOperation ReadDiverterTransitionOp(bool isStart, Sequences.Statistics plotter, int batchNr, string testName, int repetition)
|
||||
{
|
||||
if (controlBoardCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
return new Operations.ReturnGivenEventOp(Event.None);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ReadDiverterTransitionOp(this, div, runsCountWhenSendingCmd, runsCountWhenReadingDiv, toTank, plotter, batchNr, testName, repetition);
|
||||
}
|
||||
if (controlBoardCfg.DebugLevel == DebugMode.Simulate) return new Operations.ReturnGivenEventOp(Event.None);
|
||||
|
||||
return new ReadDiverterTransitionOp(this, devices.Diverter, 1, 3, isStart, plotter, batchNr, testName, repetition);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -674,9 +828,9 @@ namespace TBF.BenchControl.Elde
|
||||
/// Events: FlowRegulationStopped
|
||||
/// </summary>
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation StopFlowRegulationOp(OutputPath outputPath)
|
||||
public IOperation StopFlowRegulationOp()
|
||||
{
|
||||
return new StopFlowRegulationOp(this, outputPath);
|
||||
return new StopFlowRegulationOp(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
+4
-4
@@ -1,14 +1,14 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public class ControlBoardFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "ControlBoard"; } }
|
||||
public string ClassName { get { return "ControlBoard"; } }
|
||||
|
||||
/// <summary>Max. number of components of this class in the system</summary>
|
||||
public int MaxCount { get { return 1; } }
|
||||
@@ -28,7 +28,7 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(Elde.ControlBoardCfg.Serializer, component, this);
|
||||
return ComponentCfgBase.CreateFromDbEntity(ControlBoardCfg.Serializer, component, this);
|
||||
}
|
||||
|
||||
public void ResetStaticProperties() { ControlBoardDev.ResetStaticProperties(); }
|
||||
+1
-1
@@ -7,7 +7,7 @@ using System.Text;
|
||||
using Dirichlet.Numerics;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public class ControlComSim : IControlCom
|
||||
{
|
||||
+14
-13
@@ -5,7 +5,7 @@ using System;
|
||||
using Dirichlet.Numerics;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public class ControlComWrap : IControlCom
|
||||
{
|
||||
@@ -186,19 +186,20 @@ namespace TBF.BenchControl.Elde
|
||||
/// Constructor that initializes the control board component reference
|
||||
/// </summary>
|
||||
/// <param name="ctrlBrdComponent"></param>
|
||||
#if DN100
|
||||
public ControlComWrap(ControlCom2VB.ControlCom2panel ctrlBrdComponent)
|
||||
#elif MUNICH || FUZHOU_150
|
||||
public ControlComWrap(ControlComponent3Munich.UserControl1 ctrlBrdComponent)
|
||||
#elif FUZHOU_300
|
||||
public ControlComWrap(ControlComponent3F300.UserControl1 ctrlBrdComponent)
|
||||
#elif IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN || GELSENWASSER || SLM_150 || PETERSBURG_200
|
||||
public ControlComWrap(ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent)
|
||||
#else /// all newer benches
|
||||
public ControlComWrap(ControlComponent_Torino2015.UserControl1 ctrlBrdComponent)
|
||||
#endif
|
||||
public ControlComWrap(object eldeComponent)
|
||||
{
|
||||
this.ctrlBrdComponent = ctrlBrdComponent;
|
||||
#if DN100
|
||||
ctrlBrdComponent = eldeComponent as ControlCom2VB.ControlCom2panel;
|
||||
#elif MUNICH || FUZHOU_150
|
||||
ctrlBrdComponent = eldeComponent as ControlComponent3Munich.UserControl1;
|
||||
#elif FUZHOU_300
|
||||
ctrlBrdComponent = eldeComponent as ControlComponent3F300.UserControl1;
|
||||
#elif IZRAEL_200 || PUCHONG_200 || GENESIS || BERLIN || GELSENWASSER || SLM_150 || PETERSBURG_200
|
||||
ctrlBrdComponent = eldeComponent as ControlComponent_Izrael2014.UserControl1;
|
||||
#else /// all newer benches
|
||||
ctrlBrdComponent = eldeComponent as ControlComponent_Torino2015.UserControl1;
|
||||
#endif
|
||||
if (ctrlBrdComponent == null) throw new Exception("Wrong ELDE component");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public class ExecuteCommandOp : IOperation
|
||||
{
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using Dirichlet.Numerics;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
interface IControlCom
|
||||
{
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public class QueryMeasurementEndOp : IOperation
|
||||
{
|
||||
+1
-1
@@ -5,7 +5,7 @@ using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public class ReadDiverterTransitionOp : IOperation
|
||||
{
|
||||
+1
-1
@@ -5,7 +5,7 @@ using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public class ReadFlowOp : IOperation
|
||||
{
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using Dirichlet.Numerics;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public class SendCommandArgs
|
||||
{
|
||||
+1
-1
@@ -5,7 +5,7 @@ using System;
|
||||
using log4net;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public class StartMeasurementOp : IOperation
|
||||
{
|
||||
+4
-4
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
class StopFlowRegulationOp : IOperation
|
||||
{
|
||||
@@ -20,13 +20,13 @@ namespace TBF.BenchControl.Elde
|
||||
/// Events: None or PreviousStopped
|
||||
/// </summary>
|
||||
/// <param name="controlBoardDev">Control board component reference</param>
|
||||
public StopFlowRegulationOp(ControlBoardDev controlBoardDev, OutputPath outputPath)
|
||||
public StopFlowRegulationOp(ControlBoardDev controlBoardDev)
|
||||
{
|
||||
if (controlBoardDev == null) throw new ArgumentNullException("controlBoardDev");
|
||||
this.controlBoard = controlBoardDev;
|
||||
|
||||
if (outputPath.FlowMeter == null) throw new ArgumentNullException("Flow meter is missing");
|
||||
flowMeterNr = outputPath.FlowMeter.Idx1;
|
||||
if (controlBoardDev.Devices.FlowMeter == null) throw new ArgumentNullException("Flow meter is missing");
|
||||
flowMeterNr = controlBoardDev.Devices.FlowMeter.Idx1;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
public class StopPreviousOp : IOperation
|
||||
{
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using Dirichlet.Numerics;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl
|
||||
namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
/// <summary>
|
||||
/// Test bench model inherited by all classes for the simulation of devices.
|
||||
@@ -493,7 +493,7 @@ namespace TBF.BenchControl
|
||||
const ulong Path5 = 0;
|
||||
#endif
|
||||
/// <summary>Run this device</summary>
|
||||
public static void RunDevice(int regulValveNo, int refFlowmtrNo, Elde.StatusP statusP)
|
||||
public static void RunDevice(int regulValveNo, int refFlowmtrNo, StatusP statusP)
|
||||
{
|
||||
TestBenchSim.regulValveNo = regulValveNo;
|
||||
TestBenchSim.refFlowmtrNo = refFlowmtrNo;
|
||||
@@ -0,0 +1,182 @@
|
||||
///
|
||||
/// 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 InitializeComponent(object thirdPartyComponent, UInt128 valvesToInvert, double[] tankCapacities)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
///
|
||||
/// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
///
|
||||
/// 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
///
|
||||
/// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
///
|
||||
/// 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); } }
|
||||
|
||||
/// <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() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,278 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using Dirichlet.Numerics;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.BenchControl.Modbus;
|
||||
|
||||
namespace TBF.BenchControl.ControlBoard.Papouch
|
||||
{
|
||||
public class CBoard : ComponentBase, IControlBoard
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CBoard));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(1)); }
|
||||
|
||||
readonly CBoardCfg cBoardCfg;
|
||||
readonly GenericDevices.IModbus modbus;
|
||||
|
||||
public QuidoVariant Variant { get { return cBoardCfg.Variant; } }
|
||||
|
||||
private ushort currentOutputs;
|
||||
private DateTime lastOutputsChange;
|
||||
|
||||
public OutputPath Devices
|
||||
{
|
||||
set { devices = value; }
|
||||
get { return devices; }
|
||||
}
|
||||
OutputPath devices;
|
||||
|
||||
public CBoard()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public CBoard(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
cBoardCfg = cfg as CBoardCfg;
|
||||
|
||||
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public void InitializeComponent(object thirdPartyComponent, UInt128 valvesToInvert, double[] tankCapacities)
|
||||
{
|
||||
this.valvesToInvert = valvesToInvert;
|
||||
this.benchModelRoute = valvesToInvert;
|
||||
}
|
||||
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (cBoardCfg.DebugLevel == Config.Entities.DebugMode.Simulate) return;
|
||||
|
||||
if (modbus.ReceivedTelegrams[cBoardCfg.ModbusAddress].Count > 0)
|
||||
{
|
||||
byte[] telegram = modbus.ReceivedTelegrams[cBoardCfg.ModbusAddress].Dequeue();
|
||||
|
||||
if ((telegram.Length >= 8) && (telegram[1] == 0x11) && (telegram[2] == telegram.Length - 5))
|
||||
{
|
||||
int msgLen = telegram.Length - 7;
|
||||
byte modbusAddress = telegram[3];
|
||||
string msg = Encoding.ASCII.GetString(telegram, 5, msgLen);
|
||||
string s = string.Format("QuidoRS detected: Address={0}, Message={1}", modbusAddress, msg);
|
||||
Debug.WriteLine(s);
|
||||
log.Warn(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RunDeviceAfter() { }
|
||||
public void StopDevice() { SendOutputs(0); }
|
||||
public void StopDevice2() { }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set outputs of QuidoRS board
|
||||
/// </summary>
|
||||
/// <param name="outputs">output value</param>
|
||||
public void SetOutputs(ushort outputs)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
SendOutputs(currentOutputs);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set bit(s) specified by a bitMask. Leave other bits unaffeced.
|
||||
/// </summary>
|
||||
/// <param name="bitMask">Specifies bit(s) to set</param>
|
||||
/// <param name="outputs">output value</param>
|
||||
public void SetBit(ushort bitMask)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
SendOutputs(currentOutputs);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset bit(s) specified by a bitMask. Leave other bits unaffeced.
|
||||
/// </summary>
|
||||
/// <param name="bitMask">Specifies bit(s) to reset</param>
|
||||
/// <param name="outputs">output value</param>
|
||||
public void ResetBit(ushort bitMask)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
SendOutputs(currentOutputs);
|
||||
}
|
||||
}
|
||||
|
||||
private void SendOutputs(ushort outputs)
|
||||
{
|
||||
byte addr = cBoardCfg.ModbusAddress;
|
||||
byte cmd = (byte)Function.ForceMultipleCoils;
|
||||
byte dataLo = (byte)(outputs & 0xFF);
|
||||
byte dataHi = (byte)(outputs >> 8);
|
||||
|
||||
if (cBoardCfg.Variant == QuidoVariant.QuidoRS_2_16)
|
||||
{
|
||||
modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 16, 2, dataLo, dataHi, 0, 0 });
|
||||
}
|
||||
else if (cBoardCfg.Variant == QuidoVariant.QuidoRS_4_4)
|
||||
{
|
||||
modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 4, 1, dataLo, 0, 0 });
|
||||
}
|
||||
else if (cBoardCfg.Variant == QuidoVariant.QuidoRS_8_8)
|
||||
{
|
||||
modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 8, 1, dataLo, 0, 0 });
|
||||
}
|
||||
|
||||
lastOutputsChange = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// 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;
|
||||
}
|
||||
|
||||
public IOperation StopPreviousOp()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
///
|
||||
/// 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.Papouch
|
||||
{
|
||||
public enum QuidoVariant
|
||||
{
|
||||
QuidoRS_2_16,
|
||||
QuidoRS_4_4,
|
||||
QuidoRS_8_8,
|
||||
Count
|
||||
}
|
||||
|
||||
public class CBoardCfg : ComponentCfgBase, Generic.IChildComponentCfg
|
||||
{
|
||||
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 byte ModbusAddress; /// 1..254
|
||||
public QuidoVariant Variant; /// QuidoRS_2_16, QuidoRS_4_4 or QuidoRS_8_8
|
||||
public int VirtualValvesRangeLo;
|
||||
public int VirtualValvesRangeHi;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
CBoardCfg()
|
||||
{
|
||||
Name = "CB";
|
||||
ParentName = "Modbus";
|
||||
ModbusAddress = 1;
|
||||
Variant = QuidoVariant.QuidoRS_2_16;
|
||||
VirtualValvesRangeLo = 50;
|
||||
VirtualValvesRangeHi = 59;
|
||||
}
|
||||
|
||||
public CBoardCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("name={0}({1}) address={2} variant={3} vvLo={4} vvHi={5}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
ModbusAddress,
|
||||
Variant,
|
||||
VirtualValvesRangeLo,
|
||||
VirtualValvesRangeHi);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.ControlBoard.Papouch
|
||||
{
|
||||
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.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.parentNameComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.modbusAddressTextBox = new System.Windows.Forms.TextBox();
|
||||
this.modbusAddressLabel = new System.Windows.Forms.Label();
|
||||
this.parentNameLabel = new System.Windows.Forms.Label();
|
||||
this.variantComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.variantLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(175, 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(178, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 4;
|
||||
//
|
||||
// vValveRangeLoTextBox
|
||||
//
|
||||
this.vValveRangeLoTextBox.Enabled = false;
|
||||
this.vValveRangeLoTextBox.Location = new System.Drawing.Point(178, 161);
|
||||
this.vValveRangeLoTextBox.Name = "vValveRangeLoTextBox";
|
||||
this.vValveRangeLoTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.vValveRangeLoTextBox.TabIndex = 6;
|
||||
//
|
||||
// vValveRangeLoLabel
|
||||
//
|
||||
this.vValveRangeLoLabel.AutoSize = true;
|
||||
this.vValveRangeLoLabel.Location = new System.Drawing.Point(42, 164);
|
||||
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(178, 186);
|
||||
this.vValveRangeHiTextBox.Name = "vValveRangeHiTextBox";
|
||||
this.vValveRangeHiTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.vValveRangeHiTextBox.TabIndex = 8;
|
||||
//
|
||||
// vValveRangeHiLabel
|
||||
//
|
||||
this.vValveRangeHiLabel.AutoSize = true;
|
||||
this.vValveRangeHiLabel.Location = new System.Drawing.Point(42, 189);
|
||||
this.vValveRangeHiLabel.Name = "vValveRangeHiLabel";
|
||||
this.vValveRangeHiLabel.Size = new System.Drawing.Size(116, 13);
|
||||
this.vValveRangeHiLabel.TabIndex = 7;
|
||||
this.vValveRangeHiLabel.Text = "Virtual valves range Hi:";
|
||||
//
|
||||
// parentNameComboBox
|
||||
//
|
||||
this.parentNameComboBox.Enabled = false;
|
||||
this.parentNameComboBox.FormattingEnabled = true;
|
||||
this.parentNameComboBox.Location = new System.Drawing.Point(178, 83);
|
||||
this.parentNameComboBox.Name = "parentNameComboBox";
|
||||
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.parentNameComboBox.TabIndex = 10;
|
||||
//
|
||||
// modbusAddressTextBox
|
||||
//
|
||||
this.modbusAddressTextBox.Enabled = false;
|
||||
this.modbusAddressTextBox.Location = new System.Drawing.Point(178, 136);
|
||||
this.modbusAddressTextBox.Name = "modbusAddressTextBox";
|
||||
this.modbusAddressTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.modbusAddressTextBox.TabIndex = 12;
|
||||
//
|
||||
// modbusAddressLabel
|
||||
//
|
||||
this.modbusAddressLabel.AutoSize = true;
|
||||
this.modbusAddressLabel.Location = new System.Drawing.Point(42, 140);
|
||||
this.modbusAddressLabel.Name = "modbusAddressLabel";
|
||||
this.modbusAddressLabel.Size = new System.Drawing.Size(86, 13);
|
||||
this.modbusAddressLabel.TabIndex = 11;
|
||||
this.modbusAddressLabel.Text = "Modbus Address";
|
||||
//
|
||||
// parentNameLabel
|
||||
//
|
||||
this.parentNameLabel.AutoSize = true;
|
||||
this.parentNameLabel.Location = new System.Drawing.Point(42, 86);
|
||||
this.parentNameLabel.Name = "parentNameLabel";
|
||||
this.parentNameLabel.Size = new System.Drawing.Size(69, 13);
|
||||
this.parentNameLabel.TabIndex = 9;
|
||||
this.parentNameLabel.Text = "Parent Name";
|
||||
//
|
||||
// variantComboBox
|
||||
//
|
||||
this.variantComboBox.Enabled = false;
|
||||
this.variantComboBox.FormattingEnabled = true;
|
||||
this.variantComboBox.Location = new System.Drawing.Point(178, 110);
|
||||
this.variantComboBox.Name = "variantComboBox";
|
||||
this.variantComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.variantComboBox.TabIndex = 14;
|
||||
//
|
||||
// variantLabel
|
||||
//
|
||||
this.variantLabel.AutoSize = true;
|
||||
this.variantLabel.Location = new System.Drawing.Point(42, 113);
|
||||
this.variantLabel.Name = "variantLabel";
|
||||
this.variantLabel.Size = new System.Drawing.Size(40, 13);
|
||||
this.variantLabel.TabIndex = 13;
|
||||
this.variantLabel.Text = "Variant";
|
||||
//
|
||||
// CBoardCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.variantComboBox);
|
||||
this.Controls.Add(this.variantLabel);
|
||||
this.Controls.Add(this.parentNameComboBox);
|
||||
this.Controls.Add(this.modbusAddressTextBox);
|
||||
this.Controls.Add(this.modbusAddressLabel);
|
||||
this.Controls.Add(this.parentNameLabel);
|
||||
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.Name = "CBoardCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(400, 300);
|
||||
this.Load += new System.EventHandler(this.ControlBoardCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
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;
|
||||
private System.Windows.Forms.ComboBox parentNameComboBox;
|
||||
private System.Windows.Forms.TextBox modbusAddressTextBox;
|
||||
private System.Windows.Forms.Label modbusAddressLabel;
|
||||
private System.Windows.Forms.Label parentNameLabel;
|
||||
private System.Windows.Forms.ComboBox variantComboBox;
|
||||
private System.Windows.Forms.Label variantLabel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.ControlBoard.Papouch
|
||||
{
|
||||
public partial class CBoardCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
ComponentParametersDlg parent;
|
||||
|
||||
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)
|
||||
{
|
||||
parent = ParentForm as ComponentParametersDlg;
|
||||
if (parent == null) return;
|
||||
|
||||
if (parent.TbfComponents != null)
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (QuidoVariant v = 0; v < QuidoVariant.Count; v++) variantComboBox.Items.Add(v.ToString());
|
||||
|
||||
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;
|
||||
variantComboBox.Text = config.Variant.ToString();
|
||||
modbusAddressTextBox.Text = config.ModbusAddress.ToString();
|
||||
vValveRangeLoTextBox.Text = config.VirtualValvesRangeLo.ToString();
|
||||
vValveRangeHiTextBox.Text = config.VirtualValvesRangeHi.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
parentNameComboBox.Enabled = true;
|
||||
variantComboBox.Enabled = true;
|
||||
modbusAddressTextBox.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 (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Parent Name'";
|
||||
}
|
||||
if (!variantComboBox.Items.Contains(variantComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Variant'";
|
||||
}
|
||||
if (!int.TryParse(modbusAddressTextBox.Text, out dummy) || dummy < 0 || dummy > 255)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Modbus Address' should be between 0 and 255";
|
||||
}
|
||||
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;
|
||||
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
|
||||
for (QuidoVariant v = 0; v < QuidoVariant.Count; v++)
|
||||
{
|
||||
if (variantComboBox.Text == v.ToString()) { config.Variant = v; break; }
|
||||
}
|
||||
config.ModbusAddress = (byte)int.Parse(modbusAddressTextBox.Text);
|
||||
config.VirtualValvesRangeLo = int.Parse(vValveRangeLoTextBox.Text);
|
||||
config.VirtualValvesRangeHi = int.Parse(vValveRangeHiTextBox.Text);
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,29 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.ControlBoard.Papouch
|
||||
{
|
||||
public class CBoardFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
|
||||
public void ResetStaticProperties() { CBoard.ResetStaticProperties(); }
|
||||
|
||||
/// <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, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new CBoardCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(CBoardCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO.Ports;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
using Dirichlet.Numerics;
|
||||
using TBF.BenchControl.ControlBoard;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Danfoss.VLT2800
|
||||
{
|
||||
@@ -92,7 +91,7 @@ namespace TBF.BenchControl.Danfoss.VLT2800
|
||||
}
|
||||
|
||||
|
||||
readonly Elde.ControlBoardDev controlBoard;
|
||||
readonly IControlBoard controlBoard;
|
||||
readonly int bitPosition; /// 0 .. 63
|
||||
|
||||
public readonly UInt128 Mask; /// derived from bitPosition in the constructor
|
||||
@@ -122,7 +121,7 @@ namespace TBF.BenchControl.Danfoss.VLT2800
|
||||
{
|
||||
pumpCfg = cfg as PumpCfg;
|
||||
|
||||
controlBoard = (Elde.ControlBoardDev)TbfComponents.FindComponent("CB", components); /// TODO: replace "CB"
|
||||
controlBoard = TbfComponents.FindComponent("CB", components) as IControlBoard; /// TODO: replace "CB"
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
bitPosition = pumpCfg.BitPosition;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dirichlet.Numerics;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Resources;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace TBF.BenchControl.Elde.CoverTest
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Dirichlet.Numerics;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
@@ -69,7 +70,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
{
|
||||
diverterCfg = cfg as DiverterCfg;
|
||||
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as ControlBoardDev;
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
if (diverterCfg.BitPosition < 0 || diverterCfg.BitPosition >= 64) throw new ArgumentOutOfRangeException("position");
|
||||
@@ -189,7 +190,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
public void Initialize() { }
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
int adcValue = (int)StateMachine.ControlBoard.AnalogInputRaw(diverterCfg.AdcNr, 0);
|
||||
int adcValue = (int)controlBoard.AnalogInputRaw(diverterCfg.AdcNr, 0);
|
||||
Handlers.OnAdcChanged(this, new CmdResponseArgs(CfgChangeCmd.GetAdc, diverterCfg.BitPosition, adcValue));
|
||||
}
|
||||
public void RunDeviceAfter() { }
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
+7
-9
@@ -5,16 +5,15 @@ using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
namespace TBF.BenchControl.Elde.Diverter
|
||||
{
|
||||
public class ReadDiverterStateOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadFlowOp));
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadDiverterStateOp));
|
||||
public override string ToString() { return string.Format("ReadDiverterStateOp(div={0}, delay={1})", div.Name, delay); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly GenericDevices.IDiverter div;
|
||||
readonly ControlBoardDev ctrlBrd;
|
||||
readonly int delay;
|
||||
|
||||
int startTime;
|
||||
@@ -25,18 +24,17 @@ namespace TBF.BenchControl.Elde
|
||||
/// <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 ReadDiverterStateOp(ControlBoardDev ctrlBrd, GenericDevices.IDiverter div, int delay)
|
||||
public ReadDiverterStateOp(GenericDevices.IDiverter div, int delay)
|
||||
{
|
||||
if (ctrlBrd == null || div == null) throw new ArgumentNullException();
|
||||
|
||||
this.ctrlBrd = ctrlBrd;
|
||||
this.div = div;
|
||||
if (div == null) throw new ArgumentNullException();
|
||||
|
||||
this.delay = delay;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadDiverterStateOp(ControlBoardDev ctrlBrd, GenericDevices.IDiverter div)
|
||||
: this(ctrlBrd, div, 0)
|
||||
public ReadDiverterStateOp(GenericDevices.IDiverter div)
|
||||
: this(div, 0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Diverter
|
||||
{
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
|
||||
@@ -114,8 +115,8 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
}
|
||||
|
||||
|
||||
public double ReadFlow() { return controlBoard.ReferenceFlow; }
|
||||
public double ReadFrequency() { return controlBoard.ReferenceFreq; }
|
||||
public double ReadFlow() { return controlBoard.RefFlow; }
|
||||
public double ReadFrequency() { return controlBoard.RefFrequency; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: FlowDone, Error
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2019-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FlowMeterDewa
|
||||
{
|
||||
@@ -43,7 +44,7 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
|
||||
|
||||
refFreq[1] = refFreq[0] - refFreq[2] - refFreq[3];
|
||||
|
||||
refPulses[0] = controlBoard.EtPulses(0);
|
||||
refPulses[0] = controlBoard.RefPulses;
|
||||
refPulses[2] = controlBoard.EtPulses2;
|
||||
refPulses[3] = controlBoard.EtPulses3;
|
||||
refPulses[1] = refPulses[0] - refPulses[2] - refPulses[3];
|
||||
@@ -132,8 +133,8 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public double ReadFlow() { return controlBoard.ReferenceFlow; }
|
||||
public double ReadFrequency() { return controlBoard.ReferenceFreq; }
|
||||
public double ReadFlow() { return controlBoard.RefFlow; }
|
||||
public double ReadFrequency() { return controlBoard.RefFrequency; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: FlowDone, Error
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2017-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FlowMeterTriplet
|
||||
@@ -46,8 +47,8 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public double ReadFlow() { return controlBoard.ReferenceFlow; }
|
||||
public double ReadFrequency() { return controlBoard.ReferenceFreq; }
|
||||
public double ReadFlow() { return controlBoard.RefFlow; }
|
||||
public double ReadFrequency() { return controlBoard.RefFrequency; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: FlowDone, Error
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FlowMeterTwins
|
||||
@@ -58,8 +59,8 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public double ReadFlow() { return controlBoard.ReferenceFlow; }
|
||||
public double ReadFrequency() { return controlBoard.ReferenceFreq; }
|
||||
public double ReadFlow() { return controlBoard.RefFlow; }
|
||||
public double ReadFrequency() { return controlBoard.RefFrequency; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: FlowDone, Error
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
|
||||
{
|
||||
foreach (var cmpnt in parentDlg.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
@@ -86,9 +87,9 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the water pressure
|
||||
/// Returns the water pressure and convert from kPa to default units
|
||||
/// </summary>
|
||||
/// <returns>Pressure in mBar</returns>
|
||||
/// <returns>Pressure</returns>
|
||||
public float ReadPressure()
|
||||
{
|
||||
double rawPressure = Config.Units.ConvertFrom(Config.Unit.kPa, ControlBoard.Pressure(Idx0));
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Author: Milan Hanajik
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
|
||||
@@ -78,6 +77,18 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the water pressure and convert from kPa to default units
|
||||
/// </summary>
|
||||
/// <returns>Pressure</returns>
|
||||
public float ReadPressure()
|
||||
{
|
||||
double rawPressure = Config.Units.ConvertFrom(Config.Unit.kPa, ControlBoard.Pressure(Idx0));
|
||||
double correctedPressure = Config.Formulas.CorrectedValue(rawPressure, Corrections);
|
||||
return (float)correctedPressure;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Events: PressureDone, Error
|
||||
/// </summary>
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Author: Milan Hanajik
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
@@ -11,27 +10,25 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
public class ReadPressureOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadPressureOp));
|
||||
public override string ToString() { return string.Format("ReadPressureOp(.,{0},{1},.)", eventDone, pressureMeterNr); }
|
||||
public override string ToString() { return string.Format("ReadPressureOp()"); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoardDev;
|
||||
readonly int pressureMeterNr;
|
||||
readonly PressureMeter pressureMeter;
|
||||
readonly Event eventDone;
|
||||
FloatBox pressure;
|
||||
FloatBox pressureBox;
|
||||
|
||||
/// <summary>
|
||||
/// Events: PressureInDone, PressureOutDone or Error
|
||||
/// </summary>
|
||||
/// <param name="pressureMeter">Pressure meter reference</param>
|
||||
/// <param name="pressure">Reference to the measured pressure variable, value is in bar</param>
|
||||
/// <param name="pressureBox">Reference to the measured pressure variable, value is in bar</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadPressureOp(PressureMeter pressureMeter, ref FloatBox pressure, Event eventDone)
|
||||
public ReadPressureOp(PressureMeter pressureMeter, ref FloatBox pressureBox, Event eventDone)
|
||||
{
|
||||
if (pressureMeter == null) throw new ArgumentNullException("pressureMeter");
|
||||
this.controlBoardDev = pressureMeter.ControlBoard;
|
||||
this.pressureMeterNr = pressureMeter.Idx0;
|
||||
this.eventDone = eventDone;
|
||||
this.pressure = pressure;
|
||||
this.pressureMeter = pressureMeter;
|
||||
this.pressureBox = pressureBox;
|
||||
this.eventDone = eventDone;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
@@ -43,7 +40,7 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
pressure.Val = 0.01F * controlBoardDev.Pressure(pressureMeterNr); /// converted from [kPa] to [bar]
|
||||
pressureBox.Val = pressureMeter.ReadPressure();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
@@ -52,7 +49,7 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
pressure.Val = 0.01F * controlBoardDev.Pressure(pressureMeterNr); /// converted from [kPa] to [bar]
|
||||
pressureBox.Val = pressureMeter.ReadPressure();
|
||||
return eventDone;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Dirichlet.Numerics;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
|
||||
namespace TBF.BenchControl.Elde.PumpWithFM
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.RegisterReader
|
||||
@@ -15,8 +16,8 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
|
||||
readonly RegisterReaderCfg registerReaderCfg;
|
||||
|
||||
public int Position { get { return registerReaderCfg.Position; } } /// 1 .. inf
|
||||
///
|
||||
public int Position { get { return registerReaderCfg.Position; } } /// 1 .. Config.Data.WMsCount
|
||||
|
||||
public Config.Entities.RegisterReaderType RegisterReaderType { get { return Config.Entities.RegisterReaderType.Pulses; } }
|
||||
public double PulsesPerLtr { get { return registerReaderCfg.ProcParams.PulsesPerLtr; } }
|
||||
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); ; } }
|
||||
@@ -29,14 +30,12 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
public double BeginWMState { get { return 0; } } /// Always 0
|
||||
public double EndWMState { get { return WMVolume; } } /// Derived from WMVolume
|
||||
|
||||
|
||||
int wmPulses;
|
||||
int wmRefPulses;
|
||||
|
||||
/// <summary> This is to cope with counter overflow </summary>
|
||||
int lastPulses;
|
||||
bool lastPulsesValid;
|
||||
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly TBF.BenchControl.ControlBoard.IControlBoard controlBoard;
|
||||
|
||||
|
||||
public RegisterReader()
|
||||
@@ -48,30 +47,14 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
{
|
||||
registerReaderCfg = cfg as RegisterReaderCfg;
|
||||
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as TBF.BenchControl.ControlBoard.IControlBoard;
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
Clear();
|
||||
|
||||
/// Prepare data for SendCalibData() control board component method
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
log.DebugFormat("{0}:Clear()", Name);
|
||||
wmPulses = 0;
|
||||
wmRefPulses = 0;
|
||||
lastPulsesValid = false;
|
||||
}
|
||||
|
||||
public void TestCompleted()
|
||||
{
|
||||
log.DebugFormat("{0}:TestCompleted()", Name);
|
||||
ReadPulses();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: Event.ReadRegisterDone, Event.Error
|
||||
/// </summary>
|
||||
@@ -83,40 +66,13 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
|
||||
private void ReadPulses()
|
||||
{
|
||||
log.DebugFormat("{0}:ReadPulses() started, lastPulses={1}, lastPulsesValid={2}", Name, lastPulses, lastPulsesValid);
|
||||
if (!lastPulsesValid)
|
||||
{
|
||||
lastPulses = (int)controlBoard.WMeterPulses(Position);
|
||||
lastPulsesValid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt16 lowerWord = controlBoard.WMeterPulses(Position);
|
||||
int uncorrected = (int)(((uint)lastPulses & 0xFFFF0000) | lowerWord);
|
||||
if (Math.Abs(uncorrected - lastPulses) <= Int16.MaxValue)
|
||||
{
|
||||
lastPulses = uncorrected;
|
||||
}
|
||||
else if (Math.Abs(uncorrected + 65536 - lastPulses) <= Int16.MaxValue)
|
||||
{
|
||||
lastPulses = uncorrected + 65536;
|
||||
}
|
||||
else if (Math.Abs(uncorrected - 65536 - lastPulses) <= Int16.MaxValue)
|
||||
{
|
||||
lastPulses = uncorrected - 65536;
|
||||
}
|
||||
}
|
||||
|
||||
wmPulses = lastPulses;
|
||||
wmRefPulses = (int)controlBoard.EtPulses(Position);
|
||||
|
||||
log.DebugFormat("{0}:ReadPulses() completed, wmPulses={1} wmRefPulses={2}", Name, wmPulses, wmRefPulses);
|
||||
wmPulses = controlBoard.PulsesWM(Position);
|
||||
wmRefPulses = controlBoard.RefPulsesWM(Position);
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
lastPulsesValid = false;
|
||||
ReadPulses();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
}
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly TBF.BenchControl.ControlBoard.Legacy.ControlBoardDev controlBoard;
|
||||
readonly RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly float timePulseSec;
|
||||
@@ -26,18 +26,18 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// Set required water flow.
|
||||
/// Events: FlowSet, FlowTimeOut
|
||||
/// </summary>
|
||||
/// <param name="controlBoard">Control board device</param>
|
||||
/// <param name="_regulValve">Regulation valve component</param>
|
||||
/// <param name="cb">Control board device</param>
|
||||
/// <param name="rv">Regulation valve component</param>
|
||||
/// <param name="posLoPct">Lower limit of the position to be achieved</param>
|
||||
/// <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(TBF.BenchControl.ControlBoard.IControlBoard cb, RegulValve rv, float timePulseSec)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
controlBoard = cb as TBF.BenchControl.ControlBoard.Legacy.ControlBoardDev;
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
|
||||
regulValve = _regulValve as RegulValve;
|
||||
regulValve = rv as RegulValve;
|
||||
if (regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
|
||||
regulValveNr = this.regulValve.Idx1;
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
log.WarnFormat("RV#={0}, actPos={1}%", regulValveNr, positionPct.ToString("F1"));
|
||||
|
||||
controlBoard.ValveMove(regulValveNr,
|
||||
RegulValveMode.PulseWidth,
|
||||
TBF.BenchControl.ControlBoard.Legacy.RegulValveMode.PulseWidth,
|
||||
new float[2] { timePulseSec, timePulseSec },
|
||||
regulValve.StableTime);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.Elde.RegulValve
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
|
||||
@@ -172,7 +173,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
double flowMtrFreq = controlBoard.ReferenceFreq;
|
||||
double flowMtrFreq = controlBoard.RefFrequency;
|
||||
currentReqFlowLo = reqFlowAve;
|
||||
currentReqFlowHi = reqFlowAve;
|
||||
///
|
||||
@@ -209,7 +210,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
expireTime = StateMachine.Time + timeout;
|
||||
if (expireTime < 0) expireTime = int.MaxValue;
|
||||
|
||||
TestMethods tm = 0;
|
||||
ControlBoard.Legacy.TestMethods tm = 0;
|
||||
StopDevs sd = 0;
|
||||
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
|
||||
@@ -222,7 +223,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
public Event Run()
|
||||
{
|
||||
float rvPosition = controlBoard.RValvePosition(regulValveNr);
|
||||
double flowMtrFreq = controlBoard.ReferenceFreq;
|
||||
double flowMtrFreq = controlBoard.RefFrequency;
|
||||
double flow = flowMtrFreq * nominalFlow / 2000.0;
|
||||
|
||||
if (flowMtrFreq != 0)
|
||||
@@ -258,8 +259,8 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
expireTime = StateMachine.Time + timeout;
|
||||
if (expireTime < 0) expireTime = int.MaxValue;
|
||||
|
||||
TestMethods tm = 0;
|
||||
StopDevs sd = 0;
|
||||
ControlBoard.Legacy.TestMethods tm = 0;
|
||||
StopDevs sd = 0;
|
||||
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
|
||||
log.DebugFormat(" return Event.None");
|
||||
@@ -475,7 +476,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
if (leaveMeasurementRunning) return;
|
||||
|
||||
/// Stop measurement
|
||||
TestMethods tm = 0;
|
||||
ControlBoard.Legacy.TestMethods tm = 0;
|
||||
StopDevs sd = StopDevs.RegValveRegulation;
|
||||
controlBoard.SendCommand(Command.Stop, flowMeterNr, 50000, 50000, tm, sd);
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
|
||||
@@ -177,7 +178,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
double flowMtrFreq = controlBoard.ReferenceFreq;
|
||||
double flowMtrFreq = controlBoard.RefFrequency;
|
||||
currentReqFlowLo = reqFlowAve;
|
||||
currentReqFlowHi = reqFlowAve;
|
||||
///
|
||||
@@ -214,7 +215,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
expireTime = StateMachine.Time + timeout;
|
||||
if (expireTime < 0) expireTime = int.MaxValue;
|
||||
|
||||
TestMethods tm = 0;
|
||||
ControlBoard.Legacy.TestMethods tm = 0;
|
||||
StopDevs sd = 0;
|
||||
// '_regulValve.RegulValveTandemCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
|
||||
@@ -228,7 +229,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
{
|
||||
float rvPosition = controlBoard.RValvePosition(regulValveNr);
|
||||
float fixedRVPosition = controlBoard.RValvePosition(fixedRVNr);
|
||||
double flowMtrFreq = controlBoard.ReferenceFreq;
|
||||
double flowMtrFreq = controlBoard.RefFrequency;
|
||||
double flow = flowMtrFreq * nominalFlow / 2000.0;
|
||||
|
||||
if (flowMtrFreq != 0)
|
||||
@@ -368,7 +369,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
if (leaveMeasurementRunning) return;
|
||||
|
||||
/// Stop measurement
|
||||
TestMethods tm = 0;
|
||||
ControlBoard.Legacy.TestMethods tm = 0;
|
||||
StopDevs sd = StopDevs.RegValveRegulation;
|
||||
controlBoard.SendCommand(Command.Stop, flowMeterNr, 50000, 50000, tm, sd);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace TBF.BenchControl.Elde.TempMeter
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2020 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;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace TBF.BenchControl.Elde.TempMeterInternal
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user