Everything works OK after serious changes:
- all components, componentCfg-s and parameter providers use base classes - less boilerplate code, simpler access to test/procedure parameters from code - CreateTestParams(test), CreateProcedureParams(procedure) methods added - TestBenchSim class is made static, it is not inheritted by any device anymore
This commit is contained in:
@@ -4,25 +4,13 @@ using log4net;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Pump
|
||||
{
|
||||
public class Pump : Generic.IComponent, GenericDevices.IPump, GenericDevices.IValve
|
||||
public class Pump : ComponentBase, GenericDevices.IPump, GenericDevices.IValve
|
||||
{
|
||||
/// <summary>
|
||||
/// Info: StartMassMeasurement() and "Balance response = .., Mass = ..."
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Pump));
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("Pump(name={0}, bit={1})", Name, bitPosition);
|
||||
}
|
||||
|
||||
public static void ResetStaticProperties() { }
|
||||
|
||||
private readonly PumpCfg pumpCfg;
|
||||
public Generic.IComponentCfg Cfg { get { return pumpCfg; } }
|
||||
|
||||
public string Name { get { return pumpCfg.Name; } }
|
||||
public override string ToString() { return string.Format("Pump({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly PumpCfg pumpCfg;
|
||||
|
||||
public int Delay { get { return pumpCfg.Delay; } }
|
||||
|
||||
public ValveCategory Category { get { return ValveCategory.Feeding; } } /// Pump category is Feeding
|
||||
@@ -39,15 +27,15 @@ namespace TBF.BenchControl.Elde.Pump
|
||||
|
||||
|
||||
public Pump(PumpCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
if (cfg == null) throw new ArgumentNullException("cfg");
|
||||
this.pumpCfg = cfg;
|
||||
pumpCfg = cfg;
|
||||
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
this.bitPosition = cfg.BitPosition;
|
||||
this.Mask = (((ulong)1) << bitPosition);
|
||||
bitPosition = pumpCfg.BitPosition;
|
||||
Mask = (((ulong)1) << pumpCfg.BitPosition);
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ namespace TBF.BenchControl.Elde.Pump
|
||||
public int BitPosition;
|
||||
public int Delay;
|
||||
|
||||
/// Parameterless constructor
|
||||
public PumpCfg()
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
PumpCfg()
|
||||
{
|
||||
Name = "Pump";
|
||||
ParentName = "CB";
|
||||
|
||||
@@ -6,10 +6,6 @@ namespace TBF.BenchControl.Elde.Pump
|
||||
public class PumpFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "Pump"; } }
|
||||
public bool HasProcedureParams { get { return false; } }
|
||||
public bool HasTestParams { get { return false; } }
|
||||
public IParamsProvider GetTestParams(Entities.ComponentTest testParams) { return null; }
|
||||
public IParamsProvider GetProcedureParams(Entities.ComponentProcedure procedureParams) { return null; }
|
||||
|
||||
/// <summary>Max. number of components of this class in the system</summary>
|
||||
public int MaxCount { get { return int.MaxValue; } }
|
||||
|
||||
Reference in New Issue
Block a user