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:
@@ -6,25 +6,12 @@ using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.PressureMeter
|
||||
{
|
||||
public class PressureMeter : IComponent, GenericDevices.IPressureMeter
|
||||
public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter
|
||||
{
|
||||
/// <summary>
|
||||
/// Info: StartMassMeasurement() and "Balance response = .., Mass = ..."
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(PressureMeter));
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("PressureMeter: Name={0}, Idx0={1}", Name, Idx0);
|
||||
}
|
||||
|
||||
public static void ResetStaticProperties() { }
|
||||
public override string ToString() { return string.Format("PressureMeter({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly PressureMeterCfg pressureMeterCfg;
|
||||
public Generic.IComponentCfg Cfg { get { return pressureMeterCfg; } }
|
||||
|
||||
public string Name { get { return pressureMeterCfg.Name; } }
|
||||
public IList<Entities.MeasurementCorrection> Corrections { get { return pressureMeterCfg.Corrections; } }
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
|
||||
@@ -32,9 +19,9 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
public readonly byte RS485Address; /// 0..255
|
||||
|
||||
public PressureMeter(PressureMeterCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
if (cfg == null) throw new ArgumentNullException("cfg");
|
||||
this.pressureMeterCfg = cfg;
|
||||
pressureMeterCfg = cfg;
|
||||
|
||||
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
{
|
||||
public int Idx0; /// 0..3
|
||||
public byte RS485Address; /// 0..255
|
||||
|
||||
/// Parameterless constructor
|
||||
public PressureMeterCfg()
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
PressureMeterCfg()
|
||||
{
|
||||
Name = "PressureMeter";
|
||||
ParentName = "CB";
|
||||
|
||||
@@ -9,10 +9,6 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
public class PressureMeterFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "PressureMeter"; } }
|
||||
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 5; } }
|
||||
|
||||
Reference in New Issue
Block a user