Draining modified, in BERLIN done always before flow setting, ver. 2.12.518

This commit is contained in:
Milan Hanajik
2017-03-28 23:54:52 +02:00
parent 2ca5eec8e1
commit d420128b4b
42 changed files with 553 additions and 523 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ namespace Config.Entities
public virtual string StartValve { get; set; } public virtual string StartValve { get; set; }
public virtual string Diverter { get; set; } public virtual string Diverter { get; set; }
public virtual string TempDiv { get; set; } public virtual string TempDiv { get; set; }
public virtual string Balance { get; set; } public virtual string Scale { get; set; }
public virtual string EmptyTankValve { get; set; } public virtual string EmptyTankValve { get; set; }
/// Valves /// Valves
@@ -54,7 +54,7 @@ namespace Config.Entities
result.StartValve = StartValve; result.StartValve = StartValve;
result.Diverter = Diverter; result.Diverter = Diverter;
result.TempDiv = TempDiv; result.TempDiv = TempDiv;
result.Balance = Balance; result.Scale = Scale;
result.EmptyTankValve = EmptyTankValve; result.EmptyTankValve = EmptyTankValve;
result.ValvesOpen = ValvesOpen; result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose; result.ValvesClose = ValvesClose;
+3 -3
View File
@@ -28,7 +28,7 @@ namespace Config.Entities
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0) public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0)
public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx) public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
public virtual int Repeats { get; set; } public virtual int Repeats { get; set; }
public virtual bool Emptying { get; set; } public virtual bool Draining { get; set; }
public virtual bool Zeroing { get; set; } public virtual bool Zeroing { get; set; }
public virtual float PumpPower { get; set; } /// Power of the pump in [%] in the range 0 .. 100.0f, use values 0% and 100% for non-FM pumps public virtual float PumpPower { get; set; } /// Power of the pump in [%] in the range 0 .. 100.0f, use values 0% and 100% for non-FM pumps
public virtual int MassRepeats { get; set; } /// Number of mass. measurements at the beginning/end of test, 0 = default (=5) public virtual int MassRepeats { get; set; } /// Number of mass. measurements at the beginning/end of test, 0 = default (=5)
@@ -68,7 +68,7 @@ namespace Config.Entities
Publish = (sbyte)Config.Entities.Publish.Always; Publish = (sbyte)Config.Entities.Publish.Always;
Evaluate = true; Evaluate = true;
Repeats = 1; Repeats = 1;
Emptying = false; Draining = false;
Zeroing = false; Zeroing = false;
ErrLimLo = -2.0f; /// [%] lower error limit ErrLimLo = -2.0f; /// [%] lower error limit
ErrLimHi = 2.0f; /// [%] upper error limit ErrLimHi = 2.0f; /// [%] upper error limit
@@ -109,7 +109,7 @@ namespace Config.Entities
result.Volume = Volume; result.Volume = Volume;
result.TstTime = TstTime; result.TstTime = TstTime;
result.Repeats = Repeats; result.Repeats = Repeats;
result.Emptying = Emptying; result.Draining = Draining;
result.Zeroing = Zeroing; result.Zeroing = Zeroing;
result.PumpPower = PumpPower; result.PumpPower = PumpPower;
result.MassRepeats = MassRepeats; result.MassRepeats = MassRepeats;
+1 -1
View File
@@ -153,7 +153,7 @@ namespace Config.Entities
Volume = test.Volume; Volume = test.Volume;
TstTime = test.TstTime; TstTime = test.TstTime;
Repeats = test.Repeats; Repeats = test.Repeats;
Emptying = test.Emptying; Emptying = test.Draining;
Zeroing = test.Zeroing; Zeroing = test.Zeroing;
PumpPower = PumpPower; PumpPower = PumpPower;
Time2MassMsrmt = test.TimeStop2Mass; Time2MassMsrmt = test.TimeStop2Mass;
+2 -1
View File
@@ -21,7 +21,8 @@ namespace Config.Mappings
Map(x => x.StartValve); Map(x => x.StartValve);
Map(x => x.Diverter); Map(x => x.Diverter);
Map(x => x.TempDiv); Map(x => x.TempDiv);
Map(x => x.Balance); Map(x => x.Scale)
.Column("Balance");
Map(x => x.EmptyTankValve); Map(x => x.EmptyTankValve);
Map(x => x.ValvesOpen) Map(x => x.ValvesOpen)
.CustomType("StringClob") .CustomType("StringClob")
+2 -1
View File
@@ -22,7 +22,8 @@ namespace Config.Mappings
Map(x => x.Volume); Map(x => x.Volume);
Map(x => x.TstTime); Map(x => x.TstTime);
Map(x => x.Repeats); Map(x => x.Repeats);
Map(x => x.Emptying); Map(x => x.Draining)
.Column("Emptying");
Map(x => x.Zeroing); Map(x => x.Zeroing);
Map(x => x.PumpPower); Map(x => x.PumpPower);
Map(x => x.MassRepeats); Map(x => x.MassRepeats);
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.12.499.0")] [assembly: AssemblyVersion("2.12.518.0")]
[assembly: AssemblyFileVersion("2.12.499.0")] [assembly: AssemblyFileVersion("2.12.518.0")]
@@ -8,7 +8,7 @@ using Config.Entities;
namespace TBF.BenchControl.Dummy.Balance namespace TBF.BenchControl.Dummy.Balance
{ {
public class Component : ComponentBase, GenericDevices.IBalance, IOperation public class Component : ComponentBase, GenericDevices.IScale, IOperation
{ {
private static readonly ILog log = LogManager.GetLogger(typeof(Component)); private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString() public override string ToString()
@@ -26,7 +26,7 @@ namespace TBF.BenchControl.Dummy.Balance
log.Debug(this.ToString()); log.Debug(this.ToString());
} }
public int BalanceNr { get { return 0; } } public int ScaleNr { get { return 0; } }
public double Capacity { get { return 10000.0; } } public double Capacity { get { return 10000.0; } }
public GenericDevices.IValve DrainValve { get { return null; } } public GenericDevices.IValve DrainValve { get { return null; } }
public bool IsEmpty(double mass) { return true; } public bool IsEmpty(double mass) { return true; }
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2015 Sensus Metering Systems /// Copyright (c) 2013-2017 Sensus Metering Systems
/// ///
using System.Collections.Generic; using System.Collections.Generic;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
@@ -10,12 +10,12 @@ namespace TBF.BenchControl.GenericDevices
/// <summary> /// <summary>
/// Basic balance functions /// Basic balance functions
/// </summary> /// </summary>
public interface IBalance : IComponent public interface IScale : IComponent
{ {
/// <summary> /// <summary>
/// Balance number: 0-based index required for communication with the Elde component /// Balance number: 0-based index required for communication with the Elde component
/// </summary> /// </summary>
int BalanceNr { get; } int ScaleNr { get; }
/// <summary> /// <summary>
/// Balance water tank capacity in kg or ltr /// Balance water tank capacity in kg or ltr
@@ -5,7 +5,7 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices namespace TBF.BenchControl.GenericDevices
{ {
public interface IBalance2 : IBalance, IComponent public interface IScale2 : IScale, IComponent
{ {
/// <summary> /// <summary>
/// Events: Done, Error /// Events: Done, Error
@@ -1,12 +1,12 @@
/// ///
/// Copyright (c) 2013-2016 Sensus Metering Systems /// Copyright (c) 2013-2017 Sensus Metering Systems
/// ///
using System; using System;
using TBF.BenchControl.Generic; using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices namespace TBF.BenchControl.GenericDevices
{ {
public interface IBalanceCfg : IComponentCfg public interface IScaleCfg : IComponentCfg
{ {
/// ///
/// Parameters displayed in Metrology tab page /// Parameters displayed in Metrology tab page
@@ -10,7 +10,7 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.MettlerToledo.Multi namespace TBF.BenchControl.MettlerToledo.Multi
{ {
public class BalanceCfg : ComponentCfgBase, GenericDevices.IBalanceCfg, GenericDevices.ICalibInfoCfg public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg, GenericDevices.ICalibInfoCfg
{ {
public IComponentCfgCtrl GetControl() { return new BalanceCfgCtrl(); } public IComponentCfgCtrl GetControl() { return new BalanceCfgCtrl(); }
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
/// <note> /// <note>
/// Implemented and tested on 15.10.2013 by Milan Hanajik /// Implemented and tested on 15.10.2013 by Milan Hanajik
/// </note> /// </note>
public class BalanceDev : TankDraining, IDevice, GenericDevices.IBalance public class BalanceDev : TankDraining, IDevice, GenericDevices.IScale
{ {
/// <summary> /// <summary>
/// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..." /// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..."
@@ -48,7 +48,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
protected static SerialPort serialPort; protected static SerialPort serialPort;
protected static StringBuilder stringBuilder; protected static StringBuilder stringBuilder;
public int BalanceNr { get { return balanceNr; } } public int ScaleNr { get { return balanceNr; } }
public int IdNr { get { return balanceCfg.IdNr; } } public int IdNr { get { return balanceCfg.IdNr; } }
public double Capacity { get { return balanceCfg.Capacity; } } public double Capacity { get { return balanceCfg.Capacity; } }
public double Resolution { get { return balanceCfg.Resolution; } } public double Resolution { get { return balanceCfg.Resolution; } }
@@ -10,7 +10,7 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.MettlerToledo.Standard namespace TBF.BenchControl.MettlerToledo.Standard
{ {
public class BalanceCfg : ComponentCfgBase, GenericDevices.IBalanceCfg, GenericDevices.ICalibInfoCfg, GenericDevices.ITankDrainingCfg public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg, GenericDevices.ICalibInfoCfg, GenericDevices.ITankDrainingCfg
{ {
public IComponentCfgCtrl GetControl() { return new BalanceCfgCtrl(); } public IComponentCfgCtrl GetControl() { return new BalanceCfgCtrl(); }
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
/// <note> /// <note>
/// Implemented and tested on 15.10.2013 by Milan Hanajik /// Implemented and tested on 15.10.2013 by Milan Hanajik
/// </note> /// </note>
public class BalanceDev : TankDraining, IDevice, GenericDevices.IBalance public class BalanceDev : TankDraining, IDevice, GenericDevices.IScale
{ {
/// <summary> /// <summary>
/// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..." /// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..."
@@ -47,7 +47,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
protected SerialPort serialPort; protected SerialPort serialPort;
protected StringBuilder stringBuilder; protected StringBuilder stringBuilder;
public int BalanceNr { get { return balanceNr; } } public int ScaleNr { get { return balanceNr; } }
public double Capacity { get { return balanceCfg.Capacity; } } public double Capacity { get { return balanceCfg.Capacity; } }
public int EmptyTimeSec { get { return balanceCfg.DrainTimeSec; } } public int EmptyTimeSec { get { return balanceCfg.DrainTimeSec; } }
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
/// <note> /// <note>
/// Implemented and tested on 15.10.2013 by Milan Hanajik /// Implemented and tested on 15.10.2013 by Milan Hanajik
/// </note> /// </note>
public class BalanceNewDev : BalanceDev, IDevice, GenericDevices.IBalance2 public class BalanceNewDev : BalanceDev, IDevice, GenericDevices.IScale2
{ {
/// <summary> /// <summary>
/// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..." /// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..."
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
/// <note> /// <note>
/// Implemented and tested on 15.10.2013 by Milan Hanajik /// Implemented and tested on 15.10.2013 by Milan Hanajik
/// </note> /// </note>
public class BalanceOld : BalanceDev, IDevice, GenericDevices.IBalance public class BalanceOld : BalanceDev, IDevice, GenericDevices.IScale
{ {
/// <summary> /// <summary>
/// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..." /// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..."
@@ -85,9 +85,9 @@ namespace TBF.BenchControl.Operations
case UI2BenchCmd.Stop: return Event.UiCmdStop; case UI2BenchCmd.Stop: return Event.UiCmdStop;
case UI2BenchCmd.PurgeBegin: return Event.UiCmdPurgeBegin; case UI2BenchCmd.PurgeBegin: return Event.UiCmdPurgeBegin;
case UI2BenchCmd.PurgeEnd: return Event.UiCmdPurgeEnd; case UI2BenchCmd.PurgeEnd: return Event.UiCmdPurgeEnd;
case UI2BenchCmd.EmptyTank1: return Event.UiCmdEmptyTank1; case UI2BenchCmd.DrainTank1: return Event.UiCmdEmptyTank1;
case UI2BenchCmd.EmptyTank2: return Event.UiCmdEmptyTank2; case UI2BenchCmd.DrainTank2: return Event.UiCmdEmptyTank2;
case UI2BenchCmd.EmptyTank3: return Event.UiCmdEmptyTank3; case UI2BenchCmd.DrainTank3: return Event.UiCmdEmptyTank3;
case UI2BenchCmd.Break: return Event.UiCmdBreak; case UI2BenchCmd.Break: return Event.UiCmdBreak;
case UI2BenchCmd.ResetResults: return Event.UiCmdResetResults; case UI2BenchCmd.ResetResults: return Event.UiCmdResetResults;
case UI2BenchCmd.AcceptResults: return Event.UiCmdAcceptResults; case UI2BenchCmd.AcceptResults: return Event.UiCmdAcceptResults;
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2015 Sensus Metering Systems /// Copyright (c) 2013-2017 Sensus Metering Systems
/// ///
using System.Collections.Generic; using System.Collections.Generic;
using TBF.BenchControl.GenericDevices; using TBF.BenchControl.GenericDevices;
@@ -18,8 +18,8 @@ namespace TBF.BenchControl
public IValve StartValve; public IValve StartValve;
public IDiverter Diverter; public IDiverter Diverter;
public ITempMeter TempDiv; public ITempMeter TempDiv;
public IBalance Balance; public IScale Scale;
public IValve EmptyTankValve; public IValve DrainValve;
public IList<IValve> ValvesOpen; public IList<IValve> ValvesOpen;
public IList<IValve> ValvesClose; public IList<IValve> ValvesClose;
@@ -44,8 +44,8 @@ namespace TBF.BenchControl
StartValve = (IValve)TbfComponents.FindComponent(entity.StartValve, components); StartValve = (IValve)TbfComponents.FindComponent(entity.StartValve, components);
Diverter = (IDiverter)TbfComponents.FindComponent(entity.Diverter, components); Diverter = (IDiverter)TbfComponents.FindComponent(entity.Diverter, components);
TempDiv = (ITempMeter)TbfComponents.FindComponent(entity.TempDiv, components); TempDiv = (ITempMeter)TbfComponents.FindComponent(entity.TempDiv, components);
Balance = (IBalance)TbfComponents.FindComponent(entity.Balance, components); Scale = (IScale)TbfComponents.FindComponent(entity.Scale, components);
EmptyTankValve = (IValve)TbfComponents.FindComponent(entity.EmptyTankValve, components); DrainValve = (IValve)TbfComponents.FindComponent(entity.EmptyTankValve, components);
string[] vOpen = entity.ValvesOpen.Split(new char[] { ';' }); string[] vOpen = entity.ValvesOpen.Split(new char[] { ';' });
ValvesOpen = new List<IValve>(); ValvesOpen = new List<IValve>();
@@ -63,7 +63,7 @@ namespace TBF.BenchControl
(RegulValve != null) ? RegulValve.Name : "---", (RegulValve != null) ? RegulValve.Name : "---",
(FlowMeter != null) ? FlowMeter.Name : "---", (FlowMeter != null) ? FlowMeter.Name : "---",
(Diverter != null) ? Diverter.Name : "---", (Diverter != null) ? Diverter.Name : "---",
(Balance != null) ? Balance.Name : "---"); (Scale != null) ? Scale.Name : "---");
} }
} }
} }
@@ -126,29 +126,29 @@ namespace TBF.BenchControl.Sequences
IntBox remainingTime = new IntBox(); IntBox remainingTime = new IntBox();
State startNew = State.Create("MainSeq : Emptying tanks") State startNew = State.Create("MainSeq : Emptying tanks")
.AddOperation(checkUiOp); .AddOperation(checkUiOp);
IList<IValve> allEmptyingValves = new List<IValve>(); IList<IValve> allDrainValves = new List<IValve>();
if (StateMachine.DrainValve1 != null) allEmptyingValves.Add(StateMachine.DrainValve1); if (StateMachine.DrainValve1 != null) allDrainValves.Add(StateMachine.DrainValve1);
if (StateMachine.DrainValve2 != null) allEmptyingValves.Add(StateMachine.DrainValve2); if (StateMachine.DrainValve2 != null) allDrainValves.Add(StateMachine.DrainValve2);
if (StateMachine.DrainValve3 != null) allEmptyingValves.Add(StateMachine.DrainValve3); if (StateMachine.DrainValve3 != null) allDrainValves.Add(StateMachine.DrainValve3);
// Determine the tank emptying time (the maximum for all balances) // Determine the tank emptying time (the maximum for all balances)
int balanceEmptyTime = 0; int scaleDrainTime = 0;
if (StateMachine.Balance1 != null && StateMachine.Balance1.EmptyTimeSec > balanceEmptyTime) if (StateMachine.Scale1 != null && StateMachine.Scale1.EmptyTimeSec > scaleDrainTime)
{ {
balanceEmptyTime = StateMachine.Balance1.EmptyTimeSec; scaleDrainTime = StateMachine.Scale1.EmptyTimeSec;
} }
if (StateMachine.Balance2 != null && StateMachine.Balance2.EmptyTimeSec > balanceEmptyTime) if (StateMachine.Scale2 != null && StateMachine.Scale2.EmptyTimeSec > scaleDrainTime)
{ {
balanceEmptyTime = StateMachine.Balance2.EmptyTimeSec; scaleDrainTime = StateMachine.Scale2.EmptyTimeSec;
} }
if (StateMachine.Balance3 != null && StateMachine.Balance3.EmptyTimeSec > balanceEmptyTime) if (StateMachine.Scale3 != null && StateMachine.Scale3.EmptyTimeSec > scaleDrainTime)
{ {
balanceEmptyTime = StateMachine.Balance3.EmptyTimeSec; scaleDrainTime = StateMachine.Scale3.EmptyTimeSec;
} }
if (balanceEmptyTime > 0) if (scaleDrainTime > 0)
{ {
startNew.AddOperation(new TimerOp(balanceEmptyTime, remainingTime)) startNew.AddOperation(new TimerOp(scaleDrainTime, remainingTime))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(allEmptyingValves, null)); .AddOperation(StateMachine.ControlBoard.SetValvesOp(allDrainValves, null));
} }
startNew.EnterState(); startNew.EnterState();
@@ -177,7 +177,7 @@ namespace TBF.BenchControl.Sequences
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
State stopEmptying = State.Create("MainSeq : Stop emptying of water tanks") State stopEmptying = State.Create("MainSeq : Stop emptying of water tanks")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, allEmptyingValves)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, allDrainValves))
.EnterState(); .EnterState();
do do
{ {
@@ -190,9 +190,9 @@ namespace TBF.BenchControl.Sequences
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
State taraAll = State.Create("MainSeq : Reset all balances").AddOperation(checkUiOp); State taraAll = State.Create("MainSeq : Reset all balances").AddOperation(checkUiOp);
DoubleBox tara = new DoubleBox(0); DoubleBox tara = new DoubleBox(0);
if (StateMachine.Balance1 != null) taraAll.AddOperation(StateMachine.Balance1.TaringOp(ref tara)); if (StateMachine.Scale1 != null) taraAll.AddOperation(StateMachine.Scale1.TaringOp(ref tara));
if (StateMachine.Balance2 != null) taraAll.AddOperation(StateMachine.Balance2.TaringOp(ref tara)); if (StateMachine.Scale2 != null) taraAll.AddOperation(StateMachine.Scale2.TaringOp(ref tara));
if (StateMachine.Balance3 != null) taraAll.AddOperation(StateMachine.Balance3.TaringOp(ref tara)); if (StateMachine.Scale3 != null) taraAll.AddOperation(StateMachine.Scale3.TaringOp(ref tara));
taraAll.EnterState(); taraAll.EnterState();
do do
{ {
@@ -516,9 +516,9 @@ namespace TBF.BenchControl.Sequences
} }
/// Update format for the water mass /// Update format for the water mass
Mass.Format = outPath.Balance.Format; Mass.Format = outPath.Scale.Format;
StartMass.Format = outPath.Balance.Format; StartMass.Format = outPath.Scale.Format;
EndMass.Format = outPath.Balance.Format; EndMass.Format = outPath.Scale.Format;
//-------------------------------------------------------------- //--------------------------------------------------------------
ITestMethod testMethodSequence = TbfComponents.FindComponent(test.Method) as ITestMethod; ITestMethod testMethodSequence = TbfComponents.FindComponent(test.Method) as ITestMethod;
@@ -658,9 +658,9 @@ namespace TBF.BenchControl.Sequences
} }
/// Update format for the water mass /// Update format for the water mass
Mass.Format = outPath.Balance.Format; Mass.Format = outPath.Scale.Format;
StartMass.Format = outPath.Balance.Format; StartMass.Format = outPath.Scale.Format;
EndMass.Format = outPath.Balance.Format; EndMass.Format = outPath.Scale.Format;
//-------------------------------------------------------------- //--------------------------------------------------------------
ITestMethod testMethodSequence = TbfComponents.FindComponent(test.Method) as ITestMethod; ITestMethod testMethodSequence = TbfComponents.FindComponent(test.Method) as ITestMethod;
@@ -754,9 +754,9 @@ namespace TBF.BenchControl.Sequences
} }
/// Update format for the water mass /// Update format for the water mass
Mass.Format = outPath.Balance.Format; Mass.Format = outPath.Scale.Format;
StartMass.Format = outPath.Balance.Format; StartMass.Format = outPath.Scale.Format;
EndMass.Format = outPath.Balance.Format; EndMass.Format = outPath.Scale.Format;
ITestMethod testMethodSequence = TbfComponents.FindComponent(test.Method) as ITestMethod; ITestMethod testMethodSequence = TbfComponents.FindComponent(test.Method) as ITestMethod;
if (testMethodSequence != null && testMethodSequence.CanTest(StateMachine.Procedure.MetersKind)) if (testMethodSequence != null && testMethodSequence.CanTest(StateMachine.Procedure.MetersKind))
@@ -1046,9 +1046,9 @@ namespace TBF.BenchControl.Sequences
{ {
/// Handled inside MakeSelection() /// Handled inside MakeSelection()
None, None,
EmptyTank1, DrainTank1,
EmptyTank2, DrainTank2,
EmptyTank3, DrainTank3,
CloseTank1, CloseTank1,
CloseTank2, CloseTank2,
CloseTank3, CloseTank3,
@@ -1086,9 +1086,9 @@ namespace TBF.BenchControl.Sequences
private Selection MakeSelection(MKSelContext context) private Selection MakeSelection(MKSelContext context)
{ {
/// Tank emptying valves states /// Tank emptying valves states
bool emptying1 = false; bool draining1 = false;
bool emptying2 = false; bool draining2 = false;
bool emptying3 = false; bool draining3 = false;
/// Measured masses to control emptying /// Measured masses to control emptying
DoubleBox mass1 = new DoubleBox(); DoubleBox mass1 = new DoubleBox();
@@ -1101,7 +1101,7 @@ namespace TBF.BenchControl.Sequences
while (true) while (true)
{ {
/// Display an appropriate activity message /// Display an appropriate activity message
if (emptying1 || emptying2 || emptying3) if (draining1 || draining2 || draining3)
{ {
Bridge.OnActivity(this, Strings.Emptying_tank); Bridge.OnActivity(this, Strings.Emptying_tank);
} }
@@ -1118,7 +1118,7 @@ namespace TBF.BenchControl.Sequences
Bridge.Bench2UI(((context == MKSelContext.ProcedureNotSelected) ? ButtonsEtc.ProcedureCmbBoxEn : 0) | Bridge.Bench2UI(((context == MKSelContext.ProcedureNotSelected) ? ButtonsEtc.ProcedureCmbBoxEn : 0) |
ButtonsEtc.TestCmbBoxEn | ButtonsEtc.TestCmbBoxEn |
ButtonsEtc.StopBtnEn | ButtonsEtc.StopBtnEn |
((emptying1 || emptying2 || emptying3) ? 0 : ((draining1 || draining2 || draining3) ? 0 :
(ButtonsEtc.StartCycleBtnEn | (ButtonsEtc.StartCycleBtnEn |
ButtonsEtc.StartTestBtnsEn | ButtonsEtc.StartTestBtnsEn |
ButtonsEtc.PurgeBeginBtnEn | ButtonsEtc.PurgeBeginBtnEn |
@@ -1126,16 +1126,16 @@ namespace TBF.BenchControl.Sequences
ButtonsEtc.SensitivityTestBtnEn | ButtonsEtc.SensitivityTestBtnEn |
((Cameras.Count > 0) ? ButtonsEtc.CalibrationBtnEn : 0) | ((Cameras.Count > 0) ? ButtonsEtc.CalibrationBtnEn : 0) |
ButtonsEtc.Break)) | ButtonsEtc.Break)) |
(((StateMachine.Balance1 != null) && (StateMachine.DrainValve1 != null) && !emptying1) ? ButtonsEtc.EmptyTankBtn1En : 0) | (((StateMachine.Scale1 != null) && (StateMachine.DrainValve1 != null) && !draining1) ? ButtonsEtc.DrainTankBtn1En : 0) |
(((StateMachine.Balance2 != null) && (StateMachine.DrainValve2 != null) && !emptying2) ? ButtonsEtc.EmptyTankBtn2En : 0) | (((StateMachine.Scale2 != null) && (StateMachine.DrainValve2 != null) && !draining2) ? ButtonsEtc.DrainTankBtn2En : 0) |
(((StateMachine.Balance3 != null) && (StateMachine.DrainValve3 != null) && !emptying3) ? ButtonsEtc.EmptyTankBtn3En : 0)); (((StateMachine.Scale3 != null) && (StateMachine.DrainValve3 != null) && !draining3) ? ButtonsEtc.DrainTankBtn3En : 0));
selection = Selection.None; selection = Selection.None;
State.Create("MainSeq : Select an activity") State.Create("MainSeq : Select an activity")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((StateMachine.Balance1 != null) ? StateMachine.Balance1.ReadMassOp(ref mass1) : null) .AddOperation((StateMachine.Scale1 != null) ? StateMachine.Scale1.ReadMassOp(ref mass1) : null)
.AddOperation((StateMachine.Balance2 != null) ? StateMachine.Balance2.ReadMassOp(ref mass2) : null) .AddOperation((StateMachine.Scale2 != null) ? StateMachine.Scale2.ReadMassOp(ref mass2) : null)
.AddOperation((StateMachine.Balance3 != null) ? StateMachine.Balance3.ReadMassOp(ref mass3) : null) .AddOperation((StateMachine.Scale3 != null) ? StateMachine.Scale3.ReadMassOp(ref mass3) : null)
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState(); .EnterState();
do do
@@ -1144,12 +1144,12 @@ namespace TBF.BenchControl.Sequences
if (e.Contains(Event.Error)) goto error; if (e.Contains(Event.Error)) goto error;
else if (e.Contains(Event.UiCmdStop)) selection = Selection.Stop; else if (e.Contains(Event.UiCmdStop)) selection = Selection.Stop;
else if (e.Contains(Event.UiCmdCameraTest)) selection = Selection.CameraTest; else if (e.Contains(Event.UiCmdCameraTest)) selection = Selection.CameraTest;
else if (e.Contains(Event.UiCmdEmptyTank1)) selection = Selection.EmptyTank1; else if (e.Contains(Event.UiCmdEmptyTank1)) selection = Selection.DrainTank1;
else if (e.Contains(Event.UiCmdEmptyTank2)) selection = Selection.EmptyTank2; else if (e.Contains(Event.UiCmdEmptyTank2)) selection = Selection.DrainTank2;
else if (e.Contains(Event.UiCmdEmptyTank3)) selection = Selection.EmptyTank3; else if (e.Contains(Event.UiCmdEmptyTank3)) selection = Selection.DrainTank3;
else if (emptying1 && StateMachine.Balance1.IsEmpty(mass1.Val)) selection = Selection.CloseTank1; else if (draining1 && StateMachine.Scale1.IsEmpty(mass1.Val)) selection = Selection.CloseTank1;
else if (emptying2 && StateMachine.Balance2.IsEmpty(mass2.Val)) selection = Selection.CloseTank2; else if (draining2 && StateMachine.Scale2.IsEmpty(mass2.Val)) selection = Selection.CloseTank2;
else if (emptying3 && StateMachine.Balance3.IsEmpty(mass3.Val)) selection = Selection.CloseTank3; else if (draining3 && StateMachine.Scale3.IsEmpty(mass3.Val)) selection = Selection.CloseTank3;
else if (e.Contains(Event.UiCmdPurgeBegin)) return Selection.PurgeBegin; /// Value used to branch the code later on else if (e.Contains(Event.UiCmdPurgeBegin)) return Selection.PurgeBegin; /// Value used to branch the code later on
else if (e.Contains(Event.UiCmdPurgeEnd)) return Selection.PurgeEnd; else if (e.Contains(Event.UiCmdPurgeEnd)) return Selection.PurgeEnd;
else if (e.Contains(Event.UiCmdBreak) && context == MKSelContext.InsideProcedure) return Selection.Break; else if (e.Contains(Event.UiCmdBreak) && context == MKSelContext.InsideProcedure) return Selection.Break;
@@ -1168,58 +1168,58 @@ namespace TBF.BenchControl.Sequences
} }
else if (selection == Selection.Stop) else if (selection == Selection.Stop)
{ {
if (emptying1 || emptying2 || emptying3) if (draining1 || draining2 || draining3)
{ {
IList<IValve> valvesClose = new List<IValve>(); IList<IValve> valvesClose = new List<IValve>();
if (emptying1) valvesClose.Add(StateMachine.DrainValve1); if (draining1) valvesClose.Add(StateMachine.DrainValve1);
if (emptying2) valvesClose.Add(StateMachine.DrainValve2); if (draining2) valvesClose.Add(StateMachine.DrainValve2);
if (emptying3) valvesClose.Add(StateMachine.DrainValve3); if (draining3) valvesClose.Add(StateMachine.DrainValve3);
State.Create("MainSeq : Close emptying valve(s)") State.Create("MainSeq : Close emptying valve(s)")
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, valvesClose)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, valvesClose))
.EnterState(); .EnterState();
do { e = StateMachine.WaitRunDevsRunOps(); } do { e = StateMachine.WaitRunDevsRunOps(); }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
emptying1 = emptying2 = emptying3 = false; draining1 = draining2 = draining3 = false;
} }
selection = Selection.None; selection = Selection.None;
} }
else if ((selection == Selection.EmptyTank1) && !emptying1) else if ((selection == Selection.DrainTank1) && !draining1)
{ {
emptying1 = true; draining1 = true;
Bridge.OnActivity(this, Strings.Emptying_tank); Bridge.OnActivity(this, Strings.Emptying_tank);
Bridge.Bench2UI(((context == MKSelContext.ProcedureNotSelected) ? ButtonsEtc.ProcedureCmbBoxEn : 0) | Bridge.Bench2UI(((context == MKSelContext.ProcedureNotSelected) ? ButtonsEtc.ProcedureCmbBoxEn : 0) |
ButtonsEtc.TestCmbBoxEn | ButtonsEtc.StopBtnEn | ButtonsEtc.TestCmbBoxEn | ButtonsEtc.StopBtnEn |
(emptying2 ? 0 : ButtonsEtc.EmptyTankBtn2En) | (draining2 ? 0 : ButtonsEtc.DrainTankBtn2En) |
(emptying3 ? 0 : ButtonsEtc.EmptyTankBtn3En)); (draining3 ? 0 : ButtonsEtc.DrainTankBtn3En));
State.Create("MainSeq : Open tank 1") State.Create("MainSeq : Open tank 1")
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DrainValve1, null)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DrainValve1, null))
.EnterState(); .EnterState();
do { e = StateMachine.WaitRunDevsRunOps(); } do { e = StateMachine.WaitRunDevsRunOps(); }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
} }
else if ((selection == Selection.EmptyTank2) && !emptying2) else if ((selection == Selection.DrainTank2) && !draining2)
{ {
emptying2 = true; draining2 = true;
Bridge.OnActivity(this, Strings.Emptying_tank); Bridge.OnActivity(this, Strings.Emptying_tank);
Bridge.Bench2UI(((context == MKSelContext.ProcedureNotSelected) ? ButtonsEtc.ProcedureCmbBoxEn : 0) | Bridge.Bench2UI(((context == MKSelContext.ProcedureNotSelected) ? ButtonsEtc.ProcedureCmbBoxEn : 0) |
ButtonsEtc.TestCmbBoxEn | ButtonsEtc.StopBtnEn | ButtonsEtc.TestCmbBoxEn | ButtonsEtc.StopBtnEn |
(emptying1 ? 0 : ButtonsEtc.EmptyTankBtn1En) | (draining1 ? 0 : ButtonsEtc.DrainTankBtn1En) |
(emptying3 ? 0 : ButtonsEtc.EmptyTankBtn3En)); (draining3 ? 0 : ButtonsEtc.DrainTankBtn3En));
State.Create("MainSeq : Open tank 2") State.Create("MainSeq : Open tank 2")
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DrainValve2, null)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DrainValve2, null))
.EnterState(); .EnterState();
do { e = StateMachine.WaitRunDevsRunOps(); } do { e = StateMachine.WaitRunDevsRunOps(); }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
} }
else if ((selection == Selection.EmptyTank3) && !emptying3) else if ((selection == Selection.DrainTank3) && !draining3)
{ {
emptying3 = true; draining3 = true;
Bridge.OnActivity(this, Strings.Emptying_tank); Bridge.OnActivity(this, Strings.Emptying_tank);
Bridge.Bench2UI(((context == MKSelContext.ProcedureNotSelected) ? ButtonsEtc.ProcedureCmbBoxEn : 0) | Bridge.Bench2UI(((context == MKSelContext.ProcedureNotSelected) ? ButtonsEtc.ProcedureCmbBoxEn : 0) |
ButtonsEtc.TestCmbBoxEn | ButtonsEtc.StopBtnEn | ButtonsEtc.TestCmbBoxEn | ButtonsEtc.StopBtnEn |
(emptying1 ? 0 : ButtonsEtc.EmptyTankBtn1En) | (draining1 ? 0 : ButtonsEtc.DrainTankBtn1En) |
(emptying2 ? 0 : ButtonsEtc.EmptyTankBtn2En)); (draining2 ? 0 : ButtonsEtc.DrainTankBtn2En));
State.Create("MainSeq : Open tank 3") State.Create("MainSeq : Open tank 3")
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DrainValve3, null)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DrainValve3, null))
.EnterState(); .EnterState();
@@ -1233,7 +1233,7 @@ namespace TBF.BenchControl.Sequences
.EnterState(); .EnterState();
do { e = StateMachine.WaitRunDevsRunOps(); } do { e = StateMachine.WaitRunDevsRunOps(); }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
emptying1 = false; draining1 = false;
} }
else if (selection == Selection.CloseTank2) else if (selection == Selection.CloseTank2)
{ {
@@ -1242,7 +1242,7 @@ namespace TBF.BenchControl.Sequences
.EnterState(); .EnterState();
do { e = StateMachine.WaitRunDevsRunOps(); } do { e = StateMachine.WaitRunDevsRunOps(); }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
emptying2 = false; draining2 = false;
} }
else if (selection == Selection.CloseTank3) else if (selection == Selection.CloseTank3)
{ {
@@ -1251,7 +1251,7 @@ namespace TBF.BenchControl.Sequences
.EnterState(); .EnterState();
do { e = StateMachine.WaitRunDevsRunOps(); } do { e = StateMachine.WaitRunDevsRunOps(); }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
emptying3 = false; draining3 = false;
} }
} }
@@ -171,39 +171,39 @@ namespace TBF.BenchControl.Sequences
} }
protected Event EmptyTheTank(IValve emptyTankValve, IBalance balance) protected Event DrainTheTank(IValve drainValve, IScale scale)
{ {
return EmptyTheTank(emptyTankValve, balance, new List<IOperation>()); return DrainTheTank(drainValve, scale, new List<IOperation>());
} }
protected Event EmptyTheTank(IValve emptyTankValve, IBalance balance, IOperation extraOperation) protected Event DrainTheTank(IValve drainValve, IScale scale, IOperation extraOperation)
{ {
IList<IOperation> extraOperations = new List<IOperation>(); IList<IOperation> extraOperations = new List<IOperation>();
extraOperations.Add(extraOperation); extraOperations.Add(extraOperation);
return EmptyTheTank(emptyTankValve, balance, extraOperations); return DrainTheTank(drainValve, scale, extraOperations);
} }
/// <summary> /// <summary>
/// Empties the tank: opens the emptying valve and measures the weight. /// Empties the tank: opens the emptying valve and measures the weight.
/// </summary> /// </summary>
/// <param name="emptyTankValve">Valve to empty the tank</param> /// <param name="drainValve">Valve to empty the tank</param>
/// <param name="balance">Balance underneath the tank</param> /// <param name="scale">Balance underneath the tank</param>
/// <returns>Event.Done or Event.Error</returns> /// <returns>Event.Done or Event.Error</returns>
protected Event EmptyTheTank(IValve emptyTankValve, IBalance balance, IList<IOperation> extraOperations) protected Event DrainTheTank(IValve drainValve, IScale scale, IList<IOperation> extraOperations)
{ {
bool stopped = false; bool stopped = false;
//------------------------------------------------ //------------------------------------------------------------
Bridge.OnActivity(this, TBF.Resources.Strings.Emptying_tank); Bridge.OnActivity(this, TBF.Resources.Strings.Emptying_tank);
//------------------------------------------------ //------------------------------------------------------------
IList<Event> e; IList<Event> e;
Bridge.Bench2UI(ButtonsEtc.StopBtnEn); Bridge.Bench2UI(ButtonsEtc.StopBtnEn);
State.Create("SequenceBase : Opening the emptying valve") State.Create("SequenceBase : Drain valve opened")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(emptyTankValve, null)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(drainValve, null))
.AddOperations(extraOperations) .AddOperations(extraOperations)
.EnterState(); .EnterState();
do do
@@ -214,9 +214,9 @@ namespace TBF.BenchControl.Sequences
do do
{ {
State.Create("SequenceBase : Emptying the tank") State.Create("SequenceBase : Draining the tank")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(balance.ReadMassOp(ref Mass)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.AddOperations(extraOperations) .AddOperations(extraOperations)
.EnterState(); .EnterState();
@@ -236,16 +236,16 @@ namespace TBF.BenchControl.Sequences
if (stopped) break; if (stopped) break;
} }
while (!balance.IsEmpty(Mass.Val)); while (!scale.IsEmpty(Mass.Val));
// //
// Quit emptying // Quit emptying
// //
State.Create("SequenceBase : Closing the emptying valve") State.Create("SequenceBase : Drain valve closed")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(balance.ReadMassOp(ref Mass)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, emptyTankValve)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, drainValve))
.AddOperations(extraOperations) .AddOperations(extraOperations)
.EnterState(); .EnterState();
do do
@@ -259,7 +259,7 @@ namespace TBF.BenchControl.Sequences
State.Create("SequenceBase : Updating the weight") State.Create("SequenceBase : Updating the weight")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(balance.ReadMassOp(ref Mass)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(new Operations.TimerOp(5)) .AddOperation(new Operations.TimerOp(5))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.AddOperations(extraOperations) .AddOperations(extraOperations)
@@ -720,7 +720,7 @@ namespace TBF.BenchControl.Sequences
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(realTest ? outPath.Balance.ReadMassOp(ref Mass) : null) .AddOperation(realTest ? outPath.Scale.ReadMassOp(ref Mass) : null)
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.AddOperation((StateMachine.Ambient != null) .AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
@@ -774,7 +774,7 @@ namespace TBF.BenchControl.Sequences
sb.Append(";"); sb.Append("0"); sb.Append(";"); sb.Append("0");
sb.Append(";"); sb.Append(outPath.FlowMeter.Idx1); sb.Append(";"); sb.Append(outPath.FlowMeter.Idx1);
sb.Append(";"); sb.Append(" "); sb.Append(";"); sb.Append(" ");
sb.Append(";"); if (outPath.Balance != null) sb.Append(outPath.Balance.Name); sb.Append(";"); if (outPath.Scale != null) sb.Append(outPath.Scale.Name);
sb.Append(";"); sb.Append(tstRslt.AmbTempMean); sb.Append(";"); sb.Append(tstRslt.AmbTempMean);
sb.Append(";"); sb.Append(Units.ConvertTo(Unit.mbar, tstRslt.AmbPressMean).ToString("F0")); /// [mbar] sb.Append(";"); sb.Append(Units.ConvertTo(Unit.mbar, tstRslt.AmbPressMean).ToString("F0")); /// [mbar]
sb.Append(";"); sb.Append(tstRslt.AmbHumiMean); /// [%] sb.Append(";"); sb.Append(tstRslt.AmbHumiMean); /// [%]
@@ -1084,7 +1084,7 @@ namespace TBF.BenchControl.Sequences
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench", (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty, inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty, outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Balance != null ? outPath.Balance.Name : string.Empty, outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
} }
@@ -1208,7 +1208,7 @@ namespace TBF.BenchControl.Sequences
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench", (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty, inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty, outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Balance != null ? outPath.Balance.Name : string.Empty, outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
} }
@@ -1335,7 +1335,7 @@ namespace TBF.BenchControl.Sequences
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench", (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty, inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty, outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Balance != null ? outPath.Balance.Name : string.Empty, outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
} }
+20 -20
View File
@@ -45,9 +45,9 @@ namespace TBF.BenchControl
/// Public components /// Public components
public static Elde.ControlBoardDev ControlBoard; public static Elde.ControlBoardDev ControlBoard;
public static GenericDevices.IAmbient Ambient; public static GenericDevices.IAmbient Ambient;
public static GenericDevices.IBalance Balance1; public static GenericDevices.IScale Scale1;
public static GenericDevices.IBalance Balance2; public static GenericDevices.IScale Scale2;
public static GenericDevices.IBalance Balance3; public static GenericDevices.IScale Scale3;
public static GenericDevices.IValve DrainValve1; public static GenericDevices.IValve DrainValve1;
public static GenericDevices.IValve DrainValve2; public static GenericDevices.IValve DrainValve2;
public static GenericDevices.IValve DrainValve3; public static GenericDevices.IValve DrainValve3;
@@ -85,8 +85,8 @@ namespace TBF.BenchControl
{ {
return GenericDevices.ValveBase.Merge( return GenericDevices.ValveBase.Merge(
Utils.ValvesOpen((feedingPaths != null && feedingPaths.Count > 0) ? feedingPaths[0] : null), Utils.ValvesOpen((feedingPaths != null && feedingPaths.Count > 0) ? feedingPaths[0] : null),
Utils.ValvesOpen((benchPaths != null && benchPaths.Count > 0) ? benchPaths[0] : null), Utils.ValvesOpen((benchPaths != null && benchPaths.Count > 0) ? benchPaths[0] : null),
Utils.ValvesOpen((outputPaths != null && outputPaths.Count > 0) ? outputPaths[0] : null) Utils.ValvesOpen((outputPaths != null && outputPaths.Count > 0) ? outputPaths[0] : null)
); );
} }
} }
@@ -97,8 +97,8 @@ namespace TBF.BenchControl
{ {
return GenericDevices.ValveBase.Merge( return GenericDevices.ValveBase.Merge(
Utils.ValvesClose((feedingPaths != null && feedingPaths.Count > 0) ? feedingPaths[0] : null), Utils.ValvesClose((feedingPaths != null && feedingPaths.Count > 0) ? feedingPaths[0] : null),
Utils.ValvesClose((benchPaths != null && benchPaths.Count > 0) ? benchPaths[0] : null), Utils.ValvesClose((benchPaths != null && benchPaths.Count > 0) ? benchPaths[0] : null),
Utils.ValvesClose((outputPaths != null && outputPaths.Count > 0) ? outputPaths[0] : null) Utils.ValvesClose((outputPaths != null && outputPaths.Count > 0) ? outputPaths[0] : null)
); );
} }
} }
@@ -210,7 +210,7 @@ namespace TBF.BenchControl
/// Find all balances (to initialize tank capacities in the control board) /// Find all balances (to initialize tank capacities in the control board)
/// Find the control board /// Find the control board
IList<IBalance> balances = new List<IBalance>(); IList<IScale> balances = new List<IScale>();
SequenceBase.FlowMeters = new List<IFlowMeter>(); SequenceBase.FlowMeters = new List<IFlowMeter>();
SequenceBase.RegulValves = new List<IRegulValve>(); SequenceBase.RegulValves = new List<IRegulValve>();
SequenceBase.PumpsWithFM = new List<IPumpFM>(); SequenceBase.PumpsWithFM = new List<IPumpFM>();
@@ -230,14 +230,14 @@ namespace TBF.BenchControl
if (cmpnt is IWaterMeter) SequenceBase.WaterMeters.Add(cmpnt as IWaterMeter); if (cmpnt is IWaterMeter) SequenceBase.WaterMeters.Add(cmpnt as IWaterMeter);
if (cmpnt is ICamera) SequenceBase.Cameras.Add(cmpnt as ICamera); if (cmpnt is ICamera) SequenceBase.Cameras.Add(cmpnt as ICamera);
if (cmpnt is GenericDevices.IAmbient) Ambient = cmpnt as GenericDevices.IAmbient; if (cmpnt is GenericDevices.IAmbient) Ambient = cmpnt as GenericDevices.IAmbient;
if (cmpnt is IBalance) if (cmpnt is IScale)
{ {
IBalance balance = cmpnt as IBalance; IScale scale = cmpnt as IScale;
balances.Add(balance); balances.Add(scale);
if (balance.BalanceNr == 0) Balance1 = balance; if (scale.ScaleNr == 0) Scale1 = scale;
else if (balance.BalanceNr == 1) Balance2 = balance; else if (scale.ScaleNr == 1) Scale2 = scale;
else if (balance.BalanceNr == 2) Balance3 = balance; else if (scale.ScaleNr == 2) Scale3 = scale;
} }
Elde.Valve.Valve eldeValve = (cmpnt as Elde.Valve.Valve); Elde.Valve.Valve eldeValve = (cmpnt as Elde.Valve.Valve);
@@ -306,23 +306,23 @@ namespace TBF.BenchControl
} }
} }
if (cmpnt is IBalance) if (cmpnt is IScale)
{ {
IBalance balance = cmpnt as IBalance; IScale balance = cmpnt as IScale;
if (balance.BalanceNr == 0) if (balance.ScaleNr == 0)
{ {
DrainValve1 = balance.DrainValve; DrainValve1 = balance.DrainValve;
log.WarnFormat("InitializeBoardEtc() ... Scale1={0} Draining valve1={1}", log.WarnFormat("InitializeBoardEtc() ... Scale1={0} Draining valve1={1}",
balance.Name, (DrainValve1 != null) ? DrainValve1.Name : "---"); balance.Name, (DrainValve1 != null) ? DrainValve1.Name : "---");
} }
else if (balance.BalanceNr == 1) else if (balance.ScaleNr == 1)
{ {
DrainValve2 = balance.DrainValve; DrainValve2 = balance.DrainValve;
log.WarnFormat("InitializeBoardEtc() ... Scale2={0} Draining valve2={1}", log.WarnFormat("InitializeBoardEtc() ... Scale2={0} Draining valve2={1}",
balance.Name, (DrainValve2 != null) ? DrainValve2.Name : "---"); balance.Name, (DrainValve2 != null) ? DrainValve2.Name : "---");
} }
else if (balance.BalanceNr == 2) else if (balance.ScaleNr == 2)
{ {
DrainValve3 = balance.DrainValve; DrainValve3 = balance.DrainValve;
log.WarnFormat("InitializeBoardEtc() ... Scale3={0} Draining valve3={1}", log.WarnFormat("InitializeBoardEtc() ... Scale3={0} Draining valve3={1}",
@@ -505,7 +505,7 @@ namespace TBF.BenchControl
if (tr.Name == test.TransitionAfter) transitionAfter = tr; if (tr.Name == test.TransitionAfter) transitionAfter = tr;
} }
if (pout.Balance == null) if (pout.Scale == null)
{ {
errorMsg = string.Format("No balance specified in path {0}", test.OutputPath); errorMsg = string.Format("No balance specified in path {0}", test.OutputPath);
return false; return false;
@@ -383,7 +383,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench", (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty, inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty, outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Balance != null ? outPath.Balance.Name : string.Empty, outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
@@ -141,12 +141,12 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
Qrise = 0; Qrise = 0;
Qfall = 0; Qfall = 0;
if (!test.Emptying) /// Do not skip emptying if test.Emptying==true if (!test.Draining) /// Do not skip emptying if test.Emptying==true
{ {
//-------------------------------- //--------------------------------
State.Create("CombinedWithDetection : Get the mass of water in the tank") State.Create("CombinedWithDetection : Get the mass of water in the tank")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.Balance.ReadMassOp(ref Mass)) .AddOperation(outPath.Scale.ReadMassOp(ref Mass))
.EnterState(); .EnterState();
do do
{ {
@@ -157,14 +157,14 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
while (!e.Contains(Event.BalanceDone)); while (!e.Contains(Event.BalanceDone));
double estimatedEndMass = Mass.Val + test.Volume; double estimatedEndMass = Mass.Val + test.Volume;
if (estimatedEndMass < outPath.Balance.Capacity * Constants.TankFullFactor) if (estimatedEndMass < outPath.Scale.Capacity * Constants.TankFullFactor)
{ {
goto switching_flow_detection; /// Enough room in the tank -> skip emptying goto switching_flow_detection; /// Enough room in the tank -> skip emptying
} }
} }
// Empty the water tank // Empty the water tank
switch (EmptyTheTank(outPath.EmptyTankValve, outPath.Balance)) switch (DrainTheTank(outPath.DrainValve, outPath.Scale))
{ {
case Event.Error: goto error; case Event.Error: goto error;
case Event.UiCmdStop: goto stopTest; case Event.UiCmdStop: goto stopTest;
@@ -463,7 +463,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
State.Create(Strings.Measure_the_mass) State.Create(Strings.Measure_the_mass)
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(measureOperations)
.AddOperation(outPath.Balance.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod)) .AddOperation(outPath.Scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.EnterState(); .EnterState();
do do
{ {
@@ -548,7 +548,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//------------------------------------------------ //------------------------------------------------
State.Create(Strings.Measure_the_mass) State.Create(Strings.Measure_the_mass)
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.Balance.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod)) .AddOperation(outPath.Scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.EnterState(); .EnterState();
do do
{ {
@@ -656,9 +656,9 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
tstRslt.TestTime = cBrd.TTime; /// [s] measurement time tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total) tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = StartMass.Val; tstRslt.MassStartRaw = StartMass.Val;
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections); tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections);
tstRslt.MassEndRaw = EndMass.Val; tstRslt.MassEndRaw = EndMass.Val;
tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections); tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections);
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h] tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h] tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h]
tstRslt.VolumeCTV = 1001.03 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3] tstRslt.VolumeCTV = 1001.03 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3]
@@ -729,7 +729,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench", (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty, inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty, outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Balance != null ? outPath.Balance.Name : string.Empty, outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
@@ -424,7 +424,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench", (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty, inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty, outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Balance != null ? outPath.Balance.Name : string.Empty, outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
@@ -30,33 +30,33 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
{ {
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
IList<Event> e = new List<Event>(); /// Events from currently running operations IList<Event> e = new List<Event>(); /// Events from currently running operations
Event retVal = Event.Done; Event retVal = Event.Done;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h] LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
/// Notes: /// Notes:
/// float timeHr = volumeLtr / (1000.0f * targetFlow); /// float timeHr = volumeLtr / (1000.0f * targetFlow);
/// float timeSec = 3600.0f * timeHr; /// float timeSec = 3600.0f * timeHr;
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow)); /// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f); int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
int repetitionNr = outerLoopMode ? outerLoopCounter : 1; /// First test: repetitionNr=1 int repetitionNr = outerLoopMode ? outerLoopCounter : 1; /// First test: repetitionNr=1
//==================================== //====================================
// Transition or SetRoute - Start // Transition or SetRoute - Start
//==================================== //====================================
switch (Transition(transitionBefore, TransitionContext.BeforeTest)) switch (Transition(transitionBefore, TransitionContext.BeforeTest))
{ {
case Event.Error: { retVal = Event.Error; goto stopTest; } case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
} }
//==================================== //====================================
loop: loop:
/// Start the test, initialize test results /// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
@@ -65,12 +65,49 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); if (!test.Draining)
int flowSetTime0 = StateMachine.Time; {
///
/// Measure the weight in case there is no unconditional draining
///
State.Create("FixedStartAdvanced : Measuring the mass of water in the tank")
.AddOperation(checkUiOp)
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.BalanceDone));
}
///
/// Skip draining in case there is enough room in the tank
///
if (test.Draining || (Mass.Val + test.Volume >= outPath.Scale.Capacity * Constants.TankFullFactor))
{
///
/// Drain the water tank
///
switch (DrainTheTank(outPath.DrainValve, outPath.Scale))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
}
}
//------------------------------------------------ //------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow); Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------ //------------------------------------------------
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
int flowSetTime0 = StateMachine.Time;
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create("FixedStartAdvanced : Waiting 5 sec") State.Create("FixedStartAdvanced : Waiting 5 sec")
@@ -83,7 +120,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.TimerExpired)); while (!e.Contains(Event.TimerExpired));
@@ -98,68 +135,32 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
if (!test.Emptying) /// If condition met => skip measuring and force emptying set_flow:
{
///
/// Measure the weight and skip emptying if there is enough room in the tank
///
State.Create("FixedStartAdvanced : Measuring the mass of water in the tank")
.AddOperation(checkUiOp)
.AddOperation(outPath.Balance.ReadMassOp(ref Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.BalanceDone));
double estimatedEndMass = Mass.Val + test.Volume; //------------------------------------------------
if (estimatedEndMass < outPath.Balance.Capacity * Constants.TankFullFactor) Bridge.OnActivity(this, Strings.Setting_the_flow);
{ //------------------------------------------------
goto set_flow; /// Enough room in the tank -> skip emptying
}
}
///
/// Empty the water tank
///
switch (EmptyTheTank(outPath.EmptyTankValve, outPath.Balance))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
}
set_flow:
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create("FixedStartAdvanced : Starting the pump") State.Create("FixedStartAdvanced : Starting the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null)) .AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState(); .EnterState();
do do
{ {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
//-------------------------------- //--------------------------------
State.Create("FixedStartAdvanced : Setting the flow") State.Create("FixedStartAdvanced : Setting the flow")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, 600)) /// timeout = 10 min. .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, 600)) /// timeout = 10 min.
@@ -170,8 +171,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; } if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.RegulValveTimeOut)) if (e.Contains(Event.RegulValveTimeOut))
{ {
Bridge.OnError(this, Strings.Timeout); Bridge.OnError(this, Strings.Timeout);
@@ -182,27 +183,27 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
} }
while (!e.Contains(Event.FlowReached)); while (!e.Contains(Event.FlowReached));
flow_set: flow_set:
int flowSetTime = StateMachine.Time - flowSetTime0; int flowSetTime = StateMachine.Time - flowSetTime0;
//------------------------------------------------ //------------------------------------------------
Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start); Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start);
//------------------------------------------------ //------------------------------------------------
State.Create("FixedStartAdvanced : Closing the start/stop valve before the fixed start test") State.Create("FixedStartAdvanced : Closing the start/stop valve before the fixed start test")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.StartValve)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.StartValve))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState(); .EnterState();
do do
{ {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
int time = StateMachine.Time; int time = StateMachine.Time;
double currentFlow = RefFlow.Val; double currentFlow = RefFlow.Val;
/// ///
@@ -236,120 +237,120 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
/// ///
/// Enter watermeter begin states here /// Enter watermeter begin states here
/// ///
GenericDevices.IHasWMStatesForm dataEntryCmpnt = GenericDevices.IHasWMStatesForm dataEntryCmpnt =
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm; TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
if (dataEntryCmpnt != null) if (dataEntryCmpnt != null)
{ {
Bridge.OnActivity(this, Strings.Enter_water_meter_data); Bridge.OnActivity(this, Strings.Enter_water_meter_data);
State.Create("FixedStartAdvanced : Enter begin-state") State.Create("FixedStartAdvanced : Enter begin-state")
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp()) .AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp())
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.EnterState(); .EnterState();
do do
{ {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.ModelessFormClosed)); while (!e.Contains(Event.ModelessFormClosed));
for (int i = 0; i < Config.Data.WMsCount; i++) for (int i = 0; i < Config.Data.WMsCount; i++)
{ {
BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader = BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader =
sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader; sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader;
if (registerReader != null) registerReader.BeginWMState = dataEntryCmpnt.WMStartState(i); if (registerReader != null) registerReader.BeginWMState = dataEntryCmpnt.WMStartState(i);
} }
} }
//------------------------------------------------ //------------------------------------------------
Bridge.OnActivity(this, Strings.Measuring_the_weight); Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------ //------------------------------------------------
State.Create("FixedStartAdvanced : Measuring the start mass") State.Create("FixedStartAdvanced : Measuring the start mass")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) .AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null) .AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(outPath.Balance.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod)) .AddOperation(outPath.Scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(cBrd.UpdateTankWeightOp()) .AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp) .AddOperation(processDataLoggingOp)
.EnterState(); .EnterState();
do do
{ {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.BalanceDone)); while (!e.Contains(Event.BalanceDone));
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
Mass.Val = StartMass.Val; Mass.Val = StartMass.Val;
//------------------------------------------------ //------------------------------------------------
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create("FixedStartAdvanced : Starting the test") State.Create("FixedStartAdvanced : Starting the test")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(measureOperations)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, .AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, 2 * totalPulses, (float)test.TolerRed)) test.Qfrom, test.Qto, 2 * totalPulses, (float)test.TolerRed))
.EnterState(); .EnterState();
do do
{ {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.MeasurementStarted)); while (!e.Contains(Event.MeasurementStarted));
State.Create("FixedStartAdvanced : Opening the start/stop valve at the beginning of the fixed start test") State.Create("FixedStartAdvanced : Opening the start/stop valve at the beginning of the fixed start test")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(outPath.StartValve, null)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(outPath.StartValve, null))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState(); .EnterState();
do do
{ {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
/// Measurement loop - preparation /// Measurement loop - preparation
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders); readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
queryEnd1 = cBrd.QueryMeasurementEndOp(); queryEnd1 = cBrd.QueryMeasurementEndOp();
queryEnd2 = cBrd.QueryMeasurementEndOp(); queryEnd2 = cBrd.QueryMeasurementEndOp();
ClearAllStatistics(); ClearAllStatistics();
int estimtdEndTime = StateMachine.Time + (int)test.TstTime; int estimtdEndTime = StateMachine.Time + (int)test.TstTime;
/// Measurement loop - begin /// Measurement loop - begin
do do
{ {
//-------------------------------- //--------------------------------
switch (ReadRegistersTempPressAmbient(measureOperations, true)) switch (ReadRegistersTempPressAmbient(measureOperations, true))
{ {
case Event.Error: case Event.Error:
retVal = Event.Error; retVal = Event.Error;
goto stopTest; goto stopTest;
case Event.UiCmdStop: case Event.UiCmdStop:
retVal = Event.UiCmdStop; retVal = Event.UiCmdStop;
goto stopTest; goto stopTest;
case Event.MeasurementCompleted: case Event.MeasurementCompleted:
goto test_completed; goto test_completed;
} }
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0); int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
if (remainingTime > 60) if (remainingTime > 60)
@@ -362,28 +363,28 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
} }
RefFreq.Val = cBrd.ReferenceFreq; RefFreq.Val = cBrd.ReferenceFreq;
RefFlow.Val = cBrd.ReferenceFlow; RefFlow.Val = cBrd.ReferenceFlow;
UpdateAllStatistics(); UpdateAllStatistics();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
} }
while (cBrd.EtPulses(0) < totalPulses); while (cBrd.EtPulses(0) < totalPulses);
/// Measurement loop - end /// Measurement loop - end
test_completed: test_completed:
State.Create("FixedStartAdvanced : Closing the start/stop valve at the end of the fixed start test") State.Create("FixedStartAdvanced : Closing the start/stop valve at the end of the fixed start test")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.StartValve)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.StartValve))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState(); .EnterState();
do do
{ {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
while (e.Contains(Event.ValvesBusy)); while (e.Contains(Event.ValvesBusy));
State.Create("FixedStartAdvanced : Waiting before 2nd mass measurement") State.Create("FixedStartAdvanced : Waiting before 2nd mass measurement")
@@ -396,7 +397,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) .AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null) .AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(outPath.Balance.ReadMassOp(ref Mass)) .AddOperation(outPath.Scale.ReadMassOp(ref Mass))
.AddOperation(cBrd.UpdateTankWeightOp()) .AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp) .AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass)) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
@@ -405,7 +406,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
{ {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.TimerExpired)); while (!e.Contains(Event.TimerExpired));
@@ -423,7 +424,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) .AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null) .AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(outPath.Balance.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod)) .AddOperation(outPath.Scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(cBrd.UpdateTankWeightOp()) .AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp) .AddOperation(processDataLoggingOp)
.EnterState(); .EnterState();
@@ -431,7 +432,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
{ {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.BalanceDone)); while (!e.Contains(Event.BalanceDone));
/// ///
@@ -439,56 +440,56 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
State.Create("FixedStartAdvanced : Stopping diverter, gate, etc.") State.Create("FixedStartAdvanced : Stopping diverter, gate, etc.")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do
{ {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.PreviousStopped)); while (!e.Contains(Event.PreviousStopped));
double massStart = Formulas.CorrectedValue(StartMass.Val, outPath.Balance.Corrections); double massStart = Formulas.CorrectedValue(StartMass.Val, outPath.Scale.Corrections);
double massEnd = Formulas.CorrectedValue(EndMass.Val, outPath.Balance.Corrections); double massEnd = Formulas.CorrectedValue(EndMass.Val, outPath.Scale.Corrections);
double densityOut = Formulas.WaterDensityFromTemp(TempDownStat.Average); double densityOut = Formulas.WaterDensityFromTemp(TempDownStat.Average);
double volumeCTV = 1.00103f * 1000.0f * (massEnd - massStart) / densityOut; double volumeCTV = 1.00103f * 1000.0f * (massEnd - massStart) / densityOut;
/// ///
/// Enter watermeter end states here /// Enter watermeter end states here
/// ///
if (dataEntryCmpnt != null) if (dataEntryCmpnt != null)
{ {
Bridge.OnActivity(this, Strings.Enter_water_meter_data); Bridge.OnActivity(this, Strings.Enter_water_meter_data);
State.Create("FixedStartAdvanced : Enter end-state") State.Create("FixedStartAdvanced : Enter end-state")
.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(volumeCTV, test.ErrLimLo + test.Uncertainty, .AddOperation(dataEntryCmpnt.ShowTestEndFormOp(volumeCTV, test.ErrLimLo + test.Uncertainty,
test.ErrLimHi - test.Uncertainty)) test.ErrLimHi - test.Uncertainty))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.EnterState(); .EnterState();
do do
{ {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.ModelessFormClosed)); while (!e.Contains(Event.ModelessFormClosed));
for (int i = 0; i < Config.Data.WMsCount; i++) for (int i = 0; i < Config.Data.WMsCount; i++)
{ {
BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader = BenchControl.Elde.FixedStartRegisterReader.RegisterReader registerReader =
sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader; sensPath.RegisterReaders[i] as BenchControl.Elde.FixedStartRegisterReader.RegisterReader;
if (registerReader != null) registerReader.EndWMState = dataEntryCmpnt.WMEndState(i); if (registerReader != null) registerReader.EndWMState = dataEntryCmpnt.WMEndState(i);
} }
} }
//------------------------------------------------ //------------------------------------------------
Bridge.OnActivity(this, Strings.Test_completed); Bridge.OnActivity(this, Strings.Test_completed);
//------------------------------------------------ //------------------------------------------------
/// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results /// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest; if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest;
/// ///
@@ -544,48 +545,48 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
tstRslt.TempDivEnd = (float)TempDivStat.Last; tstRslt.TempDivEnd = (float)TempDivStat.Last;
tstRslt.TempDivMin = (float)TempDivStat.Min; tstRslt.TempDivMin = (float)TempDivStat.Min;
tstRslt.TempDivMax = (float)TempDivStat.Max; tstRslt.TempDivMax = (float)TempDivStat.Max;
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempUpMean); /// [kg/m3] tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempUpMean); /// [kg/m3]
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempDownMean); /// [kg/m3] tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempDownMean); /// [kg/m3]
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivMean); /// [kg/m3] tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivMean); /// [kg/m3]
/// Main results /// Main results
tstRslt.StartTime = TestStartTime; tstRslt.StartTime = TestStartTime;
tstRslt.EndTime = TestEndTime; tstRslt.EndTime = TestEndTime;
tstRslt.FlowSetTime = flowSetTime; tstRslt.FlowSetTime = flowSetTime;
tstRslt.TestTime = cBrd.TTime; /// [s] measurement time tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total) tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = StartMass.Val; tstRslt.MassStartRaw = StartMass.Val;
tstRslt.MassStart = massStart; /// [kg] calculated before displaying 'End state' dialog tstRslt.MassStart = massStart; /// [kg] calculated before displaying 'End state' dialog
tstRslt.MassEndRaw = EndMass.Val; tstRslt.MassEndRaw = EndMass.Val;
tstRslt.MassEnd = massEnd; /// [kg] calculated before displaying 'End state' dialog tstRslt.MassEnd = massEnd; /// [kg] calculated before displaying 'End state' dialog
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h] tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime;
tstRslt.VolumeCTV = volumeCTV; /// [kg] calculated before displaying 'End state' dialog tstRslt.VolumeCTV = volumeCTV; /// [kg] calculated before displaying 'End state' dialog
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
tstRslt.FlowMin = (float)((tstRslt.VolumeMaster != 0) ? (RefFlowStat.Min * tstRslt.VolumeCTV / tstRslt.VolumeMaster) : RefFlowStat.Min); tstRslt.FlowMin = (float)((tstRslt.VolumeMaster != 0) ? (RefFlowStat.Min * tstRslt.VolumeCTV / tstRslt.VolumeMaster) : RefFlowStat.Min);
tstRslt.FlowMax = (float)((tstRslt.VolumeMaster != 0) ? (RefFlowStat.Max * tstRslt.VolumeCTV / tstRslt.VolumeMaster) : RefFlowStat.Max); tstRslt.FlowMax = (float)((tstRslt.VolumeMaster != 0) ? (RefFlowStat.Max * tstRslt.VolumeCTV / tstRslt.VolumeMaster) : RefFlowStat.Max);
for (int i = 0; i < BatchRslts.WMPositionsCount; i++) for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{ {
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue; if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single); Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[i]; GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[i];
if (meterRslt != null && regReader != null) if (meterRslt != null && regReader != null)
{ {
meterRslt.PulsesPerLiter = 1.0f; meterRslt.PulsesPerLiter = 1.0f;
meterRslt.VolumeStart = regReader.BeginWMState; meterRslt.VolumeStart = regReader.BeginWMState;
meterRslt.VolumeEnd = regReader.EndWMState; meterRslt.VolumeEnd = regReader.EndWMState;
meterRslt.VolumeMeter = meterRslt.VolumeEnd - meterRslt.VolumeStart; meterRslt.VolumeMeter = meterRslt.VolumeEnd - meterRslt.VolumeStart;
meterRslt.VolumeRef = tstRslt.VolumeCTV; /// liter meterRslt.VolumeRef = tstRslt.VolumeCTV; /// liter
meterRslt.PulsesMeter = meterRslt.VolumeMeter; meterRslt.PulsesMeter = meterRslt.VolumeMeter;
meterRslt.PulsesMaster = tstRslt.PulsesMaster; meterRslt.PulsesMaster = tstRslt.PulsesMaster;
meterRslt.TestTime = tstRslt.TestTime; meterRslt.TestTime = tstRslt.TestTime;
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
meterRslt.Passed = (meterRslt.Error >= test.ErrLimLo + test.Uncertainty) meterRslt.Passed = (meterRslt.Error >= test.ErrLimLo + test.Uncertainty)
&& (meterRslt.Error <= test.ErrLimHi - test.Uncertainty); && (meterRslt.Error <= test.ErrLimHi - test.Uncertainty);
meterRslt.TestDone = true; meterRslt.TestDone = true;
@@ -598,7 +599,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench", (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty, inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty, outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Balance != null ? outPath.Balance.Name : string.Empty, outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
@@ -631,7 +632,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
do do
{ {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.PreviousStopped)); while (!e.Contains(Event.PreviousStopped));
@@ -639,7 +640,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
/// Prevent overwriting 'retVal' in case it was set to non-default value earlier /// Prevent overwriting 'retVal' in case it was set to non-default value earlier
switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop)) switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop))
{ {
case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; } case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; } case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
} }
@@ -49,6 +49,15 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
int repetitionNr = outerLoopMode ? outerLoopCounter : 1; /// First test: repetitionNr=1 int repetitionNr = outerLoopMode ? outerLoopCounter : 1; /// First test: repetitionNr=1
if (test.Volume >= outPath.Scale.Capacity * Constants.TankFullFactor)
{
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
retVal = Event.UiCmdStop;
goto stopTestWOTransitionAfter;
}
//==================================== //====================================
// Transition or SetRoute - Start // Transition or SetRoute - Start
//==================================== //====================================
@@ -68,45 +77,84 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
int flowSetTime0 = StateMachine.Time;
if (test.Volume >= outPath.Balance.Capacity * Constants.TankFullFactor)
{
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
retVal = Event.Error;
goto stopTest;
}
/// ///
/// Optionally display prompt to emerge temperature meters to appropriate baths for heat meters test /// Optionally display prompt to emerge temperature meters to appropriate baths for heat meters test
/// ///
IOperation heatMetersPromptOp = null; IOperation heatMetersPromptOp = null;
if (heatMetersTestParams != null && !string.IsNullOrEmpty(heatMetersTestParams.Prompt)) if (heatMetersTestParams != null && !string.IsNullOrEmpty(heatMetersTestParams.Prompt))
{ {
heatMetersPromptOp = new Operations.MessageBoxOp(heatMetersTestParams.Prompt); /// Make sure the CycleBeginForm is closed
if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest;
heatMetersPromptOp = new Operations.MessageBoxOp(heatMetersTestParams.Prompt);
} }
if (!test.Draining)
{
///
/// Measure the weight in case there is no unconditional draining
///
State.Create("FixedStartMassCollection : Measuring the mass of water in the tank")
.AddOperation(checkUiOp)
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.BalanceDone));
}
///
/// Skip draining in case there is enough room in the tank
///
if (test.Draining || (Mass.Val + test.Volume >= outPath.Scale.Capacity * Constants.TankFullFactor))
{
///
/// Drain the water tank
///
switch (DrainTheTank(outPath.DrainValve, outPath.Scale, heatMetersPromptOp))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
}
}
///
/// Make sure the drain valve is closed
///
State.Create("FixedStartMassCollection : Make sure the drain valve is closed")
.AddOperation(checkUiOp)
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp)
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.DrainValve))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.ValvesSet) || !e.Contains(Event.BalanceDone));
//------------------------------------------------ //------------------------------------------------
Bridge.OnActivity(this, Strings.Starting_the_pump); Bridge.OnActivity(this, Strings.Starting_the_pump);
//------------------------------------------------ //------------------------------------------------
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create("FixedStartMassCollection : Waiting before starting the pump") Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
.AddOperation(checkUiOp) int flowSetTime0 = StateMachine.Time;
.AddOperation(new Operations.TimerOp(5))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
}
while (!e.Contains(Event.TimerExpired));
/// ///
State.Create("FixedStartMassCollection : Starting the pump") State.Create("FixedStartMassCollection : Starting the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
@@ -128,44 +176,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
while (e.Contains(Event.ValvesBusy) || !e.Contains(Event.AllPositionsReached)); while (e.Contains(Event.ValvesBusy) || !e.Contains(Event.AllPositionsReached));
if (!test.Emptying) /// If condition met => skip measuring and force emptying
{
///
/// Measure the weight and skip emptying if there is enough room in the tank
///
State.Create("FixedStartMassCollection : Measuring the mass of water in the tank")
.AddOperation(checkUiOp)
.AddOperation(outPath.Balance.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.BalanceDone));
double estimatedEndMass = Mass.Val + test.Volume;
if (estimatedEndMass < outPath.Balance.Capacity * Constants.TankFullFactor)
{
goto set_flow; /// Enough room in the tank -> skip emptying
}
}
///
/// Empty the water tank
///
switch (EmptyTheTank(outPath.EmptyTankValve, outPath.Balance, heatMetersPromptOp))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
}
set_flow:
if (debugLevel == Config.Entities.DebugMode.Simulate) goto flow_set; if (debugLevel == Config.Entities.DebugMode.Simulate) goto flow_set;
@@ -402,7 +412,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null) .AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(outPath.Balance.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod)) .AddOperation(outPath.Scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(cBrd.UpdateTankWeightOp()) .AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp) .AddOperation(processDataLoggingOp)
.EnterState(); .EnterState();
@@ -587,7 +597,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null) .AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(outPath.Balance.ReadMassOp(ref Mass)) .AddOperation(outPath.Scale.ReadMassOp(ref Mass))
.AddOperation(cBrd.UpdateTankWeightOp()) .AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp) .AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass)) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
@@ -618,7 +628,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null) .AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(outPath.Balance.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod)) .AddOperation(outPath.Scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(cBrd.UpdateTankWeightOp()) .AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp) .AddOperation(processDataLoggingOp)
.EnterState(); .EnterState();
@@ -645,8 +655,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
while (!e.Contains(Event.PreviousStopped)); while (!e.Contains(Event.PreviousStopped));
double massStart = Formulas.CorrectedValue(StartMass.Val, outPath.Balance.Corrections); double massStart = Formulas.CorrectedValue(StartMass.Val, outPath.Scale.Corrections);
double massEnd = Formulas.CorrectedValue(EndMass.Val, outPath.Balance.Corrections); double massEnd = Formulas.CorrectedValue(EndMass.Val, outPath.Scale.Corrections);
double densityOut = Formulas.WaterDensityFromTemp(TempDownStat.Average); /// [kg/m3] double densityOut = Formulas.WaterDensityFromTemp(TempDownStat.Average); /// [kg/m3]
double volumeCTV = 1001.03 * (massEnd - massStart) / densityOut; double volumeCTV = 1001.03 * (massEnd - massStart) / densityOut;
double refEnergy = Energy.Sum * volumeCTV / VolumeForEnergy.Sum; /// [J]=[J]*[l]/[l] double refEnergy = Energy.Sum * volumeCTV / VolumeForEnergy.Sum; /// [J]=[J]*[l]/[l]
@@ -942,7 +952,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench", (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty, inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty, outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Balance != null ? outPath.Balance.Name : string.Empty, outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
@@ -982,10 +992,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
/// Prevent overwriting 'retVal' in case it was set to non-default value earlier /// Prevent overwriting 'retVal' in case it was set to non-default value earlier
switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop)) switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop))
{ {
case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; } case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; } case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
} }
stopTestWOTransitionAfter:
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
/// Create a list with one item 'retVal' (default is Event.Done) and return it /// Create a list with one item 'retVal' (default is Event.Done) and return it
@@ -614,7 +614,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench", (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty, inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty, outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Balance != null ? outPath.Balance.Name : string.Empty, outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
@@ -102,7 +102,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
int repetitionNr = outerLoopMode ? outerLoopCounter : 1; /// First test: repetitionNr = 1 int repetitionNr = outerLoopMode ? outerLoopCounter : 1; /// First test: repetitionNr = 1
if (test.Volume >= outPath.Balance.Capacity * Constants.TankFullFactor) if (test.Volume >= outPath.Scale.Capacity * Constants.TankFullFactor)
{ {
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity); Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
retVal = Event.UiCmdStop; retVal = Event.UiCmdStop;
@@ -127,22 +127,21 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, Convert.ToInt32(test.TstTime) + 15, 0, 0 }); TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
int flowSetTime0 = StateMachine.Time;
//------------------------------------------------ //------------------------------------------------
Bridge.OnActivity(this, Strings.Checking_tank_capacity); Bridge.OnActivity(this, Strings.Checking_tank_capacity);
//------------------------------------------------ //------------------------------------------------
bool emptyTheTank = test.Emptying; bool drainTheTank = test.Draining;
if (!emptyTheTank) /// If condition met => skip measuring and force emptying if (!drainTheTank) /// If condition met => skip measuring and force emptying
{ {
/// ///
/// Measure the weight and skip emptying if there is enough room in the tank /// Measure the weight and skip emptying if there is enough room in the tank
/// ///
State.Create("FlyingStartMassCollection : Checking available tank capacity") State.Create("FlyingStartMassCollection : Checking available tank capacity")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.Balance.ReadMassOp(ref Mass)) .AddOperation(outPath.Scale.ReadMassOp(ref Mass))
.EnterState(); .EnterState();
do do
{ {
@@ -153,27 +152,38 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
while (!e.Contains(Event.BalanceDone)); while (!e.Contains(Event.BalanceDone));
double estimatedEndMass = Mass.Val + test.Volume; double estimatedEndMass = Mass.Val + test.Volume;
if (estimatedEndMass >= outPath.Balance.Capacity * Constants.TankFullFactor) if (estimatedEndMass >= outPath.Scale.Capacity * Constants.TankFullFactor)
{ {
emptyTheTank = true; drainTheTank = true;
} }
} }
/// ///
if (emptyTheTank) if (drainTheTank)
{ {
#if BERLIN
switch (DrainTheTank(outPath.DrainValve, outPath.Scale))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
}
drainTheTank = false;
#else
State.Create("FlyingStartMassCollection : Opening the emptying valve") State.Create("FlyingStartMassCollection : Opening the emptying valve")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(outPath.EmptyTankValve, null)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(outPath.DrainValve, null))
.EnterState(); .EnterState();
do do
{ {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
#endif
} }
/// ///
/// Optionally display prompt to emerge temperature meters to appropriate baths for heat meters test /// Optionally display prompt to emerge temperature meters to appropriate baths for heat meters test
/// ///
@@ -186,10 +196,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
heatMetersPromptOp = new Operations.MessageBoxOp(heatMetersTestParams.Prompt); heatMetersPromptOp = new Operations.MessageBoxOp(heatMetersTestParams.Prompt);
} }
//------------------------------------------------ //------------------------------------------------
Bridge.OnActivity(this, Strings.Starting_the_pump); Bridge.OnActivity(this, Strings.Starting_the_pump);
//------------------------------------------------ //------------------------------------------------
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
int flowSetTime0 = StateMachine.Time;
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create("FlyingStartMassCollection : Starting the pump") State.Create("FlyingStartMassCollection : Starting the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
@@ -384,8 +399,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp()); foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp());
if (drainTheTank)
if (emptyTheTank)
{ {
//------------------------------------------------ //------------------------------------------------
Bridge.OnActivity(this, Strings.Closing_the_tank); Bridge.OnActivity(this, Strings.Closing_the_tank);
@@ -402,15 +416,16 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
extraOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)); extraOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
extraOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)); extraOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
} }
switch (EmptyTheTank(outPath.EmptyTankValve, outPath.Balance, extraOps)) switch (DrainTheTank(outPath.DrainValve, outPath.Scale, extraOps))
{ {
case Event.Error: { retVal = Event.Error; goto stopTest; } case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
} }
emptyTheTank = false; drainTheTank = false;
} }
if (test.TimeFlow2Mass > 0) if (test.TimeFlow2Mass > 0)
{ {
State.Create("FlyingStartMassCollection : Waiting before 1st mass measurement") State.Create("FlyingStartMassCollection : Waiting before 1st mass measurement")
@@ -456,7 +471,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null) .AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(outPath.Balance.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod)) .AddOperation(outPath.Scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(cBrd.UpdateTankWeightOp()) .AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp) .AddOperation(processDataLoggingOp)
.EnterState(); .EnterState();
@@ -535,7 +550,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(outPath.Balance.ReadMassOp(ref Mass)) .AddOperation(outPath.Scale.ReadMassOp(ref Mass))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.AddOperation((StateMachine.Ambient != null) .AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
@@ -625,7 +640,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null) .AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(outPath.Balance.ReadMassOp(ref Mass)) .AddOperation(outPath.Scale.ReadMassOp(ref Mass))
.AddOperation(cBrd.UpdateTankWeightOp()) .AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp) .AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass)) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
@@ -657,7 +672,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null) .AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(outPath.Balance.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod)) .AddOperation(outPath.Scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(cBrd.UpdateTankWeightOp()) .AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp) .AddOperation(processDataLoggingOp)
.EnterState(); .EnterState();
@@ -746,9 +761,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
tstRslt.TestTime = cBrd.TTime; /// [s] measurement time tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total) tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = StartMass.Val; tstRslt.MassStartRaw = StartMass.Val;
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections); tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections);
tstRslt.MassEndRaw = EndMass.Val; tstRslt.MassEndRaw = EndMass.Val;
tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections); tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections);
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h] tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.VolumeCTV = 1001.03 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3] tstRslt.VolumeCTV = 1001.03 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3]
@@ -942,7 +957,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench", (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty, inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty, outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Balance != null ? outPath.Balance.Name : string.Empty, outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
@@ -401,7 +401,7 @@ namespace TBF.BenchControl.TestMethods.LeakTest
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench", (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty, inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty, outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Balance != null ? outPath.Balance.Name : string.Empty, outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
@@ -312,7 +312,7 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench", (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty, inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty, outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Balance != null ? outPath.Balance.Name : string.Empty, outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
@@ -103,14 +103,14 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
if (!test.Emptying) /// If condition met => skip measuring and force emptying if (!test.Draining) /// If condition met => skip measuring and force emptying
{ {
/// ///
/// Measure the weight and skip emptying if there is enough room in the tank /// Measure the weight and skip emptying if there is enough room in the tank
/// ///
State.Create("ReferenceFlowmeterCalibration : Measuring the mass of water in the tank") State.Create("ReferenceFlowmeterCalibration : Measuring the mass of water in the tank")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.Balance.ReadMassOp(ref Mass)) .AddOperation(outPath.Scale.ReadMassOp(ref Mass))
.EnterState(); .EnterState();
do do
{ {
@@ -124,7 +124,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
while (!e.Contains(Event.BalanceDone)); while (!e.Contains(Event.BalanceDone));
double estimatedEndMass = Mass.Val + test.Volume; double estimatedEndMass = Mass.Val + test.Volume;
if (estimatedEndMass < outPath.Balance.Capacity * Constants.TankFullFactor) if (estimatedEndMass < outPath.Scale.Capacity * Constants.TankFullFactor)
{ {
goto set_flow; /// Enough room in the tank -> skip emptying goto set_flow; /// Enough room in the tank -> skip emptying
} }
@@ -133,7 +133,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
/// ///
/// Empty the water tank /// Empty the water tank
/// ///
switch (EmptyTheTank(outPath.EmptyTankValve, outPath.Balance)) switch (DrainTheTank(outPath.DrainValve, outPath.Scale))
{ {
case Event.Error: { retVal = Event.Error; goto stopTest; } case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -182,7 +182,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) .AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null) .AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(outPath.Balance.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod)) .AddOperation(outPath.Scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(cBrd.UpdateTankWeightOp()) .AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp) .AddOperation(processDataLoggingOp)
.EnterState(); .EnterState();
@@ -251,7 +251,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
.AddOperation(readRegistersOp) .AddOperation(readRegistersOp)
.AddOperation((StateMachine.Ambient != null) .AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(outPath.Balance.ReadMassOp(ref Mass)) .AddOperation(outPath.Scale.ReadMassOp(ref Mass))
.AddOperation(cBrd.UpdateTankWeightOp()) .AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp) .AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass)) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
@@ -277,7 +277,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) .AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null) .AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(outPath.Balance.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod)) .AddOperation(outPath.Scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(cBrd.UpdateTankWeightOp()) .AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp) .AddOperation(processDataLoggingOp)
.EnterState(); .EnterState();
@@ -362,9 +362,9 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
tstRslt.TestTime = cBrd.TTime; /// [s] measurement time tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total) tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = StartMass.Val; tstRslt.MassStartRaw = StartMass.Val;
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections); tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections);
tstRslt.MassEndRaw = EndMass.Val; tstRslt.MassEndRaw = EndMass.Val;
tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections); tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections);
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h] tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.VolumeCTV = 1001.03 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3] tstRslt.VolumeCTV = 1001.03 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3]
@@ -388,7 +388,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench", (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty, inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty, outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Balance != null ? outPath.Balance.Name : string.Empty, outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
+1 -1
View File
@@ -79,7 +79,7 @@ namespace TBF
TabPage tabPage = new TabPage(" " + cmpnt.Name + " "); TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
MetrologyDlgBalanceTab uiControl = new MetrologyDlgBalanceTab(); MetrologyDlgBalanceTab uiControl = new MetrologyDlgBalanceTab();
uiControl.MeterEntity = cmpnt; uiControl.MeterEntity = cmpnt;
uiControl.BalanceCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.IBalanceCfg; uiControl.BalanceCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.IScaleCfg;
uiControl.Dock = DockStyle.Fill; uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl; tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl); tabPage.Controls.Add(uiControl);
+3 -3
View File
@@ -906,7 +906,7 @@ namespace TBF
lviMetrlg1.SubItems.Add(test.Volume.ToString()); lviMetrlg1.SubItems.Add(test.Volume.ToString());
lviMetrlg1.SubItems.Add(test.TstTime.ToString()); lviMetrlg1.SubItems.Add(test.TstTime.ToString());
lviMetrlg1.SubItems.Add(test.Repeats.ToString()); lviMetrlg1.SubItems.Add(test.Repeats.ToString());
lviMetrlg1.SubItems.Add(test.Emptying ? Strings.yes : Strings.no); lviMetrlg1.SubItems.Add(test.Draining ? Strings.yes : Strings.no);
//lviMetrlg1.SubItems.Add(test.Zeroing ? Strings.yes : Strings.no); //lviMetrlg1.SubItems.Add(test.Zeroing ? Strings.yes : Strings.no);
lviMetrlg1.SubItems.Add((test.Method != null) ? test.Method.ToString() : string.Empty); lviMetrlg1.SubItems.Add((test.Method != null) ? test.Method.ToString() : string.Empty);
@@ -984,8 +984,8 @@ namespace TBF
int itmp; int itmp;
if (int.TryParse(lvi.SubItems[(int)MtrlgyClmn.Repeats].Text, out itmp)) entity.Repeats = itmp; if (int.TryParse(lvi.SubItems[(int)MtrlgyClmn.Repeats].Text, out itmp)) entity.Repeats = itmp;
if (lvi.SubItems[(int)MtrlgyClmn.Emptying].Text.Equals(Strings.yes)) entity.Emptying = true; if (lvi.SubItems[(int)MtrlgyClmn.Emptying].Text.Equals(Strings.yes)) entity.Draining = true;
else if (lvi.SubItems[(int)MtrlgyClmn.Emptying].Text.Equals(Strings.no)) entity.Emptying = false; else if (lvi.SubItems[(int)MtrlgyClmn.Emptying].Text.Equals(Strings.no)) entity.Draining = false;
if (methodCBox.Items.Contains(lvi.SubItems[(int)MtrlgyClmn.Method].Text)) if (methodCBox.Items.Contains(lvi.SubItems[(int)MtrlgyClmn.Method].Text))
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.12.517.1")] [assembly: AssemblyVersion("2.12.518.1")]
[assembly: AssemblyFileVersion("2.12.517.1")] [assembly: AssemblyFileVersion("2.12.518.1")]
@@ -396,7 +396,7 @@ namespace TBF.Screens
if (args.OutputPath.TempDiv != null) tDivCmpntLabel.Text = args.OutputPath.TempDiv.Name; if (args.OutputPath.TempDiv != null) tDivCmpntLabel.Text = args.OutputPath.TempDiv.Name;
if (args.OutputPath.FlowMeter != null) refFlowCmpntLabel.Text = args.OutputPath.FlowMeter.Name; if (args.OutputPath.FlowMeter != null) refFlowCmpntLabel.Text = args.OutputPath.FlowMeter.Name;
if (args.OutputPath.RegulValve != null) regValveCmpntLabel.Text = args.OutputPath.RegulValve.Name; if (args.OutputPath.RegulValve != null) regValveCmpntLabel.Text = args.OutputPath.RegulValve.Name;
if (args.OutputPath.Balance != null) scaleCmpntLabel.Text = args.OutputPath.Balance.Name; if (args.OutputPath.Scale != null) scaleCmpntLabel.Text = args.OutputPath.Scale.Name;
for (int i = 0; i < textBoxesCount; i++) for (int i = 0; i < textBoxesCount; i++)
{ {
@@ -425,7 +425,7 @@ namespace TBF.Screens
if (args.OutputPath.TempDiv != null) tDivCmpntLabel.Text = args.OutputPath.TempDiv.Name; if (args.OutputPath.TempDiv != null) tDivCmpntLabel.Text = args.OutputPath.TempDiv.Name;
if (args.OutputPath.FlowMeter != null) refFlowCmpntLabel.Text = args.OutputPath.FlowMeter.Name; if (args.OutputPath.FlowMeter != null) refFlowCmpntLabel.Text = args.OutputPath.FlowMeter.Name;
if (args.OutputPath.RegulValve != null) regValveCmpntLabel.Text = args.OutputPath.RegulValve.Name; if (args.OutputPath.RegulValve != null) regValveCmpntLabel.Text = args.OutputPath.RegulValve.Name;
if (args.OutputPath.Balance != null) scaleCmpntLabel.Text = args.OutputPath.Balance.Name; if (args.OutputPath.Scale != null) scaleCmpntLabel.Text = args.OutputPath.Scale.Name;
for (int i = 0; i < textBoxesCount; i++) for (int i = 0; i < textBoxesCount; i++)
{ {
@@ -412,7 +412,7 @@ namespace TBF.Screens
if (args.OutputPath.TempDiv != null) tDivCmpntLabel.Text = args.OutputPath.TempDiv.Name; if (args.OutputPath.TempDiv != null) tDivCmpntLabel.Text = args.OutputPath.TempDiv.Name;
if (args.OutputPath.FlowMeter != null) refFlowCmpntLabel.Text = args.OutputPath.FlowMeter.Name; if (args.OutputPath.FlowMeter != null) refFlowCmpntLabel.Text = args.OutputPath.FlowMeter.Name;
if (args.OutputPath.RegulValve != null) regValveCmpntLabel.Text = args.OutputPath.RegulValve.Name; if (args.OutputPath.RegulValve != null) regValveCmpntLabel.Text = args.OutputPath.RegulValve.Name;
if (args.OutputPath.Balance != null) scaleCmpntLabel.Text = args.OutputPath.Balance.Name; if (args.OutputPath.Scale != null) scaleCmpntLabel.Text = args.OutputPath.Scale.Name;
sensor1Label.Text = (args.MetersPath.RegisterReaders[0] == null) ? "" : args.MetersPath.RegisterReaders[0].Cfg.Name; sensor1Label.Text = (args.MetersPath.RegisterReaders[0] == null) ? "" : args.MetersPath.RegisterReaders[0].Cfg.Name;
if (Config.Data.WMsCount >= 2) if (Config.Data.WMsCount >= 2)
+3 -3
View File
@@ -445,7 +445,7 @@
<DependentUpon>ValveCfgCtrl.cs</DependentUpon> <DependentUpon>ValveCfgCtrl.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="BenchControl\Elde\ValveEx\ValveFactory.cs" /> <Compile Include="BenchControl\Elde\ValveEx\ValveFactory.cs" />
<Compile Include="BenchControl\GenericDevices\IBalanceCfg.cs" /> <Compile Include="BenchControl\GenericDevices\IScaleCfg.cs" />
<Compile Include="BenchControl\GenericDevices\ICalibInfoCfg.cs" /> <Compile Include="BenchControl\GenericDevices\ICalibInfoCfg.cs" />
<Compile Include="BenchControl\GenericDevices\IHasHeatMtrStatesForm.cs" /> <Compile Include="BenchControl\GenericDevices\IHasHeatMtrStatesForm.cs" />
<Compile Include="BenchControl\GenericDevices\IModbus.cs" /> <Compile Include="BenchControl\GenericDevices\IModbus.cs" />
@@ -1350,8 +1350,8 @@
<Compile Include="BenchControl\Elde\Valve\ValveCfg.cs" /> <Compile Include="BenchControl\Elde\Valve\ValveCfg.cs" />
<Compile Include="BenchControl\Elde\Valve\ValveFactory.cs" /> <Compile Include="BenchControl\Elde\Valve\ValveFactory.cs" />
<Compile Include="BenchControl\Current.cs" /> <Compile Include="BenchControl\Current.cs" />
<Compile Include="BenchControl\GenericDevices\IBalance.cs" /> <Compile Include="BenchControl\GenericDevices\IScale.cs" />
<Compile Include="BenchControl\GenericDevices\IBalance2.cs" /> <Compile Include="BenchControl\GenericDevices\IScale2.cs" />
<Compile Include="BenchControl\Generic\IComponentCfgCtrl.cs" /> <Compile Include="BenchControl\Generic\IComponentCfgCtrl.cs" />
<Compile Include="BenchControl\GenericDevices\IDiverter.cs" /> <Compile Include="BenchControl\GenericDevices\IDiverter.cs" />
<Compile Include="BenchControl\GenericDevices\IFlowMeter.cs" /> <Compile Include="BenchControl\GenericDevices\IFlowMeter.cs" />
+7 -7
View File
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2015 Sensus Metering Systems /// Copyright (c) 2013-2017 Sensus Metering Systems
/// ///
namespace TBF.UiBridge namespace TBF.UiBridge
{ {
@@ -15,9 +15,9 @@ namespace TBF.UiBridge
Stop, Stop,
PurgeBegin, PurgeBegin,
PurgeEnd, PurgeEnd,
EmptyTank1, DrainTank1,
EmptyTank2, DrainTank2,
EmptyTank3, DrainTank3,
Break, Break,
ResetResults, ResetResults,
AcceptResults, AcceptResults,
@@ -40,9 +40,9 @@ namespace TBF.UiBridge
StartCycleBtnEn = 0x10, StartCycleBtnEn = 0x10,
PurgeBeginBtnEn = 0x20, PurgeBeginBtnEn = 0x20,
PurgeEndBtnEn = 0x40, PurgeEndBtnEn = 0x40,
EmptyTankBtn1En = 0x80, DrainTankBtn1En = 0x80,
EmptyTankBtn2En = 0x100, DrainTankBtn2En = 0x100,
EmptyTankBtn3En = 0x200, DrainTankBtn3En = 0x200,
Break = 0x400, Break = 0x400,
ResetResultsBtnEn = 0x800, ResetResultsBtnEn = 0x800,
AcceptResultsBtnEn = 0x1000, AcceptResultsBtnEn = 0x1000,
@@ -199,9 +199,9 @@ namespace TBF.UiControls
private void stopBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.Stop); } private void stopBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.Stop); }
private void purgeBeginBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.PurgeBegin); } private void purgeBeginBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.PurgeBegin); }
private void purgeEndBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.PurgeEnd); } private void purgeEndBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.PurgeEnd); }
private void emptyTank1Btn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.EmptyTank1); } private void emptyTank1Btn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.DrainTank1); }
private void emptyTank2Btn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.EmptyTank2); } private void emptyTank2Btn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.DrainTank2); }
private void emptyTank3Btn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.EmptyTank3); } private void emptyTank3Btn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.DrainTank3); }
private void breakBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.Break); } private void breakBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.Break); }
private void resetResultsBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.ResetResults); } private void resetResultsBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.ResetResults); }
private void acceptResultsBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.AcceptResults); } private void acceptResultsBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.AcceptResults); }
@@ -228,8 +228,8 @@ namespace TBF.UiControls
case '5': if (startCycleBtn.Enabled) { Bridge.Ui2Bench(UI2BenchCmd.StartCycle); } return true; case '5': if (startCycleBtn.Enabled) { Bridge.Ui2Bench(UI2BenchCmd.StartCycle); } return true;
case '6': if (purgeBeginBtn.Enabled) { Bridge.Ui2Bench(UI2BenchCmd.PurgeBegin); } return true; case '6': if (purgeBeginBtn.Enabled) { Bridge.Ui2Bench(UI2BenchCmd.PurgeBegin); } return true;
case '7': if (purgeEndBtn.Enabled) { Bridge.Ui2Bench(UI2BenchCmd.PurgeEnd); } return true; case '7': if (purgeEndBtn.Enabled) { Bridge.Ui2Bench(UI2BenchCmd.PurgeEnd); } return true;
case '8': if (emptyTank1Btn.Enabled) { Bridge.Ui2Bench(UI2BenchCmd.EmptyTank1); } return true; case '8': if (emptyTank1Btn.Enabled) { Bridge.Ui2Bench(UI2BenchCmd.DrainTank1); } return true;
case '9': if (emptyTank2Btn.Enabled) { Bridge.Ui2Bench(UI2BenchCmd.EmptyTank2); } return true; case '9': if (emptyTank2Btn.Enabled) { Bridge.Ui2Bench(UI2BenchCmd.DrainTank2); } return true;
default: default:
return false; return false;
} }
@@ -286,13 +286,13 @@ namespace TBF.UiControls
purgeEndBtn.Enabled = ((args.Flags & ButtonsEtc.PurgeEndBtnEn) != 0); purgeEndBtn.Enabled = ((args.Flags & ButtonsEtc.PurgeEndBtnEn) != 0);
purgeEndBtn.BackColor = purgeEndBtn.Enabled ? colorPurgeEn : colorPurgeDis; purgeEndBtn.BackColor = purgeEndBtn.Enabled ? colorPurgeEn : colorPurgeDis;
emptyTank1Btn.Enabled = ((args.Flags & ButtonsEtc.EmptyTankBtn1En) != 0); emptyTank1Btn.Enabled = ((args.Flags & ButtonsEtc.DrainTankBtn1En) != 0);
emptyTank1Btn.BackColor = emptyTank1Btn.Enabled ? colorEmptyEn : colorEmptyDis; emptyTank1Btn.BackColor = emptyTank1Btn.Enabled ? colorEmptyEn : colorEmptyDis;
emptyTank2Btn.Enabled = ((args.Flags & ButtonsEtc.EmptyTankBtn2En) != 0); emptyTank2Btn.Enabled = ((args.Flags & ButtonsEtc.DrainTankBtn2En) != 0);
emptyTank2Btn.BackColor = emptyTank2Btn.Enabled ? colorEmptyEn : colorEmptyDis; emptyTank2Btn.BackColor = emptyTank2Btn.Enabled ? colorEmptyEn : colorEmptyDis;
emptyTank3Btn.Enabled = ((args.Flags & ButtonsEtc.EmptyTankBtn3En) != 0); emptyTank3Btn.Enabled = ((args.Flags & ButtonsEtc.DrainTankBtn3En) != 0);
emptyTank3Btn.BackColor = emptyTank3Btn.Enabled ? colorEmptyEn : colorEmptyDis; emptyTank3Btn.BackColor = emptyTank3Btn.Enabled ? colorEmptyEn : colorEmptyDis;
resetResultsBtn.Enabled = ((args.Flags & ButtonsEtc.ResetResultsBtnEn) != 0); resetResultsBtn.Enabled = ((args.Flags & ButtonsEtc.ResetResultsBtnEn) != 0);
@@ -29,7 +29,7 @@ namespace TBF.UiControls
/// <summary> /// <summary>
/// Balance configuration (with buoyancy parameters) /// Balance configuration (with buoyancy parameters)
/// </summary> /// </summary>
public BenchControl.GenericDevices.IBalanceCfg BalanceCfg; public BenchControl.GenericDevices.IScaleCfg BalanceCfg;
/// <summary> /// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK. /// A list of 'measurement-correction' pairs to be deleted from the database on OK.
@@ -104,7 +104,7 @@ namespace TBF.UiControls
if (cmpnt is IRegulValve) regulValveComboBox.Items.Add(cmpnt.Cfg.Name); if (cmpnt is IRegulValve) regulValveComboBox.Items.Add(cmpnt.Cfg.Name);
if (cmpnt is IFlowMeter) flowMeterComboBox.Items.Add(cmpnt.Cfg.Name); if (cmpnt is IFlowMeter) flowMeterComboBox.Items.Add(cmpnt.Cfg.Name);
if (cmpnt is IDiverter) diverterComboBox.Items.Add(cmpnt.Cfg.Name); if (cmpnt is IDiverter) diverterComboBox.Items.Add(cmpnt.Cfg.Name);
if (cmpnt is IBalance) balanceComboBox.Items.Add(cmpnt.Cfg.Name); if (cmpnt is IScale) balanceComboBox.Items.Add(cmpnt.Cfg.Name);
if (cmpnt is ITempMeter) tempMeterDivComboBox.Items.Add(cmpnt.Cfg.Name); if (cmpnt is ITempMeter) tempMeterDivComboBox.Items.Add(cmpnt.Cfg.Name);
if (cmpnt is IValve && (cmpnt as IValve).CoupledTo == null) if (cmpnt is IValve && (cmpnt as IValve).CoupledTo == null)
{ {
@@ -207,8 +207,8 @@ namespace TBF.UiControls
lvi.SubItems.Add((path.StartValve != null) ? path.StartValve.Cfg.Name : "---"); lvi.SubItems.Add((path.StartValve != null) ? path.StartValve.Cfg.Name : "---");
lvi.SubItems.Add((path.Diverter != null) ? path.Diverter.Cfg.Name : "---"); lvi.SubItems.Add((path.Diverter != null) ? path.Diverter.Cfg.Name : "---");
lvi.SubItems.Add((path.TempDiv != null) ? path.TempDiv.Cfg.Name : "---"); lvi.SubItems.Add((path.TempDiv != null) ? path.TempDiv.Cfg.Name : "---");
lvi.SubItems.Add((path.Balance != null) ? path.Balance.Cfg.Name : "---"); lvi.SubItems.Add((path.Scale != null) ? path.Scale.Cfg.Name : "---");
lvi.SubItems.Add((path.EmptyTankValve != null) ? path.EmptyTankValve.Cfg.Name : "---"); lvi.SubItems.Add((path.DrainValve != null) ? path.DrainValve.Cfg.Name : "---");
foreach (var valve in parent.Valves) foreach (var valve in parent.Valves)
{ {
@@ -261,7 +261,7 @@ namespace TBF.UiControls
entity.StartValve = lvi.SubItems[(int)Column.StartValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.StartValve].Text; entity.StartValve = lvi.SubItems[(int)Column.StartValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.StartValve].Text;
entity.Diverter = lvi.SubItems[(int)Column.Div].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Div].Text; entity.Diverter = lvi.SubItems[(int)Column.Div].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Div].Text;
entity.TempDiv = lvi.SubItems[(int)Column.Tdiv].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Tdiv].Text; entity.TempDiv = lvi.SubItems[(int)Column.Tdiv].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Tdiv].Text;
entity.Balance = lvi.SubItems[(int)Column.Scale].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Scale].Text; entity.Scale = lvi.SubItems[(int)Column.Scale].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Scale].Text;
entity.EmptyTankValve = lvi.SubItems[(int)Column.DrainValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.DrainValve].Text; entity.EmptyTankValve = lvi.SubItems[(int)Column.DrainValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.DrainValve].Text;
string valvesOpen = string.Empty; string valvesOpen = string.Empty;