DB change : 'RangeIx' added to Entities.MeasurementCorrection, Elde.FlowMeter supports multiple correction curves, etc, ver. 2.18.787

This commit is contained in:
Milan Hanajik 2018-01-24 14:16:38 +01:00
parent b0238fc0a3
commit 566dfb7ba8
23 changed files with 1236 additions and 351 deletions

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
@ -8,7 +8,15 @@ namespace Config.Entities
public class MeasurementCorrection
{
public virtual int Id { get; protected set; }
public virtual int RangeIx { get; set; } /// 0..5
public virtual float Measurement { get; set; }
public virtual float Correction { get; set; }
public MeasurementCorrection() { }
public MeasurementCorrection(int rangeIx)
{
RangeIx = rangeIx;
}
}
}

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Config.Entities;
@ -11,6 +11,7 @@ namespace Config.Mappings
public MeasurementCorrectionMap()
{
Id(x => x.Id);
Map(x => x.RangeIx);
Map(x => x.Measurement);
Map(x => x.Correction);
}

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sensus")]
[assembly: AssemblyProduct("Config")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2016 Sensus Slovensko a.s.")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2018 Sensus Slovensko a.s.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -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.771.0")]
[assembly: AssemblyFileVersion("2.17.771.0")]
[assembly: AssemblyVersion("2.18.787.0")]
[assembly: AssemblyFileVersion("2.18.787.0")]

View File

@ -19,13 +19,9 @@ namespace TBF.BenchControl.Dummy.FlowMeter
public float LtrPerPulse { get { return flowMeterCfg.NominalFlow / 7200.0f; } }
public float LtrPerPulseCorrected(double flow)
public float LtrPerPulseCorrected(double flow, int rangeIx)
{
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
/// Apply correction
double correctedFlow = BenchControl.Formulas.CorrectedValue(flow, Corrections);
return (float)(LtrPerPulse * correctedFlow / flow);
return (float)flow;
}
public int Idx1 { get { return 1; } }

View File

@ -9,7 +9,7 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Dummy.FlowMeter
{
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibInfoCfg, IComponentCfg
public class FlowMeterCfg : ComponentCfgBase, IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FlowMeterCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
@ -21,26 +21,6 @@ namespace TBF.BenchControl.Dummy.FlowMeter
///
public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz
/// Calibration info serialized parameters displayed in Metrology tab page
string calibCertificateNr;
DateTime calibDate;
DateTime calibValidDate;
public string CalibCertificateNr
{
get { return calibCertificateNr; }
set { calibCertificateNr = value; }
}
public DateTime CalibDate
{
get { return calibDate; }
set { calibDate = value; }
}
public DateTime CalibValidDate
{
get { return calibValidDate; }
set { calibValidDate = value; }
}
/// Private parameterless constructor invoked by all other (public) constructors
FlowMeterCfg()

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -20,15 +20,28 @@ namespace TBF.BenchControl.Elde.FlowMeter
public float NominalFlow { get { return flowMeterCfg.NominalFlow; } }
public float LtrPerPulse { get { return flowMeterCfg.NominalFlow / 7200.0f; } } /// Nominal frequency is 2000 Hz
public float LtrPerPulseCorrected(double flow)
public float LtrPerPulseCorrected(double flow, int rangeIx)
{
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
/// Apply correction
double correctedFlow = BenchControl.Formulas.CorrectedValue(flow, Corrections);
var rangeCorrections = new List<Config.Entities.MeasurementCorrection>();
foreach (var corr in Corrections)
{
if (corr.RangeIx == rangeIx) rangeCorrections.Add(corr);
}
double correctedFlow = BenchControl.Formulas.CorrectedValue(flow, rangeCorrections);
return (float)(LtrPerPulse * correctedFlow / flow);
}
public bool RangeEnabled(int ix) { return flowMeterCfg.RangeEnabled(ix); }
public double GetTempLo(int ix) { return flowMeterCfg.GetTempLo(ix); }
public double GetTempHi(int ix) { return flowMeterCfg.GetTempHi(ix); }
public double GetPressLo(int ix) { return flowMeterCfg.GetPressLo(ix); }
public double GetPressHi(int ix) { return flowMeterCfg.GetPressHi(ix); }
public FlowMeter()
{
}

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -22,24 +22,204 @@ namespace TBF.BenchControl.Elde.FlowMeter
public int Idx1; /// 1..7
public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz
public double Temp1Lo; /// 4x zero means the range is disabled
public double Temp1Hi;
public double Press1Lo;
public double Press1Hi;
public double Temp2Lo; /// 4x zero means the range is disabled
public double Temp2Hi;
public double Press2Lo;
public double Press2Hi;
public double Temp3Lo; /// 4x zero means the range is disabled
public double Temp3Hi;
public double Press3Lo;
public double Press3Hi;
public double Temp4Lo; /// 4x zero means the range is disabled
public double Temp4Hi;
public double Press4Lo;
public double Press4Hi;
public double Temp5Lo; /// 4x zero means the range is disabled
public double Temp5Hi;
public double Press5Lo;
public double Press5Hi;
public bool RangeEnabled(int rangeIx1)
{
switch (rangeIx1)
{
default:
case 0: return !(RangeEnabled(1) || RangeEnabled(2) || RangeEnabled(3) || RangeEnabled(4) || RangeEnabled(5));
case 1: return (Temp1Lo != 0) || (Temp1Hi != 0) || (Press1Lo != 0) || (Press1Hi != 0);
case 2: return (Temp2Lo != 0) || (Temp2Hi != 0) || (Press2Lo != 0) || (Press2Hi != 0);
case 3: return (Temp3Lo != 0) || (Temp3Hi != 0) || (Press3Lo != 0) || (Press3Hi != 0);
case 4: return (Temp4Lo != 0) || (Temp4Hi != 0) || (Press4Lo != 0) || (Press4Hi != 0);
case 5: return (Temp5Lo != 0) || (Temp5Hi != 0) || (Press5Lo != 0) || (Press5Hi != 0);
}
}
public double GetTempLo(int rangeIx1)
{
switch (rangeIx1)
{
default:
case 0: return 5.0; /// °C
case 1: return Temp1Lo;
case 2: return Temp2Lo;
case 3: return Temp3Lo;
case 4: return Temp4Lo;
case 5: return Temp5Lo;
}
}
public double GetTempHi(int rangeIx1)
{
switch (rangeIx1)
{
default:
case 0: return 95.0; /// °C
case 1: return Temp1Hi;
case 2: return Temp2Hi;
case 3: return Temp3Hi;
case 4: return Temp4Hi;
case 5: return Temp5Hi;
}
}
public double GetPressLo(int rangeIx1)
{
switch (rangeIx1)
{
default:
case 0: return 0; /// bar
case 1: return Press1Lo;
case 2: return Press2Lo;
case 3: return Press3Lo;
case 4: return Press4Lo;
case 5: return Press5Lo;
}
}
public double GetPressHi(int rangeIx1)
{
switch (rangeIx1)
{
default:
case 0: return 16.0; /// bar
case 1: return Press1Hi;
case 2: return Press2Hi;
case 3: return Press3Hi;
case 4: return Press4Hi;
case 5: return Press5Hi;
}
}
/// Calibration info serialized parameters displayed in Metrology tab page
string calibCertificateNr;
DateTime calibDate;
DateTime calibValidDate;
public string CalibCertificateNr
public string CalibCertificateNr;
public string CalibCertificate1;
public string CalibCertificate2;
public string CalibCertificate3;
public string CalibCertificate4;
public string CalibCertificate5;
public DateTime CalibDate;
public DateTime CalibDate1;
public DateTime CalibDate2;
public DateTime CalibDate3;
public DateTime CalibDate4;
public DateTime CalibDate5;
public DateTime CalibValidDate;
public DateTime CalibValidDate1;
public DateTime CalibValidDate2;
public DateTime CalibValidDate3;
public DateTime CalibValidDate4;
public DateTime CalibValidDate5;
public string GetCalibCertificate(int rangeIx1)
{
get { return calibCertificateNr; }
set { calibCertificateNr = value; }
switch (rangeIx1)
{
default:
case 0: return CalibCertificateNr;
case 1: return CalibCertificate1;
case 2: return CalibCertificate2;
case 3: return CalibCertificate3;
case 4: return CalibCertificate4;
case 5: return CalibCertificate5;
}
}
public DateTime CalibDate
public void SetCalibCertificate(int rangeIx1, string certificate)
{
get { return calibDate; }
set { calibDate = value; }
switch (rangeIx1)
{
default:
case 0: CalibCertificateNr = certificate; return;
case 1: CalibCertificate1 = certificate; return;
case 2: CalibCertificate2 = certificate; return;
case 3: CalibCertificate3 = certificate; return;
case 4: CalibCertificate4 = certificate; return;
case 5: CalibCertificate5 = certificate; return;
}
}
public DateTime CalibValidDate
public DateTime GetCalibDate(int rangeIx1)
{
get { return calibValidDate; }
set { calibValidDate = value; }
switch (rangeIx1)
{
default:
case 0: return CalibDate;
case 1: return CalibDate1;
case 2: return CalibDate2;
case 3: return CalibDate3;
case 4: return CalibDate4;
case 5: return CalibDate5;
}
}
public void SetCalibDate(int rangeIx1, DateTime calibDate)
{
switch (rangeIx1)
{
default:
case 0: CalibDate = calibDate; return;
case 1: CalibDate1 = calibDate; return;
case 2: CalibDate2 = calibDate; return;
case 3: CalibDate3 = calibDate; return;
case 4: CalibDate4 = calibDate; return;
case 5: CalibDate5 = calibDate; return;
}
}
public DateTime GetCalibValidDate(int rangeIx1)
{
switch (rangeIx1)
{
default:
case 0: return CalibValidDate;
case 1: return CalibValidDate1;
case 2: return CalibValidDate2;
case 3: return CalibValidDate3;
case 4: return CalibValidDate4;
case 5: return CalibValidDate5;
}
}
public void SetCalibValidDate(int rangeIx1, DateTime calibValidDate)
{
switch (rangeIx1)
{
default:
case 0: CalibValidDate = calibValidDate; return;
case 1: CalibValidDate1 = calibValidDate; return;
case 2: CalibValidDate2 = calibValidDate; return;
case 3: CalibValidDate3 = calibValidDate; return;
case 4: CalibValidDate4 = calibValidDate; return;
case 5: CalibValidDate5 = calibValidDate; return;
}
}

View File

@ -31,113 +31,432 @@ namespace TBF.BenchControl.Elde.FlowMeter
/// </summary>
private void InitializeComponent()
{
this.positionTextBox = new System.Windows.Forms.TextBox();
this.positionLabel = new System.Windows.Forms.Label();
this.parentNameLabel = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.nominalFlowTextBox = new System.Windows.Forms.TextBox();
this.nominalFlowLabel = new System.Windows.Forms.Label();
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// positionTextBox
//
this.positionTextBox.Enabled = false;
this.positionTextBox.Location = new System.Drawing.Point(224, 113);
this.positionTextBox.Name = "positionTextBox";
this.positionTextBox.Size = new System.Drawing.Size(46, 20);
this.positionTextBox.TabIndex = 6;
//
// positionLabel
//
this.positionLabel.AutoSize = true;
this.positionLabel.Location = new System.Drawing.Point(30, 116);
this.positionLabel.Name = "positionLabel";
this.positionLabel.Size = new System.Drawing.Size(44, 13);
this.positionLabel.TabIndex = 5;
this.positionLabel.Text = "Position";
//
// parentNameLabel
//
this.parentNameLabel.AutoSize = true;
this.parentNameLabel.Location = new System.Drawing.Point(30, 90);
this.parentNameLabel.Name = "parentNameLabel";
this.parentNameLabel.Size = new System.Drawing.Size(69, 13);
this.parentNameLabel.TabIndex = 3;
this.parentNameLabel.Text = "Parent Name";
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(140, 61);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(30, 64);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(137, 37);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// nominalFlowTextBox
//
this.nominalFlowTextBox.Enabled = false;
this.nominalFlowTextBox.Location = new System.Drawing.Point(224, 138);
this.nominalFlowTextBox.Name = "nominalFlowTextBox";
this.nominalFlowTextBox.Size = new System.Drawing.Size(46, 20);
this.nominalFlowTextBox.TabIndex = 8;
//
// nominalFlowLabel
//
this.nominalFlowLabel.AutoSize = true;
this.nominalFlowLabel.Location = new System.Drawing.Point(30, 141);
this.nominalFlowLabel.Name = "nominalFlowLabel";
this.nominalFlowLabel.Size = new System.Drawing.Size(140, 13);
this.nominalFlowLabel.TabIndex = 7;
this.nominalFlowLabel.Text = "Nominal flow [m3/h @2kHz]";
//
// parentNameComboBox
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(140, 87);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
this.parentNameComboBox.TabIndex = 4;
//
// FlowMeterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.parentNameComboBox);
this.Controls.Add(this.nominalFlowTextBox);
this.Controls.Add(this.nominalFlowLabel);
this.Controls.Add(this.positionTextBox);
this.Controls.Add(this.positionLabel);
this.Controls.Add(this.parentNameLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "FlowMeterCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.FlowMeterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
this.positionTextBox = new System.Windows.Forms.TextBox();
this.positionLabel = new System.Windows.Forms.Label();
this.parentNameLabel = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.nominalFlowTextBox = new System.Windows.Forms.TextBox();
this.nominalFlowLabel = new System.Windows.Forms.Label();
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
this.tempLo1TextBox = new System.Windows.Forms.TextBox();
this.tempHi1TextBox = new System.Windows.Forms.TextBox();
this.pressLo1TextBox = new System.Windows.Forms.TextBox();
this.pressHi1TextBox = new System.Windows.Forms.TextBox();
this.pressHi2TextBox = new System.Windows.Forms.TextBox();
this.pressLo2TextBox = new System.Windows.Forms.TextBox();
this.tempHi2TextBox = new System.Windows.Forms.TextBox();
this.tempLo2TextBox = new System.Windows.Forms.TextBox();
this.pressHi3TextBox = new System.Windows.Forms.TextBox();
this.pressLo3TextBox = new System.Windows.Forms.TextBox();
this.tempHi3TextBox = new System.Windows.Forms.TextBox();
this.tempLo3TextBox = new System.Windows.Forms.TextBox();
this.pressHi4TextBox = new System.Windows.Forms.TextBox();
this.pressLo4TextBox = new System.Windows.Forms.TextBox();
this.tempHi4TextBox = new System.Windows.Forms.TextBox();
this.tempLo4TextBox = new System.Windows.Forms.TextBox();
this.pressHi5TextBox = new System.Windows.Forms.TextBox();
this.pressLo5TextBox = new System.Windows.Forms.TextBox();
this.tempHi5TextBox = new System.Windows.Forms.TextBox();
this.tempLo5TextBox = new System.Windows.Forms.TextBox();
this.rangeCheckBox1 = new System.Windows.Forms.CheckBox();
this.rangeCheckBox2 = new System.Windows.Forms.CheckBox();
this.rangeCheckBox3 = new System.Windows.Forms.CheckBox();
this.rangeCheckBox4 = new System.Windows.Forms.CheckBox();
this.rangeCheckBox5 = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// positionTextBox
//
this.positionTextBox.Enabled = false;
this.positionTextBox.Location = new System.Drawing.Point(224, 113);
this.positionTextBox.Name = "positionTextBox";
this.positionTextBox.Size = new System.Drawing.Size(46, 20);
this.positionTextBox.TabIndex = 6;
//
// positionLabel
//
this.positionLabel.AutoSize = true;
this.positionLabel.Location = new System.Drawing.Point(30, 116);
this.positionLabel.Name = "positionLabel";
this.positionLabel.Size = new System.Drawing.Size(44, 13);
this.positionLabel.TabIndex = 5;
this.positionLabel.Text = "Position";
//
// parentNameLabel
//
this.parentNameLabel.AutoSize = true;
this.parentNameLabel.Location = new System.Drawing.Point(30, 90);
this.parentNameLabel.Name = "parentNameLabel";
this.parentNameLabel.Size = new System.Drawing.Size(69, 13);
this.parentNameLabel.TabIndex = 3;
this.parentNameLabel.Text = "Parent Name";
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(140, 61);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(30, 64);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(137, 37);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// nominalFlowTextBox
//
this.nominalFlowTextBox.Enabled = false;
this.nominalFlowTextBox.Location = new System.Drawing.Point(224, 138);
this.nominalFlowTextBox.Name = "nominalFlowTextBox";
this.nominalFlowTextBox.Size = new System.Drawing.Size(46, 20);
this.nominalFlowTextBox.TabIndex = 8;
//
// nominalFlowLabel
//
this.nominalFlowLabel.AutoSize = true;
this.nominalFlowLabel.Location = new System.Drawing.Point(30, 141);
this.nominalFlowLabel.Name = "nominalFlowLabel";
this.nominalFlowLabel.Size = new System.Drawing.Size(140, 13);
this.nominalFlowLabel.TabIndex = 7;
this.nominalFlowLabel.Text = "Nominal flow [m3/h @2kHz]";
//
// parentNameComboBox
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(140, 87);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
this.parentNameComboBox.TabIndex = 4;
//
// tempLo1TextBox
//
this.tempLo1TextBox.Enabled = false;
this.tempLo1TextBox.Location = new System.Drawing.Point(140, 205);
this.tempLo1TextBox.Name = "tempLo1TextBox";
this.tempLo1TextBox.Size = new System.Drawing.Size(68, 20);
this.tempLo1TextBox.TabIndex = 10;
//
// tempHi1TextBox
//
this.tempHi1TextBox.Enabled = false;
this.tempHi1TextBox.Location = new System.Drawing.Point(220, 205);
this.tempHi1TextBox.Name = "tempHi1TextBox";
this.tempHi1TextBox.Size = new System.Drawing.Size(68, 20);
this.tempHi1TextBox.TabIndex = 11;
//
// pressLo1TextBox
//
this.pressLo1TextBox.Enabled = false;
this.pressLo1TextBox.Location = new System.Drawing.Point(300, 205);
this.pressLo1TextBox.Name = "pressLo1TextBox";
this.pressLo1TextBox.Size = new System.Drawing.Size(68, 20);
this.pressLo1TextBox.TabIndex = 12;
//
// pressHi1TextBox
//
this.pressHi1TextBox.Enabled = false;
this.pressHi1TextBox.Location = new System.Drawing.Point(380, 205);
this.pressHi1TextBox.Name = "pressHi1TextBox";
this.pressHi1TextBox.Size = new System.Drawing.Size(68, 20);
this.pressHi1TextBox.TabIndex = 13;
//
// pressHi2TextBox
//
this.pressHi2TextBox.Enabled = false;
this.pressHi2TextBox.Location = new System.Drawing.Point(380, 228);
this.pressHi2TextBox.Name = "pressHi2TextBox";
this.pressHi2TextBox.Size = new System.Drawing.Size(68, 20);
this.pressHi2TextBox.TabIndex = 18;
//
// pressLo2TextBox
//
this.pressLo2TextBox.Enabled = false;
this.pressLo2TextBox.Location = new System.Drawing.Point(300, 228);
this.pressLo2TextBox.Name = "pressLo2TextBox";
this.pressLo2TextBox.Size = new System.Drawing.Size(68, 20);
this.pressLo2TextBox.TabIndex = 17;
//
// tempHi2TextBox
//
this.tempHi2TextBox.Enabled = false;
this.tempHi2TextBox.Location = new System.Drawing.Point(220, 228);
this.tempHi2TextBox.Name = "tempHi2TextBox";
this.tempHi2TextBox.Size = new System.Drawing.Size(68, 20);
this.tempHi2TextBox.TabIndex = 16;
//
// tempLo2TextBox
//
this.tempLo2TextBox.Enabled = false;
this.tempLo2TextBox.Location = new System.Drawing.Point(140, 228);
this.tempLo2TextBox.Name = "tempLo2TextBox";
this.tempLo2TextBox.Size = new System.Drawing.Size(68, 20);
this.tempLo2TextBox.TabIndex = 15;
//
// pressHi3TextBox
//
this.pressHi3TextBox.Enabled = false;
this.pressHi3TextBox.Location = new System.Drawing.Point(380, 251);
this.pressHi3TextBox.Name = "pressHi3TextBox";
this.pressHi3TextBox.Size = new System.Drawing.Size(68, 20);
this.pressHi3TextBox.TabIndex = 23;
//
// pressLo3TextBox
//
this.pressLo3TextBox.Enabled = false;
this.pressLo3TextBox.Location = new System.Drawing.Point(300, 251);
this.pressLo3TextBox.Name = "pressLo3TextBox";
this.pressLo3TextBox.Size = new System.Drawing.Size(68, 20);
this.pressLo3TextBox.TabIndex = 22;
//
// tempHi3TextBox
//
this.tempHi3TextBox.Enabled = false;
this.tempHi3TextBox.Location = new System.Drawing.Point(220, 251);
this.tempHi3TextBox.Name = "tempHi3TextBox";
this.tempHi3TextBox.Size = new System.Drawing.Size(68, 20);
this.tempHi3TextBox.TabIndex = 21;
//
// tempLo3TextBox
//
this.tempLo3TextBox.Enabled = false;
this.tempLo3TextBox.Location = new System.Drawing.Point(140, 251);
this.tempLo3TextBox.Name = "tempLo3TextBox";
this.tempLo3TextBox.Size = new System.Drawing.Size(68, 20);
this.tempLo3TextBox.TabIndex = 20;
//
// pressHi4TextBox
//
this.pressHi4TextBox.Enabled = false;
this.pressHi4TextBox.Location = new System.Drawing.Point(380, 274);
this.pressHi4TextBox.Name = "pressHi4TextBox";
this.pressHi4TextBox.Size = new System.Drawing.Size(68, 20);
this.pressHi4TextBox.TabIndex = 28;
//
// pressLo4TextBox
//
this.pressLo4TextBox.Enabled = false;
this.pressLo4TextBox.Location = new System.Drawing.Point(300, 274);
this.pressLo4TextBox.Name = "pressLo4TextBox";
this.pressLo4TextBox.Size = new System.Drawing.Size(68, 20);
this.pressLo4TextBox.TabIndex = 27;
//
// tempHi4TextBox
//
this.tempHi4TextBox.Enabled = false;
this.tempHi4TextBox.Location = new System.Drawing.Point(220, 274);
this.tempHi4TextBox.Name = "tempHi4TextBox";
this.tempHi4TextBox.Size = new System.Drawing.Size(68, 20);
this.tempHi4TextBox.TabIndex = 26;
//
// tempLo4TextBox
//
this.tempLo4TextBox.Enabled = false;
this.tempLo4TextBox.Location = new System.Drawing.Point(140, 274);
this.tempLo4TextBox.Name = "tempLo4TextBox";
this.tempLo4TextBox.Size = new System.Drawing.Size(68, 20);
this.tempLo4TextBox.TabIndex = 25;
//
// pressHi5TextBox
//
this.pressHi5TextBox.Enabled = false;
this.pressHi5TextBox.Location = new System.Drawing.Point(380, 297);
this.pressHi5TextBox.Name = "pressHi5TextBox";
this.pressHi5TextBox.Size = new System.Drawing.Size(68, 20);
this.pressHi5TextBox.TabIndex = 33;
//
// pressLo5TextBox
//
this.pressLo5TextBox.Enabled = false;
this.pressLo5TextBox.Location = new System.Drawing.Point(300, 297);
this.pressLo5TextBox.Name = "pressLo5TextBox";
this.pressLo5TextBox.Size = new System.Drawing.Size(68, 20);
this.pressLo5TextBox.TabIndex = 32;
//
// tempHi5TextBox
//
this.tempHi5TextBox.Enabled = false;
this.tempHi5TextBox.Location = new System.Drawing.Point(220, 297);
this.tempHi5TextBox.Name = "tempHi5TextBox";
this.tempHi5TextBox.Size = new System.Drawing.Size(68, 20);
this.tempHi5TextBox.TabIndex = 31;
//
// tempLo5TextBox
//
this.tempLo5TextBox.Enabled = false;
this.tempLo5TextBox.Location = new System.Drawing.Point(140, 297);
this.tempLo5TextBox.Name = "tempLo5TextBox";
this.tempLo5TextBox.Size = new System.Drawing.Size(68, 20);
this.tempLo5TextBox.TabIndex = 30;
//
// rangeCheckBox1
//
this.rangeCheckBox1.AutoSize = true;
this.rangeCheckBox1.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.rangeCheckBox1.Enabled = false;
this.rangeCheckBox1.Location = new System.Drawing.Point(32, 207);
this.rangeCheckBox1.Name = "rangeCheckBox1";
this.rangeCheckBox1.Size = new System.Drawing.Size(67, 17);
this.rangeCheckBox1.TabIndex = 34;
this.rangeCheckBox1.Text = "Range 1";
this.rangeCheckBox1.UseVisualStyleBackColor = true;
this.rangeCheckBox1.CheckedChanged += new System.EventHandler(this.rangeCheckBox1_CheckedChanged);
//
// rangeCheckBox2
//
this.rangeCheckBox2.AutoSize = true;
this.rangeCheckBox2.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.rangeCheckBox2.Enabled = false;
this.rangeCheckBox2.Location = new System.Drawing.Point(32, 230);
this.rangeCheckBox2.Name = "rangeCheckBox2";
this.rangeCheckBox2.Size = new System.Drawing.Size(67, 17);
this.rangeCheckBox2.TabIndex = 35;
this.rangeCheckBox2.Text = "Range 2";
this.rangeCheckBox2.UseVisualStyleBackColor = true;
this.rangeCheckBox2.CheckedChanged += new System.EventHandler(this.rangeCheckBox2_CheckedChanged);
//
// rangeCheckBox3
//
this.rangeCheckBox3.AutoSize = true;
this.rangeCheckBox3.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.rangeCheckBox3.Enabled = false;
this.rangeCheckBox3.Location = new System.Drawing.Point(32, 253);
this.rangeCheckBox3.Name = "rangeCheckBox3";
this.rangeCheckBox3.Size = new System.Drawing.Size(67, 17);
this.rangeCheckBox3.TabIndex = 36;
this.rangeCheckBox3.Text = "Range 3";
this.rangeCheckBox3.UseVisualStyleBackColor = true;
this.rangeCheckBox3.CheckedChanged += new System.EventHandler(this.rangeCheckBox3_CheckedChanged);
//
// rangeCheckBox4
//
this.rangeCheckBox4.AutoSize = true;
this.rangeCheckBox4.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.rangeCheckBox4.Enabled = false;
this.rangeCheckBox4.Location = new System.Drawing.Point(32, 276);
this.rangeCheckBox4.Name = "rangeCheckBox4";
this.rangeCheckBox4.Size = new System.Drawing.Size(67, 17);
this.rangeCheckBox4.TabIndex = 37;
this.rangeCheckBox4.Text = "Range 4";
this.rangeCheckBox4.UseVisualStyleBackColor = true;
this.rangeCheckBox4.CheckedChanged += new System.EventHandler(this.rangeCheckBox4_CheckedChanged);
//
// rangeCheckBox5
//
this.rangeCheckBox5.AutoSize = true;
this.rangeCheckBox5.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.rangeCheckBox5.Enabled = false;
this.rangeCheckBox5.Location = new System.Drawing.Point(32, 299);
this.rangeCheckBox5.Name = "rangeCheckBox5";
this.rangeCheckBox5.Size = new System.Drawing.Size(67, 17);
this.rangeCheckBox5.TabIndex = 38;
this.rangeCheckBox5.Text = "Range 5";
this.rangeCheckBox5.UseVisualStyleBackColor = true;
this.rangeCheckBox5.CheckedChanged += new System.EventHandler(this.rangeCheckBox5_CheckedChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(149, 186);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(52, 13);
this.label1.TabIndex = 39;
this.label1.Text = "Temp. Lo";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(229, 186);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(50, 13);
this.label2.TabIndex = 40;
this.label2.Text = "Temp. Hi";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(309, 186);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(51, 13);
this.label3.TabIndex = 41;
this.label3.Text = "Press. Lo";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(389, 186);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(49, 13);
this.label4.TabIndex = 42;
this.label4.Text = "Press. Hi";
//
// FlowMeterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.rangeCheckBox5);
this.Controls.Add(this.rangeCheckBox4);
this.Controls.Add(this.rangeCheckBox3);
this.Controls.Add(this.rangeCheckBox2);
this.Controls.Add(this.rangeCheckBox1);
this.Controls.Add(this.pressHi5TextBox);
this.Controls.Add(this.pressLo5TextBox);
this.Controls.Add(this.tempHi5TextBox);
this.Controls.Add(this.tempLo5TextBox);
this.Controls.Add(this.pressHi4TextBox);
this.Controls.Add(this.pressLo4TextBox);
this.Controls.Add(this.tempHi4TextBox);
this.Controls.Add(this.tempLo4TextBox);
this.Controls.Add(this.pressHi3TextBox);
this.Controls.Add(this.pressLo3TextBox);
this.Controls.Add(this.tempHi3TextBox);
this.Controls.Add(this.tempLo3TextBox);
this.Controls.Add(this.pressHi2TextBox);
this.Controls.Add(this.pressLo2TextBox);
this.Controls.Add(this.tempHi2TextBox);
this.Controls.Add(this.tempLo2TextBox);
this.Controls.Add(this.pressHi1TextBox);
this.Controls.Add(this.pressLo1TextBox);
this.Controls.Add(this.tempHi1TextBox);
this.Controls.Add(this.tempLo1TextBox);
this.Controls.Add(this.parentNameComboBox);
this.Controls.Add(this.nominalFlowTextBox);
this.Controls.Add(this.nominalFlowLabel);
this.Controls.Add(this.positionTextBox);
this.Controls.Add(this.positionLabel);
this.Controls.Add(this.parentNameLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "FlowMeterCfgCtrl";
this.Size = new System.Drawing.Size(492, 350);
this.Load += new System.EventHandler(this.FlowMeterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
@ -152,5 +471,34 @@ namespace TBF.BenchControl.Elde.FlowMeter
private System.Windows.Forms.TextBox nominalFlowTextBox;
private System.Windows.Forms.Label nominalFlowLabel;
private System.Windows.Forms.ComboBox parentNameComboBox;
private System.Windows.Forms.TextBox tempLo1TextBox;
private System.Windows.Forms.TextBox tempHi1TextBox;
private System.Windows.Forms.TextBox pressLo1TextBox;
private System.Windows.Forms.TextBox pressHi1TextBox;
private System.Windows.Forms.TextBox pressHi2TextBox;
private System.Windows.Forms.TextBox pressLo2TextBox;
private System.Windows.Forms.TextBox tempHi2TextBox;
private System.Windows.Forms.TextBox tempLo2TextBox;
private System.Windows.Forms.TextBox pressHi3TextBox;
private System.Windows.Forms.TextBox pressLo3TextBox;
private System.Windows.Forms.TextBox tempHi3TextBox;
private System.Windows.Forms.TextBox tempLo3TextBox;
private System.Windows.Forms.TextBox pressHi4TextBox;
private System.Windows.Forms.TextBox pressLo4TextBox;
private System.Windows.Forms.TextBox tempHi4TextBox;
private System.Windows.Forms.TextBox tempLo4TextBox;
private System.Windows.Forms.TextBox pressHi5TextBox;
private System.Windows.Forms.TextBox pressLo5TextBox;
private System.Windows.Forms.TextBox tempHi5TextBox;
private System.Windows.Forms.TextBox tempLo5TextBox;
private System.Windows.Forms.CheckBox rangeCheckBox1;
private System.Windows.Forms.CheckBox rangeCheckBox2;
private System.Windows.Forms.CheckBox rangeCheckBox3;
private System.Windows.Forms.CheckBox rangeCheckBox4;
private System.Windows.Forms.CheckBox rangeCheckBox5;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
}
}

View File

@ -1,15 +1,16 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.Windows.Forms;
using log4net;
using TBF.BenchControl.Configs;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.FlowMeter
{
public partial class FlowMeterCfgCtrl : UserControl, IComponentCfgCtrl
public partial class FlowMeterCfgCtrl : ConfigCtrlUtils, IComponentCfgCtrl
{
static readonly ILog log = LogManager.GetLogger(typeof(FlowMeterCfgCtrl));
@ -28,6 +29,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
}
}
public FlowMeterCfgCtrl()
{
InitializeComponent();
@ -65,6 +67,36 @@ namespace TBF.BenchControl.Elde.FlowMeter
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
positionTextBox.Text = config.Idx1.ToString();
nominalFlowTextBox.Text = config.NominalFlow.ToString();
rangeCheckBox1.Checked = config.RangeEnabled(1);
tempLo1TextBox.Text = config.Temp1Lo.ToString();
tempHi1TextBox.Text = config.Temp1Hi.ToString();
pressLo1TextBox.Text = config.Press1Lo.ToString();
pressHi1TextBox.Text = config.Press1Hi.ToString();
rangeCheckBox2.Checked = config.RangeEnabled(2);
tempLo2TextBox.Text = config.Temp2Lo.ToString();
tempHi2TextBox.Text = config.Temp2Hi.ToString();
pressLo2TextBox.Text = config.Press2Lo.ToString();
pressHi2TextBox.Text = config.Press2Hi.ToString();
rangeCheckBox3.Checked = config.RangeEnabled(3);
tempLo3TextBox.Text = config.Temp3Lo.ToString();
tempHi3TextBox.Text = config.Temp3Hi.ToString();
pressLo3TextBox.Text = config.Press3Lo.ToString();
pressHi3TextBox.Text = config.Press3Hi.ToString();
rangeCheckBox4.Checked = config.RangeEnabled(4);
tempLo4TextBox.Text = config.Temp4Lo.ToString();
tempHi4TextBox.Text = config.Temp4Hi.ToString();
pressLo4TextBox.Text = config.Press4Lo.ToString();
pressHi4TextBox.Text = config.Press4Hi.ToString();
rangeCheckBox5.Checked = config.RangeEnabled(5);
tempLo5TextBox.Text = config.Temp5Lo.ToString();
tempHi5TextBox.Text = config.Temp5Hi.ToString();
pressLo5TextBox.Text = config.Press5Lo.ToString();
pressHi5TextBox.Text = config.Press5Hi.ToString();
}
public void Unlock()
@ -73,7 +105,37 @@ namespace TBF.BenchControl.Elde.FlowMeter
parentNameComboBox.Enabled = true;
positionTextBox.Enabled = true;
nominalFlowTextBox.Enabled = true;
}
rangeCheckBox1.Enabled = true;
tempLo1TextBox.Enabled = rangeCheckBox1.Checked;
tempHi1TextBox.Enabled = rangeCheckBox1.Checked;
pressLo1TextBox.Enabled = rangeCheckBox1.Checked;
pressHi1TextBox.Enabled = rangeCheckBox1.Checked;
rangeCheckBox2.Enabled = true;
tempLo2TextBox.Enabled = rangeCheckBox2.Checked;
tempHi2TextBox.Enabled = rangeCheckBox2.Checked;
pressLo2TextBox.Enabled = rangeCheckBox2.Checked;
pressHi2TextBox.Enabled = rangeCheckBox2.Checked;
rangeCheckBox3.Enabled = true;
tempLo3TextBox.Enabled = rangeCheckBox3.Checked;
tempHi3TextBox.Enabled = rangeCheckBox3.Checked;
pressLo3TextBox.Enabled = rangeCheckBox3.Checked;
pressHi3TextBox.Enabled = rangeCheckBox3.Checked;
rangeCheckBox4.Enabled = true;
tempLo4TextBox.Enabled = rangeCheckBox4.Checked;
tempHi4TextBox.Enabled = rangeCheckBox4.Checked;
pressLo4TextBox.Enabled = rangeCheckBox4.Checked;
pressHi4TextBox.Enabled = rangeCheckBox4.Checked;
rangeCheckBox5.Enabled = true;
tempLo5TextBox.Enabled = rangeCheckBox5.Checked;
tempHi5TextBox.Enabled = rangeCheckBox5.Checked;
pressLo5TextBox.Enabled = rangeCheckBox5.Checked;
pressHi5TextBox.Enabled = rangeCheckBox5.Checked;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
@ -104,21 +166,182 @@ namespace TBF.BenchControl.Elde.FlowMeter
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Nominal flow' should be between 0.01 and 1600";
}
double ddummy;
if (rangeCheckBox1.Checked)
{
if (!Utils.TryParseUDouble(tempLo1TextBox.Text, out ddummy) || !Utils.TryParseUDouble(tempHi1TextBox.Text, out ddummy) ||
!Utils.TryParseUDouble(pressLo1TextBox.Text, out ddummy) || !Utils.TryParseUDouble(pressHi1TextBox.Text, out ddummy))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Ivalid 'Range 1'";
}
}
if (rangeCheckBox2.Checked)
{
if (!Utils.TryParseUDouble(tempLo2TextBox.Text, out ddummy) || !Utils.TryParseUDouble(tempHi2TextBox.Text, out ddummy) ||
!Utils.TryParseUDouble(pressLo2TextBox.Text, out ddummy) || !Utils.TryParseUDouble(pressHi2TextBox.Text, out ddummy))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Ivalid 'Range 2'";
}
}
if (rangeCheckBox3.Checked)
{
if (!Utils.TryParseUDouble(tempLo3TextBox.Text, out ddummy) || !Utils.TryParseUDouble(tempHi3TextBox.Text, out ddummy) ||
!Utils.TryParseUDouble(pressLo3TextBox.Text, out ddummy) || !Utils.TryParseUDouble(pressHi3TextBox.Text, out ddummy))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Ivalid 'Range 3'";
}
}
if (rangeCheckBox4.Checked)
{
if (!Utils.TryParseUDouble(tempLo4TextBox.Text, out ddummy) || !Utils.TryParseUDouble(tempHi4TextBox.Text, out ddummy) ||
!Utils.TryParseUDouble(pressLo4TextBox.Text, out ddummy) || !Utils.TryParseUDouble(pressHi4TextBox.Text, out ddummy))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Ivalid 'Range 4'";
}
}
if (rangeCheckBox5.Checked)
{
if (!Utils.TryParseUDouble(tempLo5TextBox.Text, out ddummy) || !Utils.TryParseUDouble(tempHi5TextBox.Text, out ddummy) ||
!Utils.TryParseUDouble(pressLo5TextBox.Text, out ddummy) || !Utils.TryParseUDouble(pressHi5TextBox.Text, out ddummy))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Ivalid 'Range 5'";
}
}
return flags;
}
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
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.Idx1 = int.Parse(positionTextBox.Text);
Utils.TryParseUFloat(nominalFlowTextBox.Text, out config.NominalFlow);
if (config.Name != nameTextBox.Text)
{
config.Name = nameTextBox.Text;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
string parentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
if (config.ParentName != parentName)
{
config.ParentName = parentName;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
flags |= UpdateDifferent(ref config.Idx1, positionTextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.NominalFlow, nominalFlowTextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
if (rangeCheckBox1.Checked)
{
flags |= UpdateDifferent(ref config.Temp1Lo, tempLo1TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp1Hi, tempHi1TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press1Lo, pressLo1TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press1Hi, pressHi1TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
else
{
flags |= UpdateDifferent(ref config.Temp1Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp1Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press1Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press1Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (rangeCheckBox2.Checked)
{
flags |= UpdateDifferent(ref config.Temp2Lo, tempLo2TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp2Hi, tempHi2TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press2Lo, pressLo2TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press2Hi, pressHi2TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
else
{
flags |= UpdateDifferent(ref config.Temp2Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp2Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press2Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press2Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (rangeCheckBox3.Checked)
{
flags |= UpdateDifferent(ref config.Temp3Lo, tempLo3TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp3Hi, tempHi3TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press3Lo, pressLo3TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press3Hi, pressHi3TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
else
{
flags |= UpdateDifferent(ref config.Temp3Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp3Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press3Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press3Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (rangeCheckBox4.Checked)
{
flags |= UpdateDifferent(ref config.Temp4Lo, tempLo4TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp4Hi, tempHi4TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press4Lo, pressLo4TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press4Hi, pressHi4TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
else
{
flags |= UpdateDifferent(ref config.Temp4Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp4Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press4Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press4Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (rangeCheckBox5.Checked)
{
flags |= UpdateDifferent(ref config.Temp5Lo, tempLo5TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp5Hi, tempHi5TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press5Lo, pressLo5TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press5Hi, pressHi5TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
else
{
flags |= UpdateDifferent(ref config.Temp5Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp5Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press5Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press5Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
return flags;
}
private void rangeCheckBox1_CheckedChanged(object sender, EventArgs e)
{
tempLo1TextBox.Enabled = tempHi1TextBox.Enabled = pressLo1TextBox.Enabled = pressHi1TextBox.Enabled =
(rangeCheckBox1.Enabled && rangeCheckBox1.Checked);
}
private void rangeCheckBox2_CheckedChanged(object sender, EventArgs e)
{
tempLo2TextBox.Enabled = tempHi2TextBox.Enabled = pressLo2TextBox.Enabled = pressHi2TextBox.Enabled =
(rangeCheckBox2.Enabled && rangeCheckBox2.Checked);
}
private void rangeCheckBox3_CheckedChanged(object sender, EventArgs e)
{
tempLo3TextBox.Enabled = tempHi3TextBox.Enabled = pressLo3TextBox.Enabled = pressHi3TextBox.Enabled =
(rangeCheckBox3.Enabled && rangeCheckBox3.Checked);
}
private void rangeCheckBox4_CheckedChanged(object sender, EventArgs e)
{
tempLo4TextBox.Enabled = tempHi4TextBox.Enabled = pressLo4TextBox.Enabled = pressHi4TextBox.Enabled =
(rangeCheckBox4.Enabled && rangeCheckBox4.Checked);
}
private void rangeCheckBox5_CheckedChanged(object sender, EventArgs e)
{
tempLo5TextBox.Enabled = tempHi5TextBox.Enabled = pressLo5TextBox.Enabled = pressHi5TextBox.Enabled =
(rangeCheckBox5.Enabled && rangeCheckBox5.Checked);
}
}
}

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
public float NominalFlow { get { return flowMeterCfg.NominalFlow; } }
public float LtrPerPulse { get { return flowMeterCfg.NominalFlow / 21600.0f; } } /// Nominal frequency is 6000 Hz
public float LtrPerPulseCorrected(double flow)
public float LtrPerPulseCorrected(double flow, int rangeIx)
{
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -9,7 +9,7 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.FlowMeterTriplet
{
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibInfoCfg, IChildComponentCfg
public class FlowMeterCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FlowMeterCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
@ -22,26 +22,6 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
public int Idx1; /// 1..7
public float NominalFlow; /// Nominal flow in m3/h at output frequency 6000 Hz (= 3 * 2000 Hz)
/// Calibration info serialized parameters displayed in Metrology tab page
string calibCertificateNr;
DateTime calibDate;
DateTime calibValidDate;
public string CalibCertificateNr
{
get { return calibCertificateNr; }
set { calibCertificateNr = value; }
}
public DateTime CalibDate
{
get { return calibDate; }
set { calibDate = value; }
}
public DateTime CalibValidDate
{
get { return calibValidDate; }
set { calibValidDate = value; }
}
/// Private parameterless constructor invoked by all other (public) constructors
FlowMeterCfg()

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -25,10 +25,10 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
public float LtrPerPulse { get { return flowMeterCfg.NominalFlow / 14400.0f; } }
/// Calculates the average of values of two flowmeters. Assumes the flow is divided evenly.
public float LtrPerPulseCorrected(double flow)
public float LtrPerPulseCorrected(double flow, int rangeIx)
{
double flow2 = flow / 2.0;
return (FlowMeter1.LtrPerPulseCorrected(flow2) + FlowMeter2.LtrPerPulseCorrected(flow2)) / 2;
return (FlowMeter1.LtrPerPulseCorrected(flow2, rangeIx) + FlowMeter2.LtrPerPulseCorrected(flow2, rangeIx)) / 2;
}

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using TBF.BenchControl.Generic;
@ -9,11 +9,22 @@ namespace TBF.BenchControl.GenericDevices
public interface ICalibInfoCfg : IComponentCfg
{
///
/// Parameters are displayed in Metrology tab page
/// Access to parameters displayed in Metrology tab page
///
string CalibCertificateNr { get; set; } /// calibration certificate number
DateTime CalibDate { get; set; } /// date of calibration
DateTime CalibValidDate { get; set; } /// calibration valid until (date)
bool RangeEnabled(int rangeIx1);
double GetTempLo(int rangeIx1);
double GetTempHi(int rangeIx1);
double GetPressLo(int rangeIx1);
double GetPressHi(int rangeIx1);
string GetCalibCertificate(int rangeIx1); /// Get calibration certificate number
DateTime GetCalibDate(int rangeIx1); /// Get the date of calibration
DateTime GetCalibValidDate(int rangeIx1); /// Get calibration valid until (date)
void SetCalibCertificate(int rangeIx1, string certificate); /// Set calibration certificate number
void SetCalibDate(int rangeIx1, DateTime date); /// Get the date of calibration
void SetCalibValidDate(int rangeIx1, DateTime date); /// Get calibration valid until (date)
}
}

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
@ -27,7 +27,7 @@ namespace TBF.BenchControl.GenericDevices
/// Corrected volume per flowmeter pulse in [l].
/// </summary>
/// <param name="flow">Water flow in [m3/h]</param>
float LtrPerPulseCorrected(double flow);
float LtrPerPulseCorrected(double flow, int rangeIx);
/// <summary>
/// Reference flow meter communicated to the board: 1-based index, 0 for flow meter twins

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -71,6 +71,28 @@ namespace TBF.BenchControl.TestMethods.Adjustment
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
{
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
retVal = Event.UiCmdStop;
goto stopTestWOStoppingDivGateEtc;
}
}
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
/// Start the test, initialize test results
@ -357,10 +379,10 @@ namespace TBF.BenchControl.TestMethods.Adjustment
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h]
tstRslt.Buoyancy = Formulas.Buoyancy();
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume); /// Calculate master flowmeter coefficient
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0f; /// Cannot be determined without the collected water mass measurement
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Calculate master flowmeter coefficient
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0f; /// Cannot be determined without the collected water mass measurement
tstRslt.FlowMean = (float)RefFlowStat.Average;
tstRslt.FlowStart = (float)RefFlowStat.First;
@ -460,6 +482,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
while (!e.Contains(Event.PreviousStopped));
}
stopTestWOStoppingDivGateEtc:
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2017 Sensus Metering Systems
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -63,6 +63,28 @@ namespace TBF.BenchControl.TestMethods.Endurance
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
{
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
retVal = Event.UiCmdStop;
goto stopTestWOStoppingDivGateEtc;
}
}
//====================================
loop:
/// Start the test, initialize test results
@ -327,19 +349,19 @@ namespace TBF.BenchControl.TestMethods.Endurance
tstRslt.StartTime = TestStartTime;
tstRslt.EndTime = TestEndTime;
tstRslt.FlowSetTime = flowSetTime;
tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = 0;
tstRslt.MassEndRaw = 0;
tstRslt.MassEnd = 0;
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.Buoyancy = Formulas.Buoyancy();
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume); /// Corrected master pulses per liter
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0; /// Cannot be determined without a mass measurement
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0; /// Cannot be determined without a mass measurement
tstRslt.FlowMean = (float)RefFlowStat.Average;
tstRslt.FlowStart = (float)RefFlowStat.First;
@ -620,12 +642,12 @@ namespace TBF.BenchControl.TestMethods.Endurance
stopTest:
///
/// Quit this sequence
///
if (isLastRepetition || retVal == Event.UiCmdStop || retVal == Event.OpArgumentError
|| retVal == Event.Error || retVal == Event.ConfigurationError)
{
///
/// Quit this sequence
///
if (isLastRepetition || retVal == Event.UiCmdStop || retVal == Event.OpArgumentError
|| retVal == Event.Error || retVal == Event.ConfigurationError)
{
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
@ -638,6 +660,8 @@ namespace TBF.BenchControl.TestMethods.Endurance
while (!e.Contains(Event.PreviousStopped));
}
stopTestWOStoppingDivGateEtc:
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -101,7 +101,29 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
/// float timeSec = 3600.0f * timeHr;
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
{
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
retVal = Event.UiCmdStop;
goto stopTestWOStoppingDivGateEtc;
}
}
//====================================
loop:
/// Start the test, initialize test results
@ -502,10 +524,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.Buoyancy = Formulas.Buoyancy();
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume); /// Corrected master pulses per liter
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0; /// Cannot be determined without a mass measurement
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0; /// Cannot be determined without a mass measurement
tstRslt.FlowMean = (float)RefFlowStat.Average;
tstRslt.FlowStart = (float)RefFlowStat.First;
@ -750,6 +772,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
while (!e.Contains(Event.PreviousStopped));
}
stopTestWOStoppingDivGateEtc:
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);

View File

@ -31,6 +31,7 @@
this.upgradeDb_215_217_Button = new System.Windows.Forms.Button();
this.upgradeDb_216_217_Button = new System.Windows.Forms.Button();
this.upgradeDb_212_217_Button = new System.Windows.Forms.Button();
this.upgradeDb_217_218_Button = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// upgradeDb_215_217_Button
@ -63,11 +64,22 @@
this.upgradeDb_212_217_Button.UseVisualStyleBackColor = true;
this.upgradeDb_212_217_Button.Click += new System.EventHandler(this.upgradeDb_212_217_Button_Click);
//
// upgradeDb_217_218_Button
//
this.upgradeDb_217_218_Button.Location = new System.Drawing.Point(12, 132);
this.upgradeDb_217_218_Button.Name = "upgradeDb_217_218_Button";
this.upgradeDb_217_218_Button.Size = new System.Drawing.Size(260, 34);
this.upgradeDb_217_218_Button.TabIndex = 3;
this.upgradeDb_217_218_Button.Text = "Upgrade database from ver. 2.17 to ver. 2.18";
this.upgradeDb_217_218_Button.UseVisualStyleBackColor = true;
this.upgradeDb_217_218_Button.Click += new System.EventHandler(this.upgradeDb_217_218_Button_Click);
//
// UpgradeSelectionDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 262);
this.Controls.Add(this.upgradeDb_217_218_Button);
this.Controls.Add(this.upgradeDb_212_217_Button);
this.Controls.Add(this.upgradeDb_216_217_Button);
this.Controls.Add(this.upgradeDb_215_217_Button);
@ -82,6 +94,7 @@
private System.Windows.Forms.Button upgradeDb_215_217_Button;
private System.Windows.Forms.Button upgradeDb_216_217_Button;
private System.Windows.Forms.Button upgradeDb_212_217_Button;
private System.Windows.Forms.Button upgradeDb_217_218_Button;
}
}

View File

@ -247,5 +247,19 @@ namespace TBF.Forms
upgradeDb_216_217_Button.Enabled = false;
}
}
private void upgradeDb_217_218_Button_Click(object sender, EventArgs e)
{
string[] commands = new string[]
{
"ALTER TABLE `measurementcorrection` ADD `RangeIx` INT NOT NULL DEFAULT '0' AFTER `Id`;",
};
if (UpgradeCommon(new MySqlConnection(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString), commands))
{
MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
upgradeDb_217_218_Button.Enabled = false;
}
}
}
}

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -90,16 +90,24 @@ namespace TBF
// Flowmeter tab-pages
if (factory is BenchControl.Elde.FlowMeter.FlowMeterFactory)
{
flowMetersCount++;
TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
MetrologyDlgFlowMeterTab uiControl = new MetrologyDlgFlowMeterTab();
uiControl.MeterEntity = cmpnt;
uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibInfoCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
metrologyTabControl.TabPages.Add(tabPage);
}
BenchControl.Elde.FlowMeter.FlowMeterCfg flowMeterCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.Elde.FlowMeter.FlowMeterCfg;
for (int r = 0; r <= 5; r++)
{
if (flowMeterCfg.RangeEnabled(r))
{
flowMetersCount++;
TabPage tabPage = new TabPage(string.Format(((r == 0) ? " {0} " : " {0} r{1} "), cmpnt.Name, r));
MetrologyDlgFlowMeterTab uiControl = new MetrologyDlgFlowMeterTab(r);
uiControl.MeterEntity = cmpnt;
uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibInfoCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
metrologyTabControl.TabPages.Add(tabPage);
}
}
}
// Pressure meter tab-pages
if (factory is BenchControl.Elde.PressureMeter.PressureMeterFactory)

View File

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

View File

@ -32,14 +32,6 @@ namespace TBF.UiControls
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.testGroupBox = new System.Windows.Forms.GroupBox();
this.correctedTextBox = new System.Windows.Forms.TextBox();
this.measuredTextBox = new System.Windows.Forms.TextBox();
this.correctedLabel = new System.Windows.Forms.Label();
this.measuredLabel = new System.Windows.Forms.Label();
this.cmpntNameLabel = new System.Windows.Forms.Label();
this.listViewEx = new Results.Forms.ListViewEx();
this.nameGroupBox = new System.Windows.Forms.GroupBox();
this.calibrationGroupBox = new System.Windows.Forms.GroupBox();
this.calibValidDateTextBox = new System.Windows.Forms.TextBox();
this.calibValidDateLabel = new System.Windows.Forms.Label();
@ -47,13 +39,23 @@ namespace TBF.UiControls
this.calibDateLabel = new System.Windows.Forms.Label();
this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox();
this.calibCertificateNrLabel = new System.Windows.Forms.Label();
this.nameGroupBox = new System.Windows.Forms.GroupBox();
this.pressFromToLabel = new System.Windows.Forms.Label();
this.tempFromToLabel = new System.Windows.Forms.Label();
this.cmpntNameLabel = new System.Windows.Forms.Label();
this.testGroupBox = new System.Windows.Forms.GroupBox();
this.correctedTextBox = new System.Windows.Forms.TextBox();
this.measuredTextBox = new System.Windows.Forms.TextBox();
this.correctedLabel = new System.Windows.Forms.Label();
this.measuredLabel = new System.Windows.Forms.Label();
this.listViewEx = new Results.Forms.ListViewEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.testGroupBox.SuspendLayout();
this.nameGroupBox.SuspendLayout();
this.calibrationGroupBox.SuspendLayout();
this.nameGroupBox.SuspendLayout();
this.testGroupBox.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
@ -77,87 +79,6 @@ namespace TBF.UiControls
this.splitContainer1.SplitterDistance = 102;
this.splitContainer1.TabIndex = 2;
//
// testGroupBox
//
this.testGroupBox.Controls.Add(this.correctedTextBox);
this.testGroupBox.Controls.Add(this.measuredTextBox);
this.testGroupBox.Controls.Add(this.correctedLabel);
this.testGroupBox.Controls.Add(this.measuredLabel);
this.testGroupBox.Location = new System.Drawing.Point(424, 10);
this.testGroupBox.Name = "testGroupBox";
this.testGroupBox.Size = new System.Drawing.Size(170, 88);
this.testGroupBox.TabIndex = 4;
this.testGroupBox.TabStop = false;
this.testGroupBox.Text = "Correction test";
//
// correctedTextBox
//
this.correctedTextBox.Location = new System.Drawing.Point(91, 37);
this.correctedTextBox.Name = "correctedTextBox";
this.correctedTextBox.ReadOnly = true;
this.correctedTextBox.Size = new System.Drawing.Size(73, 20);
this.correctedTextBox.TabIndex = 5;
//
// measuredTextBox
//
this.measuredTextBox.Location = new System.Drawing.Point(91, 15);
this.measuredTextBox.Name = "measuredTextBox";
this.measuredTextBox.Size = new System.Drawing.Size(73, 20);
this.measuredTextBox.TabIndex = 4;
this.measuredTextBox.TextChanged += new System.EventHandler(this.measuredTextBox_TextChanged);
//
// correctedLabel
//
this.correctedLabel.AutoSize = true;
this.correctedLabel.Location = new System.Drawing.Point(17, 40);
this.correctedLabel.Name = "correctedLabel";
this.correctedLabel.Size = new System.Drawing.Size(53, 13);
this.correctedLabel.TabIndex = 3;
this.correctedLabel.Text = "Corrected";
//
// measuredLabel
//
this.measuredLabel.AutoSize = true;
this.measuredLabel.Location = new System.Drawing.Point(17, 18);
this.measuredLabel.Name = "measuredLabel";
this.measuredLabel.Size = new System.Drawing.Size(54, 13);
this.measuredLabel.TabIndex = 2;
this.measuredLabel.Text = "Measured";
//
// cmpntNameLabel
//
this.cmpntNameLabel.AutoSize = true;
this.cmpntNameLabel.Location = new System.Drawing.Point(43, 37);
this.cmpntNameLabel.Name = "cmpntNameLabel";
this.cmpntNameLabel.Size = new System.Drawing.Size(64, 13);
this.cmpntNameLabel.TabIndex = 0;
this.cmpntNameLabel.Text = "cmpntName";
//
// listViewEx
//
this.listViewEx.AllowColumnReorder = true;
this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewEx.DoubleClickActivation = false;
this.listViewEx.FullRowSelect = true;
this.listViewEx.GridLines = true;
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Name = "listViewEx";
this.listViewEx.Size = new System.Drawing.Size(650, 294);
this.listViewEx.TabIndex = 0;
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged);
//
// nameGroupBox
//
this.nameGroupBox.Controls.Add(this.cmpntNameLabel);
this.nameGroupBox.Location = new System.Drawing.Point(16, 10);
this.nameGroupBox.Name = "nameGroupBox";
this.nameGroupBox.Size = new System.Drawing.Size(160, 86);
this.nameGroupBox.TabIndex = 5;
this.nameGroupBox.TabStop = false;
this.nameGroupBox.Text = "Component";
//
// calibrationGroupBox
//
this.calibrationGroupBox.Controls.Add(this.calibValidDateTextBox);
@ -224,6 +145,105 @@ namespace TBF.UiControls
this.calibCertificateNrLabel.TabIndex = 10;
this.calibCertificateNrLabel.Text = "Certificate nr.";
//
// nameGroupBox
//
this.nameGroupBox.Controls.Add(this.pressFromToLabel);
this.nameGroupBox.Controls.Add(this.tempFromToLabel);
this.nameGroupBox.Controls.Add(this.cmpntNameLabel);
this.nameGroupBox.Location = new System.Drawing.Point(16, 10);
this.nameGroupBox.Name = "nameGroupBox";
this.nameGroupBox.Size = new System.Drawing.Size(160, 86);
this.nameGroupBox.TabIndex = 5;
this.nameGroupBox.TabStop = false;
this.nameGroupBox.Text = "Component";
//
// pressFromToLabel
//
this.pressFromToLabel.AutoSize = true;
this.pressFromToLabel.Location = new System.Drawing.Point(14, 62);
this.pressFromToLabel.Name = "pressFromToLabel";
this.pressFromToLabel.Size = new System.Drawing.Size(0, 13);
this.pressFromToLabel.TabIndex = 2;
//
// tempFromToLabel
//
this.tempFromToLabel.AutoSize = true;
this.tempFromToLabel.Location = new System.Drawing.Point(14, 44);
this.tempFromToLabel.Name = "tempFromToLabel";
this.tempFromToLabel.Size = new System.Drawing.Size(0, 13);
this.tempFromToLabel.TabIndex = 1;
//
// cmpntNameLabel
//
this.cmpntNameLabel.AutoSize = true;
this.cmpntNameLabel.Location = new System.Drawing.Point(43, 22);
this.cmpntNameLabel.Name = "cmpntNameLabel";
this.cmpntNameLabel.Size = new System.Drawing.Size(64, 13);
this.cmpntNameLabel.TabIndex = 0;
this.cmpntNameLabel.Text = "cmpntName";
//
// testGroupBox
//
this.testGroupBox.Controls.Add(this.correctedTextBox);
this.testGroupBox.Controls.Add(this.measuredTextBox);
this.testGroupBox.Controls.Add(this.correctedLabel);
this.testGroupBox.Controls.Add(this.measuredLabel);
this.testGroupBox.Location = new System.Drawing.Point(424, 10);
this.testGroupBox.Name = "testGroupBox";
this.testGroupBox.Size = new System.Drawing.Size(170, 88);
this.testGroupBox.TabIndex = 4;
this.testGroupBox.TabStop = false;
this.testGroupBox.Text = "Correction test";
//
// correctedTextBox
//
this.correctedTextBox.Location = new System.Drawing.Point(91, 37);
this.correctedTextBox.Name = "correctedTextBox";
this.correctedTextBox.ReadOnly = true;
this.correctedTextBox.Size = new System.Drawing.Size(73, 20);
this.correctedTextBox.TabIndex = 5;
//
// measuredTextBox
//
this.measuredTextBox.Location = new System.Drawing.Point(91, 15);
this.measuredTextBox.Name = "measuredTextBox";
this.measuredTextBox.Size = new System.Drawing.Size(73, 20);
this.measuredTextBox.TabIndex = 4;
this.measuredTextBox.TextChanged += new System.EventHandler(this.measuredTextBox_TextChanged);
//
// correctedLabel
//
this.correctedLabel.AutoSize = true;
this.correctedLabel.Location = new System.Drawing.Point(17, 40);
this.correctedLabel.Name = "correctedLabel";
this.correctedLabel.Size = new System.Drawing.Size(53, 13);
this.correctedLabel.TabIndex = 3;
this.correctedLabel.Text = "Corrected";
//
// measuredLabel
//
this.measuredLabel.AutoSize = true;
this.measuredLabel.Location = new System.Drawing.Point(17, 18);
this.measuredLabel.Name = "measuredLabel";
this.measuredLabel.Size = new System.Drawing.Size(54, 13);
this.measuredLabel.TabIndex = 2;
this.measuredLabel.Text = "Measured";
//
// listViewEx
//
this.listViewEx.AllowColumnReorder = true;
this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill;
this.listViewEx.DoubleClickActivation = false;
this.listViewEx.FullRowSelect = true;
this.listViewEx.GridLines = true;
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Name = "listViewEx";
this.listViewEx.Size = new System.Drawing.Size(650, 294);
this.listViewEx.TabIndex = 0;
this.listViewEx.UseCompatibleStateImageBehavior = false;
this.listViewEx.View = System.Windows.Forms.View.Details;
this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged);
//
// MetrologyDlgFlowMeterTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -236,12 +256,12 @@ namespace TBF.UiControls
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.testGroupBox.ResumeLayout(false);
this.testGroupBox.PerformLayout();
this.nameGroupBox.ResumeLayout(false);
this.nameGroupBox.PerformLayout();
this.calibrationGroupBox.ResumeLayout(false);
this.calibrationGroupBox.PerformLayout();
this.nameGroupBox.ResumeLayout(false);
this.nameGroupBox.PerformLayout();
this.testGroupBox.ResumeLayout(false);
this.testGroupBox.PerformLayout();
this.ResumeLayout(false);
}
@ -264,6 +284,8 @@ namespace TBF.UiControls
private System.Windows.Forms.Label calibDateLabel;
private System.Windows.Forms.TextBox calibCertificateNrTextBox;
private System.Windows.Forms.Label calibCertificateNrLabel;
private System.Windows.Forms.Label pressFromToLabel;
private System.Windows.Forms.Label tempFromToLabel;
}
}

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -45,12 +45,17 @@ namespace TBF.UiControls
bool unlocked;
Control measurementTextBox;
Control correctionTextBox;
int rangeIx; /// 0 (no range) or 1..5 (range #)
public MetrologyDlgFlowMeterTab()
{
InitializeComponent();
toBeRemoved = new List<MeasurementCorrection>();
}
public MetrologyDlgFlowMeterTab() : this(0) {}
public MetrologyDlgFlowMeterTab(int rangeIx1)
{
InitializeComponent();
this.rangeIx = rangeIx1;
toBeRemoved = new List<MeasurementCorrection>();
}
private void MetrologyDlgFlowMeterTab_Load(object sender, System.EventArgs e)
{
@ -61,7 +66,16 @@ namespace TBF.UiControls
Localize();
/// Panel1
cmpntNameLabel.Text = meterEntity.Name;
if (rangeIx == 0)
{
cmpntNameLabel.Text = meterEntity.Name;
}
else
{
cmpntNameLabel.Text = string.Format("{0} Range {1}", meterEntity.Name, rangeIx);
tempFromToLabel.Text = string.Format("{0} {1} {2} {3} °C", Strings.from, CalibInfoCfg.GetTempLo(rangeIx), Strings.to, CalibInfoCfg.GetTempHi(rangeIx));
pressFromToLabel.Text = string.Format("{0} {1} {2} {3} bar", Strings.from, CalibInfoCfg.GetPressLo(rangeIx), Strings.to, CalibInfoCfg.GetPressHi(rangeIx));
}
testGroupBox.Text = Strings.Test_measured_corrected;
measuredLabel.Text = Strings.Measured;
@ -83,7 +97,7 @@ namespace TBF.UiControls
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Flow_m3h, Width = 100 });
listViewEx.Columns.Add(new ColumnHeader() { Text = Strings.Correction_lph, Width = 100 });
RefreshAll();
RefreshAll(rangeIx);
}
void Localize()
@ -100,17 +114,20 @@ namespace TBF.UiControls
correctedLabel.Text = Strings.Corrected;
}
void RefreshAll()
void RefreshAll(int rangeIx1)
{
if (CalibInfoCfg != null)
{
calibCertificateNrTextBox.Text = CalibInfoCfg.CalibCertificateNr;
calibDateTextBox.Text = CalibInfoCfg.CalibDate.ToShortDateString();
calibValidDateTextBox.Text = CalibInfoCfg.CalibValidDate.ToShortDateString();
calibCertificateNrTextBox.Text = CalibInfoCfg.GetCalibCertificate(rangeIx1);
calibDateTextBox.Text = CalibInfoCfg.GetCalibDate(rangeIx1).ToShortDateString();
calibValidDateTextBox.Text = CalibInfoCfg.GetCalibValidDate(rangeIx1).ToShortDateString();
}
listViewEx.Items.Clear();
foreach (var corr in MeterEntity.Corrections) AddOneLVI(corr);
foreach (var corr in MeterEntity.Corrections)
{
if (corr.RangeIx == rangeIx) AddOneLVI(corr);
}
}
void AddOneLVI(MeasurementCorrection corr)
@ -218,9 +235,9 @@ namespace TBF.UiControls
{
try
{
CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text;
CalibInfoCfg.CalibDate = DateTime.Parse(calibDateTextBox.Text);
CalibInfoCfg.CalibValidDate = DateTime.Parse(calibValidDateTextBox.Text);
CalibInfoCfg.SetCalibCertificate(rangeIx, calibCertificateNrTextBox.Text);
CalibInfoCfg.SetCalibDate(rangeIx, DateTime.Parse(calibDateTextBox.Text));
CalibInfoCfg.SetCalibValidDate(rangeIx, DateTime.Parse(calibValidDateTextBox.Text));
Component modified = CalibInfoCfg.CreateDbEntity();
MeterEntity.Parameters = modified.Parameters;
@ -241,7 +258,7 @@ namespace TBF.UiControls
public void AddOne()
{
MeasurementCorrection corr = new MeasurementCorrection();
MeasurementCorrection corr = new MeasurementCorrection(rangeIx);
MeterEntity.Corrections.Add(corr);
AddOneLVI(corr);
@ -257,11 +274,10 @@ namespace TBF.UiControls
int removeItemNr = listViewEx.SelectedIndices[0];
MeasurementCorrection selected =
(MeasurementCorrection)listViewEx.SelectedItems[0].Tag;
MeasurementCorrection selected = (MeasurementCorrection)listViewEx.SelectedItems[0].Tag;
if (selected.Id != 0) toBeRemoved.Add(selected);
MeterEntity.Corrections.RemoveAt(removeItemNr);
RefreshAll();
RefreshAll(rangeIx);
if (removeItemNr < listViewEx.Items.Count)
{