diff --git a/TBF/BenchControl/Ambient/Comet/Ambient.cs b/TBF/BenchControl/Ambient/Comet/Ambient.cs
index 0db46ac18..d3f639ba3 100644
--- a/TBF/BenchControl/Ambient/Comet/Ambient.cs
+++ b/TBF/BenchControl/Ambient/Comet/Ambient.cs
@@ -18,68 +18,54 @@ namespace TBF.BenchControl.Ambient.Comet
public class Ambient : ComponentBase, IDevice, IOperation, GenericDevices.IAmbient
{
private static readonly ILog log = LogManager.GetLogger(typeof(Ambient));
- public override string ToString() { return string.Format("Ambient({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
private readonly AmbientCfg ambientCfg;
/// Private fields
SerialPort serialPort;
- /// The state of the measurement
- MsrmntState msrmntState;
- int msrmntTimeStamp;
-
/// Measured values when MsrmntState == MsrmntState.Valid
float temperature; /// [°C]
float pressure; /// [bar]
float humidity; /// [R%]
+ /// Last valid measurement time stamp
+ int msrmntTimeStamp;
- public Ambient()
- {
- }
- ///
- /// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
- ///
- public Ambient(AmbientCfg cfg, IList components)
- : this(cfg)
- {
- }
+ public Ambient() { }
- public Ambient(Generic.IComponentCfg cfg)
+ ///
+ /// Ambient temperature / humidity / pressure meter 'Comet' connected via serial interface (RS232)
+ ///
+ public Ambient(Generic.IComponentCfg cfg)
: base(cfg)
{
ambientCfg = cfg as AmbientCfg;
- log.Warn(this.ToString());
}
- public void Initialize()
+ public override void Initialize()
{
- if (ambientCfg.DebugLevel == DebugMode.Simulate)
- {
- temperature = 20.0f;
- humidity = 40.0f;
- pressure = 1.0f;
-
- msrmntTimeStamp = StateMachine.Time;
- msrmntState = MsrmntState.Valid;
- return;
- }
-
- string comPortName = "COM" + ambientCfg.ComPortNr.ToString();
- serialPort = new SerialPort(comPortName, ambientCfg.BaudRate, ambientCfg.Parity, ambientCfg.DataBits, ambientCfg.StopBits);
- serialPort.Handshake = ambientCfg.Handshake;
- serialPort.Open();
- if (ambientCfg.SetDtrToOne)
- {
- serialPort.DtrEnable = true;
- }
-
+ temperature = 20.0f;
+ humidity = 40.0f;
+ pressure = 1.0f;
msrmntTimeStamp = 0;
- msrmntState = MsrmntState.Busy;
- log.FatalFormat("Successfully initialized device {0}", ToString());
+ if (ambientCfg.DebugLevel == DebugMode.Normal)
+ {
+ string comPortName = "COM" + ambientCfg.ComPortNr.ToString();
+ serialPort = new SerialPort(comPortName, ambientCfg.BaudRate, ambientCfg.Parity, ambientCfg.DataBits, ambientCfg.StopBits);
+ serialPort.Handshake = ambientCfg.Handshake;
+ serialPort.Open();
+ if (ambientCfg.SetDtrToOne) serialPort.DtrEnable = true;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ else
+ {
+ serialPort = null;
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ }
}
/// Run this device
@@ -112,7 +98,6 @@ namespace TBF.BenchControl.Ambient.Comet
pressure = (float)value / 10000.0f;
msrmntTimeStamp = StateMachine.Time;
- msrmntState = MsrmntState.Valid;
UpdateProcessData(temperature, pressure, humidity);
diff --git a/TBF/BenchControl/Ambient/Greco/Ambient.cs b/TBF/BenchControl/Ambient/Greco/Ambient.cs
index 041b0fd5f..916892adb 100644
--- a/TBF/BenchControl/Ambient/Greco/Ambient.cs
+++ b/TBF/BenchControl/Ambient/Greco/Ambient.cs
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.Ambient.Greco
public class Ambient : ComponentBase, IDevice, IOperation, GenericDevices.IAmbient
{
private static readonly ILog log = LogManager.GetLogger(typeof(Ambient));
- public override string ToString() { return string.Format("Ambient({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
private readonly AmbientCfg ambientCfg;
@@ -28,9 +28,6 @@ namespace TBF.BenchControl.Ambient.Greco
SerialPort serialPort;
StringBuilder measurementBuilder;
- /// The state of the measurement
- MsrmntState msrmntState;
-
///
/// Measured values when MsrmntState == MsrmntState.Valid
///
@@ -38,49 +35,43 @@ namespace TBF.BenchControl.Ambient.Greco
float pressure; /// [bar]
float humidity; /// [R%]
- /// Measurement time stamp when MsrmntState == MsrmntState.Valid
+ /// Last valid measurement time stamp
int msrmntTimeStamp;
- public Ambient()
- {
- }
+
+ public Ambient() { }
///
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
/// Connection settings: 19200 Bd 8-bits No-parity 1-stop-bit Flow control: none or hardware.
///
- public Ambient(AmbientCfg cfg, IList components)
- : this(cfg)
- {
- }
-
public Ambient(Generic.IComponentCfg cfg)
: base(cfg)
{
ambientCfg = cfg as AmbientCfg;
- log.Warn(this.ToString());
}
- public void Initialize()
+ public override void Initialize()
{
- if (ambientCfg.DebugLevel == DebugMode.Simulate)
+ temperature = 20.0f;
+ humidity = 40.0f;
+ pressure = 1.0f;
+ msrmntTimeStamp = 0;
+
+ if (ambientCfg.DebugLevel == DebugMode.Normal)
+ {
+ string comPortName = "COM" + ambientCfg.ComPortNr.ToString();
+ serialPort = new SerialPort(comPortName, ambientCfg.BaudRate, ambientCfg.Parity, ambientCfg.DataBits, ambientCfg.StopBits);
+ serialPort.Handshake = ambientCfg.Handshake;
+ serialPort.Open();
+ measurementBuilder = new StringBuilder(40);
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ else
{
- temperature = 20.0f;
- humidity = 40.0f;
- pressure = 1.0f;
- msrmntTimeStamp = StateMachine.Time;
- msrmntState = MsrmntState.Valid;
- return;
- }
-
- string comPortName = "COM" + ambientCfg.ComPortNr.ToString();
- serialPort = new SerialPort(comPortName, ambientCfg.BaudRate, ambientCfg.Parity, ambientCfg.DataBits, ambientCfg.StopBits);
- serialPort.Handshake = ambientCfg.Handshake;
- serialPort.Open();
- measurementBuilder = new StringBuilder(40);
- msrmntState = MsrmntState.Busy;
-
- log.FatalFormat("Successfully initialized device {0}", ToString());
+ serialPort = null;
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ }
}
/// Run this device
@@ -136,7 +127,6 @@ namespace TBF.BenchControl.Ambient.Greco
UpdateProcessData(temperature, pressure, humidity);
msrmntTimeStamp = StateMachine.Time;
- msrmntState = MsrmntState.Valid;
log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
}
else
diff --git a/TBF/BenchControl/ComponentBase.cs b/TBF/BenchControl/ComponentBase.cs
index 1ea9af76d..a828a7f93 100644
--- a/TBF/BenchControl/ComponentBase.cs
+++ b/TBF/BenchControl/ComponentBase.cs
@@ -8,18 +8,18 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl
{
- public class ComponentBase : IComponent
+ public abstract class ComponentBase : IComponent
{
readonly Generic.IComponentCfg cfg;
public Generic.IComponentCfg Cfg { get { return cfg; } }
- public string Name { get { return cfg.Name; } }
- public string ClassName { get { return cfg.Factory.ClassName; } }
- public string ParentName { get { return cfg.ParentName; } }
- public Generic.IComponentFactory Factory { get { return cfg.Factory; } }
- public int ItemNr { get { return cfg.ItemNr; } }
- public DebugMode DebugLevel { get { return cfg.DebugLevel; } set { cfg.DebugLevel = value; } }
- public LogLevel LogLevel { get { return cfg.LogLevel; } }
+ public string Name { get { return cfg.Name; } }
+ public string ClassName { get { return cfg.Factory.ClassName; } }
+ public string ParentName { get { return cfg.ParentName; } }
+ public IComponentFactory Factory { get { return cfg.Factory; } }
+ public int ItemNr { get { return cfg.ItemNr; } }
+ public DebugMode DebugLevel { get { return cfg.DebugLevel; } set { cfg.DebugLevel = value; } }
+ public LogLevel LogLevel { get { return cfg.LogLevel; } }
public IList Corrections
{
@@ -49,8 +49,7 @@ namespace TBF.BenchControl
this.cfg = cfg;
}
- /// Empty implementation, might be overriden in derived classes
- public static void ResetStaticProperties() { }
+ public abstract void Initialize();
/// Empty implementation, might be overriden in derived classes
public virtual void StartChangeHandler() { }
diff --git a/TBF/BenchControl/Danfoss/VLT2800/Pump.cs b/TBF/BenchControl/Danfoss/VLT2800/Pump.cs
index 156f53413..9bd74d13f 100644
--- a/TBF/BenchControl/Danfoss/VLT2800/Pump.cs
+++ b/TBF/BenchControl/Danfoss/VLT2800/Pump.cs
@@ -71,7 +71,7 @@ namespace TBF.BenchControl.Danfoss.VLT2800
public class Pump : ComponentBase, IDevice, IOperation, GenericDevices.IPumpFM, GenericDevices.IValve
{
private static readonly ILog log = LogManager.GetLogger(typeof(Pump));
- public override string ToString() { return string.Format("Pump-Danfoss-VLT2800({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
private readonly PumpCfg pumpCfg;
@@ -86,21 +86,15 @@ namespace TBF.BenchControl.Danfoss.VLT2800
/// Pump power in [%] in range 0 .. 100.0f
///
private float power;
- public float Power
- {
- get { return power; }
- }
+ public float Power { get { return power; } }
readonly Elde.ControlBoardDev controlBoard;
- readonly int bitPosition; /// 0 .. 63
- public readonly UInt128 Mask; /// derived from bitPosition in the constructor
+ int bitNr; /// 0 .. 127
+ public UInt128 Mask; /// derived from bitPosition in the constructor
- public bool State
- {
- get { return (controlBoard.Route & Mask) != 0; }
- }
+ public bool State { get { return (controlBoard.Route & Mask) != 0; } }
/// Private fields
SerialPort serialPort;
@@ -109,9 +103,7 @@ namespace TBF.BenchControl.Danfoss.VLT2800
StringBuilder responseBuilder;
- public Pump()
- {
- }
+ public Pump() { }
///
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
@@ -124,29 +116,31 @@ namespace TBF.BenchControl.Danfoss.VLT2800
controlBoard = (Elde.ControlBoardDev)TbfComponents.FindComponent("CB", components); /// TODO: replace "CB"
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
-
- bitPosition = pumpCfg.BitPosition;
- Mask = (((UInt128)1) << bitPosition);
- Mask |= (((UInt128)1) << (bitPosition + 1));
-
- log.Warn(this.ToString());
}
- public void Initialize()
+ public override void Initialize()
{
- if (pumpCfg.DebugLevel == DebugMode.Simulate)
- {
- return;
- }
+ bitNr = pumpCfg.BitPosition;
+ Mask = (((UInt128)1) << bitNr);
+#if MUNICH
+ Mask |= (((UInt128)1) << (bitNr + 1));
+#endif
- string comPortName = "COM" + pumpCfg.ComPortNr.ToString();
- serialPort = new SerialPort(comPortName, pumpCfg.BaudRate, pumpCfg.Parity, pumpCfg.DataBits, pumpCfg.StopBits);
- serialPort.Handshake = Handshake.None;
- serialPort.Open();
- responseBuilder = new StringBuilder(40);
-
- log.FatalFormat("Successfully initialized device {0}", ToString());
- }
+ if (pumpCfg.DebugLevel == DebugMode.Normal)
+ {
+ string comPortName = "COM" + pumpCfg.ComPortNr.ToString();
+ serialPort = new SerialPort(comPortName, pumpCfg.BaudRate, pumpCfg.Parity, pumpCfg.DataBits, pumpCfg.StopBits);
+ serialPort.Handshake = Handshake.None;
+ serialPort.Open();
+ responseBuilder = new StringBuilder(40);
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ else
+ {
+ serialPort = null;
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ }
+ }
/// Run this device
public void RunDeviceBefore()
diff --git a/TBF/BenchControl/DataContainers/BackupAndSecurityOptions/Component.cs b/TBF/BenchControl/DataContainers/BackupAndSecurityOptions/Component.cs
index 5e8c00e23..7c7f747c6 100644
--- a/TBF/BenchControl/DataContainers/BackupAndSecurityOptions/Component.cs
+++ b/TBF/BenchControl/DataContainers/BackupAndSecurityOptions/Component.cs
@@ -12,26 +12,26 @@ namespace TBF.BenchControl.DataContainers.BackupAndSecurityOptions
public class Component : ComponentBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString() { return string.Format("{0}({1})", this.GetType().Namespace.Substring(32), Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly ComponentCfg myCfg;
public int MinPasswdLength { get { return myCfg.MinPasswdLength; } }
public int PasswdExpirationPeriodDays { get { return myCfg.PasswdExpirationPeriodDays; } }
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
myCfg = cfg as ComponentCfg;
+ }
+ public override void Initialize()
+ {
Users.GlobalData.MinPasswdLength = myCfg.MinPasswdLength;
Users.GlobalData.PasswdExpirationPeriodDays = myCfg.PasswdExpirationPeriodDays;
-
- log.Warn(this.ToString());
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
- }
+ }
}
diff --git a/TBF/BenchControl/DataContainers/BenchInfo/Extended/Component.cs b/TBF/BenchControl/DataContainers/BenchInfo/Extended/Component.cs
index 70408bcd7..42a87c148 100644
--- a/TBF/BenchControl/DataContainers/BenchInfo/Extended/Component.cs
+++ b/TBF/BenchControl/DataContainers/BenchInfo/Extended/Component.cs
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.DataContainers.BenchInfo.Extended
public class Component : ComponentBase, GenericDevices.IBenchInfo
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString() { return string.Format("BenchInfoEx({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly ComponentCfg myCfg;
@@ -30,16 +30,19 @@ namespace TBF.BenchControl.DataContainers.BenchInfo.Extended
public string Address5 { get { return myCfg.Address5; } }
public RemoteDBUse RemoteDBUse { get { return myCfg.RemoteDBUse; } }
- public Component()
- {
- }
+
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
myCfg = cfg as ComponentCfg;
- Events.DB.SetBenchName(myCfg.TestBenchName);
- log.Warn(this.ToString());
}
- }
+
+ public override void Initialize()
+ {
+ Events.DB.SetBenchName(myCfg.TestBenchName);
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ }
}
diff --git a/TBF/BenchControl/DataContainers/BenchInfo/iPerl/Component.cs b/TBF/BenchControl/DataContainers/BenchInfo/iPerl/Component.cs
index dbc9c6e24..c9a083429 100644
--- a/TBF/BenchControl/DataContainers/BenchInfo/iPerl/Component.cs
+++ b/TBF/BenchControl/DataContainers/BenchInfo/iPerl/Component.cs
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataContainers.BenchInfo.iPerl
public class Component : ComponentBase, GenericDevices.IBenchInfo, GenericDevices.IHasCalendarEvents
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString() { return string.Format("BenchInfo.iPerl({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly ComponentCfg myCfg;
@@ -33,16 +33,19 @@ namespace TBF.BenchControl.DataContainers.BenchInfo.iPerl
public Side Side { get { return myCfg.Side; } }
public int MaxTestIndex { get { return myCfg.MaxTestIndex; } } /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
- public Component()
- {
- }
+
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
myCfg = cfg as ComponentCfg;
+ }
+
+ public override void Initialize()
+ {
Events.DB.SetBenchName(myCfg.TestBenchName);
- log.Warn(this.ToString());
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
diff --git a/TBF/BenchControl/DataContainers/Buoyancy/Component.cs b/TBF/BenchControl/DataContainers/Buoyancy/Component.cs
index af159a5d0..9b0e057dd 100644
--- a/TBF/BenchControl/DataContainers/Buoyancy/Component.cs
+++ b/TBF/BenchControl/DataContainers/Buoyancy/Component.cs
@@ -14,27 +14,28 @@ namespace TBF.BenchControl.DataContainers.Buoyancy
public class Component : ComponentBase, GenericDevices.IHasCalendarEvents
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString() { return string.Format("{0}({1})", this.GetType().Namespace.Substring(32), Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly ComponentCfg myCfg;
public double Buoyancy { get { return myCfg.Buoyancy; } }
- public Component()
- {
- }
+
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
myCfg = cfg as ComponentCfg;
-
- /// This is to use data in formulas
- Config.Data.Buoyancy = Buoyancy;
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ Config.Data.Buoyancy = Buoyancy; /// This is to use Buoyancy from this component in formulas
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
public IList GetCalendarEvents()
{
DateTime calibrationDue = myCfg.CalibValidDate;
diff --git a/TBF/BenchControl/DataContainers/Density/Component.cs b/TBF/BenchControl/DataContainers/Density/Component.cs
index b3721b78e..3aacf99b3 100644
--- a/TBF/BenchControl/DataContainers/Density/Component.cs
+++ b/TBF/BenchControl/DataContainers/Density/Component.cs
@@ -14,29 +14,31 @@ namespace TBF.BenchControl.DataContainers.Density
public class Component : ComponentBase, GenericDevices.IHasCalendarEvents
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString() { return string.Format("{0}({1})", this.GetType().Namespace.Substring(32), Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly ComponentCfg myCfg;
public double RealDensity { get { return myCfg.RealDensity; } }
public double AtTemperature { get { return myCfg.AtTemperature; } }
- public Component()
- {
- }
+
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
myCfg = cfg as ComponentCfg;
+ }
- /// This is to use data in formulas
+ public override void Initialize()
+ {
+ /// This is to use sample density and temp. from this component in formulas
Config.Data.RealDensity = RealDensity;
Config.Data.AtTemperature = AtTemperature;
-
- log.Warn(this.ToString());
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
+
public IList GetCalendarEvents()
{
DateTime calibrationDue = myCfg.CalibValidDate;
diff --git a/TBF/BenchControl/DataContainers/Evaporation/Component.cs b/TBF/BenchControl/DataContainers/Evaporation/Component.cs
index 151ac75d3..1b76c43b1 100644
--- a/TBF/BenchControl/DataContainers/Evaporation/Component.cs
+++ b/TBF/BenchControl/DataContainers/Evaporation/Component.cs
@@ -13,14 +13,10 @@ namespace TBF.BenchControl.DataContainers.Evaporation
public class Component : ComponentBase, IEvaporation, GenericDevices.IHasCalendarEvents
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString()
- {
- return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
- }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly EvaporationCfg myCfg;
-
///
/// For a given temperature in [°C] returns an evaporation rate in [kg/s]
///
@@ -30,17 +26,20 @@ namespace TBF.BenchControl.DataContainers.Evaporation
}
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
myCfg = cfg as EvaporationCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
public IList GetCalendarEvents()
{
DateTime calibrationDue = myCfg.CalibValidDate;
diff --git a/TBF/BenchControl/DataEntry/Combined/EntryForm.cs b/TBF/BenchControl/DataEntry/Combined/EntryForm.cs
index 72c36b129..066e18305 100644
--- a/TBF/BenchControl/DataEntry/Combined/EntryForm.cs
+++ b/TBF/BenchControl/DataEntry/Combined/EntryForm.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataEntry.Combined
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasWMStatesForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
- public override string ToString() { return string.Format("DataEntry.Combined({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -60,25 +60,26 @@ namespace TBF.BenchControl.DataEntry.Combined
CurrentOp currentOp;
- public EntryForm()
- {
- }
+ public EntryForm() { }
public EntryForm(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
-
- disabled = new bool[Config.Data.CompoundWMsCount];
- wmStartState = new double[Config.Data.CompoundWMsCount * 2];
- wmStartStateStr = new string[Config.Data.CompoundWMsCount * 2];
- wmEndState = new double[Config.Data.CompoundWMsCount * 2];
- wmCycleEndState = new string[Config.Data.CompoundWMsCount * 2];
-
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ disabled = new bool[Config.Data.CompoundWMsCount];
+ wmStartState = new double[Config.Data.CompoundWMsCount * 2];
+ wmStartStateStr = new string[Config.Data.CompoundWMsCount * 2];
+ wmEndState = new double[Config.Data.CompoundWMsCount * 2];
+ wmCycleEndState = new string[Config.Data.CompoundWMsCount * 2];
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp()
{
diff --git a/TBF/BenchControl/DataEntry/Fewa/EntryFormNoStartEnd.cs b/TBF/BenchControl/DataEntry/Fewa/EntryFormNoStartEnd.cs
index 92a22d15f..b83f058d2 100644
--- a/TBF/BenchControl/DataEntry/Fewa/EntryFormNoStartEnd.cs
+++ b/TBF/BenchControl/DataEntry/Fewa/EntryFormNoStartEnd.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
public class EntryFormNoStartEnd : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryFormNoStartEnd));
- public override string ToString() { return string.Format("DataEntry.Standard24({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -60,25 +60,26 @@ namespace TBF.BenchControl.DataEntry.Fewa
CurrentOp currentOp;
- public EntryFormNoStartEnd()
- {
- }
+ public EntryFormNoStartEnd() { }
public EntryFormNoStartEnd(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
-
- disabled = new bool[Config.Data.WMsCount];
- wmStartState = new double[Config.Data.WMsCount];
- wmStartStateStr = new string[Config.Data.WMsCount];
- wmEndState = new double[Config.Data.WMsCount];
- wmCycleEndState = new string[Config.Data.WMsCount];
-
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ disabled = new bool[Config.Data.WMsCount];
+ wmStartState = new double[Config.Data.WMsCount];
+ wmStartStateStr = new string[Config.Data.WMsCount];
+ wmEndState = new double[Config.Data.WMsCount];
+ wmCycleEndState = new string[Config.Data.WMsCount];
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp()
{
diff --git a/TBF/BenchControl/DataEntry/HeatMeters12/EntryForm.cs b/TBF/BenchControl/DataEntry/HeatMeters12/EntryForm.cs
index cbe225635..68a521f92 100644
--- a/TBF/BenchControl/DataEntry/HeatMeters12/EntryForm.cs
+++ b/TBF/BenchControl/DataEntry/HeatMeters12/EntryForm.cs
@@ -13,10 +13,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasHeatMtrStatesForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
- public override string ToString()
- {
- return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
- }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -75,28 +72,29 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
CurrentOp currentOp;
- public EntryForm()
- {
- }
+ public EntryForm() { }
public EntryForm(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
+ }
+ public override void Initialize()
+ {
disabled = new bool[Config.Data.HeatMetersCount];
- wmStartState = new double[Config.Data.HeatMetersCount];
+ wmStartState = new double[Config.Data.HeatMetersCount];
wmStartStateStr = new string[Config.Data.HeatMetersCount];
- wmEndState = new double[Config.Data.HeatMetersCount];
+ wmEndState = new double[Config.Data.HeatMetersCount];
energyStartState = new double[Config.Data.HeatMetersCount];
energyStartStateStr = new string[Config.Data.HeatMetersCount];
energyEndState = new double[Config.Data.HeatMetersCount];
wmCycleEndState = new string[Config.Data.HeatMetersCount];
-
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp()
{
diff --git a/TBF/BenchControl/DataEntry/HeatMeters6/EntryForm.cs b/TBF/BenchControl/DataEntry/HeatMeters6/EntryForm.cs
index f547825c6..53216d533 100644
--- a/TBF/BenchControl/DataEntry/HeatMeters6/EntryForm.cs
+++ b/TBF/BenchControl/DataEntry/HeatMeters6/EntryForm.cs
@@ -13,10 +13,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasHeatMtrStatesForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
- public override string ToString()
- {
- return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
- }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -75,26 +72,26 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
CurrentOp currentOp;
- public EntryForm()
- {
- }
+ public EntryForm() { }
public EntryForm(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
+ }
+ public override void Initialize()
+ {
disabled = new bool[Config.Data.HeatMetersCount];
- wmStartState = new double[Config.Data.HeatMetersCount];
+ wmStartState = new double[Config.Data.HeatMetersCount];
wmStartStateStr = new string[Config.Data.HeatMetersCount];
- wmEndState = new double[Config.Data.HeatMetersCount];
+ wmEndState = new double[Config.Data.HeatMetersCount];
energyStartState = new double[Config.Data.HeatMetersCount];
energyStartStateStr = new string[Config.Data.HeatMetersCount];
energyEndState = new double[Config.Data.HeatMetersCount];
wmCycleEndState = new string[Config.Data.HeatMetersCount];
-
currentOp = CurrentOp.None;
- log.Warn(this.ToString());
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
/// Reference to the operation
diff --git a/TBF/BenchControl/DataEntry/Munich/EntryForm.cs b/TBF/BenchControl/DataEntry/Munich/EntryForm.cs
index 9ed6805b7..23e9dae30 100644
--- a/TBF/BenchControl/DataEntry/Munich/EntryForm.cs
+++ b/TBF/BenchControl/DataEntry/Munich/EntryForm.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataEntry.Munich
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
- public override string ToString() { return string.Format("DataEntry.Munich({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -55,22 +55,23 @@ namespace TBF.BenchControl.DataEntry.Munich
CurrentOp currentOp;
- public EntryForm()
- {
- }
+ public EntryForm() { }
public EntryForm(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
-
- serialNr = new string[Config.Data.CompoundWMsCount];
- wmEndState = new string[Config.Data.CompoundWMsCount];
-
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ serialNr = new string[Config.Data.CompoundWMsCount];
+ wmEndState = new string[Config.Data.CompoundWMsCount];
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp()
{
diff --git a/TBF/BenchControl/DataEntry/Munich3/EntryForm.cs b/TBF/BenchControl/DataEntry/Munich3/EntryForm.cs
index ff1c7979f..170e37d72 100644
--- a/TBF/BenchControl/DataEntry/Munich3/EntryForm.cs
+++ b/TBF/BenchControl/DataEntry/Munich3/EntryForm.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasWMStatesForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
- public override string ToString() { return string.Format("DataEntry.Munich3({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -64,26 +64,27 @@ namespace TBF.BenchControl.DataEntry.Munich3
CurrentOp currentOp;
- public EntryForm()
- {
- }
+ public EntryForm() { }
public EntryForm(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
-
- serialNr = new string[Config.Data.WMsCount];
- disabled = new bool[Config.Data.WMsCount];
- wmStartState = new double[Config.Data.WMsCount];
- wmStartStateStr = new string[Config.Data.WMsCount];
- wmEndState = new double[Config.Data.WMsCount];
- wmCycleEndState = new string[Config.Data.WMsCount];
-
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ serialNr = new string[Config.Data.WMsCount];
+ disabled = new bool[Config.Data.WMsCount];
+ wmStartState = new double[Config.Data.WMsCount];
+ wmStartStateStr = new string[Config.Data.WMsCount];
+ wmEndState = new double[Config.Data.WMsCount];
+ wmCycleEndState = new string[Config.Data.WMsCount];
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp()
{
diff --git a/TBF/BenchControl/DataEntry/S620/EntryForm.cs b/TBF/BenchControl/DataEntry/S620/EntryForm.cs
index aeff18e2d..811e5e10a 100644
--- a/TBF/BenchControl/DataEntry/S620/EntryForm.cs
+++ b/TBF/BenchControl/DataEntry/S620/EntryForm.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataEntry.S620
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm, IHasWMStatesForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
- public override string ToString() { return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -62,9 +62,7 @@ namespace TBF.BenchControl.DataEntry.S620
CurrentOp currentOp;
- public EntryForm()
- {
- }
+ public EntryForm() { }
public EntryForm(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -73,17 +71,20 @@ namespace TBF.BenchControl.DataEntry.S620
tracing = (TBF.BenchControl.Output.DB.ProductionTracing.Tracing)TbfComponents.FindComponent(cfg.ParentName, components);
if (tracing == null) throw new Exception("Cannot find " + Name + " parent");
-
- disabled = new bool[Config.Data.WMsCount];
- wmStartState = new double[Config.Data.WMsCount];
- wmStartStateStr = new string[Config.Data.WMsCount];
- wmEndState = new double[Config.Data.WMsCount];
- wmCycleEndState = new string[Config.Data.WMsCount];
-
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ disabled = new bool[Config.Data.WMsCount];
+ wmStartState = new double[Config.Data.WMsCount];
+ wmStartStateStr = new string[Config.Data.WMsCount];
+ wmEndState = new double[Config.Data.WMsCount];
+ wmCycleEndState = new string[Config.Data.WMsCount];
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp()
{
diff --git a/TBF/BenchControl/DataEntry/Single/EntryFormNoStartEnd.cs b/TBF/BenchControl/DataEntry/Single/EntryFormNoStartEnd.cs
index 9a2efcfd6..1055b7d4c 100644
--- a/TBF/BenchControl/DataEntry/Single/EntryFormNoStartEnd.cs
+++ b/TBF/BenchControl/DataEntry/Single/EntryFormNoStartEnd.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataEntry.Single
public class EntryFormNoStartEnd : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryFormNoStartEnd));
- public override string ToString() { return string.Format("DataEntry.Standard24({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -60,25 +60,26 @@ namespace TBF.BenchControl.DataEntry.Single
CurrentOp currentOp;
- public EntryFormNoStartEnd()
- {
- }
+ public EntryFormNoStartEnd() { }
public EntryFormNoStartEnd(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
-
- disabled = new bool[Config.Data.WMsCount];
- wmStartState = new double[Config.Data.WMsCount];
- wmStartStateStr = new string[Config.Data.WMsCount];
- wmEndState = new double[Config.Data.WMsCount];
- wmCycleEndState = new string[Config.Data.WMsCount];
-
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ disabled = new bool[Config.Data.WMsCount];
+ wmStartState = new double[Config.Data.WMsCount];
+ wmStartStateStr = new string[Config.Data.WMsCount];
+ wmEndState = new double[Config.Data.WMsCount];
+ wmCycleEndState = new string[Config.Data.WMsCount];
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp()
{
diff --git a/TBF/BenchControl/DataEntry/Standard12/EntryFormNoStartEnd.cs b/TBF/BenchControl/DataEntry/Standard12/EntryFormNoStartEnd.cs
index 78921f815..a61c06430 100644
--- a/TBF/BenchControl/DataEntry/Standard12/EntryFormNoStartEnd.cs
+++ b/TBF/BenchControl/DataEntry/Standard12/EntryFormNoStartEnd.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
public class EntryFormNoStartEnd : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryFormNoStartEnd));
- public override string ToString() { return string.Format("DataEntry.Standard12({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -60,25 +60,26 @@ namespace TBF.BenchControl.DataEntry.Standard12
CurrentOp currentOp;
- public EntryFormNoStartEnd()
- {
- }
+ public EntryFormNoStartEnd() { }
public EntryFormNoStartEnd(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
-
- disabled = new bool[Config.Data.WMsCount];
- wmStartState = new double[Config.Data.WMsCount];
- wmStartStateStr = new string[Config.Data.WMsCount];
- wmEndState = new double[Config.Data.WMsCount];
- wmCycleEndState = new string[Config.Data.WMsCount];
-
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ disabled = new bool[Config.Data.WMsCount];
+ wmStartState = new double[Config.Data.WMsCount];
+ wmStartStateStr = new string[Config.Data.WMsCount];
+ wmEndState = new double[Config.Data.WMsCount];
+ wmCycleEndState = new string[Config.Data.WMsCount];
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp()
{
diff --git a/TBF/BenchControl/DataEntry/Standard24/EntryFormNoStartEnd.cs b/TBF/BenchControl/DataEntry/Standard24/EntryFormNoStartEnd.cs
index 5a9bfead8..c451ff745 100644
--- a/TBF/BenchControl/DataEntry/Standard24/EntryFormNoStartEnd.cs
+++ b/TBF/BenchControl/DataEntry/Standard24/EntryFormNoStartEnd.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
public class EntryFormNoStartEnd : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryFormNoStartEnd));
- public override string ToString() { return string.Format("DataEntry.Standard24({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -60,25 +60,25 @@ namespace TBF.BenchControl.DataEntry.Standard24
CurrentOp currentOp;
- public EntryFormNoStartEnd()
- {
- }
+ public EntryFormNoStartEnd() { }
public EntryFormNoStartEnd(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
-
- disabled = new bool[Config.Data.WMsCount];
- wmStartState = new double[Config.Data.WMsCount];
- wmStartStateStr = new string[Config.Data.WMsCount];
- wmEndState = new double[Config.Data.WMsCount];
- wmCycleEndState = new string[Config.Data.WMsCount];
-
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ disabled = new bool[Config.Data.WMsCount];
+ wmStartState = new double[Config.Data.WMsCount];
+ wmStartStateStr = new string[Config.Data.WMsCount];
+ wmEndState = new double[Config.Data.WMsCount];
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp()
{
diff --git a/TBF/BenchControl/DataEntry/Standard48/EntryFormNoStartEnd.cs b/TBF/BenchControl/DataEntry/Standard48/EntryFormNoStartEnd.cs
index 6e073d4b8..4accb87ce 100644
--- a/TBF/BenchControl/DataEntry/Standard48/EntryFormNoStartEnd.cs
+++ b/TBF/BenchControl/DataEntry/Standard48/EntryFormNoStartEnd.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
public class EntryFormNoStartEnd : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryFormNoStartEnd));
- public override string ToString() { return string.Format("DataEntry.Standard48({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -60,25 +60,26 @@ namespace TBF.BenchControl.DataEntry.Standard48
CurrentOp currentOp;
- public EntryFormNoStartEnd()
- {
- }
+ public EntryFormNoStartEnd() { }
public EntryFormNoStartEnd(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
-
- disabled = new bool[Config.Data.WMsCount];
- wmStartState = new double[Config.Data.WMsCount];
- wmStartStateStr = new string[Config.Data.WMsCount];
- wmEndState = new double[Config.Data.WMsCount];
- wmCycleEndState = new string[Config.Data.WMsCount];
-
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ disabled = new bool[Config.Data.WMsCount];
+ wmStartState = new double[Config.Data.WMsCount];
+ wmStartStateStr = new string[Config.Data.WMsCount];
+ wmEndState = new double[Config.Data.WMsCount];
+ wmCycleEndState = new string[Config.Data.WMsCount];
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp()
{
diff --git a/TBF/BenchControl/DataEntry/Standard6/EntryFormNoStartEnd.cs b/TBF/BenchControl/DataEntry/Standard6/EntryFormNoStartEnd.cs
index 4bee3c4f9..64a13e8b5 100644
--- a/TBF/BenchControl/DataEntry/Standard6/EntryFormNoStartEnd.cs
+++ b/TBF/BenchControl/DataEntry/Standard6/EntryFormNoStartEnd.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
public class EntryFormNoStartEnd : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryFormNoStartEnd));
- public override string ToString() { return string.Format("DataEntry.Standard6({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -57,24 +57,25 @@ namespace TBF.BenchControl.DataEntry.Standard6
CurrentOp currentOp;
- public EntryFormNoStartEnd()
- {
- }
+ public EntryFormNoStartEnd() { }
public EntryFormNoStartEnd(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
-
- disabled = new bool[Config.Data.WMsCount];
- wmStartState = new double[Config.Data.WMsCount];
- wmStartStateStr = new string[Config.Data.WMsCount];
- wmEndState = new double[Config.Data.WMsCount];
-
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ disabled = new bool[Config.Data.WMsCount];
+ wmStartState = new double[Config.Data.WMsCount];
+ wmStartStateStr = new string[Config.Data.WMsCount];
+ wmEndState = new double[Config.Data.WMsCount];
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp()
{
diff --git a/TBF/BenchControl/DataEntry/StandardCamera/EntryForm.cs b/TBF/BenchControl/DataEntry/StandardCamera/EntryForm.cs
index f1276ce04..4c4a0f6f6 100644
--- a/TBF/BenchControl/DataEntry/StandardCamera/EntryForm.cs
+++ b/TBF/BenchControl/DataEntry/StandardCamera/EntryForm.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
public class EntryForm : ComponentBase, IOperation, IDataEntryForCamera, IHasWMStatesForm, IHasCycleBeginForm, IHasCycleEndForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
- public override string ToString() { return string.Format("DataEntry.Standard24({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly EntryFormCfg entryFormCfg;
@@ -110,25 +110,26 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
CurrentOp currentOp;
- public EntryForm()
- {
- }
+ public EntryForm() { }
public EntryForm(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
-
- disabled = new bool[Config.Data.WMsCount];
- wmStartState = new double[Config.Data.WMsCount];
- wmStartStateStr = new string[Config.Data.WMsCount];
- wmEndState = new double[Config.Data.WMsCount];
- wmCycleEndState = new string[Config.Data.WMsCount];
-
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ disabled = new bool[Config.Data.WMsCount];
+ wmStartState = new double[Config.Data.WMsCount];
+ wmStartStateStr = new string[Config.Data.WMsCount];
+ wmEndState = new double[Config.Data.WMsCount];
+ wmCycleEndState = new string[Config.Data.WMsCount];
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp()
{
diff --git a/TBF/BenchControl/DataEntry/WMStates/EntryForm.cs b/TBF/BenchControl/DataEntry/WMStates/EntryForm.cs
index 6638792de..e1398f572 100644
--- a/TBF/BenchControl/DataEntry/WMStates/EntryForm.cs
+++ b/TBF/BenchControl/DataEntry/WMStates/EntryForm.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataEntry.WMStates
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasWMStatesForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
- public override string ToString() { return string.Format("DataEntry.WMStates({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -62,19 +62,22 @@ namespace TBF.BenchControl.DataEntry.WMStates
CurrentOp currentOp;
- public EntryForm()
- {
- }
+ public EntryForm() { }
public EntryForm(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
- wmStartState = new double[Config.Data.WMsCount];
- currentOp = CurrentOp.None;
- log.Debug(this.ToString());
}
+ public override void Initialize()
+ {
+ wmStartState = new double[Config.Data.WMsCount];
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp(IList waterMeters)
{
diff --git a/TBF/BenchControl/DataEntry/iPerl/EntryForm.cs b/TBF/BenchControl/DataEntry/iPerl/EntryForm.cs
index 1c6d9cb8c..504412a8f 100644
--- a/TBF/BenchControl/DataEntry/iPerl/EntryForm.cs
+++ b/TBF/BenchControl/DataEntry/iPerl/EntryForm.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasWMStatesForm
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
- public override string ToString() { return string.Format("DataEntry.iPerl({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -59,25 +59,26 @@ namespace TBF.BenchControl.DataEntry.iPerl
CurrentOp currentOp;
- public EntryForm()
- {
- }
+ public EntryForm() { }
public EntryForm(Generic.IComponentCfg cfg)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
-
- disabled = new bool[Config.Data.WMsCount];
- wmStartState = new double[Config.Data.WMsCount];
- wmStartStateStr = new string[Config.Data.WMsCount];
- wmEndState = new double[Config.Data.WMsCount];
- wmCycleEndState = new string[Config.Data.WMsCount];
-
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ disabled = new bool[Config.Data.WMsCount];
+ wmStartState = new double[Config.Data.WMsCount];
+ wmStartStateStr = new string[Config.Data.WMsCount];
+ wmEndState = new double[Config.Data.WMsCount];
+ wmCycleEndState = new string[Config.Data.WMsCount];
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp()
{
diff --git a/TBF/BenchControl/Dummy/Balance/Component.cs b/TBF/BenchControl/Dummy/Balance/Component.cs
index 4b0406c30..e86d3cc21 100644
--- a/TBF/BenchControl/Dummy/Balance/Component.cs
+++ b/TBF/BenchControl/Dummy/Balance/Component.cs
@@ -12,20 +12,7 @@ namespace TBF.BenchControl.Dummy.Balance
public class Component : ComponentBase, IScale, IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString()
- {
- return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
- }
-
- public Component()
- {
- }
-
- public Component(Generic.IComponentCfg cfg)
- : base(cfg)
- {
- log.Warn(this.ToString());
- }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public int ScaleNr { get { return 0; } }
public double Capacity { get { return 10000.0; } }
@@ -40,6 +27,19 @@ namespace TBF.BenchControl.Dummy.Balance
public float BuoyancyPress { get { return 1.013f; } }
public float BuoyancyHumi { get { return 50.0f; } }
+
+ public Component() { }
+
+ public Component(Generic.IComponentCfg cfg)
+ : base(cfg)
+ {
+ }
+
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IOperation ZeroOp()
{
return this;
diff --git a/TBF/BenchControl/Dummy/Diverter/Component.cs b/TBF/BenchControl/Dummy/Diverter/Component.cs
index e1da3c807..4864cf8c2 100644
--- a/TBF/BenchControl/Dummy/Diverter/Component.cs
+++ b/TBF/BenchControl/Dummy/Diverter/Component.cs
@@ -13,37 +13,33 @@ namespace TBF.BenchControl.Dummy.Diverter
public class Component : ComponentBase, IDiverter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString()
- {
- return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
- }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
FloatBox switchTimeStart;
FloatBox switchTimeEnd;
public FloatBox SwitchTimeStart { get { return switchTimeStart; } }
public FloatBox SwitchTimeEnd { get { return switchTimeEnd; } }
- public Component()
- {
- }
-
- public Component(Generic.IComponentCfg cfg)
- : base(cfg)
- {
- switchTimeStart = new FloatBox();
- switchTimeEnd = new FloatBox();
- log.Warn(this.ToString());
- }
-
public int DiverterNr { get { return 0; } }
public bool State { get { return false; } }
public int ThresholdGate { get { return 50; } }
public int ThresholdLo { get { return 10; } }
public int ThresholdHi { get { return 90; } }
+ public double TestTimeCorrection(double flow) { return 0; }
- public double TestTimeCorrection(double flow)
+
+ public Component() { }
+
+ public Component(Generic.IComponentCfg cfg)
+ : base(cfg)
{
- return 0;
+ }
+
+ public override void Initialize()
+ {
+ switchTimeStart = new FloatBox();
+ switchTimeEnd = new FloatBox();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
}
}
diff --git a/TBF/BenchControl/Dummy/FlowMeter/FlowMeter.cs b/TBF/BenchControl/Dummy/FlowMeter/FlowMeter.cs
index 038451a76..884f0434c 100644
--- a/TBF/BenchControl/Dummy/FlowMeter/FlowMeter.cs
+++ b/TBF/BenchControl/Dummy/FlowMeter/FlowMeter.cs
@@ -11,12 +11,10 @@ namespace TBF.BenchControl.Dummy.FlowMeter
public class FlowMeter : ComponentBase, GenericDevices.IFlowMeter
{
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
- public override string ToString() { return string.Format("FlowMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly FlowMeterCfg flowMeterCfg;
-
public double NominalFlow { get { return flowMeterCfg.NominalFlow; } }
-
public double LtrPerPulse { get { return flowMeterCfg.NominalFlow / 7200.0f; } }
public double LtrPerPulseCorrected(double flow, int rangeIx)
@@ -27,18 +25,19 @@ namespace TBF.BenchControl.Dummy.FlowMeter
public int Idx1 { get { return 1; } }
- public FlowMeter()
- {
- }
+ public FlowMeter() { }
public FlowMeter(Generic.IComponentCfg cfg, IList components)
: base(cfg)
{
flowMeterCfg = cfg as FlowMeterCfg;
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public double ReadFlow() { return 1.23; }
public double ReadFrequency() { return 1.23 * 2000.0 / (double)NominalFlow; }
diff --git a/TBF/BenchControl/Dummy/RegulValve/RegulValve.cs b/TBF/BenchControl/Dummy/RegulValve/RegulValve.cs
index 46d0daf73..3dbbc37ff 100644
--- a/TBF/BenchControl/Dummy/RegulValve/RegulValve.cs
+++ b/TBF/BenchControl/Dummy/RegulValve/RegulValve.cs
@@ -8,10 +8,10 @@ using TBF.Boxes;
namespace TBF.BenchControl.Dummy.RegulValve
{
- public class RegulValve : ComponentBase, IDevice, GenericDevices.IRegulValve
+ public class RegulValve : ComponentBase, GenericDevices.IRegulValve
{
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
- public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public readonly RegulValveCfg RegulValveCfg;
@@ -27,24 +27,19 @@ namespace TBF.BenchControl.Dummy.RegulValve
public IDictionary Dict { get { return dict; } }
- public RegulValve()
- {
- }
+ public RegulValve() { }
public RegulValve(Generic.IComponentCfg cfg, IList components)
: base(cfg)
{
RegulValveCfg = cfg as RegulValveCfg;
- dict = new Dictionary();
-
- log.Warn(this.ToString());
}
- public void Initialize() { }
- public void RunDeviceBefore() { }
- public void RunDeviceAfter() { }
- public void StopDevice() { }
- public void StopDevice2() { }
+ public override void Initialize()
+ {
+ dict = new Dictionary();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
///
diff --git a/TBF/BenchControl/Dummy/Valve/Component.cs b/TBF/BenchControl/Dummy/Valve/Component.cs
index faa1c5a4a..375c3613b 100644
--- a/TBF/BenchControl/Dummy/Valve/Component.cs
+++ b/TBF/BenchControl/Dummy/Valve/Component.cs
@@ -12,29 +12,27 @@ namespace TBF.BenchControl.Dummy.Valve
public class Component : ComponentBase, IValve
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString()
- {
- return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
- }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
- public Component()
- {
- }
-
- public Component(Generic.IComponentCfg cfg)
- : base(cfg)
- {
- log.Warn(this.ToString());
- }
-
- bool state;
-
- public bool State { get { return state; } }
+ public bool State { get { return false; } }
public ValveCategory Category { get { return ValveCategory.None; } }
public int Delay { get { return 1; } }
public IValve CoupledTo { get { return null; } }
public bool InvertCouple { get { return false; } }
public int LagOpening { get { return 0; } }
public int LagClosing { get { return 0; } }
+
+
+ public Component() { }
+
+ public Component(Generic.IComponentCfg cfg)
+ : base(cfg)
+ {
+ }
+
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
}
}
diff --git a/TBF/BenchControl/Elde/ControlBoardDev.cs b/TBF/BenchControl/Elde/ControlBoardDev.cs
index 7169e2e5a..48a14fbac 100644
--- a/TBF/BenchControl/Elde/ControlBoardDev.cs
+++ b/TBF/BenchControl/Elde/ControlBoardDev.cs
@@ -16,7 +16,7 @@ namespace TBF.BenchControl.Elde
public class ControlBoardDev : ComponentBase, IDevice, IValveControl
{
private static readonly ILog log = LogManager.GetLogger(typeof(ControlBoardDev));
- public override string ToString() { return string.Format("ControlBoard({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
const int FiltersCount = 8;
@@ -167,7 +167,7 @@ namespace TBF.BenchControl.Elde
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
+ UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
int[] filters;
float[] FMFreq;
@@ -271,9 +271,8 @@ namespace TBF.BenchControl.Elde
controlCom.SetReservoirTemp(nr, temp);
}
- public ControlBoardDev()
- {
- }
+
+ public ControlBoardDev() { }
///
/// Constructor
@@ -282,29 +281,6 @@ namespace TBF.BenchControl.Elde
: base(cfg)
{
controlBoardCfg = cfg as ControlBoardCfg;
-
- cbCommandQueue = new Queue();
- lastSentFilters = new uint[FiltersCount];
-
-#if DN100 || FUZHOU_150 || MUNICH
- FMFreq = new float[2] { 0, 0 }; /// Nr. of pumps: Fuzhou150=2, Fuzhou300=6, newer=6
-#elif SLM_END || WARSAW_END
- FMFreq = new float[4] { 0, 0, 0, 0 };
-#else /// all newer benches
- FMFreq = new float[6] { 0, 0, 0, 0, 0, 0 };
-#endif
- emergencyStop = false;
- previousEmergencyStop = false;
-
- routeMask = 0;
- for (int i = 0; i < 128; i++)
- {
- if (i < controlBoardCfg.VirtualValvesRangeLo || i > controlBoardCfg.VirtualValvesRangeHi)
- {
- routeMask = routeMask | ((UInt128)1 << i);
- }
- }
-
log.Warn(this.ToString());
}
@@ -349,9 +325,31 @@ namespace TBF.BenchControl.Elde
}
/// Initialize this device
- public void Initialize()
+ public override void Initialize()
{
- int divertersCount = BenchControl.Elde.Diverter.Diverter.DivertersCount;
+ cbCommandQueue = new Queue();
+ lastSentFilters = new uint[FiltersCount];
+
+#if DN100 || FUZHOU_150 || MUNICH
+ FMFreq = new float[2] { 0, 0 }; /// Nr. of pumps: Fuzhou150=2, Fuzhou300=6, newer=6
+#elif SLM_END || WARSAW_END
+ FMFreq = new float[4] { 0, 0, 0, 0 };
+#else /// all newer benches
+ FMFreq = new float[6] { 0, 0, 0, 0, 0, 0 };
+#endif
+ emergencyStop = false;
+ previousEmergencyStop = false;
+
+ routeMask = 0;
+ for (int i = 0; i < 128; i++)
+ {
+ if (i < controlBoardCfg.VirtualValvesRangeLo || i > controlBoardCfg.VirtualValvesRangeHi)
+ {
+ routeMask = routeMask | ((UInt128)1 << i);
+ }
+ }
+
+ int divertersCount = BenchControl.Elde.Diverter.Diverter.DivertersCount;
DiverterEdge = new uint[divertersCount];
for (int i = 0; i < divertersCount; i++)
@@ -370,7 +368,7 @@ namespace TBF.BenchControl.Elde
BalanceRange,
MeretProtocol);
- log.FatalFormat("Successfully initialized device {0}", ToString());
+ log.FatalFormat("Device successfully initialized {0}", ToString());
}
///
diff --git a/TBF/BenchControl/Elde/CoverTest/CoverTest.cs b/TBF/BenchControl/Elde/CoverTest/CoverTest.cs
index 6f93738cd..83aa98f6a 100644
--- a/TBF/BenchControl/Elde/CoverTest/CoverTest.cs
+++ b/TBF/BenchControl/Elde/CoverTest/CoverTest.cs
@@ -15,20 +15,20 @@ namespace TBF.BenchControl.Elde.CoverTest
private static readonly ILog log = LogManager.GetLogger(typeof(CoverTest));
private static readonly ILog bypassLog = LogManager.GetLogger("BypassLog");
- public override string ToString() { return string.Format("CoverTest({0})", Cfg.ToString(1)); }
-
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
+
readonly CoverTestCfg coverTestCfg;
readonly ControlBoardDev controlBoard;
- readonly int bitPosition; /// 0 .. 63
- readonly ulong mask; /// derived from bitPosition in the constructor
- readonly ulong target;
- readonly string message;
- readonly Users.Entities.GID[] bypassLevel;
+
+ int bitPosition; /// 0 .. 127
+ ulong mask; /// derived from bitPosition in the constructor
+ ulong target;
+ string message;
+ Users.Entities.GID[] bypassLevel;
- public CoverTest()
- {
- }
+
+ public CoverTest() { }
public CoverTest(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -37,15 +37,17 @@ namespace TBF.BenchControl.Elde.CoverTest
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
+ }
+ public override void Initialize()
+ {
bitPosition = coverTestCfg.BitPosition;
mask = (((ulong)1) << coverTestCfg.BitPosition);
- target = coverTestCfg.Invert ? 0 : mask;
+ target = coverTestCfg.Invert ? 0 : mask;
message = coverTestCfg.Message;
bypassLevel = coverTestCfg.BypassLevel;
-
- log.Warn(this.ToString());
- }
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
public int ConditionsCount { get { return 1; } }
diff --git a/TBF/BenchControl/Elde/Diverter/Diverter.cs b/TBF/BenchControl/Elde/Diverter/Diverter.cs
index 86ba2ef2f..ae126eda3 100644
--- a/TBF/BenchControl/Elde/Diverter/Diverter.cs
+++ b/TBF/BenchControl/Elde/Diverter/Diverter.cs
@@ -14,38 +14,33 @@ namespace TBF.BenchControl.Elde.Diverter
public class Diverter : ComponentBase, IDevice, GenericDevices.IDiverter, GenericDevices.ISequenceCondition, GenericDevices.IHasCalendarEvents
{
private static readonly ILog log = LogManager.GetLogger(typeof(Diverter));
- public override string ToString() { return string.Format("Diverter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
-
- ///
- /// Enumeration of balances via static fields and methods
- ///
- static int nextIdx = 0;
- public static new void ResetStaticProperties()
- {
- nextIdx = 0;
- }
- public static int DivertersCount { get { return nextIdx; } }
- public static GenericDevices.IDiverter[] Diverters;
-
- readonly int diverterNr0; /// 0-based diverter number
- public int DiverterNr { get { return diverterNr0 + 1; } } /// 1-based public diverter number
-
- readonly DiverterCfg diverterCfg;
- readonly ControlBoardDev controlBoard;
- readonly UInt128 mask; /// derived from bitPosition in the constructor
+ readonly DiverterCfg diverterCfg;
public int AdcNr { get { return diverterCfg.AdcNr; } }
-
- readonly int flowMtrNr4Cmd;
- readonly IOperation diverterToTankOp;
- readonly IOperation diverterToSinkOp;
-
-
- public bool State { get { return (controlBoard.RRoute & mask) != 0; } }
public int ThresholdGate { get { return diverterCfg.StartingLevel; } }
public int ThresholdLo { get { return diverterCfg.ThresholdLo; } }
public int ThresholdHi { get { return diverterCfg.ThresholdHi; } }
+ readonly ControlBoardDev controlBoard;
+ public bool State { get { return (controlBoard.RRoute & mask) != 0; } }
+
+ ///
+ /// Enumeration of balances via static fields and methods
+ ///
+ static int nextIdx = 0;
+ public static int DivertersCount { get { return nextIdx; } }
+ public static GenericDevices.IDiverter[] Diverters;
+ ///
+ int diverterNr0; /// 0-based diverter number assigned in Initialize()
+ public int DiverterNr { get { return diverterNr0 + 1; } } /// 1-based public diverter number
+
+ UInt128 mask; /// derived from bitPosition in the constructor
+ int flowMtrNr4Cmd;
+ IOperation diverterToTankOp;
+ IOperation diverterToSinkOp;
+
+
FloatBox switchTimeStart;
FloatBox switchTimeEnd;
public FloatBox SwitchTimeStart { get { return switchTimeStart; } }
@@ -60,98 +55,97 @@ namespace TBF.BenchControl.Elde.Diverter
}
- public Diverter()
- {
- }
+ public Diverter() { }
public Diverter(Generic.IComponentCfg cfg, IList components)
: base(cfg)
{
diverterCfg = cfg as DiverterCfg;
- if (cfg.DebugLevel != Config.Entities.DebugMode.Off)
+ controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
+ if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
+
+ /// Prepare data for SendCalibData() control board component method
+ if (diverterCfg.AdcNr >= 0 && diverterCfg.AdcNr < controlBoard.RegValveCalib.GetLength(0))
{
- controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
- if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
-
- if (diverterCfg.BitPosition < 0 || diverterCfg.BitPosition >= 64) throw new ArgumentOutOfRangeException("position");
- this.mask = (((UInt128)1) << diverterCfg.BitPosition);
-
- switchTimeStart = new FloatBox(diverterCfg.DfltSwithTimeStartMs / 1000.0f);
- switchTimeEnd = new FloatBox(diverterCfg.DfltSwithTimeEndMs / 1000.0f);
-
- diverterNr0 = nextIdx++;
- ///
- if (Diverters == null || Diverters.Length < nextIdx)
- {
- GenericDevices.IDiverter[] divertersSoFar = Diverters;
-
- Diverters = new GenericDevices.IDiverter[nextIdx];
-
- if (divertersSoFar != null)
- {
- for (int i = 0; i < divertersSoFar.Length; i++) Diverters[i] = divertersSoFar[i];
-
- }
-
- Diverters[nextIdx - 1] = this;
- }
-
- /// Prepare arguments of SendCalibData()
- if (diverterCfg.AdcNr >= 0 && diverterCfg.AdcNr < controlBoard.RegValveCalib.GetLength(0))
- {
- controlBoard.RegValveCalib[diverterCfg.AdcNr, 0] = (uint)diverterCfg.AdcValueToSink;
- controlBoard.RegValveCalib[diverterCfg.AdcNr, 1] = (uint)diverterCfg.AdcValueToTank;
- }
- else
- {
- log.ErrorFormat("Unable to set {0} ADC levels: RegValveCalib array size={1}, diverter AdcNr={2}",
- Name, controlBoard.RegValveCalib.GetLength(0), diverterCfg.AdcNr);
- }
-
-
- int divNrFromName;
- if (!int.TryParse(Name.Substring(3), out divNrFromName))
- {
- divNrFromName = nextIdx;
- }
-#if FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || GENESIS || PETERSBURG_50 || PETERSBURG_200 || ROMA_200 || SLM_150
- flowMtrNr4Cmd = divNrFromName + 1;
-#elif BADGER_STREDNA_TRAT
- flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : ((divNrFromName == 2) ? 9 : 20);
-#elif BADGER_VELKA_TRAT
- flowMtrNr4Cmd = ((divNrFromName % 10) == 1) ? 0x11 : (((divNrFromName % 10) == 2) ? 0x22 : 0x33);
-#elif CEVAK_200
- flowMtrNr4Cmd = (divNrFromName == 4) ? 5 : divNrFromName;
-#elif DEWA_300 || PUCHONG_200
- flowMtrNr4Cmd = divNrFromName + 2; /// Div1: 1,2,3, Div2: 4, Div3: 5, Div4: 6, Div5: 7
-#elif FILIPINY_50
- flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : 7;
-#elif FUZHOU_100
- flowMtrNr4Cmd = divNrFromName;
-#elif GELSENWASSER
- switch (divNrFromName)
- {
- default:
- case 1: flowMtrNr4Cmd = 1; break;
- case 2: flowMtrNr4Cmd = 0x12; break;
- case 3: flowMtrNr4Cmd = 3; break;
- case 4: flowMtrNr4Cmd = 5; break;
- }
-#elif TURA_IPERL || TURA_IPERL_NEW
- flowMtrNr4Cmd = divNrFromName + 16 * divNrFromName;
-#elif MILWAUKEE
- flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : 68;
-#else /// all other benches
- flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : 3;
-#endif
- diverterToTankOp = new SwitchDiverterOp(controlBoard, true, flowMtrNr4Cmd);
- diverterToSinkOp = new SwitchDiverterOp(controlBoard, false, flowMtrNr4Cmd);
-
- log.Warn(this.ToString());
+ controlBoard.RegValveCalib[diverterCfg.AdcNr, 0] = (uint)diverterCfg.AdcValueToSink;
+ controlBoard.RegValveCalib[diverterCfg.AdcNr, 1] = (uint)diverterCfg.AdcValueToTank;
+ }
+ else
+ {
+ log.ErrorFormat("Unable to set {0} ADC levels: RegValveCalib array size={1}, diverter AdcNr={2}",
+ Name, controlBoard.RegValveCalib.GetLength(0), diverterCfg.AdcNr);
}
}
+ public override void Initialize()
+ {
+ if (diverterCfg.BitPosition < 0 || diverterCfg.BitPosition >= 127) throw new ArgumentOutOfRangeException("position");
+ mask = (((UInt128)1) << diverterCfg.BitPosition);
+
+ switchTimeStart = new FloatBox(diverterCfg.DfltSwithTimeStartMs / 1000.0f);
+ switchTimeEnd = new FloatBox(diverterCfg.DfltSwithTimeEndMs / 1000.0f);
+
+ diverterNr0 = nextIdx++;
+ ///
+ if (Diverters == null || Diverters.Length < nextIdx)
+ {
+ GenericDevices.IDiverter[] divertersSoFar = Diverters;
+
+ Diverters = new GenericDevices.IDiverter[nextIdx];
+
+ if (divertersSoFar != null)
+ {
+ for (int i = 0; i < divertersSoFar.Length; i++) Diverters[i] = divertersSoFar[i];
+
+ }
+
+ Diverters[nextIdx - 1] = this;
+ }
+
+ int divNrFromName;
+ if (!int.TryParse(Name.Substring(3), out divNrFromName))
+ {
+ divNrFromName = nextIdx;
+ }
+
+#if FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || GENESIS || PETERSBURG_50 || PETERSBURG_200 || ROMA_200 || SLM_150
+ flowMtrNr4Cmd = divNrFromName + 1;
+#elif BADGER_STREDNA_TRAT
+ flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : ((divNrFromName == 2) ? 9 : 20);
+#elif BADGER_VELKA_TRAT
+ flowMtrNr4Cmd = ((divNrFromName % 10) == 1) ? 0x11 : (((divNrFromName % 10) == 2) ? 0x22 : 0x33);
+#elif CEVAK_200
+ flowMtrNr4Cmd = (divNrFromName == 4) ? 5 : divNrFromName;
+#elif DEWA_300 || PUCHONG_200
+ flowMtrNr4Cmd = divNrFromName + 2; /// Div1: 1,2,3, Div2: 4, Div3: 5, Div4: 6, Div5: 7
+#elif FILIPINY_50
+ flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : 7;
+#elif FUZHOU_100
+ flowMtrNr4Cmd = divNrFromName;
+#elif GELSENWASSER
+ switch (divNrFromName)
+ {
+ default:
+ case 1: flowMtrNr4Cmd = 1; break;
+ case 2: flowMtrNr4Cmd = 0x12; break;
+ case 3: flowMtrNr4Cmd = 3; break;
+ case 4: flowMtrNr4Cmd = 5; break;
+ }
+#elif TURA_IPERL || TURA_IPERL_NEW
+ flowMtrNr4Cmd = divNrFromName + 16 * divNrFromName;
+#elif MILWAUKEE
+ flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : 68;
+#else /// all other benches
+ flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : 3;
+#endif
+
+ diverterToTankOp = new SwitchDiverterOp(controlBoard, true, flowMtrNr4Cmd);
+ diverterToSinkOp = new SwitchDiverterOp(controlBoard, false, flowMtrNr4Cmd);
+
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
///
/// Calendar support
///
@@ -186,11 +180,9 @@ namespace TBF.BenchControl.Elde.Diverter
return calendarEvents;
}
-
///
/// IDevice interface implementation
///
- public void Initialize() { }
public void RunDeviceBefore()
{
int adcValue = (int)StateMachine.ControlBoard.AnalogInputRaw(diverterCfg.AdcNr, 0);
diff --git a/TBF/BenchControl/Elde/FixedStartRegisterReader/RegisterReader.cs b/TBF/BenchControl/Elde/FixedStartRegisterReader/RegisterReader.cs
index b572f2820..1c76056d1 100644
--- a/TBF/BenchControl/Elde/FixedStartRegisterReader/RegisterReader.cs
+++ b/TBF/BenchControl/Elde/FixedStartRegisterReader/RegisterReader.cs
@@ -11,7 +11,7 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
public class RegisterReader : ComponentBase, GenericDevices.IRegReader, IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(RegisterReader));
- public override string ToString() { return string.Format("FixedStartRegisterReader({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly RegisterReaderCfg registerReaderCfg;
readonly ControlBoardDev controlBoard;
@@ -54,9 +54,7 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
- public RegisterReader()
- {
- }
+ public RegisterReader() { }
public RegisterReader(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -66,12 +64,15 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
/// Control board is used to read reference flowmeter pulses
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
-
- Clear();
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ Clear();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
public void Clear()
{
log.DebugFormat("{0}:Clear()", Name);
diff --git a/TBF/BenchControl/Elde/FlowMeter/FlowMeter.cs b/TBF/BenchControl/Elde/FlowMeter/FlowMeter.cs
index 246463a99..23b55ea7b 100644
--- a/TBF/BenchControl/Elde/FlowMeter/FlowMeter.cs
+++ b/TBF/BenchControl/Elde/FlowMeter/FlowMeter.cs
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
public class FlowMeter : ComponentBase, Generic.IDevice, GenericDevices.IFlowMeter, GenericDevices.IHasCalendarEvents
{
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
- public override string ToString() { return string.Format("FlowMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly FlowMeterCfg flowMeterCfg;
readonly ControlBoardDev controlBoard;
@@ -41,9 +41,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
public double GetPressHi(int ix) { return flowMeterCfg.GetPressHi(ix); }
- public FlowMeter()
- {
- }
+ public FlowMeter() { }
public FlowMeter(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -58,14 +56,12 @@ namespace TBF.BenchControl.Elde.FlowMeter
{
controlBoard.EtCalib[Idx1] = (float)flowMeterCfg.NominalFlow;
}
-
- log.Warn(this.ToString());
}
///
/// IDevice interface functions
///
- public void Initialize()
+ public override void Initialize()
{
for (int r = 0; r <= 5; r++)
{
@@ -76,8 +72,9 @@ namespace TBF.BenchControl.Elde.FlowMeter
}
}
- log.FatalFormat("Successfully initialized device {0}", Name);
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
+
public void RunDeviceBefore() { }
public void RunDeviceAfter() { }
public void StopDevice() { }
diff --git a/TBF/BenchControl/Elde/FlowMeterDewa/FlowMeter.cs b/TBF/BenchControl/Elde/FlowMeterDewa/FlowMeter.cs
index 97a703ed3..0e727607f 100644
--- a/TBF/BenchControl/Elde/FlowMeterDewa/FlowMeter.cs
+++ b/TBF/BenchControl/Elde/FlowMeterDewa/FlowMeter.cs
@@ -12,17 +12,17 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
public class FlowMeter : ComponentBase, IFlowMeter
{
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
- public override string ToString() { return string.Format("FlowMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly FlowMeterCfg flowMeterCfg;
readonly ControlBoardDev controlBoard;
readonly IFlowMeter flowMeter1;
readonly IFlowMeter flowMeter2;
readonly IFlowMeter flowMeter3;
- readonly double nominalFlow;
- readonly double ltrPerPulse;
- readonly int flowMetersCount;
- readonly int flowMetersBitfield;
+ double nominalFlow;
+ double ltrPerPulse;
+ int flowMetersCount;
+ int flowMetersBitfield;
public int Idx1 { get { return flowMetersBitfield; } }
public double NominalFlow { get { return nominalFlow; } }
@@ -99,11 +99,7 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
public double GetPressHi(int ix) { return flowMeterCfg.GetPressHi(ix); }
- public FlowMeter()
- {
- refFreq = new double[4];
- refPulses = new int[4];
- }
+ public FlowMeter() { }
public FlowMeter(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -116,6 +112,12 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
if (!string.IsNullOrEmpty(flowMeterCfg.Flowmeter1)) flowMeter1 = TbfComponents.FindComponent(flowMeterCfg.Flowmeter1, components) as IFlowMeter;
if (!string.IsNullOrEmpty(flowMeterCfg.Flowmeter2)) flowMeter2 = TbfComponents.FindComponent(flowMeterCfg.Flowmeter2, components) as IFlowMeter;
if (!string.IsNullOrEmpty(flowMeterCfg.Flowmeter3)) flowMeter3 = TbfComponents.FindComponent(flowMeterCfg.Flowmeter3, components) as IFlowMeter;
+ }
+
+ public override void Initialize()
+ {
+ refFreq = new double[4];
+ refPulses = new int[4];
nominalFlow = 0;
flowMetersCount = 0;
@@ -126,11 +128,9 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
if (flowMetersCount == 0) throw new Exception("Missing flowmeters");
ltrPerPulse = nominalFlow / (flowMetersCount * 7200.0); /// Nominal freq. is flowMetersCount * 2000 Hz (2000, 4000 or 6000 Hz)
- refFreq = new double[4];
- refPulses = new int[4];
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
- log.Warn(this.ToString());
- }
public double ReadFlow() { return controlBoard.ReferenceFlow; }
public double ReadFrequency() { return controlBoard.ReferenceFreq; }
diff --git a/TBF/BenchControl/Elde/FlowMeterTriplet/FlowMeter.cs b/TBF/BenchControl/Elde/FlowMeterTriplet/FlowMeter.cs
index 7a061e78d..8859483eb 100644
--- a/TBF/BenchControl/Elde/FlowMeterTriplet/FlowMeter.cs
+++ b/TBF/BenchControl/Elde/FlowMeterTriplet/FlowMeter.cs
@@ -11,7 +11,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
public class FlowMeter : ComponentBase, GenericDevices.IFlowMeter
{
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
- public override string ToString() { return string.Format("FlowMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly FlowMeterCfg flowMeterCfg;
readonly ControlBoardDev controlBoard;
@@ -27,9 +27,8 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
return (LtrPerPulse * correctedFlow / flow);
}
- public FlowMeter()
- {
- }
+
+ public FlowMeter() { }
public FlowMeter(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -42,9 +41,13 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
/// Prepare data for SendCalibData() control board component method
if (Idx1 >= controlBoard.EtCalib.Length) throw new Exception("Flowmeter " + Name + " parameter 'Idx1' is out of range");
controlBoard.EtCalib[Idx1] = (float)flowMeterCfg.NominalFlow;
-
- log.Warn(this.ToString());
}
+
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public double ReadFlow() { return controlBoard.ReferenceFlow; }
public double ReadFrequency() { return controlBoard.ReferenceFreq; }
diff --git a/TBF/BenchControl/Elde/FlowMeterTwins/FlowMeter.cs b/TBF/BenchControl/Elde/FlowMeterTwins/FlowMeter.cs
index d2d79e665..6ba88da45 100644
--- a/TBF/BenchControl/Elde/FlowMeterTwins/FlowMeter.cs
+++ b/TBF/BenchControl/Elde/FlowMeterTwins/FlowMeter.cs
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
public class FlowMeter : ComponentBase, GenericDevices.IFlowMeter
{
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
- public override string ToString() { return string.Format("FlowMeterTwins({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly FlowMeterCfg flowMeterCfg;
readonly ControlBoardDev controlBoard;
@@ -33,9 +33,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
}
- public FlowMeter()
- {
- }
+ public FlowMeter() { }
public FlowMeter(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -51,13 +49,16 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
FlowMeter2 = TbfComponents.FindComponent(flowMeterCfg.FlowMeter2, components) as Elde.FlowMeter.FlowMeter;
if (FlowMeter2 == null) throw new Exception("Cannot find FlowMeter2 component");
+ /// Prepare data for SendCalibData() control board component method
controlBoard.EtCalib[Idx1] = (float)flowMeterCfg.NominalFlow; /// Idx1==0 for FlowMeterTwins
-
- /// Prepare data for SendCalibData() control board component method
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
public double ReadFlow() { return controlBoard.ReferenceFlow; }
public double ReadFrequency() { return controlBoard.ReferenceFreq; }
diff --git a/TBF/BenchControl/Elde/PressureMeter/PressureMeter.cs b/TBF/BenchControl/Elde/PressureMeter/PressureMeter.cs
index d9d41b59c..09e9cc875 100644
--- a/TBF/BenchControl/Elde/PressureMeter/PressureMeter.cs
+++ b/TBF/BenchControl/Elde/PressureMeter/PressureMeter.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter, GenericDevices.IHasCalendarEvents
{
private static readonly ILog log = LogManager.GetLogger(typeof(PressureMeter));
- public override string ToString() { return string.Format("PressureMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly PressureMeterCfg pressureMeterCfg;
@@ -22,9 +22,8 @@ namespace TBF.BenchControl.Elde.PressureMeter
public readonly int Idx0; /// 0..3
public readonly byte RS485Address; /// 0..255
- public PressureMeter()
- {
- }
+
+ public PressureMeter() { }
public PressureMeter(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -48,10 +47,13 @@ namespace TBF.BenchControl.Elde.PressureMeter
{
ControlBoard.MeretProtocol |= (byte)(1 << Idx0);
}
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList GetCalendarEvents()
{
diff --git a/TBF/BenchControl/Elde/PressureMeterInternal/PressureMeter.cs b/TBF/BenchControl/Elde/PressureMeterInternal/PressureMeter.cs
index 74ef397b0..3919d2cb0 100644
--- a/TBF/BenchControl/Elde/PressureMeterInternal/PressureMeter.cs
+++ b/TBF/BenchControl/Elde/PressureMeterInternal/PressureMeter.cs
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter, GenericDevices.IHasCalendarEvents
{
private static readonly ILog log = LogManager.GetLogger(typeof(PressureMeter));
- public override string ToString() { return string.Format("PressureMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly PressureMeterCfg pressureMeterCfg;
@@ -22,9 +22,8 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
public int Idx0 { get { return pressureMeterCfg.Idx0; } } /// 0..7
- public PressureMeter()
- {
- }
+
+ public PressureMeter() { }
public PressureMeter(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -42,9 +41,13 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
ControlBoard.TempCalibData[pressureMeterCfg.CoefsIdx0, 4] = pressureMeterCfg.A5;
ControlBoard.MeretRS485Address[0] = 0; /// This disables Merets, Groch temperatures, enables on-board A/D pressure and temperature
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList GetCalendarEvents()
{
diff --git a/TBF/BenchControl/Elde/Pump/Pump.cs b/TBF/BenchControl/Elde/Pump/Pump.cs
index eb6644a44..b06425e4b 100644
--- a/TBF/BenchControl/Elde/Pump/Pump.cs
+++ b/TBF/BenchControl/Elde/Pump/Pump.cs
@@ -11,7 +11,7 @@ namespace TBF.BenchControl.Elde.Pump
public class Pump : ComponentBase, GenericDevices.IPump, GenericDevices.IValve
{
private static readonly ILog log = LogManager.GetLogger(typeof(Pump));
- public override string ToString() { return string.Format("Pump({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly PumpCfg pumpCfg;
@@ -27,15 +27,12 @@ namespace TBF.BenchControl.Elde.Pump
public float Power { get { return State ? 100.0f : 0; } }
- readonly ControlBoardDev controlBoard;
- readonly int bitPosition; /// 0 .. 127
-
- public readonly UInt128 Mask; /// derived from bitPosition in the constructor
+ ControlBoardDev controlBoard;
+ int bitNr; /// 0 .. 127
+ public UInt128 Mask; /// derived from bitPosition
- public Pump()
- {
- }
+ public Pump() { }
public Pump(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -44,13 +41,15 @@ namespace TBF.BenchControl.Elde.Pump
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
-
- bitPosition = pumpCfg.BitPosition;
- Mask = (((UInt128)1) << pumpCfg.BitPosition);
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ bitNr = pumpCfg.BitPosition;
+ Mask = (((UInt128)1) << pumpCfg.BitPosition);
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public bool State
{
get { return (controlBoard.Route & Mask) != 0; }
diff --git a/TBF/BenchControl/Elde/PumpTandem/Pump.cs b/TBF/BenchControl/Elde/PumpTandem/Pump.cs
index 965cd3a9c..6cd71c257 100644
--- a/TBF/BenchControl/Elde/PumpTandem/Pump.cs
+++ b/TBF/BenchControl/Elde/PumpTandem/Pump.cs
@@ -11,15 +11,15 @@ namespace TBF.BenchControl.Elde.PumpTandem
public class Pump : ComponentBase, GenericDevices.IPumpFM, GenericDevices.IValve, IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(Pump));
- public override string ToString() { return string.Format("PumpTandem({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly PumpCfg pumpCfg;
readonly GenericDevices.IPump pump1;
readonly GenericDevices.IPump pump2;
- readonly GenericDevices.IPumpFM pumpFm1;
- readonly GenericDevices.IPumpFM pumpFm2;
+ GenericDevices.IPumpFM pumpFm1;
+ GenericDevices.IPumpFM pumpFm2;
public bool State { get { return pump1.State || pump2.State; } }
public int Delay { get { return Math.Max(pump1.Delay, pump2.Delay); } }
@@ -37,15 +37,12 @@ namespace TBF.BenchControl.Elde.PumpTandem
get { return (pump1.Power + pump2.Power) / 2.0f; }
}
-
- readonly UInt128 mask1;
- readonly UInt128 mask2;
+ UInt128 mask1;
+ UInt128 mask2;
public UInt128 Mask { get { return mask1 | mask2; } } /// derived from masks of two pumps
- public Pump()
- {
- }
+ public Pump() { }
public Pump(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -57,23 +54,26 @@ namespace TBF.BenchControl.Elde.PumpTandem
pump2 = (GenericDevices.IPump)TbfComponents.FindComponent(pumpCfg.Pump2, components);
if (pump2 == null) throw new Exception("Cannot find component Pump 2");
-
- pumpFm1 = pump1 as GenericDevices.IPumpFM;
- pumpFm2 = pump2 as GenericDevices.IPumpFM;
-
- if (pump1 is Elde.Pump.Pump) { mask1 = (pump1 as Elde.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; }
- 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; }
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ pumpFm1 = pump1 as GenericDevices.IPumpFM;
+ pumpFm2 = pump2 as GenericDevices.IPumpFM;
+
+ if (pump1 is Elde.Pump.Pump) { mask1 = (pump1 as Elde.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; }
+ 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; }
+
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public void TurnOn(float powerArg)
{
diff --git a/TBF/BenchControl/Elde/PumpWithFM/Pump.cs b/TBF/BenchControl/Elde/PumpWithFM/Pump.cs
index 047ee61cc..b2dbad0cf 100644
--- a/TBF/BenchControl/Elde/PumpWithFM/Pump.cs
+++ b/TBF/BenchControl/Elde/PumpWithFM/Pump.cs
@@ -11,7 +11,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
public class Pump : ComponentBase, GenericDevices.IPumpFM, GenericDevices.IValve, IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(Pump));
- public override string ToString() { return string.Format("PumpWithFM({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly PumpCfg pumpCfg;
@@ -23,10 +23,10 @@ namespace TBF.BenchControl.Elde.PumpWithFM
public int LagClosing { get { return 0; } }
readonly ControlBoardDev controlBoard;
- readonly int bitPosition; /// 0 .. 63
- int FMIndex; /// 0 .. FMPumpsCount-1
- public readonly UInt128 Mask; /// derived from bitPosition in the constructor
+ int bitNr; /// 0 .. 127
+ int FMIndex; /// 0 .. FMPumpsCount-1
+ public UInt128 Mask; /// derived from bitPosition in the constructor
public bool State
{
@@ -43,9 +43,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
}
- public Pump()
- {
- }
+ public Pump() { }
///
/// Constructor
@@ -59,13 +57,15 @@ namespace TBF.BenchControl.Elde.PumpWithFM
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
+ }
- bitPosition = pumpCfg.BitPosition;
+ public override void Initialize()
+ {
+ bitNr = pumpCfg.BitPosition;
Mask = (((UInt128)1) << pumpCfg.BitPosition);
FMIndex = pumpCfg.FMIndex;
-
- log.Warn(this.ToString());
- }
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
public void TurnOn(float powerArg)
diff --git a/TBF/BenchControl/Elde/RegulValve/RegulValve.cs b/TBF/BenchControl/Elde/RegulValve/RegulValve.cs
index b1996ca06..a4271405d 100644
--- a/TBF/BenchControl/Elde/RegulValve/RegulValve.cs
+++ b/TBF/BenchControl/Elde/RegulValve/RegulValve.cs
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.Elde.RegulValve
public class RegulValve : ComponentBase, IDevice, GenericDevices.IRegulValve
{
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
- public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public readonly RegulValveCfg RegulValveCfg;
@@ -83,9 +83,7 @@ namespace TBF.BenchControl.Elde.RegulValve
#endregion Configuration Change Handling
- public RegulValve()
- {
- }
+ public RegulValve() { }
public RegulValve(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -95,7 +93,6 @@ namespace TBF.BenchControl.Elde.RegulValve
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
- this.dict = new Dictionary();
#if GENESIS
adcChannel = (Idx1 < 6) ? (Idx1 - 1) : (Idx1 - 2);
@@ -109,7 +106,8 @@ namespace TBF.BenchControl.Elde.RegulValve
adcChannel = Idx1 - 1;
#endif
- if (Idx1 < ControlBoard.RegValveCalib.GetLength(0))
+ /// Prepare data for SendCalibData() control board component method
+ if (Idx1 < ControlBoard.RegValveCalib.GetLength(0))
{
this.ControlBoard.RegValveCalib[adcChannel, 0] = (uint)DacValueClosed;
this.ControlBoard.RegValveCalib[adcChannel, 1] = (uint)DacValueOpen;
@@ -119,17 +117,18 @@ namespace TBF.BenchControl.Elde.RegulValve
log.ErrorFormat("Unable to set {0} ADC levels: RegValveCalib array size={1}, RV Idx1={2}, RV AdcNr={3}",
Name, ControlBoard.RegValveCalib.GetLength(0), Idx1, Idx1 - 1);
}
-
- StartChangeHandler();
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ this.dict = new Dictionary();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
///
/// IDevice interface implementation
///
- public void Initialize() { }
public void RunDeviceBefore()
{
int adcValue = (int)ControlBoard.AnalogInputRaw(adcChannel, 0);
diff --git a/TBF/BenchControl/Elde/RegulValveCoax/RegulValve.cs b/TBF/BenchControl/Elde/RegulValveCoax/RegulValve.cs
index bfdf4e21f..c0ba9c122 100644
--- a/TBF/BenchControl/Elde/RegulValveCoax/RegulValve.cs
+++ b/TBF/BenchControl/Elde/RegulValveCoax/RegulValve.cs
@@ -11,7 +11,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
public class RegulValve : ComponentBase, GenericDevices.IRegulValve
{
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
- public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public readonly RegulValveCfg RegulValveCfg;
@@ -31,9 +31,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
public float Position { get { return ControlBoard.RValvePosition(Idx1); } }
- public RegulValve()
- {
- }
+ public RegulValve() { }
public RegulValve(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -42,12 +40,14 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
-
- this.dict = new Dictionary();
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ dict = new Dictionary();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
///
/// Operation to set the water flow within tolerances
diff --git a/TBF/BenchControl/Elde/RegulValveMilwaukee/RegulValve.cs b/TBF/BenchControl/Elde/RegulValveMilwaukee/RegulValve.cs
index 0c478d74c..0bceebe8e 100644
--- a/TBF/BenchControl/Elde/RegulValveMilwaukee/RegulValve.cs
+++ b/TBF/BenchControl/Elde/RegulValveMilwaukee/RegulValve.cs
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.Elde.RegulValveMilwaukee
public class RegulValve : ComponentBase, IDevice, GenericDevices.IRegulValve
{
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
- public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public readonly RegulValveCfg RegulValveCfg;
@@ -83,9 +83,7 @@ namespace TBF.BenchControl.Elde.RegulValveMilwaukee
#endregion Configuration Change Handling
- public RegulValve()
- {
- }
+ public RegulValve() { }
public RegulValve(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -95,11 +93,9 @@ namespace TBF.BenchControl.Elde.RegulValveMilwaukee
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
- this.dict = new Dictionary();
-
+ /// Prepare data for SendCalibData() control board component method
adcChannel = Idx1 - 1;
-
- if (Idx1 < ControlBoard.RegValveCalib.GetLength(0))
+ if (adcChannel >= 0 && adcChannel < ControlBoard.RegValveCalib.GetLength(0))
{
this.ControlBoard.RegValveCalib[adcChannel, 0] = (uint)DacValueClosed;
this.ControlBoard.RegValveCalib[adcChannel, 1] = (uint)DacValueOpen;
@@ -109,17 +105,19 @@ namespace TBF.BenchControl.Elde.RegulValveMilwaukee
log.ErrorFormat("Unable to set {0} ADC levels: RegValveCalib array size={1}, RV Idx1={2}, RV AdcNr={3}",
Name, ControlBoard.RegValveCalib.GetLength(0), Idx1, Idx1 - 1);
}
-
- StartChangeHandler();
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ adcChannel = Idx1 - 1;
+ dict = new Dictionary();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
///
/// IDevice interface implementation
///
- public void Initialize() { }
public void RunDeviceBefore()
{
int adcValue = (int)ControlBoard.AnalogInputRaw(adcChannel, 0);
diff --git a/TBF/BenchControl/Elde/RegulValveTandem/RegulValveTandem.cs b/TBF/BenchControl/Elde/RegulValveTandem/RegulValveTandem.cs
index 99604e198..5c352aec1 100644
--- a/TBF/BenchControl/Elde/RegulValveTandem/RegulValveTandem.cs
+++ b/TBF/BenchControl/Elde/RegulValveTandem/RegulValveTandem.cs
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
public class RegulValveTandem : ComponentBase, GenericDevices.IRegulValve
{
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValveTandem));
- public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public readonly RegulValveTandemCfg RegulValveTandemCfg;
@@ -25,8 +25,8 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
readonly RegulValve.RegulValve regulValve;
readonly RegulValve.RegulValve fixedRV;
- readonly float fixedPctLo; /// [%]
- readonly float fixedPctHi; /// [%]
+ float fixedPctLo; /// [%]
+ float fixedPctHi; /// [%]
public int FlowStableSec { get { return RegulValveTandemCfg.FlowStableSec; } } /// 0..60 sec
///
@@ -38,9 +38,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
}
- public RegulValveTandem()
- {
- }
+ public RegulValveTandem() { }
public RegulValveTandem(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -52,15 +50,17 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
fixedRV = (RegulValve.RegulValve)TbfComponents.FindComponent(RegulValveTandemCfg.FixedRVName, components);
if (fixedRV == null) throw new Exception("Cannot find fixed RV");
-
- fixedPctLo = Math.Max(0.0f, RegulValveTandemCfg.FixedRVPosition - 3.0f);
- fixedPctHi = Math.Min(100.0f, RegulValveTandemCfg.FixedRVPosition + 3.0f);
-
- this.dict = new Dictionary();
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ fixedPctLo = Math.Max(0.0f, RegulValveTandemCfg.FixedRVPosition - 3.0f);
+ fixedPctHi = Math.Min(100.0f, RegulValveTandemCfg.FixedRVPosition + 3.0f);
+ dict = new Dictionary();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
///
/// Operation to set the water flow within tolerances
/// Events: Event.None, Event.FlowReached, Event.FlowTimeOut
diff --git a/TBF/BenchControl/Elde/TempMeter/TempMeter.cs b/TBF/BenchControl/Elde/TempMeter/TempMeter.cs
index 25eee010a..6b41195cf 100644
--- a/TBF/BenchControl/Elde/TempMeter/TempMeter.cs
+++ b/TBF/BenchControl/Elde/TempMeter/TempMeter.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.Elde.TempMeter
public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents
{
private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter));
- public override string ToString() { return string.Format("TempMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly TempMeterCfg tempMtrCfg;
@@ -26,9 +26,8 @@ namespace TBF.BenchControl.Elde.TempMeter
public double A4 { get { return tempMtrCfg.A4; } }
public double A5 { get { return tempMtrCfg.A5; } }
- public TempMeter()
- {
- }
+
+ public TempMeter() { }
public TempMeter(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -44,10 +43,13 @@ namespace TBF.BenchControl.Elde.TempMeter
ControlBoard.TempCalibData[Idx0, 2] = (float)A3;
ControlBoard.TempCalibData[Idx0, 3] = (float)A4;
ControlBoard.TempCalibData[Idx0, 4] = (float)A5;
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList GetCalendarEvents()
{
diff --git a/TBF/BenchControl/Elde/TempMeterInternal/TempMeter.cs b/TBF/BenchControl/Elde/TempMeterInternal/TempMeter.cs
index 08bb1a908..6a7e9f22b 100644
--- a/TBF/BenchControl/Elde/TempMeterInternal/TempMeter.cs
+++ b/TBF/BenchControl/Elde/TempMeterInternal/TempMeter.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.Elde.TempMeterInternal
public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents
{
private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter));
- public override string ToString() { return string.Format("TempMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly TempMeterCfg tempMtrCfg;
@@ -21,9 +21,8 @@ namespace TBF.BenchControl.Elde.TempMeterInternal
public int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..7
- public TempMeter()
- {
- }
+
+ public TempMeter() { }
public TempMeter(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -39,10 +38,13 @@ namespace TBF.BenchControl.Elde.TempMeterInternal
ControlBoard.TempCalibData[tempMtrCfg.CoefsIdx0, 2] = tempMtrCfg.A3;
ControlBoard.TempCalibData[tempMtrCfg.CoefsIdx0, 3] = tempMtrCfg.A4;
ControlBoard.TempCalibData[tempMtrCfg.CoefsIdx0, 4] = tempMtrCfg.A5;
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList GetCalendarEvents()
{
diff --git a/TBF/BenchControl/Elde/TempMeterMeret/TempMeter.cs b/TBF/BenchControl/Elde/TempMeterMeret/TempMeter.cs
index df9641220..ba1015c08 100644
--- a/TBF/BenchControl/Elde/TempMeterMeret/TempMeter.cs
+++ b/TBF/BenchControl/Elde/TempMeterMeret/TempMeter.cs
@@ -12,13 +12,14 @@ namespace TBF.BenchControl.Elde.TempMeterMeret
public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents
{
private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter));
- public override string ToString() { return string.Format("TempMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly TempMeterCfg tempMtrCfg;
public readonly ControlBoardDev ControlBoard;
- public TempMeter() {}
+
+ public TempMeter() { }
public TempMeter(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -30,10 +31,13 @@ namespace TBF.BenchControl.Elde.TempMeterMeret
/// Prepare data for SendCalibData() control board component method
ControlBoard.MeretRS485Address[tempMtrCfg.MeretIdx0] = tempMtrCfg.ModbusAddress;
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList GetCalendarEvents()
{
diff --git a/TBF/BenchControl/Elde/Valve/Valve.cs b/TBF/BenchControl/Elde/Valve/Valve.cs
index 5c83e0059..b9d6a2d7d 100644
--- a/TBF/BenchControl/Elde/Valve/Valve.cs
+++ b/TBF/BenchControl/Elde/Valve/Valve.cs
@@ -12,31 +12,29 @@ namespace TBF.BenchControl.Elde.Valve
public class Valve : GenericDevices.ValveBase, IValve
{
private static readonly ILog log = LogManager.GetLogger(typeof(Valve));
- public override string ToString() { return string.Format("Valve({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly ValveCfg valveCfg;
+ ///
+ public ValveCategory Category { get { return valveCfg.Category; } }
+ public int Delay { get { return valveCfg.OpenCloseTime; } }
+ public bool Inverted { get { return valveCfg.Inverted; } }
+ public bool InvertCouple { get { return valveCfg.InvertCouple; } }
+ public int LagOpening { get { return valveCfg.LagOpening; } }
+ public int LagClosing { get { return valveCfg.LagClosing; } }
readonly ControlBoardDev controlBoard;
+ public bool State { get { return (controlBoard.Route & Mask) != 0; } }
- public ValveCategory Category { get { return valveCfg.Category; } }
- public int Delay { get { return valveCfg.OpenCloseTime; } }
- public bool Inverted { get { return valveCfg.Inverted; } }
public IValve CoupledTo { get { return coupledTo; } }
readonly IValve coupledTo;
-
- public bool InvertCouple { get { return valveCfg.InvertCouple; } }
- public int LagOpening { get { return valveCfg.LagOpening; } }
- public int LagClosing { get { return valveCfg.LagClosing; } }
- public readonly UInt128 Mask; /// derived from bitPosition in the constructor
-
- public int BitPosition { get { return valveCfg.BitPosition; } }
+ public int BitPosition { get { return valveCfg.BitPosition; } }
+ public UInt128 Mask; /// derived from bitPosition in the constructor
- public Valve()
- {
- }
+ public Valve() { }
public Valve(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -46,25 +44,22 @@ namespace TBF.BenchControl.Elde.Valve
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
- if (valveCfg.BitPosition < 0 || valveCfg.BitPosition >= 128)
- {
- throw new ArgumentOutOfRangeException("position");
- }
- this.Mask = (((UInt128)1) << valveCfg.BitPosition);
-
- if (valveCfg.CoupledToName != null)
+ if (!string.IsNullOrEmpty(valveCfg.CoupledToName))
{
coupledTo = (IValve)TbfComponents.FindComponent(valveCfg.CoupledToName, components);
- }
-
- log.Warn(this.ToString());
- }
-
- public bool State
- {
- get { return (controlBoard.Route & Mask) != 0; }
+ if (coupledTo == null) throw new Exception("Cannot find " + valveCfg.CoupledToName);
+ }
}
+ public override void Initialize()
+ {
+ if (valveCfg.BitPosition < 0 || valveCfg.BitPosition >= 128)
+ {
+ throw new ArgumentOutOfRangeException("position");
+ }
+ this.Mask = (((UInt128)1) << valveCfg.BitPosition);
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
#region Configuration Change Handling
diff --git a/TBF/BenchControl/Elde/ValveEx/Valve.cs b/TBF/BenchControl/Elde/ValveEx/Valve.cs
index 697540fc6..a6dc91f1f 100644
--- a/TBF/BenchControl/Elde/ValveEx/Valve.cs
+++ b/TBF/BenchControl/Elde/ValveEx/Valve.cs
@@ -12,31 +12,20 @@ namespace TBF.BenchControl.Elde.ValveEx
public class Valve : ComponentBase, Generic.IComponent
{
private static readonly ILog log = LogManager.GetLogger(typeof(Valve));
- public override string ToString() { return string.Format("ValveEx({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly ValveCfg valveCfg;
- public readonly UInt128 Mask; /// derived from bitPosition in the constructor
- ///
public readonly IValve[] InputValves;
+ public UInt128 Mask; /// derived from bitPosition in the constructor
- public Valve()
- {
- }
+
+ public Valve() { }
public Valve(Generic.IComponentCfg cfg, IList components)
: base(cfg)
{
valveCfg = cfg as ValveCfg;
-
- //controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
- //if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
-
- if (valveCfg.BitPosition < 0 || valveCfg.BitPosition >= 128)
- {
- throw new ArgumentOutOfRangeException("position");
- }
- this.Mask = (((UInt128)1) << valveCfg.BitPosition);
InputValves = new IValve[valveCfg.InputValvesCount];
InputValves[0] = TbfComponents.FindComponent(valveCfg.Input1, components) as IValve;
@@ -47,10 +36,19 @@ namespace TBF.BenchControl.Elde.ValveEx
InputValves[3] = TbfComponents.FindComponent(valveCfg.Input4, components) as IValve;
if (InputValves.Length > 4)
InputValves[4] = TbfComponents.FindComponent(valveCfg.Input5, components) as IValve;
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ if (valveCfg.BitPosition < 0 || valveCfg.BitPosition > 127)
+ {
+ throw new ArgumentOutOfRangeException("position");
+ }
+ Mask = (((UInt128)1) << valveCfg.BitPosition);
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
public void UpdateRoute(ref UInt128 route)
{
bool output;
diff --git a/TBF/BenchControl/Generic/IComponent.cs b/TBF/BenchControl/Generic/IComponent.cs
index 5daf62580..e6f70116a 100644
--- a/TBF/BenchControl/Generic/IComponent.cs
+++ b/TBF/BenchControl/Generic/IComponent.cs
@@ -1,5 +1,5 @@
///
-/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
+/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using System.Collections.Generic;
@@ -19,10 +19,20 @@ namespace TBF.BenchControl.Generic
IComponentCfg Cfg { get; }
+ ///
+ /// Measurement correction table
+ ///
IList Corrections { get; set; }
IList Uncertainties { get; set; }
+ ///
+ /// Invoked once on program start-up before the state machine is started,
+ /// before RunDeviceBefore() functions of all devices and before Start()
+ /// functions of all operations.
+ ///
+ void Initialize();
+
void StartChangeHandler();
void StopChangeHandler();
diff --git a/TBF/BenchControl/Generic/IComponentFactory.cs b/TBF/BenchControl/Generic/IComponentFactory.cs
index 0005050f3..a6b448e70 100644
--- a/TBF/BenchControl/Generic/IComponentFactory.cs
+++ b/TBF/BenchControl/Generic/IComponentFactory.cs
@@ -32,8 +32,5 @@ namespace TBF.BenchControl.Generic
/// Converts an Entities.Component object into an instance of an appropriate class implementing IComponentCfg
///
IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component);
-
-
- void ResetStaticProperties();
}
}
diff --git a/TBF/BenchControl/Generic/IDevice.cs b/TBF/BenchControl/Generic/IDevice.cs
index bb68b2bc6..abf723a9a 100644
--- a/TBF/BenchControl/Generic/IDevice.cs
+++ b/TBF/BenchControl/Generic/IDevice.cs
@@ -5,8 +5,6 @@ namespace TBF.BenchControl.Generic
{
public interface IDevice : IComponent
{
- void Initialize();
-
///
/// This function is invoked regularly each 1000 ms (once per second)
/// just before Start(), Run() and Stop() functions of acrive operations.
diff --git a/TBF/BenchControl/GenericDevices/IEventTrigger.cs b/TBF/BenchControl/GenericDevices/IEventTrigger.cs
index b6c8c27a2..0f289640a 100644
--- a/TBF/BenchControl/GenericDevices/IEventTrigger.cs
+++ b/TBF/BenchControl/GenericDevices/IEventTrigger.cs
@@ -6,12 +6,5 @@ namespace TBF.BenchControl.GenericDevices
{
public interface IEventTrigger : IResultsProcessor
{
- ///
- /// Analyze results of one batch of water meters and trigger appropriate events.
- /// Events: Event.ResultsProcessed, Event.Busy
- ///
- /// Results of a batch of water meters
- /// Reference to the operation
- IOperation ProcessResultsOp(Results.Entities.Batch batch);
}
}
diff --git a/TBF/BenchControl/GenericDevices/IFlowMeter.cs b/TBF/BenchControl/GenericDevices/IFlowMeter.cs
index ed386f360..93934b43c 100644
--- a/TBF/BenchControl/GenericDevices/IFlowMeter.cs
+++ b/TBF/BenchControl/GenericDevices/IFlowMeter.cs
@@ -34,11 +34,6 @@ namespace TBF.BenchControl.GenericDevices
///
int Idx1 { get; }
- ///
- /// Measurement correction table
- ///
- IList Corrections { get; }
-
///
/// Returns current flow value in [m3/h]
///
diff --git a/TBF/BenchControl/GenericDevices/IPressureMeter.cs b/TBF/BenchControl/GenericDevices/IPressureMeter.cs
index a914c7f93..c1f004e98 100644
--- a/TBF/BenchControl/GenericDevices/IPressureMeter.cs
+++ b/TBF/BenchControl/GenericDevices/IPressureMeter.cs
@@ -13,11 +13,6 @@ namespace TBF.BenchControl.GenericDevices
///
public interface IPressureMeter : IComponent
{
- ///
- /// Measurement correction table
- ///
- IList Corrections { get; }
-
///
/// Events: PressureDone, Error
///
diff --git a/TBF/BenchControl/GenericDevices/IRegReaderPulses.cs b/TBF/BenchControl/GenericDevices/IRegReaderPulses.cs
index 94133afce..5d9dce1a2 100644
--- a/TBF/BenchControl/GenericDevices/IRegReaderPulses.cs
+++ b/TBF/BenchControl/GenericDevices/IRegReaderPulses.cs
@@ -5,12 +5,6 @@ namespace TBF.BenchControl.GenericDevices
{
interface IRegReaderPulses : IRegReader
{
- int Position { get; }
int Filter { get; }
-
- double PulsesPerLtr { get; } /// [imp/l] ... water meter or volume measurement part of a heat meter
- double LtrsPerPulse { get; } /// [l/imp]
-
- int WMPulses { get; } /// Counted pulses of the water meter
}
}
diff --git a/TBF/BenchControl/GenericDevices/IResultsPrinter.cs b/TBF/BenchControl/GenericDevices/IResultsPrinter.cs
index 1633b55da..94051c4ff 100644
--- a/TBF/BenchControl/GenericDevices/IResultsPrinter.cs
+++ b/TBF/BenchControl/GenericDevices/IResultsPrinter.cs
@@ -6,14 +6,6 @@ namespace TBF.BenchControl.GenericDevices
{
public interface IResultsPrinter : IResultsProcessor
{
- ///
- /// Prints results fo one batch of water meters.
- /// Events: Event.ResultsPrinted, Event.Busy
- ///
- /// Results of a batch of water meters
- /// Reference to the operation
- IOperation ProcessResultsOp(Results.Entities.Batch batch);
-
///
/// When true printing at the end of cycle is bypassed.
/// Can be used to disable printing without having to modify all procedures.
diff --git a/TBF/BenchControl/GenericDevices/IResultsWriter.cs b/TBF/BenchControl/GenericDevices/IResultsWriter.cs
index 0b62b7d4b..bf53d9b98 100644
--- a/TBF/BenchControl/GenericDevices/IResultsWriter.cs
+++ b/TBF/BenchControl/GenericDevices/IResultsWriter.cs
@@ -6,12 +6,5 @@ namespace TBF.BenchControl.GenericDevices
{
public interface IResultsWriter : IResultsProcessor
{
- ///
- /// Writes results of one batch of water meters into a file or a database.
- /// Events: Event.ResultsWritten, Event.Busy
- ///
- /// Results of a batch of water meters
- /// Reference to the operation
- IOperation ProcessResultsOp(Results.Entities.Batch batch);
}
}
diff --git a/TBF/BenchControl/GenericDevices/IScaleOrTank.cs b/TBF/BenchControl/GenericDevices/IScaleOrTank.cs
index 680a3566f..3b044315b 100644
--- a/TBF/BenchControl/GenericDevices/IScaleOrTank.cs
+++ b/TBF/BenchControl/GenericDevices/IScaleOrTank.cs
@@ -54,10 +54,5 @@ namespace TBF.BenchControl.GenericDevices
/// Time in seconds to empty the tank completely when it is full
///
int EmptyTimeSec { get; }
-
- ///
- /// Measurement correction table
- ///
- IList Corrections { get; }
}
}
diff --git a/TBF/BenchControl/GenericDevices/ValveBase.cs b/TBF/BenchControl/GenericDevices/ValveBase.cs
index f897dd047..c268471f1 100644
--- a/TBF/BenchControl/GenericDevices/ValveBase.cs
+++ b/TBF/BenchControl/GenericDevices/ValveBase.cs
@@ -6,18 +6,13 @@ using System.Collections.Generic;
namespace TBF.BenchControl.GenericDevices
{
- public class ValveBase : ComponentBase
+ public abstract class ValveBase : ComponentBase
{
- public ValveBase()
- {
- }
-
- ///
- /// Invokes ComponentBase constructor
- ///
- public ValveBase(Generic.IComponentCfg cfg) : base(cfg)
- {
- }
+ ///
+ /// Invoke ComponentBase constructors
+ ///
+ public ValveBase() : base() { }
+ public ValveBase(Generic.IComponentCfg cfg) : base(cfg) { }
///
/// Process the list of components and return all valves (masters and coupled)
diff --git a/TBF/BenchControl/Hart/Common/Hart.cs b/TBF/BenchControl/Hart/Common/Hart.cs
index 47eec9f7f..f1b91082a 100644
--- a/TBF/BenchControl/Hart/Common/Hart.cs
+++ b/TBF/BenchControl/Hart/Common/Hart.cs
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.Hart.Common
public class Hart : ComponentBase, IDevice, GenericDevices.IHart
{
private static readonly ILog log = LogManager.GetLogger(typeof(Hart));
- public override string ToString() { return string.Format("Modbus({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
private readonly HartCfg hartCfg;
@@ -47,9 +47,7 @@ namespace TBF.BenchControl.Hart.Common
Queue telegramsToSend;
- public Hart()
- {
- }
+ public Hart() { }
///
/// HART modem connected via serial interface (RS232).
@@ -58,38 +56,32 @@ namespace TBF.BenchControl.Hart.Common
public Hart(Generic.IComponentCfg cfg)
: base(cfg)
{
- receivedTelegrams = new Queue[16]; /// Max. 16 slaves with adresses 0..15
- for (int i = 0; i < receivedTelegrams.Length; i++)
- {
- receivedTelegrams[i] = new Queue();
- }
+ hartCfg = cfg as HartCfg;
+ }
+
+ public override void Initialize()
+ {
telegramsToSend = new Queue();
- serialPort = null;
- hartCfg = cfg as HartCfg;
- log.Warn(this.ToString());
- }
+ receivedTelegrams = new Queue[16]; /// Max. 16 slaves with adresses 0..15
+ for (int i = 0; i < receivedTelegrams.Length; i++)
+ {
+ receivedTelegrams[i] = new Queue();
+ }
- ~Hart()
- {
- }
-
-
- public void Initialize()
- {
- if (hartCfg.DebugLevel == DebugMode.Simulate)
+ if (hartCfg.DebugLevel == DebugMode.Normal)
+ {
+ string portName = "COM" + hartCfg.ComPortNr.ToString();
+ serialPort = new SerialPort(portName, hartCfg.BaudRate, hartCfg.Parity, hartCfg.DataBits, hartCfg.StopBits);
+ serialPort.Handshake = hartCfg.Handshake;
+ serialPort.Open();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ else
{
serialPort = null;
- log.FatalFormat("{0} - Device simulated", Name);
- return;
- }
-
- string comPortName = "COM" + hartCfg.ComPortNr.ToString();
- serialPort = new SerialPort(comPortName, hartCfg.BaudRate, hartCfg.Parity, hartCfg.DataBits, hartCfg.StopBits);
- serialPort.Handshake = hartCfg.Handshake;
- serialPort.Open();
-
- log.FatalFormat("{0} - Device successfully initialized", Name);
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ }
}
public void RunDeviceBefore()
@@ -110,10 +102,9 @@ namespace TBF.BenchControl.Hart.Common
public void StopDevice()
{
- if (serialPort != null)
+ if (serialPort != null && serialPort.IsOpen)
{
serialPort.Close();
- serialPort = null;
}
}
diff --git a/TBF/BenchControl/Hart/Nivotrack/Nivotrack.cs b/TBF/BenchControl/Hart/Nivotrack/Nivotrack.cs
index df70e49db..d13d8aad7 100644
--- a/TBF/BenchControl/Hart/Nivotrack/Nivotrack.cs
+++ b/TBF/BenchControl/Hart/Nivotrack/Nivotrack.cs
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.Hart.Nivotrack
const int StableReadingsCount = 9;
private static readonly ILog log = LogManager.GetLogger(typeof(Nivotrack));
- public override string ToString() { return string.Format("{0}({1})", Cfg.Name, Cfg.ToString(-1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly NivotrackCfg nivotrackCfg;
readonly IHart hart;
@@ -50,9 +50,7 @@ namespace TBF.BenchControl.Hart.Nivotrack
CurrentOp currentOp;
- public Nivotrack()
- {
- }
+ public Nivotrack() { }
///
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
@@ -65,12 +63,16 @@ namespace TBF.BenchControl.Hart.Nivotrack
hart = (IHart)TbfComponents.FindComponent(cfg.ParentName, components);
if (hart == null) throw new Exception("Cannot find " + Name + " parent");
+ }
+ public override void Initialize()
+ {
levelReadings = new double[StableReadingsCount];
sortedLevelReadings = new double[StableReadingsCount];
-
- log.Warn(this.ToString());
- }
+ rawLevel_mm = 0;
+ isRawLevelValid = false;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
///
/// Calendar support
@@ -106,14 +108,6 @@ namespace TBF.BenchControl.Hart.Nivotrack
return calendarEvents;
}
- public void Initialize()
- {
- if (nivotrackCfg.DebugLevel == DebugMode.Simulate) return;
-
- rawLevel_mm = 0;
- isRawLevelValid = false;
- }
-
void Detect()
{
diff --git a/TBF/BenchControl/Keithley/Multimeter_2010_RS232/Multimeter.cs b/TBF/BenchControl/Keithley/Multimeter_2010_RS232/Multimeter.cs
index f8ff8ab16..b2bc9be1a 100644
--- a/TBF/BenchControl/Keithley/Multimeter_2010_RS232/Multimeter.cs
+++ b/TBF/BenchControl/Keithley/Multimeter_2010_RS232/Multimeter.cs
@@ -15,12 +15,13 @@ using TBF.Boxes;
namespace TBF.BenchControl.Keithley.Multimeter_2010_RS232
{
///
- /// Root component for Modbus communication via serial port (RS485)
- ///
- public class Multimeter : ComponentBase, IDevice
+ /// Keithley mulltimeter connected via serial interface (RS232)
+ /// Connection settings: 9600Bd 8-bits no-parity 1-stop-bit flow control: none
+ ///
+ public class Multimeter : ComponentBase, IDevice
{
private static readonly ILog log = LogManager.GetLogger(typeof(Multimeter));
- public override string ToString() { return string.Format("{0}({1})", GetType().Namespace.Substring(17), Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
private readonly MultimeterCfg multimeterCfg;
@@ -57,39 +58,43 @@ namespace TBF.BenchControl.Keithley.Multimeter_2010_RS232
ScanState scanState;
- public Multimeter()
- {
- Resistance = new double[ChannelTo + 1];
- }
+ public Multimeter() { }
- ///
- /// Keithley mulltimeter connected via serial interface (RS232)
- /// Connection settings: 9600Bd 8-bits no-parity 1-stop-bit flow control: none
- ///
public Multimeter(Generic.IComponentCfg cfg)
: base(cfg)
{
multimeterCfg = cfg as MultimeterCfg;
- serialPort = null;
-
- receivedData = new StringBuilder();
- readAttemptsCount = 0;
-
- Resistance = new double[ChannelTo + 1];
- for (int i = 0; i < Resistance.Length; i++) Resistance[i] = 0;
-
- listOfReadOperations = new List();
- listOfChannels = new List();
- nextChannelIx = 0;
- currentChannel = 0; /// invalid, no :rout:clos command yet
- scanState = ScanState.Off;
-
- log.Warn(this.ToString());
}
- ~Multimeter()
- {
- }
+ public override void Initialize()
+ {
+ receivedData = new StringBuilder();
+ readAttemptsCount = 0;
+
+ Resistance = new double[ChannelTo + 1];
+ for (int i = 0; i < Resistance.Length; i++) Resistance[i] = 0;
+
+ listOfReadOperations = new List();
+ listOfChannels = new List();
+ nextChannelIx = 0;
+ currentChannel = 0; /// invalid, no :rout:clos command yet
+ scanState = ScanState.Off;
+
+ if (multimeterCfg.DebugLevel == DebugMode.Normal)
+ {
+ string portName = "COM" + multimeterCfg.ComPortNr.ToString();
+ serialPort = new SerialPort(portName, multimeterCfg.BaudRate, multimeterCfg.Parity, multimeterCfg.DataBits, multimeterCfg.StopBits);
+ serialPort.Handshake = multimeterCfg.Handshake;
+ serialPort.Open();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ else
+ {
+ serialPort = null;
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ }
+ }
+
///
/// Start reading temperature from specified channel
@@ -168,23 +173,6 @@ namespace TBF.BenchControl.Keithley.Multimeter_2010_RS232
}
- public void Initialize()
- {
- if (multimeterCfg.DebugLevel == DebugMode.Simulate)
- {
- log.FatalFormat("Simulated device {0}", ToString());
- return;
- }
-
- string comPortName = "COM" + multimeterCfg.ComPortNr.ToString();
- serialPort = new SerialPort(comPortName, multimeterCfg.BaudRate, multimeterCfg.Parity, multimeterCfg.DataBits, multimeterCfg.StopBits);
- serialPort.Handshake = multimeterCfg.Handshake;
- serialPort.Open();
-
- log.FatalFormat("Successfully initialized device {0}", ToString());
- }
-
-
///
/// Send an ASCII string, appends at the end.
///
diff --git a/TBF/BenchControl/Keithley/TempMeter/TempMeter.cs b/TBF/BenchControl/Keithley/TempMeter/TempMeter.cs
index c0ad548b6..a27e1fae4 100644
--- a/TBF/BenchControl/Keithley/TempMeter/TempMeter.cs
+++ b/TBF/BenchControl/Keithley/TempMeter/TempMeter.cs
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Keithley.TempMeter
public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents
{
private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter));
- public override string ToString() { return string.Format("Keithley.TempMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly TempMeterCfg tempMtrCfg; /// configuration
@@ -28,9 +28,7 @@ namespace TBF.BenchControl.Keithley.TempMeter
Dictionary operations2;
- public TempMeter()
- {
- }
+ public TempMeter() { }
public TempMeter(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -39,13 +37,15 @@ namespace TBF.BenchControl.Keithley.TempMeter
Multimeter = (Multimeter)TbfComponents.FindComponent(cfg.ParentName, components);
if (Multimeter == null) throw new Exception("Cannot find " + Name + " parent");
-
- operations = new Dictionary();
- operations2 = new Dictionary();
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ operations = new Dictionary();
+ operations2 = new Dictionary();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
///
/// Calendar support
///
diff --git a/TBF/BenchControl/MettlerToledo/Multi/BalanceDev.cs b/TBF/BenchControl/MettlerToledo/Multi/BalanceDev.cs
index 38d2fc7c1..73d498f75 100644
--- a/TBF/BenchControl/MettlerToledo/Multi/BalanceDev.cs
+++ b/TBF/BenchControl/MettlerToledo/Multi/BalanceDev.cs
@@ -27,7 +27,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
/// Warn: Start measurement when busy is true
///
private static readonly ILog log = LogManager.GetLogger(typeof(BalanceDev));
- public override string ToString() { return string.Format("MettlerToledo.Multi.Balance({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
protected readonly BalanceCfg balanceCfg;
protected static BalanceCfg balance1Cfg;
@@ -36,10 +36,6 @@ namespace TBF.BenchControl.MettlerToledo.Multi
/// Enumeration of balances via static fields and methods
///
static int nextBalanceIdx = 0;
- public static new void ResetStaticProperties()
- {
- nextBalanceIdx = 0;
- }
public static int BalancesCount { get { return nextBalanceIdx; } }
public static BalanceDev[] Balances;
public static double[] Masses;
@@ -76,9 +72,8 @@ namespace TBF.BenchControl.MettlerToledo.Multi
public string Format { get { return balanceCfg.Format; } }
- public BalanceDev()
- {
- }
+
+ public BalanceDev() { }
///
/// Constructor
@@ -88,40 +83,45 @@ namespace TBF.BenchControl.MettlerToledo.Multi
: base(cfg)
{
balanceCfg = cfg as BalanceCfg;
- if (balanceCfg.IdNr == 1) balance1Cfg = balanceCfg;
+ }
+
+ public override void Initialize()
+ {
+ base.Initialize();
balanceNr = nextBalanceIdx++;
Masses = new double[nextBalanceIdx]; /// (re)initialize the static array of masses of all balances
- ///
- if (Balances == null || Balances.Length < nextBalanceIdx)
- {
- BalanceDev[] balancesSoFar = Balances;
- Balances = new BalanceDev[nextBalanceIdx];
- if (balancesSoFar != null) for (int i = 0; i < balancesSoFar.Length; i++) Balances[i] = balancesSoFar[i];
- Balances[nextBalanceIdx - 1] = this;
- }
+ ///
+ if (Balances == null || Balances.Length < nextBalanceIdx)
+ {
+ BalanceDev[] balancesSoFar = Balances;
+ Balances = new BalanceDev[nextBalanceIdx];
+ if (balancesSoFar != null) for (int i = 0; i < balancesSoFar.Length; i++) Balances[i] = balancesSoFar[i];
+ Balances[nextBalanceIdx - 1] = this;
+ }
- log.Warn(this.ToString());
- }
-
- public void Initialize()
- {
- base.Initalize();
+ if (balanceCfg.IdNr == 1) balance1Cfg = balanceCfg;
msrmntState = MsrmntState.Failed; /// Data not valid yet
+ stringBuilder = new StringBuilder(40);
- if (balanceCfg.DebugLevel == DebugMode.Simulate) return;
+ if (balanceCfg.DebugLevel == DebugMode.Normal)
+ {
+ if (balanceCfg.IdNr == 1)
+ {
+ string portName = "COM" + balanceCfg.ComPortNr.ToString();
+ serialPort = new SerialPort(portName, balanceCfg.BaudRate, balanceCfg.Parity, balanceCfg.DataBits, balanceCfg.StopBits);
+ serialPort.Handshake = balanceCfg.Handshake;
+ serialPort.Open();
+ }
- if (balanceCfg.IdNr == 1)
- {
- stringBuilder = new StringBuilder(40);
- string comPortName = "COM" + balanceCfg.ComPortNr.ToString();
- serialPort = new SerialPort(comPortName, balanceCfg.BaudRate, balanceCfg.Parity, balanceCfg.DataBits, balanceCfg.StopBits);
- serialPort.Handshake = balanceCfg.Handshake;
- serialPort.Open();
- }
-
- log.FatalFormat("Successfully initialized device {0}", ToString());
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ else
+ {
+ serialPort = null;
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ }
}
public override bool IsEmpty()
diff --git a/TBF/BenchControl/MettlerToledo/Standard/BalanceDev.cs b/TBF/BenchControl/MettlerToledo/Standard/BalanceDev.cs
index db90b9460..c8f73f5b1 100644
--- a/TBF/BenchControl/MettlerToledo/Standard/BalanceDev.cs
+++ b/TBF/BenchControl/MettlerToledo/Standard/BalanceDev.cs
@@ -35,7 +35,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
/// Warn: Start measurement when busy is true
///
private static readonly ILog log = LogManager.GetLogger(typeof(BalanceDev));
- public override string ToString() { return string.Format("MettlerToledo.Standard.Balance({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
protected readonly BalanceCfg balanceCfg;
@@ -43,10 +43,6 @@ namespace TBF.BenchControl.MettlerToledo.Standard
/// Enumeration of balances via static fields and methods
///
static int nextBalanceIdx = 0;
- public static new void ResetStaticProperties()
- {
- nextBalanceIdx = 0;
- }
public static int BalancesCount { get { return nextBalanceIdx; } }
public static BalanceDev[] Balances;
public static double[] Masses;
@@ -98,24 +94,22 @@ namespace TBF.BenchControl.MettlerToledo.Standard
: base(cfg)
{
balanceCfg = cfg as BalanceCfg;
+ }
+
+ public override void Initialize()
+ {
+ base.Initialize();
balanceNr = nextBalanceIdx++;
Masses = new double[nextBalanceIdx]; /// (re)initialize the static array of masses of all balances
- ///
- if (Balances == null || Balances.Length < nextBalanceIdx)
- {
- BalanceDev[] balancesSoFar = Balances;
- Balances = new BalanceDev[nextBalanceIdx];
- if (balancesSoFar != null) for (int i = 0; i < balancesSoFar.Length; i++) Balances[i] = balancesSoFar[i];
- Balances[nextBalanceIdx - 1] = this;
- }
-
- log.Warn(this.ToString());
- }
-
- public void Initialize()
- {
- base.Initalize();
+ ///
+ if (Balances == null || Balances.Length < nextBalanceIdx)
+ {
+ BalanceDev[] balancesSoFar = Balances;
+ Balances = new BalanceDev[nextBalanceIdx];
+ if (balancesSoFar != null) for (int i = 0; i < balancesSoFar.Length; i++) Balances[i] = balancesSoFar[i];
+ Balances[nextBalanceIdx - 1] = this;
+ }
if (balanceCfg.CalibValidDate != DateTime.MinValue && balanceCfg.CalibValidDate.Date < DateTime.Now.Date)
{
@@ -125,16 +119,21 @@ namespace TBF.BenchControl.MettlerToledo.Standard
Activity = Activity.Idle;
msrmntState = MsrmntState.Failed; /// Data not valid yet
MsrmntTime = 0;
+ stringBuilder = new StringBuilder(40);
- if (balanceCfg.DebugLevel == DebugMode.Simulate) return;
-
- stringBuilder = new StringBuilder(40);
- string comPortName = "COM" + balanceCfg.ComPortNr.ToString();
- serialPort = new SerialPort(comPortName, balanceCfg.BaudRate, balanceCfg.Parity, balanceCfg.DataBits, balanceCfg.StopBits);
- serialPort.Handshake = balanceCfg.Handshake;
- serialPort.Open();
-
- log.FatalFormat("Successfully initialized device {0}", Name);
+ if (balanceCfg.DebugLevel == DebugMode.Normal)
+ {
+ string portName = "COM" + balanceCfg.ComPortNr.ToString();
+ serialPort = new SerialPort(portName, balanceCfg.BaudRate, balanceCfg.Parity, balanceCfg.DataBits, balanceCfg.StopBits);
+ serialPort.Handshake = balanceCfg.Handshake;
+ serialPort.Open();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ else
+ {
+ serialPort = null;
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ }
}
diff --git a/TBF/BenchControl/MettlerToledo/Standard/BalanceNewDev.cs b/TBF/BenchControl/MettlerToledo/Standard/BalanceNewDev.cs
index 947743714..33ffedc21 100644
--- a/TBF/BenchControl/MettlerToledo/Standard/BalanceNewDev.cs
+++ b/TBF/BenchControl/MettlerToledo/Standard/BalanceNewDev.cs
@@ -22,7 +22,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
/// Warn: Start measurement when busy is true
///
private static readonly ILog log = LogManager.GetLogger(typeof(BalanceNewDev));
- public override string ToString() { return string.Format("MettlerToledo.Standard.BalanceNew({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
/// Serial number after GetSerialNumber() when MsrmntState == MsrmntState.Valid
public string SerialNumber { get { return serialNumber; } }
diff --git a/TBF/BenchControl/MettlerToledo/Standard/BalanceOld.cs b/TBF/BenchControl/MettlerToledo/Standard/BalanceOld.cs
index 316dc08ba..f232463a6 100644
--- a/TBF/BenchControl/MettlerToledo/Standard/BalanceOld.cs
+++ b/TBF/BenchControl/MettlerToledo/Standard/BalanceOld.cs
@@ -25,7 +25,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
/// Warn: Start measurement when busy is true
///
private static readonly ILog log = LogManager.GetLogger(typeof(BalanceOld));
- public override string ToString() { return string.Format("MettlerToledo.Standard.BalanceOld({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public BalanceOld() { }
diff --git a/TBF/BenchControl/MettlerToledo/TankDraining.cs b/TBF/BenchControl/MettlerToledo/TankDraining.cs
index 85956655e..f58ffeead 100644
--- a/TBF/BenchControl/MettlerToledo/TankDraining.cs
+++ b/TBF/BenchControl/MettlerToledo/TankDraining.cs
@@ -22,11 +22,10 @@ namespace TBF.BenchControl.MettlerToledo
TankClosed,
}
- public class TankDraining : ComponentBase, ITankDraining, ISequenceCondition
+ public abstract class TankDraining : ComponentBase, ITankDraining, ISequenceCondition
{
private static readonly ILog log = LogManager.GetLogger(typeof(TankDraining));
-
readonly GenericDevices.ITankDrainingCfg tankDrainingCfg;
bool hasDrainValve { get { return !string.IsNullOrEmpty(tankDrainingCfg.DrainValve); } } /// Available in UI (unlike 'drainValve')
@@ -45,40 +44,22 @@ namespace TBF.BenchControl.MettlerToledo
DrainState drainState;
- public TankDraining()
- : base()
- {
- openTheDrainValveOp = null;
- closeTheDrainValveOp = null;
- waitTankIsEmptyOp = null;
- waitTankContainsMoreThenThld1Op = null;
- waitTankContainsMoreThenThld2Op = null;
- waitTankContainsMoreThenThld3Op = null;
- waitTankContainsMoreThenThld4Op = null;
- }
+ public TankDraining() : base() { }
public TankDraining(Generic.IComponentCfg cfg)
: base(cfg)
{
tankDrainingCfg = cfg as GenericDevices.ITankDrainingCfg;
if (tankDrainingCfg == null) throw new Exception(string.Format("Cannot create component {0}", cfg.Name));
-
- openTheDrainValveOp = null;
- closeTheDrainValveOp = null;
- waitTankIsEmptyOp = null;
- waitTankContainsMoreThenThld1Op = null;
- waitTankContainsMoreThenThld2Op = null;
- waitTankContainsMoreThenThld3Op = null;
- waitTankContainsMoreThenThld4Op = null;
}
- protected void Initalize()
+ public override void Initialize()
{
drainValve = TbfComponents.FindComponent(tankDrainingCfg.DrainValve) as IValve;
- evaporationCmpnt = TbfComponents.FindComponent(tankDrainingCfg.Evaporation) as IEvaporation;
-
if (drainValve == null) throw new Exception(string.Format("{0} is missing a drain valve", Name));
+ evaporationCmpnt = TbfComponents.FindComponent(tankDrainingCfg.Evaporation) as IEvaporation;
+
openTheDrainValveOp = new Elde.SetValvesOp(StateMachine.ControlBoard, drainValve, null);
closeTheDrainValveOp = new Elde.SetValvesOp(StateMachine.ControlBoard, null, drainValve);
waitTankIsEmptyOp = new WaitTankEmptyOp(this);
@@ -91,8 +72,16 @@ namespace TBF.BenchControl.MettlerToledo
waitTankContainsMoreThenThld3Op = new WaitTankContainsMoreThenOp(this, tankCfg.ThldLevel3);
waitTankContainsMoreThenThld4Op = new WaitTankContainsMoreThenOp(this, tankCfg.ThldLevel4);
}
+ else
+ {
+ waitTankContainsMoreThenThld1Op = null;
+ waitTankContainsMoreThenThld2Op = null;
+ waitTankContainsMoreThenThld3Op = null;
+ waitTankContainsMoreThenThld4Op = null;
+ }
}
+
protected void RunBefore()
{
switch (drainState)
diff --git a/TBF/BenchControl/Modbus/CometAmbient/Ambient.cs b/TBF/BenchControl/Modbus/CometAmbient/Ambient.cs
index 4491e656a..54e33a56e 100644
--- a/TBF/BenchControl/Modbus/CometAmbient/Ambient.cs
+++ b/TBF/BenchControl/Modbus/CometAmbient/Ambient.cs
@@ -17,14 +17,11 @@ namespace TBF.BenchControl.Modbus.CometAmbient
public class Ambient : ComponentBase, IDevice, IOperation, GenericDevices.IAmbient
{
private static readonly ILog log = LogManager.GetLogger(typeof(Ambient));
- public override string ToString() { return string.Format("Ambient({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly AmbientCfg ambientCfg;
readonly GenericDevices.IModbus modbus;
- /// The state of the measurement
- MsrmntState msrmntState;
-
///
/// Measured values when MsrmntState == MsrmntState.Valid
///
@@ -32,12 +29,11 @@ namespace TBF.BenchControl.Modbus.CometAmbient
float pressure; /// [bar]
float humidity; /// [R%]
- /// Measurement time stamp when MsrmntState == MsrmntState.Valid
+ /// Measurement time stamp
int msrmntTimeStamp;
- public Ambient()
- {
- }
+
+ public Ambient() { }
///
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
@@ -49,37 +45,21 @@ namespace TBF.BenchControl.Modbus.CometAmbient
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
-
- log.Warn(this.ToString());
}
- public void Initialize()
+ public override void Initialize()
{
- if (ambientCfg.DebugLevel == DebugMode.Simulate)
- {
- temperature = 20.0f;
- humidity = 40.0f;
- pressure = 1.0f;
- msrmntTimeStamp = StateMachine.Time;
- msrmntState = MsrmntState.Valid;
- return;
- }
-
- msrmntState = MsrmntState.Busy;
-
- log.FatalFormat("Successfully initialized device {0}", ToString());
+ temperature = 20.0f;
+ humidity = 40.0f;
+ pressure = 1.0f;
+ msrmntTimeStamp = 0;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
+
/// Run this device
public void RunDeviceBefore()
{
- if (ambientCfg.DebugLevel == DebugMode.Simulate ||
- ambientCfg.DebugLevel == DebugMode.FailureDuringOperation)
- {
- msrmntTimeStamp = StateMachine.Time;
- return;
- }
-
if (modbus.ReceivedTelegrams[ambientCfg.ModbusAddress].Count > 0)
{
byte[] telegram = modbus.ReceivedTelegrams[ambientCfg.ModbusAddress].Dequeue();
@@ -96,14 +76,16 @@ namespace TBF.BenchControl.Modbus.CometAmbient
pressure = (float)value / 10000.0f;
msrmntTimeStamp = StateMachine.Time;
- msrmntState = MsrmntState.Valid;
UpdateProcessData(temperature, pressure, humidity);
log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
}
}
+ }
+ public void RunDeviceAfter()
+ {
if ((StateMachine.Time % 10) == (ambientCfg.ModbusAddress % 10)) /// Each 10 seconds
{
/// Read four registers: 0x31, 0x32, 0x33, 0x34
@@ -123,7 +105,6 @@ namespace TBF.BenchControl.Modbus.CometAmbient
}
}
- public void RunDeviceAfter() { }
public void StopDevice() { }
public void StopDevice2() { }
@@ -171,8 +152,6 @@ namespace TBF.BenchControl.Modbus.CometAmbient
}
/// Stop this operation
- public void Stop()
- {
- }
+ public void Stop() { }
}
}
diff --git a/TBF/BenchControl/Modbus/Common/Modbus.cs b/TBF/BenchControl/Modbus/Common/Modbus.cs
index 8d6eac1be..032f18409 100644
--- a/TBF/BenchControl/Modbus/Common/Modbus.cs
+++ b/TBF/BenchControl/Modbus/Common/Modbus.cs
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.Modbus.Common
public class Modbus : ComponentBase, IDevice, GenericDevices.IModbus
{
private static readonly ILog log = LogManager.GetLogger(typeof(Modbus));
- public override string ToString() { return string.Format("Modbus({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
private readonly ModbusCfg modbusCommonCfg;
@@ -38,9 +38,8 @@ namespace TBF.BenchControl.Modbus.Common
Queue telegramsToSend;
- public Modbus()
- {
- }
+
+ public Modbus() { }
///
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
@@ -49,87 +48,46 @@ namespace TBF.BenchControl.Modbus.Common
public Modbus(Generic.IComponentCfg cfg)
: base(cfg)
{
- receivedTelegrams = new Queue[256];
- for (int i = 0; i < receivedTelegrams.Length; i++)
- {
- receivedTelegrams[i] = new Queue();
- }
+ modbusCommonCfg = cfg as ModbusCfg;
+ }
+
+ public override void Initialize()
+ {
telegramsToSend = new Queue();
- serialPort = null;
- modbusCommonCfg = cfg as ModbusCfg;
- log.Warn(this.ToString());
- }
-
- ~Modbus()
- {
- }
-
- public void Initialize()
- {
- if (modbusCommonCfg.DebugLevel == DebugMode.Simulate)
- {
- serialPort = null;
- log.FatalFormat("{0} - Device simulated", Name);
- return;
- }
-
- string comPortName = "COM" + modbusCommonCfg.ComPortNr.ToString();
- serialPort = new SerialPort(comPortName, modbusCommonCfg.BaudRate, modbusCommonCfg.Parity, modbusCommonCfg.DataBits, modbusCommonCfg.StopBits);
- serialPort.Handshake = modbusCommonCfg.Handshake;
- serialPort.Open();
-
- //stopWorkerThread = false;
- //workerThread = new Thread(Worker);
- //workerThread.Start();
-
- initialRunDeviceCommComplete = false; /// Causes search for Quido RS modules in the first RunDeviceAfter() call
-
- log.FatalFormat("{0} - Device successfully initialized", Name);
- }
-
-
- ///
- /// Send an arbitrary modbus message.
- /// When the message length is N, however only bytes 1..N-2 have to be set.
- /// The last two message bytes (CRC) may be uninitialized or zero.
- /// They are calculated inside this function as required by Modbus specification.
- ///
- /// Message incl CRC fields, CRC bytes dont have to be set
- public void SendMessage(byte[] message)
- {
- if (serialPort == null) return;
-
- Telegram.UpdateTelegramCRC(message);
-
- if ((DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 100) && initialRunDeviceCommComplete)
+ receivedTelegrams = new Queue[256];
+ for (int i = 0; i < receivedTelegrams.Length; i++)
{
- /// More then 100 ms since last 'send' --> do not enqueue the message
- SendMessageNow(message);
+ receivedTelegrams[i] = new Queue();
+ }
+
+ if (modbusCommonCfg.DebugLevel == DebugMode.Normal)
+ {
+ string comPortName = "COM" + modbusCommonCfg.ComPortNr.ToString();
+ serialPort = new SerialPort(comPortName, modbusCommonCfg.BaudRate, modbusCommonCfg.Parity, modbusCommonCfg.DataBits, modbusCommonCfg.StopBits);
+ serialPort.Handshake = modbusCommonCfg.Handshake;
+ serialPort.Open();
+ initialRunDeviceCommComplete = false; /// Causes search for Quido RS modules in the first RunDeviceAfter() call
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
else
{
- telegramsToSend.Enqueue(message);
-
- string s = Telegram.LogTelegram(string.Format("{0} - Enqueueing message ", Name), message);
- Debug.WriteLine(s);
- log.Debug(s);
+ serialPort = null;
+ log.FatalFormat("{0} simulated: {1}", Name, this);
}
}
- ///
- /// Send a structured modbus message.
- ///
- /// Device address (1..255) or 0 = broadcast
- /// Function (0..127)
- /// Address of data to be transferred (0..65535)
- /// Count of data bytes to be transferred (0..65535)
- public void SendMessage(byte modbusAddress, byte function, ushort dataAddress, ushort dataCount)
- {
- if (serialPort == null) return;
-
- byte[] message = new byte[8]
+ ///
+ /// Send a structured modbus message.
+ ///
+ /// Device address (1..255) or 0 = broadcast
+ /// Function (0..127)
+ /// Address of data to be transferred (0..65535)
+ /// Count of data bytes to be transferred (0..65535)
+ public void SendMessage(byte modbusAddress, byte function, ushort dataAddress, ushort dataCount)
+ {
+ byte[] message = new byte[8]
{
modbusAddress,
function,
@@ -144,14 +102,30 @@ namespace TBF.BenchControl.Modbus.Common
SendMessage(message);
}
- public void SendMessageNow(byte[] message)
+ ///
+ /// Send an arbitrary modbus message.
+ /// When the message length is N, however only bytes 1..N-2 have to be set.
+ /// The last two message bytes (CRC) may be uninitialized or zero.
+ /// They are calculated inside this function as required by Modbus specification.
+ ///
+ /// Message incl CRC fields, CRC bytes dont have to be set
+ public void SendMessage(byte[] message)
{
- serialPort.Write(message, 0, message.Length);
- lastSerialPortWrite = DateTime.Now;
+ Telegram.UpdateTelegramCRC(message);
- string s = Telegram.LogTelegram(string.Format("{0} - Sending message ", Name), message);
- Debug.WriteLine(s);
- log.Debug(s);
+ if ((DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 100) && initialRunDeviceCommComplete)
+ {
+ /// More then 100 ms since last 'send' --> do not enqueue the message
+ SendMessageNow(message);
+ }
+ else
+ {
+ telegramsToSend.Enqueue(message);
+
+ string s = Telegram.LogTelegram(string.Format("{0} - Enqueueing message ", Name), message);
+ Debug.WriteLine(s);
+ log.Debug(s);
+ }
}
@@ -189,8 +163,6 @@ namespace TBF.BenchControl.Modbus.Common
/// Run this device
public void RunDeviceAfter()
{
- if (serialPort == null) return;
-
if (!initialRunDeviceCommComplete)
{
initialRunDeviceCommComplete = true; /// Prevent 2nd invocation of the subsequent code
@@ -210,27 +182,36 @@ namespace TBF.BenchControl.Modbus.Common
/// Stop this device
public void StopDevice()
{
- }
-
- public void StopDevice2()
- {
- if (serialPort != null)
+ /// Send telegrams currently in the queue
+ while (telegramsToSend.Count > 0)
{
- /// Send telegrams currently in the queue
- while (telegramsToSend.Count > 0)
+ while ((DateTime.Now - lastSerialPortWrite) <= new TimeSpan(0, 0, 0, 0, 200))
{
- while ((DateTime.Now - lastSerialPortWrite) <= new TimeSpan(0, 0, 0, 0, 200))
- {
- Thread.Sleep(100);
- }
- SendMessageNow(telegramsToSend.Dequeue());
+ Thread.Sleep(100);
}
+ SendMessageNow(telegramsToSend.Dequeue());
+ }
- //stopWorkerThread = true;
- //workerThread.Join(2000);
+ if (serialPort != null && serialPort.IsOpen)
+ {
serialPort.Close();
- serialPort = null;
}
}
- }
+
+ public void StopDevice2() { }
+
+
+ public void SendMessageNow(byte[] message)
+ {
+ if (serialPort != null && serialPort.IsOpen)
+ {
+ serialPort.Write(message, 0, message.Length);
+ }
+
+ lastSerialPortWrite = DateTime.Now;
+ string s = Telegram.LogTelegram(string.Format("{0} - Sending message ", Name), message);
+ Debug.WriteLine(s);
+ log.Debug(s);
+ }
+ }
}
diff --git a/TBF/BenchControl/Modbus/Easytherm/Easytherm.cs b/TBF/BenchControl/Modbus/Easytherm/Easytherm.cs
index c83597891..554716869 100644
--- a/TBF/BenchControl/Modbus/Easytherm/Easytherm.cs
+++ b/TBF/BenchControl/Modbus/Easytherm/Easytherm.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.Modbus.Easytherm
public class Easytherm : ComponentBase, IDevice, GenericDevices.ITempMeter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Easytherm));
- public override string ToString() { return string.Format("Easytherm({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly EasythermCfg easythermCfg;
readonly GenericDevices.IModbus modbus;
@@ -24,9 +24,8 @@ namespace TBF.BenchControl.Modbus.Easytherm
public float requiredTemp { get { return easythermCfg.ProcParams.RequiredTemp; } }
- public Easytherm()
- {
- }
+
+ public Easytherm() { }
public Easytherm(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -35,26 +34,27 @@ namespace TBF.BenchControl.Modbus.Easytherm
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
-
- log.Warn(this.ToString());
}
/// Initialize this device
- public void Initialize()
+ public override void Initialize()
{
- if (easythermCfg.DebugLevel == DebugMode.Simulate) return;
-
temperatureSetPointValid = false;
temperatureSetPointRequested = false;
actualTemperatureIsValid = false;
+
+ if (easythermCfg.DebugLevel == DebugMode.Simulate)
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ else
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
+
/// Run this device
public void RunDeviceBefore()
{
if (easythermCfg.DebugLevel == DebugMode.Simulate) return;
-
if (modbus.ReceivedTelegrams[easythermCfg.ModbusAddress].Count > 0)
{
byte[] telegram = modbus.ReceivedTelegrams[easythermCfg.ModbusAddress].Dequeue();
@@ -79,17 +79,22 @@ namespace TBF.BenchControl.Modbus.Easytherm
StateMachine.ControlBoard.SetReservoirTemp(easythermCfg.ReservoirNr, (float)actualTemperature);
}
}
- }
-
-
+ }
+ }
+
+ /// Run this device
+ public void RunDeviceAfter()
+ {
+ if (easythermCfg.DebugLevel == DebugMode.Simulate) return;
+
if (!temperatureSetPointValid && !temperatureSetPointRequested)
- {
- RequestTemperatureSetpoint();
+ {
+ RequestTemperatureSetpoint();
temperatureSetPointRequested = true;
- }
- else if (temperatureSetPointValid && requiredTemp != temperatureSetPoint)
- {
- SetTemperatureSetpoint(requiredTemp);
+ }
+ else if (temperatureSetPointValid && requiredTemp != temperatureSetPoint)
+ {
+ SetTemperatureSetpoint(requiredTemp);
log.InfoFormat("{0} - Set new temperature setpoint = {1}", Name, requiredTemp);
}
else if ((StateMachine.Time % 10) == (easythermCfg.ModbusAddress % 10)) /// This is to prevent overflow of the Modbus component queue for sending data
@@ -98,7 +103,6 @@ namespace TBF.BenchControl.Modbus.Easytherm
}
}
- public void RunDeviceAfter() { }
public void StopDevice() { }
public void StopDevice2() { }
diff --git a/TBF/BenchControl/Modbus/Novus/Novus.cs b/TBF/BenchControl/Modbus/Novus/Novus.cs
index ed5c79e26..2b8af7dc3 100644
--- a/TBF/BenchControl/Modbus/Novus/Novus.cs
+++ b/TBF/BenchControl/Modbus/Novus/Novus.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.Modbus.Novus
public class Novus : ComponentBase, IDevice, GenericDevices.ITempMeter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Novus));
- public override string ToString() { return string.Format("Novus({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
const ushort SetpointAddress = 0; /// Temperature setpoint
const ushort ProcessValueAddress = 1; /// Actual temperature
@@ -27,9 +27,8 @@ namespace TBF.BenchControl.Modbus.Novus
public float requiredTemp { get { return novusCfg.ProcParams.RequiredTemp; } }
- public Novus()
- {
- }
+
+ public Novus() { }
public Novus(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -38,26 +37,27 @@ namespace TBF.BenchControl.Modbus.Novus
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
-
- log.Warn(this.ToString());
}
/// Initialize this device
- public void Initialize()
+ public override void Initialize()
{
- if (novusCfg.DebugLevel == DebugMode.Simulate) return;
-
temperatureSetPointValid = false;
temperatureSetPointRequested = false;
actualTemperatureIsValid = false;
+
+ if (novusCfg.DebugLevel == DebugMode.Simulate)
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ else
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
+
/// Run this device
public void RunDeviceBefore()
{
if (novusCfg.DebugLevel == DebugMode.Simulate) return;
-
if (modbus.ReceivedTelegrams[novusCfg.ModbusAddress].Count > 0)
{
byte[] telegram = modbus.ReceivedTelegrams[novusCfg.ModbusAddress].Dequeue();
@@ -91,16 +91,21 @@ namespace TBF.BenchControl.Modbus.Novus
}
}
}
-
-
+ }
+
+ /// Run this device
+ public void RunDeviceAfter()
+ {
+ if (novusCfg.DebugLevel == DebugMode.Simulate) return;
+
if (!temperatureSetPointValid && !temperatureSetPointRequested)
- {
- RequestTemperatureSetpoint();
+ {
+ RequestTemperatureSetpoint();
temperatureSetPointRequested = true;
- }
- else if (temperatureSetPointValid && requiredTemp != temperatureSetPoint)
- {
- SetTemperatureSetpoint(requiredTemp);
+ }
+ else if (temperatureSetPointValid && requiredTemp != temperatureSetPoint)
+ {
+ SetTemperatureSetpoint(requiredTemp);
log.InfoFormat("{0} - Set new temperature setpoint = {1}", Name, requiredTemp);
}
else if ((StateMachine.Time % 10) == (novusCfg.ModbusAddress % 10)) /// This is to prevent overflow of the Modbus component queue for sending data
@@ -109,7 +114,6 @@ namespace TBF.BenchControl.Modbus.Novus
}
}
- public void RunDeviceAfter() { }
public void StopDevice() { }
public void StopDevice2() { }
@@ -178,7 +182,6 @@ namespace TBF.BenchControl.Modbus.Novus
}
-
///
/// Operations, etc.
///
diff --git a/TBF/BenchControl/Modbus/PressureMeter/Meret/PressureMeter.cs b/TBF/BenchControl/Modbus/PressureMeter/Meret/PressureMeter.cs
index 846be82db..72949639a 100644
--- a/TBF/BenchControl/Modbus/PressureMeter/Meret/PressureMeter.cs
+++ b/TBF/BenchControl/Modbus/PressureMeter/Meret/PressureMeter.cs
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter, IDevice
{
private static readonly ILog log = LogManager.GetLogger(typeof(PressureMeter));
- public override string ToString() { return string.Format("PressureMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly PressureMeterCfg pressureMtrCfg;
readonly GenericDevices.IModbus modbus;
@@ -21,9 +21,8 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
const ushort WatchdogBitMask = 0x0010;
- public PressureMeter()
- {
- }
+
+ public PressureMeter() { }
public PressureMeter(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -32,13 +31,12 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
-
- log.Warn(this.ToString());
}
/// Initialize this device
- public void Initialize()
+ public override void Initialize()
{
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
@@ -102,6 +100,16 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
receivedPressure = System.BitConverter.ToSingle(telegram, 3);
}
}
+ }
+
+ /// Run this device
+ public void RunDeviceAfter()
+ {
+ if (pressureMtrCfg.DebugLevel == Config.Entities.DebugMode.Simulate ||
+ pressureMtrCfg.DebugLevel == Config.Entities.DebugMode.FailureDuringOperation)
+ {
+ return;
+ }
if ((StateMachine.Time % 3) == (pressureMtrCfg.ModbusAddress % 3)) /// Each 3 seconds
{
@@ -111,7 +119,6 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
}
}
- public void RunDeviceAfter() { }
public void StopDevice() { }
public void StopDevice2() { }
}
diff --git a/TBF/BenchControl/Modbus/QuidoRS/QuidoRS.cs b/TBF/BenchControl/Modbus/QuidoRS/QuidoRS.cs
index ed8af16f8..eba5e8b9e 100644
--- a/TBF/BenchControl/Modbus/QuidoRS/QuidoRS.cs
+++ b/TBF/BenchControl/Modbus/QuidoRS/QuidoRS.cs
@@ -3,32 +3,32 @@
///
using System;
using System.Collections.Generic;
+using System.Diagnostics;
+using System.Text;
using log4net;
+using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Boxes;
-using System.Text;
-using System.Diagnostics;
namespace TBF.BenchControl.Modbus.QuidoRS
{
public class QuidoRS : ComponentBase, IDevice, GenericDevices.IParallelOutput
{
private static readonly ILog log = LogManager.GetLogger(typeof(QuidoRS));
- public override string ToString() { return string.Format("QuidoRS({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly QuidoRSCfg quidoRSCfg;
- readonly GenericDevices.IModbus modbus;
-
public QuidoVariant Variant { get { return quidoRSCfg.Variant; } }
+ readonly GenericDevices.IModbus modbus;
+
+ ushort watchdogBitMask;
+
private ushort currentOutputs;
private DateTime lastOutputsChange;
- ushort watchdogBitMask;
- public QuidoRS()
- {
- }
+ public QuidoRS() { }
public QuidoRS(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -37,15 +37,17 @@ namespace TBF.BenchControl.Modbus.QuidoRS
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
-
- watchdogBitMask = (ushort)(quidoRSCfg.WatchdogEnabled ? (1 << quidoRSCfg.WatchdogBitNr) : 0);
-
- log.Warn(this.ToString());
}
/// Initialize this device
- public void Initialize()
+ public override void Initialize()
{
+ watchdogBitMask = (ushort)(quidoRSCfg.WatchdogEnabled ? (1 << quidoRSCfg.WatchdogBitNr) : 0);
+
+ if (quidoRSCfg.DebugLevel == DebugMode.Simulate)
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ else
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
/// Run this device
@@ -79,7 +81,11 @@ namespace TBF.BenchControl.Modbus.QuidoRS
}
public void RunDeviceAfter() { }
- public void StopDevice() { SendOutputs(0); }
+
+ public void StopDevice()
+ {
+ SendOutputs(0);
+ }
public void StopDevice2() { }
diff --git a/TBF/BenchControl/Modbus/TankSelector/TankSelector.cs b/TBF/BenchControl/Modbus/TankSelector/TankSelector.cs
index 6b6de238b..654daf062 100644
--- a/TBF/BenchControl/Modbus/TankSelector/TankSelector.cs
+++ b/TBF/BenchControl/Modbus/TankSelector/TankSelector.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using log4net;
using TBF.BenchControl.Generic;
using TBF.BenchControl.GenericDevices;
+using TBF.BenchControl.Modbus;
using TBF.Boxes;
using TBF.Resources;
@@ -77,17 +78,15 @@ namespace TBF.BenchControl.Modbus.TankSelector
public class TankSelector : ComponentBase, ISequenceCondition, IDevice
{
private static readonly ILog log = LogManager.GetLogger(typeof(TankSelector));
- public override string ToString() { return string.Format("TankSelector({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly TankSelectorCfg tankSelectorCfg;
-
- readonly TBF.BenchControl.Modbus.QuidoRS.QuidoRS quidoRS;
-
- readonly TBF.BenchControl.Modbus.Easytherm.Easytherm hotHeating;
- readonly TBF.BenchControl.Modbus.Easytherm.Easytherm hotCooling;
- readonly TBF.BenchControl.Modbus.Easytherm.Easytherm warmHeating;
- readonly TBF.BenchControl.Modbus.Easytherm.Easytherm warmCooling;
- readonly TBF.BenchControl.Modbus.Easytherm.Easytherm coldCooling;
+ readonly QuidoRS.QuidoRS quidoRS;
+ Easytherm.Easytherm hotHeating;
+ Easytherm.Easytherm hotCooling;
+ Easytherm.Easytherm warmHeating;
+ Easytherm.Easytherm warmCooling;
+ Easytherm.Easytherm coldCooling;
public State State;
@@ -164,11 +163,16 @@ namespace TBF.BenchControl.Modbus.TankSelector
quidoRS = (TBF.BenchControl.Modbus.QuidoRS.QuidoRS)TbfComponents.FindComponent(cfg.ParentName, components);
if (quidoRS == null) throw new Exception(string.Format("Cannot find parent '{0}' of the component {1}", cfg.ParentName, Name));
- hotHeating = (TBF.BenchControl.Modbus.Easytherm.Easytherm)TbfComponents.FindComponent(tankSelectorCfg.HotWaterHeating, components);
- hotCooling = (TBF.BenchControl.Modbus.Easytherm.Easytherm)TbfComponents.FindComponent(tankSelectorCfg.HotWaterCooling, components);
- warmHeating = (TBF.BenchControl.Modbus.Easytherm.Easytherm)TbfComponents.FindComponent(tankSelectorCfg.WarmWaterHeating, components);
- warmCooling = (TBF.BenchControl.Modbus.Easytherm.Easytherm)TbfComponents.FindComponent(tankSelectorCfg.WarmWaterCooling, components);
- coldCooling = (TBF.BenchControl.Modbus.Easytherm.Easytherm)TbfComponents.FindComponent(tankSelectorCfg.ColdWaterCooling, components);
+ CreateConditions(false);
+ }
+
+ public override void Initialize()
+ {
+ hotHeating = (TBF.BenchControl.Modbus.Easytherm.Easytherm)TbfComponents.FindComponent(tankSelectorCfg.HotWaterHeating);
+ hotCooling = (TBF.BenchControl.Modbus.Easytherm.Easytherm)TbfComponents.FindComponent(tankSelectorCfg.HotWaterCooling);
+ warmHeating = (TBF.BenchControl.Modbus.Easytherm.Easytherm)TbfComponents.FindComponent(tankSelectorCfg.WarmWaterHeating);
+ warmCooling = (TBF.BenchControl.Modbus.Easytherm.Easytherm)TbfComponents.FindComponent(tankSelectorCfg.WarmWaterCooling);
+ coldCooling = (TBF.BenchControl.Modbus.Easytherm.Easytherm)TbfComponents.FindComponent(tankSelectorCfg.ColdWaterCooling);
if (hotHeating == null) throw new Exception(string.Format("Component '{0}' cannot find temperature controller '{1}'", Name, tankSelectorCfg.HotWaterHeating));
if (hotCooling == null) throw new Exception(string.Format("Component '{0}' cannot find temperature controller '{1}'", Name, tankSelectorCfg.HotWaterCooling));
@@ -176,12 +180,13 @@ namespace TBF.BenchControl.Modbus.TankSelector
if (warmCooling == null) throw new Exception(string.Format("Component '{0}' cannot find temperature controller '{1}'", Name, tankSelectorCfg.WarmWaterCooling));
if (coldCooling == null) throw new Exception(string.Format("Component '{0}' cannot find temperature controller '{1}'", Name, tankSelectorCfg.ColdWaterCooling));
- CreateConditions(true);
+ CreateConditions(true);
+ State = State.Unknown;
- State = State.Unknown;
+ SetOutputs(0); /// Reset all Quido outputs
- log.Fatal(this.ToString());
- }
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
///
@@ -257,11 +262,6 @@ namespace TBF.BenchControl.Modbus.TankSelector
///
/// IDevice interface implementation
///
- public void Initialize()
- {
- SetOutputs(0); /// Reset all Quido outputs
- }
-
public void RunDeviceBefore()
{
if (StateMachine.Time == 3)
diff --git a/TBF/BenchControl/Modbus/UltrasoundLevelMeter/LevelMeter.cs b/TBF/BenchControl/Modbus/UltrasoundLevelMeter/LevelMeter.cs
index 2a69cfcb1..d3c055b43 100644
--- a/TBF/BenchControl/Modbus/UltrasoundLevelMeter/LevelMeter.cs
+++ b/TBF/BenchControl/Modbus/UltrasoundLevelMeter/LevelMeter.cs
@@ -14,14 +14,11 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
public class LevelMeter : ComponentBase, GenericDevices.ILevelMeter, GenericDevices.ITempMeter, IDevice
{
private static readonly ILog log = LogManager.GetLogger(typeof(LevelMeter));
- public override string ToString() { return string.Format("LevelMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly LevelMeterCfg myCfg;
readonly GenericDevices.IModbus modbus;
- /// The state of the measurement
- MsrmntState msrmntState;
-
///
/// Measured values when MsrmntState == MsrmntState.Valid
///
@@ -37,9 +34,7 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
int msrmntTimeStamp;
- public LevelMeter()
- {
- }
+ public LevelMeter() { }
public LevelMeter(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -48,32 +43,22 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
-
- /// Connect to handler
- //ModbusAddress.MeretRS485Address[Idx0] = ModbusAddress;
-
- log.Warn(this.ToString());
}
/// Initialize this device
- public void Initialize()
+ public override void Initialize()
{
+ distance = 200.0;
+ level = 0;
+ percentage = 0;
+ temperature = 20.0;
+ state = 0;
+ msrmntTimeStamp = 0;
+
if (myCfg.DebugLevel == DebugMode.Simulate)
- {
- distance = 200.0;
- level = 0;
- percentage = 0;
- temperature = 20.0;
- state = 0;
-
- msrmntTimeStamp = StateMachine.Time;
- msrmntState = MsrmntState.Valid;
- return;
- }
-
- msrmntState = MsrmntState.Busy;
-
- log.FatalFormat("Successfully initialized device {0}", ToString());
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ else
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
@@ -124,7 +109,15 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
Debug.WriteLine(line);
}
}
+ }
+ public void RunDeviceAfter()
+ {
+ if (myCfg.DebugLevel == Config.Entities.DebugMode.Simulate ||
+ myCfg.DebugLevel == Config.Entities.DebugMode.FailureDuringOperation)
+ {
+ return;
+ }
byte[] msg = new byte[8]; /// Buffer for data to send
@@ -184,7 +177,6 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
}
}
- public void RunDeviceAfter() { }
public void StopDevice() { }
public void StopDevice2() { }
}
diff --git a/TBF/BenchControl/Modbus/WaterAnalyzer/Analyzer.cs b/TBF/BenchControl/Modbus/WaterAnalyzer/Analyzer.cs
index 7e76ed7b5..ea686023a 100644
--- a/TBF/BenchControl/Modbus/WaterAnalyzer/Analyzer.cs
+++ b/TBF/BenchControl/Modbus/WaterAnalyzer/Analyzer.cs
@@ -14,14 +14,11 @@ namespace TBF.BenchControl.Modbus.WaterAnalyzer
public class Analyzer : ComponentBase, GenericDevices.ITempMeter, IDevice
{
private static readonly ILog log = LogManager.GetLogger(typeof(Analyzer));
- public override string ToString() { return string.Format("Analyzer({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly AnalyzerCfg myCfg;
readonly GenericDevices.IModbus modbus;
- /// The state of the measurement
- MsrmntState msrmntState;
-
///
/// Measured values when MsrmntState == MsrmntState.Valid
///
@@ -34,9 +31,7 @@ namespace TBF.BenchControl.Modbus.WaterAnalyzer
int msrmntTimeStamp;
- public Analyzer()
- {
- }
+ public Analyzer() { }
public Analyzer(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -45,29 +40,19 @@ namespace TBF.BenchControl.Modbus.WaterAnalyzer
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
-
- /// Connect to handler
- //ModbusAddress.MeretRS485Address[Idx0] = ModbusAddress;
-
- log.Warn(this.ToString());
}
/// Initialize this device
- public void Initialize()
+ public override void Initialize()
{
+ conductivity = 0.0F;
+ temperature = 0.0;
+ msrmntTimeStamp = 0;
+
if (myCfg.DebugLevel == DebugMode.Simulate)
- {
- conductivity = 0.0F;
- temperature = 0.0;
-
- msrmntTimeStamp = StateMachine.Time;
- msrmntState = MsrmntState.Valid;
- return;
- }
-
- msrmntState = MsrmntState.Busy;
-
- log.FatalFormat("Successfully initialized device {0}", ToString());
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ else
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
@@ -107,7 +92,15 @@ namespace TBF.BenchControl.Modbus.WaterAnalyzer
Debug.WriteLine(line);
}
}
+ }
+ public void RunDeviceAfter()
+ {
+ if (myCfg.DebugLevel == Config.Entities.DebugMode.Simulate ||
+ myCfg.DebugLevel == Config.Entities.DebugMode.FailureDuringOperation)
+ {
+ return;
+ }
byte[] msg = new byte[8]; /// Buffer for data to send
@@ -131,7 +124,6 @@ namespace TBF.BenchControl.Modbus.WaterAnalyzer
}
}
- public void RunDeviceAfter() { }
public void StopDevice() { }
public void StopDevice2() { }
diff --git a/TBF/BenchControl/Modbus/WaterAnalyzer2/Analyzer.cs b/TBF/BenchControl/Modbus/WaterAnalyzer2/Analyzer.cs
index 0ee042b40..f0803a8b9 100644
--- a/TBF/BenchControl/Modbus/WaterAnalyzer2/Analyzer.cs
+++ b/TBF/BenchControl/Modbus/WaterAnalyzer2/Analyzer.cs
@@ -14,14 +14,11 @@ namespace TBF.BenchControl.Modbus.WaterAnalyzer2
public class Analyzer : ComponentBase, GenericDevices.ITempMeter, IDevice
{
private static readonly ILog log = LogManager.GetLogger(typeof(Analyzer));
- public override string ToString() { return string.Format("Analyzer({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly AnalyzerCfg myCfg;
readonly GenericDevices.IModbus modbus;
- /// The state of the measurement
- MsrmntState msrmntState;
-
///
/// Measured values when MsrmntState == MsrmntState.Valid
///
@@ -34,9 +31,7 @@ namespace TBF.BenchControl.Modbus.WaterAnalyzer2
int msrmntTimeStamp;
- public Analyzer()
- {
- }
+ public Analyzer() { }
public Analyzer(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -45,29 +40,19 @@ namespace TBF.BenchControl.Modbus.WaterAnalyzer2
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
-
- /// Connect to handler
- //ModbusAddress.MeretRS485Address[Idx0] = ModbusAddress;
-
- log.Warn(this.ToString());
}
/// Initialize this device
- public void Initialize()
+ public override void Initialize()
{
+ conductivity = 0.0F;
+ temperature = 0.0;
+ msrmntTimeStamp = 0;
+
if (myCfg.DebugLevel == DebugMode.Simulate)
- {
- conductivity = 0.0F;
- temperature = 0.0;
-
- msrmntTimeStamp = StateMachine.Time;
- msrmntState = MsrmntState.Valid;
- return;
- }
-
- msrmntState = MsrmntState.Busy;
-
- log.FatalFormat("Successfully initialized device {0}", ToString());
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ else
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
@@ -113,7 +98,16 @@ namespace TBF.BenchControl.Modbus.WaterAnalyzer2
Debug.WriteLine(line);
}
}
+ }
+ /// Run this device
+ public void RunDeviceAfter()
+ {
+ if (myCfg.DebugLevel == Config.Entities.DebugMode.Simulate ||
+ myCfg.DebugLevel == Config.Entities.DebugMode.FailureDuringOperation)
+ {
+ return;
+ }
byte[] msg = new byte[8]; /// Buffer for data to send
@@ -137,7 +131,6 @@ namespace TBF.BenchControl.Modbus.WaterAnalyzer2
}
}
- public void RunDeviceAfter() { }
public void StopDevice() { }
public void StopDevice2() { }
diff --git a/TBF/BenchControl/Network/Adapter/Netadapter.cs b/TBF/BenchControl/Network/Adapter/Netadapter.cs
index 11a0c1611..ba692d2fc 100644
--- a/TBF/BenchControl/Network/Adapter/Netadapter.cs
+++ b/TBF/BenchControl/Network/Adapter/Netadapter.cs
@@ -9,40 +9,35 @@ namespace TBF.BenchControl.Network.Adapter
public class Netadapter : ComponentBase, GenericDevices.INetworkAdapter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Netadapter));
- public override string ToString()
- {
- return string.Format("Component={0} IPAddress={1} NetMask={2} Description={3}", Cfg.Name, IPAddress, NetMask, (Cfg as NetadapterCfg).Description);
- }
-
- public bool Running { get { return running; } }
- bool running;
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly NetadapterCfg netadapterCfg;
- readonly IPAddress ipAddress;
- readonly IPAddress netMask;
- readonly IPAddress broadcastAddress;
+ IPAddress ipAddress;
+ IPAddress netMask;
+ IPAddress broadcastAddress;
public IPAddress IPAddress { get { return ipAddress; } }
public IPAddress NetMask { get { return netMask; } }
public IPAddress BroadcastAddress { get { return broadcastAddress; } }
- public Netadapter()
- {
- }
+
+ public Netadapter() { }
public Netadapter(Generic.IComponentCfg cfg)
: base(cfg)
{
netadapterCfg = cfg as NetadapterCfg;
- AdapterInfo.RefreshNetAdaptersInfo();
- AdapterInfo netadapter = AdapterInfo.GetNetAdapter(netadapterCfg.Description);
- ipAddress = netadapter.IPAddress;
- netMask = netadapter.NetMask;
- broadcastAddress = netadapter.GetBroadcastAddress();
-
- running = false;
-
- log.Warn(this.ToString());
}
- }
+
+ public override void Initialize()
+ {
+ AdapterInfo.RefreshNetAdaptersInfo();
+ AdapterInfo netadapter = AdapterInfo.GetNetAdapter(netadapterCfg.Description);
+ ipAddress = netadapter.IPAddress;
+ netMask = netadapter.NetMask;
+ broadcastAddress = netadapter.GetBroadcastAddress();
+
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ }
}
diff --git a/TBF/BenchControl/Network/Camera/CLP1611/Camera.cs b/TBF/BenchControl/Network/Camera/CLP1611/Camera.cs
index feee1d2c2..0d372b4de 100644
--- a/TBF/BenchControl/Network/Camera/CLP1611/Camera.cs
+++ b/TBF/BenchControl/Network/Camera/CLP1611/Camera.cs
@@ -73,7 +73,6 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
///
static int nextCameraIdx = 0;
static int GetCameraIdx() { return nextCameraIdx++; } /// Used in Initialize()
- public static new void ResetStaticProperties() { nextCameraIdx = 0; }
///
/// Telnet support
@@ -139,7 +138,6 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
public Camera() {}
-
public Camera(Generic.IComponentCfg cfg, IList components)
: base(cfg)
{
@@ -155,8 +153,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
running = false;
}
-
- public void Initialize()
+ public override void Initialize()
{
cameraIdx = GetCameraIdx();
diff --git a/TBF/BenchControl/Network/Camera/Display/Display.cs b/TBF/BenchControl/Network/Camera/Display/Display.cs
index d5f7d4d9d..193e0cdd7 100644
--- a/TBF/BenchControl/Network/Camera/Display/Display.cs
+++ b/TBF/BenchControl/Network/Camera/Display/Display.cs
@@ -14,33 +14,28 @@ namespace TBF.BenchControl.Network.Camera.Display
public class Display : ComponentBase, IOperation, ICameraDisplay
{
private static readonly ILog log = LogManager.GetLogger(typeof(Display));
- public override string ToString()
- {
- return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
- }
-
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public readonly DisplayCfg DisplayCfg;
- ///
- public Display()
- {
- }
- ///
+
+
+ public Display() { }
+
public Display(Generic.IComponentCfg cfg, IList components)
: base(cfg)
{
DisplayCfg = cfg as DisplayCfg;
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
public bool[] SelectedImages { get { return selectedImages; } }
bool[] selectedImages;
-
-
public enum CurrentOp
{
None,
diff --git a/TBF/BenchControl/Network/Camera/Roi/Roi.cs b/TBF/BenchControl/Network/Camera/Roi/Roi.cs
index 420fbf61f..6171f1f6f 100644
--- a/TBF/BenchControl/Network/Camera/Roi/Roi.cs
+++ b/TBF/BenchControl/Network/Camera/Roi/Roi.cs
@@ -12,21 +12,13 @@ namespace TBF.BenchControl.Network.Camera.Roi
{
public class Roi : ComponentBase, GenericDevices.IRegReaderLiveCamera, IOperation
{
- /// TODO: Implement support for sharing one camera by multiple ROI-s
-
private static readonly ILog log = LogManager.GetLogger(typeof(Roi));
- public override string ToString()
- {
- return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
- }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
- ///
- /// Cfg
- ///
public readonly RoiCfg RoiCfg;
- public readonly CLP1611.Camera NetCamera;
- public readonly Roi PreviousRoi;
+ public CLP1611.Camera NetCamera;
+ public Roi PreviousRoi;
///
/// ICamera interface functions
@@ -118,31 +110,29 @@ namespace TBF.BenchControl.Network.Camera.Roi
}
-
- public Roi()
- {
- }
+ public Roi() { }
public Roi(Generic.IComponentCfg cfg, IList components)
: base(cfg)
{
RoiCfg = cfg as RoiCfg;
- NetCamera = TbfComponents.FindComponent(cfg.ParentName, components) as CLP1611.Camera;
+ }
- PreviousRoi = TbfComponents.FindComponent(RoiCfg.PreviousRoi, components) as Roi;
+ public override void Initialize()
+ {
+ NetCamera = TbfComponents.FindComponent(RoiCfg.ParentName) as CLP1611.Camera;
+ PreviousRoi = TbfComponents.FindComponent(RoiCfg.PreviousRoi) as Roi;
- detected = false;
- RoiX = new Boxes.IntBox();
- RoiY = new Boxes.IntBox();
+ detected = false;
+ RoiX = new Boxes.IntBox();
+ RoiY = new Boxes.IntBox();
RoiWid = new Boxes.IntBox();
RoiHgh = new Boxes.IntBox();
- Clear();
+ Clear();
- //StartChangeHandler(); /// already done in StateMachine.InitializeBoardEtc(...)
-
- log.Warn(this.ToString());
- }
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
#region Configuration Change Handling
diff --git a/TBF/BenchControl/Network/Camera/RoiForFixedStart/Roi.cs b/TBF/BenchControl/Network/Camera/RoiForFixedStart/Roi.cs
index 648362072..46c78fcb9 100644
--- a/TBF/BenchControl/Network/Camera/RoiForFixedStart/Roi.cs
+++ b/TBF/BenchControl/Network/Camera/RoiForFixedStart/Roi.cs
@@ -11,23 +11,15 @@ namespace TBF.BenchControl.Network.Camera.RoiForFixedStart
{
public class Roi : ComponentBase, GenericDevices.IRegReaderStillCamera, IOperation
{
- /// TODO: Implement support for sharing one camera by multiple ROI-s
-
private static readonly ILog log = LogManager.GetLogger(typeof(Roi));
- public override string ToString()
- {
- return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
- }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
- ///
- /// Cfg
- ///
readonly RoiCfg roiCfg;
///
/// Camera and ICamera
///
- public readonly CLP1611.Camera NetCamera;
+ public CLP1611.Camera NetCamera;
public GenericDevices.ICamera Camera { get { return NetCamera as GenericDevices.ICamera; } }
public int Position
@@ -66,23 +58,21 @@ namespace TBF.BenchControl.Network.Camera.RoiForFixedStart
public int WMRefPulses { get { return wmRefPulses; } }
- public Roi()
- {
- }
+ public Roi() { }
public Roi(Generic.IComponentCfg cfg, IList components)
: base(cfg)
{
roiCfg = cfg as RoiCfg;
- NetCamera = TbfComponents.FindComponent(cfg.ParentName, components) as CLP1611.Camera;
-
- Clear();
-
- StartChangeHandler();
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ NetCamera = TbfComponents.FindComponent(roiCfg.ParentName) as CLP1611.Camera;
+ Clear();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
#region Configuration Change Handling
diff --git a/TBF/BenchControl/Network/Comet/Ambient/Ambient.cs b/TBF/BenchControl/Network/Comet/Ambient/Ambient.cs
index 4ba4df5c4..c80b73256 100644
--- a/TBF/BenchControl/Network/Comet/Ambient/Ambient.cs
+++ b/TBF/BenchControl/Network/Comet/Ambient/Ambient.cs
@@ -19,12 +19,12 @@ namespace TBF.BenchControl.Network.Comet.Ambient
public class Ambient : ComponentBase, IDevice, IOperation, GenericDevices.IAmbient
{
private static readonly ILog log = LogManager.GetLogger(typeof(Ambient));
- public override string ToString() { return string.Format("Ambient({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly AmbientCfg myCfg;
- readonly IPAddress ipAddress;
- readonly int tcpPort;
+ IPAddress ipAddress;
+ int tcpPort;
TcpClient tcpClient;
NetworkStream networkStream;
@@ -38,9 +38,6 @@ namespace TBF.BenchControl.Network.Comet.Ambient
State state;
- /// The state of the measurement
- MsrmntState msrmntState;
-
///
/// Measured values when MsrmntState == MsrmntState.Valid
///
@@ -51,9 +48,8 @@ namespace TBF.BenchControl.Network.Comet.Ambient
/// Measurement time stamp when MsrmntState == MsrmntState.Valid
int msrmntTimeStamp;
- public Ambient()
- {
- }
+
+ public Ambient() { }
///
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
@@ -62,35 +58,30 @@ namespace TBF.BenchControl.Network.Comet.Ambient
: base(cfg)
{
myCfg = cfg as AmbientCfg;
- if (myCfg == null) throw new ArgumentNullException("No configuration");
+ }
+
+ public override void Initialize()
+ {
+ temperature = 20.0f;
+ humidity = 40.0f;
+ pressure = 1.0f;
+ msrmntTimeStamp = 0;
ipAddress = IPAddress.Parse(myCfg.IPAddress);
tcpPort = myCfg.TcpPort;
-
- log.Warn(this.ToString());
- }
-
- public void Initialize()
- {
- if (myCfg.DebugLevel == DebugMode.Simulate)
- {
- temperature = 20.0f;
- humidity = 40.0f;
- pressure = 1.0f;
- msrmntTimeStamp = StateMachine.Time;
- msrmntState = MsrmntState.Valid;
- log.FatalFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
- return;
- }
-
- tcpClient = new TcpClient();
- tcpClient.Connect(ipAddress, tcpPort);
- networkStream = tcpClient.GetStream();
-
state = State.Idle;
- msrmntState = MsrmntState.Busy;
- log.FatalFormat("Initialization successful: {0}", this.ToString());
+ if (myCfg.DebugLevel == DebugMode.Normal)
+ {
+ tcpClient = new TcpClient();
+ tcpClient.Connect(ipAddress, tcpPort);
+ networkStream = tcpClient.GetStream();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ else
+ {
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ }
}
/// Run this device
@@ -122,7 +113,6 @@ namespace TBF.BenchControl.Network.Comet.Ambient
value = (int)bytes[9] * 256 + (int)bytes[10];
temperature = (float)(value / 10.0); /// Conversion to °C
msrmntTimeStamp = StateMachine.Time;
- msrmntState = MsrmntState.Valid;
log.InfoFormat("Ambient temperature = {0:F1} C", temperature);
state = State.Idle;
break;
@@ -130,7 +120,6 @@ namespace TBF.BenchControl.Network.Comet.Ambient
value = (int)bytes[9] * 256 + (int)bytes[10];
humidity = (float)(value / 10.0); /// Conversion to R%
msrmntTimeStamp = StateMachine.Time;
- msrmntState = MsrmntState.Valid;
log.InfoFormat("Ambient humidity = {0:F1} %", humidity);
state = State.Idle;
break;
@@ -138,7 +127,6 @@ namespace TBF.BenchControl.Network.Comet.Ambient
value = (int)bytes[9] * 256 + (int)bytes[10];
pressure = (float)(value / 10000.0); /// Conversion to bar
msrmntTimeStamp = StateMachine.Time;
- msrmntState = MsrmntState.Valid;
log.InfoFormat("Ambient pressure = {0:F0} mbar", 1000 * pressure);
state = State.Idle;
break;
@@ -256,8 +244,6 @@ namespace TBF.BenchControl.Network.Comet.Ambient
}
/// Stop this operation
- public void Stop()
- {
- }
+ public void Stop() { }
}
}
diff --git a/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs b/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs
index 168136f89..4b636177f 100644
--- a/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs
+++ b/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs
@@ -31,7 +31,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public class Tracing : ComponentBase, IOperation, GenericDevices.IResultsWriter, GenericDevices.IStartInfoReader, Generic.IDevice
{
private static readonly ILog log = LogManager.GetLogger(typeof(Tracing));
- public override string ToString() { return string.Format("Tracing({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public const string WorkstepName = "Test_bench";
@@ -45,13 +45,11 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
}
}
- readonly IPAddress ipAddress;
- readonly IPAddress netMask;
-
+ IPAddress ipAddress;
+ IPAddress netMask;
public IPAddress IPAddress { get { return ipAddress; } }
public IPAddress NetMask { get { return netMask; } }
-
enum OpState
{
None,
@@ -103,81 +101,70 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
: base(cfg)
{
tracingCfg = cfg as MonitoringCfg;
- if (tracingCfg == null) throw new ArgumentException("tracingCfg");
+ }
+ public override void Initialize()
+ {
Network.AdapterInfo.RefreshNetAdaptersInfo();
Network.AdapterInfo netadapter = Network.AdapterInfo.GetNetAdapter(tracingCfg.NetAdapter);
ipAddress = netadapter.IPAddress;
-
netMask = netadapter.NetMask;
+ currentProcess = null;
currentOpState = OpState.None;
- log.Warn(this.ToString());
- }
- ///
- /// IDevice interface implementation
- ///
- public void Initialize()
- {
- if (tracingCfg.DebugLevel == DebugMode.Simulate) return;
-
- string ipAddress = GetIPAddress();
-
- ///
- /// Session factory is used to create database sessions
- ///
- sessionFactory = FluentNHibernate.Cfg.Fluently.Configure()
- .Database(FluentNHibernate.Cfg.Db.MySQLConfiguration.Standard.ConnectionString(tracingCfg.ConnStr))
- .Mappings(m => m.FluentMappings.AddFromAssemblyOf())
- .ExposeConfiguration(TracingDB.DB.BuildSchema)
- .BuildSessionFactory();
-
- ///
- /// Session factory 2 is used to create the 2nd database sessions
- ///
- if (!string.IsNullOrEmpty(tracingCfg.ConnStr2))
+ if (tracingCfg.DebugLevel == DebugMode.Normal)
{
- sessionFactory2 = FluentNHibernate.Cfg.Fluently.Configure()
- .Database(FluentNHibernate.Cfg.Db.MySQLConfiguration.Standard.ConnectionString(tracingCfg.ConnStr2))
- .Mappings(m => m.FluentMappings.AddFromAssemblyOf())
- .ExposeConfiguration(TracingDB.DB.BuildSchema)
- .BuildSessionFactory();
- }
+ /// Session factory is used to create database sessions
+ sessionFactory = FluentNHibernate.Cfg.Fluently.Configure()
+ .Database(FluentNHibernate.Cfg.Db.MySQLConfiguration.Standard.ConnectionString(tracingCfg.ConnStr))
+ .Mappings(m => m.FluentMappings.AddFromAssemblyOf())
+ .ExposeConfiguration(TracingDB.DB.BuildSchema)
+ .BuildSessionFactory();
- ///
- /// Register this test bench in the tracing DB for approx. 2 weeks
- ///
- ISession session = sessionFactory.OpenSession();
+ /// Session factory 2 is used to create the 2nd database sessions
+ if (!string.IsNullOrEmpty(tracingCfg.ConnStr2))
+ {
+ sessionFactory2 = FluentNHibernate.Cfg.Fluently.Configure()
+ .Database(FluentNHibernate.Cfg.Db.MySQLConfiguration.Standard.ConnectionString(tracingCfg.ConnStr2))
+ .Mappings(m => m.FluentMappings.AddFromAssemblyOf())
+ .ExposeConfiguration(TracingDB.DB.BuildSchema)
+ .BuildSessionFactory();
+ }
+
+ /// Register this test bench in the tracing DB for approx. 2 weeks
+ ISession session = sessionFactory.OpenSession();
#if !DEBUG
/// Only a release version registers a workplace
TracingDB.DB.RegisterWorkplace(session,
workplace,
Users.GlobalData.GetCurrentUserName(),
- GetIPAddress(),
+ (ipAddress != null) ? ipAddress.ToString() : "1.2.3.4",
"",
WorkstepName,
DateTime.Now + new TimeSpan(15, 0, 0, 0));
#endif
- session.Flush();
- session.Close();
- TracingDB.DB.SessionFactory = sessionFactory;
- if (session != null) session.Dispose();
+ session.Flush();
+ session.Close();
+ TracingDB.DB.SessionFactory = sessionFactory;
+ if (session != null) session.Dispose();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ else
+ {
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ }
+ }
- currentProcess = null;
- }
///
- string GetIPAddress()
- {
- return (ipAddress != null) ? ipAddress.ToString() : "1.2.3.4";
- }
+ /// IDevice interface implementation
///
public void RunDeviceBefore() { }
public void RunDeviceAfter() { }
///
public void StopDevice()
{
- if (tracingCfg.DebugLevel == DebugMode.Simulate) return;
+ if (tracingCfg.DebugLevel != DebugMode.Normal) return;
using (ISession session = sessionFactory.OpenSession())
{
diff --git a/TBF/BenchControl/Output/DB/SaveDiverterCorrections/SaveDiverterCorr.cs b/TBF/BenchControl/Output/DB/SaveDiverterCorrections/SaveDiverterCorr.cs
index de90614cd..f43901955 100644
--- a/TBF/BenchControl/Output/DB/SaveDiverterCorrections/SaveDiverterCorr.cs
+++ b/TBF/BenchControl/Output/DB/SaveDiverterCorrections/SaveDiverterCorr.cs
@@ -23,7 +23,7 @@ namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections
public class SaveDiverterCorr : ComponentBase, IOperation, GenericDevices.IResultsWriter
{
private static readonly ILog log = LogManager.GetLogger(typeof(SaveDiverterCorr));
- public override string ToString() { return string.Format("SaveDiverterCorr({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
SaveDiverterCorrCfg myCfg;
@@ -50,11 +50,14 @@ namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections
: base(cfg)
{
myCfg = cfg as SaveDiverterCorrCfg;
- currentOp = CurrentOp.None;
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
///
/// Writes the test cycle results into a file, Events: Event.ResultsWritten
diff --git a/TBF/BenchControl/Output/DB/SaveFlowmeterCorrections/SaveFlowmeterCorr.cs b/TBF/BenchControl/Output/DB/SaveFlowmeterCorrections/SaveFlowmeterCorr.cs
index 85ecbe6fc..2514ad5a6 100644
--- a/TBF/BenchControl/Output/DB/SaveFlowmeterCorrections/SaveFlowmeterCorr.cs
+++ b/TBF/BenchControl/Output/DB/SaveFlowmeterCorrections/SaveFlowmeterCorr.cs
@@ -23,7 +23,7 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
public class SaveFlowmeterCorr : ComponentBase, IOperation, GenericDevices.IResultsWriter
{
private static readonly ILog log = LogManager.GetLogger(typeof(SaveFlowmeterCorr));
- public override string ToString() { return string.Format("SaveFlowmeterCorr({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
SaveFlowmeterCorrCfg myCfg;
@@ -50,11 +50,14 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
: base(cfg)
{
myCfg = cfg as SaveFlowmeterCorrCfg;
- currentOp = CurrentOp.None;
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
///
/// Writes the test cycle results into a file, Events: Event.ResultsWritten
diff --git a/TBF/BenchControl/Output/DB/SensusOracle/Database.cs b/TBF/BenchControl/Output/DB/SensusOracle/Database.cs
index 7f42feff1..7b0760a4a 100644
--- a/TBF/BenchControl/Output/DB/SensusOracle/Database.cs
+++ b/TBF/BenchControl/Output/DB/SensusOracle/Database.cs
@@ -51,7 +51,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public class Database : ComponentBase, IOperation, GenericDevices.IResultsWriter, GenericDevices.IStartInfoReader, Generic.IDevice
{
private static readonly ILog log = LogManager.GetLogger(typeof(Database));
- public override string ToString() { return string.Format("{0}({1})", GetType().Namespace.Substring(17), Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public const int Anbid_StaraTura = 4;
@@ -129,39 +129,46 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
: base(cfg)
{
dbCfg = cfg as DatabaseCfg;
- currentOpState = OpState.None;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ currentOpState = OpState.None;
+
+ if (dbCfg.DebugLevel == DebugMode.Normal)
+ {
+ productionDB = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
+ qualityDB = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltaqual;Password=test;");
+ testDB = new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;");
+
+ ///
+ /// Do something with the database to see if the connection works well
+ ///
+ if (DBUsed == DBUsed.Production)
+ {
+ SelectedDB.Open();
+
+ string rslt = "none";
+ OracleCommand cmd = new OracleCommand("SELECT standort FROM anbieter_sd WHERE anbid = 4", SelectedDB);
+ OracleDataReader dr = cmd.ExecuteReader();
+ if (dr.Read()) rslt = dr.GetString(0);
+ dr.Close();
+
+ SelectedDB.Close();
+ }
+
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ else
+ {
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ }
+ }
+
///
/// IDevice interface implementation
///
- public void Initialize()
- {
- if (dbCfg.DebugLevel == DebugMode.Simulate) return;
-
- productionDB = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
- qualityDB = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltaqual;Password=test;");
- testDB = new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;");
-
- ///
- /// Do something with the database to see if the connection works well
- ///
- if (DBUsed == DBUsed.Production)
- {
- SelectedDB.Open();
-
- string rslt = "none";
- OracleCommand cmd = new OracleCommand("SELECT standort FROM anbieter_sd WHERE anbid = 4", SelectedDB);
- OracleDataReader dr = cmd.ExecuteReader();
- if (dr.Read()) rslt = dr.GetString(0);
- dr.Close();
-
- SelectedDB.Close();
- }
- }
- ///
- public void RunDeviceBefore() {}
+ public void RunDeviceBefore() { }
public void RunDeviceAfter() {}
///
public void StopDevice()
diff --git a/TBF/BenchControl/Output/EventTriggers/Iperl/Trigger.cs b/TBF/BenchControl/Output/EventTriggers/Iperl/Trigger.cs
index 29ae616ed..21d3af2ec 100644
--- a/TBF/BenchControl/Output/EventTriggers/Iperl/Trigger.cs
+++ b/TBF/BenchControl/Output/EventTriggers/Iperl/Trigger.cs
@@ -9,7 +9,7 @@ namespace TBF.BenchControl.Output.EventTriggers.Iperl
public class Trigger : ComponentBase, IOperation, GenericDevices.IEventTrigger
{
private static readonly ILog log = LogManager.GetLogger(typeof(Trigger));
- public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly TriggerCfg triggerCfg;
@@ -22,10 +22,13 @@ namespace TBF.BenchControl.Output.EventTriggers.Iperl
: base(cfg)
{
triggerCfg = cfg as TriggerCfg;
- ApplyConfig();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ApplyConfig();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
void ApplyConfig()
{
diff --git a/TBF/BenchControl/Output/EventTriggers/Standard/Trigger.cs b/TBF/BenchControl/Output/EventTriggers/Standard/Trigger.cs
index e6e226bce..63accf31e 100644
--- a/TBF/BenchControl/Output/EventTriggers/Standard/Trigger.cs
+++ b/TBF/BenchControl/Output/EventTriggers/Standard/Trigger.cs
@@ -11,7 +11,7 @@ namespace TBF.BenchControl.Output.EventTriggers.Standard
public class Trigger : ComponentBase, IOperation, GenericDevices.IEventTrigger
{
private static readonly ILog log = LogManager.GetLogger(typeof(Trigger));
- public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly TriggerCfg triggerCfg;
string src { get { return triggerCfg.EventSource; } }
@@ -25,10 +25,14 @@ namespace TBF.BenchControl.Output.EventTriggers.Standard
: base(cfg)
{
triggerCfg = cfg as TriggerCfg;
- if (triggerCfg == null) throw new ArgumentException("triggerCfg");
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
+
#region Configuration Change Handling
public static void OnCfgChange(object sender, CfgChangeArgs args)
diff --git a/TBF/BenchControl/Output/FileWriters/Basic/Writer.cs b/TBF/BenchControl/Output/FileWriters/Basic/Writer.cs
index beb907ebf..851beedea 100644
--- a/TBF/BenchControl/Output/FileWriters/Basic/Writer.cs
+++ b/TBF/BenchControl/Output/FileWriters/Basic/Writer.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
public class Writer : ComponentBase, IOperation, GenericDevices.IResultsWriter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Writer));
- public override string ToString() { return string.Format("Output.FileWriters.Basic({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly WriterCfg writerCfg;
@@ -38,10 +38,13 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
: base(cfg)
{
writerCfg = cfg as WriterCfg;
- ApplyConfig();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ApplyConfig();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
void ApplyConfig()
{
diff --git a/TBF/BenchControl/Output/FileWriters/Elde/Writer.cs b/TBF/BenchControl/Output/FileWriters/Elde/Writer.cs
index 884eee901..a8aeb519a 100644
--- a/TBF/BenchControl/Output/FileWriters/Elde/Writer.cs
+++ b/TBF/BenchControl/Output/FileWriters/Elde/Writer.cs
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Output.FileWriters.Elde
public class Writer : ComponentBase, IOperation, GenericDevices.IResultsWriter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Writer));
- public override string ToString() { return string.Format("Output.FileWriters.Enhanced({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly WriterCfg writerCfg;
@@ -37,10 +37,13 @@ namespace TBF.BenchControl.Output.FileWriters.Elde
: base(cfg)
{
writerCfg = cfg as WriterCfg;
- ApplyConfig();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ApplyConfig();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
void ApplyConfig()
{
diff --git a/TBF/BenchControl/Output/FileWriters/Enhanced/Writer.cs b/TBF/BenchControl/Output/FileWriters/Enhanced/Writer.cs
index eca5cc4ce..9d0584146 100644
--- a/TBF/BenchControl/Output/FileWriters/Enhanced/Writer.cs
+++ b/TBF/BenchControl/Output/FileWriters/Enhanced/Writer.cs
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
public class Writer : ComponentBase, IOperation, GenericDevices.IResultsWriter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Writer));
- public override string ToString() { return string.Format("Output.FileWriters.Enhanced({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly WriterCfg writerCfg;
@@ -37,10 +37,13 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
: base(cfg)
{
writerCfg = cfg as WriterCfg;
- ApplyConfig();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ApplyConfig();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
void ApplyConfig()
{
diff --git a/TBF/BenchControl/Output/FileWriters/ImageArchiver/Archiver.cs b/TBF/BenchControl/Output/FileWriters/ImageArchiver/Archiver.cs
index 49e999703..63ead2081 100644
--- a/TBF/BenchControl/Output/FileWriters/ImageArchiver/Archiver.cs
+++ b/TBF/BenchControl/Output/FileWriters/ImageArchiver/Archiver.cs
@@ -15,8 +15,7 @@ namespace TBF.BenchControl.Output.FileWriters.ImageArchiver
public class Archiver : ComponentBase, IOperation, GenericDevices.IResultsWriter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Archiver));
- public override string ToString() { return string.Format("Output.FileWriters.Basic({0})", Cfg.ToString(1)); }
-
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly ArchiverCfg writerCfg;
@@ -54,11 +53,8 @@ namespace TBF.BenchControl.Output.FileWriters.ImageArchiver
#endregion Configuration Change Handling
-
Results.Entities.Batch batch;
- bool abort; /// Set to 'true' by Stop() operation to abort writing to the file
-
public Archiver() {}
@@ -66,10 +62,13 @@ namespace TBF.BenchControl.Output.FileWriters.ImageArchiver
: base(cfg)
{
writerCfg = cfg as ArchiverCfg;
- StartChangeHandler();
- log.Debug(ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
///
/// Returns a file name derived from a DateTime structure.
diff --git a/TBF/BenchControl/Output/FileWriters/IperlLogger/Writer.cs b/TBF/BenchControl/Output/FileWriters/IperlLogger/Writer.cs
index b9943a607..0f3e85ddd 100644
--- a/TBF/BenchControl/Output/FileWriters/IperlLogger/Writer.cs
+++ b/TBF/BenchControl/Output/FileWriters/IperlLogger/Writer.cs
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
public class Writer : ComponentBase, IOperation, GenericDevices.IResultsWriter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Writer));
- public override string ToString() { return string.Format("Sensus-Oracle-Database({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
WriterCfg writerCfg;
@@ -49,11 +49,14 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
: base(cfg)
{
writerCfg = cfg as WriterCfg;
- currentOp = CurrentOp.None;
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
///
/// Returns a file name derived from a DateTime structure.
diff --git a/TBF/BenchControl/Output/FileWriters/OneFilePerMeter/Writer.cs b/TBF/BenchControl/Output/FileWriters/OneFilePerMeter/Writer.cs
index caf4607fa..e28fb5d5e 100644
--- a/TBF/BenchControl/Output/FileWriters/OneFilePerMeter/Writer.cs
+++ b/TBF/BenchControl/Output/FileWriters/OneFilePerMeter/Writer.cs
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Output.FileWriters.OneFilePerMeter
public class Writer : ComponentBase, IOperation, GenericDevices.IResultsWriter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Writer));
- public override string ToString() { return string.Format("Output.FileWriters.Enhanced({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly WriterCfg writerCfg;
@@ -30,8 +30,6 @@ namespace TBF.BenchControl.Output.FileWriters.OneFilePerMeter
Results.Entities.Batch batch;
- bool abort; /// Set to 'true' by Stop() operation to abort writing to files
-
public Writer() {}
@@ -39,10 +37,13 @@ namespace TBF.BenchControl.Output.FileWriters.OneFilePerMeter
: base(cfg)
{
writerCfg = cfg as WriterCfg;
- ApplyConfig();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ApplyConfig();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
void ApplyConfig()
{
@@ -291,8 +292,6 @@ namespace TBF.BenchControl.Output.FileWriters.OneFilePerMeter
/// Write aligned columns
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
{
- if (abort) return;
-
wrtr.Write(leftColumn[i]);
wrtr.Write(new string(' ', maxLen - leftColumn[i].Length + 3));
wrtr.WriteLine(rightColumn[i]);
@@ -304,7 +303,6 @@ namespace TBF.BenchControl.Output.FileWriters.OneFilePerMeter
foreach (var wm in batch.WaterMeters)
{
WriteWM(wrtr, wm);
- if (abort) return;
}
///----------
@@ -352,8 +350,6 @@ namespace TBF.BenchControl.Output.FileWriters.OneFilePerMeter
int totalWidth = 0;
for (int i = 0; i < testItems.Count; i++)
{
- if (abort) return;
-
columnWidths[i] = ElSpaces(testItems[i].Caption).Length;
foreach (var mtr in wm.RegularMeterTestRslts())
{
@@ -381,8 +377,6 @@ namespace TBF.BenchControl.Output.FileWriters.OneFilePerMeter
/// Write column headers
for (int i = 0; i < testItems.Count; i++)
{
- if (abort) return;
-
string caption = ElSpaces(testItems[i].Caption);
wr.Write(caption);
@@ -405,8 +399,6 @@ namespace TBF.BenchControl.Output.FileWriters.OneFilePerMeter
/// Write table data
foreach (var mtr in wm.RegularMeterTestRslts())
{
- if (abort) return;
-
if (mtr != null && mtr.IsPilotRslt() && mtr.Publish() == Config.Entities.Publish.Always)
{
for (int i = 0; i < testItems.Count; i++)
diff --git a/TBF/BenchControl/Output/FileWriters/Xml/Writer.cs b/TBF/BenchControl/Output/FileWriters/Xml/Writer.cs
index e4f04c1a7..747c072a9 100644
--- a/TBF/BenchControl/Output/FileWriters/Xml/Writer.cs
+++ b/TBF/BenchControl/Output/FileWriters/Xml/Writer.cs
@@ -16,7 +16,7 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
public class Writer : ComponentBase, IOperation, GenericDevices.IResultsWriter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Writer));
- public override string ToString() { return string.Format("Output.FileWriters.Enhanced({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly WriterCfg writerCfg;
@@ -31,8 +31,6 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
Results.Entities.Batch batch;
- bool abort;
-
public Writer() {}
@@ -40,10 +38,13 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
: base(cfg)
{
writerCfg = cfg as WriterCfg;
- ApplyConfig();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ApplyConfig();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
void ApplyConfig()
{
@@ -262,8 +263,6 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
/// Common items 1
foreach (var v in commonItems)
{
- if (abort) return;
-
/// Fetch the item and strip color information
string itemText = v.Print(wm);
string[] texts = itemText.Split(new char[] { '|' });
@@ -275,8 +274,6 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
/// Test items
foreach (var mtr in wm.RegularMeterTestRslts())
{
- if (abort) return;
-
if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
{
wr.WriteLine(string.Format(" <{0}>", testTag));
diff --git a/TBF/BenchControl/Output/FileWriters/XmlBatch/Writer.cs b/TBF/BenchControl/Output/FileWriters/XmlBatch/Writer.cs
index d17f2c322..3a7800c1f 100644
--- a/TBF/BenchControl/Output/FileWriters/XmlBatch/Writer.cs
+++ b/TBF/BenchControl/Output/FileWriters/XmlBatch/Writer.cs
@@ -16,7 +16,7 @@ namespace TBF.BenchControl.Output.FileWriters.XmlBatch
public class Writer : ComponentBase, IOperation, GenericDevices.IResultsWriter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Writer));
- public override string ToString() { return string.Format("Output.FileWriters.Enhanced({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly WriterCfg writerCfg;
@@ -33,8 +33,6 @@ namespace TBF.BenchControl.Output.FileWriters.XmlBatch
Results.Entities.Batch batch;
- bool abort;
-
public Writer() {}
@@ -46,6 +44,11 @@ namespace TBF.BenchControl.Output.FileWriters.XmlBatch
log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ApplyConfig();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
void ApplyConfig()
{
@@ -266,8 +269,6 @@ namespace TBF.BenchControl.Output.FileWriters.XmlBatch
/// Common items
foreach (var v in commonItems)
{
- if (abort) return;
-
/// Fetch the item and strip color information
string itemText = v.Print(batch.WaterMeters[0]);
string[] texts = itemText.Split(new char[] { '|' });
@@ -283,8 +284,6 @@ namespace TBF.BenchControl.Output.FileWriters.XmlBatch
/// Meter items
foreach (var v in meterItems)
{
- if (abort) return;
-
/// Fetch the item and strip color information
string itemText = v.Print(wm);
string[] texts = itemText.Split(new char[] { '|' });
@@ -296,8 +295,6 @@ namespace TBF.BenchControl.Output.FileWriters.XmlBatch
/// Test items
foreach (var mtr in wm.RegularMeterTestRslts())
{
- if (abort) return;
-
if ((mtr != null) && (mtr.Publish() == Config.Entities.Publish.Always))
{
wr.WriteLine(string.Format(" <{0}>", testTag));
diff --git a/TBF/BenchControl/Output/Printers/Enhanced/Printer.cs b/TBF/BenchControl/Output/Printers/Enhanced/Printer.cs
index c20475cdd..c42961d0e 100644
--- a/TBF/BenchControl/Output/Printers/Enhanced/Printer.cs
+++ b/TBF/BenchControl/Output/Printers/Enhanced/Printer.cs
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
- public override string ToString() { return string.Format("Output.Printers.Enhanced({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly PrinterCfg printerCfg;
@@ -38,10 +38,13 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
- ApplyConfig();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ApplyConfig();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
void ApplyConfig()
{
diff --git a/TBF/BenchControl/Output/Printers/Label/Printer.cs b/TBF/BenchControl/Output/Printers/Label/Printer.cs
index 76dba4437..091827194 100644
--- a/TBF/BenchControl/Output/Printers/Label/Printer.cs
+++ b/TBF/BenchControl/Output/Printers/Label/Printer.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.Output.Printers.Label
public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
- public override string ToString() { return string.Format("LabelPrinter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly PrinterCfg printerCfg;
@@ -34,10 +34,14 @@ namespace TBF.BenchControl.Output.Printers.Label
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
- ApplyConfig();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ApplyConfig();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
void ApplyConfig()
{
commonItems = Results.WMeterRsltItemSpec.FromStrArray(printerCfg.ItemsToPrint);
diff --git a/TBF/BenchControl/Output/Printers/MultiLabel/Printer.cs b/TBF/BenchControl/Output/Printers/MultiLabel/Printer.cs
index d404c6afb..33d35eb40 100644
--- a/TBF/BenchControl/Output/Printers/MultiLabel/Printer.cs
+++ b/TBF/BenchControl/Output/Printers/MultiLabel/Printer.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.Output.Printers.MultiLabel
public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
- public override string ToString() { return string.Format("MultiLabel.Printer({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly PrinterCfg printerCfg;
@@ -34,10 +34,14 @@ namespace TBF.BenchControl.Output.Printers.MultiLabel
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
- ApplyConfig();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ApplyConfig();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
void ApplyConfig()
{
commonItems = Results.WMeterRsltItemSpec.FromStrArray(printerCfg.ItemsToPrint);
diff --git a/TBF/BenchControl/Output/Printers/Munich/Printer.cs b/TBF/BenchControl/Output/Printers/Munich/Printer.cs
index f840b9ec7..bc43566b0 100644
--- a/TBF/BenchControl/Output/Printers/Munich/Printer.cs
+++ b/TBF/BenchControl/Output/Printers/Munich/Printer.cs
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Output.Printers.Munich
public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
- public override string ToString() { return string.Format("Output.Printers.Munich({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly PrinterCfg printerCfg;
@@ -27,17 +27,19 @@ namespace TBF.BenchControl.Output.Printers.Munich
public string Version { get { return printerCfg.Version; } }
- public Printer()
- {
- }
+ public Printer() { }
public Printer(Generic.IComponentCfg cfg)
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
/// Events: ResultsPrinted
/// Procedure to print the results of
diff --git a/TBF/BenchControl/Output/Printers/Munich/PrinterFactory.cs b/TBF/BenchControl/Output/Printers/Munich/PrinterFactory.cs
index 426945698..372b97305 100644
--- a/TBF/BenchControl/Output/Printers/Munich/PrinterFactory.cs
+++ b/TBF/BenchControl/Output/Printers/Munich/PrinterFactory.cs
@@ -10,8 +10,6 @@ namespace TBF.BenchControl.Output.Printers.Munich
{
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
- public void ResetStaticProperties() { Printer.ResetStaticProperties(); }
-
public IComponent DummyComponent() { return new Printer(); }
public IComponent GetComponent(IComponentCfg cfg, IList components) { return new Printer(cfg); }
diff --git a/TBF/BenchControl/Output/Printers/OnePerBatch/Printer.cs b/TBF/BenchControl/Output/Printers/OnePerBatch/Printer.cs
index 8134399ef..66868847e 100644
--- a/TBF/BenchControl/Output/Printers/OnePerBatch/Printer.cs
+++ b/TBF/BenchControl/Output/Printers/OnePerBatch/Printer.cs
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Output.Printers.OnePerBatch
public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
- public override string ToString() { return string.Format("Output.Printers.OnePerMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly PrinterCfg printerCfg;
@@ -38,10 +38,13 @@ namespace TBF.BenchControl.Output.Printers.OnePerBatch
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
- ApplyConfig();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ApplyConfig();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
void ApplyConfig()
{
diff --git a/TBF/BenchControl/Output/Printers/OnePerMeter/Printer.cs b/TBF/BenchControl/Output/Printers/OnePerMeter/Printer.cs
index 037e3588d..85d8546e5 100644
--- a/TBF/BenchControl/Output/Printers/OnePerMeter/Printer.cs
+++ b/TBF/BenchControl/Output/Printers/OnePerMeter/Printer.cs
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
- public override string ToString() { return string.Format("Output.Printers.OnePerMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly PrinterCfg printerCfg;
@@ -38,10 +38,13 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
- ApplyConfig();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ApplyConfig();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
void ApplyConfig()
{
diff --git a/TBF/BenchControl/Output/Printers/Zapiska/Printer.cs b/TBF/BenchControl/Output/Printers/Zapiska/Printer.cs
index dc7bfc86b..6e906a4b8 100644
--- a/TBF/BenchControl/Output/Printers/Zapiska/Printer.cs
+++ b/TBF/BenchControl/Output/Printers/Zapiska/Printer.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.Output.Printers.Zapiska
public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
- public override string ToString() { return string.Format("Output.Printers.Zapiska({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly PrinterCfg printerCfg;
@@ -37,10 +37,13 @@ namespace TBF.BenchControl.Output.Printers.Zapiska
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
- ApplyConfig();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ApplyConfig();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
void ApplyConfig()
{
diff --git a/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/EntryForm.cs b/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/EntryForm.cs
index 33af82b3e..29203eead 100644
--- a/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/EntryForm.cs
+++ b/TBF/BenchControl/RegisterReaders/KPackE/DataEntryForRadio/EntryForm.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.DataEntryForRadio
public class EntryForm : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasWMStatesForm, IReceivesDataFromRadio
{
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
- public override string ToString() { return string.Format("DataEntry.Standard48({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool UsesCameras() { return false; }
@@ -62,29 +62,31 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.DataEntryForRadio
CurrentOp currentOp;
- public EntryForm()
- {
- }
+ public EntryForm() { }
public EntryForm(Generic.IComponentCfg cfg, IList components)
: base(cfg)
{
entryFormCfg = cfg as EntryFormCfg;
+ }
- radio = (KPackE.Radio.Radio)TbfComponents.FindComponent(entryFormCfg.Radio, components);
+ public override void Initialize()
+ {
+ radio = (KPackE.Radio.Radio)TbfComponents.FindComponent(entryFormCfg.Radio);
if (radio == null) throw new Exception("Cannot find Radio");
radio.EntryForm = this;
- disabled = new bool[Config.Data.WMsCount];
- wmStartState = new double[Config.Data.WMsCount];
- wmStartStateStr = new string[Config.Data.WMsCount];
- wmEndState = new double[Config.Data.WMsCount];
- wmCycleEndState = new string[Config.Data.WMsCount];
+ disabled = new bool[Config.Data.WMsCount];
+ wmStartState = new double[Config.Data.WMsCount];
+ wmStartStateStr = new string[Config.Data.WMsCount];
+ wmEndState = new double[Config.Data.WMsCount];
+ wmCycleEndState = new string[Config.Data.WMsCount];
+ currentOp = CurrentOp.None;
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
+
/// Reference to the operation
public IOperation ShowCycleBeginFormOp()
{
diff --git a/TBF/BenchControl/RegisterReaders/KPackE/Radio/Radio.cs b/TBF/BenchControl/RegisterReaders/KPackE/Radio/Radio.cs
index bedf7fe6c..8abb5343c 100644
--- a/TBF/BenchControl/RegisterReaders/KPackE/Radio/Radio.cs
+++ b/TBF/BenchControl/RegisterReaders/KPackE/Radio/Radio.cs
@@ -22,7 +22,7 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.Radio
public class Radio : ComponentBase, IDevice
{
private static readonly ILog log = LogManager.GetLogger(typeof(Radio));
- public override string ToString() { return string.Format("Radio({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
enum KPackE_Type
{
@@ -71,9 +71,7 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.Radio
public IReceivesDataFromRadio EntryForm;
- public Radio()
- {
- }
+ public Radio() { }
///
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
@@ -82,41 +80,28 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.Radio
public Radio(Generic.IComponentCfg cfg)
: base(cfg)
{
- RegReaders = new List();
-
- serialPort = null;
radioCfg = cfg as RadioCfg;
+ }
+
+ public override void Initialize()
+ {
+ RegReaders = new List();
data = new List();
-
- log.Warn(this.ToString());
- }
-
- ~Radio()
- {
- }
-
-
- public void Initialize()
- {
- if (radioCfg.DebugLevel == DebugMode.Simulate)
- {
- serialPort = null;
- log.FatalFormat("{0} - Device simulated", Name);
- return;
- }
-
lastTelegramReceived = DateTime.MinValue;
- string comPortName = "COM" + radioCfg.ComPortNr.ToString();
- serialPort = new SerialPort(comPortName, radioCfg.BaudRate, radioCfg.Parity, radioCfg.DataBits, radioCfg.StopBits);
- serialPort.Handshake = radioCfg.Handshake;
- serialPort.Open();
-
- //stopWorkerThread = false;
- //workerThread = new Thread(Worker);
- //workerThread.Start();
-
- log.FatalFormat("{0} - Device successfully initialized", Name);
+ if (radioCfg.DebugLevel == DebugMode.Normal)
+ {
+ string portName = "COM" + radioCfg.ComPortNr.ToString();
+ serialPort = new SerialPort(portName, radioCfg.BaudRate, radioCfg.Parity, radioCfg.DataBits, radioCfg.StopBits);
+ serialPort.Handshake = radioCfg.Handshake;
+ serialPort.Open();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ else
+ {
+ serialPort = null;
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ }
}
diff --git a/TBF/BenchControl/RegisterReaders/KPackE/RegisterReader/RegisterReader.cs b/TBF/BenchControl/RegisterReaders/KPackE/RegisterReader/RegisterReader.cs
index 2b704f242..9b3cbeb88 100644
--- a/TBF/BenchControl/RegisterReaders/KPackE/RegisterReader/RegisterReader.cs
+++ b/TBF/BenchControl/RegisterReaders/KPackE/RegisterReader/RegisterReader.cs
@@ -11,11 +11,11 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.RegisterReader
public class RegisterReader : ComponentBase, GenericDevices.IRegReader, IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(RegisterReader));
- public override string ToString() { return string.Format("KPackE.RegisterReader({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
- readonly RegisterReaderCfg registerReaderCfg;
- readonly Radio.Radio radio;
- readonly TBF.BenchControl.Elde.ControlBoardDev controlBoard;
+ readonly RegisterReaderCfg rrCfg;
+ Radio.Radio radio;
+ TBF.BenchControl.Elde.ControlBoardDev controlBoard;
public int Position
@@ -28,7 +28,7 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.RegisterReader
}
}
public Config.Entities.RegisterReaderType RegisterReaderType { get { return Config.Entities.RegisterReaderType.Manual; } }
- public double PulsesPerLtr { get { return registerReaderCfg.ProcParams.PulsesPerLtr; } }
+ public double PulsesPerLtr { get { return rrCfg.ProcParams.PulsesPerLtr; } }
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); } }
///
@@ -76,26 +76,26 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.RegisterReader
public int WMRefPulses { get { return wmRefPulses; } }
-
- public RegisterReader()
- {
- }
+ public RegisterReader() { }
public RegisterReader(Generic.IComponentCfg cfg, IList components)
: base(cfg)
{
- registerReaderCfg = cfg as RegisterReaderCfg;
+ rrCfg = cfg as RegisterReaderCfg;
+ }
- /// Control board is used to read reference flowmeter pulses
- radio = (Radio.Radio)TbfComponents.FindComponent(cfg.ParentName, components);
+ public override void Initialize()
+ {
+ /// Control board is used to read reference flowmeter pulses
+ radio = (Radio.Radio)TbfComponents.FindComponent(rrCfg.ParentName);
if (radio == null) throw new Exception(string.Format("Cannot find a parent of {0}", Name));
controlBoard = StateMachine.ControlBoard;
- Clear();
+ Clear();
- log.Warn(this.ToString());
- }
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
public void Clear()
{
diff --git a/TBF/BenchControl/RegisterReaders/PulsesFromEldeCB/RegisterReader.cs b/TBF/BenchControl/RegisterReaders/PulsesFromEldeCB/RegisterReader.cs
index cbda40cb2..9252f9f7a 100644
--- a/TBF/BenchControl/RegisterReaders/PulsesFromEldeCB/RegisterReader.cs
+++ b/TBF/BenchControl/RegisterReaders/PulsesFromEldeCB/RegisterReader.cs
@@ -11,7 +11,7 @@ namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
public class RegisterReader : ComponentBase, GenericDevices.IRegReader, IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(RegisterReader));
- public override string ToString() { return string.Format("RegisterReader({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly RegisterReaderCfg registerReaderCfg;
@@ -39,9 +39,7 @@ namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
readonly TBF.BenchControl.Elde.ControlBoardDev controlBoard;
- public RegisterReader()
- {
- }
+ public RegisterReader() { }
public RegisterReader(Generic.IComponentCfg cfg, IList components)
: base(cfg)
@@ -50,14 +48,14 @@ namespace TBF.BenchControl.RegisterReaders.PulsesFromEldeCB
controlBoard = (TBF.BenchControl.Elde.ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
-
- Clear();
-
- /// Prepare data for SendCalibData() control board component method
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ Clear();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public void Clear()
{
log.DebugFormat("{0}:Clear()", Name);
diff --git a/TBF/BenchControl/RegisterReaders/SerialStream/SerialStream.cs b/TBF/BenchControl/RegisterReaders/SerialStream/SerialStream.cs
index 0139a8426..28a873a63 100644
--- a/TBF/BenchControl/RegisterReaders/SerialStream/SerialStream.cs
+++ b/TBF/BenchControl/RegisterReaders/SerialStream/SerialStream.cs
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.RegisterReaders.SerialStream
public class SerialStream : ComponentBase, IDevice, GenericDevices.IRegReaderDatastream, GenericDevices.IHasTestName, IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(SerialStream));
- public override string ToString() { return string.Format("RegisterReaders.SerialStream({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly SerialStreamCfg myCfg;
@@ -176,32 +176,17 @@ namespace TBF.BenchControl.RegisterReaders.SerialStream
private TextReader textReader; /// Used instead of serialPort in DebugMode.Simulate
- public SerialStream()
- {
- }
+ public SerialStream() { }
public SerialStream(Generic.IComponentCfg cfg)
: base(cfg)
{
- ClearData();
-
myCfg = cfg as SerialStreamCfg;
-
- log.Warn(this.ToString());
}
- ///
- /// Clear data related to a specific water meter
- ///
- public void ClearData()
- {
- commFailed = false;
- datastreamFramesCount = 0;
- }
-
- public void Initialize()
+ public override void Initialize()
{
- ClearData();
+ ClearData();
datastreamParsingEnabled = false;
currentFrameFormat = new FrameFormat(FrameLength, FrameFrequency,
@@ -232,7 +217,8 @@ namespace TBF.BenchControl.RegisterReaders.SerialStream
myCfg.StopBits);
serialPort.Handshake = myCfg.Handshake;
- serialPort.Open();
+ serialPort.Open();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
else if (DebugLevel == DebugMode.Simulate)
{
@@ -244,9 +230,24 @@ namespace TBF.BenchControl.RegisterReaders.SerialStream
{
MessageBox.Show("Missing file C:\\TBF\\Simulate\\seriastream.txt");
}
+ log.FatalFormat("{0} simulated: {1}", Name, this);
+ }
+ else
+ {
+ serialPort = null;
+ log.FatalFormat("{0} in other mode: {1}", Name, this);
}
}
+ ///
+ /// Clear data related to a specific water meter
+ ///
+ public void ClearData()
+ {
+ commFailed = false;
+ datastreamFramesCount = 0;
+ }
+
public void RunDeviceBefore()
{
if (DebugLevel == DebugMode.Normal || DebugLevel == DebugMode.Simulate)
diff --git a/TBF/BenchControl/StateMachine.cs b/TBF/BenchControl/StateMachine.cs
index 0d48c7575..69fdd7989 100644
--- a/TBF/BenchControl/StateMachine.cs
+++ b/TBF/BenchControl/StateMachine.cs
@@ -305,11 +305,11 @@ namespace TBF.BenchControl
}
- public static string CurrentlyInitializedDeviceName;
+ public static string CurrentlyInitializedComponentName;
///
public static string InitializeDevices()
{
- CurrentlyInitializedDeviceName = "-";
+ CurrentlyInitializedComponentName = "-";
bool anyComponentIsInSimulMode = false;
StringBuilder inSimulMode = new StringBuilder();
@@ -323,18 +323,17 @@ namespace TBF.BenchControl
anyComponentIsInSimulMode = true;
}
- IDevice device = cmpnt as IDevice;
- if (device != null)
- {
- CurrentlyInitializedDeviceName = device.Name;
- UiBridge.Bridge.OnActivity(null, device.Name); /// Info
+ if (cmpnt is IDevice)
+ {
+ devices.Add(cmpnt as IDevice); /// Only components that were initialized are added
+ UiBridge.Bridge.OnActivity(null, cmpnt.Name); /// Info
+ }
- device.Initialize();
- AddDevice(device); /// Only components that were initialized are added
- }
+ CurrentlyInitializedComponentName = cmpnt.Name;
+ cmpnt.Initialize();
}
- CurrentlyInitializedDeviceName = "---";
+ CurrentlyInitializedComponentName = "---";
///
/// (1) Propagate debug levels from parents to children when necessary
diff --git a/TBF/BenchControl/TestMethods/Adjustment/TestMethod.cs b/TBF/BenchControl/TestMethods/Adjustment/TestMethod.cs
index 7e6ad5f7f..74fe03f65 100644
--- a/TBF/BenchControl/TestMethods/Adjustment/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/Adjustment/TestMethod.cs
@@ -12,21 +12,23 @@ namespace TBF.BenchControl.TestMethods.Adjustment
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
- public override string ToString() { return string.Format("TestMethods.Adjustment({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
- public TestMethod()
- {
- }
+ public TestMethod() { }
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new AdjustmentSeq()).Execute(test, repetNr, isLastRepetition, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/ChangeFlowDirection/TestMethod.cs b/TBF/BenchControl/TestMethods/ChangeFlowDirection/TestMethod.cs
index a605a8841..111dad8c1 100644
--- a/TBF/BenchControl/TestMethods/ChangeFlowDirection/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/ChangeFlowDirection/TestMethod.cs
@@ -12,21 +12,23 @@ namespace TBF.BenchControl.TestMethods.ChangeFlowDirection
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
- public override string ToString() { return string.Format("TestMethods.ChangeFlowDirection({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
- public TestMethod()
- {
- }
+ public TestMethod() { }
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new ChangeFlowDirectionSeq()).Execute(test, repetNr, isLastRepetition, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/CombinedWithDetection/TestMethod.cs b/TBF/BenchControl/TestMethods/CombinedWithDetection/TestMethod.cs
index 117b8b855..bb160b107 100644
--- a/TBF/BenchControl/TestMethods/CombinedWithDetection/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/CombinedWithDetection/TestMethod.cs
@@ -12,24 +12,26 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
- public override string ToString() { return string.Format("TestMethods.CombinedWithDetection({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly TestMethodCfg testMethodCfg;
public bool CanTest(MetersKind meters) { return meters == MetersKind.Combined; }
public bool DoTransitions() { return true; }
- public TestMethod()
- {
- }
+ public TestMethod() { }
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new CombinedWithDetectionSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/Counter/TestMethod.cs b/TBF/BenchControl/TestMethods/Counter/TestMethod.cs
index 57c8a9e5e..00c88305d 100644
--- a/TBF/BenchControl/TestMethods/Counter/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/Counter/TestMethod.cs
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.TestMethods.Counter
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
- public override string ToString() { return string.Format("TestMethods.Counter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return false; }
@@ -22,22 +22,20 @@ namespace TBF.BenchControl.TestMethods.Counter
/// Enumeration of counters via static fields and methods
///
static int nextCounterIdx = 0;
- public static new void ResetStaticProperties()
- {
- nextCounterIdx = 0;
- }
public static int CountersCount { get { return nextCounterIdx; } }
public static TestMethod[] Counters;
///
private int counterIdx0; /// 0-based index of this counter
- public TestMethod()
- {
- }
+ public TestMethod() { }
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
+ {
+ }
+
+ public override void Initialize()
{
counterIdx0 = nextCounterIdx++;
///
@@ -48,9 +46,9 @@ namespace TBF.BenchControl.TestMethods.Counter
if (contersSoFar != null) for (int i = 0; i < contersSoFar.Length; i++) Counters[i] = contersSoFar[i];
Counters[nextCounterIdx - 1] = this;
}
-
- log.Warn(this.ToString());
- }
+
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
diff --git a/TBF/BenchControl/TestMethods/DiverterTest/Component.cs b/TBF/BenchControl/TestMethods/DiverterTest/Component.cs
index a7085ac09..83b2f413b 100644
--- a/TBF/BenchControl/TestMethods/DiverterTest/Component.cs
+++ b/TBF/BenchControl/TestMethods/DiverterTest/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new DiverterTestSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams);
diff --git a/TBF/BenchControl/TestMethods/Dummy/TestMethod.cs b/TBF/BenchControl/TestMethods/Dummy/TestMethod.cs
index 1deae72d0..b96aab3f8 100644
--- a/TBF/BenchControl/TestMethods/Dummy/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/Dummy/TestMethod.cs
@@ -12,21 +12,23 @@ namespace TBF.BenchControl.TestMethods.Dummy
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
- public override string ToString() { return string.Format("TestMethods.Dummy({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return true; }
- public TestMethod()
- {
- }
+ public TestMethod() { }
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new DummySeq()).Execute(test, repetNr, isLastRepetition, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/Endurance/Component.cs b/TBF/BenchControl/TestMethods/Endurance/Component.cs
index 187d4e50e..f661d9115 100644
--- a/TBF/BenchControl/TestMethods/Endurance/Component.cs
+++ b/TBF/BenchControl/TestMethods/Endurance/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.Endurance
public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new EnduranceSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.Cycle, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FixedStart/Compound/Component.cs b/TBF/BenchControl/TestMethods/FixedStart/Compound/Component.cs
index 004cdb94b..90ee1c866 100644
--- a/TBF/BenchControl/TestMethods/FixedStart/Compound/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStart/Compound/Component.cs
@@ -19,16 +19,18 @@ namespace TBF.BenchControl.TestMethods.FixedStart.Compound
public bool CanTest(MetersKind meters) { return meters == MetersKind.Combined; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartSeq()).Execute(test, repetNr, isLastRepetition, true, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FixedStart/HeatMeters/Component.cs b/TBF/BenchControl/TestMethods/FixedStart/HeatMeters/Component.cs
index a81d8a671..f9b517665 100644
--- a/TBF/BenchControl/TestMethods/FixedStart/HeatMeters/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStart/HeatMeters/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FixedStart.HeatMeters
public bool CanTest(MetersKind meters) { return meters == MetersKind.HeatMeter; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartSeq()).Execute(test, repetNr, isLastRepetition, false, testMethodCfg.TestParams, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FixedStart/Single/Component.cs b/TBF/BenchControl/TestMethods/FixedStart/Single/Component.cs
index efdaebd29..e0a3fff18 100644
--- a/TBF/BenchControl/TestMethods/FixedStart/Single/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStart/Single/Component.cs
@@ -19,16 +19,18 @@ namespace TBF.BenchControl.TestMethods.FixedStart.Single
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartSeq()).Execute(test, repetNr, isLastRepetition, false, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FixedStartAdvanced/Single/Component.cs b/TBF/BenchControl/TestMethods/FixedStartAdvanced/Single/Component.cs
index c4371f3b1..ebc45baa9 100644
--- a/TBF/BenchControl/TestMethods/FixedStartAdvanced/Single/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStartAdvanced/Single/Component.cs
@@ -12,21 +12,23 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced.Single
public class Component : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString() { return string.Format("TestMethods.FixedStartAdvanced({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartAdvancedSeq()).Execute(test, repetNr, isLastRepetition);
diff --git a/TBF/BenchControl/TestMethods/FixedStartDeferredEval/Compound/Component.cs b/TBF/BenchControl/TestMethods/FixedStartDeferredEval/Compound/Component.cs
index 87c297b52..25cd4f879 100644
--- a/TBF/BenchControl/TestMethods/FixedStartDeferredEval/Compound/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStartDeferredEval/Compound/Component.cs
@@ -19,16 +19,19 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval.Compound
public bool CanTest(MetersKind meters) { return meters == MetersKind.Combined; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
private IntermediateData intermediateData;
public object IntermediateData { get { return intermediateData; } }
diff --git a/TBF/BenchControl/TestMethods/FixedStartDeferredEval/HeatMeters/Component.cs b/TBF/BenchControl/TestMethods/FixedStartDeferredEval/HeatMeters/Component.cs
index a2f439e89..9fba799c4 100644
--- a/TBF/BenchControl/TestMethods/FixedStartDeferredEval/HeatMeters/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStartDeferredEval/HeatMeters/Component.cs
@@ -21,17 +21,20 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval.HeatMeters
public bool CanTest(MetersKind meters) { return meters == MetersKind.HeatMeter; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
private IntermediateData intermediateData;
public object IntermediateData { get { return intermediateData; } }
diff --git a/TBF/BenchControl/TestMethods/FixedStartDeferredEval/Single/Component.cs b/TBF/BenchControl/TestMethods/FixedStartDeferredEval/Single/Component.cs
index cb7193d5d..26ff9e2e4 100644
--- a/TBF/BenchControl/TestMethods/FixedStartDeferredEval/Single/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStartDeferredEval/Single/Component.cs
@@ -19,16 +19,19 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval.Single
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
private IntermediateData intermediateData;
public object IntermediateData { get { return intermediateData; } }
diff --git a/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/Compound/Component.cs b/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/Compound/Component.cs
index 648bb7496..c3a07c8b5 100644
--- a/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/Compound/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/Compound/Component.cs
@@ -19,16 +19,19 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval.Compound
public bool CanTest(MetersKind meters) { return meters == MetersKind.Combined; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
private IntermediateData intermediateData;
public object IntermediateData { get { return intermediateData; } }
diff --git a/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/HeatMeters/Component.cs b/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/HeatMeters/Component.cs
index 1270acf91..fd66c4da5 100644
--- a/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/HeatMeters/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/HeatMeters/Component.cs
@@ -21,17 +21,20 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval.HeatMeters
public bool CanTest(MetersKind meters) { return meters == MetersKind.HeatMeter; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
private IntermediateData intermediateData;
public object IntermediateData { get { return intermediateData; } }
diff --git a/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/Single/Component.cs b/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/Single/Component.cs
index 82fb949a7..80ef00cee 100644
--- a/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/Single/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStartMassCollDeferredEval/Single/Component.cs
@@ -19,16 +19,19 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval.Single
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
private IntermediateData intermediateData;
public object IntermediateData { get { return intermediateData; } }
diff --git a/TBF/BenchControl/TestMethods/FixedStartMassCollection/Compound/Component.cs b/TBF/BenchControl/TestMethods/FixedStartMassCollection/Compound/Component.cs
index a1296b27a..3d30e4513 100644
--- a/TBF/BenchControl/TestMethods/FixedStartMassCollection/Compound/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStartMassCollection/Compound/Component.cs
@@ -19,16 +19,18 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.Compound
public bool CanTest(MetersKind meters) { return meters == MetersKind.Combined; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartMassCollectionSeq()).Execute(test, repetNr, isLastRepetition, true, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FixedStartMassCollection/HeatMeters/Component.cs b/TBF/BenchControl/TestMethods/FixedStartMassCollection/HeatMeters/Component.cs
index 631a3dd11..c7e670879 100644
--- a/TBF/BenchControl/TestMethods/FixedStartMassCollection/HeatMeters/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStartMassCollection/HeatMeters/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.HeatMeters
public bool CanTest(MetersKind meters) { return meters == MetersKind.HeatMeter; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartMassCollectionSeq()).Execute(test, repetNr, isLastRepetition, false, testMethodCfg.TestParams, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FixedStartMassCollection/Single/Component.cs b/TBF/BenchControl/TestMethods/FixedStartMassCollection/Single/Component.cs
index f3325fba6..0a203296b 100644
--- a/TBF/BenchControl/TestMethods/FixedStartMassCollection/Single/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStartMassCollection/Single/Component.cs
@@ -19,16 +19,18 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.Single
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartMassCollectionSeq()).Execute(test, repetNr, isLastRepetition, false, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FixedStartTankCollection/Compound/Component.cs b/TBF/BenchControl/TestMethods/FixedStartTankCollection/Compound/Component.cs
index 1a1979eb8..36d46d69f 100644
--- a/TBF/BenchControl/TestMethods/FixedStartTankCollection/Compound/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStartTankCollection/Compound/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection.Compound
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartTankCollectionSeq()).Execute(test, repetNr, isLastRepetition, null, testMethodCfg.TestParams, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FixedStartTankCollection/Single/Component.cs b/TBF/BenchControl/TestMethods/FixedStartTankCollection/Single/Component.cs
index 570c509a1..f5e7694f6 100644
--- a/TBF/BenchControl/TestMethods/FixedStartTankCollection/Single/Component.cs
+++ b/TBF/BenchControl/TestMethods/FixedStartTankCollection/Single/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection.Single
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartTankCollectionSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStart/Compound/Component.cs b/TBF/BenchControl/TestMethods/FlyingStart/Compound/Component.cs
index f05435af5..5b511d732 100644
--- a/TBF/BenchControl/TestMethods/FlyingStart/Compound/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStart/Compound/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.Compound
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStart/HeatMeters/Component.cs b/TBF/BenchControl/TestMethods/FlyingStart/HeatMeters/Component.cs
index 354e1fd19..f41531054 100644
--- a/TBF/BenchControl/TestMethods/FlyingStart/HeatMeters/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStart/HeatMeters/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.HeatMeters
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartSeq()).Execute(test, repetNr, isLastRepetition, null, testMethodCfg.TestParams, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStart/Single/Component.cs b/TBF/BenchControl/TestMethods/FlyingStart/Single/Component.cs
index 09ab145ad..ec40c271a 100644
--- a/TBF/BenchControl/TestMethods/FlyingStart/Single/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStart/Single/Component.cs
@@ -19,16 +19,18 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.Single
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartSeq()).Execute(test, repetNr, isLastRepetition, null, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Compound/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Compound/Component.cs
index 6c1af9a5b..c10a4035b 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Compound/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Compound/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Compoun
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartFirstRepetWithMassCollSeq()).Execute(test, repetNr, isLastRepetition, null, testMethodCfg.TestParams, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/HeatMeters/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/HeatMeters/Component.cs
index 6c99debd9..03751992f 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/HeatMeters/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/HeatMeters/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.HeatMet
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartFirstRepetWithMassCollSeq()).Execute(test, repetNr, isLastRepetition, null, null, testMethodCfg.TestParams, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/Component.cs
index e89de941f..bf051853e 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/Single/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl.Single
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartFirstRepetWithMassCollSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, null, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/Compound/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/Compound/Component.cs
index 5b7bd1eda..7915f56bf 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/Compound/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/Compound/Component.cs
@@ -22,17 +22,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative.Compound
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartMassCollComparativeSeq()).Execute(test, repetNr, isLastRepetition, null, testMethodCfg.TestParams, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/HeatMeters/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/HeatMeters/Component.cs
index a28b53725..0188fe594 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/HeatMeters/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/HeatMeters/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative.HeatMeters
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartMassCollComparativeSeq()).Execute(test, repetNr, isLastRepetition, null, null, testMethodCfg.TestParams, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/Single/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/Single/Component.cs
index 5378b8608..6495de081 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/Single/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/Single/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative.Single
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartMassCollComparativeSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, null, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/Compound/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/Compound/Component.cs
index cc5e0ce62..d1f4f16ac 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/Compound/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/Compound/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged.Compound
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartMassCollProlongedSeq()).Execute(test, repetNr, isLastRepetition, null, testMethodCfg.TestParams, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/HeatMeters/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/HeatMeters/Component.cs
index bae14fb6b..fcf756e7a 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/HeatMeters/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/HeatMeters/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged.HeatMeters
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartMassCollProlongedSeq()).Execute(test, repetNr, isLastRepetition, null, null, testMethodCfg.TestParams, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/Single/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/Single/Component.cs
index 1055400ae..c22d371de 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/Single/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/Single/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged.Single
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartMassCollProlongedSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, null, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/Compound/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/Compound/Component.cs
index a2e73c087..5cd83105c 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/Compound/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/Compound/Component.cs
@@ -22,17 +22,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.Compound
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartMassCollectionSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/HeatMeters/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/HeatMeters/Component.cs
index fcd2debf7..55311f005 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/HeatMeters/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/HeatMeters/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.HeatMeters
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartMassCollectionSeq()).Execute(test, repetNr, isLastRepetition, null, testMethodCfg.TestParams, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/Single/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/Single/Component.cs
index c9d96541d..e04bc70b7 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/Single/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/Single/Component.cs
@@ -19,16 +19,18 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.Single
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartMassCollectionSeq()).Execute(test, repetNr, isLastRepetition, null, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartTankCollection/Compound/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartTankCollection/Compound/Component.cs
index 8a4fd6096..0d95676ee 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartTankCollection/Compound/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartTankCollection/Compound/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection.Compound
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartTankCollectionSeq()).Execute(test, repetNr, isLastRepetition, null, testMethodCfg.TestParams, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/FlyingStartTankCollection/Single/Component.cs b/TBF/BenchControl/TestMethods/FlyingStartTankCollection/Single/Component.cs
index 0597a4e19..cdf6357f0 100644
--- a/TBF/BenchControl/TestMethods/FlyingStartTankCollection/Single/Component.cs
+++ b/TBF/BenchControl/TestMethods/FlyingStartTankCollection/Single/Component.cs
@@ -21,17 +21,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection.Single
readonly TestMethodCfg testMethodCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FlyingStartTankCollectionSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, null, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/GrabImage/Component.cs b/TBF/BenchControl/TestMethods/GrabImage/Component.cs
index 916dd0adf..72e9fc993 100644
--- a/TBF/BenchControl/TestMethods/GrabImage/Component.cs
+++ b/TBF/BenchControl/TestMethods/GrabImage/Component.cs
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.TestMethods.GrabImage
public class Component : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString() { return string.Format("TestMethods.GrabImage({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return false; }
@@ -51,18 +51,19 @@ namespace TBF.BenchControl.TestMethods.GrabImage
#endregion Configuration Change Handling
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
this.cfg = cfg as GrabImageCfg;
- StartChangeHandler();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int idummy, bool bdummy)
{
return (new GrabImageSeq()).Execute(test, cfg);
diff --git a/TBF/BenchControl/TestMethods/LeakTest/TestMethod.cs b/TBF/BenchControl/TestMethods/LeakTest/TestMethod.cs
index 598fb1600..96aad7600 100644
--- a/TBF/BenchControl/TestMethods/LeakTest/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/LeakTest/TestMethod.cs
@@ -12,24 +12,26 @@ namespace TBF.BenchControl.TestMethods.LeakTest
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
- public override string ToString() { return string.Format("TestMethods.LeakTest({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return true; }
readonly TestMethodCfg testMethodCfg;
- public TestMethod()
- {
- }
+ public TestMethod() { }
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new LeakTestSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams);
diff --git a/TBF/BenchControl/TestMethods/LiveStream/Component.cs b/TBF/BenchControl/TestMethods/LiveStream/Component.cs
index 5b6b716e6..60b7c2e9b 100644
--- a/TBF/BenchControl/TestMethods/LiveStream/Component.cs
+++ b/TBF/BenchControl/TestMethods/LiveStream/Component.cs
@@ -12,27 +12,29 @@ namespace TBF.BenchControl.TestMethods.LiveStream
public class Component : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString() { return string.Format("TestMethods.LiveStream({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return false; }
- readonly LiveStreamCfg cfg;
+ readonly LiveStreamCfg myCfg;
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
- this.cfg = cfg as LiveStreamCfg;
+ myCfg = cfg as LiveStreamCfg;
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int idummy, bool bdummy)
{
- return (new LiveStreamSeq()).Execute(test, cfg.HiResolution);
+ return (new LiveStreamSeq()).Execute(test, myCfg.HiResolution);
}
}
}
diff --git a/TBF/BenchControl/TestMethods/ManualEntry/Component.cs b/TBF/BenchControl/TestMethods/ManualEntry/Component.cs
index adcdf51ab..37bd02fcd 100644
--- a/TBF/BenchControl/TestMethods/ManualEntry/Component.cs
+++ b/TBF/BenchControl/TestMethods/ManualEntry/Component.cs
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.TestMethods.ManualEntry
public class Component : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString() { return string.Format("ManualEntry({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly ManualEntryCfg myCfg;
@@ -26,16 +26,18 @@ namespace TBF.BenchControl.TestMethods.ManualEntry
: base(cfg)
{
myCfg = cfg as ManualEntryCfg;
- StartChangeHandler();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new ManualEntrySeq()).Execute(test, repetNr, isLastRepetition, myCfg, DebugLevel);
}
-
#region Configuration Change Handling
public static void OnCfgChange(object sender, CfgChangeArgs args)
diff --git a/TBF/BenchControl/TestMethods/OuterLoop/End/Component.cs b/TBF/BenchControl/TestMethods/OuterLoop/End/Component.cs
index 728b567be..1b6263fa2 100644
--- a/TBF/BenchControl/TestMethods/OuterLoop/End/Component.cs
+++ b/TBF/BenchControl/TestMethods/OuterLoop/End/Component.cs
@@ -19,16 +19,18 @@ namespace TBF.BenchControl.TestMethods.OuterLoop.End
public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return false; }
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return new List { Event.OuterLoopEnd };
diff --git a/TBF/BenchControl/TestMethods/OuterLoop/Start/Component.cs b/TBF/BenchControl/TestMethods/OuterLoop/Start/Component.cs
index 7b25efa9d..9dbfaed56 100644
--- a/TBF/BenchControl/TestMethods/OuterLoop/Start/Component.cs
+++ b/TBF/BenchControl/TestMethods/OuterLoop/Start/Component.cs
@@ -19,16 +19,18 @@ namespace TBF.BenchControl.TestMethods.OuterLoop.Start
public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return false; }
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return new List { Event.OuterLoopStart };
diff --git a/TBF/BenchControl/TestMethods/PMaxTest/TestMethod.cs b/TBF/BenchControl/TestMethods/PMaxTest/TestMethod.cs
index add52b45c..3d582b4f3 100644
--- a/TBF/BenchControl/TestMethods/PMaxTest/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/PMaxTest/TestMethod.cs
@@ -22,17 +22,19 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
readonly TestMethodCfg testMethodCfg;
- public TestMethod()
- {
- }
+ public TestMethod() { }
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new PMaxTestSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams);
diff --git a/TBF/BenchControl/TestMethods/PMaxTest/TestMethodFactory.cs b/TBF/BenchControl/TestMethods/PMaxTest/TestMethodFactory.cs
index f1adce069..447571981 100644
--- a/TBF/BenchControl/TestMethods/PMaxTest/TestMethodFactory.cs
+++ b/TBF/BenchControl/TestMethods/PMaxTest/TestMethodFactory.cs
@@ -8,9 +8,7 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
{
public class TestMethodFactory : IComponentFactory
{
- public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
-
- public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
+ public string ClassName { get { return GetType().Namespace.Substring(17); } }
public IComponent DummyComponent() { return new TestMethod(); }
diff --git a/TBF/BenchControl/TestMethods/PulsesTest/TestMethod.cs b/TBF/BenchControl/TestMethods/PulsesTest/TestMethod.cs
index 95ed53224..755be041f 100644
--- a/TBF/BenchControl/TestMethods/PulsesTest/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/PulsesTest/TestMethod.cs
@@ -12,24 +12,26 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
- public override string ToString() { return string.Format("TestMethods.PulsesTest({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
readonly TestMethodCfg testMethodCfg;
- public TestMethod()
- {
- }
+ public TestMethod() { }
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new PulseOutputsTestSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/PulsesTestManual/TestMethod.cs b/TBF/BenchControl/TestMethods/PulsesTestManual/TestMethod.cs
index 108f2005a..c905239d4 100644
--- a/TBF/BenchControl/TestMethods/PulsesTestManual/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/PulsesTestManual/TestMethod.cs
@@ -12,21 +12,23 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
- public override string ToString() { return string.Format("TestMethods.PulsesTestManual({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
- public TestMethod()
- {
- }
+ public TestMethod() { }
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new PulseTestManualSeq()).Execute(test, repetNr, isLastRepetition, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/Q2CorrectionFromHistory/Component.cs b/TBF/BenchControl/TestMethods/Q2CorrectionFromHistory/Component.cs
index fe05f1054..cbaedb037 100644
--- a/TBF/BenchControl/TestMethods/Q2CorrectionFromHistory/Component.cs
+++ b/TBF/BenchControl/TestMethods/Q2CorrectionFromHistory/Component.cs
@@ -11,12 +11,12 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
public class Component : ComponentBase, GenericDevices.ISimultTestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
- public override string ToString() { return string.Format("TestMethods.GrabImage({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return false; }
- readonly FromHistoryCfg cfg;
+ readonly FromHistoryCfg myCfg;
public bool SimultWithPrevious { get { return false; } }
public bool SimultWithNext { get { return false; } }
@@ -41,14 +41,14 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
{
if (args.Command == CfgChangeCmd.CfgChange)
{
- cfg.UseWebService = tmpcfg.UseWebService;
- cfg.BaseUrl = tmpcfg.BaseUrl;
- cfg.RelativeUrl = tmpcfg.RelativeUrl;
- cfg.UseLocalDB = tmpcfg.UseLocalDB;
- cfg.ProcedureName = tmpcfg.ProcedureName;
- cfg.ProcedureNameAlt1 = tmpcfg.ProcedureNameAlt1;
- cfg.ProcedureNameAlt2 = tmpcfg.ProcedureNameAlt2;
- cfg.UseDefaultValues = tmpcfg.UseDefaultValues;
+ myCfg.UseWebService = tmpcfg.UseWebService;
+ myCfg.BaseUrl = tmpcfg.BaseUrl;
+ myCfg.RelativeUrl = tmpcfg.RelativeUrl;
+ myCfg.UseLocalDB = tmpcfg.UseLocalDB;
+ myCfg.ProcedureName = tmpcfg.ProcedureName;
+ myCfg.ProcedureNameAlt1 = tmpcfg.ProcedureNameAlt1;
+ myCfg.ProcedureNameAlt2 = tmpcfg.ProcedureNameAlt2;
+ myCfg.UseDefaultValues = tmpcfg.UseDefaultValues;
}
}
};
@@ -57,21 +57,22 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
#endregion Configuration Change Handling
- public Component()
- {
- }
+ public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
- this.cfg = cfg as FromHistoryCfg;
- StartChangeHandler();
- log.Warn(this.ToString());
+ myCfg = cfg as FromHistoryCfg;
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetitionNr, bool isLastRepetition)
{
- return (new FromHistorySeq()).Execute(test, repetitionNr, cfg);
+ return (new FromHistorySeq()).Execute(test, repetitionNr, myCfg);
}
}
}
diff --git a/TBF/BenchControl/TestMethods/RoiDetection/RoiDetection.cs b/TBF/BenchControl/TestMethods/RoiDetection/RoiDetection.cs
index 6b2b9c96d..29046716b 100644
--- a/TBF/BenchControl/TestMethods/RoiDetection/RoiDetection.cs
+++ b/TBF/BenchControl/TestMethods/RoiDetection/RoiDetection.cs
@@ -12,21 +12,24 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
public class RoiDetection : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(RoiDetection));
- public override string ToString() { return string.Format("TestMethods.RoiDetection({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return true; }
public bool DoTransitions() { return true; }
- public RoiDetection()
- {
- }
+
+ public RoiDetection() { }
public RoiDetection(Generic.IComponentCfg cfg)
: base(cfg)
{
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
diff --git a/TBF/BenchControl/TestMethods/RoiDetection/RoiDetectionFactory.cs b/TBF/BenchControl/TestMethods/RoiDetection/RoiDetectionFactory.cs
index e62b65b5f..c6b79a06d 100644
--- a/TBF/BenchControl/TestMethods/RoiDetection/RoiDetectionFactory.cs
+++ b/TBF/BenchControl/TestMethods/RoiDetection/RoiDetectionFactory.cs
@@ -8,9 +8,7 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
{
public class RoiDetectionFactory : IComponentFactory
{
- public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
-
- public void ResetStaticProperties() { RoiDetection.ResetStaticProperties(); }
+ public string ClassName { get { return GetType().Namespace.Substring(17); } }
public IComponent DummyComponent() { return new RoiDetection(); }
diff --git a/TBF/BenchControl/TestMethods/SensitivityTest/TestMethod.cs b/TBF/BenchControl/TestMethods/SensitivityTest/TestMethod.cs
index cb28c6628..d99b9099b 100644
--- a/TBF/BenchControl/TestMethods/SensitivityTest/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/SensitivityTest/TestMethod.cs
@@ -12,24 +12,27 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
- public override string ToString() { return string.Format("TestMethods.SensitivityTest({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly TestMethodCfg testMethodCfg;
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return true; }
- public TestMethod()
- {
- }
+
+ public TestMethod() { }
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new SensitivityTestSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, DebugLevel);
diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/TestMethod.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/TestMethod.cs
index 963566424..0f71a05f2 100644
--- a/TBF/BenchControl/TestMethods/iPerlCommunication/TestMethod.cs
+++ b/TBF/BenchControl/TestMethods/iPerlCommunication/TestMethod.cs
@@ -15,7 +15,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
- public override string ToString() { return string.Format("TestMethods.iPerlCommunication({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
public bool DoTransitions() { return false; }
@@ -60,25 +60,21 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
#endregion Configuration Change Handling
- public TestMethod()
- {
- }
+ public TestMethod() { }
public TestMethod(Generic.IComponentCfg cfg)
: base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
- StartChangeHandler();
- log.Warn(this.ToString());
}
/// IDevice interface - only Initialize() is used
- public void Initialize()
+ public override void Initialize()
{
- if (DebugLevel == DebugMode.Normal)
- {
- /// Check whether RFID serial ports are free
- SerialPort rfidPort;
+ if (DebugLevel == DebugMode.Normal)
+ {
+ /// Check whether RFID serial ports are free
+ SerialPort rfidPort;
if (testMethodCfg.RfidPortNrBoard1 != 0)
{
rfidPort = new SerialPort(string.Format("COM{0}", testMethodCfg.RfidPortNrBoard1), 9600, Parity.None, 8, StopBits.One);
@@ -88,28 +84,34 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (testMethodCfg.RfidPortNrBoard2 != 0)
{
- rfidPort = new SerialPort(string.Format("COM{0}", testMethodCfg.RfidPortNrBoard2), 9600, Parity.None, 8, StopBits.One);
- rfidPort.Open();
- rfidPort.Close();
+ rfidPort = new SerialPort(string.Format("COM{0}", testMethodCfg.RfidPortNrBoard2), 9600, Parity.None, 8, StopBits.One);
+ rfidPort.Open();
+ rfidPort.Close();
}
if (testMethodCfg.RfidPortNrBoard3 != 0)
{
- rfidPort = new SerialPort(string.Format("COM{0}", testMethodCfg.RfidPortNrBoard3), 9600, Parity.None, 8, StopBits.One);
- rfidPort.Open();
- rfidPort.Close();
+ rfidPort = new SerialPort(string.Format("COM{0}", testMethodCfg.RfidPortNrBoard3), 9600, Parity.None, 8, StopBits.One);
+ rfidPort.Open();
+ rfidPort.Close();
}
if (testMethodCfg.RfidPortNrBoard4 != 0)
{
- rfidPort = new SerialPort(string.Format("COM{0}", testMethodCfg.RfidPortNrBoard4), 9600, Parity.None, 8, StopBits.One);
- rfidPort.Open();
- rfidPort.Close();
+ rfidPort = new SerialPort(string.Format("COM{0}", testMethodCfg.RfidPortNrBoard4), 9600, Parity.None, 8, StopBits.One);
+ rfidPort.Open();
+ rfidPort.Close();
}
+
+ rfidDataLogger.Fatal("------------------------------------------------------------------------");
+ rfidDataLogger.FatalFormat("Test Bench Framework ver. {0}", Program.Version);
+
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ else
+ {
+ log.FatalFormat("{0} simulated: {1}", Name, this);
}
-
- rfidDataLogger.Fatal("------------------------------------------------------------------------");
- rfidDataLogger.FatalFormat("Test Bench Framework ver. {0}", Program.Version);
}
/// IDevice interface - only Initialize() is used
diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs
index 6d9adb6a7..baf9cf2f7 100644
--- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs
+++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
public class IperlHead : ComponentBase, IDevice, IRegReaderDatastream, IHasTestName, IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(IperlHead));
- public override string ToString() { return string.Format("iPerl({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
#if TURA_SPECIAL
public const int MaxOptoDataCount = 250000;
@@ -327,34 +327,29 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
private SerialPort optoSerialPort;
- public IperlHead()
- {
- }
+ public IperlHead() { }
public IperlHead(Generic.IComponentCfg cfg)
: base(cfg)
{
- flowDirectionDetection = new FlowDirectionDetection();
-
- ClearData();
-
iperlHeadCfg = cfg as IperlHeadCfg;
-
- log.Warn(this.ToString());
}
-
- public void Initialize()
+ public override void Initialize()
{
ClearData();
- optoSerialPortParsingEnabled = false;
+ flowDirectionDetection = new FlowDirectionDetection();
/// Allocate memory for opto-data from iPerl
optoData = new OptoTelegramRaw[MaxOptoDataCount];
- for (int i = 0; i < MaxOptoDataCount; i++) optoData[i] = new OptoTelegramRaw();
+ for (int i = 0; i < MaxOptoDataCount; i++)
+ {
+ optoData[i] = new OptoTelegramRaw();
+ }
toBeFlushed = new OptoTelegramRaw();
+ optoSerialPortParsingEnabled = false;
synchronized = false;
synchronized2 = false;
partOfTelegram = string.Empty;
@@ -365,8 +360,13 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
optoSerialPort = new SerialPort(string.Format("COM{0}", iperlHeadCfg.OptoComPortNr),
9600, Parity.None, 8, StopBits.One);
optoSerialPort.Handshake = Handshake.None;
-
optoSerialPort.Open();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+ else
+ {
+ optoSerialPort = null;
+ log.FatalFormat("{0} simulated: {1}", Name, this);
}
}
diff --git a/TBF/BenchControl/Various/ErrorFlags/Errors.cs b/TBF/BenchControl/Various/ErrorFlags/Errors.cs
index 4ed0b5f4b..b19e91bb1 100644
--- a/TBF/BenchControl/Various/ErrorFlags/Errors.cs
+++ b/TBF/BenchControl/Various/ErrorFlags/Errors.cs
@@ -13,14 +13,8 @@ namespace TBF.BenchControl.Various.ErrorFlags
public class Errors : ComponentBase, GenericDevices.IErrorFlags
{
private static readonly ILog log = LogManager.GetLogger(typeof(Errors));
- public override string ToString()
- {
- return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
- }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
- ///
- /// Cfg
- ///
readonly ErrorsCfg errorsCfg;
///
@@ -195,20 +189,19 @@ namespace TBF.BenchControl.Various.ErrorFlags
}
- public Errors()
- {
- }
+ public Errors() { }
public Errors(Generic.IComponentCfg cfg, IList components)
: base(cfg)
{
errorsCfg = cfg as ErrorsCfg;
-
- StartChangeHandler();
-
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
#region Configuration Change Handling
diff --git a/TBF/BenchControl/Various/ManualLevelMsrmnt/ManualLevelMsrmnt.cs b/TBF/BenchControl/Various/ManualLevelMsrmnt/ManualLevelMsrmnt.cs
index 6d199f4b2..403b74b07 100644
--- a/TBF/BenchControl/Various/ManualLevelMsrmnt/ManualLevelMsrmnt.cs
+++ b/TBF/BenchControl/Various/ManualLevelMsrmnt/ManualLevelMsrmnt.cs
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.Various.ManualLevelMsrmnt
public class ManualLevelMsrmnt : ComponentBase, ILevelMeter, IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(ManualLevelMsrmnt));
- public override string ToString() { return string.Format("ManualLevelMsrmnt({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly TestMethodCfg myCfg;
@@ -32,18 +32,18 @@ namespace TBF.BenchControl.Various.ManualLevelMsrmnt
CurrentOp currentOp;
- public ManualLevelMsrmnt()
- {
- currentOp = CurrentOp.None;
- }
+ public ManualLevelMsrmnt() { }
public ManualLevelMsrmnt(Generic.IComponentCfg cfg)
: base(cfg)
{
myCfg = cfg as TestMethodCfg;
+ }
- currentOp = CurrentOp.None;
- log.Warn(this.ToString());
+ public override void Initialize()
+ {
+ currentOp = CurrentOp.None;
+ log.FatalFormat("{0} initialized: {1}", Name, this);
}
diff --git a/TBF/BenchControl/Various/StatisticsMonitoring/ProcessStatistics.cs b/TBF/BenchControl/Various/StatisticsMonitoring/ProcessStatistics.cs
index 90f7027a4..8711f8fe9 100644
--- a/TBF/BenchControl/Various/StatisticsMonitoring/ProcessStatistics.cs
+++ b/TBF/BenchControl/Various/StatisticsMonitoring/ProcessStatistics.cs
@@ -13,7 +13,7 @@ namespace TBF.BenchControl.Various.StatisticsMonitoring
public class ProcessStatistics : ComponentBase, IOperation, GenericDevices.IStatisticsMonitoring
{
private static readonly ILog log = LogManager.GetLogger(typeof(ProcessStatistics));
- public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly StatisticsCfg statisticsCfg;
@@ -26,10 +26,13 @@ namespace TBF.BenchControl.Various.StatisticsMonitoring
: base(cfg)
{
statisticsCfg = cfg as StatisticsCfg;
- ApplyConfig();
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ApplyConfig();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
void ApplyConfig()
{
diff --git a/TBF/BenchControl/Various/TankWithLevelMsrmnt/Tank.cs b/TBF/BenchControl/Various/TankWithLevelMsrmnt/Tank.cs
index df6a39cf5..b89a0a7a3 100644
--- a/TBF/BenchControl/Various/TankWithLevelMsrmnt/Tank.cs
+++ b/TBF/BenchControl/Various/TankWithLevelMsrmnt/Tank.cs
@@ -13,14 +13,14 @@ using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
{
- public class Tank : TBF.BenchControl.MettlerToledo.TankDraining, IDevice, IScaleOrTank, IVolumeMeter, IOperation
+ public class Tank : TBF.BenchControl.MettlerToledo.TankDraining, IScaleOrTank, IVolumeMeter, IOperation
{
///
/// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..."
/// Warn: Start measurement when busy is true
///
private static readonly ILog log = LogManager.GetLogger(typeof(Tank));
- public override string ToString() { return string.Format("TankWithLevelMsrmnt({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly TankCfg tankCfg;
@@ -49,10 +49,6 @@ namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
/// Enumeration of balances via static fields and methods
///
static int nextTankIdx = 0;
- public static new void ResetStaticProperties()
- {
- nextTankIdx = 0;
- }
public static int TanksCount { get { return nextTankIdx; } }
public static Tank[] Tanks;
///
@@ -70,9 +66,7 @@ namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
public double Volume { get { return Level2Volume(levelMeter.Level); } }
- public Tank()
- {
- }
+ public Tank() { }
///
/// Constructor
@@ -83,30 +77,28 @@ namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
: base(cfg)
{
tankCfg = cfg as TankCfg;
-
- tankNr = nextTankIdx++;
- ///
- if (Tanks == null || Tanks.Length < nextTankIdx)
- {
- Tank[] tanksSoFar = Tanks;
- Tanks = new Tank[nextTankIdx];
- if (tanksSoFar != null) for (int i = 0; i < tanksSoFar.Length; i++) Tanks[i] = tanksSoFar[i];
- Tanks[nextTankIdx - 1] = this;
- }
-
- currentOp = CurrentOp.None;
- levelBox = new DoubleBox();
-
- log.Warn(this.ToString());
}
///
/// IDevice interface (required to call base and initialize 'DrainValve')
///
- public void Initialize()
+ public override void Initialize()
{
- base.Initalize();
+ tankNr = nextTankIdx++;
+ ///
+ if (Tanks == null || Tanks.Length < nextTankIdx)
+ {
+ Tank[] tanksSoFar = Tanks;
+ Tanks = new Tank[nextTankIdx];
+ if (tanksSoFar != null) for (int i = 0; i < tanksSoFar.Length; i++) Tanks[i] = tanksSoFar[i];
+ Tanks[nextTankIdx - 1] = this;
+ }
+
+ base.Initialize();
+
+ currentOp = CurrentOp.None;
+ levelBox = new DoubleBox();
drainValve2 = TbfComponents.FindComponent(tankCfg.DrainValve2) as IValve;
@@ -115,11 +107,9 @@ namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
if (levelMeter == null) levelMeter = manualLevelMeter;
useCalibTable = LoadCalibrationTable(tankCfg.CalibrationTable);
- }
- public void RunDeviceBefore() { }
- public void RunDeviceAfter() { }
- public void StopDevice() { }
- public void StopDevice2() { }
+
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
public override bool IsEmpty()
diff --git a/TBF/BenchControl/WaterMeters/Munich/WaterMeter.cs b/TBF/BenchControl/WaterMeters/Munich/WaterMeter.cs
index 33301c6de..41df7f6ac 100644
--- a/TBF/BenchControl/WaterMeters/Munich/WaterMeter.cs
+++ b/TBF/BenchControl/WaterMeters/Munich/WaterMeter.cs
@@ -15,7 +15,7 @@ namespace TBF.BenchControl.WaterMeters.Munich
public class WaterMeter : ComponentBase, GenericDevices.IWaterMeter
{
private static readonly ILog log = LogManager.GetLogger(typeof(WaterMeter));
- public override string ToString() { return string.Format("WaterMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly WaterMeterCfg waterMeterCfg;
@@ -63,53 +63,32 @@ namespace TBF.BenchControl.WaterMeters.Munich
public Config.Entities.Medium WaterTemp { get { return Config.Entities.Medium.NotSpecified; } }
/// Properties set by the Begin and the End form
- public string SerialNr
- {
- get { return serialNr; }
- set { serialNr = value; }
- }
- string serialNr;
+ public string SerialNr { get; set; }
+ public string EndState { get; set; }
+ public string BeginState { get; set; }
+ public bool Disabled { get; set; }
- public string EndState
- {
- get { return endState; }
- set { endState = value; }
- }
- string endState;
- public string BeginState
- {
- get { return beginState; }
- set { beginState = value; }
- }
- string beginState;
-
- public bool Disabled
- {
- get { return disabled; }
- set { disabled = value; }
- }
- bool disabled;
-
- public WaterMeter()
- {
- ClearData();
- }
+ public WaterMeter() { }
public WaterMeter(Generic.IComponentCfg cfg)
: base(cfg)
{
- ClearData();
waterMeterCfg = cfg as WaterMeterCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ClearData();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public void ClearData()
{
- serialNr = string.Empty;
- endState = string.Empty;
- beginState = string.Empty;
- disabled = false;
+ SerialNr = string.Empty;
+ EndState = string.Empty;
+ BeginState = string.Empty;
+ Disabled = false;
}
}
}
diff --git a/TBF/BenchControl/WaterMeters/WaterMeter/WaterMeter.cs b/TBF/BenchControl/WaterMeters/WaterMeter/WaterMeter.cs
index 84a5fe8a6..26c5f6064 100644
--- a/TBF/BenchControl/WaterMeters/WaterMeter/WaterMeter.cs
+++ b/TBF/BenchControl/WaterMeters/WaterMeter/WaterMeter.cs
@@ -1,5 +1,5 @@
///
-/// Copyright (c) 2013-2017 Sensus Metering Systems
+/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using log4net;
using Config.Entities;
@@ -12,7 +12,7 @@ namespace TBF.BenchControl.WaterMeters.WaterMeter
public class WaterMeter : ComponentBase, GenericDevices.IWaterMeter
{
private static readonly ILog log = LogManager.GetLogger(typeof(WaterMeter));
- public override string ToString() { return string.Format("WaterMeter({0})", Cfg.ToString(1)); }
+ public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly WaterMeterCfg waterMeterCfg;
@@ -72,53 +72,32 @@ namespace TBF.BenchControl.WaterMeters.WaterMeter
#endif
/// Properties set by the Begin and the End form or the iPerl head
- public string SerialNr
- {
- get { return serialNr; }
- set { serialNr = value; }
- }
- string serialNr;
+ public string SerialNr { get; set; }
+ public string EndState { get; set; }
+ public string BeginState { get; set; }
+ public bool Disabled { get; set; }
- public string EndState
- {
- get { return endState; }
- set { endState = value; }
- }
- string endState;
-
- public string BeginState
- {
- get { return beginState; }
- set { beginState = value; }
- }
- string beginState;
-
- public bool Disabled
- {
- get { return disabled; }
- set { disabled = value; }
- }
- bool disabled;
-
- public WaterMeter()
- {
- ClearData();
- }
+
+ public WaterMeter() { }
public WaterMeter(Generic.IComponentCfg cfg)
: base(cfg)
{
- ClearData();
waterMeterCfg = cfg as WaterMeterCfg;
- log.Warn(this.ToString());
}
+ public override void Initialize()
+ {
+ ClearData();
+ log.FatalFormat("{0} initialized: {1}", Name, this);
+ }
+
public void ClearData()
{
- serialNr = string.Empty;
- endState = string.Empty;
- beginState = string.Empty;
- disabled = false;
+ SerialNr = string.Empty;
+ EndState = string.Empty;
+ BeginState = string.Empty;
+ Disabled = false;
}
}
}
diff --git a/TBF/UI/MainWnd.cs b/TBF/UI/MainWnd.cs
index 730630d38..020912c38 100644
--- a/TBF/UI/MainWnd.cs
+++ b/TBF/UI/MainWnd.cs
@@ -280,7 +280,7 @@ namespace TBF.UI
formThread.Join();
string errMsg = string.Format(Strings.Failed_to_initialize_device_0_1_2,
- BenchControl.StateMachine.CurrentlyInitializedDeviceName,
+ BenchControl.StateMachine.CurrentlyInitializedComponentName,
Environment.NewLine,
exc.Message);
log.Fatal(errMsg);