IperlHead.CalculateQ2CorrectionFactor( ) bug fix for R400, etc, ver. 2.27.1873

This commit is contained in:
Milan Hanajik 2022-03-11 00:13:47 +01:00
parent 8ef21b3831
commit 2a26da6337
3 changed files with 9 additions and 22 deletions

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.27.1871.0")]
[assembly: AssemblyFileVersion("2.27.1871.0")]
[assembly: AssemblyVersion("2.27.1873.0")]
[assembly: AssemblyFileVersion("2.27.1873.0")]

View File

@ -2647,30 +2647,17 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
double q2Correction = 0;
double q2Correction2 = 0; /// L-R direction in case of Q2CorrType.Update and Q2CorrType.ConditionalUpdate
int metroR = 800;
if (string.IsNullOrEmpty(wm.MetrologicalClass()) ||
(wm.MetrologicalClass()[0] != 'R' && wm.MetrologicalClass()[0] != 'r') ||
!int.TryParse(wm.MetrologicalClass().Substring(1), out metroR) ||
metroR <= 0)
{
metroR = 800; /// R800 is the default metrological class
}
if (q2CorrType == Q2CorrType.Update || q2CorrType == Q2CorrType.ConditionalUpdate)
{
/// Calculate two Q2 correction factors from two tests done in both directions
q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom,
metroR, q2adjResult.Q2CorrRL);
q2Correction2 = ihead.CalculateQ2CorrectionFactor(q2adjResult2, ihead.CalibTargetQ2, q2adjTestData2.Qfrom,
metroR, q2adjResult2.Q2CorrLR);
q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrRL);
q2Correction2 = ihead.CalculateQ2CorrectionFactor(q2adjResult2, ihead.CalibTargetQ2, q2adjTestData2.Qfrom, q2adjResult2.Q2CorrLR);
}
else
{
/// Calculate Q2 correction factors from a single test
q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom,
metroR, q2adjResult.Q2CorrRL);
q2Correction2 = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom,
metroR, q2adjResult.Q2CorrLR);
q2Correction = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrRL);
q2Correction2 = ihead.CalculateQ2CorrectionFactor(q2adjResult, ihead.CalibTargetQ2, q2adjTestData.Qfrom, q2adjResult.Q2CorrLR);
}

View File

@ -211,7 +211,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
/// <param name="nominalFlow">Nominal flow in m3/h</param>
/// <param name="currentFactor">0 or the current Q2 correction factor when updating the factor</param>
/// <returns>Calculated Q2 correction factor</returns>
public double CalculateQ2CorrectionFactor(Results.Entities.MeterTestRslt q2adjResult, double calibTarget, double nominalFlow, int metroR, int currentFactor = 0)
public double CalculateQ2CorrectionFactor(Results.Entities.MeterTestRslt q2adjResult, double calibTarget, double nominalFlow, int currentFactor = 0)
{
double nominalTestFlowLph = Common.Units.ConvertTo(Common.Unit.lph, nominalFlow);
double volumeRefShiftedToTarget = q2adjResult.VolumeRef * (1.0 + calibTarget / 100.0);
@ -224,8 +224,8 @@ 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 = (double)currentFactor
- (800.0 / metroR) * (q2adjErrorShiftedToTarget / G) * (volumeRefShiftedToTarget / q2adjResult.VolumeMeter);
double q2CorrectionFactor = Convert.ToDouble(currentFactor)
- (q2adjErrorShiftedToTarget / G) * (volumeRefShiftedToTarget / q2adjResult.VolumeMeter);
log.WarnFormat("CalculateQ2CorrectionFactor() : Pos={0}, PCB#={1}, Error={2}%, CalTarget={3}%, Q2CorrFactor={4}",
Name,