- COmponent properties 'Position' --> 'Idx0' or 'Idx1'

- process data logging, RegulVal position logging
- changes for I11+I12, NOK yet
This commit is contained in:
Milan Hanajik 2014-09-10 12:05:49 +02:00
parent c3050863a6
commit fcfdfeca41
26 changed files with 165 additions and 101 deletions

View File

@ -14,7 +14,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
public override string ToString()
{
return string.Format("FlowMeter({0},{1})", Name, Position);
return string.Format("FlowMeter({0},{1})", Name, Idx1);
}
public static void ResetStaticProperties() { }
@ -23,7 +23,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
public Generic.IComponentCfg Cfg { get { return flowMeterCfg; } }
public string Name { get { return flowMeterCfg.Name; } }
public int Position { get { return flowMeterCfg.Position; } }
public int Idx1 { get { return flowMeterCfg.Idx1; } }
public IList<Entities.MeasurementCorrection> Corrections { get { return flowMeterCfg.Corrections; } }
public readonly ControlBoardDev ControlBoard;
@ -40,7 +40,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
nominalFlow = cfg.NominalFlow;
ControlBoard.EtCalib[Position] = NominalFlow;
ControlBoard.EtCalib[Idx1] = NominalFlow;
/// Prepare data for SendCalibData() control board component method

View File

@ -7,7 +7,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
{
public class FlowMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg
{
public int Position; /// 1..5
public int Idx1; /// 1..5
public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz
@ -20,23 +20,23 @@ namespace TBF.BenchControl.Elde.FlowMeter
/// Flow meter configuration parameters
/// </summary>
/// <param name="name">Flow meter name</param>
/// <param name="position">Position on the control board 1..5</param>
public FlowMeterCfg(IComponentFactory factory, string name, string parentName, int position, float nominalFlow)
/// <param name="idx1">Position on the control board 1..5</param>
public FlowMeterCfg(IComponentFactory factory, string name, string parentName, int idx1, float nominalFlow)
: base(factory, name, parentName)
{
if (position < 1 || position > 5) throw new ArgumentOutOfRangeException("position");
this.Position = position;
if (idx1 < 0 || idx1 > 5) throw new ArgumentOutOfRangeException("idx1");
this.Idx1 = idx1;
this.NominalFlow = nominalFlow;
}
public IComponentCfg Clone()
{
return new FlowMeterCfg(Factory, Name, ParentName, Position, NominalFlow);
return new FlowMeterCfg(Factory, Name, ParentName, Idx1, NominalFlow);
}
public string ToString(int i)
{
return string.Format("position={0}, nominalFlow={1}", Position, NominalFlow);
return string.Format("idx1={0}, nominalFlow={1}", Idx1, NominalFlow);
}
public TBF.Entities.Component CreateDbEntity()

View File

@ -53,7 +53,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
positionTextBox.Text = config.Position.ToString();
positionTextBox.Text = config.Idx1.ToString();
nominalFlowTextBox.Text = config.NominalFlow.ToString();
}
@ -95,7 +95,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.Position = int.Parse(positionTextBox.Text);
config.Idx1 = int.Parse(positionTextBox.Text);
Utils.TryParseUFloat(nominalFlowTextBox.Text, out config.NominalFlow);
}
}

View File

@ -25,7 +25,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
{
if (flowMeter == null) throw new ArgumentNullException("flowMeter");
this.controlBoard = flowMeter.ControlBoard;
this.flowMeterNr = flowMeter.Position;
this.flowMeterNr = flowMeter.Idx1;
this.eventDone = eventDone;
this.flow = flow;

View File

@ -15,7 +15,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
private static readonly ILog log = LogManager.GetLogger(typeof(PressureMeter));
public override string ToString()
{
return string.Format("PressureMeter({0},{1})", Name, Index);
return string.Format("PressureMeter({0},{1})", Name, Idx0);
}
public static void ResetStaticProperties() { }
@ -28,7 +28,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
public readonly ControlBoardDev ControlBoard;
public readonly int Index; /// 0..3
public readonly int Idx0; /// 0..3
public readonly byte RS485Address; /// 0..255
public PressureMeter(PressureMeterCfg cfg, IList<Generic.IComponent> components)
@ -39,11 +39,11 @@ namespace TBF.BenchControl.Elde.PressureMeter
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
Index = cfg.Position;
Idx0 = cfg.Idx0;
RS485Address = cfg.RS485Address;
/// Prepare data for SendCalibData() control board component method
ControlBoard.MeretRS485Address[Index] = RS485Address;
ControlBoard.MeretRS485Address[Idx0] = RS485Address;
log.Debug(this.ToString());
}

