1. Profiles for Compound meters, 2. TestMethods.CombinedWithDetection modifications.
This commit is contained in:
parent
a027f3f544
commit
ad7abe5471
@ -477,8 +477,10 @@ namespace Common
|
||||
public enum TestProfile
|
||||
{
|
||||
UserDefined,
|
||||
UserDefinedCompound,
|
||||
UserDefinedHeatMeter,
|
||||
Protected, /// The first protected one
|
||||
ProtectedCompound,
|
||||
ProtectedHeatMeter,
|
||||
}
|
||||
|
||||
|
||||
@ -24,11 +24,18 @@ namespace Common
|
||||
{
|
||||
switch (pt)
|
||||
{
|
||||
case ProfileType.Q3R: return FlowNames.Q3Q2Q1;
|
||||
case ProfileType.QnClassColdWater: return FlowNames.QnQtQmin;
|
||||
case ProfileType.QnClassHotWater: return FlowNames.QnQtQmin;
|
||||
case ProfileType.QpQi: return FlowNames.QpQi;
|
||||
default: return FlowNames.Q3Q2Q1;
|
||||
case ProfileType.Q3R:
|
||||
case ProfileType.Q3RCompound:
|
||||
return FlowNames.Q3Q2Q1;
|
||||
case ProfileType.QnClassColdWater:
|
||||
case ProfileType.QnClassHotWater:
|
||||
case ProfileType.QnClassCompound:
|
||||
return FlowNames.QnQtQmin;
|
||||
case ProfileType.QpQi:
|
||||
case ProfileType.QpQiCompound:
|
||||
return FlowNames.QpQi;
|
||||
default:
|
||||
return FlowNames.Q3Q2Q1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
56
TBF/Resources/Strings.Designer.cs
generated
56
TBF/Resources/Strings.Designer.cs
generated
@ -19,7 +19,7 @@ namespace TBF.Resources {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Strings {
|
||||
@ -114,6 +114,24 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _aux.
|
||||
/// </summary>
|
||||
internal static string _aux {
|
||||
get {
|
||||
return ResourceManager.GetString("_aux", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to _main.
|
||||
/// </summary>
|
||||
internal static string _main {
|
||||
get {
|
||||
return ResourceManager.GetString("_main", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <none>.
|
||||
/// </summary>
|
||||
@ -1392,6 +1410,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to determine.
|
||||
/// </summary>
|
||||
internal static string determine {
|
||||
get {
|
||||
return ResourceManager.GetString("determine", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Device.
|
||||
/// </summary>
|
||||
@ -2508,6 +2535,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Initial {0}.
|
||||
/// </summary>
|
||||
internal static string Initial_0 {
|
||||
get {
|
||||
return ResourceManager.GetString("Initial_0", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Invalid {0}.
|
||||
/// </summary>
|
||||
@ -5856,6 +5892,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Target {0}.
|
||||
/// </summary>
|
||||
internal static string Target_0 {
|
||||
get {
|
||||
return ResourceManager.GetString("Target_0", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Target flow high [m3/h]:.
|
||||
/// </summary>
|
||||
@ -5892,15 +5937,6 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Target Q [m3/h].
|
||||
/// </summary>
|
||||
internal static string TargetQ {
|
||||
get {
|
||||
return ResourceManager.GetString("TargetQ", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Tarring.
|
||||
/// </summary>
|
||||
|
||||
@ -903,8 +903,8 @@
|
||||
<data name="T_out" xml:space="preserve">
|
||||
<value>T out</value>
|
||||
</data>
|
||||
<data name="TargetQ" xml:space="preserve">
|
||||
<value>Cílové Q [m3/h]</value>
|
||||
<data name="Target_0" xml:space="preserve">
|
||||
<value>Cílový {0}</value>
|
||||
</data>
|
||||
<data name="Tarring" xml:space="preserve">
|
||||
<value>Dehtování</value>
|
||||
@ -1734,4 +1734,10 @@
|
||||
<data name="default_printer" xml:space="preserve">
|
||||
<value>předvolená tiskárna</value>
|
||||
</data>
|
||||
<data name="determine" xml:space="preserve">
|
||||
<value>zjistit</value>
|
||||
</data>
|
||||
<data name="Initial_0" xml:space="preserve">
|
||||
<value>Počáteční {0}</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -2202,4 +2202,7 @@
|
||||
<data name="Wait_until" xml:space="preserve">
|
||||
<value>Warten bis</value>
|
||||
</data>
|
||||
<data name="determine" xml:space="preserve">
|
||||
<value>feststellen</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -522,8 +522,8 @@
|
||||
<data name="RelativeQto" xml:space="preserve">
|
||||
<value>Relative Q to</value>
|
||||
</data>
|
||||
<data name="TargetQ" xml:space="preserve">
|
||||
<value>Target Q [m3/h]</value>
|
||||
<data name="Target_0" xml:space="preserve">
|
||||
<value>Target {0}</value>
|
||||
</data>
|
||||
<data name="Compound_meters" xml:space="preserve">
|
||||
<value>Compound meters</value>
|
||||
@ -2407,4 +2407,16 @@
|
||||
<data name="Show_cycle_beginning_form" xml:space="preserve">
|
||||
<value>Show cycle beginning form</value>
|
||||
</data>
|
||||
<data name="determine" xml:space="preserve">
|
||||
<value>determine</value>
|
||||
</data>
|
||||
<data name="_aux" xml:space="preserve">
|
||||
<value>_aux</value>
|
||||
</data>
|
||||
<data name="_main" xml:space="preserve">
|
||||
<value>_main</value>
|
||||
</data>
|
||||
<data name="Initial_0" xml:space="preserve">
|
||||
<value>Initial {0}</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
@ -17,9 +17,9 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CombinedWithDetTestParams) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public double InitQfrom; /// Tested flow low range related to the detected flow
|
||||
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 double RelativeQfrom; /// Tested flow low range related to the detected flow
|
||||
public double RelativeQto; /// Tested flow high range related to the detected 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 OffsetPulsesFreq; /// Offset frequency of pulses of the small WM for the detection in Hz
|
||||
@ -27,22 +27,22 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
TargetQ = 3.0;
|
||||
RelativeQfrom = -0.4;
|
||||
RelativeQto = -0.2;
|
||||
RateOfChange = 0.05f;
|
||||
InitQfrom = 1.0;
|
||||
InitQto = 1.1;
|
||||
TargetQ = 3.0;
|
||||
RateOfChange = 0.05f;
|
||||
DetectionThreshold = 0.25f;
|
||||
OffsetPulsesFreq = 1.0f;
|
||||
SupressTrills = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
Strings.TargetQ,
|
||||
Strings.RelativeQfrom,
|
||||
Strings.RelativeQto,
|
||||
Strings.RateOfChangePct,
|
||||
string.Format(Strings.Initial_0, Strings.Q_from + " [m3/h]" ),
|
||||
string.Format(Strings.Initial_0, Strings.Q_to + " [m3/h]" ),
|
||||
string.Format(Strings.Target_0, "Q [m3/h]" ),
|
||||
Strings.RateOfChangePct,
|
||||
Strings.DetectionThresholdPct,
|
||||
"Offset pulses freq.",
|
||||
Strings.SupressWMTrills,
|
||||
@ -54,13 +54,13 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return TargetQ.ToString();
|
||||
case 1: return RelativeQfrom.ToString();
|
||||
case 2: return RelativeQto.ToString();
|
||||
case 0: return InitQfrom.ToString();
|
||||
case 1: return InitQto.ToString();
|
||||
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 6: return SupressTrills ? Strings.yes : Strings.no;
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
@ -69,9 +69,9 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: TargetQ = Utils.ParseUDouble(strValue); return CfgUpdateFlags.None;
|
||||
case 1: RelativeQfrom = Utils.ParseSDouble(strValue); return CfgUpdateFlags.None;
|
||||
case 2: RelativeQto = Utils.ParseSDouble(strValue); return CfgUpdateFlags.None;
|
||||
case 0: InitQfrom = Utils.ParseUDouble(strValue); return CfgUpdateFlags.None;
|
||||
case 1: InitQto = Utils.ParseUDouble(strValue); return CfgUpdateFlags.None;
|
||||
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;
|
||||
@ -88,19 +88,17 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
double ddummy;
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
case 0: /// InitQfrom
|
||||
case 1: /// InitQto
|
||||
case 2: /// TargetQ
|
||||
if (Utils.TryParseUDouble(strValue, out ddummy)) return true;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 3: /// RateOfChange
|
||||
case 4: /// DetectionThreshold
|
||||
case 5: /// OffsetPulsesFreq
|
||||
if (Utils.TryParseUFloat(strValue, out fdummy)) return true;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
if (Utils.TryParseSDouble(strValue, out ddummy)) return true;
|
||||
break;
|
||||
case 6:
|
||||
case 6: /// SupressTrills
|
||||
if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true;
|
||||
break;
|
||||
default:
|
||||
@ -114,10 +112,10 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
|
||||
void CopyContentTo(CombinedWithDetTestParams prms)
|
||||
{
|
||||
prms.TargetQ = this.TargetQ;
|
||||
prms.RelativeQfrom = this.RelativeQfrom;
|
||||
prms.RelativeQto = this.RelativeQto;
|
||||
prms.RateOfChange = this.RateOfChange;
|
||||
prms.InitQfrom = this.InitQfrom;
|
||||
prms.InitQto = this.InitQto;
|
||||
prms.TargetQ = this.TargetQ;
|
||||
prms.RateOfChange = this.RateOfChange;
|
||||
prms.DetectionThreshold = this.DetectionThreshold;
|
||||
prms.OffsetPulsesFreq = this.OffsetPulsesFreq;
|
||||
prms.SupressTrills = this.SupressTrills;
|
||||
|
||||
@ -24,7 +24,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
/// </summary>
|
||||
/// <param name="devices">Devices</param>
|
||||
/// <returns>true when capabilities of devices are OK</returns>
|
||||
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
|
||||
public static bool CheckDeviceCaps(Test test, OutputPath devices, out string message)
|
||||
{
|
||||
if (!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
|
||||
{
|
||||
@ -65,15 +65,16 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
return true;
|
||||
}
|
||||
|
||||
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
|
||||
bool isDelayedStart, CombinedWithDetTestParams testParams,
|
||||
Common.DebugMode debugLevel)
|
||||
public IList<Event> Execute(Test test, int repetitionNr, bool isLastRepetition,
|
||||
bool isDelayedStart, TestMethodCfg methodCfg, DebugMode debugLevel)
|
||||
{
|
||||
if (debugLevel == Common.DebugMode.Simulate)
|
||||
if (debugLevel == DebugMode.Simulate)
|
||||
{
|
||||
return Simulate(test, repetitionNr, isLastRepetition, testParams);
|
||||
return Simulate(test, repetitionNr, isLastRepetition);
|
||||
}
|
||||
|
||||
bool isRise = methodCfg.IsRise;
|
||||
|
||||
ControlBoard.Uni.UniCB cBrd = StateMachine.ControlBoard as ControlBoard.Uni.UniCB;
|
||||
IScale scale = cBrd.Devices.Scale as IScale;
|
||||
|
||||
@ -86,7 +87,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
|
||||
if (test.Part < 0 || test.Part > TBF.Data.CompoundWMsCount)
|
||||
{
|
||||
UiBridge.Bridge.OnError(this, string.Format("Test 'Part' should be '-' or 1 .. {0}", TBF.Data.CompoundWMsCount));
|
||||
Bridge.OnError(this, string.Format("Test 'Part' should be '-' or 1 .. {0}", TBF.Data.CompoundWMsCount));
|
||||
return new List<Event> { Event.ConfigurationError };
|
||||
}
|
||||
|
||||
@ -221,7 +222,8 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(outPath.RegValve.SetFlowAndMeasureOp(outPath.FlowMeter, test.Qfrom, test.Qto, RefFlow, FlowSettingTimeoutSec, (float)test.ShortPulses))
|
||||
.AddOperation(outPath.RegValve.SetFlowAndMeasureOp(outPath.FlowMeter,
|
||||
methodCfg.TestParams.InitQfrom, methodCfg.TestParams.InitQto, RefFlow, FlowSettingTimeoutSec, test.ShortPulses))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@ -262,8 +264,8 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
int lastTime = StateMachine.Time;
|
||||
|
||||
/// Detection parameters
|
||||
float rvPulse = (testParams.TargetQ > (test.Qfrom + test.Qto) / 2.0) ? 0.05f : -0.05f; /// rise(+) or fall(-)
|
||||
rvPulse *= (100.0f * testParams.RateOfChange);
|
||||
float rvPulse = isRise ? 0.05f : -0.05f; /// rise(+) or fall(-)
|
||||
rvPulse *= (100.0f * methodCfg.TestParams.RateOfChange);
|
||||
|
||||
bool detected = false;
|
||||
bool targetReached = false;
|
||||
@ -362,38 +364,38 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
double aveFreqAfter = 0;
|
||||
foreach (var f in freqBefore) aveFreqBefore += f;
|
||||
foreach (var f in freqAfter) aveFreqAfter += f;
|
||||
aveFreqBefore /= (double)DetectionKernelSize;
|
||||
aveFreqAfter /= (double)DetectionKernelSize;
|
||||
aveFreqBefore /= DetectionKernelSize;
|
||||
aveFreqAfter /= DetectionKernelSize;
|
||||
|
||||
UiBridge.Bridge.OnCompoundDetection(this, string.Format("time={0}, flow{1}, aveFlowB={2}, aveFlowA={3}, pulseFreq={4}, aveFreqB={5}, aveFreqA={6}",
|
||||
StateMachine.Time - startTime,
|
||||
flowsForDetection[0].ToString("F2"),
|
||||
aveFlowBefore.ToString("F2"),
|
||||
aveFlowAfter.ToString("F2"),
|
||||
pulseFreqsForDetection[0].ToString("F2"),
|
||||
aveFreqBefore.ToString("F2"),
|
||||
aveFreqAfter.ToString("F2")));
|
||||
Bridge.OnCompoundDetection(this, string.Format("time={0}, flow{1}, aveFlowB={2}, aveFlowA={3}, pulseFreq={4}, aveFreqB={5}, aveFreqA={6}",
|
||||
StateMachine.Time - startTime,
|
||||
flowsForDetection[0].ToString("F2"),
|
||||
aveFlowBefore.ToString("F2"),
|
||||
aveFlowAfter.ToString("F2"),
|
||||
pulseFreqsForDetection[0].ToString("F2"),
|
||||
aveFreqBefore.ToString("F2"),
|
||||
aveFreqAfter.ToString("F2")));
|
||||
|
||||
detectedFlow = aveFlowBefore;
|
||||
|
||||
if (rvPulse > 0)
|
||||
if (isRise)
|
||||
{
|
||||
/// rise
|
||||
detected = (aveFreqAfter < aveFreqBefore * (1 - testParams.DetectionThreshold));
|
||||
targetReached = ((aveFlowAfter + aveFlowBefore) / 2) > testParams.TargetQ;
|
||||
detected = (aveFreqAfter < aveFreqBefore * (1 - methodCfg.TestParams.DetectionThreshold));
|
||||
targetReached = ((aveFlowAfter + aveFlowBefore) / 2) > methodCfg.TestParams.TargetQ;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// fall
|
||||
detected = (aveFreqAfter > (aveFreqBefore + testParams.OffsetPulsesFreq) * (1 + testParams.DetectionThreshold));
|
||||
targetReached = ((aveFlowAfter + aveFlowBefore) / 2) < testParams.TargetQ;
|
||||
detected = (aveFreqAfter > (aveFreqBefore + methodCfg.TestParams.OffsetPulsesFreq) * (1 + methodCfg.TestParams.DetectionThreshold));
|
||||
targetReached = ((aveFlowAfter + aveFlowBefore) / 2) < methodCfg.TestParams.TargetQ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
while (!detected && !targetReached);
|
||||
|
||||
if (rvPulse > 0)
|
||||
if (isRise)
|
||||
{
|
||||
Qrise = detectedFlow;
|
||||
}
|
||||
@ -402,19 +404,29 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
Qfall = detectedFlow;
|
||||
}
|
||||
|
||||
UiBridge.Bridge.OnCompoundDetection(this, string.Format("detected flow={0}", detectedFlow.ToString("F2")));
|
||||
Bridge.OnCompoundDetection(this, string.Format("detected flow={0}", detectedFlow.ToString("F2")));
|
||||
|
||||
double qfrom_detected = detectedFlow + testParams.RelativeQfrom;
|
||||
double qto_detected = detectedFlow + testParams.RelativeQto;
|
||||
double qfromAfterDetection;
|
||||
double qtoAfterDetection;
|
||||
bool goBackToInitFlow;
|
||||
///
|
||||
if (test.IsFromToInPct)
|
||||
{
|
||||
qfromAfterDetection = detectedFlow * test.Qfrom / 100;
|
||||
qtoAfterDetection = detectedFlow * test.Qto / 100;
|
||||
goBackToInitFlow = (isRise && (test.Qfrom * test.Qto < 10000)) || (!isRise && (test.Qfrom * test.Qto > 10000));
|
||||
}
|
||||
else
|
||||
{
|
||||
qfromAfterDetection = detectedFlow + test.Qfrom;
|
||||
qtoAfterDetection = detectedFlow + test.Qto;
|
||||
goBackToInitFlow = (isRise && (test.Qfrom + test.Qto < 0)) || (!isRise && (test.Qfrom + test.Qto > 0));
|
||||
}
|
||||
|
||||
/// Update test results with the test flow determined from the detected switching flow
|
||||
double Qave_lps = (qfrom_detected + qto_detected) / 7.2;
|
||||
/// Update test results with the test flow determined from the detected switching flow
|
||||
double Qave_lps = (qfromAfterDetection + qtoAfterDetection) / 7.2;
|
||||
double testTimeFromDetectedFlow = test.Volume / Qave_lps; /// Test volume wont be changed
|
||||
|
||||
double relativeQave = (testParams.RelativeQfrom + testParams.RelativeQto) / 2.0;
|
||||
bool goBackToInitFlow = ((rvPulse > 0) && (relativeQave < 0)) ||
|
||||
((rvPulse < 0) && (relativeQave > 0));
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.FlowSetting));
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
|
||||
@ -425,7 +437,8 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(cBrd.SetFlowOp(test.Qfrom, test.Qto, RefFlow, FlowSettingTimeoutSec))
|
||||
.AddOperation(cBrd.SetFlowOp(methodCfg.TestParams.InitQfrom,
|
||||
methodCfg.TestParams.InitQto, RefFlow, FlowSettingTimeoutSec))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@ -446,7 +459,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(outPath.RegValve.SetFlowOp(outPath.FlowMeter, qfrom_detected, qto_detected, RefFlow, FlowSettingTimeoutSec, 0))
|
||||
.AddOperation(outPath.RegValve.SetFlowOp(outPath.FlowMeter, qfromAfterDetection, qtoAfterDetection, RefFlow, FlowSettingTimeoutSec, 0))
|
||||
//.AddOp(pOut.RegulValve.SetPositionOp(35.0f, 38.0f, uint.MaxValue))
|
||||
.EnterState();
|
||||
do {
|
||||
@ -508,7 +521,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(cBrd.FlyingStartStopTestOp(test, qfrom_detected, qto_detected, totalPulses, true, isDelayedStart, false, 0, true, DiverterStart, DiverterEnd))
|
||||
.AddOperation(cBrd.FlyingStartStopTestOp(test, qfromAfterDetection, qtoAfterDetection, totalPulses, true, isDelayedStart, false, 0, true, DiverterStart, DiverterEnd))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
@ -713,7 +726,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
oneMTR.PulsesPerLiter = regReader.PulsesPerLtr;
|
||||
|
||||
/// Optionally supress pulses from the large water meter
|
||||
oneMTR.PulsesMeter = (isAux == 0 && testParams.SupressTrills) ? 0 : Convert.ToDouble(regReader.WMPulses);
|
||||
oneMTR.PulsesMeter = (isAux == 0 && methodCfg.TestParams.SupressTrills) ? 0 : Convert.ToDouble(regReader.WMPulses);
|
||||
oneMTR.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses);
|
||||
oneMTR.TestTime = cBrd.TestTime;
|
||||
oneMTR.VolumeStart = 0;
|
||||
@ -832,8 +845,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
}
|
||||
|
||||
|
||||
IList<Event> Simulate(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
|
||||
CombinedWithDetTestParams testParams)
|
||||
IList<Event> Simulate(Test test, int repetitionNr, bool isLastRepetition)
|
||||
{
|
||||
///
|
||||
/// Test method simulation
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig;
|
||||
|
||||
namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
{
|
||||
@ -38,7 +37,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
|
||||
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
|
||||
{
|
||||
return (new CombinedWithDetectionSeq()).Execute(test, repetNr, isLastRepetition, false, testMethodCfg.TestParams, DebugLevel);
|
||||
return new CombinedWithDetectionSeq().Execute(test, repetNr, isLastRepetition, false, testMethodCfg, DebugLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -18,6 +18,10 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new TestMethodCfgCtrl(); }
|
||||
|
||||
|
||||
public bool IsRise;
|
||||
|
||||
|
||||
/// <summary> Test parameters </summary>
|
||||
[XmlIgnore]
|
||||
public CombinedWithDetTestParams TestParams;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
@ -43,12 +43,15 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
riseCheckBox.Checked = config.IsRise;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
}
|
||||
riseCheckBox.Enabled = true;
|
||||
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
@ -58,13 +61,23 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
if (config.Name != nameTextBox.Text)
|
||||
{
|
||||
config.Name = nameTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
||||
}
|
||||
|
||||
return flags;
|
||||
if (config.IsRise != riseCheckBox.Checked)
|
||||
{
|
||||
config.IsRise = riseCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,49 +31,62 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(137, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(27, 60);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// BasicPrinterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "BasicPrinterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.riseCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(137, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(27, 60);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// riseCheckBox
|
||||
//
|
||||
this.riseCheckBox.AutoSize = true;
|
||||
this.riseCheckBox.Enabled = false;
|
||||
this.riseCheckBox.Location = new System.Drawing.Point(137, 86);
|
||||
this.riseCheckBox.Name = "riseCheckBox";
|
||||
this.riseCheckBox.Size = new System.Drawing.Size(138, 17);
|
||||
this.riseCheckBox.TabIndex = 6;
|
||||
this.riseCheckBox.Text = "Rise (unchecked = Fall)";
|
||||
this.riseCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// TestMethodCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.riseCheckBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "TestMethodCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@ -82,5 +95,6 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
}
|
||||
private System.Windows.Forms.CheckBox riseCheckBox;
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ namespace TBF.Rig.TestMethods.SensitivityTest
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
Strings.TargetQ,
|
||||
string.Format(Strings.Target_0, "Q [m3/h]"),
|
||||
Strings.RateOfChangePct,
|
||||
Strings.DetectionThresholdPct,
|
||||
Strings.SupressWMTrills,
|
||||
|
||||
@ -1,21 +1,16 @@
|
||||
///
|
||||
/// Copyright (c) 2019-2022 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Common.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
using TBF.UI.Shared;
|
||||
using TBF.Rig.Output;
|
||||
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
|
||||
|
||||
namespace TBF.UI.Bench.TestProfiles
|
||||
{
|
||||
@ -479,14 +474,14 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
}
|
||||
|
||||
double dummy;
|
||||
if ((e.SubItem == (int)MtrlgyClmn.CoefQfrom && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
|
||||
(e.SubItem == (int)MtrlgyClmn.CoefQto && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
|
||||
(e.SubItem == (int)MtrlgyClmn.ErrLimLo && !Utils.TryParseSDouble(e.DisplayText, out dummy)) ||
|
||||
(e.SubItem == (int)MtrlgyClmn.ErrLimHi && !Utils.TryParseSDouble(e.DisplayText, out dummy)) ||
|
||||
(e.SubItem == (int)MtrlgyClmn.TempLimLo && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
|
||||
(e.SubItem == (int)MtrlgyClmn.TempLimHi && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
|
||||
(e.SubItem == (int)MtrlgyClmn.PressLimLo && !Utils.TryParseUDouble(e.DisplayText, out dummy)) ||
|
||||
(e.SubItem == (int)MtrlgyClmn.PressLimHi && !Utils.TryParseUDouble(e.DisplayText, out dummy)))
|
||||
if (( e.SubItem == (int)MtrlgyClmn.CoefQfrom && !Utils.TryParseUDouble(e.DisplayText, out dummy) ) ||
|
||||
( e.SubItem == (int)MtrlgyClmn.CoefQto && !Utils.TryParseUDouble(e.DisplayText, out dummy) ) ||
|
||||
( e.SubItem == (int)MtrlgyClmn.ErrLimLo && !Utils.TryParseSDouble(e.DisplayText, out dummy) ) ||
|
||||
( e.SubItem == (int)MtrlgyClmn.ErrLimHi && !Utils.TryParseSDouble(e.DisplayText, out dummy) ) ||
|
||||
( e.SubItem == (int)MtrlgyClmn.TempLimLo && !Utils.TryParseUDouble(e.DisplayText, out dummy) ) ||
|
||||
( e.SubItem == (int)MtrlgyClmn.TempLimHi && !Utils.TryParseUDouble(e.DisplayText, out dummy) ) ||
|
||||
( e.SubItem == (int)MtrlgyClmn.PressLimLo && !Utils.TryParseUDouble(e.DisplayText, out dummy) ) ||
|
||||
( e.SubItem == (int)MtrlgyClmn.PressLimHi && !Utils.TryParseUDouble(e.DisplayText, out dummy) ))
|
||||
{
|
||||
/// Cannot parse => revert content of the cell
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
@ -1412,11 +1407,23 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
break;
|
||||
|
||||
case ProfileType.Q3RCompound:
|
||||
newName = (nameId == 1) ? "Q4_main" : (nameId == 2) ? "Q3_main" : (nameId == 3) ? "Q2_main" : (nameId == 4) ? "Qrise-10%" : (nameId == 5) ? "Qfall+10%" : (nameId == 6) ? "Q2_aux" : "Q1_aux";
|
||||
newName = (nameId == 1) ? string.Format("Q4{0}", Strings._main)
|
||||
: (nameId == 2) ? string.Format("Q3{0}", Strings._main)
|
||||
: (nameId == 3) ? string.Format("Q2{0}", Strings._main)
|
||||
: (nameId == 4) ? "Qrise-10%"
|
||||
: (nameId == 5) ? "Qfall+10%"
|
||||
: (nameId == 6) ? string.Format("Q2{0}", Strings._aux)
|
||||
: string.Format("Q1{0}", Strings._aux);
|
||||
break;
|
||||
|
||||
case ProfileType.QnClassCompound:
|
||||
newName = (nameId == 1) ? "Qmax_main" : (nameId == 2) ? "Qn_main" : (nameId == 3) ? "Qt_main" : (nameId == 4) ? "Qrise-10%" : (nameId == 5) ? "Qfall+10%" : (nameId == 6) ? "Qt_aux" : "Qmin_aux";
|
||||
newName = (nameId == 1) ? string.Format("Qmax{0}", Strings._main)
|
||||
: (nameId == 2) ? string.Format("Qn{0}", Strings._main)
|
||||
: (nameId == 3) ? string.Format("Qt{0}", Strings._main)
|
||||
: (nameId == 4) ? "Qrise-10%"
|
||||
: (nameId == 5) ? "Qfall+10%"
|
||||
: (nameId == 6) ? string.Format("Qt{0}", Strings._aux)
|
||||
: string.Format("Qmin{0}", Strings._aux);
|
||||
break;
|
||||
|
||||
case ProfileType.QpQiCompound:
|
||||
@ -1455,13 +1462,13 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
|
||||
case ProfileType.Q3RCompound:
|
||||
case ProfileType.QnClassCompound:
|
||||
ptest.CoefQfrom = (count < 2) ? 0.9 : 1.0;
|
||||
ptest.CoefQto = (count < 2) ? 1.0 : 1.1;
|
||||
ptest.CoefQfrom = (count < 2) ? 0.9 : (count == 3) ? 0.825 : (count == 4) ? 1.1 : 1.0;
|
||||
ptest.CoefQto = (count < 2) ? 1.0 : (count == 3) ? 0.91 : (count == 4) ? 1.21 : 1.1;
|
||||
break;
|
||||
|
||||
case ProfileType.QpQiCompound:
|
||||
ptest.CoefQfrom = (count < 1) ? 0.9 : 1.0;
|
||||
ptest.CoefQto = (count < 1) ? 1.0 : 1.1;
|
||||
ptest.CoefQfrom = (count < 1) ? 0.9 : (count == 2) ? 0.825 : (count == 3) ? 1.1 : 1.0;
|
||||
ptest.CoefQto = (count < 1) ? 1.0 : (count == 2) ? 0.91 : (count == 3) ? 1.21 : 1.1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
#if LANG_PL
|
||||
#define SHOW_Q_TG
|
||||
#endif
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -14,11 +10,13 @@ using log4net;
|
||||
using Common;
|
||||
using Common.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.Resources;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
using TBF.UI.Shared;
|
||||
using TBF.Rig.Sequences;
|
||||
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
|
||||
using TBF.UI.Shared;
|
||||
using Results.Entities;
|
||||
|
||||
namespace TBF.UI.Procedures
|
||||
{
|
||||
@ -66,8 +64,9 @@ namespace TBF.UI.Procedures
|
||||
|
||||
IList<TestParamsCtrl> testParamsCtrls;
|
||||
IList<IProcParamsCtrl> procedureParamsCtrls;
|
||||
IList<IComponent> waterMeters;
|
||||
|
||||
bool unlocked;
|
||||
bool unlocked;
|
||||
|
||||
ProcedureDlg()
|
||||
{
|
||||
@ -311,7 +310,7 @@ namespace TBF.UI.Procedures
|
||||
}
|
||||
}
|
||||
|
||||
IList<IComponent> waterMeters = new List<IComponent>();
|
||||
waterMeters = new List<IComponent>();
|
||||
int addedWMsCount = 0;
|
||||
foreach (var cmpnt in TbfComponents)
|
||||
{
|
||||
@ -449,12 +448,12 @@ namespace TBF.UI.Procedures
|
||||
|
||||
foreach (var test in LoadedProcedure.Tests)
|
||||
{
|
||||
test.VolumeUnit = TBF.Rig.Sequences.ProcessData.VolumeUnit;
|
||||
test.FlowUnit = TBF.Rig.Sequences.ProcessData.FlowUnit;
|
||||
test.MassUnit = TBF.Rig.Sequences.ProcessData.MassUnit;
|
||||
test.TempUnit = TBF.Rig.Sequences.ProcessData.TempUnit;
|
||||
test.PressUnit = TBF.Rig.Sequences.ProcessData.PressUnit;
|
||||
test.LengthUnit = TBF.Rig.Sequences.ProcessData.LengthUnit;
|
||||
test.VolumeUnit = ProcessData.VolumeUnit;
|
||||
test.FlowUnit = ProcessData.FlowUnit;
|
||||
test.MassUnit = ProcessData.MassUnit;
|
||||
test.TempUnit = ProcessData.TempUnit;
|
||||
test.PressUnit = ProcessData.PressUnit;
|
||||
test.LengthUnit = ProcessData.LengthUnit;
|
||||
test.ResetChngdFlags();
|
||||
}
|
||||
|
||||
@ -823,17 +822,32 @@ namespace TBF.UI.Procedures
|
||||
#region Metrology1
|
||||
|
||||
Control[] metrology1Editors;
|
||||
ComboBox qtgBox = new ComboBox();
|
||||
|
||||
public enum MtrlgyClmn
|
||||
void FillQtgComboBoxItems()
|
||||
{
|
||||
qtgBox.Items.Clear();
|
||||
qtgBox.Items.Add(Strings.determine);
|
||||
|
||||
// IWaterMeter wm = waterMeters.FirstOrDefault(x => !(x as IWaterMeter).Disabled) as IWaterMeter;
|
||||
// if (wm != null)
|
||||
// {
|
||||
// qtgBox.Items.Add(wm.Q4_Qmax.ToString());
|
||||
// qtgBox.Items.Add(wm.Q3_Qn.ToString());
|
||||
// qtgBox.Items.Add(wm.Q2_Qt.ToString());
|
||||
// qtgBox.Items.Add(wm.Q1_Qmin.ToString());
|
||||
// }
|
||||
}
|
||||
|
||||
public enum MtrlgyClmn
|
||||
{
|
||||
Name,
|
||||
Part,
|
||||
#if SHOW_Q_TG
|
||||
Qtg,
|
||||
#endif
|
||||
FlowUnit,
|
||||
Qfrom,
|
||||
Qto,
|
||||
FlowUnit,
|
||||
IsFromToInPct,
|
||||
Volume,
|
||||
VolumeUnit,
|
||||
TestTime,
|
||||
@ -850,12 +864,11 @@ namespace TBF.UI.Procedures
|
||||
ListViewEx lv = metrology1ListViewEx;
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 });
|
||||
#if SHOW_Q_TG
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Q_tg, Width = 80 });
|
||||
#endif
|
||||
lv.Columns.Add(new ColumnHeader { Text = "Unit", Width = 50 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Q_from, Width = 80 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Q_to, Width = 80 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = "Unit", Width = 50 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} of {1}", Unit.Pct.ToDescription(), Strings.Q_tg), Width = 50 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Volume, Width = 70 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = "Unit", Width = 50 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} [s]", Strings.Test_time), Width = 70 });
|
||||
@ -865,8 +878,7 @@ namespace TBF.UI.Procedures
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Repeats_nr_chdr, Width = 90 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Method_chdr, Width = 200 });
|
||||
|
||||
methodCBox = new ComboBox();
|
||||
foreach (var m in TestMethods) methodCBox.Items.Add(m.Cfg.Name);
|
||||
FillQtgComboBoxItems();
|
||||
|
||||
var flowUnitBox = new ComboBox();
|
||||
var volUnitBox = new ComboBox();
|
||||
@ -876,16 +888,22 @@ namespace TBF.UI.Procedures
|
||||
if (Units.IsVolume(u)) volUnitBox.Items.Add(u.ToDescription());
|
||||
}
|
||||
|
||||
var isFromToInPctBox = new ComboBox();
|
||||
isFromToInPctBox.Items.Add(Strings.yes);
|
||||
isFromToInPctBox.Items.Add(Strings.no);
|
||||
|
||||
methodCBox = new ComboBox();
|
||||
foreach (var m in TestMethods) methodCBox.Items.Add(m.Cfg.Name);
|
||||
|
||||
metrology1Editors = new Control[]
|
||||
{
|
||||
new TextBox(), /// Name
|
||||
new TextBox(), /// Part
|
||||
#if SHOW_Q_TG
|
||||
new TextBox(), /// Qtg
|
||||
#endif
|
||||
qtgBox, /// Qtg
|
||||
flowUnitBox,
|
||||
new TextBox(), /// Qfrom
|
||||
new TextBox(), /// Qto
|
||||
flowUnitBox,
|
||||
isFromToInPctBox,
|
||||
new TextBox(), /// Volume
|
||||
volUnitBox,
|
||||
new TextBox(), /// Test time
|
||||
@ -925,12 +943,11 @@ namespace TBF.UI.Procedures
|
||||
ListViewItem lvi = new ListViewItem(test.Name); /// Name
|
||||
lvi.Tag = test;
|
||||
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
|
||||
#if SHOW_Q_TG
|
||||
lvi.SubItems.Add(Units.ConvertTo(test.FlowUnit, test.Qtg).ToString()); /// Q_tg (target flow)
|
||||
#endif
|
||||
lvi.SubItems.Add(Units.ConvertTo(test.FlowUnit, test.Qfrom).ToString()); /// Q_from
|
||||
lvi.SubItems.Add(Units.ConvertTo(test.FlowUnit, test.Qto).ToString()); /// Q_to
|
||||
lvi.SubItems.Add(test.Qtg < 0 ? Strings.determine : Units.ConvertTo(test.FlowUnit, test.Qtg).ToString()); /// Q_tg (target flow, -1 = detect)
|
||||
lvi.SubItems.Add(test.FlowUnit.ToDescription());
|
||||
lvi.SubItems.Add(test.IsFromToInPct ? test.Qfrom.ToString(): Units.ConvertTo(test.FlowUnit, test.Qfrom).ToString()); /// Q_from (lower limit of flow)
|
||||
lvi.SubItems.Add(test.IsFromToInPct ? test.Qto.ToString(): Units.ConvertTo(test.FlowUnit, test.Qto).ToString()); /// Q_to (upper limit of flow)
|
||||
lvi.SubItems.Add(test.IsFromToInPct ? Strings.yes : Strings.no);
|
||||
lvi.SubItems.Add(Units.ConvertTo(test.VolumeUnit, test.Volume).ToString()); /// Volume
|
||||
lvi.SubItems.Add(test.VolumeUnit.ToDescription());
|
||||
lvi.SubItems.Add(test.TestTime.ToString());
|
||||
@ -968,19 +985,36 @@ namespace TBF.UI.Procedures
|
||||
int itmp;
|
||||
float tmp;
|
||||
double dtmp;
|
||||
#if SHOW_Q_TG
|
||||
if (test.QtgTextChngd && Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.Qtg].Text, out dtmp))
|
||||
test.Qtg = (float)Units.ConvertFrom(test.FlowUnit, dtmp);
|
||||
#endif
|
||||
if (test.QfromTextChngd && Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.Qfrom].Text, out dtmp))
|
||||
test.Qfrom = Units.ConvertFrom(test.FlowUnit, dtmp);
|
||||
|
||||
if (test.QtoTextChngd && Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.Qto].Text, out dtmp))
|
||||
test.Qto = Units.ConvertFrom(test.FlowUnit, dtmp);
|
||||
if (test.QtgTextChngd)
|
||||
{
|
||||
if (lvi.SubItems[(int)MtrlgyClmn.Qtg].Text == Strings.determine)
|
||||
{
|
||||
test.Qtg = -1.0;
|
||||
}
|
||||
else if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.Qtg].Text, out dtmp))
|
||||
{
|
||||
test.Qtg = Units.ConvertFrom(test.FlowUnit, dtmp);
|
||||
}
|
||||
}
|
||||
|
||||
test.IsFromToInPct = lvi.SubItems[(int)MtrlgyClmn.IsFromToInPct].Text.Equals(Strings.yes);
|
||||
|
||||
if (test.QfromTextChngd && Utils.TryParseSDouble(lvi.SubItems[(int)MtrlgyClmn.Qfrom].Text, out dtmp))
|
||||
{
|
||||
test.Qfrom = test.IsFromToInPct ? dtmp : Units.ConvertFrom(test.FlowUnit, dtmp);
|
||||
}
|
||||
|
||||
if (test.QtoTextChngd && Utils.TryParseSDouble(lvi.SubItems[(int)MtrlgyClmn.Qto].Text, out dtmp))
|
||||
{
|
||||
test.Qto = test.IsFromToInPct ? dtmp : Units.ConvertFrom(test.FlowUnit, dtmp);
|
||||
}
|
||||
|
||||
if (test.VolumeTextChngd && Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.Volume].Text, out dtmp))
|
||||
{
|
||||
test.Volume = Units.ConvertFrom(test.VolumeUnit, dtmp);
|
||||
|
||||
}
|
||||
|
||||
if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.TestTime].Text, out dtmp)) test.TestTime = dtmp;
|
||||
|
||||
if (Utils.TryParseSFloat(lvi.SubItems[(int)MtrlgyClmn.ErrLimLo].Text, out tmp)) test.ErrLimLo = tmp;
|
||||
@ -1000,12 +1034,8 @@ namespace TBF.UI.Procedures
|
||||
{
|
||||
MtrlgyClmn column = (MtrlgyClmn)e.SubItem;
|
||||
|
||||
#if SHOW_Q_TG
|
||||
if (e.SubItem == (int)MtrlgyClmn.Qtg) return;
|
||||
#endif
|
||||
/// Unit change is allowed when locked
|
||||
if ((column != MtrlgyClmn.FlowUnit && column != MtrlgyClmn.VolumeUnit) &&
|
||||
(!unlocked || column >= MtrlgyClmn.ColumnsCount))
|
||||
/// Only a unit change is allowed when locked
|
||||
if (!unlocked && column != MtrlgyClmn.FlowUnit && column != MtrlgyClmn.VolumeUnit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1013,20 +1043,19 @@ namespace TBF.UI.Procedures
|
||||
MtrlgyClmn[] protectedColumns = new MtrlgyClmn[]
|
||||
{
|
||||
MtrlgyClmn.Name,
|
||||
MtrlgyClmn.Qfrom, MtrlgyClmn.Qto,
|
||||
MtrlgyClmn.Qtg, MtrlgyClmn.Qfrom, MtrlgyClmn.Qto, MtrlgyClmn.IsFromToInPct,
|
||||
MtrlgyClmn.ErrLimLo, MtrlgyClmn.ErrLimHi,
|
||||
};
|
||||
if (((e.Item.Tag as Test).Profile >= TestProfile.Protected) && protectedColumns.Contains<MtrlgyClmn>(column)) return;
|
||||
if (((e.Item.Tag as Test).Profile >= TestProfile.Protected) && protectedColumns.Contains(column)) return;
|
||||
|
||||
metrology1ListViewEx.StartEditing(metrology1Editors[e.SubItem], e.Item, e.SubItem);
|
||||
if (column == MtrlgyClmn.Qtg) FillQtgComboBoxItems();
|
||||
|
||||
metrology1ListViewEx.StartEditing(metrology1Editors[e.SubItem], e.Item, e.SubItem);
|
||||
}
|
||||
|
||||
void metrology1ListViewEx_SubItemRightClicked(object sender, SubItemEventArgs e)
|
||||
{
|
||||
#if SHOW_Q_TG
|
||||
if (e.SubItem == (int)MtrlgyClmn.Qtg) return;
|
||||
#endif
|
||||
if (!unlocked || e.SubItem >= (int)MtrlgyClmn.ColumnsCount) return;
|
||||
if (!unlocked) return;
|
||||
|
||||
if (DialogResult.Yes == MessageBox.Show(Strings.Do_you_want_to_copy_this_value_to_all_cells_below_this_cell,
|
||||
Strings.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Question))
|
||||
@ -1036,23 +1065,33 @@ namespace TBF.UI.Procedures
|
||||
System.Drawing.Color backColor = System.Drawing.Color.White;
|
||||
foreach (ListViewItem item in metrology1ListViewEx.Items)
|
||||
{
|
||||
if (value != null && item.SubItems.Count > columnNr)
|
||||
if (item.SubItems.Count > columnNr)
|
||||
{
|
||||
/// This item is below e.Item
|
||||
item.SubItems[columnNr].Text = value;
|
||||
item.SubItems[columnNr].BackColor = backColor;
|
||||
|
||||
switch ((MtrlgyClmn)columnNr)
|
||||
if (item == e.Item)
|
||||
{
|
||||
case MtrlgyClmn.FlowUnit: UpdateFlow(item, Units.FromDescription(value)); break;
|
||||
case MtrlgyClmn.VolumeUnit: UpdateVolume(item, Units.FromDescription(value)); break;
|
||||
/// Set 'value' to the value to be copied
|
||||
value = item.SubItems[columnNr].Text;
|
||||
backColor = item.SubItems[columnNr].BackColor;
|
||||
}
|
||||
else if (value != null)
|
||||
{
|
||||
/// This item is below e.Item
|
||||
item.SubItems[columnNr].Text = value;
|
||||
item.SubItems[columnNr].BackColor = backColor;
|
||||
|
||||
switch ((MtrlgyClmn)columnNr)
|
||||
{
|
||||
case MtrlgyClmn.FlowUnit:
|
||||
UpdateFlow(item, Units.FromDescription(value));
|
||||
break;
|
||||
case MtrlgyClmn.IsFromToInPct:
|
||||
UpdateQfromQto(item, value == Strings.yes);
|
||||
break;
|
||||
case MtrlgyClmn.VolumeUnit:
|
||||
UpdateVolume(item, Units.FromDescription(value));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (item == e.Item)
|
||||
{
|
||||
/// Set 'value' to the value to be copied
|
||||
value = item.SubItems[columnNr].Text;
|
||||
backColor = item.SubItems[columnNr].BackColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1064,8 +1103,7 @@ namespace TBF.UI.Procedures
|
||||
MtrlgyClmn column = (MtrlgyClmn)e.SubItem;
|
||||
Unit newUnit;
|
||||
int dummy;
|
||||
float fdummy;
|
||||
double ddummy;
|
||||
double ddummy = -1.0;
|
||||
|
||||
switch (column)
|
||||
{
|
||||
@ -1078,32 +1116,28 @@ namespace TBF.UI.Procedures
|
||||
if (int.TryParse(e.DisplayText, out dummy) && Data.IsGoodPartNr(dummy)) return; /// OK
|
||||
break;
|
||||
|
||||
#if SHOW_Q_TG
|
||||
case MtrlgyClmn.Qtg:
|
||||
if (Utils.TryParseUFloat(e.DisplayText, out fdummy))
|
||||
{
|
||||
if (e.DisplayText != e.Item.SubItems[e.SubItem].Text) test.QtgTextChngd = true;
|
||||
return; /// OK
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case MtrlgyClmn.FlowUnit:
|
||||
newUnit = Units.FromDescription(e.DisplayText);
|
||||
if (!Units.IsFlow(newUnit)) break;
|
||||
UpdateFlow(e.Item, newUnit);
|
||||
return;
|
||||
|
||||
case MtrlgyClmn.ErrLimLo:
|
||||
case MtrlgyClmn.ErrLimHi:
|
||||
if (Utils.TryParseSFloat(e.DisplayText, out fdummy)) return;
|
||||
if (Utils.TryParseSDouble(e.DisplayText, out ddummy)) return;
|
||||
break;
|
||||
|
||||
case MtrlgyClmn.Uncertainty:
|
||||
if (Utils.TryParseUFloat(e.DisplayText, out fdummy)) return;
|
||||
if (Utils.TryParseUDouble(e.DisplayText, out ddummy)) return;
|
||||
break;
|
||||
|
||||
case MtrlgyClmn.Repeats:
|
||||
if (int.TryParse(e.DisplayText, out dummy)) return; /// OK
|
||||
break;
|
||||
|
||||
case MtrlgyClmn.FlowUnit:
|
||||
newUnit = Units.FromDescription(e.DisplayText);
|
||||
if (!Units.IsFlow(newUnit)) break;
|
||||
UpdateFlow(e.Item, newUnit);
|
||||
case MtrlgyClmn.IsFromToInPct:
|
||||
if (e.DisplayText != Strings.no && e.DisplayText != Strings.yes) break;
|
||||
UpdateQfromQto(e.Item, e.DisplayText == Strings.yes);
|
||||
return;
|
||||
|
||||
case MtrlgyClmn.VolumeUnit:
|
||||
@ -1116,6 +1150,7 @@ namespace TBF.UI.Procedures
|
||||
if (methodCBox.Items.Contains(e.DisplayText)) return;
|
||||
break;
|
||||
|
||||
case MtrlgyClmn.Qtg:
|
||||
case MtrlgyClmn.Qfrom:
|
||||
case MtrlgyClmn.Qto:
|
||||
case MtrlgyClmn.Volume:
|
||||
@ -1123,7 +1158,10 @@ namespace TBF.UI.Procedures
|
||||
|
||||
if (e.DisplayText == e.Item.SubItems[e.SubItem].Text) return; /// Nothing changed
|
||||
|
||||
double qTg = 1.0;
|
||||
double qFromPct = 90.0;
|
||||
double qFrom = 1.0;
|
||||
double qToPct = 100.0;
|
||||
double qTo = 1.0;
|
||||
double volume = 0.0;
|
||||
double testTime = 0.0;
|
||||
@ -1132,30 +1170,104 @@ namespace TBF.UI.Procedures
|
||||
bool calculateTime = false;
|
||||
bool allOk = true;
|
||||
|
||||
if (column == MtrlgyClmn.Qfrom && Utils.TryParseUDouble(e.DisplayText, out qFrom))
|
||||
if (column == MtrlgyClmn.Qtg)
|
||||
{
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Qto].Text, out qTo);
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Volume].Text, out volume);
|
||||
if (allOk)
|
||||
if (e.DisplayText == Strings.determine)
|
||||
{
|
||||
test.QfromTextChngd = true;
|
||||
calculateTime = true;
|
||||
if (e.DisplayText != e.Item.SubItems[e.SubItem].Text) test.QtgTextChngd = true;
|
||||
return; /// OK
|
||||
}
|
||||
else if (Utils.TryParseUDouble(e.DisplayText, out qTg))
|
||||
{
|
||||
if (test.IsFromToInPct)
|
||||
{
|
||||
/// Qfrom, Qto unit is % => calculate Qfrom, Qto and time
|
||||
allOk &= Utils.TryParseSDouble(e.Item.SubItems[(int)MtrlgyClmn.Qfrom].Text, out qFromPct);
|
||||
allOk &= Utils.TryParseSDouble(e.Item.SubItems[(int)MtrlgyClmn.Qto].Text, out qToPct);
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Volume].Text, out volume);
|
||||
if (allOk)
|
||||
{
|
||||
qFrom = qTg * qFromPct / 100;
|
||||
qTo = qTg * qToPct / 100;
|
||||
test.QtgTextChngd = true;
|
||||
calculateTime = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Qfrom and Qto are in absolute flow values => no test time recalcualtion required
|
||||
test.QtgTextChngd = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (column == MtrlgyClmn.Qto && Utils.TryParseUDouble(e.DisplayText, out qTo))
|
||||
else if (column == MtrlgyClmn.Qfrom && Utils.TryParseSDouble(e.DisplayText, out qFrom))
|
||||
{
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Qfrom].Text, out qFrom);
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Volume].Text, out volume);
|
||||
if (allOk)
|
||||
if (test.IsFromToInPct && e.Item.SubItems[(int)MtrlgyClmn.Qtg].Text != Strings.determine)
|
||||
{
|
||||
test.QtoTextChngd = true;
|
||||
calculateTime = true;
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Qtg].Text, out qTg);
|
||||
qFromPct = qFrom;
|
||||
allOk &= Utils.TryParseSDouble(e.Item.SubItems[(int)MtrlgyClmn.Qto].Text, out qToPct);
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Volume].Text, out volume);
|
||||
if (allOk)
|
||||
{
|
||||
qFrom = qTg * qFromPct / 100;
|
||||
qTo = qTg * qToPct / 100;
|
||||
test.QfromTextChngd = true;
|
||||
calculateTime = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
allOk &= Utils.TryParseSDouble(e.Item.SubItems[(int)MtrlgyClmn.Qto].Text, out qTo);
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Volume].Text, out volume);
|
||||
if (allOk)
|
||||
{
|
||||
test.QfromTextChngd = true;
|
||||
calculateTime = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (column == MtrlgyClmn.Qto && Utils.TryParseSDouble(e.DisplayText, out qTo))
|
||||
{
|
||||
if (test.IsFromToInPct && e.Item.SubItems[(int)MtrlgyClmn.Qtg].Text != Strings.determine)
|
||||
{
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Qtg].Text, out qTg);
|
||||
allOk &= Utils.TryParseSDouble(e.Item.SubItems[(int)MtrlgyClmn.Qfrom].Text, out qFromPct);
|
||||
qToPct = qTo;
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Volume].Text, out volume);
|
||||
if (allOk)
|
||||
{
|
||||
qFrom = qTg * qFromPct / 100;
|
||||
qTo = qTg * qToPct / 100;
|
||||
test.QtoTextChngd = true;
|
||||
calculateTime = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
allOk &= Utils.TryParseSDouble(e.Item.SubItems[(int)MtrlgyClmn.Qfrom].Text, out qFrom);
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Volume].Text, out volume);
|
||||
if (allOk)
|
||||
{
|
||||
test.QtoTextChngd = true;
|
||||
calculateTime = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (column == MtrlgyClmn.Volume && Utils.TryParseUDouble(e.DisplayText, out volume))
|
||||
{
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Qfrom].Text, out qFrom);
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Qto].Text, out qTo);
|
||||
allOk &= Utils.TryParseSDouble(e.Item.SubItems[(int)MtrlgyClmn.Qfrom].Text, out qFrom);
|
||||
allOk &= Utils.TryParseSDouble(e.Item.SubItems[(int)MtrlgyClmn.Qto].Text, out qTo);
|
||||
|
||||
if (test.IsFromToInPct)
|
||||
{
|
||||
allOk &= e.Item.SubItems[(int)MtrlgyClmn.Qtg].Text != Strings.determine;
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Qtg].Text, out qTg);
|
||||
qFrom = qTg * qFrom / 100;
|
||||
qTo = qTg * qTo / 100;
|
||||
}
|
||||
|
||||
if (allOk)
|
||||
{
|
||||
test.VolumeTextChngd = true;
|
||||
@ -1164,15 +1276,24 @@ namespace TBF.UI.Procedures
|
||||
}
|
||||
else if (column == MtrlgyClmn.TestTime && Utils.TryParseUDouble(e.DisplayText, out testTime))
|
||||
{
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Qfrom].Text, out qFrom);
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Qto].Text, out qTo);
|
||||
allOk &= Utils.TryParseSDouble(e.Item.SubItems[(int)MtrlgyClmn.Qfrom].Text, out qFrom);
|
||||
allOk &= Utils.TryParseSDouble(e.Item.SubItems[(int)MtrlgyClmn.Qto].Text, out qTo);
|
||||
|
||||
if (test.IsFromToInPct)
|
||||
{
|
||||
allOk &= e.Item.SubItems[(int)MtrlgyClmn.Qtg].Text != Strings.determine;
|
||||
allOk &= Utils.TryParseUDouble(e.Item.SubItems[(int)MtrlgyClmn.Qtg].Text, out qTg);
|
||||
qFrom = qTg * qFrom / 100;
|
||||
qTo = qTg * qTo / 100;
|
||||
}
|
||||
|
||||
if (allOk)
|
||||
{
|
||||
calculateVolume = true;
|
||||
}
|
||||
}
|
||||
|
||||
double qAveLps = Units.ConvertFrom(test.FlowUnit, qFrom + qTo) / 7.2;
|
||||
double qAveLps = Units.ConvertFrom((test.FlowUnit == Unit.Pct) ? Unit.m3 : test.FlowUnit, qFrom + qTo) / 7.2;
|
||||
|
||||
if (calculateTime)
|
||||
{
|
||||
@ -1204,27 +1325,73 @@ namespace TBF.UI.Procedures
|
||||
{
|
||||
Test test = item.Tag as Test;
|
||||
if (test == null || !Units.IsFlow(newUnit) || newUnit == test.FlowUnit) return;
|
||||
|
||||
Unit oriUnit = test.FlowUnit;
|
||||
test.FlowUnit = newUnit;
|
||||
|
||||
int ix = (int)MtrlgyClmn.Qfrom;
|
||||
double flowM3ph = Units.ConvertFrom(oriUnit, Utils.ParseUDouble(item.SubItems[ix].Text));
|
||||
item.SubItems[ix].Text = Units.ConvertTo(newUnit, test.QfromTextChngd ? flowM3ph : test.Qfrom).ToString();
|
||||
int ix = (int)MtrlgyClmn.Qtg;
|
||||
if (item.SubItems[ix].Text != Strings.determine)
|
||||
{
|
||||
double flowM3ph = Units.ConvertFrom(oriUnit, Utils.ParseUDouble(item.SubItems[ix].Text));
|
||||
item.SubItems[ix].Text = Units.ConvertTo(newUnit, test.QtgTextChngd ? flowM3ph : test.Qtg).ToString();
|
||||
}
|
||||
|
||||
ix = (int)MtrlgyClmn.Qto;
|
||||
flowM3ph = Units.ConvertFrom(oriUnit, Utils.ParseUDouble(item.SubItems[ix].Text));
|
||||
item.SubItems[ix].Text = Units.ConvertTo(newUnit, test.QtoTextChngd ? flowM3ph : test.Qto).ToString();
|
||||
#if SHOW_Q_TG
|
||||
ix = (int)MtrlgyClmn.Qtg;
|
||||
flowM3ph = Units.ConvertFrom(oriUnit, Utils.ParseUDouble(item.SubItems[ix].Text));
|
||||
item.SubItems[ix].Text = Units.ConvertTo(newUnit, test.QtgTextChngd ? flowM3ph : test.Qtg).ToString();
|
||||
#endif
|
||||
if (!test.IsFromToInPct)
|
||||
{
|
||||
ix = (int)MtrlgyClmn.Qfrom;
|
||||
double flowM3ph = Units.ConvertFrom(oriUnit, Utils.ParseSDouble(item.SubItems[ix].Text));
|
||||
item.SubItems[ix].Text = Units.ConvertTo(newUnit, test.QfromTextChngd ? flowM3ph : test.Qfrom).ToString();
|
||||
|
||||
ix = (int)MtrlgyClmn.Qto;
|
||||
flowM3ph = Units.ConvertFrom(oriUnit, Utils.ParseSDouble(item.SubItems[ix].Text));
|
||||
item.SubItems[ix].Text = Units.ConvertTo(newUnit, test.QtoTextChngd ? flowM3ph : test.Qto).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateQfromQto(ListViewItem item, bool newIsFromToInPct)
|
||||
{
|
||||
Test test = item.Tag as Test;
|
||||
string qTgStr = item.SubItems[(int)MtrlgyClmn.Qtg].Text;
|
||||
double qTg = -1.0; /// in flow units, no conversion needed
|
||||
if (qTgStr != Strings.determine)
|
||||
{
|
||||
Utils.TryParseUDouble(qTgStr, out qTg);
|
||||
}
|
||||
if (test == null || test.IsFromToInPct == newIsFromToInPct || qTg <= 0) return;
|
||||
|
||||
if (newIsFromToInPct)
|
||||
{
|
||||
/// From a flow in flow unit to %
|
||||
int ix = (int)MtrlgyClmn.Qfrom;
|
||||
double flow = Utils.ParseSDouble(item.SubItems[ix].Text);
|
||||
item.SubItems[ix].Text = (100 * flow / qTg).ToString();
|
||||
|
||||
ix = (int)MtrlgyClmn.Qto;
|
||||
flow = Utils.ParseSDouble(item.SubItems[ix].Text);
|
||||
item.SubItems[ix].Text = (100 * flow / qTg).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
/// From % to a flow in flow unit
|
||||
int ix = (int)MtrlgyClmn.Qfrom;
|
||||
double pct = Utils.ParseSDouble(item.SubItems[ix].Text);
|
||||
item.SubItems[ix].Text = (pct * qTg / 100).ToString();
|
||||
|
||||
ix = (int)MtrlgyClmn.Qto;
|
||||
pct = Utils.ParseSDouble(item.SubItems[ix].Text);
|
||||
item.SubItems[ix].Text = (pct * qTg / 100).ToString();
|
||||
}
|
||||
|
||||
test.IsFromToInPct = newIsFromToInPct;
|
||||
test.QfromTextChngd = true;
|
||||
test.QtoTextChngd = true;
|
||||
}
|
||||
|
||||
void UpdateVolume(ListViewItem item, Unit newUnit)
|
||||
{
|
||||
Test test = item.Tag as Test;
|
||||
if (test == null || !Units.IsVolume(newUnit) || newUnit == test.VolumeUnit) return;
|
||||
|
||||
Unit oriUnit = test.VolumeUnit;
|
||||
test.VolumeUnit = newUnit;
|
||||
|
||||
@ -1397,7 +1564,7 @@ namespace TBF.UI.Procedures
|
||||
Mtrlgy2Clmn column = (Mtrlgy2Clmn)e.SubItem;
|
||||
|
||||
/// Unit change is allowed when locked
|
||||
if (column != Mtrlgy2Clmn.TempUnit && (!unlocked || column >= Mtrlgy2Clmn.ColumnsCount))
|
||||
if (!unlocked && column != Mtrlgy2Clmn.TempUnit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -2452,7 +2619,7 @@ namespace TBF.UI.Procedures
|
||||
/// Add a test
|
||||
Test test = new Test(newName, listViewEx.Items.Count, LoadedProcedure);
|
||||
|
||||
IBenchInfo benchInfo = TBF.Rig.Sequences.ProcessData.BenchInfo;
|
||||
IBenchInfo benchInfo = ProcessData.BenchInfo;
|
||||
test.VolumeUnit = (benchInfo != null) ? benchInfo.VolumeUnit : Unit.l;
|
||||
test.FlowUnit = (benchInfo != null) ? benchInfo.FlowUnit : Unit.m3ph;
|
||||
test.MassUnit = (benchInfo != null) ? benchInfo.MassUnit : Unit.kg;
|
||||
|
||||
@ -721,19 +721,16 @@ namespace TBF.UI.Procedures
|
||||
|
||||
public void CreateFromProfile()
|
||||
{
|
||||
IList<Profile> profiles;
|
||||
IList<Profile> profiles;
|
||||
IList<FeedingPath> fPaths;
|
||||
IList<BenchPath> bPaths;
|
||||
IList<OutputPath> oPaths;
|
||||
|
||||
IList<BenchPath> bPaths;
|
||||
IList<OutputPath> oPaths;
|
||||
try
|
||||
{
|
||||
profiles = session.QueryOver<Profile>()
|
||||
.OrderBy(x => x.ItemNr).Asc
|
||||
.List();
|
||||
fPaths = session.QueryOver<FeedingPath>().OrderBy(x => x.ItemNr).Asc.List();
|
||||
bPaths = session.QueryOver<BenchPath>().OrderBy(x => x.ItemNr).Asc.List();
|
||||
oPaths = session.QueryOver<OutputPath>().OrderBy(x => x.ItemNr).Asc.List();
|
||||
profiles = session.QueryOver<Profile>() .OrderBy(x => x.ItemNr).Asc.List();
|
||||
fPaths = session.QueryOver<FeedingPath>().OrderBy(x => x.ItemNr).Asc.List();
|
||||
bPaths = session.QueryOver<BenchPath>() .OrderBy(x => x.ItemNr).Asc.List();
|
||||
oPaths = session.QueryOver<OutputPath>() .OrderBy(x => x.ItemNr).Asc.List();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@ -742,7 +739,7 @@ namespace TBF.UI.Procedures
|
||||
return;
|
||||
}
|
||||
|
||||
TestWizard.TestProfileSelection dlg = new TestWizard.TestProfileSelection(profiles, fPaths, bPaths, oPaths);
|
||||
var dlg = new TestWizard.TestProfileSelection(profiles, fPaths, bPaths, oPaths);
|
||||
if (dlg.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
/// Find an unused procedure name
|
||||
@ -757,15 +754,42 @@ namespace TBF.UI.Procedures
|
||||
|
||||
ProfileType pt = dlg.SelectedProfile.ProfileType;
|
||||
|
||||
Procedure newProcedure = new Procedure(newName, Procedures.Count);
|
||||
Medium medium = (pt == ProfileType.QnClassHotWater) ? Medium.HotWater : Medium.ColdWater;
|
||||
var newProcedure = new Procedure(newName, Procedures.Count);
|
||||
switch (pt)
|
||||
{
|
||||
case ProfileType.Q3RCompound:
|
||||
case ProfileType.QnClassCompound:
|
||||
case ProfileType.QpQiCompound:
|
||||
newProcedure.MetersKind = MetersKind.Combined;
|
||||
break;
|
||||
default:
|
||||
newProcedure.MetersKind = MetersKind.Single;
|
||||
break;
|
||||
}
|
||||
var medium = (pt == ProfileType.QnClassHotWater) ? Medium.HotWater : Medium.ColdWater;
|
||||
IList<IParamsProvider> errorFlagsParamsOfCreatedTests = new List<IParamsProvider>();
|
||||
IList<IParamsProvider> waterMeterParamsOfNewProcedure = new List<IParamsProvider>();
|
||||
|
||||
var cmpntEntities = session.QueryOver<Component>()
|
||||
.OrderBy(x => x.ItemNr).Asc
|
||||
.List<Component>();
|
||||
IList<Rig.Generic.IComponent> components = Rig.TbfComponents.LoadComponentsFromDB(cmpntEntities);
|
||||
var cmpntEntities = session.QueryOver<Component>().OrderBy(x => x.ItemNr).Asc.List();
|
||||
|
||||
var components = Rig.TbfComponents.LoadComponentsFromDB(cmpntEntities);
|
||||
|
||||
int toBeUpdatedWMsCount;
|
||||
switch (newProcedure.MetersKind)
|
||||
{
|
||||
default:
|
||||
case MetersKind.Single:
|
||||
toBeUpdatedWMsCount = Data.WMsCount;
|
||||
break;
|
||||
case MetersKind.Combined:
|
||||
toBeUpdatedWMsCount = 2 * Data.CompoundWMsCount;
|
||||
break;
|
||||
case MetersKind.HeatMeter:
|
||||
toBeUpdatedWMsCount = 2 * Data.WMsCount;
|
||||
break;
|
||||
}
|
||||
|
||||
int wmIx = 0;
|
||||
foreach (var cmptn in components)
|
||||
{
|
||||
if (cmptn.ClassName == "WaterMeter")
|
||||
@ -775,16 +799,37 @@ namespace TBF.UI.Procedures
|
||||
TBF.Rig.WaterMeters.WaterMeter.ProcParams wmParams = waterMeterParams as TBF.Rig.WaterMeters.WaterMeter.ProcParams;
|
||||
if (wmParams != null)
|
||||
{
|
||||
wmParams.Qnames = Common.Utils.ProfileType2FlowNames(pt);
|
||||
wmParams.Qmax = (pt == ProfileType.Manual) ? 0 : Formulas.GetQ4Qmax(dlg.Qn, dlg.MetroClass, medium);
|
||||
wmParams.Qn = dlg.Qn;
|
||||
wmParams.Qt = (pt == ProfileType.Manual) ? 0 : (pt == ProfileType.QpQi) ? (0.1 * dlg.Qn) : Formulas.GetQ2Qt(dlg.Qn, dlg.MetroClass, medium);
|
||||
wmParams.Qmin = (pt == ProfileType.Manual) ? 0 : (pt == ProfileType.QpQi) ? dlg.Qn / dlg.QpQiRatio : Formulas.GetQ1Qmin(dlg.Qn, dlg.MetroClass, medium);
|
||||
wmParams.MetrologicalClass = dlg.MetroClass;
|
||||
wmParams.WaterTemp = medium;
|
||||
}
|
||||
if (newProcedure.MetersKind == MetersKind.Single || (newProcedure.MetersKind == MetersKind.Combined && (wmIx % 2) == 0))
|
||||
{
|
||||
/// Plain (single) water meter or a main meter of a compound meter
|
||||
wmParams.Qnames = Common.Utils.ProfileType2FlowNames(pt);
|
||||
wmParams.Qmax = (pt == ProfileType.Manual) ? 0 : Formulas.GetQ4Qmax(dlg.Qn, dlg.MetroClass, medium);
|
||||
wmParams.Qn = dlg.Qn;
|
||||
wmParams.Qt = (pt == ProfileType.Manual) ? 0 : (pt == ProfileType.QpQi) ? (0.1 * dlg.Qn) : Formulas.GetQ2Qt(dlg.Qn, dlg.MetroClass, medium);
|
||||
wmParams.Qmin = (pt == ProfileType.Manual) ? 0 : (pt == ProfileType.QpQi) ? dlg.Qn / dlg.QpQiRatio : Formulas.GetQ1Qmin(dlg.Qn, dlg.MetroClass, medium);
|
||||
wmParams.MetrologicalClass = dlg.MetroClass;
|
||||
wmParams.WaterTemp = medium;
|
||||
}
|
||||
else if (newProcedure.MetersKind == MetersKind.Combined && (wmIx % 2) == 1)
|
||||
{
|
||||
/// Aux. meter of a compound meter
|
||||
wmParams.Qnames = Common.Utils.ProfileType2FlowNames(pt);
|
||||
wmParams.Qmax = (pt == ProfileType.Manual) ? 0 : Formulas.GetQ4Qmax(dlg.QnAux, dlg.MetroClassAux, medium);
|
||||
wmParams.Qn = dlg.QnAux;
|
||||
wmParams.Qt = (pt == ProfileType.Manual) ? 0 : (pt == ProfileType.QpQiCompound) ? (0.1 * dlg.Qn) : Formulas.GetQ2Qt(dlg.QnAux, dlg.MetroClassAux, medium);
|
||||
wmParams.Qmin = (pt == ProfileType.Manual) ? 0 : (pt == ProfileType.QpQiCompound) ? dlg.Qn / dlg.QpQiRatio : Formulas.GetQ1Qmin(dlg.QnAux, dlg.MetroClassAux, medium);
|
||||
wmParams.MetrologicalClass = dlg.MetroClassAux;
|
||||
wmParams.WaterTemp = medium;
|
||||
}
|
||||
else if (newProcedure.MetersKind == MetersKind.HeatMeter)
|
||||
{
|
||||
/// TODO
|
||||
}
|
||||
|
||||
waterMeterParamsOfNewProcedure.Add(waterMeterParams);
|
||||
waterMeterParamsOfNewProcedure.Add(waterMeterParams);
|
||||
wmIx++;
|
||||
if (wmIx >= toBeUpdatedWMsCount) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -867,6 +912,7 @@ namespace TBF.UI.Procedures
|
||||
efp.UpdateEmbeddedDbEntity();
|
||||
}
|
||||
|
||||
session.Flush();
|
||||
transaction.Commit();
|
||||
|
||||
MessageBox.Show(string.Format(Strings.Procedure_0_added, newProcedure.Name),
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
///
|
||||
/// Copyright (c) 2019-2022 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Common.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
using TBF.Rig;
|
||||
|
||||
namespace TBF.UI.Procedures.TestWizard
|
||||
{
|
||||
@ -18,29 +17,44 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(TestProfileSelection));
|
||||
|
||||
const int NameColumn = 0;
|
||||
const int SelectorColumn = 5;
|
||||
enum Column
|
||||
{
|
||||
Name,
|
||||
Part,
|
||||
Qtg,
|
||||
Qfrom,
|
||||
Qto,
|
||||
FromToUnit,
|
||||
Selector,
|
||||
ErrLimLo,
|
||||
ErrLimHi,
|
||||
Method,
|
||||
}
|
||||
|
||||
const string EmptySelector = "---";
|
||||
|
||||
IList<Profile> profiles;
|
||||
IList<FeedingPath> fPaths;
|
||||
IList<BenchPath> bPaths;
|
||||
IList<OutputPath> oPaths;
|
||||
IList<Config.Entities.Profile> profiles;
|
||||
IList<Config.Entities.FeedingPath> fPaths;
|
||||
IList<Config.Entities.BenchPath> bPaths;
|
||||
IList<Config.Entities.OutputPath> oPaths;
|
||||
|
||||
public Profile SelectedProfile;
|
||||
public IList<Test> SelectedTests;
|
||||
public double Qn;
|
||||
public string MetroClass;
|
||||
public double QpQiRatio;
|
||||
public double QnAux;
|
||||
public string MetroClassAux;
|
||||
public double QpQiRatioAux;
|
||||
|
||||
IList<string> selectorVals; /// Empty string or null (which is permitted) is not part of this list
|
||||
TextBox testNameTextBox;
|
||||
ComboBox selectorComboBox;
|
||||
|
||||
public TestProfileSelection(IList<Profile> profiles,
|
||||
IList<FeedingPath> fPaths,
|
||||
IList<BenchPath> bPaths,
|
||||
IList<OutputPath> oPaths)
|
||||
public TestProfileSelection(IList<Config.Entities.Profile> profiles,
|
||||
IList<Config.Entities.FeedingPath> fPaths,
|
||||
IList<Config.Entities.BenchPath> bPaths,
|
||||
IList<Config.Entities.OutputPath> oPaths)
|
||||
{
|
||||
this.profiles = profiles;
|
||||
this.fPaths = fPaths;
|
||||
@ -69,8 +83,9 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
listViewEx.Columns.Add(Strings.Name, 70);
|
||||
listViewEx.Columns.Add(Strings.Part, 40);
|
||||
listViewEx.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_tg), 80);
|
||||
listViewEx.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_from), 80);
|
||||
listViewEx.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_to), 70);
|
||||
listViewEx.Columns.Add(string.Format("{0}", Strings.Q_from), 80);
|
||||
listViewEx.Columns.Add(string.Format("{0}", Strings.Q_to), 70);
|
||||
listViewEx.Columns.Add(string.Format("Unit", Strings.Q_to), 40);
|
||||
listViewEx.Columns.Add("Selector");
|
||||
listViewEx.Columns.Add(Strings.Err_limit_neg_pct_chdr, 80);
|
||||
listViewEx.Columns.Add(Strings.Err_limit_pos_pct_chdr, 80);
|
||||
@ -93,13 +108,17 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
private void TestProfileSelection_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
}
|
||||
#if LANG_PL
|
||||
protectedCheckBox.Checked = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Test_profiles_selection;
|
||||
nextButton.Text = Strings.NextBtnText;
|
||||
cancelButton.Text = Strings.CancelBtnText;
|
||||
protectedCheckBox.Text = Strings.Protected_procedure;
|
||||
}
|
||||
|
||||
void RedrawQn(Profile profile)
|
||||
@ -190,16 +209,29 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
int itemNr = 0;
|
||||
foreach (var ptest in profile.Tests)
|
||||
{
|
||||
Medium medium = (profile.ProfileType == ProfileType.QnClassHotWater) ? Medium.HotWater : Medium.ColdWater;
|
||||
var methodCmpnt = TbfComponents.FindComponent(ptest.Method);
|
||||
bool compoundDetection = methodCmpnt != null && methodCmpnt is Rig.TestMethods.CombinedWithDetection.TestMethod;
|
||||
|
||||
double Qtg = TBF.UI.Procedures.Formulas.GetTargetQ(ptest, Qn, QpQiRatio, MetroClass, medium);
|
||||
Medium medium = (profile.ProfileType == ProfileType.QnClassHotWater) ? Medium.HotWater : Medium.ColdWater;
|
||||
|
||||
Test test = new Test(ptest.Name, itemNr++, null); /// Procedure reference to be added later
|
||||
test.Part = ptest.Part;
|
||||
test.Profile = (profile.ProfileType == ProfileType.QpQi) ? TestProfile.ProtectedHeatMeter : TestProfile.Protected;
|
||||
test.Qtg = Qtg;
|
||||
test.Qfrom = Qtg * ptest.CoefQfrom;
|
||||
test.Qto = Qtg * ptest.CoefQto;
|
||||
|
||||
test.Profile = (profile.ProfileType == ProfileType.QpQi)
|
||||
? (protectedCheckBox.Checked ? TestProfile.ProtectedHeatMeter : TestProfile.UserDefinedHeatMeter)
|
||||
: (profile.ProfileType == ProfileType.Q3RCompound || profile.ProfileType == ProfileType.QnClassCompound
|
||||
|| profile.ProfileType == ProfileType.QpQiCompound)
|
||||
? (protectedCheckBox.Checked ? TestProfile.ProtectedCompound : TestProfile.UserDefinedCompound)
|
||||
: (protectedCheckBox.Checked ? TestProfile.Protected : TestProfile.UserDefined);
|
||||
|
||||
test.Qtg = compoundDetection ? -1.0
|
||||
: ptest.Name.Contains(Strings._aux) ? TBF.UI.Procedures.Formulas.GetTargetQ(ptest, QnAux, QpQiRatioAux, MetroClassAux, medium)
|
||||
: ptest.Name.Contains(Strings._main) ? TBF.UI.Procedures.Formulas.GetTargetQ(ptest, Qn, QpQiRatio, MetroClass, medium)
|
||||
: TBF.UI.Procedures.Formulas.GetTargetQ(ptest, Qn, QpQiRatio, MetroClass, medium);
|
||||
|
||||
test.IsFromToInPct = test.Qtg <= 0 || Rig.Sequences.ProcessData.IsFromToInPct;
|
||||
test.Qfrom = test.IsFromToInPct ? 100 * ptest.CoefQfrom : test.Qtg * ptest.CoefQfrom;
|
||||
test.Qto = test.IsFromToInPct ? 100 * ptest.CoefQto : test.Qtg * ptest.CoefQto;
|
||||
test.TempLimLo = Convert.ToSingle(ptest.TempLimLo);
|
||||
test.TempLimHi = Convert.ToSingle(ptest.TempLimHi);
|
||||
test.Publish = ptest.Publish;
|
||||
@ -226,9 +258,10 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
{
|
||||
lvi = new ListViewItem(new string[] { ptest.Name,
|
||||
(ptest.Part > 0) ? ptest.Part.ToString() : "-",
|
||||
Qtg.ToString(),
|
||||
test.Qtg < 0 ? Strings.determine : test.Qtg.ToString(),
|
||||
test.Qfrom.ToString(),
|
||||
test.Qto.ToString(),
|
||||
test.IsFromToInPct ? "%" : "m3/h",
|
||||
EmptySelector,
|
||||
ptest.ErrLimLo.ToString(),
|
||||
ptest.ErrLimHi.ToString(),
|
||||
@ -238,9 +271,10 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
{
|
||||
lvi = new ListViewItem(new string[] { ptest.Name,
|
||||
(ptest.Part > 0) ? ptest.Part.ToString() : "-",
|
||||
Qtg.ToString(),
|
||||
test.Qtg < 0 ? Strings.determine : test.Qtg.ToString(),
|
||||
test.Qfrom.ToString(),
|
||||
test.Qto.ToString(),
|
||||
test.IsFromToInPct ? "%" : "m3/h",
|
||||
EmptySelector,
|
||||
Strings.calculated,
|
||||
Strings.calculated,
|
||||
@ -315,6 +349,10 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
}
|
||||
}
|
||||
|
||||
private void metroClassComboBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
metroClassComboBox_SelectedIndexChanged(sender, e);
|
||||
}
|
||||
private void metroClassComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (IsFormValid())
|
||||
@ -343,6 +381,38 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
}
|
||||
}
|
||||
|
||||
private void qnAuxTextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (IsFormValid())
|
||||
{
|
||||
RedrawPTests(SelectedProfile);
|
||||
nextButton.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RedrawPTests(null);
|
||||
nextButton.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void metroClassAuxComboBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
metroClassAuxComboBox_SelectedIndexChanged(sender, e);
|
||||
}
|
||||
private void metroClassAuxComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (IsFormValid())
|
||||
{
|
||||
RedrawPTests(SelectedProfile);
|
||||
nextButton.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RedrawPTests(null);
|
||||
nextButton.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool IsProfileValid()
|
||||
{
|
||||
@ -362,6 +432,19 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
}
|
||||
}
|
||||
|
||||
bool IsQnAuxValid()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(qnAuxTextBox.Text) && Utils.TryParseUDouble(qnAuxTextBox.Text, out QnAux) && (QnAux > 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
QnAux = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsMetroClassValid()
|
||||
{
|
||||
if (SelectedProfile.ProfileType == ProfileType.Manual)
|
||||
@ -381,6 +464,25 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsMetroClassAuxValid()
|
||||
{
|
||||
if (SelectedProfile.ProfileType == ProfileType.Manual)
|
||||
{
|
||||
MetroClassAux = string.Empty;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(metroClassAuxComboBox.Text) &&
|
||||
(metroClassAuxComboBox.Items.Count == 0 || metroClassAuxComboBox.Items.Contains(metroClassAuxComboBox.Text)))
|
||||
{
|
||||
MetroClassAux = metroClassAuxComboBox.Text;
|
||||
return true;
|
||||
}
|
||||
|
||||
MetroClassAux = string.Empty;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsQpQiRatioValid()
|
||||
{
|
||||
if (SelectedProfile.ProfileType != ProfileType.QpQi)
|
||||
@ -401,16 +503,21 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
|
||||
bool IsFormValid()
|
||||
{
|
||||
return IsProfileValid() && IsQnValid() && IsMetroClassValid() && IsQpQiRatioValid();
|
||||
bool isCompound = SelectedProfile.ProfileType == ProfileType.Q3RCompound ||
|
||||
SelectedProfile.ProfileType == ProfileType.QnClassCompound ||
|
||||
SelectedProfile.ProfileType == ProfileType.QpQiCompound;
|
||||
|
||||
return IsProfileValid() && IsQnValid() && IsMetroClassValid() && IsQpQiRatioValid()
|
||||
&& (!isCompound || (IsQnAuxValid() && IsMetroClassAuxValid()));
|
||||
}
|
||||
|
||||
private void listViewEx_SubItemClicked(object sender, SubItemEventArgs e)
|
||||
{
|
||||
if (e.SubItem == NameColumn)
|
||||
if (e.SubItem == (int)Column.Name)
|
||||
{
|
||||
listViewEx.StartEditing(testNameTextBox, e.Item, e.SubItem);
|
||||
}
|
||||
else if (e.SubItem == SelectorColumn)
|
||||
else if (e.SubItem == (int)Column.Selector)
|
||||
{
|
||||
listViewEx.StartEditing(selectorComboBox, e.Item, e.SubItem);
|
||||
}
|
||||
@ -420,7 +527,7 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
{
|
||||
Test test = e.Item.Tag as Test;
|
||||
|
||||
if (e.SubItem == NameColumn)
|
||||
if (e.SubItem == (int)Column.Name)
|
||||
{
|
||||
foreach (var item in listViewEx.Items)
|
||||
{
|
||||
@ -437,7 +544,7 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
/// OK
|
||||
test.Name = e.DisplayText;
|
||||
}
|
||||
else if (e.SubItem == SelectorColumn)
|
||||
else if (e.SubItem == (int)Column.Selector)
|
||||
{
|
||||
if (!selectorComboBox.Items.Contains(e.DisplayText))
|
||||
{
|
||||
@ -456,13 +563,13 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
foreach (var item in listViewEx.Items)
|
||||
{
|
||||
var lvi = item as ListViewItem;
|
||||
string selector = (lvi.SubItems[SelectorColumn].Text == EmptySelector) ? string.Empty : lvi.SubItems[SelectorColumn].Text;
|
||||
string selector = (lvi.SubItems[(int)Column.Selector].Text == EmptySelector) ? string.Empty : lvi.SubItems[(int)Column.Selector].Text;
|
||||
Test test = lvi.Tag as Test;
|
||||
|
||||
if (test != null)
|
||||
{
|
||||
/// Depending on the chosen Q select the paths
|
||||
double Qaver = (test.Qfrom + test.Qto) / 2.0;
|
||||
double Qaver = (test.QfromM3ph() + test.QtoM3ph()) / 2.0;
|
||||
foreach (var path in fPaths)
|
||||
{
|
||||
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto) &&
|
||||
|
||||
@ -40,16 +40,17 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
this.profileDescriptionLabel = new System.Windows.Forms.Label();
|
||||
this.profileComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.qnGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.qnAuxTextBox = new System.Windows.Forms.TextBox();
|
||||
this.qnAuxLabel = new System.Windows.Forms.Label();
|
||||
this.qnTextBox = new System.Windows.Forms.TextBox();
|
||||
this.qnLabel = new System.Windows.Forms.Label();
|
||||
this.metroClassGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.metroClassAuxComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.metroClassComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.listViewEx = new Common.Forms.ListViewEx();
|
||||
this.protectedCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.nextButton = new System.Windows.Forms.Button();
|
||||
this.qnAuxTextBox = new System.Windows.Forms.TextBox();
|
||||
this.qnAuxLabel = new System.Windows.Forms.Label();
|
||||
this.metroClassAuxComboBox = new System.Windows.Forms.ComboBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).BeginInit();
|
||||
this.horizSplitContainer.Panel1.SuspendLayout();
|
||||
this.horizSplitContainer.Panel2.SuspendLayout();
|
||||
@ -78,6 +79,7 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
//
|
||||
// horizSplitContainer.Panel2
|
||||
//
|
||||
this.horizSplitContainer.Panel2.Controls.Add(this.protectedCheckBox);
|
||||
this.horizSplitContainer.Panel2.Controls.Add(this.cancelButton);
|
||||
this.horizSplitContainer.Panel2.Controls.Add(this.nextButton);
|
||||
this.horizSplitContainer.Size = new System.Drawing.Size(850, 363);
|
||||
@ -179,6 +181,25 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
this.qnGroupBox.TabStop = false;
|
||||
this.qnGroupBox.Text = "2. Nominal flow";
|
||||
//
|
||||
// qnAuxTextBox
|
||||
//
|
||||
this.qnAuxTextBox.Location = new System.Drawing.Point(55, 48);
|
||||
this.qnAuxTextBox.Name = "qnAuxTextBox";
|
||||
this.qnAuxTextBox.Size = new System.Drawing.Size(82, 20);
|
||||
this.qnAuxTextBox.TabIndex = 13;
|
||||
this.qnAuxTextBox.Visible = false;
|
||||
this.qnAuxTextBox.TextChanged += new System.EventHandler(this.qnAuxTextBox_TextChanged);
|
||||
//
|
||||
// qnAuxLabel
|
||||
//
|
||||
this.qnAuxLabel.AutoSize = true;
|
||||
this.qnAuxLabel.Location = new System.Drawing.Point(10, 52);
|
||||
this.qnAuxLabel.Name = "qnAuxLabel";
|
||||
this.qnAuxLabel.Size = new System.Drawing.Size(41, 13);
|
||||
this.qnAuxLabel.TabIndex = 12;
|
||||
this.qnAuxLabel.Text = "Q3 aux";
|
||||
this.qnAuxLabel.Visible = false;
|
||||
//
|
||||
// qnTextBox
|
||||
//
|
||||
this.qnTextBox.Location = new System.Drawing.Point(55, 22);
|
||||
@ -207,6 +228,17 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
this.metroClassGroupBox.TabStop = false;
|
||||
this.metroClassGroupBox.Text = "3. Metrological class";
|
||||
//
|
||||
// metroClassAuxComboBox
|
||||
//
|
||||
this.metroClassAuxComboBox.FormattingEnabled = true;
|
||||
this.metroClassAuxComboBox.Location = new System.Drawing.Point(23, 48);
|
||||
this.metroClassAuxComboBox.Name = "metroClassAuxComboBox";
|
||||
this.metroClassAuxComboBox.Size = new System.Drawing.Size(100, 21);
|
||||
this.metroClassAuxComboBox.TabIndex = 1;
|
||||
this.metroClassAuxComboBox.Visible = false;
|
||||
this.metroClassAuxComboBox.SelectedIndexChanged += new System.EventHandler(this.metroClassAuxComboBox_SelectedIndexChanged);
|
||||
this.metroClassAuxComboBox.TextChanged += new System.EventHandler(this.metroClassAuxComboBox_TextChanged);
|
||||
//
|
||||
// metroClassComboBox
|
||||
//
|
||||
this.metroClassComboBox.FormattingEnabled = true;
|
||||
@ -215,6 +247,7 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
this.metroClassComboBox.Size = new System.Drawing.Size(100, 21);
|
||||
this.metroClassComboBox.TabIndex = 0;
|
||||
this.metroClassComboBox.SelectedIndexChanged += new System.EventHandler(this.metroClassComboBox_SelectedIndexChanged);
|
||||
this.metroClassComboBox.TextChanged += new System.EventHandler(this.metroClassComboBox_TextChanged);
|
||||
//
|
||||
// listViewEx
|
||||
//
|
||||
@ -231,6 +264,16 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
this.listViewEx.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewEx.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// protectedCheckBox
|
||||
//
|
||||
this.protectedCheckBox.AutoSize = true;
|
||||
this.protectedCheckBox.Location = new System.Drawing.Point(12, 17);
|
||||
this.protectedCheckBox.Name = "protectedCheckBox";
|
||||
this.protectedCheckBox.Size = new System.Drawing.Size(123, 17);
|
||||
this.protectedCheckBox.TabIndex = 2;
|
||||
this.protectedCheckBox.Text = "Protected procedure";
|
||||
this.protectedCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
@ -253,33 +296,6 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
this.nextButton.UseVisualStyleBackColor = true;
|
||||
this.nextButton.Click += new System.EventHandler(this.nextButton_Click);
|
||||
//
|
||||
// qnAuxTextBox
|
||||
//
|
||||
this.qnAuxTextBox.Location = new System.Drawing.Point(55, 48);
|
||||
this.qnAuxTextBox.Name = "qnAuxTextBox";
|
||||
this.qnAuxTextBox.Size = new System.Drawing.Size(82, 20);
|
||||
this.qnAuxTextBox.TabIndex = 13;
|
||||
this.qnAuxTextBox.Visible = false;
|
||||
//
|
||||
// qnAuxLabel
|
||||
//
|
||||
this.qnAuxLabel.AutoSize = true;
|
||||
this.qnAuxLabel.Location = new System.Drawing.Point(10, 52);
|
||||
this.qnAuxLabel.Name = "qnAuxLabel";
|
||||
this.qnAuxLabel.Size = new System.Drawing.Size(41, 13);
|
||||
this.qnAuxLabel.TabIndex = 12;
|
||||
this.qnAuxLabel.Text = "Q3 aux";
|
||||
this.qnAuxLabel.Visible = false;
|
||||
//
|
||||
// metroClassAuxComboBox
|
||||
//
|
||||
this.metroClassAuxComboBox.FormattingEnabled = true;
|
||||
this.metroClassAuxComboBox.Location = new System.Drawing.Point(23, 48);
|
||||
this.metroClassAuxComboBox.Name = "metroClassAuxComboBox";
|
||||
this.metroClassAuxComboBox.Size = new System.Drawing.Size(100, 21);
|
||||
this.metroClassAuxComboBox.TabIndex = 1;
|
||||
this.metroClassAuxComboBox.Visible = false;
|
||||
//
|
||||
// TestProfileSelection
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -292,6 +308,7 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
this.Load += new System.EventHandler(this.TestProfileSelection_Load);
|
||||
this.horizSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.horizSplitContainer.Panel2.ResumeLayout(false);
|
||||
this.horizSplitContainer.Panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).EndInit();
|
||||
this.horizSplitContainer.ResumeLayout(false);
|
||||
this.horizSplitContainer2.Panel1.ResumeLayout(false);
|
||||
@ -329,5 +346,6 @@ namespace TBF.UI.Procedures.TestWizard
|
||||
private System.Windows.Forms.TextBox qnAuxTextBox;
|
||||
private System.Windows.Forms.Label qnAuxLabel;
|
||||
private System.Windows.Forms.ComboBox metroClassAuxComboBox;
|
||||
private System.Windows.Forms.CheckBox protectedCheckBox;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user