Q2 correction for Suez (RL, LR) modified, 'Q2 correction check Q2bc Q2ac' test method implemented.

This commit is contained in:
Milan Hanajik 2018-11-09 15:56:22 +01:00
parent 73ea0ff586
commit bd9c3aa5e2
3 changed files with 177 additions and 7 deletions

View File

@ -1869,12 +1869,24 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
q2CorrRL = (byte)((int)Math.Round(q2Correction) & 0x000000FF);
q2CorrLR = (byte)((int)Math.Round(q2Correction) & 0x000000FF);
}
else if (q2CorrType == Q2CorrType.RL)
else if (q2CorrType == Q2CorrType.RL) /// SUEZ
{
if (Math.Abs(ihead.Q2ErrWOCorrection) <= 0.5)
{
resultStr = string.Format("Q2 correction = 0 (writing bypassed)");
return CommErr.None;
}
q2CorrRL = (byte)((int)Math.Round(q2Correction) & 0x000000FF);
}
else if (q2CorrType == Q2CorrType.LR)
else if (q2CorrType == Q2CorrType.LR) /// SUEZ
{
if (Math.Abs(ihead.Q2ErrWOCorrection) <= 0.5)
{
resultStr = string.Format("Q2 correction = 0 (writing bypassed)");
return CommErr.None;
}
q2CorrLR = (byte)((int)Math.Round(q2Correction) & 0x000000FF);
}

View File

@ -60,6 +60,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionRLStr);
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionLRStr);
retVal.Add("Q2 corrected from Q2adj");
retVal.Add("Q2 correction check Q2bc Q2ac");
retVal.Add(iPerlCommunicationForm.SetActiveModeStr);
retVal.Add("---");
retVal.Add(iPerlCommunicationForm.Reset2HzCorrectionStr);

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -57,6 +57,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
const string Q2correctedFromCmd = "q2 corrected from ";
const string Q2correctionCheckCmd = "q2 correction check ";
const string Hz2correctedFromCmd = "2Hz corrected from ";
if (testParams.Activity.ToLower().Contains(Q2correctedFromCmd))
@ -77,7 +78,28 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
rList.Add(Event.Done);
return rList;
}
//else if (testParams.Activity.ToLower().Contains(Hz2correctedFromCmd))
else if (testParams.Activity.ToLower().Contains(Q2correctionCheckCmd))
{
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.FlowSetting));
string[] testNames = testParams.Activity.Substring(Q2correctionCheckCmd.Length).Split(new char[] { ' ' });
if (testNames.Length >= 2)
{
CheckQ2Correction(test.Name, testNames[0], testNames[1]);
}
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.Completed));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(test.Name, 0)));
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
IList<Event> rList = new List<Event>(1);
rList.Add(Event.Done);
return rList;
}
//else if (testParams.Activity.ToLower().Contains(Hz2correctedFromCmd))
//{
// TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
// Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.JustStarted));
@ -183,8 +205,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// <summary>
/// Virtually apply Q2 correction to a test used for the correction calculation.
/// </summary>
/// <param name="oriTestRslt">Q2Adj test result</param>
/// <returns>Virtual Q2 test result</returns>
/// <param name="testName">This test name</param>
/// <param name="oriTestRslt">Name of Q2 test done before Q2 correction (Q2adj)</param>
/// <remarks>Assuming this test does not have multiple parts (part = 0)</remarks>
void MakeQ2CorrectedFrom(string testName, string oriTestName)
{
@ -322,5 +344,140 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
}
}
}
}
/// <summary>
/// Check results of 2 tests: before Q2 correction and after Q2 correction.
/// Evaluate whether Q2 correction works OK.
/// </summary>
/// <param name="testName">This test name</param>
/// <param name="testNameQ2bc">Name of Q2 test done before correction</param>
/// <param name="testNameQ2ac">Name of Q2 test done after correction</param>
/// <remarks>Assuming these tests do not have multiple parts (part = 0)</remarks>
void CheckQ2Correction(string testName, string testNameQ2bc, string testNameQ2ac)
{
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(testName, 0);
Results.Entities.TestRslt testRsltQ2bc = ProcessData.BatchRslts.GetTestRslt(testNameQ2bc, 0);
Results.Entities.TestRslt testRsltQ2ac = ProcessData.BatchRslts.GetTestRslt(testNameQ2ac, 0);
if ((tstRslt == null) || (testRsltQ2bc == null) || (testRsltQ2ac == null)) return;
tstRslt.Components = testRsltQ2ac.Components;
/// Auxiliary results, as in SequenceBase.UpdateTemoPressDensAmb()
tstRslt.AmbTempMean = testRsltQ2ac.AmbTempMean;
tstRslt.AmbTempStart = testRsltQ2ac.AmbTempStart;
tstRslt.AmbTempEnd = testRsltQ2ac.AmbTempEnd;
tstRslt.AmbTempMin = testRsltQ2ac.AmbTempMin;
tstRslt.AmbTempMax = testRsltQ2ac.AmbTempMax;
tstRslt.AmbPressMean = testRsltQ2ac.AmbPressMean;
tstRslt.AmbPressStart = testRsltQ2ac.AmbPressStart;
tstRslt.AmbPressEnd = testRsltQ2ac.AmbPressEnd;
tstRslt.AmbPressMin = testRsltQ2ac.AmbPressMin;
tstRslt.AmbPressMax = testRsltQ2ac.AmbPressMax;
tstRslt.AmbHumiMean = testRsltQ2ac.AmbHumiMean;
tstRslt.AmbHumiStart = testRsltQ2ac.AmbHumiStart;
tstRslt.AmbHumiEnd = testRsltQ2ac.AmbHumiEnd;
tstRslt.AmbHumiMin = testRsltQ2ac.AmbHumiMin;
tstRslt.AmbHumiMax = testRsltQ2ac.AmbHumiMax;
tstRslt.PressUpMean = testRsltQ2ac.PressUpMean;
tstRslt.PressUpStart = testRsltQ2ac.PressUpStart;
tstRslt.PressUpEnd = testRsltQ2ac.PressUpEnd;
tstRslt.PressUpMin = testRsltQ2ac.PressUpMin;
tstRslt.PressUpMax = testRsltQ2ac.PressUpMax;
tstRslt.PressDownMean = testRsltQ2ac.PressDownMean;
tstRslt.PressDownStart = testRsltQ2ac.PressDownStart;
tstRslt.PressDownEnd = testRsltQ2ac.PressDownEnd;
tstRslt.PressDownMin = testRsltQ2ac.PressDownMin;
tstRslt.PressDownMax = testRsltQ2ac.PressDownMax;
tstRslt.PressDeltaMean = testRsltQ2ac.PressDeltaMean;
tstRslt.PressDeltaStart = testRsltQ2ac.PressDeltaStart;
tstRslt.PressDeltaEnd = testRsltQ2ac.PressDeltaEnd;
tstRslt.PressDeltaMin = testRsltQ2ac.PressDeltaMin;
tstRslt.PressDeltaMax = testRsltQ2ac.PressDeltaMax;
tstRslt.TempUpMean = testRsltQ2ac.TempUpMean;
tstRslt.TempUpStart = testRsltQ2ac.TempUpStart;
tstRslt.TempUpEnd = testRsltQ2ac.TempUpEnd;
tstRslt.TempUpMin = testRsltQ2ac.TempUpMin;
tstRslt.TempUpMax = testRsltQ2ac.TempUpMax;
tstRslt.TempDownMean = testRsltQ2ac.TempDownMean;
tstRslt.TempDownStart = testRsltQ2ac.TempDownStart;
tstRslt.TempDownEnd = testRsltQ2ac.TempDownEnd;
tstRslt.TempDownMin = testRsltQ2ac.TempDownMin;
tstRslt.TempDownMax = testRsltQ2ac.TempDownMax;
tstRslt.TempDivMean = testRsltQ2ac.TempDivMean;
tstRslt.TempDivStart = testRsltQ2ac.TempDivStart;
tstRslt.TempDivEnd = testRsltQ2ac.TempDivEnd;
tstRslt.TempDivMin = testRsltQ2ac.TempDivMin;
tstRslt.TempDivMax = testRsltQ2ac.TempDivMax;
tstRslt.DensityIn = testRsltQ2ac.DensityIn;
tstRslt.DensityLine = testRsltQ2ac.DensityLine;
tstRslt.DensityDiv = testRsltQ2ac.DensityDiv;
tstRslt.StartTime = testRsltQ2ac.StartTime;
tstRslt.EndTime = testRsltQ2ac.EndTime;
tstRslt.FlowSetTime = testRsltQ2ac.FlowSetTime;
tstRslt.TestTime = testRsltQ2ac.TestTime;
tstRslt.PulsesMaster = testRsltQ2ac.PulsesMaster;
tstRslt.ConstMasterRaw = testRsltQ2ac.ConstMasterRaw;
tstRslt.ConstMaster = testRsltQ2ac.ConstMaster;
tstRslt.MassStartRaw = testRsltQ2ac.MassStartRaw;
tstRslt.MassStart = testRsltQ2ac.MassStart;
tstRslt.MassEndRaw = testRsltQ2ac.MassEndRaw;
tstRslt.MassEnd = testRsltQ2ac.MassEnd;
tstRslt.Buoyancy = testRsltQ2ac.Buoyancy;
tstRslt.FlowMass = testRsltQ2ac.FlowMass;
tstRslt.FlowVolume = testRsltQ2ac.FlowVolume;
tstRslt.VolumeCTV = testRsltQ2ac.VolumeCTV;
tstRslt.VolumeMaster = testRsltQ2ac.VolumeMaster;
tstRslt.ErrorMaster = testRsltQ2ac.ErrorMaster;
tstRslt.FlowMean = testRsltQ2ac.FlowMean;
tstRslt.FlowMin = testRsltQ2ac.FlowMin;
tstRslt.FlowMax = testRsltQ2ac.FlowMax;
tstRslt.Custom1 = testRsltQ2ac.Custom1;
tstRslt.Custom2 = testRsltQ2ac.Custom2;
tstRslt.Custom3 = testRsltQ2ac.Custom3;
tstRslt.Custom4 = testRsltQ2ac.Custom4;
tstRslt.Custom5 = testRsltQ2ac.Custom5;
tstRslt.Custom6 = testRsltQ2ac.Custom6;
tstRslt.Custom7 = testRsltQ2ac.Custom7;
tstRslt.Custom8 = testRsltQ2ac.Custom8;
for (int i = 0; i < ProcessData.BatchRslts.WMPositionsCount; i++)
{
Results.Entities.MeterTestRslt meterRslt = ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
Results.Entities.MeterTestRslt meterRsltQ2bc = ProcessData.BatchRslts.GetMeterTestRslt(testNameQ2bc, i, CompoundMeterId.Single);
Results.Entities.MeterTestRslt meterRsltQ2ac = ProcessData.BatchRslts.GetMeterTestRslt(testNameQ2ac, i, CompoundMeterId.Single);
if ((meterRslt != null) && (meterRsltQ2bc != null) && (meterRsltQ2ac != null))
{
meterRslt.PulsesMeter = meterRsltQ2ac.PulsesMeter;
meterRslt.PulsesMaster = meterRsltQ2ac.PulsesMaster;
meterRslt.PulsesPerLiter = meterRsltQ2ac.PulsesPerLiter;
meterRslt.VolumeRef = meterRsltQ2ac.VolumeRef;
meterRslt.TestTime = meterRsltQ2ac.TestTime;
meterRslt.VolumeStart = meterRsltQ2ac.VolumeStart;
meterRslt.VolumeEnd = meterRsltQ2ac.VolumeEnd;
meterRslt.VolumeMeter = meterRsltQ2ac.VolumeMeter;
meterRslt.Error = meterRsltQ2ac.Error;
meterRslt.TestDone = meterRsltQ2ac.TestDone;
tstRslt.TestDone = true;
if (((meterRsltQ2bc.Error < -0.5f) && (meterRsltQ2ac.Error < meterRsltQ2bc.Error)) ||
((meterRsltQ2bc.Error > +0.5f) && (meterRsltQ2ac.Error > meterRsltQ2bc.Error)))
{
/// Q2 correction check failed
meterRslt.Passed = false;
}
else
{
/// Q2 correction check passed
meterRslt.Passed = meterRsltQ2ac.Passed;
}
}
}
}
}
}