PmpWithFM and Transition sequences functionality implemented

This commit is contained in:
Milan Hanajik
2014-09-08 13:16:31 +02:00
parent d98762aaf8
commit 6eee83042b
17 changed files with 171 additions and 59 deletions
@@ -124,13 +124,20 @@ namespace TBF.BenchControl.Elde
public void SetFMFreq(int index, float power) public void SetFMFreq(int index, float power)
{ {
#if FUZHOU300 #if FUZHOU300
if (index == 0) FMFreq = new float[6] { power, 0, 0, 0, 0, 0 }; if ((FMFreq == null) || (FMFreq.Length != 6))
else if (index == 1) FMFreq = new float[6] { 0, power, 0, 0, 0, 0 }; {
else if (index == 2) FMFreq = new float[6] { 0, 0, power, 0, 0, 0 }; if (index == 0) FMFreq = new float[6] { power, 0, 0, 0, 0, 0 };
else if (index == 3) FMFreq = new float[6] { 0, 0, 0, power, 0, 0 }; else if (index == 1) FMFreq = new float[6] { 0, power, 0, 0, 0, 0 };
else if (index == 4) FMFreq = new float[6] { 0, 0, 0, 0, power, 0 }; else if (index == 2) FMFreq = new float[6] { 0, 0, power, 0, 0, 0 };
else if (index == 5) FMFreq = new float[6] { 0, 0, 0, 0, 0, power }; else if (index == 3) FMFreq = new float[6] { 0, 0, 0, power, 0, 0 };
else FMFreq = new float[6] { 0, 0, 0, 0, 0, 0 }; else if (index == 4) FMFreq = new float[6] { 0, 0, 0, 0, power, 0 };
else if (index == 5) FMFreq = new float[6] { 0, 0, 0, 0, 0, power };
else FMFreq = new float[6] { 0, 0, 0, 0, 0, 0 };
}
else if(index >= 0 && index < 6)
{
FMFreq[index] = power;
}
#else #else
if (index == 0) FMFreq = new float[2] { power, 0 }; if (index == 0) FMFreq = new float[2] { power, 0 };
else if (index == 1) FMFreq = new float[2] { 0, power }; else if (index == 1) FMFreq = new float[2] { 0, power };
@@ -4,7 +4,7 @@ using log4net;
namespace TBF.BenchControl.Elde.PumpWithFM namespace TBF.BenchControl.Elde.PumpWithFM
{ {
public class Pump : Generic.IComponent, GenericDevices.IPumpFM, GenericDevices.IValve, IOperation public class Pump : ComponentBase, GenericDevices.IPumpFM, GenericDevices.IValve, IOperation
{ {
/// <summary> /// <summary>
/// Info: StartMassMeasurement() and "Balance response = .., Mass = ..." /// Info: StartMassMeasurement() and "Balance response = .., Mass = ..."
@@ -18,15 +18,12 @@ namespace TBF.BenchControl.Elde.PumpWithFM
public static void ResetStaticProperties() { } public static void ResetStaticProperties() { }
private readonly PumpCfg pumpCfg; public int Delay { get { return (Cfg as PumpCfg).Delay; } }
public Generic.IComponentCfg Cfg { get { return pumpCfg; } }
public string Name { get { return pumpCfg.Name; } }
public int Delay { get { return pumpCfg.Delay; } }
public ValveCategory Category { get { return ValveCategory.Feeding; } } /// Pump category is Feeding public ValveCategory Category { get { return ValveCategory.Feeding; } } /// Pump category is Feeding
public float Power { get { return (TestParams is FMPumpTestParams) ? (TestParams as FMPumpTestParams).Power : 0; } }
public GenericDevices.IValve CoupledTo { get { return null; } } public GenericDevices.IValve CoupledTo { get { return null; } }
public bool InvertCouple { get { return false; } } public bool InvertCouple { get { return false; } }
public int LagOpening { get { return 0; } } public int LagOpening { get { return 0; } }
@@ -34,7 +31,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
readonly ControlBoardDev controlBoard; readonly ControlBoardDev controlBoard;
readonly int bitPosition; /// 0 .. 63 readonly int bitPosition; /// 0 .. 63
int FMIndex; /// 0 .. FMPumpsCount-1 int FMIndex; /// 0 .. FMPumpsCount-1
public readonly ulong Mask; /// derived from bitPosition in the constructor public readonly ulong Mask; /// derived from bitPosition in the constructor
@@ -43,11 +40,12 @@ namespace TBF.BenchControl.Elde.PumpWithFM
get { return (controlBoard.Route & Mask) != 0; } get { return (controlBoard.Route & Mask) != 0; }
} }
public float powerForOp;
public Pump(PumpCfg cfg, IList<Generic.IComponent> components) public Pump(PumpCfg cfg, IList<Generic.IComponent> components)
: base(cfg)
{ {
if (cfg == null) throw new ArgumentNullException("cfg"); if (cfg == null) throw new ArgumentNullException("cfg");
this.pumpCfg = cfg;
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components); controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent"); if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
@@ -59,12 +57,30 @@ namespace TBF.BenchControl.Elde.PumpWithFM
log.Debug(this.ToString()); log.Debug(this.ToString());
} }
public void TurnOnDfltPower()
{
controlBoard.SetFMFreq(FMIndex, Power);
}
public void TurnOn(float powerArg)
{
controlBoard.SetFMFreq(FMIndex, powerArg);
}
public void TurnOff()
{
controlBoard.SetFMFreq(FMIndex, 0.0f);
}
/// <summary> /// <summary>
/// The currently running operation. /// The currently running operation.
/// </summary> /// </summary>
public enum CurrentOp public enum CurrentOp
{ {
None, None,
TurnOnDfltPower,
TurnOn, TurnOn,
TurnOff, TurnOff,
} }
@@ -74,17 +90,28 @@ namespace TBF.BenchControl.Elde.PumpWithFM
/// <summary> /// <summary>
/// Turn the pump frequency inverter on. /// Turn the pump frequency inverter on.
/// </summary> /// </summary>
public IOperation TurnOn() public IOperation TurnOnDfltPowerOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.TurnOn; currentOp = CurrentOp.TurnOnDfltPower;
return this; return this;
} }
/// <summary>
/// Turn the pump frequency inverter on.
/// </summary>
public IOperation TurnOnOp(float powerArg)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.TurnOn;
powerForOp = powerArg;
return this;
}
/// <summary> /// <summary>
/// Turn the pump frequency inverter on. /// Turn the pump frequency inverter on.
/// </summary> /// </summary>
public IOperation TurnOff() public IOperation TurnOffOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.TurnOff; currentOp = CurrentOp.TurnOff;
@@ -96,12 +123,15 @@ namespace TBF.BenchControl.Elde.PumpWithFM
{ {
switch (currentOp) switch (currentOp)
{ {
case CurrentOp.TurnOn: case CurrentOp.TurnOnDfltPower:
controlBoard.SetFMFreq(FMIndex, 50.0f); TurnOnDfltPower();
return;
case CurrentOp.TurnOn:
TurnOn(powerForOp);
return; return;
case CurrentOp.TurnOff: case CurrentOp.TurnOff:
default: default:
controlBoard.SetFMFreq(FMIndex, 0.0f); TurnOff();
return; return;
} }
} }
@@ -19,8 +19,6 @@ namespace TBF.BenchControl.Elde.RegisterReader
public static void ResetStaticProperties() { } public static void ResetStaticProperties() { }
RegisterReaderCfg registerReaderCfg;
public float PulsesPerLtr public float PulsesPerLtr
{ {
get get
@@ -37,7 +35,6 @@ namespace TBF.BenchControl.Elde.RegisterReader
: base(cfg) : base(cfg)
{ {
if (cfg == null) throw new ArgumentNullException("cfg"); if (cfg == null) throw new ArgumentNullException("cfg");
this.registerReaderCfg = cfg;
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components); ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent"); if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
@@ -8,14 +8,35 @@ namespace TBF.BenchControl.GenericDevices
/// </summary> /// </summary>
public interface IPumpFM : IPump public interface IPumpFM : IPump
{ {
/// <summary> /// <summary>
/// Turns the frequency inverter on using the test parameter 'Power' (0 .. 100.0f %) /// Turns the frequency inverter on using the test parameter 'Power' (0 .. 100.0f %)
/// </summary>
void TurnOnDfltPower();
/// <summary>
/// Turns the frequency inverter on using 'power' argument (0 .. 100.0f %)
/// </summary>
void TurnOn(float power);
/// <summary>
/// Turns the frequency inverter off
/// </summary>
void TurnOff();
/// <summary>
/// Turns the frequency inverter on using the test parameter 'Power' (0 .. 100.0f %)
/// </summary>
IOperation TurnOnDfltPowerOp();
/// <summary>
/// Turns the frequency inverter on using 'power' argument (0 .. 100.0f %)
/// </summary> /// </summary>
IOperation TurnOn(); IOperation TurnOnOp(float power);
/// <summary> /// <summary>
/// Turns the frequency inverter off /// Turns the frequency inverter off
/// </summary> /// </summary>
IOperation TurnOff(); IOperation TurnOffOp();
} }
} }
@@ -205,6 +205,8 @@ namespace TBF.BenchControl.Sequences
ISequence testMethodSequence = TbfComponents.FindComponent(test.Method) as ISequence; ISequence testMethodSequence = TbfComponents.FindComponent(test.Method) as ISequence;
if (testMethodSequence != null) if (testMethodSequence != null)
{ {
StateMachine.LoadTestParams(test);
//-------------------------------------------------------------- //--------------------------------------------------------------
e = testMethodSequence.Execute(test); e = testMethodSequence.Execute(test);
@@ -236,6 +238,8 @@ namespace TBF.BenchControl.Sequences
ISequence testMethodSequence = TbfComponents.FindComponent(test.Method) as ISequence; ISequence testMethodSequence = TbfComponents.FindComponent(test.Method) as ISequence;
if (testMethodSequence != null) if (testMethodSequence != null)
{ {
StateMachine.LoadTestParams(test);
//-------------------------------------------------------------- //--------------------------------------------------------------
e = testMethodSequence.Execute(test); e = testMethodSequence.Execute(test);
@@ -24,6 +24,7 @@ namespace TBF.BenchControl.Sequences
public static BenchId.Component BenchId; public static BenchId.Component BenchId;
public static IList<IFlowMeter> FlowMeters; /// list of reference flowmeters public static IList<IFlowMeter> FlowMeters; /// list of reference flowmeters
public static IList<IRegulValve> RegulValves; /// list of regulation valves public static IList<IRegulValve> RegulValves; /// list of regulation valves
public static IList<IPumpFM> PumpsWithFM; /// list of FM controlled pumps
public static IList<IWaterMeter> WaterMeters; /// list of water meters public static IList<IWaterMeter> WaterMeters; /// list of water meters
public static IList<ICamera> Cameras; /// list of cameras public static IList<ICamera> Cameras; /// list of cameras
@@ -394,8 +395,27 @@ namespace TBF.BenchControl.Sequences
Bridge.OnActivity(this, string.Format(message, transitionSequence.Name, step.ItemNr + 1, stepsCount)); Bridge.OnActivity(this, string.Format(message, transitionSequence.Name, step.ItemNr + 1, stepsCount));
//------------------------------------------------ //------------------------------------------------
/// Get new regulation valve positions and calculate the number of valves to change
float[] allFMPumpPcts = Utils.GetPumpWithFMPcts(step);
for (int i = 0; i < allFMPumpPcts.Length; i++)
{
float pwr = allFMPumpPcts[i];
if (pwr > 0) /// Negative value means no power change
{
PumpsWithFM[i].TurnOn(pwr);
}
else if (pwr == 0)
{
PumpsWithFM[i].TurnOff();
}
else if (pwr == -2)
{
PumpsWithFM[i].TurnOnDfltPower();
}
}
/// Get new regulation valve positions and calculate the number of valves to change /// Get new regulation valve positions and calculate the number of valves to change
float[] allRegvPositions = Utils.RegulValvesPositions(step); float[] allRegvPositions = Utils.GetRegulValvesPositions(step);
/// ///
IList<IOperation> rvPosOperations = new List<IOperation>(); IList<IOperation> rvPosOperations = new List<IOperation>();
for (int i = 0; i < allRegvPositions.Length; i++) for (int i = 0; i < allRegvPositions.Length; i++)
@@ -472,10 +492,10 @@ namespace TBF.BenchControl.Sequences
/// ///
/// Stop the pump at the end of test /// Stop the pump at the end of test
/// ///
StateMachine.ControlBoard.SetFMFreq(-1, 0); /// Stop FM controlled pumps foreach (var fmPump in PumpsWithFM) fmPump.TurnOff();
State.Create("SequenceBase : Test(s) completed -> Stopping the pump") State.Create("SequenceBase : Test(s) completed -> Stopping the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null) .AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, inPath.Pump)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, inPath.Pump))
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp()) .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
.EnterState(); .EnterState();
@@ -198,6 +198,7 @@ namespace TBF.BenchControl
IList<IBalance> balances = new List<IBalance>(); IList<IBalance> balances = new List<IBalance>();
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.WaterMeters = new List<IWaterMeter>(); SequenceBase.WaterMeters = new List<IWaterMeter>();
SequenceBase.Cameras = new List<ICamera>(); SequenceBase.Cameras = new List<ICamera>();
ulong valvesToInvert = 0; ulong valvesToInvert = 0;
@@ -207,7 +208,8 @@ namespace TBF.BenchControl
if (cmpnt is BenchId.Component) SequenceBase.BenchId = cmpnt as BenchId.Component; if (cmpnt is BenchId.Component) SequenceBase.BenchId = cmpnt as BenchId.Component;
if (cmpnt is IFlowMeter) SequenceBase.FlowMeters.Add(cmpnt as IFlowMeter); if (cmpnt is IFlowMeter) SequenceBase.FlowMeters.Add(cmpnt as IFlowMeter);
if (cmpnt is IRegulValve) SequenceBase.RegulValves.Add(cmpnt as IRegulValve); if (cmpnt is IRegulValve) SequenceBase.RegulValves.Add(cmpnt as IRegulValve);
if (cmpnt is IWaterMeter) SequenceBase.WaterMeters.Add(cmpnt as IWaterMeter); if (cmpnt is IPumpFM) SequenceBase.PumpsWithFM.Add(cmpnt as IPumpFM);
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 IBalance)
@@ -317,14 +319,7 @@ namespace TBF.BenchControl
{ {
foreach (var cmpnt in components) foreach (var cmpnt in components)
{ {
if (cmpnt is ComponentBase) if (cmpnt is ComponentBase) (cmpnt as ComponentBase).GetProcedureParams(procedure);
{
if (cmpnt.Cfg.Name.Equals("ROI2"))
{
int a = 5;
}
(cmpnt as ComponentBase).GetProcedureParams(procedure);
}
} }
} }
@@ -54,7 +54,7 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
//------------------------------------------------ //------------------------------------------------
State.Create("RoiDetection : Starting the pump") State.Create("RoiDetection : Starting the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOn() : null) .AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnDfltPowerOp() : null)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null)) .AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState(); .EnterState();
do do
@@ -112,7 +112,7 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
//------------------------------------------------ //------------------------------------------------
State.Create("RoiDetection : Stopping the pump") State.Create("RoiDetection : Stopping the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump)) .AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
.EnterState(); .EnterState();
do do
@@ -143,7 +143,7 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
State.Create("RoiDetection : Detection of ROI-s completed -> Stopping the pump") State.Create("RoiDetection : Detection of ROI-s completed -> Stopping the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump)) .AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.EnterState(); .EnterState();
do { do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
@@ -168,7 +168,7 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
cBrd.SetFMFreq(0, 0); /// Stop FM controlled pumps cBrd.SetFMFreq(0, 0); /// Stop FM controlled pumps
State.Create("RoiDetection : User selected STOP -> Closing the valves") State.Create("RoiDetection : User selected STOP -> Closing the valves")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose)) .AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState(); .EnterState();
do do
@@ -187,7 +187,7 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
cBrd.SetFMFreq(0, 0); /// Stop FM controlled pumps cBrd.SetFMFreq(0, 0); /// Stop FM controlled pumps
State.Create("RoiDetection : ERROR -> Closing the valves") State.Create("RoiDetection : ERROR -> Closing the valves")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose)) .AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState(); .EnterState();
do do
@@ -104,7 +104,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
//------------------------------------------------ //------------------------------------------------
State.Create("CombinedMeters : Starting the pump") State.Create("CombinedMeters : Starting the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOn() : null) .AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnDfltPowerOp() : null)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null)) .AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState(); .EnterState();
do do
@@ -117,7 +117,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
State.Create("CombinedWithDetection : Start the pump") State.Create("CombinedWithDetection : Start the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(measureOperations)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOn() : null) .AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnDfltPowerOp() : null)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null)) .AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState(); .EnterState();
do do
@@ -480,7 +480,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//------------------------------------------------ //------------------------------------------------
State.Create(Strings.Stop_the_pump) State.Create(Strings.Stop_the_pump)
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump)) .AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
.AddOperation(cBrd.UpdateTankWeightOp()) .AddOperation(cBrd.UpdateTankWeightOp())
.EnterState(); .EnterState();
@@ -615,7 +615,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
State.Create("CombinedWithDetection : Test(s) completed -> Stopping the pump") State.Create("CombinedWithDetection : Test(s) completed -> Stopping the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump)) .AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.EnterState(); .EnterState();
do { do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
@@ -640,7 +640,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
State.Create("CombinedWithDetection : User selected STOP -> Closing the valves") State.Create("CombinedWithDetection : User selected STOP -> Closing the valves")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose)) .AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState(); .EnterState();
do do
@@ -658,7 +658,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
error: error:
State.Create("close_before_error") State.Create("close_before_error")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose)) .AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState(); .EnterState();
do do
@@ -104,7 +104,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//------------------------------------------------ //------------------------------------------------
State.Create("FlyingStartCollectionMethod : Starting the pump") State.Create("FlyingStartCollectionMethod : Starting the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOn() : null) .AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnDfltPowerOp() : null)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null)) .AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState(); .EnterState();
do do
@@ -104,7 +104,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
//------------------------------------------------ //------------------------------------------------
State.Create("FlyingStart : Starting the pump") State.Create("FlyingStart : Starting the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOn() : null) .AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnDfltPowerOp() : null)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null)) .AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState(); .EnterState();
do do
@@ -104,7 +104,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
//------------------------------------------------ //------------------------------------------------
State.Create("FlyingStartCollectionMethod : Starting the pump") State.Create("FlyingStartCollectionMethod : Starting the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOn() : null) .AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnDfltPowerOp() : null)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null)) .AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState(); .EnterState();
do do
@@ -104,7 +104,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
//------------------------------------------------ //------------------------------------------------
State.Create("ReferenceFlowmeterCalibration : Starting the pump") State.Create("ReferenceFlowmeterCalibration : Starting the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOn() : null) .AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnDfltPowerOp() : null)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null)) .AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState(); .EnterState();
do do
@@ -219,7 +219,13 @@ namespace TBF.UiControls
{ {
fmPumpsPcts += lviSubitText; fmPumpsPcts += lviSubitText;
} }
else if(Utils.TryParseUFloat(lviSubitText, out fdummy) && (fdummy >= 0) && (fdummy <= 100.0f)) else if (lviSubitText.Equals("Dflt"))
{
fmPumpsPcts += lviSubitText;
if (valvesOpen != string.Empty) valvesOpen += ";";
valvesOpen += valve.Cfg.Name;
}
else if (Utils.TryParseUFloat(lviSubitText, out fdummy) && (fdummy >= 0) && (fdummy <= 100.0f))
{ {
fmPumpsPcts += lviSubitText; fmPumpsPcts += lviSubitText;
if (fdummy > 0) if (fdummy > 0)
+34 -2
View File
@@ -110,7 +110,7 @@ namespace TBF
/// </summary> /// </summary>
/// <param name="entity">TransitionStep entity</param> /// <param name="entity">TransitionStep entity</param>
/// <returns>float[] of regulation valve positions from 0 to 100.0f</returns> /// <returns>float[] of regulation valve positions from 0 to 100.0f</returns>
public static float[] RegulValvesPositions(Entities.TransitionStep step) public static float[] GetRegulValvesPositions(Entities.TransitionStep step)
{ {
int regvCount = BenchControl.Sequences.SequenceBase.RegulValves.Count; int regvCount = BenchControl.Sequences.SequenceBase.RegulValves.Count;
float[] result = new float[regvCount]; float[] result = new float[regvCount];
@@ -132,5 +132,37 @@ namespace TBF
return result; return result;
} }
}
/// <summary>
/// Get an array of Pump-With-FM power percentages from a TransitionStep entity
/// </summary>
/// <param name="entity">TransitionStep entity</param>
/// <returns>float[] of FM-pump power percentages from 0 to 100.0f</returns>
public static float[] GetPumpWithFMPcts(Entities.TransitionStep step)
{
int fmPumpCount = BenchControl.Sequences.SequenceBase.PumpsWithFM.Count;
float[] result = new float[fmPumpCount];
string[] rvPosStr = (step.PumpWithFMPcts != null) ? step.PumpWithFMPcts.Split(new char[] { ';' }) : new string[0];
for (int i = 0; i < fmPumpCount; i++)
{
float fdummy;
if ((i < rvPosStr.Length) && Utils.TryParseUFloat(rvPosStr[i], out fdummy) &&
(fdummy >= 0) && (fdummy <= 100.0f))
{
result[i] = fdummy;
}
else if (rvPosStr[i].Equals("Dflt"))
{
result[i] = -2.0f; /// This value means default pump power defined by the Test parameter
}
else //if (rvPosStr[i].Equals("---"))
{
result[i] = -1.0f; /// This value means no pump power change
}
}
return result;
}
}
} }