View File

@ -7,8 +7,8 @@ namespace TBF.BenchControl.Elde.PressureMeter
{
public class PressureMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg
{
public int Position; /// 0..7
public byte RS485Address; /// 0..255
public int Idx0; /// 0..3
public byte RS485Address; /// 0..255
/// Parameterless constructor
public PressureMeterCfg()
@ -18,14 +18,14 @@ namespace TBF.BenchControl.Elde.PressureMeter
/// Regulation valve configuration parameters
/// </summary>
/// <param name="name">Regulation valve name</param>
/// <param name="index">Position on the control board 1..5</param>
/// <param name="idx0">Position on the control board 0..3</param>
/// <param name="dacValueClosed">0..1023</param>
/// <param name="dacValueOpen">0..1023</param>
public PressureMeterCfg(IComponentFactory factory, string name, string parentName, int index, byte rs485Address)
public PressureMeterCfg(IComponentFactory factory, string name, string parentName, int idx0, byte rs485Address)
: base(factory, name, parentName)
{
if (index < 0 || index > 7) throw new ArgumentOutOfRangeException("Position");
this.Position = index;
if (idx0 < 0 || idx0 > 3) throw new ArgumentOutOfRangeException("Index (0-based)");
this.Idx0 = idx0;
if (rs485Address < 0 || rs485Address > 255) throw new ArgumentOutOfRangeException("RS485Address");
this.RS485Address = rs485Address;
@ -33,12 +33,12 @@ namespace TBF.BenchControl.Elde.PressureMeter
public IComponentCfg Clone()
{
return new PressureMeterCfg(Factory, Name, ParentName, Position, RS485Address);
return new PressureMeterCfg(Factory, Name, ParentName, Idx0, RS485Address);
}
public string ToString(int i)
{
return string.Format("index={0}, RS485 address={1}", Position, RS485Address);
return string.Format("idx0={0}, RS485 address={1}", Idx0, RS485Address);
}
public TBF.Entities.Component CreateDbEntity()

View File

@ -52,7 +52,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
componentNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
positionTextBox.Text = config.Position.ToString();
positionTextBox.Text = config.Idx0.ToString();
rs485AddressTextBox.Text = config.RS485Address.ToString();
}
@ -93,7 +93,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.Position = int.Parse(positionTextBox.Text);
config.Idx0 = int.Parse(positionTextBox.Text);
config.RS485Address = (byte)int.Parse(rs485AddressTextBox.Text);
}
}

View File

@ -25,7 +25,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
{
if (pressureMeter == null) throw new ArgumentNullException("pressureMeter");
this.controlBoardDev = pressureMeter.ControlBoard;
this.pressureMeterNr = pressureMeter.Index;
this.pressureMeterNr = pressureMeter.Idx0;
this.eventDone = eventDone;
this.pressure = pressure;
@ -39,7 +39,8 @@ namespace TBF.BenchControl.Elde.PressureMeter
/// <summary>Start this operation</summary>
public void Start()
{
}
pressure.Val = controlBoardDev.Pressure(pressureMeterNr);
}
/// <summary>Run this operation</summary>
/// <returns>

View File

@ -39,7 +39,7 @@ namespace TBF.BenchControl.Elde.RegulValve
this.regulValve = regulValve as RegulValve;
if (regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
this.regulValveNr = this.regulValve.Position;
this.regulValveNr = this.regulValve.Idx1;
this.timePulseSec = timePulseSec;

View File

@ -15,7 +15,7 @@ namespace TBF.BenchControl.Elde.RegulValve
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
public override string ToString()
{
return string.Format("RegulationValve({0},{1})", Name, Position);
return string.Format("RegulationValve({0},{1})", Name, Idx1);
}
public static void ResetStaticProperties() { }
@ -30,11 +30,16 @@ namespace TBF.BenchControl.Elde.RegulValve
readonly ControlBoardDev controlBoard;
public readonly int Position; /// 0..7
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 float Position
{
get { return controlBoard.RValvePosition(Idx1); }
}
public RegulValve(RegulValveCfg cfg, IList<Generic.IComponent> components)
{
@ -44,7 +49,7 @@ namespace TBF.BenchControl.Elde.RegulValve
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
this.Position = cfg.Position;
this.Idx1 = cfg.Idx1;
this.DacValueClosed = cfg.DacValueClosed;
this.DacValueOpen = cfg.DacValueOpen;
this.StableTime = cfg.StableTime;
@ -52,8 +57,8 @@ namespace TBF.BenchControl.Elde.RegulValve
this.dict = new Dictionary<float, float>();
this.controlBoard.RegValveCalib[Position - 1, 0] = (uint)DacValueClosed;
this.controlBoard.RegValveCalib[Position - 1, 1] = (uint)DacValueOpen;
this.controlBoard.RegValveCalib[Idx1 - 1, 0] = (uint)DacValueClosed;
this.controlBoard.RegValveCalib[Idx1 - 1, 1] = (uint)DacValueOpen;
log.Debug(this.ToString());
}

View File

@ -10,7 +10,7 @@ namespace TBF.BenchControl.Elde.RegulValve
///
/// Stored parameters
///
public int Position; /// 0..7
public int Idx1; /// 1..7
public int DacValueClosed; /// 0..1023
public int DacValueOpen; /// 0..1023
public int PidCoef; /// 1..100
@ -26,6 +26,7 @@ namespace TBF.BenchControl.Elde.RegulValve
/// Parameterless constructor
public RegulValveCfg()
{
Idx1 = 1;
StableTimeMs = 500;
FlowStableSec = 5;
}
@ -33,19 +34,19 @@ namespace TBF.BenchControl.Elde.RegulValve
/// Regulation valve configuration parameters
/// </summary>
/// <param name="name">Regulation valve name</param>
/// <param name="position">Position on the control board 0..7</param>
/// <param name="idx1">Position on the control board 0..7</param>
/// <param name="dacValueClosed">0..1023</param>
/// <param name="dacValueOpen">0..1023</param>
/// <param name="pidCoef">1..100</param>
public RegulValveCfg(IComponentFactory factory, string name, string parentName, int position, int dacValueClosed, int dacValueOpen, int pidCoef, int stableTimeMs, bool storedPositionReuse, int flowStableSec)
public RegulValveCfg(IComponentFactory factory, string name, string parentName, int idx1, int dacValueClosed, int dacValueOpen, int pidCoef, int stableTimeMs, bool storedPositionReuse, int flowStableSec)
: base(factory, name, parentName)
{
if (position < 0 || position > 7) throw new ArgumentOutOfRangeException("position");
if (idx1 < 1 || idx1 > 7) throw new ArgumentOutOfRangeException("position");
if (dacValueClosed < 0 || dacValueClosed > 1023) throw new ArgumentOutOfRangeException("dacValueOpen");
if (dacValueOpen < 0 || dacValueOpen > 1023) throw new ArgumentOutOfRangeException("dacValueOpen");
if (pidCoef < 1 || pidCoef > 100) throw new ArgumentOutOfRangeException("pidCoef");
this.Position = position;
this.Idx1 = idx1;
this.DacValueClosed = dacValueClosed;
this.DacValueOpen = dacValueOpen;
this.PidCoef = pidCoef;
@ -56,13 +57,13 @@ namespace TBF.BenchControl.Elde.RegulValve
public IComponentCfg Clone()
{
return new RegulValveCfg(Factory, Name, ParentName, Position, DacValueClosed, DacValueOpen, PidCoef, StableTimeMs, StoredPositionReuse, FlowStableSec);
return new RegulValveCfg(Factory, Name, ParentName, Idx1, DacValueClosed, DacValueOpen, PidCoef, StableTimeMs, StoredPositionReuse, FlowStableSec);
}
public string ToString(int i)
{
return string.Format("position={0}, DAC-closed={1}, DAC-open={2}, PID={3}, posReuse={4}, flowStableSec={5}",
Position, DacValueClosed, DacValueOpen, PidCoef, StoredPositionReuse, FlowStableSec);
return string.Format("idx1={0}, DA-closed={1}, DA-open={2}, PID={3}, stabT={4}ms, posReuse={5}, flowStable={6}s",
Idx1, DacValueClosed, DacValueOpen, PidCoef, StableTimeMs, StoredPositionReuse, FlowStableSec);
}
public TBF.Entities.Component CreateDbEntity()

View File

@ -52,7 +52,7 @@ namespace TBF.BenchControl.Elde.RegulValve
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
positionTextBox.Text = config.Position.ToString();
positionTextBox.Text = config.Idx1.ToString();
dacClosedTextBox.Text = config.DacValueClosed.ToString();
dacOpenTextBox.Text = config.DacValueOpen.ToString();
pidCoefTextBox.Text = config.PidCoef.ToString();
@ -124,7 +124,7 @@ namespace TBF.BenchControl.Elde.RegulValve
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.Position = int.Parse(positionTextBox.Text);
config.Idx1 = int.Parse(positionTextBox.Text);
config.DacValueClosed = int.Parse(dacClosedTextBox.Text);
config.DacValueOpen = int.Parse(dacOpenTextBox.Text);
config.PidCoef = int.Parse(pidCoefTextBox.Text);

View File

@ -66,11 +66,11 @@ namespace TBF.BenchControl.Elde.RegulValve
this.regulValve = regulValve as Elde.RegulValve.RegulValve;
if (regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
this.regulValveNr = this.regulValve.Position;
this.regulValveNr = this.regulValve.Idx1;
this.flowMeter = flowMeter as Elde.FlowMeter.FlowMeter;
if (flowMeter == null) throw new ArgumentNullException("flowMeter in null or not Elde");
this.flowMeterNr = this.flowMeter.Position;
this.flowMeterNr = this.flowMeter.Idx1;
this.reqFlowLo = requiredFlowLo;
this.reqFlowHi = requiredFlowHi;

View File

@ -43,7 +43,7 @@ namespace TBF.BenchControl.Elde.RegulValve
this.regulValve = regulValve as RegulValve;
if (regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
this.regulValveNr = this.regulValve.Position;
this.regulValveNr = this.regulValve.Idx1;
this.posLoPct = posLoPct;
this.posHiPct = posHiPct;

View File

@ -6,7 +6,7 @@ namespace TBF.BenchControl.Elde
public class StartMeasurementOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(StartMeasurementOp));
public override string ToString() { return string.Format("StartMeasurementOp(ref={0},pulses={1})", flowMeter.Position, refPulses); }
public override string ToString() { return string.Format("StartMeasurementOp(ref={0},pulses={1})", flowMeter.Idx1, refPulses); }
/// Set by the constructor
readonly ControlBoardDev controlBoard;
@ -44,7 +44,7 @@ namespace TBF.BenchControl.Elde
/// <summary>Start this operation</summary>
public void Start()
{
controlBoard.SendCommand(Command.Start, flowMeter.Position, controlBoard.RRoute, refPulses, testMethod,
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, controlBoard.RRoute, refPulses, testMethod,
filterConstant, 20, 0, StopDevs.None);
}

View File

@ -25,7 +25,7 @@ namespace TBF.BenchControl.Elde.TempMeter
{
if (tempMeter == null) throw new ArgumentNullException("tempMeter");
this.controlBoardDev = tempMeter.ControlBoard;
this.tempMeterNr = tempMeter.Index;
this.tempMeterNr = tempMeter.Idx0;
this.temp = temp;
this.eventDone = eventDone;
log.Debug(this.ToString());
@ -38,7 +38,8 @@ namespace TBF.BenchControl.Elde.TempMeter
/// <summary>Start this operation</summary>
public void Start()
{
}
temp.Val = controlBoardDev.Temperature(tempMeterNr);
}
/// <summary>Run this operation</summary>
/// <returns>

View File

@ -15,7 +15,7 @@ namespace TBF.BenchControl.Elde.TempMeter
private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter));
public override string ToString()
{
return string.Format("TempMeter({0},{1})", Name, Index);
return string.Format("TempMeter({0},{1})", Name, Idx0);
}
public static void ResetStaticProperties() { }
@ -27,7 +27,7 @@ namespace TBF.BenchControl.Elde.TempMeter
public readonly ControlBoardDev ControlBoard;
public readonly int Index; /// 0..7
public readonly int Idx0; /// 0..7
public readonly float A1;
public readonly float A2;
public readonly float A3;
@ -42,7 +42,7 @@ namespace TBF.BenchControl.Elde.TempMeter
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
Index = cfg.Position;
Idx0 = cfg.Idx0;
A1 = cfg.A1;
A2 = cfg.A2;
A3 = cfg.A3;
@ -50,11 +50,11 @@ namespace TBF.BenchControl.Elde.TempMeter
A5 = cfg.A5;
/// Prepare data for SendCalibData() control board component method
ControlBoard.TempCalibData[Index, 0] = A1;
ControlBoard.TempCalibData[Index, 1] = A2;
ControlBoard.TempCalibData[Index, 2] = A3;
ControlBoard.TempCalibData[Index, 3] = A4;
ControlBoard.TempCalibData[Index, 4] = A5;
ControlBoard.TempCalibData[Idx0, 0] = A1;
ControlBoard.TempCalibData[Idx0, 1] = A2;
ControlBoard.TempCalibData[Idx0, 2] = A3;
ControlBoard.TempCalibData[Idx0, 3] = A4;
ControlBoard.TempCalibData[Idx0, 4] = A5;
log.Debug(this.ToString());
}

