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:
@@ -19,9 +19,6 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
readonly int regulValveNr;
|
||||
readonly float timePulseSec;
|
||||
|
||||
/// Process values
|
||||
bool firstRun;
|
||||
|
||||
/// <summary>
|
||||
/// Set required water flow.
|
||||
/// Events: FlowSet, FlowTimeOut
|
||||
@@ -49,7 +46,6 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
firstRun = true;
|
||||
float positionPct = controlBoard.RValvePosition(regulValveNr);
|
||||
log.WarnFormat("RV#={0}, actPos={1}%", regulValveNr, positionPct.ToString("F1"));
|
||||
|
||||
|
||||
@@ -6,35 +6,23 @@ using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Elde.RegulValve
|
||||
{
|
||||
public class RegulValve : IComponent, GenericDevices.IRegulValve
|
||||
public class RegulValve : ComponentBase, GenericDevices.IRegulValve
|
||||
{
|
||||
/// <summary>
|
||||
/// Info: StartMassMeasurement() and "Balance response = .., Mass = ..."
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("RegulationValve({0},{1})", Name, Idx1);
|
||||
}
|
||||
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
|
||||
|
||||
public static void ResetStaticProperties() { }
|
||||
|
||||
public RegulValveCfg RegulValveCfg;
|
||||
public Generic.IComponentCfg Cfg { get { return RegulValveCfg; } }
|
||||
|
||||
public string Name { get { return Cfg.Name; } }
|
||||
public readonly RegulValveCfg RegulValveCfg;
|
||||
|
||||
IDictionary<float, float> dict;
|
||||
public IDictionary<float, float> Dict { get { return dict; } }
|
||||
|
||||
readonly ControlBoardDev controlBoard;
|
||||
|
||||
public readonly int Idx1; /// 1..7
|
||||
public readonly int DacValueClosed; /// 0..1023
|
||||
public readonly int DacValueOpen; /// 0..1023
|
||||
public readonly int StableTime; /// 0=200ms, step=50ms, max. 1500ms (max.26)
|
||||
public readonly int FlowStableSec; /// 0..60 sec
|
||||
public int Idx1 { get { return RegulValveCfg.Idx1; } } /// 1..7
|
||||
public int DacValueClosed { get { return RegulValveCfg.DacValueClosed; } } /// 0..1023
|
||||
public int DacValueOpen { get { return RegulValveCfg.DacValueOpen; } } /// 0..1023
|
||||
public int StableTime { get { return RegulValveCfg.StableTime; } } /// 0=200ms, step=50ms, max. 1500ms (max.26)
|
||||
public int FlowStableSec { get { return RegulValveCfg.FlowStableSec; } } /// 0..60 sec
|
||||
///
|
||||
public float Position
|
||||
{
|
||||
@@ -42,19 +30,13 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
}
|
||||
|
||||
public RegulValve(RegulValveCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
if (cfg == null) throw new ArgumentNullException("cfg");
|
||||
this.RegulValveCfg = cfg;
|
||||
RegulValveCfg = cfg;
|
||||
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
this.Idx1 = cfg.Idx1;
|
||||
this.DacValueClosed = cfg.DacValueClosed;
|
||||
this.DacValueOpen = cfg.DacValueOpen;
|
||||
this.StableTime = cfg.StableTime;
|
||||
this.FlowStableSec = cfg.FlowStableSec;
|
||||
|
||||
this.dict = new Dictionary<float, float>();
|
||||
|
||||
this.controlBoard.RegValveCalib[Idx1 - 1, 0] = (uint)DacValueClosed;
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// </summary>
|
||||
public int StableTime { get { return (StableTimeMs - 200) / 50; } }
|
||||
|
||||
/// Parameterless constructor
|
||||
public RegulValveCfg()
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
RegulValveCfg()
|
||||
{
|
||||
Name = "RegulationValve";
|
||||
ParentName = "CB";
|
||||
|
||||
@@ -6,10 +6,6 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
public class RegulValveFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "RegulationValve"; } }
|
||||
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