PumpFM,pumpTandem test parameter Power replaced by parameter Entities.Test.PumpPower,

all changes done except of UI changes (which can be done in more different ways)
This commit is contained in:
Milan Hanajik
2015-01-17 04:52:42 +01:00
parent a0fb8000f0
commit d3532a2796
20 changed files with 21 additions and 285 deletions
@@ -19,7 +19,6 @@ namespace TBF.BenchControl.Elde.PumpTandem
public bool State { get { return pump1.State || pump2.State; } }
public int Delay { get { return Math.Max(pump1.Delay, pump2.Delay); } }
public float Power { get { return pumpCfg.TestParams.Power; } }
public ValveCategory Category { get { return ValveCategory.Feeding; } } /// Pump category is Feeding
public GenericDevices.IValve CoupledTo { get { return null; } }
public bool InvertCouple { get { return false; } }
@@ -56,11 +55,6 @@ namespace TBF.BenchControl.Elde.PumpTandem
}
public void TurnOnDfltPower()
{
TurnOn(Power);
}
public void TurnOn(float powerArg)
{
if ((pumpFm1 != null) && (pumpFm2 != null))
@@ -105,7 +99,6 @@ namespace TBF.BenchControl.Elde.PumpTandem
public enum CurrentOp
{
None,
TurnOnDfltPower,
TurnOn,
TurnOff,
}
@@ -114,16 +107,6 @@ namespace TBF.BenchControl.Elde.PumpTandem
float powerForOp;
/// <summary>
/// Turn the pump frequency inverter on.
/// </summary>
public IOperation TurnOnDfltPowerOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.TurnOnDfltPower;
return this;
}
/// <summary>
/// Turn the pump frequency inverter on.
/// </summary>
@@ -150,9 +133,6 @@ namespace TBF.BenchControl.Elde.PumpTandem
{
switch (currentOp)
{
case CurrentOp.TurnOnDfltPower:
TurnOnDfltPower();
return;
case CurrentOp.TurnOn:
TurnOn(powerForOp);
return;
@@ -16,16 +16,6 @@ namespace TBF.BenchControl.Elde.PumpTandem
public string Pump1; /// Name of the pump 1 component
public string Pump2; /// Name of the pump 2 component
/// <summary> Test parameters </summary>
public PumpTestParams TestParams;
public override IParamsProvider GetTestParams() { return TestParams; }
public override IParamsProvider CreateTestParams(Entities.Test test)
{
PumpTestParams testParams = new PumpTestParams();
testParams.UpdateTestParams(Name, test);
return testParams;
}
/// Private parameterless constructor invoked by all other (public) constructors
PumpCfg()
{
@@ -33,7 +23,6 @@ namespace TBF.BenchControl.Elde.PumpTandem
ParentName = string.Empty;
Pump1 = string.Empty;
Pump2 = string.Empty;
TestParams = new PumpTestParams();
}
public PumpCfg(IComponentFactory factory)
@@ -1,95 +0,0 @@
using System;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.Elde.PumpTandem
{
public class PumpTestParams : TestParamsBase, IParamsProvider, ITestParams
{
public float Power; /// Target=terminal flow durning detection when increasing or decreasing the flow
public override void InitializeAll()
{
Power = 50.0f;
}
string[] paramNames = new string[]
{
Strings.PowerPct,
};
public override string ParamName(int i) { return paramNames[i]; }
public override int ParamsCount() { return paramNames.Length; }
public override string ToString(int i)
{
switch (i)
{
case 0: return Power.ToString("F1");
default: return string.Empty;
}
}
public void UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: Power = Utils.ParseUFloat(strValue); return;
default: return;
}
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
float dummy;
switch (i)
{
case 0:
if (Utils.TryParseUFloat(strValue, out dummy)) return true;
break;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
public override void UpdateTestParams(Entities.ComponentTest dbEntity)
{
if (dbEntity == null) return;
try
{
PumpTestParams tmp = (PumpTestParams)(new XmlSerializer(typeof(PumpTestParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
Power = tmp.Power;
}
catch
{
}
}
/// Parameterless constructor
public PumpTestParams()
{
}
public PumpTestParams(Entities.ComponentTest testParamsEntity, string componentName, Entities.Test test)
{
this.testParamsEntity = testParamsEntity;
this.componentName = componentName;
this.test = test;
}
}
}
@@ -1,95 +0,0 @@
using System;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.Elde.PumpWithFM
{
public class FMPumpTestParams : TestParamsBase, IParamsProvider, ITestParams
{
public float Power; /// Target=terminal flow durning detection when increasing or decreasing the flow
public override void InitializeAll()
{
Power = 50.0f;
}
string[] paramNames = new string[]
{
Strings.PowerPct,
};
public override string ParamName(int i) { return paramNames[i]; }
public override int ParamsCount() { return paramNames.Length; }
public override string ToString(int i)
{
switch (i)
{
case 0: return Power.ToString("F1");
default: return string.Empty;
}
}
public void UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: Power = Utils.ParseUFloat(strValue); return;
default: return;
}
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
float dummy;
switch (i)
{
case 0:
if (Utils.TryParseUFloat(strValue, out dummy)) return true;
break;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
public override void UpdateTestParams(Entities.ComponentTest dbEntity)
{
if (dbEntity == null) return;
try
{
FMPumpTestParams tmp = (FMPumpTestParams)(new XmlSerializer(typeof(FMPumpTestParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
Power = tmp.Power;
}
catch
{
}
}
/// Parameterless constructor
public FMPumpTestParams()
{
}
public FMPumpTestParams(Entities.ComponentTest testParamsEntity, string componentName, Entities.Test test)
{
this.testParamsEntity = testParamsEntity;
this.componentName = componentName;
this.test = test;
}
}
}
@@ -13,7 +13,6 @@ namespace TBF.BenchControl.Elde.PumpWithFM
public int Delay { get { return pumpCfg.Delay; } }
public ValveCategory Category { get { return ValveCategory.Feeding; } } /// Pump category is Feeding
public float Power { get { return pumpCfg.TestParams.Power; } }
public GenericDevices.IValve CoupledTo { get { return null; } }
public bool InvertCouple { get { return false; } }
public int LagOpening { get { return 0; } }
@@ -46,12 +45,6 @@ namespace TBF.BenchControl.Elde.PumpWithFM
}
public void TurnOnDfltPower()
{
log.DebugFormat("{0}.TurnOnDfltPower(), Power={1}", Name, Power);
controlBoard.SetFMFreq(FMIndex, Power);
}
public void TurnOn(float powerArg)
{
log.DebugFormat("{0}.TurnOn({1})", Name, powerArg);
@@ -71,7 +64,6 @@ namespace TBF.BenchControl.Elde.PumpWithFM
public enum CurrentOp
{
None,
TurnOnDfltPower,
TurnOn,
TurnOff,
}
@@ -80,16 +72,6 @@ namespace TBF.BenchControl.Elde.PumpWithFM
float powerForOp;
/// <summary>
/// Turn the pump frequency inverter on.
/// </summary>
public IOperation TurnOnDfltPowerOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.TurnOnDfltPower;
return this;
}
/// <summary>
/// Turn the pump frequency inverter on.
/// </summary>
@@ -116,9 +98,6 @@ namespace TBF.BenchControl.Elde.PumpWithFM
{
switch (currentOp)
{
case CurrentOp.TurnOnDfltPower:
TurnOnDfltPower();
return;
case CurrentOp.TurnOn:
TurnOn(powerForOp);
return;
@@ -17,17 +17,6 @@ namespace TBF.BenchControl.Elde.PumpWithFM
public int FMIndex;
public int Delay;
/// <summary> Test parameters </summary>
[XmlIgnore]
public FMPumpTestParams TestParams;
public override IParamsProvider GetTestParams() { return TestParams; }
public override IParamsProvider CreateTestParams(Entities.Test test)
{
FMPumpTestParams testParams = new FMPumpTestParams();
testParams.UpdateTestParams(Name, test);
return testParams;
}
/// Private parameterless constructor invoked by all other (public) constructors
PumpCfg()
{
@@ -36,7 +25,6 @@ namespace TBF.BenchControl.Elde.PumpWithFM
BitPosition = 0;
FMIndex = 0;
Delay = 1;
TestParams = new FMPumpTestParams();
}
public PumpCfg(IComponentFactory factory)
@@ -8,11 +8,6 @@ namespace TBF.BenchControl.GenericDevices
/// </summary>
public interface IPumpFM : IPump
{
/// <summary>
/// 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>
@@ -24,11 +19,6 @@ namespace TBF.BenchControl.GenericDevices
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>
@@ -458,10 +458,6 @@ namespace TBF.BenchControl.Sequences
{
PumpsWithFM[i].TurnOff();
}
else if (pwr == -2)
{
PumpsWithFM[i].TurnOnDfltPower();
}
}
/// Get new regulation valve positions,
@@ -43,7 +43,7 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
foreach (var pump in PumpsWithFM) pump.TurnOnDfltPower();
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create("RoiDetection : Starting the pump")
.AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
@@ -105,8 +105,8 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
foreach (var pump in PumpsWithFM) pump.TurnOnDfltPower();
State.Create("CombinedMeters : Starting the pump")
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create("CombinedMeters : Starting the pump")
.AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState();
@@ -119,7 +119,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
State.Create("CombinedWithDetection : Start the pump")
.AddOperation(checkUiOp)
.AddOperations(measureOperations)
.AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnDfltPowerOp() : null)
.AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnOp(test.PumpPower) : null)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState();
do
@@ -103,8 +103,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
foreach (var pump in PumpsWithFM) pump.TurnOnDfltPower();
State.Create("FixedStartMassCollection : Starting the pump")
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create("FixedStartMassCollection : Starting the pump")
.AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState();
@@ -100,8 +100,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
foreach (var pump in PumpsWithFM) pump.TurnOnDfltPower();
State.Create("FlyingStart : Starting the pump")
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create("FlyingStart : Starting the pump")
.AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState();
@@ -100,8 +100,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
foreach (var pump in PumpsWithFM) pump.TurnOnDfltPower();
State.Create("FlyingStartCollectionMethod : Starting the pump")
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create("FlyingStartCollectionMethod : Starting the pump")
.AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState();
@@ -100,8 +100,8 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------
foreach (var pump in PumpsWithFM) pump.TurnOnDfltPower();
State.Create("ReferenceFlowmeterCalibration : Starting the pump")
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create("ReferenceFlowmeterCalibration : Starting the pump")
.AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState();
+2
View File
@@ -20,6 +20,7 @@ namespace TBF.Entities
public virtual int Repeats { get; set; }
public virtual bool Emptying { 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 int Time2MassMsrmt { get; set; } /// Delay time from the test end (diverted) to the 2nd mass measuremen in [s]
public virtual string Method { get; set; }
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0)
@@ -65,6 +66,7 @@ namespace TBF.Entities
result.Repeats = Repeats;
result.Emptying = Emptying;
result.Zeroing = Zeroing;
result.PumpPower = PumpPower;
result.Time2MassMsrmt = Time2MassMsrmt;
result.Method = Method;
result.ErrLimLo = ErrLimLo;
+4 -2
View File
@@ -26,7 +26,8 @@ namespace TBF.Entities
public virtual int Repeats { get; set; }
public virtual bool Emptying { get; set; }
public virtual bool Zeroing { get; set; }
public virtual int Time2MassMsrmt { 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 int Time2MassMsrmt { get; set; }
public virtual string Method { get; set; }
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0)
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0)
@@ -139,7 +140,8 @@ namespace TBF.Entities
Repeats = test.Repeats;
Emptying = test.Emptying;
Zeroing = test.Zeroing;
Time2MassMsrmt = test.Time2MassMsrmt;
PumpPower = PumpPower;
Time2MassMsrmt = test.Time2MassMsrmt;
Method = test.Method;
ErrLimLo = test.ErrLimLo;
ErrLimHi = test.ErrLimHi;
+1
View File
@@ -18,6 +18,7 @@ namespace TBF.Mappings
Map(x => x.Repeats);
Map(x => x.Emptying);
Map(x => x.Zeroing);
Map(x => x.PumpPower);
Map(x => x.Time2MassMsrmt);
Map(x => x.Method);
Map(x => x.ErrLimLo);
+2 -1
View File
@@ -27,7 +27,8 @@ namespace TBF.Mappings
Map(x => x.Repeats);
Map(x => x.Emptying);
Map(x => x.Zeroing);
Map(x => x.Time2MassMsrmt);
Map(x => x.PumpPower);
Map(x => x.Time2MassMsrmt);
Map(x => x.Method);
Map(x => x.ErrLimLo);
Map(x => x.ErrLimHi);
-2
View File
@@ -248,7 +248,6 @@
</Compile>
<Compile Include="BenchControl\Elde\FlowMeterTwins\FlowMeterFactory.cs" />
<Compile Include="BenchControl\Elde\FlowMeterTwins\ReadFlowOp.cs" />
<Compile Include="BenchControl\Elde\PumpTandem\PumpTestParams.cs" />
<Compile Include="BenchControl\Elde\PumpTandem\Pump.cs" />
<Compile Include="BenchControl\Elde\PumpTandem\PumpCfg.cs" />
<Compile Include="BenchControl\Elde\PumpTandem\PumpCfgCtrl.cs">
@@ -258,7 +257,6 @@
<DependentUpon>PumpCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Elde\PumpTandem\PumpFactory.cs" />
<Compile Include="BenchControl\Elde\PumpWithFM\FMPumpTestParams.cs" />
<Compile Include="BenchControl\Elde\PumpWithFM\Pump.cs" />
<Compile Include="BenchControl\Elde\PumpWithFM\PumpCfg.cs" />
<Compile Include="BenchControl\Elde\PumpWithFM\PumpCfgCtrl.cs">