CombinedWithDetection : Extra test parameters 'UseAinsteadOfB' and 'DetectedFlowShift', ver. 3.9.2136
This commit is contained in:
parent
05665288ab
commit
b931ed62ff
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("3.9.2135.0")]
|
||||
[assembly: AssemblyFileVersion("3.9.2135.0")]
|
||||
[assembly: AssemblyVersion("3.9.2136.0")]
|
||||
[assembly: AssemblyFileVersion("3.9.2136.0")]
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
@ -21,7 +19,9 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
public double InitQto; /// Tested flow high range related to the detected flow
|
||||
public double TargetQ; /// Target=terminal flow durning detection when increasing or decreasing the flow
|
||||
public float RateOfChange; /// Each step is calculated as (TargetQfrom - Qfrom) * RateOfChange, text form is displayed in % (*100)
|
||||
public float DetectionThreshold; /// Drop of frequency for the detection, text form is displayed in % (*100)
|
||||
public float DetectionThreshold; /// Drop of frequency for the detection, text form is displayed in % (*100)
|
||||
public bool UseAinsteadOfB; /// true = Uses 'average flow After' instead of the 'average flow Before'
|
||||
public double DetectedFlowShift; /// Detected flow shift in [m3/h]
|
||||
public float OffsetPulsesFreq; /// Offset frequency of pulses of the small WM for the detection in Hz
|
||||
public bool SupressTrills; /// Main meter readings are ignored during test (suitable for small flows)
|
||||
|
||||
@ -32,6 +32,8 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
TargetQ = 3.0;
|
||||
RateOfChange = 0.05f;
|
||||
DetectionThreshold = 0.25f;
|
||||
UseAinsteadOfB = false;
|
||||
DetectedFlowShift = 0;
|
||||
OffsetPulsesFreq = 1.0f;
|
||||
SupressTrills = false;
|
||||
}
|
||||
@ -44,6 +46,8 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
string.Format(Strings.Target_0, "Q [m3/h]" ),
|
||||
Strings.RateOfChangePct,
|
||||
Strings.DetectionThresholdPct,
|
||||
"Use A instead of B",
|
||||
"Detected flow shift [m3/h]",
|
||||
"Offset pulses freq.",
|
||||
Strings.SupressWMTrills,
|
||||
};
|
||||
@ -59,8 +63,10 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
case 2: return TargetQ.ToString();
|
||||
case 3: return (100.0f * RateOfChange).ToString();
|
||||
case 4: return (100.0f * DetectionThreshold).ToString();
|
||||
case 5: return OffsetPulsesFreq.ToString();
|
||||
case 6: return SupressTrills ? Strings.yes : Strings.no;
|
||||
case 5: return UseAinsteadOfB ? Strings.yes : Strings.no;
|
||||
case 6: return DetectedFlowShift.ToString();
|
||||
case 7: return OffsetPulsesFreq.ToString();
|
||||
case 8: return SupressTrills ? Strings.yes : Strings.no;
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
@ -74,8 +80,10 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
case 2: TargetQ = Utils.ParseUDouble(strValue); return CfgUpdateFlags.None;
|
||||
case 3: RateOfChange = Utils.ParseUFloat(strValue) / 100.0f; return CfgUpdateFlags.None;
|
||||
case 4: DetectionThreshold = Utils.ParseUFloat(strValue) / 100.0f; return CfgUpdateFlags.None;
|
||||
case 5: OffsetPulsesFreq = Utils.ParseUFloat(strValue); return CfgUpdateFlags.None;
|
||||
case 6: SupressTrills = strValue.Equals(Strings.yes); return CfgUpdateFlags.None;
|
||||
case 5: UseAinsteadOfB = strValue.Equals(Strings.yes); return CfgUpdateFlags.None;
|
||||
case 6: DetectedFlowShift = Utils.ParseSDouble(strValue); return CfgUpdateFlags.None;
|
||||
case 7: OffsetPulsesFreq = Utils.ParseUFloat(strValue); return CfgUpdateFlags.None;
|
||||
case 8: SupressTrills = strValue.Equals(Strings.yes); return CfgUpdateFlags.None;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
@ -95,13 +103,17 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
break;
|
||||
case 3: /// RateOfChange
|
||||
case 4: /// DetectionThreshold
|
||||
case 5: /// OffsetPulsesFreq
|
||||
case 7: /// OffsetPulsesFreq
|
||||
if (Utils.TryParseUFloat(strValue, out fdummy)) return true;
|
||||
break;
|
||||
case 6: /// SupressTrills
|
||||
case 5: /// UseAinsteadOfB
|
||||
case 8: /// SupressTrills
|
||||
if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true;
|
||||
break;
|
||||
default:
|
||||
case 6: /// DetectedFlowShift
|
||||
if (Utils.TryParseSDouble(strValue, out ddummy)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
@ -117,6 +129,8 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
prms.TargetQ = this.TargetQ;
|
||||
prms.RateOfChange = this.RateOfChange;
|
||||
prms.DetectionThreshold = this.DetectionThreshold;
|
||||
prms.UseAinsteadOfB = this.UseAinsteadOfB;
|
||||
prms.DetectedFlowShift = this.DetectedFlowShift;
|
||||
prms.OffsetPulsesFreq = this.OffsetPulsesFreq;
|
||||
prms.SupressTrills = this.SupressTrills;
|
||||
}
|
||||
|
||||
@ -257,7 +257,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
|
||||
/// Current values
|
||||
flowsForDetection[0] = RefFlow.Val;
|
||||
pulseFreqsForDetection[0] = 0.0f;
|
||||
pulseFreqsForDetection[0] = 0.0;
|
||||
int startTime = StateMachine.Time;
|
||||
int lastTime = StateMachine.Time;
|
||||
|
||||
@ -274,6 +274,11 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
|
||||
do
|
||||
{
|
||||
///
|
||||
/// Switching flow detection loop
|
||||
///
|
||||
|
||||
/// Make one regulation valve step
|
||||
State.Create(string.Format("{0}({1}) : Change the RV position", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
@ -294,25 +299,28 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
/// Update FIFO buffers for the reference flow and the frequency of pulses
|
||||
///
|
||||
|
||||
/// Last pulses are kept to calculate differences
|
||||
/// Store previous pulses counts to calculate differences
|
||||
for (int i = 0; i < 2 * TBF.Data.CompoundWMsCount; i++) lastWMPulses[i] = RegisterReaders[i].WMPulses;
|
||||
|
||||
/// Read new pulses counts from water meters
|
||||
switch (ReadRegistersTempPressAmbient(measureOperations, false))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
|
||||
/// Calculate difference of pulses for the detected meter (aux. meter)
|
||||
int wmIx = Math.Max(0, test.Part - 1) * 2 + 1;
|
||||
double wmPulsesDiff = RegisterReaders[wmIx].WMPulses - lastWMPulses[wmIx];
|
||||
|
||||
/// Shift data in the detection buffers
|
||||
for (int i = DetectionBufferSize - 2; i >= 0; i--)
|
||||
{
|
||||
flowsForDetection[i + 1] = flowsForDetection[i];
|
||||
pulseFreqsForDetection[i + 1] = pulseFreqsForDetection[i];
|
||||
}
|
||||
|
||||
switch (ReadRegistersTempPressAmbient(measureOperations, false))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
|
||||
flowsForDetection[0] = cBrd.RefFrequency * outPath.FlowMeter.NominalFlow / outPath.FlowMeter.NominalFreq;
|
||||
double diff = RegisterReaders[Math.Max(0, test.Part - 1) * 2 + 1].WMPulses - lastWMPulses[Math.Max(0, test.Part - 1) * 2 + 1];
|
||||
pulseFreqsForDetection[0] = diff / (double)(StateMachine.Time - lastTime);
|
||||
pulseFreqsForDetection[0] = wmPulsesDiff / (StateMachine.Time - lastTime);
|
||||
lastTime = StateMachine.Time;
|
||||
}
|
||||
|
||||
@ -374,7 +382,8 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
aveFreqBefore.ToString("F2"),
|
||||
aveFreqAfter.ToString("F2")));
|
||||
|
||||
detectedFlow = aveFlowBefore;
|
||||
detectedFlow = (methodCfg.TestParams.UseAinsteadOfB ? aveFlowAfter : aveFlowBefore)
|
||||
+ methodCfg.TestParams.DetectedFlowShift;
|
||||
|
||||
if (isRise)
|
||||
{
|
||||
@ -393,7 +402,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
}
|
||||
while (!detected && !targetReached);
|
||||
|
||||
if (isRise)
|
||||
if (isRise)
|
||||
{
|
||||
Qrise = detectedFlow;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user