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:
@@ -5,33 +5,20 @@ using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FlowMeter
|
||||
{
|
||||
public class FlowMeter : Generic.IComponent, GenericDevices.IFlowMeter
|
||||
public class FlowMeter : ComponentBase, GenericDevices.IFlowMeter
|
||||
{
|
||||
/// <summary>
|
||||
/// Info: StartMassMeasurement() and "Balance response = .., Mass = ..."
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("FlowMeter: Name={0}, Idx1={1}", Name, Idx1);
|
||||
}
|
||||
public override string ToString() { return string.Format("FlowMeter({0})", Cfg.ToString(1)); }
|
||||
|
||||
public static void ResetStaticProperties() { }
|
||||
readonly FlowMeterCfg flowMeterCfg;
|
||||
|
||||
FlowMeterCfg flowMeterCfg;
|
||||
public Generic.IComponentCfg Cfg { get { return flowMeterCfg; } }
|
||||
|
||||
public string Name { get { return flowMeterCfg.Name; } }
|
||||
public int Idx1 { get { return flowMeterCfg.Idx1; } }
|
||||
public IList<Entities.MeasurementCorrection> Corrections { get { return flowMeterCfg.Corrections; } }
|
||||
|
||||
|
||||
public readonly ControlBoardDev ControlBoard;
|
||||
|
||||
public float NominalFlow { get { return nominalFlow; } }
|
||||
readonly float nominalFlow;
|
||||
public float NominalFlow { get { return flowMeterCfg.NominalFlow; } }
|
||||
|
||||
public float LtrPerPulse { get { return nominalFlow / 7200.0f; } }
|
||||
public float LtrPerPulse { get { return flowMeterCfg.NominalFlow / 7200.0f; } }
|
||||
|
||||
public float LtrPerPulseCorrected(float flow)
|
||||
{
|
||||
@@ -42,15 +29,14 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
|
||||
|
||||
public FlowMeter(FlowMeterCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
if (cfg == null) throw new ArgumentNullException("cfg");
|
||||
this.flowMeterCfg = cfg;
|
||||
flowMeterCfg = cfg;
|
||||
|
||||
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
nominalFlow = cfg.NominalFlow;
|
||||
ControlBoard.EtCalib[Idx1] = NominalFlow;
|
||||
ControlBoard.EtCalib[Idx1] = flowMeterCfg.NominalFlow;
|
||||
|
||||
/// Prepare data for SendCalibData() control board component method
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
{
|
||||
public int Idx1; /// 1..5
|
||||
public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz
|
||||
|
||||
/// Parameterless constructor
|
||||
public FlowMeterCfg()
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
FlowMeterCfg()
|
||||
{
|
||||
Name = "FlowMeter";
|
||||
ParentName = "CB";
|
||||
|
||||
@@ -9,10 +9,6 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
public class FlowMeterFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "FlowMeter"; } }
|
||||
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 7; } }
|
||||
|
||||
Reference in New Issue
Block a user