From 5181f75217f280642684063da30b32ae2a7fc210 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Tue, 8 Aug 2023 12:08:23 +0200 Subject: [PATCH] Bug fix in Q2 correction factor calculation when volume = 0, ver. 2.33.2080 --- TBF/Properties/AssemblyInfo.cs | 4 ++-- .../TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index acf98518e..76e14a306 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.33.2079.0")] -[assembly: AssemblyFileVersion("2.33.2079.0")] +[assembly: AssemblyVersion("2.33.2080.0")] +[assembly: AssemblyFileVersion("2.33.2080.0")] diff --git a/TBF/Rig/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs b/TBF/Rig/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs index db58c13de..52ac1f662 100644 --- a/TBF/Rig/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs +++ b/TBF/Rig/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs @@ -224,8 +224,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead double F = D / (nominalTestFlowLph * 10.0); /// Error corrected with 8 Raw Units per minute [%] double G = F / B; /// Error corrected with 1 Raw Unit per minute [%] - double q2CorrectionFactor = Convert.ToDouble(currentFactor) - - (q2adjResult.Error / G) * (q2adjResult.VolumeRef / q2adjResult.VolumeMeter); + /// Do not change the factor for an invalid measurement (q2adjResult.VolumeMeter == 0) + double q2CorrectionFactor = (Math.Abs(q2adjResult.VolumeMeter) <= float.Epsilon) ? Convert.ToDouble(currentFactor) : + Convert.ToDouble(currentFactor) - (q2adjResult.Error / G) * (q2adjResult.VolumeRef / q2adjResult.VolumeMeter); log.WarnFormat("CalculateQ2CorrectionFactor() : Pos={0}, PCB#={1}, Error={2}%, Q2CorrFactor={3}", Name,