View File

@ -7,7 +7,7 @@ namespace TBF.BenchControl.Elde.TempMeter
{
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg
{
public int Position; /// 0..7
public int Idx0; /// 0..7
public float A1;
public float A2;
@ -23,17 +23,17 @@ namespace TBF.BenchControl.Elde.TempMeter
/// Temperature meter configuration parameters
/// </summary>
/// <param name="name">Temperature meter name</param>
/// <param name="index">Position on the control board 0..7</param>
/// <param name="idx0">Position on the control board 0..7</param>
/// <param name="a1">A1</param>
/// <param name="a2">A2</param>
/// <param name="a3">A3</param>
/// <param name="a4">A4</param>
/// <param name="a5">A5</param>
public TempMeterCfg(IComponentFactory factory, string name, string parentName, int index, float a1, float a2, float a3, float a4, float a5)
public TempMeterCfg(IComponentFactory factory, string name, string parentName, int idx0, float a1, float a2, float a3, float a4, float a5)
: base(factory, name, parentName)
{
if (index < 0 || index > 7) throw new ArgumentOutOfRangeException("position");
this.Position = index;
if (idx0 < 0 || idx0 > 7) throw new ArgumentOutOfRangeException("position");
this.Idx0 = idx0;
this.A1 = a1;
this.A2 = a2;
@ -48,12 +48,12 @@ namespace TBF.BenchControl.Elde.TempMeter
public IComponentCfg Clone()
{
return new TempMeterCfg(Factory, Name, ParentName, Position, A1, A2, A3, A4, A5);
return new TempMeterCfg(Factory, Name, ParentName, Idx0, A1, A2, A3, A4, A5);
}
public string ToString(int i)
{
return string.Format("index={0}, A1={1}, A2={2}, A3={3}, A4={4}, A5={5}", Position, A1, A2, A3, A4, A5);
return string.Format("idx0={0}, A1={1}, A2={2}, A3={3}, A4={4}, A5={5}", Idx0, A1, A2, A3, A4, A5);
}
public TBF.Entities.Component CreateDbEntity()

View File

@ -53,7 +53,7 @@ namespace TBF.BenchControl.Elde.TempMeter
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
positionTextBox.Text = config.Position.ToString();
positionTextBox.Text = config.Idx0.ToString();
a1TextBox.Text = config.A1.ToString();
a2TextBox.Text = config.A2.ToString();
a3TextBox.Text = config.A3.ToString();
@ -129,7 +129,7 @@ namespace TBF.BenchControl.Elde.TempMeter
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.Position = int.Parse(positionTextBox.Text);
config.Idx0 = int.Parse(positionTextBox.Text);
bool updateOk = Utils.TryParseEFloat(a1TextBox.Text, out config.A1) &&
Utils.TryParseEFloat(a2TextBox.Text, out config.A2) &&
Utils.TryParseEFloat(a3TextBox.Text, out config.A3) &&

View File

@ -17,7 +17,7 @@ namespace TBF.BenchControl.GenericDevices
/// <summary>
/// 1 based index of the reference flowmeter
/// </summary>
int Position { get; }
int Idx1 { get; }
/// <summary>
/// Measurement correction table

View File

@ -7,6 +7,14 @@ namespace TBF.BenchControl.GenericDevices
{
public interface IRegulValve : IComponent
{
/// <summary>
/// Regulation valve position 0.0 .. 100.0 %
/// </summary>
float Position { get; }
/// <summary>
/// Dictionary for position re-use
/// </summary>
IDictionary<float, float> Dict { get; }
/// <summary>

View File

@ -128,9 +128,9 @@ namespace TBF.BenchControl.Sequences
#region Temperature_Pressure_Humidity
protected static FloatBox tempIn = new FloatBox() { Name = "Temperature In", Format = "F1" };
protected static FloatBox tempOut = new FloatBox() { Name = "Temperature Out", Format = "F1" };
protected static FloatBox tempDiv = new FloatBox() { Name = "Temperature Div", Format = "F1" };
protected static FloatBox tempIn = new FloatBox() { Name = "Temperature In", Format = "F2" };
protected static FloatBox tempOut = new FloatBox() { Name = "Temperature Out", Format = "F2" };
protected static FloatBox tempDiv = new FloatBox() { Name = "Temperature Div", Format = "F2" };
protected static FloatBox pressIn = new FloatBox() { Name = "Pressure In", Format = "F3", Factor = 0.01f };
protected static FloatBox pressOut = new FloatBox() { Name = "Pressure Out", Format = "F3", Factor = 0.01f };
protected static FloatBox airTemperature = new FloatBox() { Name = "Ambient Temperature", Format = "F1" };
@ -255,17 +255,18 @@ namespace TBF.BenchControl.Sequences
{
logger.Info(Environment.NewLine);
if (sectionName != null) logger.Info(sectionName);
logger.Info("Time Flow Test time Et.vol T.in Tou Tdi Pin Pou Mass VolMM Tam Ham. Pam Rv");
logger.Info("Time Flow TstTime Et.count Et.vol Tin Tout Tdiv Pin Pout Mass VolMM Tamb Hamb Pamb Rv");
logger.Info(Environment.NewLine);
}
public void LogProcessData(ILog logger)
{
logger.InfoFormat("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14}",
DateTime.Now.ToShortTimeString(),
logger.InfoFormat("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14} {15}",
DateTime.Now.ToLongTimeString(),
refFlow,
"Test time",
Formulas.VolumeFromPulses(refCount.Val, 1.0f / ltrPerRefPulse),
StateMachine.ControlBoard.TTime.ToString("F3"),
StateMachine.ControlBoard.EtPulses(0),
Formulas.VolumeFromPulses(StateMachine.ControlBoard.EtPulses(0), 1.0f / ltrPerRefPulse).ToString("F3"),
tempIn,
tempOut,
tempDiv,
@ -276,7 +277,7 @@ namespace TBF.BenchControl.Sequences
airTemperature,
airHumidity,
airPressure,
"Rv");
outPath.RegulValve.Position.ToString("F1"));
}
@ -563,21 +564,21 @@ namespace TBF.BenchControl.Sequences
ticTac = !ticTac;
State.Create("Read water meters")
.AddOperation(checkUiOp)
.AddOperation(realTest ? processDataLoggingOp : null)
.AddOperations(measureOperations)
.AddOperation(ticTac ? readRegisters1 : readRegisters2)
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn, Event.TempInDone))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut, Event.TempOutDone))
.AddOperation(outPath.TempDiv.ReadTempOp(ref tempDiv, Event.TempDivDone))
.AddOperation(benchPath.PressIn.ReadPressureOp(ref pressIn, Event.PressureInDone))
.AddOperation(benchPath.PressOut.ReadPressureOp(ref pressOut, Event.PressureOutDone))
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
.AddOperation(outPath.TempDiv.ReadTempOp(ref tempDiv))
.AddOperation(benchPath.PressIn.ReadPressureOp(ref pressIn))
.AddOperation(benchPath.PressOut.ReadPressureOp(ref pressOut))
.AddOperation(realTest ? outPath.Balance.ReadMassOp(ref mass) : null)
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(airTemperature, airPressure, airHumidity)
: null)
.AddOperation(realTest ? (ticTac ? queryEnd1 : queryEnd2) : null)
.EnterState();
.AddOperation(realTest ? processDataLoggingOp : null)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
@ -585,12 +586,7 @@ namespace TBF.BenchControl.Sequences
if (e.Contains(Event.UiCmdStop)) return Event.UiCmdStop;
if (e.Contains(Event.MeasurementCompleted)) return Event.MeasurementCompleted;
}
while ( !e.Contains(Event.TempInDone) ||
!e.Contains(Event.TempOutDone) ||
!e.Contains(Event.TempDivDone) ||
!e.Contains(Event.PressureInDone) ||
!e.Contains(Event.PressureOutDone) ||
(realTest && !e.Contains(Event.BalanceDone)) ||
while ( (realTest && !e.Contains(Event.BalanceDone)) ||
!e.Contains(Event.ReadAllRegistersDone));
return Event.Done;

View File

@ -474,7 +474,7 @@ namespace TBF.BenchControl
SequenceBase.LtrPerRefPulse = new float[SequenceBase.ReferenceFlowmetersCount];
foreach (var flowmtr in SequenceBase.FlowMeters)
{
int ix = flowmtr.Position;
int ix = flowmtr.Idx1;
if (ix > 0 && ix <= SequenceBase.ReferenceFlowmetersCount)
{
SequenceBase.LtrPerRefPulse[ix - 1] = flowmtr.NominalFlow / 7200.0f;

View File

@ -159,9 +159,18 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//------------------------------------------------
State.Create("FlyingStartCollectionMethod : Measuring the start mass")
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
.AddOperation(outPath.TempDiv.ReadTempOp(ref tempDiv))
.AddOperation(benchPath.PressIn.ReadPressureOp(ref pressIn))
.AddOperation(benchPath.PressOut.ReadPressureOp(ref pressOut))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(airTemperature, airPressure, airHumidity) : null)
.AddOperations(measureOperations)
.AddOperation(outPath.Balance.ReadStableMassOp(ref startMass, 5))
.EnterState();
.AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
@ -256,8 +265,16 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//------------------------------------------------
State.Create("FlyingStartCollectionMethod : Measuring the end mass")
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
.AddOperation(outPath.TempDiv.ReadTempOp(ref tempDiv))
.AddOperation(benchPath.PressIn.ReadPressureOp(ref pressIn))
.AddOperation(benchPath.PressOut.ReadPressureOp(ref pressOut))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(airTemperature, airPressure, airHumidity) : null)
.AddOperation(outPath.Balance.ReadStableMassOp(ref endMass, 5))
.AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp)
.EnterState();
do
{

View File

@ -40,6 +40,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
/// float timeSec = 3600.0f * timeHr;
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(7200.0f * test.Volume / outPath.FlowMeter.NominalFlow); /// Nominal flow in [m3/h]
/// Double total pulses for 'added' flowmeters
if (outPath.FlowMeter.Cfg.Name.Contains("+")) { totalPulses *= 2; }
ltrPerRefPulse = outPath.FlowMeter.NominalFlow / 7200.0f; /// [ltr/pulse]
///
@ -160,10 +163,18 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
//------------------------------------------------
State.Create("FlyingStartCollectionMethod : Measuring the start mass")
.AddOperation(checkUiOp)
.AddOperation(processDataLoggingOp)
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
.AddOperation(outPath.TempDiv.ReadTempOp(ref tempDiv))
.AddOperation(benchPath.PressIn.ReadPressureOp(ref pressIn))
.AddOperation(benchPath.PressOut.ReadPressureOp(ref pressOut))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(airTemperature, airPressure, airHumidity) : null)
.AddOperations(measureOperations)
.AddOperation(outPath.Balance.ReadStableMassOp(ref startMass, 5))
.EnterState();
.AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
@ -262,9 +273,16 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
//------------------------------------------------
State.Create("FlyingStartCollectionMethod : Measuring the end mass")
.AddOperation(checkUiOp)
.AddOperation(processDataLoggingOp)
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
.AddOperation(outPath.TempDiv.ReadTempOp(ref tempDiv))
.AddOperation(benchPath.PressIn.ReadPressureOp(ref pressIn))
.AddOperation(benchPath.PressOut.ReadPressureOp(ref pressOut))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(airTemperature, airPressure, airHumidity) : null)
.AddOperation(outPath.Balance.ReadStableMassOp(ref endMass, 5))
.AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp)
.EnterState();
do
{

View File

@ -151,8 +151,17 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
//------------------------------------------------
State.Create("ReferenceFlowmeterCalibration : Measuring the start mass")
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
.AddOperation(outPath.TempDiv.ReadTempOp(ref tempDiv))
.AddOperation(benchPath.PressIn.ReadPressureOp(ref pressIn))
.AddOperation(benchPath.PressOut.ReadPressureOp(ref pressOut))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(airTemperature, airPressure, airHumidity) : null)
.AddOperation(outPath.Balance.ReadStableMassOp(ref startMass, 5))
.EnterState();
.AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
@ -246,8 +255,16 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
//------------------------------------------------
State.Create("ReferenceFlowmeterCalibration : Measuring the end mass")
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
.AddOperation(outPath.TempDiv.ReadTempOp(ref tempDiv))
.AddOperation(benchPath.PressIn.ReadPressureOp(ref pressIn))
.AddOperation(benchPath.PressOut.ReadPressureOp(ref pressOut))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(airTemperature, airPressure, airHumidity) : null)
.AddOperation(outPath.Balance.ReadStableMassOp(ref endMass, 5))
.AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
@ -291,10 +308,10 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
tstRslt.ErrorMaster = 100 * (tstRslt.VolumeMaster - tstRslt.VolumeCTV) / tstRslt.VolumeCTV;
/// Update flowmeter constant with the measured one
if (outPath.FlowMeter.Position > 0 && outPath.FlowMeter.Position <= ReferenceFlowmetersCount)
if (outPath.FlowMeter.Idx1 > 0 && outPath.FlowMeter.Idx1 <= ReferenceFlowmetersCount)
{
LtrPerRefPulse[outPath.FlowMeter.Position - 1] = tstRslt.ConstMaster;
log.InfoFormat("Updating LtrPerRefPulse[{0}] = {1}", outPath.FlowMeter.Position - 1, tstRslt.ConstMaster);
LtrPerRefPulse[outPath.FlowMeter.Idx1 - 1] = tstRslt.ConstMaster;
log.InfoFormat("Updating LtrPerRefPulse[{0}] = {1}", outPath.FlowMeter.Idx1 - 1, tstRslt.ConstMaster);
}
}
tstRslt.TimeDivStart0 = 0;