(1) bug fixes, (2) common iPerlCommunication test result derived from the 1st test (Read configuration), version 1.5.111.

This commit is contained in:
Milan Hanajik
2015-09-11 19:36:37 +02:00
parent e230ce02bf
commit 06c46785f6
7 changed files with 118 additions and 14 deletions
@@ -36,7 +36,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
tp.UpdateTestParams(tstPrms);
string lowercaseAct = tp.Activity.ToLower();
return lowercaseAct.Contains("simulate ") || lowercaseAct.Contains("q2 corrected from ");
return lowercaseAct.Contains("read configuration") || lowercaseAct.Contains("simulate ") || lowercaseAct.Contains("q2 corrected from ");
}
}
return false;
@@ -488,6 +488,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
CommCompletedHandler = null;
AllCompletedHandler = null;
Entities.TestResult result = CommResult(StateMachine.Tests[0]); /// TODO: Pass the test info in a correct way
BenchControl.Sequences.SequenceBase.AddOrOverwriteResult(result); /// TODO: Pass the result in a correct way
TBF.UiBridge.Bridge.OnTestCompleted(this, new TBF.UiBridge.TestCompletedEventArgs(result));
formCompleted = true;
Program.LocalSettings.iPerlCommunicationsFormLeft = Location.X;
Program.LocalSettings.iPerlCommunicationsFormTop = Location.Y;
@@ -1082,5 +1086,84 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
Text = data.CommMessage;
}
/// <summary>
/// Create virtual test result with representing communication success/failure
/// </summary>
/// <param name="test"></param>
/// <returns></returns>
Entities.TestResult CommResult(Entities.Test test)
{
Entities.TestResult tstRslt = new Entities.TestResult(test, 1, Entities.MetersKind.Single);
tstRslt.DoNotEvaluate = false;
tstRslt.DoNotPublish = false;
tstRslt.TimeStart = DateTime.Now;
tstRslt.TimeEnd = DateTime.Now;
tstRslt.AmbientTempAve = 20.0f;
tstRslt.AmbientPressAve = 1000.0f;
tstRslt.AmbientHumiAve = 50.0f;
tstRslt.PressInStart = 1000.0f;
tstRslt.PressOutStart = 1000.0f;
tstRslt.TempInStart = 20.0f;
tstRslt.TempOutStart = 20.0f;
tstRslt.TempDivStart = 20.0f;
tstRslt.PressInEnd = 1000.0f;
tstRslt.PressOutEnd = 1000.0f;
tstRslt.TempInEnd = 20.0f;
tstRslt.TempOutEnd = 20.0f;
tstRslt.TempDivEnd = 20.0f;
tstRslt.PressInAvrg = 1000.0f;
tstRslt.PressOutAvrg = 1000.0f;
tstRslt.TempInAvrg = 20.0f;
tstRslt.TempOutAvrg = 20.0f;
tstRslt.TempDivAvrg = 20.0f;
tstRslt.BatchNr = Program.LocalSettings.BatchNr;
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = 0;
tstRslt.MassEndRaw = 0;
tstRslt.MassEnd = 0;
tstRslt.MassDiff = 0;
tstRslt.DensityIn = Program.LocalSettings.RealDensity;
tstRslt.DensityOut = Program.LocalSettings.RealDensity;
tstRslt.DensityDiv = Program.LocalSettings.RealDensity;
tstRslt.Time = 0;
tstRslt.FlowMass = 0;
tstRslt.FlowVolume = 0;
tstRslt.VolumeCTV = 0;
tstRslt.VolumeMaster = 0;
tstRslt.PulsesMaster = 0;
tstRslt.ConstMaster = 0;
tstRslt.ErrorMaster = 0;
for (int i = 0; i < Program.WMsCount; i++)
{
/// Reference to iPerl water meter or null:
WaterMeters.iPerl.WaterMeter iPerl = (i < iPerlCommunicationForm.waterMeters.Count) ? iPerlCommunicationForm.waterMeters[i] : null;
tstRslt.Meters[i].SerialNr = iPerl.SerialNr;
tstRslt.Meters[i].PulsesPerLiter = 0;
tstRslt.Meters[i].VolumeRef = 0;
tstRslt.Meters[i].Time = 0;
tstRslt.Meters[i].TimeStart = 0;
tstRslt.Meters[i].TimeEnd = 0;
tstRslt.Meters[i].PulsesMaster = 0;
tstRslt.Meters[i].VolumeStart = 0;
tstRslt.Meters[i].VolumeEnd = 0;
tstRslt.Meters[i].VolumeMeter = 0;
tstRslt.Meters[i].VolumeErrorPct = 0;
tstRslt.Meters[i].Passed = (!iPerl.CommFailed && !iPerl.Disabled);
tstRslt.Meters[i].PulsesMeter = 0;
tstRslt.Meters[i].Disabled = iPerl.Disabled;
}
return tstRslt;
}
}
}
@@ -213,7 +213,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
tstRslt.Meters[i].PulsesMaster = oriTestRslt.Meters[i].PulsesMaster;
tstRslt.Meters[i].Disabled = oriTestRslt.Meters[i].Disabled;
if ((iPerl == null) || (Math.Abs(tstRslt.Meters[i].VolumeErrorPct) <= 0.5f))
if ((iPerl == null) || (Math.Abs(oriTestRslt.Meters[i].VolumeErrorPct) <= 0.5f))
{
/// Normal meter or iPerl without correction
tstRslt.Meters[i].VolumeStart = oriTestRslt.Meters[i].VolumeStart;
@@ -307,7 +307,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
tstRslt.Meters[i].PulsesMaster = tstRslt.PulsesMaster;
tstRslt.Meters[i].VolumeStart = 0;
tstRslt.Meters[i].VolumeErrorPct = errorPct;
tstRslt.Meters[i].Passed = (test.ErrLimLo <= errorPct) && (errorPct <= test.ErrLimLo);
tstRslt.Meters[i].Passed = (test.ErrLimLo <= errorPct) && (errorPct <= test.ErrLimHi);
tstRslt.Meters[i].VolumeMeter = test.Volume * (1.0f + 0.01f * errorPct);
tstRslt.Meters[i].PulsesMeter = sensPath.RegisterReaders[i].PulsesPerLtr * tstRslt.Meters[i].VolumeMeter;
tstRslt.Meters[i].Disabled = false;