Make Q2 correction from ... modifications, no Q2 factors written in case of large error, version. 1.5.136

This commit is contained in:
Milan Hanajik
2015-10-23 18:32:58 +02:00
parent 1892f9de9f
commit e52f9ea9e7
5 changed files with 22 additions and 16 deletions
@@ -1036,12 +1036,18 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
if (wm.CommFailed) return CommErr.CommFailed;
if (OpenPort(wm) != 0) return CommErr.OpenPort; /// Open RFID port
CommErr error = CommErr.Write;
/// Write Q2 corrections
double q2CorrectionFactor = wm.Q2CorrectionFactor();
if (q2CorrectionFactor == 0)
{
resultStr = string.Format("Q2 factors = 0 (writing bypassed)");
return CommErr.None;
}
if (OpenPort(wm) != 0) return CommErr.OpenPort; /// Open RFID port
CommErr error = CommErr.Write;
Byte q2CorrRFlow = (byte)((int)Math.Round(q2CorrectionFactor / 2) & 0x000000FF);
Byte q2CorrLFlow = (byte)((int)Math.Round(q2CorrectionFactor) & 0x000000FF);
byte[] wrData = new byte[2] { q2CorrRFlow, q2CorrLFlow };
@@ -218,7 +218,10 @@ 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(oriTestRslt.Meters[i].VolumeErrorPct) <= 0.5f))
if (iPerl == null ||
Math.Abs(oriTestRslt.Meters[i].VolumeErrorPct) <= 0.5f ||
oriTestRslt.Meters[i].VolumeErrorPct < oriTestRslt.ErrLimLo ||
oriTestRslt.Meters[i].VolumeErrorPct > oriTestRslt.ErrLimHi)
{
/// Normal meter or iPerl without correction
tstRslt.Meters[i].VolumeStart = oriTestRslt.Meters[i].VolumeStart;