Many changes, new results used, all test sequences modified, simulated tests rewritten.

This commit is contained in:
Milan Hanajik
2016-01-04 13:53:45 +01:00
parent 494c6edf76
commit 26982a5729
71 changed files with 2609 additions and 2692 deletions
@@ -47,7 +47,8 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, 1, inPath, benchPath, outPath, sensPath, 0));
TestResult tstRslt = new TestResult(test, 1, StateMachine.Procedure.MetersKind);
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, 1);
TestStartTime = DateTime.Now;
//------------------------------------------------
Bridge.OnActivity(this, Strings.Starting_the_pump);
@@ -103,11 +104,6 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
PressureUp.Val.ToString("F1"),
PressureUp.Val.ToString("F1")));
tstRslt.TempInStart = TempIn.Val;
tstRslt.TempOutStart = TempOut.Val;
tstRslt.PressInStart = PressureUp.Val;
tstRslt.PressOutStart = PressureDown.Val;
float step = (pumpPower < 40.0f) ? 5.0f : ((pumpPower < 60.0f) ? 3.0f : ((pumpPower < 80.0f) ? 2.0f : 1.0f));
if (PressureDown.Val < testParams.PressureLo)
@@ -128,10 +124,11 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
pressure_set:
tstRslt.TimeStart = DateTime.Now;
ClearAllStatistics();
UpdateAllStatistics();
startTime = StateMachine.Time;
int endTime = startTime + testParams.DurationPMax;
ResetAveragedData();
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_in_progress);
@@ -148,17 +145,13 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
{
e = StateMachine.WaitRunDevsRunOps();
tstRslt.TempInEnd = TempIn.Val;
tstRslt.TempOutEnd = TempOut.Val;
tstRslt.PressInEnd = PressureUp.Val;
tstRslt.PressOutEnd = PressureDown.Val;
tstRslt.MassEndRaw = Mass.Val;
AccumulateAveragedData();
CurrentMassRaw = Mass.Val;
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
UpdateAllStatistics();
int remainingTime = Math.Max(endTime - StateMachine.Time, 0);
if (remainingTime > 60)
{
@@ -173,7 +166,9 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
/// Measurement loop - end
test_completed:
test_completed:
TestEndTime = DateTime.Now;
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_completed);
@@ -185,102 +180,110 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
///
/// Populate TestResult data entity with data
///
UpdateTestRsltWithAveragedData(tstRslt);
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
tstRslt.TimeEnd = DateTime.Now;
tstRslt.BatchNr = Program.LocalSettings.BatchNr;
tstRslt.MassStart = 0;
tstRslt.MassEnd = 0;
tstRslt.MassDiff = 0;
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
tstRslt.DensityDiv = 0; /// [kg/m3]
tstRslt.Time = testParams.DurationPMax; /// [s] measurement time
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 0; /// [l/h]
tstRslt.PulsesMaster = 0; /// Pulses of the master flow meter (test total)
tstRslt.VolumeMaster = 0; /// [l] volume from the master flow meter
tstRslt.ConstMaster = 0; /// Convert the flow to [m3/h]
tstRslt.VolumeCTV = 0; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0;
tstRslt.TimeDivStart0 = 0;
tstRslt.TimeDivStart1 = 0;
tstRslt.TimeDivStart2 = 0;
tstRslt.TimeDivStart3 = 0;
tstRslt.TimeDivStart4 = 0;
tstRslt.TimeDivStart5 = 0;
tstRslt.TimeDivEnd0 = 0;
tstRslt.TimeDivEnd1 = 0;
tstRslt.TimeDivEnd2 = 0;
tstRslt.TimeDivEnd3 = 0;
tstRslt.TimeDivEnd4 = 0;
tstRslt.TimeDivEnd5 = 0;
if (StateMachine.Procedure.MetersKind == Config.Entities.MetersKind.Single)
{
for (int i = 0; i < Config.Data.WMsCount; i++)
{
if (sensPath.RegisterReaders[i] != null)
{
tstRslt.Meters[i].SerialNr = (WaterMeters.Count > i) ? WaterMeters[i].SerialNr : string.Empty;
tstRslt.Meters[i].VolumeStart = 0;
tstRslt.Meters[i].VolumeEnd = 0;
tstRslt.Meters[i].VolumeMeter = 0;
tstRslt.Meters[i].VolumeRef = 0;
tstRslt.Meters[i].PulsesMeter = 0;
tstRslt.Meters[i].PulsesMaster = 0;
tstRslt.Meters[i].Time = testParams.DurationPMax;
tstRslt.Meters[i].VolumeErrorPct = 0;
tstRslt.Meters[i].Passed = true;
}
}
}
else
if (tstRslt != null)
{
for (int iCmbnd = 0; iCmbnd < Config.Data.CompoundWMsCount; iCmbnd++)
/// Auxiliary results
tstRslt.AmbientTempAve = AmbientTempStat.Average;
tstRslt.AmbientPressAve = AmbientPressureStat.Average;
tstRslt.AmbientHumiAve = AmbientHumidityStat.Average;
tstRslt.PressUpAvrg = PressureUpStat.Average;
tstRslt.PressUpStart = PressureUpStat.First;
tstRslt.PressUpEnd = PressureUpStat.Last;
tstRslt.PressUpMin = PressureUpStat.Min;
tstRslt.PressUpMax = PressureUpStat.Max;
tstRslt.PressDownAvrg = PressureDownStat.Average;
tstRslt.PressDownStart = PressureDownStat.First;
tstRslt.PressDownEnd = PressureDownStat.Last;
tstRslt.PressDownMin = PressureDownStat.Min;
tstRslt.PressDownMax = PressureDownStat.Max;
tstRslt.TempInAvrg = TempInStat.Average;
tstRslt.TempInStart = TempInStat.First;
tstRslt.TempInEnd = TempInStat.Last;
tstRslt.TempInMin = TempInStat.Min;
tstRslt.TempInMax = TempInStat.Max;
tstRslt.TempOutAvrg = TempOutStat.Average;
tstRslt.TempOutStart = TempOutStat.First;
tstRslt.TempOutEnd = TempOutStat.Last;
tstRslt.TempOutMin = TempOutStat.Min;
tstRslt.TempOutMax = TempOutStat.Max;
tstRslt.TempDivAvrg = TempDivStat.Average;
tstRslt.TempDivStart = TempDivStat.First;
tstRslt.TempDivEnd = TempDivStat.Last;
tstRslt.TempDivMin = TempDivStat.Min;
tstRslt.TempDivMax = TempDivStat.Max;
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
tstRslt.DensityDiv = 0;
/// Main results
tstRslt.StartTime = TestStartTime;
tstRslt.EndTime = TestEndTime;
tstRslt.FlowSetTime = 0;
tstRslt.TestTime = Convert.ToDouble(testParams.DurationPMax); /// [s] measurement time
tstRslt.PulsesMaster = 0; /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = 0;
tstRslt.MassEndRaw = 0;
tstRslt.MassEnd = 0;
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 0; /// [m3/h]
tstRslt.VolumeMaster = 0; /// [l] volume from the master flow meter
tstRslt.VolumeCTV = 0; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ConstMaster = 0; /// Convert the flow to [m3/h]
tstRslt.ErrorMaster = 0;
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
tstRslt.CombinedMeters[iCmbnd].VolumeRef = 0;
for (int i = 2 * iCmbnd; i < 2 * iCmbnd + 2; i++)
if (StateMachine.Procedure.MetersKind == MetersKind.Single)
{
if (sensPath.RegisterReaders[i] == null || sensPath.RegisterReaders[i].PulsesPerLtr <= float.Epsilon)
{
tstRslt.Meters[i].PulsesPerLiter = 1.0f;
}
else
{
tstRslt.Meters[i].PulsesPerLiter = sensPath.RegisterReaders[i].PulsesPerLtr;
}
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
tstRslt.Meters[i].SerialNr = (WaterMeters.Count > i) ? WaterMeters[i].SerialNr : string.Empty;
tstRslt.Meters[i].VolumeStart = 0;
tstRslt.Meters[i].VolumeEnd = 0;
tstRslt.Meters[i].VolumeRef = 0;
tstRslt.Meters[i].VolumeMeter = 0;
tstRslt.Meters[i].Time = test.TstTime;
tstRslt.Meters[i].TimeStart = 0;
tstRslt.Meters[i].TimeEnd = testParams.DurationPMax;
tstRslt.Meters[i].PulsesMeter = 0;
tstRslt.Meters[i].PulsesMaster = 0;
tstRslt.Meters[i].VolumeErrorPct = 0;
tstRslt.Meters[i].Passed = true;
if (meterRslt != null)
{
meterRslt.TestTime = tstRslt.TestTime;
meterRslt.Error = 0;
meterRslt.Passed = true;
meterRslt.TestDone = true;
}
}
else
{
Results.Entities.MeterTestRslt mainMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundMain);
Results.Entities.MeterTestRslt auxMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundAux);
tstRslt.CombinedMeters[iCmbnd].VolumeMeter = 0;
tstRslt.CombinedMeters[iCmbnd].PulsesMaster = 0;
tstRslt.CombinedMeters[iCmbnd].Time = testParams.DurationPMax;
tstRslt.CombinedMeters[iCmbnd].VolumeErrorPct = 0;
tstRslt.CombinedMeters[iCmbnd].Passed = true;
for (int isAux = 0; isAux <= 1; isAux++) /// 0=main, 1=aux
{
Results.Entities.MeterTestRslt meterRslt = (isAux == 0) ? mainMeterRslt : auxMeterRslt;
if (meterRslt != null)
{
meterRslt.TestTime = tstRslt.TestTime;
meterRslt.Error = 0;
meterRslt.Passed = true;
}
}
Results.Entities.MeterTestRslt compoundMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Compound);
if (compoundMeterRslt != null)
{
compoundMeterRslt.TestTime = tstRslt.TestTime;
compoundMeterRslt.Error = 0;
compoundMeterRslt.Passed = true;
mainMeterRslt.TestDone = auxMeterRslt.TestDone = compoundMeterRslt.TestDone = true;
}
}
}
}
/// Add data - end
AddOrOverwriteResult(tstRslt);
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(tstRslt));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName));
/// Append the results to the CSV-file
allResults.Info(TestResult2CsvLine(tstRslt));
allResults.Info(TestResult2CsvLine(testName, test.Part));
stopTest: