diff --git a/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeter.cs b/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeter.cs index ce984f357..a863462e5 100644 --- a/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeter.cs +++ b/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeter.cs @@ -114,7 +114,11 @@ namespace TBF.BenchControl.WaterMeters.iPerl originalCalibrationFactor, newFactor, VolumeLtrStart.ToString("F3"), VolumeLtrEnd.ToString("F3"), volumeMeter.ToString("F3"), VolumeLtrRef.ToString("F3")); - return newFactor; + + if (newFactor < iPerlCfg.CalibrationMin) newFactor = iPerlCfg.CalibrationMin; + if (newFactor > iPerlCfg.CalibrationMax) newFactor = iPerlCfg.CalibrationMax; + + return newFactor; } else { diff --git a/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeterCfg.cs b/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeterCfg.cs index be29dfd11..41ef88072 100644 --- a/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeterCfg.cs +++ b/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeterCfg.cs @@ -20,6 +20,8 @@ namespace TBF.BenchControl.WaterMeters.iPerl /// Serialized parameters /// public MeterType MeterType; + public UInt16 CalibrationMin; + public UInt16 CalibrationMax; public int OptoComPortNr; public int MuxBoardNr; /// Multiplexer board number 1 .. 4 public int Group; /// Number written to QuidoRS to connct the watermeter to RfidComPort @@ -41,6 +43,8 @@ namespace TBF.BenchControl.WaterMeters.iPerl Name = "iPerl"; ParentName = string.Empty; OptoComPortNr = 10; + CalibrationMin = 2400; + CalibrationMax = 2700; ProcParams = new ProcParams(); } @@ -52,9 +56,11 @@ namespace TBF.BenchControl.WaterMeters.iPerl public string ToString(int i) { - return string.Format("Name={0}, Type={1}, Opto=COM{2}, MuxBoard#={3}, Group={4}", + return string.Format("Name={0}, Type={1}, CalibMin={2}, CalibMax={3}, Opto=COM{4}, MuxBoard#={5}, Group={6}", Name, MeterType, + CalibrationMin, + CalibrationMax, OptoComPortNr, MuxBoardNr, Group); diff --git a/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeterCfgCtrl.cs b/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeterCfgCtrl.cs index 0a9ff42f5..1151a6f8a 100644 --- a/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeterCfgCtrl.cs +++ b/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeterCfgCtrl.cs @@ -49,6 +49,8 @@ namespace TBF.BenchControl.WaterMeters.iPerl classNameLabel.Text = config.Factory.ClassName; nameTextBox.Text = config.Name; meterTypeComboBox.Text = config.MeterType.ToString(); + calibFactorMinTextBox.Text = config.CalibrationMin.ToString(); + calibFactorMaxTextBox.Text = config.CalibrationMax.ToString(); optoPortNrTextBox.Text = config.OptoComPortNr.ToString(); muxBoardNrTextBox.Text = config.MuxBoardNr.ToString(); groupTextBox.Text = config.Group.ToString(); @@ -58,6 +60,8 @@ namespace TBF.BenchControl.WaterMeters.iPerl { nameTextBox.Enabled = true; meterTypeComboBox.Enabled = true; + calibFactorMinTextBox.Enabled = true; + calibFactorMaxTextBox.Enabled = true; optoPortNrTextBox.Enabled = true; muxBoardNrTextBox.Enabled = true; groupTextBox.Enabled = true; @@ -72,6 +76,18 @@ namespace TBF.BenchControl.WaterMeters.iPerl flags |= CfgUpdateFlags.Error; message += Environment.NewLine + "Meter type is not valid"; } + + UInt16 calibFactor; + if (!UInt16.TryParse(calibFactorMinTextBox.Text, out calibFactor) || calibFactor < 1 || calibFactor > 5000) + { + flags |= CfgUpdateFlags.Error; + message += Environment.NewLine + "'Calib. factor limit low' is not valid"; + } + if (!UInt16.TryParse(calibFactorMaxTextBox.Text, out calibFactor) || calibFactor < 1 || calibFactor > 5000) + { + flags |= CfgUpdateFlags.Error; + message += Environment.NewLine + "'Calib. factor limit high' is not valid"; + } int dummy; if (!int.TryParse(optoPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999) @@ -101,6 +117,8 @@ namespace TBF.BenchControl.WaterMeters.iPerl config.Name = nameTextBox.Text; config.MeterType = (MeterType)meterTypeComboBox.SelectedIndex; + config.CalibrationMin = UInt16.Parse(calibFactorMinTextBox.Text); + config.CalibrationMax = UInt16.Parse(calibFactorMaxTextBox.Text); config.OptoComPortNr = int.Parse(optoPortNrTextBox.Text); config.MuxBoardNr = int.Parse(muxBoardNrTextBox.Text); config.Group = int.Parse(groupTextBox.Text); diff --git a/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeterCfgCtrl.designer.cs b/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeterCfgCtrl.designer.cs index c66ea753e..c594bfdc8 100644 --- a/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeterCfgCtrl.designer.cs +++ b/TestBenchFramework/BenchControl/WaterMeters/iPerl/WaterMeterCfgCtrl.designer.cs @@ -43,107 +43,149 @@ namespace TBF.BenchControl.WaterMeters.iPerl this.groupLabel = new System.Windows.Forms.Label(); this.meterTypeLabel = new System.Windows.Forms.Label(); this.meterTypeComboBox = new System.Windows.Forms.ComboBox(); + this.calibFactorMinTextBox = new System.Windows.Forms.TextBox(); + this.calibFactorMinLabel = new System.Windows.Forms.Label(); + this.calibFactorMaxTextBox = new System.Windows.Forms.TextBox(); + this.calibFactorMaxLabel = new System.Windows.Forms.Label(); this.SuspendLayout(); // // nameTextBox // this.nameTextBox.Enabled = false; - this.nameTextBox.Location = new System.Drawing.Point(135, 55); + this.nameTextBox.Location = new System.Drawing.Point(135, 36); this.nameTextBox.Name = "nameTextBox"; this.nameTextBox.Size = new System.Drawing.Size(121, 20); - this.nameTextBox.TabIndex = 5; + this.nameTextBox.TabIndex = 2; // // nameLabel // this.nameLabel.AutoSize = true; - this.nameLabel.Location = new System.Drawing.Point(25, 58); + this.nameLabel.Location = new System.Drawing.Point(25, 39); this.nameLabel.Name = "nameLabel"; this.nameLabel.Size = new System.Drawing.Size(35, 13); - this.nameLabel.TabIndex = 4; + this.nameLabel.TabIndex = 1; this.nameLabel.Text = "Name"; // // classNameLabel // this.classNameLabel.AutoSize = true; - this.classNameLabel.Location = new System.Drawing.Point(132, 31); + this.classNameLabel.Location = new System.Drawing.Point(132, 15); this.classNameLabel.Name = "classNameLabel"; this.classNameLabel.Size = new System.Drawing.Size(60, 13); - this.classNameLabel.TabIndex = 3; + this.classNameLabel.TabIndex = 0; this.classNameLabel.Text = "ClassName"; // // optoPortNrTextBox // this.optoPortNrTextBox.Enabled = false; - this.optoPortNrTextBox.Location = new System.Drawing.Point(135, 104); + this.optoPortNrTextBox.Location = new System.Drawing.Point(135, 125); this.optoPortNrTextBox.Name = "optoPortNrTextBox"; this.optoPortNrTextBox.Size = new System.Drawing.Size(34, 20); - this.optoPortNrTextBox.TabIndex = 7; + this.optoPortNrTextBox.TabIndex = 10; // // optoPortNrLabel // this.optoPortNrLabel.AutoSize = true; - this.optoPortNrLabel.Location = new System.Drawing.Point(25, 107); + this.optoPortNrLabel.Location = new System.Drawing.Point(25, 128); this.optoPortNrLabel.Name = "optoPortNrLabel"; this.optoPortNrLabel.Size = new System.Drawing.Size(96, 13); - this.optoPortNrLabel.TabIndex = 6; + this.optoPortNrLabel.TabIndex = 9; this.optoPortNrLabel.Text = "Opto serial port nr.:"; // // muxBoardNrTextBox // this.muxBoardNrTextBox.Enabled = false; - this.muxBoardNrTextBox.Location = new System.Drawing.Point(135, 128); + this.muxBoardNrTextBox.Location = new System.Drawing.Point(135, 147); this.muxBoardNrTextBox.Name = "muxBoardNrTextBox"; this.muxBoardNrTextBox.Size = new System.Drawing.Size(34, 20); - this.muxBoardNrTextBox.TabIndex = 9; + this.muxBoardNrTextBox.TabIndex = 12; // // muxBoardNrLabel // this.muxBoardNrLabel.AutoSize = true; - this.muxBoardNrLabel.Location = new System.Drawing.Point(25, 131); + this.muxBoardNrLabel.Location = new System.Drawing.Point(25, 150); this.muxBoardNrLabel.Name = "muxBoardNrLabel"; this.muxBoardNrLabel.Size = new System.Drawing.Size(78, 13); - this.muxBoardNrLabel.TabIndex = 8; + this.muxBoardNrLabel.TabIndex = 11; this.muxBoardNrLabel.Text = "Mux. board nr.:"; // // groupTextBox // this.groupTextBox.Enabled = false; - this.groupTextBox.Location = new System.Drawing.Point(135, 152); + this.groupTextBox.Location = new System.Drawing.Point(135, 169); this.groupTextBox.Name = "groupTextBox"; this.groupTextBox.Size = new System.Drawing.Size(34, 20); - this.groupTextBox.TabIndex = 11; + this.groupTextBox.TabIndex = 14; // // groupLabel // this.groupLabel.AutoSize = true; - this.groupLabel.Location = new System.Drawing.Point(25, 155); + this.groupLabel.Location = new System.Drawing.Point(25, 172); this.groupLabel.Name = "groupLabel"; this.groupLabel.Size = new System.Drawing.Size(39, 13); - this.groupLabel.TabIndex = 10; + this.groupLabel.TabIndex = 13; this.groupLabel.Text = "Group:"; // // meterTypeLabel // this.meterTypeLabel.AutoSize = true; - this.meterTypeLabel.Location = new System.Drawing.Point(25, 82); + this.meterTypeLabel.Location = new System.Drawing.Point(25, 61); this.meterTypeLabel.Name = "meterTypeLabel"; this.meterTypeLabel.Size = new System.Drawing.Size(57, 13); - this.meterTypeLabel.TabIndex = 12; + this.meterTypeLabel.TabIndex = 3; this.meterTypeLabel.Text = "Meter type"; // // meterTypeComboBox // this.meterTypeComboBox.Enabled = false; this.meterTypeComboBox.FormattingEnabled = true; - this.meterTypeComboBox.Location = new System.Drawing.Point(135, 79); + this.meterTypeComboBox.Location = new System.Drawing.Point(135, 58); this.meterTypeComboBox.Name = "meterTypeComboBox"; this.meterTypeComboBox.Size = new System.Drawing.Size(121, 21); - this.meterTypeComboBox.TabIndex = 13; + this.meterTypeComboBox.TabIndex = 4; + // + // calibFactorMinTextBox + // + this.calibFactorMinTextBox.Enabled = false; + this.calibFactorMinTextBox.Location = new System.Drawing.Point(135, 81); + this.calibFactorMinTextBox.Name = "calibFactorMinTextBox"; + this.calibFactorMinTextBox.Size = new System.Drawing.Size(57, 20); + this.calibFactorMinTextBox.TabIndex = 6; + // + // calibFactorMinLabel + // + this.calibFactorMinLabel.AutoSize = true; + this.calibFactorMinLabel.Location = new System.Drawing.Point(25, 84); + this.calibFactorMinLabel.Name = "calibFactorMinLabel"; + this.calibFactorMinLabel.Size = new System.Drawing.Size(105, 13); + this.calibFactorMinLabel.TabIndex = 5; + this.calibFactorMinLabel.Text = "Calib. factor limit low:"; + // + // calibFactorMaxTextBox + // + this.calibFactorMaxTextBox.Enabled = false; + this.calibFactorMaxTextBox.Location = new System.Drawing.Point(135, 103); + this.calibFactorMaxTextBox.Name = "calibFactorMaxTextBox"; + this.calibFactorMaxTextBox.Size = new System.Drawing.Size(57, 20); + this.calibFactorMaxTextBox.TabIndex = 8; + // + // calibFactorMaxLabel + // + this.calibFactorMaxLabel.AutoSize = true; + this.calibFactorMaxLabel.Location = new System.Drawing.Point(25, 106); + this.calibFactorMaxLabel.Name = "calibFactorMaxLabel"; + this.calibFactorMaxLabel.Size = new System.Drawing.Size(109, 13); + this.calibFactorMaxLabel.TabIndex = 7; + this.calibFactorMaxLabel.Text = "Calib. factor limit high:"; // // WaterMeterCfgCtrl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.calibFactorMaxTextBox); + this.Controls.Add(this.calibFactorMaxLabel); + this.Controls.Add(this.calibFactorMinTextBox); + this.Controls.Add(this.calibFactorMinLabel); this.Controls.Add(this.meterTypeComboBox); this.Controls.Add(this.meterTypeLabel); this.Controls.Add(this.groupTextBox); @@ -176,5 +218,9 @@ namespace TBF.BenchControl.WaterMeters.iPerl private System.Windows.Forms.Label groupLabel; private System.Windows.Forms.Label meterTypeLabel; private System.Windows.Forms.ComboBox meterTypeComboBox; + private System.Windows.Forms.TextBox calibFactorMinTextBox; + private System.Windows.Forms.Label calibFactorMinLabel; + private System.Windows.Forms.TextBox calibFactorMaxTextBox; + private System.Windows.Forms.Label calibFactorMaxLabel; } } diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index 714043c1a..007341586 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.5.100.1")] -[assembly: AssemblyFileVersion("1.5.100.1")] +[assembly: AssemblyVersion("1.5.101.1")] +[assembly: AssemblyFileVersion("1.5.101.1")]