ReadMassOp removed, ProcessData.Mass removed, TestMethods.FixedStartMassCollection, ver. 3.1.1620
This commit is contained in:
@@ -537,7 +537,7 @@ namespace TBF.Rig.ControlBoard.Papouch
|
||||
{
|
||||
if (opCompleted) return Event.TestCompleted;
|
||||
|
||||
double currentMass = TBF.Rig.Sequences.ProcessData.Mass.Val;
|
||||
double currentMass = (Devices.Scale is IScale) ? (Devices.Scale as IScale).Mass : 0;
|
||||
|
||||
if (currentMass - TBF.Rig.Sequences.ProcessData.StartMass.Val >= currentTest.Volume)
|
||||
{
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
log.InfoFormat("Op.Start() RV#={0} Et#={1} Qfrom={2} Qto={3}", regV.Idx1, flowMeter.Idx1, qFrom, qTo);
|
||||
|
||||
/// Start the test (and the flow measurement)
|
||||
uniCB.StartTest(false, flowMeter.Idx1, 0, 0, false, false, true, false, pulsesCount, 0);
|
||||
uniCB.StartTest(false, flowMeter.Idx1, 0, 0, false, false, true, false, pulsesCount);
|
||||
|
||||
opState = OpState.StartingTest;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
|
||||
case OpState.TestInProgress:
|
||||
|
||||
if ((uniCB.State & (ulong)StatusP.TestCompleted) == 0)
|
||||
if ((uniCB.State & (ulong)StatusP.TestCompleted) == 0 && uniCB.RefPulses < pulsesCount)
|
||||
{
|
||||
return Event.TestInProgress; /// Test was not completed yet
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace TBF.Rig.Dummy.Balance
|
||||
public float BuoyancyPress { get { return 1.013f; } }
|
||||
public float BuoyancyHumi { get { return 50.0f; } }
|
||||
|
||||
public double Mass { get { return 0; } }
|
||||
|
||||
|
||||
public Component() { }
|
||||
|
||||
|
||||
@@ -14,19 +14,14 @@ namespace TBF.Rig.GenericDevices
|
||||
float BuoyancyPress { get; } /// Displayed in Metrology tab page
|
||||
float BuoyancyHumi { get; } ///
|
||||
|
||||
double Mass { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <returns>ZeroOp instance reference casted to IOperaton</returns>
|
||||
IOperation ZeroOp();
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="result">Reference to a variable for the measured mass in kg</param>
|
||||
/// <returns>ReadMassOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadMassOp(ref DoubleBox mass);
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Timeout, Error
|
||||
/// </summary>
|
||||
|
||||
@@ -816,7 +816,6 @@ namespace TBF.Rig.Sequences
|
||||
/// Update format for the water mass
|
||||
if (outPath != null && outPath.Scale != null && !string.IsNullOrEmpty(outPath.Scale.Format))
|
||||
{
|
||||
Mass.Format = outPath.Scale.Format;
|
||||
StartMass.Format = outPath.Scale.Format;
|
||||
EndMass.Format = outPath.Scale.Format;
|
||||
}
|
||||
@@ -1033,7 +1032,6 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
|
||||
/// Update format for the water mass
|
||||
Mass.Format = "F3";
|
||||
StartMass.Format = "F3";
|
||||
EndMass.Format = "F3";
|
||||
|
||||
|
||||
@@ -300,11 +300,6 @@ namespace TBF.Rig.Sequences
|
||||
bool draining2 = false;
|
||||
bool draining3 = false;
|
||||
|
||||
/// Measured masses to control emptying
|
||||
DoubleBox mass1 = new DoubleBox();
|
||||
DoubleBox mass2 = new DoubleBox();
|
||||
DoubleBox mass3 = new DoubleBox();
|
||||
|
||||
IList<Event> e;
|
||||
|
||||
while (true)
|
||||
@@ -336,14 +331,10 @@ namespace TBF.Rig.Sequences
|
||||
((StateMachine.DrainValve2 == null) ? 0 : (draining2 ? ButtonsEtc.DrainTankBtn2Hi : ButtonsEtc.DrainTankBtn2En)) |
|
||||
((StateMachine.DrainValve3 == null) ? 0 : (draining3 ? ButtonsEtc.DrainTankBtn3Hi : ButtonsEtc.DrainTankBtn3En)));
|
||||
|
||||
|
||||
State.Create("MainSeq : Select an activity")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.BenchWaitingOp)
|
||||
.AddOperation((StateMachine.Tank1 is IScale) ? (StateMachine.Tank1 as IScale).ReadMassOp(ref mass1) : null)
|
||||
.AddOperation((StateMachine.Tank2 is IScale) ? (StateMachine.Tank2 as IScale).ReadMassOp(ref mass2) : null)
|
||||
.AddOperation((StateMachine.Tank3 is IScale) ? (StateMachine.Tank3 as IScale).ReadMassOp(ref mass3) : null)
|
||||
.EnterState();
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.BenchWaitingOp)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -379,7 +370,6 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
while (true);
|
||||
|
||||
|
||||
if (e.Contains(Event.Error))
|
||||
{
|
||||
///------------------------------------
|
||||
@@ -505,21 +495,15 @@ namespace TBF.Rig.Sequences
|
||||
int remTime = drainingStartTime + maxDrainTime - StateMachine.Time;
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Emptying_tank, remTime / 60, "min", remTime % 60, Strings.sec));
|
||||
|
||||
DoubleBox mass1 = new DoubleBox();
|
||||
DoubleBox mass2 = new DoubleBox();
|
||||
DoubleBox mass3 = new DoubleBox();
|
||||
///
|
||||
State.Create("MainSeq : Reading mass")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((StateMachine.Tank1 is IScale) ? (StateMachine.Tank1 as IScale).ReadMassOp(ref mass1) : null)
|
||||
.AddOperation((StateMachine.Tank2 is IScale) ? (StateMachine.Tank2 as IScale).ReadMassOp(ref mass2) : null)
|
||||
.AddOperation((StateMachine.Tank3 is IScale) ? (StateMachine.Tank3 as IScale).ReadMassOp(ref mass3) : null)
|
||||
.EnterState();
|
||||
while (StateMachine.WaitRunDevsRunOps().Contains(Event.Busy)) { }
|
||||
State.Create("MainSeq : Draining tanks")
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
|
||||
if (draining1 && StateMachine.Tank1 != null && StateMachine.Tank1.IsEmpty()) draining1 = false;
|
||||
if (draining2 && StateMachine.Tank2 != null && StateMachine.Tank2.IsEmpty()) draining2 = false;
|
||||
if (draining3 && StateMachine.Tank3 != null && StateMachine.Tank3.IsEmpty()) draining3 = false;
|
||||
StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
if (draining1 && StateMachine.Tank1.IsEmpty()) draining1 = false;
|
||||
if (draining2 && StateMachine.Tank2.IsEmpty()) draining2 = false;
|
||||
if (draining3 && StateMachine.Tank3.IsEmpty()) draining3 = false;
|
||||
}
|
||||
|
||||
/// Close all drain valves
|
||||
|
||||
@@ -5,6 +5,7 @@ using log4net;
|
||||
using SchematicDrawing;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.Sequences
|
||||
{
|
||||
@@ -21,6 +22,15 @@ namespace TBF.Rig.Sequences
|
||||
public static IStatisticsMonitoring StatisticsMonitoringComp;
|
||||
public static Output.DB.SensusOracle.Database OracleDB;
|
||||
|
||||
///------------------------------------------------------------
|
||||
/// Test related (instance) variables.
|
||||
/// Created when test sequence is open.
|
||||
/// They persist during all repetitions of the same test
|
||||
///------------------------------------------------------------
|
||||
protected static Rig.BenchPath benchPath;
|
||||
protected static Rig.OutputPath outPath;
|
||||
|
||||
|
||||
public static readonly IList<IDrawingItCmpntWithMeasuredVal> ComponentsWithMeasuredVal;
|
||||
public static readonly IList<IDrawingItCmpntWithSetpoint> ComponentsWithSetpoint;
|
||||
|
||||
@@ -205,7 +215,6 @@ namespace TBF.Rig.Sequences
|
||||
public static DoubleBox RefFrequency = new DoubleBox() { Name = "RefFreq", Format = "F2" };
|
||||
public static DoubleBox RefFlow = new DoubleBox() { Name = "RefFlow", Format = "F2" }; /// [m3/h]
|
||||
|
||||
public static DoubleBox Mass = new DoubleBox() { Name = "Mass", Format = "F3" }; /// [kg]
|
||||
public static DoubleBox StartMass = new DoubleBox() { Name = "Start Mass", Format = "F3" }; /// [kg]
|
||||
public static DoubleBox EndMass = new DoubleBox() { Name = "End Mass", Format = "F3" }; /// [kg]
|
||||
|
||||
@@ -231,7 +240,6 @@ namespace TBF.Rig.Sequences
|
||||
RefPulses = 0;
|
||||
RefFrequency.Clear();
|
||||
RefFlow.Clear();
|
||||
Mass.Clear();
|
||||
StartMass.Clear();
|
||||
EndMass.Clear();
|
||||
}
|
||||
@@ -375,5 +383,115 @@ namespace TBF.Rig.Sequences
|
||||
Energy.Stop();
|
||||
VolumeForEnergy.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Process data logging
|
||||
///
|
||||
public void LogProcessDataTestInfo(ILog logger, string procedureName, string testName)
|
||||
{
|
||||
logger.Info(Environment.NewLine);
|
||||
logger.InfoFormat("{0}={1:dd.MM.yyyy HH:mm:ss} {2}={3} {4}={5} {6}={7}",
|
||||
Strings.Date_and_time, TestStartTime,
|
||||
Strings.Batch_nr, BatchRslts.Batch.BatchNr,
|
||||
Strings.Procedure, procedureName,
|
||||
Strings.Test, testName);
|
||||
}
|
||||
|
||||
public void LogProcessDataHeader(ILog logger)
|
||||
{
|
||||
LogProcessDataHeader(logger, null);
|
||||
}
|
||||
|
||||
public void LogProcessDataHeader(ILog logger, string sectionName)
|
||||
{
|
||||
logger.Info(Environment.NewLine);
|
||||
if (sectionName != null) logger.Info(sectionName);
|
||||
logger.Info("Time Flow TstTime Ref.cnt Ref.vol Tup Tdown Tdiv Pup Pdown Pdelta Mass VolMM Tamb Hamb Pamb Rv");
|
||||
logger.Info(Environment.NewLine);
|
||||
}
|
||||
|
||||
public void LogProcessData(ILog logger)
|
||||
{
|
||||
logger.InfoFormat("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14} {15} {16}",
|
||||
DateTime.Now.ToLongTimeString(),
|
||||
Utils.DoubleToStr(RefFlow.Val, 4), /// flow measured by the reference flow meter in m3/h
|
||||
StateMachine.ControlBoard.TestTime.ToString("F3"),/// test time in s
|
||||
StateMachine.ControlBoard.RefPulses, /// reference flow meter pulses count
|
||||
Config.Formulas.VolumeFromPulses(StateMachine.ControlBoard.RefPulses, 1.0f / LtrPerRefPulse).ToString("F3"), /// volume in l
|
||||
benchPath.TempMtrUp != null ? benchPath.TempMtrUp.ReadTemperature() : 0, /// temp. at the beginning of line in degree C
|
||||
benchPath.TempMtrDown != null ? benchPath.TempMtrDown.ReadTemperature() : 0, /// temp. at the end of line in degree C
|
||||
outPath.TempMtrDiv != null ? outPath.TempMtrDiv.ReadTemperature() : 0, /// temp. at the diverter in degree C
|
||||
PressUp, /// water pressure at the beginning of test line in bar (= 100 kPa)
|
||||
PressDown, /// water pressure at the end of test line in bar (= 100 kPa)
|
||||
PressDelta,
|
||||
(outPath.Scale is IScale) ? (outPath.Scale as IScale).Mass : 0, /// collected water mass in kg
|
||||
"VolMM",
|
||||
AmbTemp, /// ambient temperature in degree C
|
||||
AmbHumi, /// ambient humidity in R%
|
||||
AmbPress, /// ambient pressure in mbar (= 1 hPa)
|
||||
outPath.RegValve.Position.ToString("F1")); /// regulation valve position in % (0=closed / 100=open)
|
||||
}
|
||||
|
||||
public void LogProcessDataHeaderHeatMeters(ILog logger, string sectionName)
|
||||
{
|
||||
logger.Info(Environment.NewLine);
|
||||
if (sectionName != null) logger.Info(sectionName);
|
||||
logger.Info("Time Flow TstTime Ref.cnt Ref.vol Tup Tdown Tdiv Pup Pdown Pdelta Mass VolMM Tamb Hamb Pamb Rv Thiac1 Thiac2 Tloac1 Tloac2");
|
||||
logger.Info(Environment.NewLine);
|
||||
}
|
||||
|
||||
public void LogProcessDataHeatMeters(ILog logger)
|
||||
{
|
||||
logger.InfoFormat("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14} {15} {16} {17} {18} {19} {20}",
|
||||
DateTime.Now.ToLongTimeString(),
|
||||
Utils.DoubleToStr(RefFlow.Val, 4),
|
||||
StateMachine.ControlBoard.TestTime.ToString("F3"),
|
||||
StateMachine.ControlBoard.RefPulses,
|
||||
Config.Formulas.VolumeFromPulses(StateMachine.ControlBoard.RefPulses, 1.0f / LtrPerRefPulse).ToString("F3"),
|
||||
benchPath.TempMtrUp != null ? benchPath.TempMtrUp.ReadTemperature() : 0, /// temp. at the beginning of line in degree C
|
||||
benchPath.TempMtrDown != null ? benchPath.TempMtrDown.ReadTemperature() : 0, /// temp. at the end of test in degree C
|
||||
outPath.TempMtrDiv != null ? outPath.TempMtrDiv.ReadTemperature() : 0, /// temp. at the diverter in degree C
|
||||
PressUp,
|
||||
PressDown,
|
||||
PressDelta,
|
||||
(outPath.Scale is IScale) ? (outPath.Scale as IScale).Mass : 0, /// collected water mass in kg
|
||||
"VolMM",
|
||||
AmbTemp,
|
||||
AmbHumi,
|
||||
AmbPress,
|
||||
outPath.RegValve.Position.ToString("F1"),
|
||||
TempRefHi1,
|
||||
TempRefHi2,
|
||||
TempRefLo1,
|
||||
TempRefLo2);
|
||||
}
|
||||
|
||||
///
|
||||
/// Endurance data logging
|
||||
///
|
||||
public void LogEnduranceHeader(System.IO.StreamWriter writer)
|
||||
{
|
||||
LogEnduranceHeader(writer, null);
|
||||
}
|
||||
|
||||
public void LogEnduranceHeader(System.IO.StreamWriter writer, string sectionName)
|
||||
{
|
||||
writer.WriteLine();
|
||||
if (sectionName != null)
|
||||
writer.Write(sectionName);
|
||||
writer.WriteLine("Time T_up T_dn Pr_up Pr_dn Flow");
|
||||
}
|
||||
|
||||
public void LogEnduranceData(System.IO.StreamWriter writer)
|
||||
{
|
||||
|
||||
writer.WriteLine(string.Format("{0:dd.MM.yyyy HH:mm.ss} {1} {2} {3} {4} {5}",
|
||||
DateTime.Now,
|
||||
benchPath.TempMtrUp != null ? benchPath.TempMtrUp.ReadTemperature() : 0, /// temp. at the beginning of line in degree C
|
||||
benchPath.TempMtrDown != null ? benchPath.TempMtrDown.ReadTemperature() : 0, /// temp. at the end of line in degree C
|
||||
PressUp,
|
||||
PressDown,
|
||||
RefFlow));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,8 +57,6 @@ namespace TBF.Rig.Sequences
|
||||
/// They persist during all repetitions of the same test
|
||||
///------------------------------------------------------------
|
||||
protected static Rig.FeedingPath inPath;
|
||||
protected static Rig.BenchPath benchPath;
|
||||
protected static Rig.OutputPath outPath;
|
||||
protected static Rig.MetersPath sensPath;
|
||||
protected static Rig.HeatMetersPath heatMetersPath;
|
||||
|
||||
@@ -92,116 +90,6 @@ namespace TBF.Rig.Sequences
|
||||
protected GenericDevices.IDataEntry lastDataEntryCmpnt;
|
||||
|
||||
|
||||
///
|
||||
/// Process data logging
|
||||
///
|
||||
public void LogProcessDataTestInfo(ILog logger, string procedureName, string testName)
|
||||
{
|
||||
logger.Info(Environment.NewLine);
|
||||
logger.InfoFormat("{0}={1:dd.MM.yyyy HH:mm:ss} {2}={3} {4}={5} {6}={7}",
|
||||
Strings.Date_and_time, TestStartTime,
|
||||
Strings.Batch_nr, BatchRslts.Batch.BatchNr,
|
||||
Strings.Procedure, procedureName,
|
||||
Strings.Test, testName);
|
||||
}
|
||||
|
||||
public void LogProcessDataHeader(ILog logger)
|
||||
{
|
||||
LogProcessDataHeader(logger, null);
|
||||
}
|
||||
|
||||
public void LogProcessDataHeader(ILog logger, string sectionName)
|
||||
{
|
||||
logger.Info(Environment.NewLine);
|
||||
if (sectionName != null) logger.Info(sectionName);
|
||||
logger.Info("Time Flow TstTime Ref.cnt Ref.vol Tup Tdown Tdiv Pup Pdown Pdelta Mass VolMM Tamb Hamb Pamb Rv");
|
||||
logger.Info(Environment.NewLine);
|
||||
}
|
||||
|
||||
public void LogProcessData(ILog logger)
|
||||
{
|
||||
logger.InfoFormat("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14} {15} {16}",
|
||||
DateTime.Now.ToLongTimeString(),
|
||||
Utils.DoubleToStr(RefFlow.Val, 4), /// flow measured by the reference flow meter in m3/h
|
||||
StateMachine.ControlBoard.TestTime.ToString("F3"),/// test time in s
|
||||
StateMachine.ControlBoard.RefPulses, /// reference flow meter pulses count
|
||||
Formulas.VolumeFromPulses(StateMachine.ControlBoard.RefPulses, 1.0f / LtrPerRefPulse).ToString("F3"), /// volume in l
|
||||
TempUp, /// water temperature at the beginning of test line in degree C
|
||||
TempDown, /// water temperature at the end of test line in degree C
|
||||
TempDiv, /// water temperature at the diverter in degree C
|
||||
PressUp, /// water pressure at the beginning of test line in bar (= 100 kPa)
|
||||
PressDown, /// water pressure at the end of test line in bar (= 100 kPa)
|
||||
PressDelta,
|
||||
Mass, /// collected water mass in kg
|
||||
"VolMM",
|
||||
AmbTemp, /// ambient temperature in degree C
|
||||
AmbHumi, /// ambient humidity in R%
|
||||
AmbPress, /// ambient pressure in mbar (= 1 hPa)
|
||||
outPath.RegValve.Position.ToString("F1")); /// regulation valve position in % (0=closed / 100=open)
|
||||
}
|
||||
|
||||
public void LogProcessDataHeaderHeatMeters(ILog logger, string sectionName)
|
||||
{
|
||||
logger.Info(Environment.NewLine);
|
||||
if (sectionName != null) logger.Info(sectionName);
|
||||
logger.Info("Time Flow TstTime Ref.cnt Ref.vol Tup Tdown Tdiv Pup Pdown Pdelta Mass VolMM Tamb Hamb Pamb Rv Thiac1 Thiac2 Tloac1 Tloac2");
|
||||
logger.Info(Environment.NewLine);
|
||||
}
|
||||
|
||||
public void LogProcessDataHeatMeters(ILog logger)
|
||||
{
|
||||
logger.InfoFormat("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14} {15} {16} {17} {18} {19} {20}",
|
||||
DateTime.Now.ToLongTimeString(),
|
||||
Utils.DoubleToStr(RefFlow.Val, 4),
|
||||
StateMachine.ControlBoard.TestTime.ToString("F3"),
|
||||
StateMachine.ControlBoard.RefPulses,
|
||||
Formulas.VolumeFromPulses(StateMachine.ControlBoard.RefPulses, 1.0f / LtrPerRefPulse).ToString("F3"),
|
||||
TempUp,
|
||||
TempDown,
|
||||
TempDiv,
|
||||
PressUp,
|
||||
PressDown,
|
||||
PressDelta,
|
||||
Mass,
|
||||
"VolMM",
|
||||
AmbTemp,
|
||||
AmbHumi,
|
||||
AmbPress,
|
||||
outPath.RegValve.Position.ToString("F1"),
|
||||
TempRefHi1,
|
||||
TempRefHi2,
|
||||
TempRefLo1,
|
||||
TempRefLo2);
|
||||
}
|
||||
|
||||
///
|
||||
/// Endurance data logging
|
||||
///
|
||||
public void LogEnduranceHeader(System.IO.StreamWriter writer)
|
||||
{
|
||||
LogEnduranceHeader(writer, null);
|
||||
}
|
||||
|
||||
public void LogEnduranceHeader(System.IO.StreamWriter writer, string sectionName)
|
||||
{
|
||||
writer.WriteLine();
|
||||
if (sectionName != null)
|
||||
writer.Write(sectionName);
|
||||
writer.WriteLine("Time T_up T_dn Pr_up Pr_dn Flow");
|
||||
}
|
||||
|
||||
public void LogEnduranceData(System.IO.StreamWriter writer)
|
||||
{
|
||||
|
||||
writer.WriteLine(string.Format("{0:dd.MM.yyyy HH:mm.ss} {1} {2} {3} {4} {5}",
|
||||
DateTime.Now,
|
||||
TempUp,
|
||||
TempDown,
|
||||
PressUp,
|
||||
PressDown,
|
||||
RefFlow));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used in tests in measurement loop to display remaining test time
|
||||
/// </summary>
|
||||
@@ -261,37 +149,29 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
IOperation timer = new TimerOp(tank.EmptyTimeSec, remainingTimeSec);
|
||||
|
||||
State.Create("SequenceBase : Draining the tank")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new TimerOp(tank.EmptyTimeSec, remainingTimeSec))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
State.Create("SequenceBase : Draining the tank")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(timer)
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e))
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e))
|
||||
{
|
||||
stopped = true;
|
||||
break;
|
||||
}
|
||||
if (e.Contains(Event.ScaleOverload)) { }; /// Tank should be emptying now
|
||||
///
|
||||
if (!(tank is IScale))
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}",
|
||||
Strings.Emptying_tank,
|
||||
remainingTimeSec.Val / 60, "min",
|
||||
remainingTimeSec.Val % 60, Strings.sec));
|
||||
}
|
||||
stopped = true;
|
||||
break;
|
||||
}
|
||||
///
|
||||
if (!(tank is IScale))
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}",
|
||||
Strings.Emptying_tank,
|
||||
remainingTimeSec.Val / 60, "min",
|
||||
remainingTimeSec.Val % 60, Strings.sec));
|
||||
}
|
||||
while ((tank is IScale) && !e.Contains(Event.ScaleDone));
|
||||
|
||||
if (stopped) break;
|
||||
}
|
||||
while (!tank.IsEmpty() && !e.Contains(Event.TimerExpired));
|
||||
}
|
||||
@@ -314,37 +194,28 @@ namespace TBF.Rig.Sequences
|
||||
///
|
||||
/// 1st half
|
||||
///
|
||||
IOperation timer1 = new TimerOp(tank.EmptyTimeSec / 2, remainingTimeSec);
|
||||
State.Create("SequenceBase : Draining the tank")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new TimerOp(tank.EmptyTimeSec / 2, remainingTimeSec))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
State.Create("SequenceBase : Draining the tank")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(timer1)
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e))
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e))
|
||||
{
|
||||
stopped = true;
|
||||
break;
|
||||
}
|
||||
if (e.Contains(Event.ScaleOverload)) { }; /// Tank should be emptying now
|
||||
///
|
||||
if (!(tank is IScale))
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}",
|
||||
Strings.Emptying_tank,
|
||||
(remainingTimeSec.Val + tank.EmptyTimeSec / 2) / 60, "min",
|
||||
(remainingTimeSec.Val + tank.EmptyTimeSec / 2) % 60, Strings.sec));
|
||||
}
|
||||
stopped = true;
|
||||
break;
|
||||
}
|
||||
///
|
||||
if (!(tank is IScale))
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}",
|
||||
Strings.Emptying_tank,
|
||||
(remainingTimeSec.Val + tank.EmptyTimeSec / 2) / 60, "min",
|
||||
(remainingTimeSec.Val + tank.EmptyTimeSec / 2) % 60, Strings.sec));
|
||||
}
|
||||
while ((tank is IScale) && !e.Contains(Event.ScaleDone));
|
||||
|
||||
if (stopped) break;
|
||||
}
|
||||
while (!tank.IsEmpty() && !e.Contains(Event.TimerExpired));
|
||||
|
||||
@@ -364,38 +235,30 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
IOperation timer2 = new TimerOp(tank.EmptyTimeSec / 2, remainingTimeSec);
|
||||
|
||||
State.Create("SequenceBase : Draining the tank")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new TimerOp(tank.EmptyTimeSec / 2, remainingTimeSec))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
State.Create("SequenceBase : Draining the tank")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(timer2)
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e))
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e))
|
||||
{
|
||||
stopped = true;
|
||||
break;
|
||||
}
|
||||
if (e.Contains(Event.ScaleOverload)) { }; /// Tank should be emptying now
|
||||
///
|
||||
if (!(tank is IScale))
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}",
|
||||
Strings.Emptying_tank,
|
||||
remainingTimeSec.Val / 60, "min",
|
||||
remainingTimeSec.Val % 60, Strings.sec));
|
||||
}
|
||||
|
||||
stopped = true;
|
||||
break;
|
||||
}
|
||||
///
|
||||
if (!(tank is IScale))
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}",
|
||||
Strings.Emptying_tank,
|
||||
remainingTimeSec.Val / 60, "min",
|
||||
remainingTimeSec.Val % 60, Strings.sec));
|
||||
}
|
||||
while ((tank is IScale) && !e.Contains(Event.ScaleDone));
|
||||
|
||||
if (stopped) break;
|
||||
}
|
||||
while (!tank.IsEmpty() && !e.Contains(Event.TimerExpired));
|
||||
}
|
||||
@@ -406,7 +269,6 @@ namespace TBF.Rig.Sequences
|
||||
//
|
||||
State.Create("SequenceBase : Closing the drain valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, tank.DrainValve))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
@@ -422,7 +284,6 @@ namespace TBF.Rig.Sequences
|
||||
{
|
||||
State.Create("SequenceBase : Closing the 2nd drain valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, tank.DrainValve2))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
@@ -432,25 +293,24 @@ namespace TBF.Rig.Sequences
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet) || ((tank is IScale) && !e.Contains(Event.ScaleDone)));
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
}
|
||||
|
||||
if (tank is IScale)
|
||||
{
|
||||
State.Create("SequenceBase : Updating the mass")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((tank as IScale).ReadMassOp(ref Mass))
|
||||
.AddOperation(new Operations.TimerOp(5))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone) || !e.Contains(Event.TimerExpired));
|
||||
}
|
||||
//if (tank is IScale)
|
||||
//{
|
||||
// State.Create("SequenceBase : Updating the mass")
|
||||
// .AddOperation(checkUiOp)
|
||||
// .AddOperation(new Operations.TimerOp(5))
|
||||
// .AddOperations(extraOperations)
|
||||
// .EnterState();
|
||||
// do
|
||||
// {
|
||||
// e = StateMachine.WaitRunDevsRunOps();
|
||||
// if (e.Contains(Event.Error)) return Event.Error;
|
||||
// if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
// }
|
||||
// while (!e.Contains(Event.TimerExpired));
|
||||
//}
|
||||
|
||||
if (stopped)
|
||||
return Event.UiCmdStop;
|
||||
@@ -1988,7 +1848,7 @@ namespace TBF.Rig.Sequences
|
||||
else if (inPath.Pump is IValve) log.FatalFormat(" Feeding valve: {0}", (inPath.Pump as IValve).State ? "open" : "close");
|
||||
if (outPath.RegValve is IRegValve) log.FatalFormat(" Regulation valve position: {0}%", outPath.RegValve.Position);
|
||||
log.FatalFormat(" Flow: {0}", RefFlow);
|
||||
log.FatalFormat(" Mass: {0}", Mass);
|
||||
log.FatalFormat(" Mass: {0}", (outPath.Scale is IScale) ? (outPath.Scale as IScale).Mass : 0);
|
||||
log.FatalFormat(" Start mass: {0}", StartMass);
|
||||
log.FatalFormat(" Liter/ref.pulse: {0}", LtrPerRefPulse);
|
||||
log.FatalFormat(" Reference pulses: {0}", RefPulses);
|
||||
|
||||
@@ -198,20 +198,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
|
||||
if (!test.DoDraining) /// Do not skip emptying if test.Emptying==true
|
||||
{
|
||||
//--------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Mesuring mass of water in the tank", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
if (TestAndLogUiCmdStop(test,e)) goto stopTest;
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
|
||||
double estimatedEndMass = Mass.Val + test.Volume;
|
||||
double estimatedEndMass = scale.Mass + test.Volume;
|
||||
if (estimatedEndMass < scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
goto switching_flow_detection; /// Enough room in the tank -> skip emptying
|
||||
@@ -551,7 +538,6 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
///
|
||||
Mass.Val = StartMass.Val;
|
||||
tMass1 = StateMachine.Time;
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
@@ -180,22 +180,7 @@ namespace TBF.Rig.TestMethods.DiverterTest
|
||||
|
||||
if (!drainTheTank) /// If condition met => skip measuring and force emptying
|
||||
{
|
||||
///
|
||||
/// Measure the weight and skip emptying if there is enough room in the tank
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
|
||||
double estimatedEndMass = Mass.Val + test.Volume;
|
||||
double estimatedEndMass = scale.Mass + test.Volume;
|
||||
if (estimatedEndMass >= scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
drainTheTank = true;
|
||||
@@ -456,7 +441,6 @@ namespace TBF.Rig.TestMethods.DiverterTest
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
|
||||
Mass.Val = StartMass.Val;
|
||||
tMass1 = StateMachine.Time;
|
||||
log.WarnFormat("Start mass = {0}kg", StartMass);
|
||||
|
||||
|
||||
@@ -161,33 +161,10 @@ namespace TBF.Rig.TestMethods.FixedStartAdvanced
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
|
||||
if (!test.DoDraining)
|
||||
if (test.DoDraining || (scale.Mass + test.Volume >= scale.Capacity * Constants.TankFullFactor))
|
||||
{
|
||||
///
|
||||
/// Measure the weight in case there is no unconditional draining
|
||||
///
|
||||
State.Create("FixedStartAdvanced : Measuring mass of water in the tank")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(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.ScaleDone));
|
||||
}
|
||||
///
|
||||
/// Skip draining in case there is enough room in the tank
|
||||
///
|
||||
if (test.DoDraining || (Mass.Val + test.Volume >= scale.Capacity * Constants.TankFullFactor))
|
||||
{
|
||||
///
|
||||
/// Drain the water tank
|
||||
/// There is not enough room in the tank OR unconditional draining ... drain the water tank
|
||||
///
|
||||
switch (DrainTheTank(scale, readTempPressOps))
|
||||
{
|
||||
@@ -386,7 +363,6 @@ namespace TBF.Rig.TestMethods.FixedStartAdvanced
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
///
|
||||
TestStartTime = DateTime.Now;
|
||||
Mass.Val = StartMass.Val;
|
||||
tMass1 = StateMachine.Time;
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
@@ -184,33 +184,10 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollAdvanced
|
||||
|
||||
#region Make sure there is enough space in the tank
|
||||
|
||||
if (!test.DoDraining)
|
||||
if (test.DoDraining || (scale.Mass + test.Volume >= scale.Capacity * Constants.TankFullFactor))
|
||||
{
|
||||
///
|
||||
/// Measure the weight in case there is no unconditional draining
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(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.ScaleDone));
|
||||
}
|
||||
///
|
||||
/// Skip draining in case there is enough room in the tank
|
||||
///
|
||||
if (test.DoDraining || (Mass.Val + test.Volume >= scale.Capacity * Constants.TankFullFactor))
|
||||
{
|
||||
///
|
||||
/// Drain the water tank
|
||||
/// There is not enough room in the tank OR unconditional draining ... drain the water tank
|
||||
///
|
||||
IList<IOperation> ops = new List<IOperation>(readTempPressOps);
|
||||
ops.Add(heatMetersPromptOp);
|
||||
@@ -226,7 +203,6 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollAdvanced
|
||||
State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.AddOperation(cBrd.SetValvesOp(null, scale.DrainValve))
|
||||
.EnterState();
|
||||
@@ -288,7 +264,6 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollAdvanced
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
///
|
||||
Mass.Val = StartMass.Val;
|
||||
tMass1 = StateMachine.Time;
|
||||
|
||||
#endregion
|
||||
@@ -340,7 +315,6 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollAdvanced
|
||||
State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowAdvancedTestStartFormOp(sensPath.RegisterReaders, BatchRslts.Batch.WaterMeters, false))
|
||||
.EnterState();
|
||||
do
|
||||
@@ -494,7 +468,6 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollAdvanced
|
||||
State.Create(string.Format("{0}({1}) : Start the test, open the start/stop valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
//.AddOperation(cBrd.StartTestOp(test, false, true, true, test.Qfrom, test.Qto, totalPulses, 0))
|
||||
.AddOperation(cBrd.OpenStartValveOp())
|
||||
.EnterState();
|
||||
@@ -597,7 +570,6 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollAdvanced
|
||||
State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.CloseStartValveOp())
|
||||
.EnterState();
|
||||
do {
|
||||
@@ -610,7 +582,6 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollAdvanced
|
||||
State.Create(string.Format("{0}({1}) : Stopping flow regulation", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.StopFlowRegulationOp())
|
||||
.EnterState();
|
||||
do {
|
||||
|
||||
+1
-23
@@ -207,30 +207,10 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollDeferredEval
|
||||
}
|
||||
|
||||
|
||||
if (!test.DoDraining)
|
||||
{
|
||||
///
|
||||
/// Measure the weight in case there is no unconditional draining
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(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.ScaleDone));
|
||||
}
|
||||
///
|
||||
/// Skip draining in case there is enough room in the tank
|
||||
///
|
||||
if (test.DoDraining || (Mass.Val + test.Volume >= scale.Capacity * Constants.TankFullFactor))
|
||||
if (test.DoDraining || (scale.Mass + test.Volume >= scale.Capacity * Constants.TankFullFactor))
|
||||
{
|
||||
///
|
||||
/// Drain the water tank
|
||||
@@ -249,7 +229,6 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollDeferredEval
|
||||
State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
|
||||
.EnterState();
|
||||
@@ -531,7 +510,6 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollDeferredEval
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
///
|
||||
Mass.Val = StartMass.Val;
|
||||
tMass1 = StateMachine.Time;
|
||||
|
||||
|
||||
|
||||
@@ -22,8 +22,7 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
/// <returns>true when capabilities of devices are OK</returns>
|
||||
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
|
||||
{
|
||||
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
|
||||
!(StateMachine.ControlBoard is ControlBoard.Papouch.PapouchCB) &&
|
||||
if (!(StateMachine.ControlBoard is ControlBoard.Papouch.PapouchCB) &&
|
||||
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
|
||||
{
|
||||
/// Control board does not support this method
|
||||
@@ -182,35 +181,11 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!test.DoDraining)
|
||||
if (test.DoDraining || (scale.Mass + test.Volume >= scale.Capacity * Constants.TankFullFactor))
|
||||
{
|
||||
///
|
||||
/// Measure the weight in case there is no unconditional draining
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(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.ScaleDone));
|
||||
}
|
||||
///
|
||||
/// Skip draining in case there is enough room in the tank
|
||||
///
|
||||
if (test.DoDraining || (Mass.Val + test.Volume >= scale.Capacity * Constants.TankFullFactor))
|
||||
{
|
||||
///
|
||||
/// Drain the water tank
|
||||
///
|
||||
///
|
||||
/// There is not enough room in the tank OR unconditional draining ... drain the water tank
|
||||
///
|
||||
IList<IOperation> ops = new List<IOperation>(readTempPressOps);
|
||||
ops.Add(heatMetersPromptOp);
|
||||
switch (DrainTheTank(scale, ops))
|
||||
@@ -225,7 +200,6 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.AddOperation(cBrd.SetValvesOp(null, scale.DrainValve))
|
||||
.EnterState();
|
||||
@@ -506,7 +480,6 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
///
|
||||
Mass.Val = StartMass.Val;
|
||||
tMass1 = StateMachine.Time;
|
||||
|
||||
|
||||
@@ -556,7 +529,6 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
|
||||
.EnterState();
|
||||
do {
|
||||
@@ -624,73 +596,51 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
}
|
||||
|
||||
|
||||
if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "Measurement");
|
||||
else LogProcessDataHeaderHeatMeters(processDataLogger, "Measurement");
|
||||
if (heatMetersPath == null)
|
||||
LogProcessDataHeader(processDataLogger, "Measurement");
|
||||
else
|
||||
LogProcessDataHeaderHeatMeters(processDataLogger, "Measurement");
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
//------------------------------------------------
|
||||
StartTime = (double)StateMachine.Time;
|
||||
|
||||
/// Measurement loop preparation
|
||||
TestStartTime = DateTime.Now;
|
||||
StartTime = (double)StateMachine.Time;
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
int remainingTime;
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, Math.Max((int)(test.TestTime / 10), 5));
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Start the test, open the start/stop valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.OpenStartValveOp())
|
||||
//.AddOperation(cBrd.StartTestOp(test, false, true, true, test.Qfrom, test.Qto, totalPulses, 0))
|
||||
.AddOperation(cBrd.StandingStartStopTestOp(test, test.Qfrom, test.Qto, totalPulses))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
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.TestInProgress));
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
switchTimeStart = 0.001f * cBrd.ValveOpenCloseTime;
|
||||
log.WarnFormat("Start valve switch time on test start = {0} ms", cBrd.ValveOpenCloseTime);
|
||||
|
||||
/// Measurement loop - preparation
|
||||
queryEnd1 = cBrd.QueryMeasurementEndOp();
|
||||
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, Math.Max((int)(test.TestTime / 10), 5));
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
|
||||
/// Measurement loop - begin
|
||||
do
|
||||
{
|
||||
//--------------------------------
|
||||
switch (ReadRegistersTempPressAmbient(null, true))
|
||||
{
|
||||
case Event.Error:
|
||||
retVal = Event.Error;
|
||||
goto stopTest;
|
||||
|
||||
case Event.UiCmdStop:
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTest;
|
||||
|
||||
case Event.TestCompleted:
|
||||
goto test_completed;
|
||||
}
|
||||
|
||||
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
|
||||
if (remainingTime > 60)
|
||||
{
|
||||
/// Show remaining time
|
||||
if ((remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0)) > 60)
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
||||
}
|
||||
else
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
||||
}
|
||||
|
||||
/// Update statistics
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
RefFlow.Val = outPath.FlowMeter.ReadFlow();
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
#region Heat meters
|
||||
|
||||
if (heatMetersTestParams != null)
|
||||
{
|
||||
/// Update heatmeter volume and energy values
|
||||
if (lastEnergyUpdateTime == 0)
|
||||
{
|
||||
lastEnergyUpdateTime = StateMachine.Time;
|
||||
@@ -698,9 +648,9 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
else
|
||||
{
|
||||
//double deltaTime = (double)(StateMachine.Time - lastEnergyUpdateTime);
|
||||
double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C]
|
||||
double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C]
|
||||
double deltaVolume = LtrPerRefPulse * RefPulsesDelta; /// [l]
|
||||
double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C]
|
||||
double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C]
|
||||
double deltaVolume = LtrPerRefPulse * RefPulsesDelta; /// [l]
|
||||
double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Config.Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)]
|
||||
Energy.Update(deltaEnergy);
|
||||
VolumeForEnergy.Update(deltaVolume);
|
||||
@@ -708,39 +658,25 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
}
|
||||
}
|
||||
|
||||
if (compound)
|
||||
{
|
||||
/// TODO: Reimplement for combined meters
|
||||
//for (int i = 0; i < Config.Data.CompoundWMsCount; i++)
|
||||
//{
|
||||
// data.TestResult.CombinedMeters[i].VolumeMeter = data.TestResult.Meters[2 * i].VolumeMeter
|
||||
// + data.TestResult.Meters[2 * i + 1].VolumeMeter;
|
||||
// if (data.Volume.Valid)
|
||||
// {
|
||||
// data.TestResult.CombinedMeters[i].VolumeErrorPct =
|
||||
// Formulas.ErrorFromVolumes(data.TestResult.CombinedMeters[i].VolumeMeter, data.Volume.Val);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
#endregion
|
||||
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (cBrd.RefPulses < totalPulses);
|
||||
/// Measurement loop - end
|
||||
|
||||
test_completed:
|
||||
|
||||
StopRecordingStatistics();
|
||||
while (!e.Contains(Event.TestCompleted) && !e.Contains(Event.Next));
|
||||
|
||||
/// Measurement loop end
|
||||
switchTimeStart = 0.001f * cBrd.ValveOpenCloseTime;
|
||||
log.WarnFormat("Start valve switch time on test start = {0} ms", cBrd.ValveOpenCloseTime);
|
||||
StopRecordingStatistics();
|
||||
EndTime = (double)StateMachine.Time;
|
||||
TestEndTime = DateTime.Now;
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.CloseStartValveOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -748,26 +684,13 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Stopping flow regulation", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.StopFlowRegulationOp())
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.FlowRegulationStopped));
|
||||
|
||||
|
||||
switchTimeEnd = 0.001f * cBrd.ValveOpenCloseTime;
|
||||
log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime);
|
||||
|
||||
if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "End mass");
|
||||
else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass");
|
||||
if (heatMetersPath == null)
|
||||
LogProcessDataHeader(processDataLogger, "End mass");
|
||||
else
|
||||
LogProcessDataHeaderHeatMeters(processDataLogger, "End mass");
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Measuring_the_weight);
|
||||
@@ -799,7 +722,6 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.SetValvesOp(scale.DrainValve, null))
|
||||
.AddOperations(readTempPressOps)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -810,18 +732,6 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
}
|
||||
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.StopPreviousOp())
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.PreviousStopped));
|
||||
|
||||
|
||||
double massStart = Config.Formulas.CorrectedValue(StartMass.Val, scale.Corrections);
|
||||
double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, scale.Corrections);
|
||||
double densityOut = Config.Formulas.WaterDensityFromTempPress((TempUpStat.Average + TempDownStat.Average) / 2,
|
||||
@@ -953,7 +863,6 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_completed);
|
||||
//------------------------------------------------
|
||||
|
||||
+1
-3
@@ -212,7 +212,6 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -221,7 +220,7 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
|
||||
double estimatedEndMass = Mass.Val + test.Volume;
|
||||
double estimatedEndMass = scale.Mass + test.Volume;
|
||||
if (estimatedEndMass >= scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
drainTheTank = true;
|
||||
@@ -547,7 +546,6 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
|
||||
Mass.Val = StartMass.Val;
|
||||
tMass1 = StateMachine.Time;
|
||||
log.WarnFormat("Start mass = {0}kg", StartMass);
|
||||
}
|
||||
|
||||
+1
-5
@@ -227,7 +227,6 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -236,7 +235,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
|
||||
double estimatedEndMass = Mass.Val + test.Volume;
|
||||
double estimatedEndMass = scale.Mass + test.Volume;
|
||||
if (estimatedEndMass >= scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
drainTheTank = true;
|
||||
@@ -543,7 +542,6 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(compareValves, null))
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -592,7 +590,6 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, compareValves))
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -629,7 +626,6 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
|
||||
Mass.Val = StartMass.Val;
|
||||
tMass1 = StateMachine.Time;
|
||||
log.WarnFormat("Start mass = {0}kg", StartMass);
|
||||
|
||||
|
||||
+1
-17
@@ -199,22 +199,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
|
||||
if (!drainTheTank) /// If condition met => skip measuring and force emptying
|
||||
{
|
||||
///
|
||||
/// Measure the weight and skip emptying if there is enough room in the tank
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
|
||||
double estimatedEndMass = Mass.Val + volumeToTank;
|
||||
double estimatedEndMass = scale.Mass + volumeToTank;
|
||||
if (estimatedEndMass >= scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
drainTheTank = true;
|
||||
@@ -540,7 +525,6 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
|
||||
Mass.Val = StartMass.Val;
|
||||
tMass1 = StateMachine.Time;
|
||||
log.WarnFormat("Start mass = {0}kg", StartMass);
|
||||
|
||||
|
||||
@@ -195,22 +195,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
|
||||
if (!drainTheTank) /// If condition met => skip measuring and force emptying
|
||||
{
|
||||
///
|
||||
/// Measure the weight and skip emptying if there is enough room in the tank
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone));
|
||||
|
||||
double estimatedEndMass = Mass.Val + test.Volume;
|
||||
double estimatedEndMass = scale.Mass + test.Volume;
|
||||
if (estimatedEndMass >= scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
drainTheTank = true;
|
||||
@@ -536,7 +521,6 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
}
|
||||
while (!e.Contains(Event.ScaleDone) && !e.Contains(Event.Next));
|
||||
|
||||
Mass.Val = StartMass.Val;
|
||||
tMass1 = StateMachine.Time;
|
||||
log.WarnFormat("Start mass = {0}kg", StartMass);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user