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:
Milan Hanajik
2015-01-02 12:51:27 +01:00
parent 752719bd62
commit 94de991bf6
126 changed files with 1117 additions and 1629 deletions
@@ -5,26 +5,12 @@ using TBF.Boxes;
namespace TBF.BenchControl.Elde.FlowMeterTwins
{
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}", Name);
}
public override string ToString() { return string.Format("FlowMeterTwins({0})", Cfg.ToString(1)); }
public static void ResetStaticProperties() { }
FlowMeterCfg flowMeterCfg;
public Generic.IComponentCfg Cfg { get { return flowMeterCfg; } }
public string Name { get { return flowMeterCfg.Name; } }
public IList<Entities.MeasurementCorrection> Corrections { get { return flowMeterCfg.Corrections; } }
readonly FlowMeterCfg flowMeterCfg;
public int Idx1 { get { return 0; } }
@@ -32,11 +18,10 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
public readonly TBF.BenchControl.Elde.FlowMeter.FlowMeter FlowMeter1;
public readonly TBF.BenchControl.Elde.FlowMeter.FlowMeter FlowMeter2;
public float NominalFlow { get { return nominalFlow; } }
readonly float nominalFlow;
public float NominalFlow { get { return flowMeterCfg.NominalFlow; } }
/// The nominal flowed of a pair of flow meters is reached at 4000Hz
public float LtrPerPulse { get { return nominalFlow / 14400.0f; } }
public float LtrPerPulse { get { return flowMeterCfg.NominalFlow / 14400.0f; } }
/// Calculates the average of values of two flowmeters. Assumes the flow is divided evenly.
public float LtrPerPulseCorrected(float flow)
@@ -47,9 +32,9 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
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");
@@ -60,8 +45,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
FlowMeter2 = (TBF.BenchControl.Elde.FlowMeter.FlowMeter)TbfComponents.FindComponent(flowMeterCfg.FlowMeter2, components);
if (FlowMeter2 == null) throw new Exception("Cannot find FlowMeter2 component");
nominalFlow = cfg.NominalFlow;
ControlBoard.EtCalib[Idx1] = NominalFlow;
ControlBoard.EtCalib[Idx1] = flowMeterCfg.NominalFlow;
/// Prepare data for SendCalibData() control board component method
@@ -10,9 +10,9 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz
public string FlowMeter1; /// Name of the flow meter 1 component
public string FlowMeter2; /// Name of the flow meter 2 component
/// Parameterless constructor
public FlowMeterCfg()
/// Private parameterless constructor invoked by all other (public) constructors
FlowMeterCfg()
{
Name = "FlowMeterTwins";
ParentName = "CB";
@@ -9,10 +9,6 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
public class FlowMeterFactory : IComponentFactory
{
public string ClassName { get { return "FlowMeterTwins"; } }
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 1; } }