Components Initialize() rewritten, double StartChangeHandler() calls avoided, ToString() methods are equl, use ClassName.
This commit is contained in:
parent
331803e51d
commit
1d50b7206d
@ -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;
|
||||
|
||||
/// <summary>The state of the measurement</summary>
|
||||
MsrmntState msrmntState;
|
||||
int msrmntTimeStamp;
|
||||
|
||||
/// Measured values when MsrmntState == MsrmntState.Valid
|
||||
float temperature; /// [°C]
|
||||
float pressure; /// [bar]
|
||||
float humidity; /// [R%]
|
||||
|
||||
/// <summary>Last valid measurement time stamp</summary>
|
||||
int msrmntTimeStamp;
|
||||
|
||||
public Ambient()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
|
||||
/// </summary>
|
||||
public Ambient(AmbientCfg cfg, IList<Generic.IComponent> components)
|
||||
: this(cfg)
|
||||
{
|
||||
}
|
||||
public Ambient() { }
|
||||
|
||||
public Ambient(Generic.IComponentCfg cfg)
|
||||
/// <summary>
|
||||
/// Ambient temperature / humidity / pressure meter 'Comet' connected via serial interface (RS232)
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
@ -112,7 +98,6 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
pressure = (float)value / 10000.0f;
|
||||
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
|
||||
UpdateProcessData(temperature, pressure, humidity);
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
/// <summary>The state of the measurement</summary>
|
||||
MsrmntState msrmntState;
|
||||
|
||||
///
|
||||
/// Measured values when MsrmntState == MsrmntState.Valid
|
||||
///
|
||||
@ -38,49 +35,43 @@ namespace TBF.BenchControl.Ambient.Greco
|
||||
float pressure; /// [bar]
|
||||
float humidity; /// [R%]
|
||||
|
||||
/// <summary>Measurement time stamp when MsrmntState == MsrmntState.Valid</summary>
|
||||
/// <summary>Last valid measurement time stamp</summary>
|
||||
int msrmntTimeStamp;
|
||||
|
||||
public Ambient()
|
||||
{
|
||||
}
|
||||
|
||||
public Ambient() { }
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public Ambient(AmbientCfg cfg, IList<Generic.IComponent> 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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
@ -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
|
||||
|
||||
@ -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<MeasurementCorrection> Corrections
|
||||
{
|
||||
@ -49,8 +49,7 @@ namespace TBF.BenchControl
|
||||
this.cfg = cfg;
|
||||
}
|
||||
|
||||
/// <summary> Empty implementation, might be overriden in derived classes </summary>
|
||||
public static void ResetStaticProperties() { }
|
||||
public abstract void Initialize();
|
||||
|
||||
/// <summary> Empty implementation, might be overriden in derived classes </summary>
|
||||
public virtual void StartChangeHandler() { }
|
||||
|
||||
@ -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
|
||||
/// </summary>
|
||||
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() { }
|
||||
|
||||
/// <summary>
|
||||
/// 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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
DateTime calibrationDue = myCfg.CalibValidDate;
|
||||
|
||||
@ -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<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
DateTime calibrationDue = myCfg.CalibValidDate;
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// For a given temperature in [°C] returns an evaporation rate in [kg/s]
|
||||
/// </summary>
|
||||
@ -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<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
DateTime calibrationDue = myCfg.CalibValidDate;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
|
||||
@ -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<Generic.IComponent> 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);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowCycleBeginFormOp()
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<Generic.IComponent> 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; }
|
||||
|
||||
@ -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<double, float> Dict { get { return dict; } }
|
||||
|
||||
|
||||
public RegulValve()
|
||||
{
|
||||
}
|
||||
public RegulValve() { }
|
||||
|
||||
public RegulValve(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
RegulValveCfg = cfg as RegulValveCfg;
|
||||
dict = new Dictionary<double, float>();
|
||||
|
||||
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<double, float>();
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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() { }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
@ -282,29 +281,6 @@ namespace TBF.BenchControl.Elde
|
||||
: base(cfg)
|
||||
{
|
||||
controlBoardCfg = cfg as ControlBoardCfg;
|
||||
|
||||
cbCommandQueue = new Queue<SendCommandArgs>();
|
||||
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
|
||||
}
|
||||
|
||||
/// <summary>Initialize this device</summary>
|
||||
public void Initialize()
|
||||
public override void Initialize()
|
||||
{
|
||||
int divertersCount = BenchControl.Elde.Diverter.Diverter.DivertersCount;
|
||||
cbCommandQueue = new Queue<SendCommandArgs>();
|
||||
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());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -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<Generic.IComponent> 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; } }
|
||||
|
||||
@ -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)); }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration of balances via static fields and methods
|
||||
/// </summary>
|
||||
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; } }
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration of balances via static fields and methods
|
||||
/// </summary>
|
||||
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<Generic.IComponent> 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);
|
||||
|
||||
@ -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<Generic.IComponent> 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);
|
||||
|
||||
@ -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<Generic.IComponent> 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() { }
|
||||
|
||||
@ -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<Generic.IComponent> 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; }
|
||||
|
||||
@ -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<Generic.IComponent> 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; }
|
||||
|
||||
@ -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<Generic.IComponent> 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; }
|
||||
|
||||
|
||||
@ -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<Generic.IComponent> 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<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
|
||||
@ -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<Generic.IComponent> 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<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
|
||||
@ -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<Generic.IComponent> 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; }
|
||||
|
||||
@ -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<Generic.IComponent> 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)
|
||||
{
|
||||
|
||||
@ -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() { }
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
|
||||
@ -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<Generic.IComponent> 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<double, float>();
|
||||
|
||||
#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<double, float>();
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// IDevice interface implementation
|
||||
///
|
||||
public void Initialize() { }
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
int adcValue = (int)ControlBoard.AnalogInputRaw(adcChannel, 0);
|
||||
|
||||
@ -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<Generic.IComponent> 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<double, float>();
|
||||
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
dict = new Dictionary<double, float>();
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Operation to set the water flow within tolerances
|
||||
|
||||
@ -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<Generic.IComponent> 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<double, float>();
|
||||
|
||||
/// 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<double, float>();
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// IDevice interface implementation
|
||||
///
|
||||
public void Initialize() { }
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
int adcValue = (int)ControlBoard.AnalogInputRaw(adcChannel, 0);
|
||||
|
||||
@ -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<Generic.IComponent> 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<double, float>();
|
||||
|
||||
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<double, float>();
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Operation to set the water flow within tolerances
|
||||
/// Events: Event.None, Event.FlowReached, Event.FlowTimeOut
|
||||
|
||||
@ -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<Generic.IComponent> 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<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
|
||||
@ -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<Generic.IComponent> 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<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
|
||||
@ -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<Generic.IComponent> 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<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
|
||||
{
|
||||
|
||||
@ -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<Generic.IComponent> 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
|
||||
|
||||
|
||||
@ -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<Generic.IComponent> 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;
|
||||
|
||||
@ -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; }
|
||||
|
||||
/// <summary>
|
||||
/// Measurement correction table
|
||||
/// </summary>
|
||||
IList<Config.Entities.MeasurementCorrection> Corrections { get; set; }
|
||||
|
||||
IList<Config.Entities.Uncertainty> Uncertainties { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
void Initialize();
|
||||
|
||||
void StartChangeHandler();
|
||||
|
||||
void StopChangeHandler();
|
||||
|
||||
@ -32,8 +32,5 @@ namespace TBF.BenchControl.Generic
|
||||
/// Converts an Entities.Component object into an instance of an appropriate class implementing IComponentCfg
|
||||
/// </summary>
|
||||
IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component);
|
||||
|
||||
|
||||
void ResetStaticProperties();
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,8 +5,6 @@ namespace TBF.BenchControl.Generic
|
||||
{
|
||||
public interface IDevice : IComponent
|
||||
{
|
||||
void Initialize();
|
||||
|
||||
/// <summary>
|
||||
/// This function is invoked regularly each 1000 ms (once per second)
|
||||
/// just before Start(), Run() and Stop() functions of acrive operations.
|
||||
|
||||
@ -6,12 +6,5 @@ namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IEventTrigger : IResultsProcessor
|
||||
{
|
||||
/// <summary>
|
||||
/// Analyze results of one batch of water meters and trigger appropriate events.
|
||||
/// Events: Event.ResultsProcessed, Event.Busy
|
||||
/// </summary>
|
||||
/// <param name="batch">Results of a batch of water meters</param>
|
||||
/// <returns>Reference to the operation</returns>
|
||||
IOperation ProcessResultsOp(Results.Entities.Batch batch);
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,11 +34,6 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// </summary>
|
||||
int Idx1 { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Measurement correction table
|
||||
/// </summary>
|
||||
IList<Config.Entities.MeasurementCorrection> Corrections { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns current flow value in [m3/h]
|
||||
/// </summary>
|
||||
|
||||
@ -13,11 +13,6 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// </summary>
|
||||
public interface IPressureMeter : IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Measurement correction table
|
||||
/// </summary>
|
||||
IList<MeasurementCorrection> Corrections { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: PressureDone, Error
|
||||
/// </summary>
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,14 +6,6 @@ namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IResultsPrinter : IResultsProcessor
|
||||
{
|
||||
/// <summary>
|
||||
/// Prints results fo one batch of water meters.
|
||||
/// Events: Event.ResultsPrinted, Event.Busy
|
||||
/// </summary>
|
||||
/// <param name="batch">Results of a batch of water meters</param>
|
||||
/// <returns>Reference to the operation</returns>
|
||||
IOperation ProcessResultsOp(Results.Entities.Batch batch);
|
||||
|
||||
/// <summary>
|
||||
/// When true printing at the end of cycle is bypassed.
|
||||
/// Can be used to disable printing without having to modify all procedures.
|
||||
|
||||
@ -6,12 +6,5 @@ namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IResultsWriter : IResultsProcessor
|
||||
{
|
||||
/// <summary>
|
||||
/// Writes results of one batch of water meters into a file or a database.
|
||||
/// Events: Event.ResultsWritten, Event.Busy
|
||||
/// </summary>
|
||||
/// <param name="batch">Results of a batch of water meters</param>
|
||||
/// <returns>Reference to the operation</returns>
|
||||
IOperation ProcessResultsOp(Results.Entities.Batch batch);
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,10 +54,5 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// Time in seconds to empty the tank completely when it is full
|
||||
/// </summary>
|
||||
int EmptyTimeSec { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Measurement correction table
|
||||
/// </summary>
|
||||
IList<Config.Entities.MeasurementCorrection> Corrections { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,18 +6,13 @@ using System.Collections.Generic;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public class ValveBase : ComponentBase
|
||||
public abstract class ValveBase : ComponentBase
|
||||
{
|
||||
public ValveBase()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes ComponentBase constructor
|
||||
/// </summary>
|
||||
public ValveBase(Generic.IComponentCfg cfg) : base(cfg)
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Invoke ComponentBase constructors
|
||||
/// </summary>
|
||||
public ValveBase() : base() { }
|
||||
public ValveBase(Generic.IComponentCfg cfg) : base(cfg) { }
|
||||
|
||||
/// <summary>
|
||||
/// Process the list of components and return all valves (masters and coupled)
|
||||
|
||||
@ -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<byte[]> telegramsToSend;
|
||||
|
||||
|
||||
public Hart()
|
||||
{
|
||||
}
|
||||
public Hart() { }
|
||||
|
||||
/// <summary>
|
||||
/// 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<byte[]>[16]; /// Max. 16 slaves with adresses 0..15
|
||||
for (int i = 0; i < receivedTelegrams.Length; i++)
|
||||
{
|
||||
receivedTelegrams[i] = new Queue<byte[]>();
|
||||
}
|
||||
hartCfg = cfg as HartCfg;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
telegramsToSend = new Queue<byte[]>();
|
||||
|
||||
serialPort = null;
|
||||
hartCfg = cfg as HartCfg;
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
receivedTelegrams = new Queue<byte[]>[16]; /// Max. 16 slaves with adresses 0..15
|
||||
for (int i = 0; i < receivedTelegrams.Length; i++)
|
||||
{
|
||||
receivedTelegrams[i] = new Queue<byte[]>();
|
||||
}
|
||||
|
||||
~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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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() { }
|
||||
|
||||
/// <summary>
|
||||
/// 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()
|
||||
{
|
||||
|
||||
@ -15,12 +15,13 @@ using TBF.Boxes;
|
||||
namespace TBF.BenchControl.Keithley.Multimeter_2010_RS232
|
||||
{
|
||||
/// <summary>
|
||||
/// Root component for Modbus communication via serial port (RS485)
|
||||
/// </summary>
|
||||
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
|
||||
/// </summary>
|
||||
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() { }
|
||||
|
||||
/// <summary>
|
||||
/// Keithley mulltimeter connected via serial interface (RS232)
|
||||
/// Connection settings: 9600Bd 8-bits no-parity 1-stop-bit flow control: none
|
||||
/// </summary>
|
||||
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<int>();
|
||||
listOfChannels = new List<int>();
|
||||
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<int>();
|
||||
listOfChannels = new List<int>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 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());
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send an ASCII string, appends <CR><LF> at the end.
|
||||
/// </summary>
|
||||
|
||||
@ -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<DoubleBox, IOperation> operations2;
|
||||
|
||||
|
||||
public TempMeter()
|
||||
{
|
||||
}
|
||||
public TempMeter() { }
|
||||
|
||||
public TempMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> 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<DoubleBox, IOperation>();
|
||||
operations2 = new Dictionary<DoubleBox, IOperation>();
|
||||
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
operations = new Dictionary<DoubleBox, IOperation>();
|
||||
operations2 = new Dictionary<DoubleBox, IOperation>();
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
///
|
||||
/// Calendar support
|
||||
///
|
||||
|
||||
@ -27,7 +27,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
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
|
||||
/// </summary>
|
||||
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() { }
|
||||
|
||||
/// <summary>
|
||||
/// 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()
|
||||
|
||||
@ -35,7 +35,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
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
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
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)); }
|
||||
|
||||
/// <summary>Serial number after GetSerialNumber() when MsrmntState == MsrmntState.Valid</summary>
|
||||
public string SerialNumber { get { return serialNumber; } }
|
||||
|
||||
@ -25,7 +25,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
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() { }
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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;
|
||||
|
||||
/// <summary>The state of the measurement</summary>
|
||||
MsrmntState msrmntState;
|
||||
|
||||
///
|
||||
/// Measured values when MsrmntState == MsrmntState.Valid
|
||||
///
|
||||
@ -32,12 +29,11 @@ namespace TBF.BenchControl.Modbus.CometAmbient
|
||||
float pressure; /// [bar]
|
||||
float humidity; /// [R%]
|
||||
|
||||
/// <summary>Measurement time stamp when MsrmntState == MsrmntState.Valid</summary>
|
||||
/// <summary>Measurement time stamp</summary>
|
||||
int msrmntTimeStamp;
|
||||
|
||||
public Ambient()
|
||||
{
|
||||
}
|
||||
|
||||
public Ambient() { }
|
||||
|
||||
/// <summary>
|
||||
/// 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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
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
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
public void Stop() { }
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<byte[]> telegramsToSend;
|
||||
|
||||
public Modbus()
|
||||
{
|
||||
}
|
||||
|
||||
public Modbus() { }
|
||||
|
||||
/// <summary>
|
||||
/// 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<byte[]>[256];
|
||||
for (int i = 0; i < receivedTelegrams.Length; i++)
|
||||
{
|
||||
receivedTelegrams[i] = new Queue<byte[]>();
|
||||
}
|
||||
modbusCommonCfg = cfg as ModbusCfg;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
telegramsToSend = new Queue<byte[]>();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="message">Message incl CRC fields, CRC bytes dont have to be set</param>
|
||||
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<byte[]>[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<byte[]>();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send a structured modbus message.
|
||||
/// </summary>
|
||||
/// <param name="modbusAddress">Device address (1..255) or 0 = broadcast</param>
|
||||
/// <param name="function">Function (0..127)</param>
|
||||
/// <param name="dataAddress">Address of data to be transferred (0..65535)</param>
|
||||
/// <param name="dataCount">Count of data bytes to be transferred (0..65535)</param>
|
||||
public void SendMessage(byte modbusAddress, byte function, ushort dataAddress, ushort dataCount)
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
byte[] message = new byte[8]
|
||||
/// <summary>
|
||||
/// Send a structured modbus message.
|
||||
/// </summary>
|
||||
/// <param name="modbusAddress">Device address (1..255) or 0 = broadcast</param>
|
||||
/// <param name="function">Function (0..127)</param>
|
||||
/// <param name="dataAddress">Address of data to be transferred (0..65535)</param>
|
||||
/// <param name="dataCount">Count of data bytes to be transferred (0..65535)</param>
|
||||
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)
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="message">Message incl CRC fields, CRC bytes dont have to be set</param>
|
||||
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
|
||||
/// <summary>Run this device</summary>
|
||||
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
|
||||
/// <summary>Stop this device</summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<Generic.IComponent> 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());
|
||||
}
|
||||
|
||||
/// <summary>Initialize this device</summary>
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
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() { }
|
||||
|
||||
|
||||
@ -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<Generic.IComponent> 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());
|
||||
}
|
||||
|
||||
/// <summary>Initialize this device</summary>
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
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.
|
||||
///
|
||||
|
||||
@ -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<Generic.IComponent> 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());
|
||||
}
|
||||
|
||||
/// <summary>Initialize this device</summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
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() { }
|
||||
}
|
||||
|
||||
@ -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<Generic.IComponent> 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());
|
||||
}
|
||||
|
||||
/// <summary>Initialize this device</summary>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
@ -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() { }
|
||||
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -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)
|
||||
|
||||
@ -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;
|
||||
|
||||
/// <summary>The state of the measurement</summary>
|
||||
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<Generic.IComponent> 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());
|
||||
}
|
||||
|
||||
/// <summary>Initialize this device</summary>
|
||||
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() { }
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
/// <summary>The state of the measurement</summary>
|
||||
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<Generic.IComponent> 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());
|
||||
}
|
||||
|
||||
/// <summary>Initialize this device</summary>
|
||||
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() { }
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
/// <summary>The state of the measurement</summary>
|
||||
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<Generic.IComponent> 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());
|
||||
}
|
||||
|
||||
/// <summary>Initialize this device</summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
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() { }
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
@ -155,8 +153,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
running = false;
|
||||
}
|
||||
|
||||
|
||||
public void Initialize()
|
||||
public override void Initialize()
|
||||
{
|
||||
cameraIdx = GetCameraIdx();
|
||||
|
||||
|
||||
@ -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<Generic.IComponent> 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,
|
||||
|
||||
@ -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<Generic.IComponent> 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
|
||||
|
||||
@ -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<Generic.IComponent> 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
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
/// <summary>The state of the measurement</summary>
|
||||
MsrmntState msrmntState;
|
||||
|
||||
///
|
||||
/// Measured values when MsrmntState == MsrmntState.Valid
|
||||
///
|
||||
@ -51,9 +48,8 @@ namespace TBF.BenchControl.Network.Comet.Ambient
|
||||
/// <summary>Measurement time stamp when MsrmntState == MsrmntState.Valid</summary>
|
||||
int msrmntTimeStamp;
|
||||
|
||||
public Ambient()
|
||||
{
|
||||
}
|
||||
|
||||
public Ambient() { }
|
||||
|
||||
/// <summary>
|
||||
/// 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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
@ -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
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
public void Stop() { }
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<TracingDB.Entities.Process>())
|
||||
.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<TracingDB.Entities.Process>())
|
||||
.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<TracingDB.Entities.Process>())
|
||||
.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<TracingDB.Entities.Process>())
|
||||
.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",
|
||||
"<multiple>",
|
||||
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())
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Writes the test cycle results into a file, Events: Event.ResultsWritten
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Writes the test cycle results into a file, Events: Event.ResultsWritten
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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()
|
||||
{
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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()
|
||||
{
|
||||
|
||||
@ -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()
|
||||
{
|
||||
|
||||
@ -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()
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a file name derived from a DateTime structure.
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns a file name derived from a DateTime structure.
|
||||
|
||||
@ -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++)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user