Calculated error limits for heat meter flow measurement testing, ver. 2.17.705

This commit is contained in:
Milan Hanajik
2017-10-18 10:52:15 +02:00
parent 21a329b1d3
commit 3822c6f5ab
15 changed files with 492 additions and 252 deletions
+51 -2
View File
@@ -25,8 +25,8 @@ namespace Config.Entities
public virtual float Volume { get; set; } /// Test volume (target) in [l]
public virtual float TstTime { get; set; } /// Test time (estimate) in [s]
public virtual string Method { get; set; }
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0)
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0)
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0) or 1=class1, 2=class2, 3=class3
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0) or -Qn in m3/h
public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
public virtual int Repeats { get; set; }
public virtual bool DoDraining { get; set; }
@@ -301,6 +301,55 @@ namespace Config.Entities
return diff.ToString();
}
public virtual float GetErrLimLo(float flow)
{
if (ErrLimLo <= ErrLimHi)
{
return ErrLimLo; /// Error limit of a water meter
}
else
{
/// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(ErrLimLo);
float Qp = Math.Abs(ErrLimHi);
float Q = Math.Max(flow, 0.00001f); /// to avoid division by zero
/// Calculate the error limit of a heat meter
switch (metrClass)
{
default:
case 1: return -Math.Min(3.5f, 1.0f + 0.01f * Qp / Q);
case 2: return -Math.Min(5.0f, 2.0f + 0.02f * Qp / Q);
case 3: return -Math.Min(5.0f, 3.0f + 0.05f * Qp / Q);
}
}
}
public virtual float GetErrLimHi(float flow)
{
if (ErrLimLo <= ErrLimHi)
{
return ErrLimHi; /// Error limit of a water meter
}
else
{
/// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(ErrLimLo);
float Qp = Math.Abs(ErrLimHi);
float Q = Math.Max(flow, 0.00001f); /// to avoid division by zero
/// Calculate the error limit of a heat meter
switch (metrClass)
{
default:
case 1: return +Math.Min(3.5f, 1.0f + 0.01f * Qp / Q);
case 2: return +Math.Min(5.0f, 2.0f + 0.02f * Qp / Q);
case 3: return +Math.Min(5.0f, 3.0f + 0.05f * Qp / Q);
}
}
}
public override string ToString()
{
string partStr = (Part > 0) ? string.Format(", part {0}", Part) : string.Empty;
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.17.700.0")]
[assembly: AssemblyFileVersion("2.17.700.0")]
[assembly: AssemblyVersion("2.17.705.0")]
[assembly: AssemblyFileVersion("2.17.705.0")]
+49 -2
View File
@@ -118,8 +118,55 @@ namespace Results.Entities
public virtual double TargetVolume() { return TestData.TargetVolume; }
public virtual double TargetTime() { return TestData.TargetTime; }
public virtual string Method() { return TestData.Method; }
public virtual double ErrLimLo() { return TestData.ErrLimLo; }
public virtual double ErrLimHi() { return TestData.ErrLimHi; }
public virtual double ErrLimLo()
{
if (TestData.ErrLimLo <= TestData.ErrLimHi)
{
return TestData.ErrLimLo; /// Error limit of a water meter
}
else
{
/// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(TestData.ErrLimLo);
double Qp = Math.Abs(TestData.ErrLimHi);
double Q = Math.Max(FlowMean, 0.00001); /// to avoid division by zero
/// Calculate the error limit of a heat meter
switch (metrClass)
{
default:
case 1: return -Math.Min(3.5, 1.0 + 0.01 * Qp / Q);
case 2: return -Math.Min(5.0, 2.0 + 0.02 * Qp / Q);
case 3: return -Math.Min(5.0, 3.0 + 0.05 * Qp / Q);
}
}
}
public virtual double ErrLimHi()
{
if (TestData.ErrLimLo <= TestData.ErrLimHi)
{
return TestData.ErrLimHi; /// Error limit of a water meter
}
else
{
/// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(TestData.ErrLimLo);
double Qp = Math.Abs(TestData.ErrLimHi);
double Q = Math.Max(FlowMean, 0.00001); /// to avoid division by zero
/// Calculate the error limit of a heat meter
switch (metrClass)
{
default:
case 1: return +Math.Min(3.5, 1.0 + 0.01 * Qp / Q);
case 2: return +Math.Min(5.0, 2.0 + 0.02 * Qp / Q);
case 3: return +Math.Min(5.0, 3.0 + 0.05 * Qp / Q);
}
}
}
public virtual double Uncertainty() { return TestData.Uncertainty; }
public virtual float TempLimLo() { return TestData.TempLimLo; }
public virtual float TempLimHi() { return TestData.TempLimHi; }
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.17.700.0")]
[assembly: AssemblyFileVersion("2.17.700.0")]
[assembly: AssemblyVersion("2.17.705.0")]
[assembly: AssemblyFileVersion("2.17.705.0")]
@@ -404,8 +404,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter
meterRslt.TestTime = tstRslt.TestTime;
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
meterRslt.Passed = (meterRslt.Error >= test.ErrLimLo + test.Uncertainty)
&& (meterRslt.Error <= test.ErrLimHi - test.Uncertainty);
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty)
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty);
meterRslt.TestDone = true;
tstRslt.TestDone = true;
}
@@ -689,8 +689,8 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
compoundMeterRslt.PulsesMaster = tstRslt.PulsesMaster;
compoundMeterRslt.TestTime = tstRslt.TestTime;
compoundMeterRslt.Error = Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef);
compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.ErrLimLo + test.Uncertainty)
&& (compoundMeterRslt.Error <= test.ErrLimHi - test.Uncertainty)
compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty)
&& (compoundMeterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty)
&& (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On);
mainMeterRslt.Passed = auxMeterRslt.Passed = compoundMeterRslt.Passed;
mainMeterRslt.TestDone = auxMeterRslt.TestDone = compoundMeterRslt.TestDone = true;
@@ -408,8 +408,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
}
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
meterRslt.Passed = (meterRslt.Error >= test.ErrLimLo + test.Uncertainty)
&& (meterRslt.Error <= test.ErrLimHi - test.Uncertainty)
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty)
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty)
&& (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On);
meterRslt.TestDone = true;
tstRslt.TestDone = true;
@@ -556,8 +556,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
meterRslt.TestTime = tstRslt.TestTime;
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
meterRslt.Passed = (meterRslt.Error >= test.ErrLimLo + test.Uncertainty)
&& (meterRslt.Error <= test.ErrLimHi - test.Uncertainty)
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty)
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty)
&& (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On);
meterRslt.TestDone = true;
tstRslt.TestDone = true;
@@ -992,8 +992,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
compoundMeterRslt.PulsesMaster = tstRslt.PulsesMaster;
compoundMeterRslt.TestTime = tstRslt.TestTime;
compoundMeterRslt.Error = Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef);
compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.ErrLimLo + test.Uncertainty)
&& (compoundMeterRslt.Error <= test.ErrLimHi - test.Uncertainty)
compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty)
&& (compoundMeterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty)
&& (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On);
mainMeterRslt.Passed = auxMeterRslt.Passed = compoundMeterRslt.Passed;
mainMeterRslt.TestDone = auxMeterRslt.TestDone = compoundMeterRslt.TestDone = true;
@@ -1045,8 +1045,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
volumeRslt.Error = Formulas.ErrorFromVolumes(volumeRslt.VolumeMeter, volumeRslt.VolumeRef);
volumeRslt.Passed = !heatMetersTestParams.EvaluateVolume ||
((volumeRslt.Error >= test.ErrLimLo + test.Uncertainty) &&
(volumeRslt.Error <= test.ErrLimHi - test.Uncertainty) &&
((volumeRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) &&
(volumeRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) &&
(tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On));
volumeRslt.TestDone = true;
tstRslt.TestDone = true;
@@ -1094,8 +1094,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
meterRslt.TestTime = tstRslt.TestTime;
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
meterRslt.Passed = (meterRslt.Error >= test.ErrLimLo + test.Uncertainty)
&& (meterRslt.Error <= test.ErrLimHi - test.Uncertainty)
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty)
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty)
&& (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On);
meterRslt.TestDone = true;
tstRslt.TestDone = true;
@@ -585,8 +585,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
volumeRslt.Error = Formulas.ErrorFromVolumes(volumeRslt.VolumeMeter, volumeRslt.VolumeRef);
volumeRslt.Passed = !heatMetersTestParams.EvaluateVolume ||
((volumeRslt.Error >= test.ErrLimLo + test.Uncertainty) &&
(volumeRslt.Error <= test.ErrLimHi - test.Uncertainty) &&
((volumeRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) &&
(volumeRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) &&
(tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On));
volumeRslt.TestDone = true;
tstRslt.TestDone = true;
@@ -679,8 +679,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
}
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
meterRslt.Passed = (meterRslt.Error >= test.ErrLimLo + test.Uncertainty)
&& (meterRslt.Error <= test.ErrLimHi - test.Uncertainty)
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty)
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty)
&& (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On);
meterRslt.TestDone = true;
tstRslt.TestDone = true;
@@ -861,8 +861,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
compoundMeterRslt.PulsesMaster = tstRslt.PulsesMaster;
compoundMeterRslt.TestTime = tstRslt.TestTime;
compoundMeterRslt.Error = Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef);
compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.ErrLimLo + test.Uncertainty)
&& (compoundMeterRslt.Error <= test.ErrLimHi - test.Uncertainty)
compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty)
&& (compoundMeterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty)
&& (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On);
mainMeterRslt.Passed = auxMeterRslt.Passed = compoundMeterRslt.Passed;
mainMeterRslt.TestDone = auxMeterRslt.TestDone = compoundMeterRslt.TestDone = true;
@@ -914,8 +914,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
volumeRslt.Error = Formulas.ErrorFromVolumes(volumeRslt.VolumeMeter, volumeRslt.VolumeRef);
volumeRslt.Passed = !heatMetersTestParams.EvaluateVolume ||
((volumeRslt.Error >= test.ErrLimLo + test.Uncertainty) &&
(volumeRslt.Error <= test.ErrLimHi - test.Uncertainty) &&
((volumeRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) &&
(volumeRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) &&
(tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On));
volumeRslt.TestDone = true;
tstRslt.TestDone = true;
@@ -1009,8 +1009,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
}
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
meterRslt.Passed = (meterRslt.Error >= test.ErrLimLo + test.Uncertainty)
&& (meterRslt.Error <= test.ErrLimHi - test.Uncertainty)
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty)
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty)
&& (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On);
meterRslt.TestDone = true;
tstRslt.TestDone = true;
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.17.704.1")]
[assembly: AssemblyFileVersion("2.17.704.1")]
[assembly: AssemblyVersion("2.17.705.1")]
[assembly: AssemblyFileVersion("2.17.705.1")]
@@ -15,7 +15,7 @@ namespace TBF.TestWizard
{
Qfrom_Qto,
Q_dQ,
Q_dPct
Q_dPct,
}
Test test;
@@ -26,7 +26,7 @@ namespace TBF.TestWizard
{
InitializeComponent();
qSpec = QSpec.Qfrom_Qto;
qSpec = 0;
Text = Strings.Flow_selection;
qFromLabel.Text = Strings.Q_from_m3h;
@@ -55,11 +55,6 @@ namespace TBF.TestWizard
foreach (var path in sensorPaths) sensorsComboBox.Items.Add(path.Name);
RefreshWizardPage();
}
void RefreshWizardPage()
{
qFromTextBox.Text = test.Qfrom.ToString();
qToTextBox.Text = test.Qto.ToString();
nextButton.Enabled = IsFormValid();
@@ -32,23 +32,33 @@ namespace TBF.TestWizard
private void InitializeComponent()
{
this.horizSplitContainer = new System.Windows.Forms.SplitContainer();
this.errLoPctTextBox = new System.Windows.Forms.TextBox();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.errLoPctLabel = new System.Windows.Forms.Label();
this.errHiPctLabel = new System.Windows.Forms.Label();
this.errHiPctTextBox = new System.Windows.Forms.TextBox();
this.errLoPctTextBox = new System.Windows.Forms.TextBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.classComboBox = new System.Windows.Forms.ComboBox();
this.classLabel = new System.Windows.Forms.Label();
this.qpLabel = new System.Windows.Forms.Label();
this.qpTextBox = new System.Windows.Forms.TextBox();
this.uncertaintyTextBox = new System.Windows.Forms.TextBox();
this.durationTextBox = new System.Windows.Forms.TextBox();
this.volumeTextBox = new System.Windows.Forms.TextBox();
this.errHiPctLabel = new System.Windows.Forms.Label();
this.errLoPctLabel = new System.Windows.Forms.Label();
this.uncertaintyLabel = new System.Windows.Forms.Label();
this.durationLabel = new System.Windows.Forms.Label();
this.volumeLabel = new System.Windows.Forms.Label();
this.cancelButton = new System.Windows.Forms.Button();
this.nextButton = new System.Windows.Forms.Button();
this.backButton = new System.Windows.Forms.Button();
this.uncertaintyTextBox = new System.Windows.Forms.TextBox();
this.uncertaintyLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).BeginInit();
this.horizSplitContainer.Panel1.SuspendLayout();
this.horizSplitContainer.Panel2.SuspendLayout();
this.horizSplitContainer.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.SuspendLayout();
//
// horizSplitContainer
@@ -61,14 +71,11 @@ namespace TBF.TestWizard
//
// horizSplitContainer.Panel1
//
this.horizSplitContainer.Panel1.Controls.Add(this.tabControl1);
this.horizSplitContainer.Panel1.Controls.Add(this.uncertaintyTextBox);
this.horizSplitContainer.Panel1.Controls.Add(this.uncertaintyLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.errLoPctTextBox);
this.horizSplitContainer.Panel1.Controls.Add(this.errHiPctTextBox);
this.horizSplitContainer.Panel1.Controls.Add(this.durationTextBox);
this.horizSplitContainer.Panel1.Controls.Add(this.volumeTextBox);
this.horizSplitContainer.Panel1.Controls.Add(this.errHiPctLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.errLoPctLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.uncertaintyLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.durationLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.volumeLabel);
//
@@ -81,72 +88,165 @@ namespace TBF.TestWizard
this.horizSplitContainer.SplitterDistance = 182;
this.horizSplitContainer.TabIndex = 1;
//
// errLoPctTextBox
// tabControl1
//
this.errLoPctTextBox.Location = new System.Drawing.Point(150, 76);
this.errLoPctTextBox.Name = "errLoPctTextBox";
this.errLoPctTextBox.Size = new System.Drawing.Size(86, 20);
this.errLoPctTextBox.TabIndex = 7;
this.errLoPctTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(284, 93);
this.tabControl1.TabIndex = 0;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// tabPage1
//
this.tabPage1.BackColor = System.Drawing.SystemColors.Control;
this.tabPage1.Controls.Add(this.errLoPctLabel);
this.tabPage1.Controls.Add(this.errHiPctLabel);
this.tabPage1.Controls.Add(this.errHiPctTextBox);
this.tabPage1.Controls.Add(this.errLoPctTextBox);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(276, 67);
this.tabPage1.TabIndex = 0;
//
// errLoPctLabel
//
this.errLoPctLabel.AutoSize = true;
this.errLoPctLabel.Location = new System.Drawing.Point(31, 16);
this.errLoPctLabel.Name = "errLoPctLabel";
this.errLoPctLabel.Size = new System.Drawing.Size(85, 13);
this.errLoPctLabel.TabIndex = 0;
this.errLoPctLabel.Text = "Error low limit [%]";
//
// errHiPctLabel
//
this.errHiPctLabel.AutoSize = true;
this.errHiPctLabel.Location = new System.Drawing.Point(31, 41);
this.errHiPctLabel.Name = "errHiPctLabel";
this.errHiPctLabel.Size = new System.Drawing.Size(89, 13);
this.errHiPctLabel.TabIndex = 2;
this.errHiPctLabel.Text = "Error high limit [%]";
//
// errHiPctTextBox
//
this.errHiPctTextBox.Location = new System.Drawing.Point(150, 102);
this.errHiPctTextBox.Location = new System.Drawing.Point(146, 38);
this.errHiPctTextBox.Name = "errHiPctTextBox";
this.errHiPctTextBox.Size = new System.Drawing.Size(86, 20);
this.errHiPctTextBox.TabIndex = 6;
this.errHiPctTextBox.TabIndex = 3;
this.errHiPctTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// errLoPctTextBox
//
this.errLoPctTextBox.Location = new System.Drawing.Point(146, 13);
this.errLoPctTextBox.Name = "errLoPctTextBox";
this.errLoPctTextBox.Size = new System.Drawing.Size(86, 20);
this.errLoPctTextBox.TabIndex = 1;
this.errLoPctTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// tabPage2
//
this.tabPage2.BackColor = System.Drawing.SystemColors.Control;
this.tabPage2.Controls.Add(this.classComboBox);
this.tabPage2.Controls.Add(this.classLabel);
this.tabPage2.Controls.Add(this.qpLabel);
this.tabPage2.Controls.Add(this.qpTextBox);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(276, 67);
this.tabPage2.TabIndex = 1;
//
// classComboBox
//
this.classComboBox.FormattingEnabled = true;
this.classComboBox.Items.AddRange(new object[] {
"1",
"2",
"3"});
this.classComboBox.Location = new System.Drawing.Point(146, 13);
this.classComboBox.Name = "classComboBox";
this.classComboBox.Size = new System.Drawing.Size(86, 21);
this.classComboBox.TabIndex = 1;
this.classComboBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// classLabel
//
this.classLabel.AutoSize = true;
this.classLabel.Location = new System.Drawing.Point(31, 17);
this.classLabel.Name = "classLabel";
this.classLabel.Size = new System.Drawing.Size(32, 13);
this.classLabel.TabIndex = 0;
this.classLabel.Text = "Class";
//
// qpLabel
//
this.qpLabel.AutoSize = true;
this.qpLabel.Location = new System.Drawing.Point(31, 42);
this.qpLabel.Name = "qpLabel";
this.qpLabel.Size = new System.Drawing.Size(55, 13);
this.qpLabel.TabIndex = 2;
this.qpLabel.Text = "Qp [m3/h]";
//
// qpTextBox
//
this.qpTextBox.Location = new System.Drawing.Point(146, 39);
this.qpTextBox.Name = "qpTextBox";
this.qpTextBox.Size = new System.Drawing.Size(86, 20);
this.qpTextBox.TabIndex = 3;
this.qpTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// uncertaintyTextBox
//
this.uncertaintyTextBox.Location = new System.Drawing.Point(150, 100);
this.uncertaintyTextBox.Name = "uncertaintyTextBox";
this.uncertaintyTextBox.Size = new System.Drawing.Size(86, 20);
this.uncertaintyTextBox.TabIndex = 2;
this.uncertaintyTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// durationTextBox
//
this.durationTextBox.Location = new System.Drawing.Point(150, 50);
this.durationTextBox.Location = new System.Drawing.Point(150, 149);
this.durationTextBox.Name = "durationTextBox";
this.durationTextBox.Size = new System.Drawing.Size(86, 20);
this.durationTextBox.TabIndex = 5;
this.durationTextBox.TabIndex = 6;
this.durationTextBox.TextChanged += new System.EventHandler(this.durationTextBox_TextChanged);
//
// volumeTextBox
//
this.volumeTextBox.Location = new System.Drawing.Point(150, 24);
this.volumeTextBox.Location = new System.Drawing.Point(150, 124);
this.volumeTextBox.Name = "volumeTextBox";
this.volumeTextBox.Size = new System.Drawing.Size(86, 20);
this.volumeTextBox.TabIndex = 4;
this.volumeTextBox.TextChanged += new System.EventHandler(this.volumeTextBox_TextChanged);
//
// errHiPctLabel
// uncertaintyLabel
//
this.errHiPctLabel.AutoSize = true;
this.errHiPctLabel.Location = new System.Drawing.Point(35, 105);
this.errHiPctLabel.Name = "errHiPctLabel";
this.errHiPctLabel.Size = new System.Drawing.Size(89, 13);
this.errHiPctLabel.TabIndex = 3;
this.errHiPctLabel.Text = "Error high limit [%]";
//
// errLoPctLabel
//
this.errLoPctLabel.AutoSize = true;
this.errLoPctLabel.Location = new System.Drawing.Point(35, 79);
this.errLoPctLabel.Name = "errLoPctLabel";
this.errLoPctLabel.Size = new System.Drawing.Size(85, 13);
this.errLoPctLabel.TabIndex = 2;
this.errLoPctLabel.Text = "Error low limit [%]";
this.uncertaintyLabel.AutoSize = true;
this.uncertaintyLabel.Location = new System.Drawing.Point(35, 103);
this.uncertaintyLabel.Name = "uncertaintyLabel";
this.uncertaintyLabel.Size = new System.Drawing.Size(78, 13);
this.uncertaintyLabel.TabIndex = 1;
this.uncertaintyLabel.Text = "Uncertainty [%]";
//
// durationLabel
//
this.durationLabel.AutoSize = true;
this.durationLabel.Location = new System.Drawing.Point(35, 53);
this.durationLabel.Location = new System.Drawing.Point(35, 152);
this.durationLabel.Name = "durationLabel";
this.durationLabel.Size = new System.Drawing.Size(83, 13);
this.durationLabel.TabIndex = 1;
this.durationLabel.TabIndex = 5;
this.durationLabel.Text = "Test duration [s]";
//
// volumeLabel
//
this.volumeLabel.AutoSize = true;
this.volumeLabel.Location = new System.Drawing.Point(35, 27);
this.volumeLabel.Location = new System.Drawing.Point(35, 127);
this.volumeLabel.Name = "volumeLabel";
this.volumeLabel.Size = new System.Drawing.Size(53, 13);
this.volumeLabel.TabIndex = 0;
this.volumeLabel.TabIndex = 3;
this.volumeLabel.Text = "Volume [l]";
//
// cancelButton
@@ -156,7 +256,7 @@ namespace TBF.TestWizard
this.cancelButton.Location = new System.Drawing.Point(186, 17);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 42);
this.cancelButton.TabIndex = 27;
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
@@ -167,7 +267,7 @@ namespace TBF.TestWizard
this.nextButton.Location = new System.Drawing.Point(105, 17);
this.nextButton.Name = "nextButton";
this.nextButton.Size = new System.Drawing.Size(75, 42);
this.nextButton.TabIndex = 26;
this.nextButton.TabIndex = 1;
this.nextButton.Text = "&Next >";
this.nextButton.UseVisualStyleBackColor = true;
this.nextButton.Click += new System.EventHandler(this.nextButton_Click);
@@ -179,27 +279,11 @@ namespace TBF.TestWizard
this.backButton.Location = new System.Drawing.Point(24, 17);
this.backButton.Name = "backButton";
this.backButton.Size = new System.Drawing.Size(75, 42);
this.backButton.TabIndex = 25;
this.backButton.TabIndex = 0;
this.backButton.Text = "< &Back";
this.backButton.UseVisualStyleBackColor = true;
this.backButton.Click += new System.EventHandler(this.backButton_Click);
//
// uncertaintyTextBox
//
this.uncertaintyTextBox.Location = new System.Drawing.Point(150, 128);
this.uncertaintyTextBox.Name = "uncertaintyTextBox";
this.uncertaintyTextBox.Size = new System.Drawing.Size(86, 20);
this.uncertaintyTextBox.TabIndex = 9;
//
// uncertaintyLabel
//
this.uncertaintyLabel.AutoSize = true;
this.uncertaintyLabel.Location = new System.Drawing.Point(35, 131);
this.uncertaintyLabel.Name = "uncertaintyLabel";
this.uncertaintyLabel.Size = new System.Drawing.Size(78, 13);
this.uncertaintyLabel.TabIndex = 8;
this.uncertaintyLabel.Text = "Uncertainty [%]";
//
// VolumeAndErrorSelection
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -215,6 +299,11 @@ namespace TBF.TestWizard
this.horizSplitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).EndInit();
this.horizSplitContainer.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.ResumeLayout(false);
}
@@ -235,5 +324,12 @@ namespace TBF.TestWizard
private System.Windows.Forms.Label volumeLabel;
private System.Windows.Forms.TextBox uncertaintyTextBox;
private System.Windows.Forms.Label uncertaintyLabel;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Label classLabel;
private System.Windows.Forms.Label qpLabel;
private System.Windows.Forms.TextBox qpTextBox;
private System.Windows.Forms.ComboBox classComboBox;
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Windows.Forms;
@@ -10,17 +10,20 @@ namespace TBF.TestWizard
{
public partial class VolumeAndErrorSelection : Form
{
enum TabId
{
WaterMeterTab,
HeatMeterTab,
}
Test test;
TabId tabId;
public VolumeAndErrorSelection()
{
InitializeComponent();
}
public VolumeAndErrorSelection(bool first, bool last, Test test)
: this()
{
this.test = test;
tabId = 0;
Text = Strings.Volume_and_error_selection;
volumeLabel.Text = Strings.Volume + " [l]";
@@ -31,6 +34,16 @@ namespace TBF.TestWizard
backButton.Text = Strings.BackBtnText;
nextButton.Text = Strings.FinishBtnText;
cancelButton.Text = Strings.CancelBtnText;
tabPage1.Text = Strings.Water_Meter;
tabPage2.Text = Strings.Heat_meter;
classLabel.Text = Strings.Metrological_class;
qpLabel.Text = "Qp [m3/h]";
}
public VolumeAndErrorSelection(bool first, bool last, Test test)
: this()
{
this.test = test;
if (first) backButton.Visible = false;
if (last) nextButton.Text = Strings.FinishBtnText;
@@ -40,37 +53,60 @@ namespace TBF.TestWizard
{
if (test == null) return;
RefreshWizardPage();
}
void RefreshWizardPage()
{
volumeTextBox.Text = test.Volume.ToString();
durationTextBox.Text = test.TstTime.ToString();
errLoPctTextBox.Text = test.ErrLimLo.ToString();
errHiPctTextBox.Text = test.ErrLimHi.ToString();
uncertaintyTextBox.Text = test.Uncertainty.ToString();
classComboBox.Text = "1";
nextButton.Enabled = IsFormValid();
}
bool IsFormValid()
{
int idummy;
float dummy;
return Utils.TryParseUFloat(volumeTextBox.Text, out dummy) &&
Utils.TryParseUFloat(durationTextBox.Text, out dummy) &&
Utils.TryParseSFloat(errLoPctTextBox.Text, out dummy) &&
Utils.TryParseSFloat(errHiPctTextBox.Text, out dummy) &&
Utils.TryParseUFloat(uncertaintyTextBox.Text, out dummy);
bool tabsValid;
switch (tabId)
{
default:
case TabId.WaterMeterTab:
tabsValid = Utils.TryParseSFloat(errLoPctTextBox.Text, out dummy)
&& Utils.TryParseSFloat(errHiPctTextBox.Text, out dummy);
break;
case TabId.HeatMeterTab:
tabsValid = int.TryParse(classComboBox.Text, out idummy)
&& idummy >= 1 && idummy <= 3
&& Utils.TryParseUFloat(qpTextBox.Text, out dummy);
break;
}
/// Return complete result
return tabsValid && Utils.TryParseUFloat(volumeTextBox.Text, out dummy)
&& Utils.TryParseUFloat(durationTextBox.Text, out dummy)
&& Utils.TryParseUFloat(uncertaintyTextBox.Text, out dummy);
}
void UpdateTest()
{
test.Volume = Utils.ParseUFloat(volumeTextBox.Text);
test.TstTime = Utils.ParseUFloat(durationTextBox.Text);
test.Uncertainty = Utils.ParseUFloat(uncertaintyTextBox.Text);
switch (tabId)
{
default:
case TabId.WaterMeterTab:
test.ErrLimLo = Utils.ParseSFloat(errLoPctTextBox.Text);
test.ErrLimHi = Utils.ParseSFloat(errHiPctTextBox.Text);
test.Uncertainty = Utils.ParseUFloat(uncertaintyTextBox.Text);
break;
case TabId.HeatMeterTab:
test.ErrLimLo = (float)int.Parse(classComboBox.Text);
test.ErrLimHi = -Utils.ParseUFloat(qpTextBox.Text);
break;
}
}
private void backButton_Click(object sender, EventArgs e)
@@ -130,5 +166,22 @@ namespace TBF.TestWizard
}
anyTextBox_TextChanged(sender, e);
}
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
switch ((TabId)tabControl1.SelectedIndex)
{
default:
case TabId.WaterMeterTab:
tabId = TabId.WaterMeterTab;
break;
case TabId.HeatMeterTab:
tabId = TabId.HeatMeterTab;
break;
}
nextButton.Enabled = IsFormValid();
}
}
}