diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/EntryForm.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryForm.cs index a6609b129..db3fcee40 100644 --- a/TestBenchFramework/BenchControl/DataEntry/Standard/EntryForm.cs +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/EntryForm.cs @@ -42,6 +42,10 @@ namespace TBF.BenchControl.DataEntry.Standard System.Windows.Forms.Form modelessDlg; + float refVolume; + float errLimLo; + float errLimHi; + bool resultSaved; /// Set in Run() when results are saved IList waterMeters; /// Passesd as an argument of ShowCycleBeginFormOp/ShowCycleEndFormOp constructor @@ -100,10 +104,13 @@ namespace TBF.BenchControl.DataEntry.Standard } /// Reference to the operation - public IOperation ShowTestEndFormOp() + public IOperation ShowTestEndFormOp(float refVolume, float errLimLo, float errLimHi) { if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); currentOp = CurrentOp.EnterTestEndStates; + this.refVolume = refVolume; + this.errLimLo = errLimLo; + this.errLimHi = errLimHi; return this; } @@ -129,7 +136,7 @@ namespace TBF.BenchControl.DataEntry.Standard /// void OpenTestEndStatesDlg(EntryForm myRef) { - myRef.modelessDlg = new TestStartEndForm(Program.WMsCount, wmStartStateStr, disabled); + myRef.modelessDlg = new TestStartEndForm(Program.WMsCount, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi); modelessDlg.Show(); } diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/TestStartEndForm.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/TestStartEndForm.cs index 3560e11b9..0718c75f3 100644 --- a/TestBenchFramework/BenchControl/DataEntry/Standard/TestStartEndForm.cs +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/TestStartEndForm.cs @@ -30,7 +30,10 @@ namespace TBF.BenchControl.DataEntry.Standard // To be retrieved after the form closes public float[] WMEndState; - bool endStates; + bool endStates; /// false=start states, true=end states + float refVolume; + float errLimLo; + float errLimHi; /// /// Constructor to fill in start states @@ -54,7 +57,8 @@ namespace TBF.BenchControl.DataEntry.Standard /// Constructor to fill in end states /// /// Number of text boxes for serial numbers - public TestStartEndForm(int waterMetersCount, string[] wmStartStateStr, bool[] disabled) + public TestStartEndForm(int waterMetersCount, string[] wmStartStateStr, bool[] disabled, + float refVolume, float errLimLo, float errLimHi) { endStates = true; @@ -209,5 +213,89 @@ namespace TBF.BenchControl.DataEntry.Standard } #endregion + + private void wmEndStateTextBox1_TextChanged(object sender, EventArgs e) + { + float err = 0; + try + { + float endState = Utils.ParseUFloat(wmEndStateTextBox1.Text); + float startState = Utils.ParseUFloat(wmStartStateTextBox1.Text); + err = 100.0f * (endState - startState - refVolume) / refVolume; + } + catch { }; + + exclamation1.Visible = (err < errLimLo) || (errLimHi < err); + } + + private void wmEndStateTextBox2_TextChanged(object sender, EventArgs e) + { + float err = 0; + try + { + float endState = Utils.ParseUFloat(wmEndStateTextBox2.Text); + float startState = Utils.ParseUFloat(wmStartStateTextBox2.Text); + err = 100.0f * (endState - startState - refVolume) / refVolume; + } + catch { err = 1000.0f; }; + + exclamation2.Visible = (err < errLimLo) || (errLimHi < err); + } + + private void wmEndStateTextBox3_TextChanged(object sender, EventArgs e) + { + float err = 0; + try + { + float endState = Utils.ParseUFloat(wmEndStateTextBox3.Text); + float startState = Utils.ParseUFloat(wmStartStateTextBox3.Text); + err = 100.0f * (endState - startState - refVolume) / refVolume; + } + catch { err = 1000.0f; }; + + exclamation3.Visible = (err < errLimLo) || (errLimHi < err); + } + + private void wmEndStateTextBox4_TextChanged(object sender, EventArgs e) + { + float err = 0; + try + { + float endState = Utils.ParseUFloat(wmEndStateTextBox4.Text); + float startState = Utils.ParseUFloat(wmStartStateTextBox4.Text); + err = 100.0f * (endState - startState - refVolume) / refVolume; + } + catch { err = 1000.0f; }; + + exclamation4.Visible = (err < errLimLo) || (errLimHi < err); + } + + private void wmEndStateTextBox5_TextChanged(object sender, EventArgs e) + { + float err = 0; + try + { + float endState = Utils.ParseUFloat(wmEndStateTextBox5.Text); + float startState = Utils.ParseUFloat(wmStartStateTextBox5.Text); + err = 100.0f * (endState - startState - refVolume) / refVolume; + } + catch { err = 1000.0f; }; + + exclamation5.Visible = (err < errLimLo) || (errLimHi < err); + } + + private void wmEndStateTextBox6_TextChanged(object sender, EventArgs e) + { + float err = 0; + try + { + float endState = Utils.ParseUFloat(wmEndStateTextBox6.Text); + float startState = Utils.ParseUFloat(wmStartStateTextBox6.Text); + err = 100.0f * (endState - startState - refVolume) / refVolume; + } + catch { err = 1000.0f; }; + + exclamation6.Visible = (err < errLimLo) || (errLimHi < err); + } } } diff --git a/TestBenchFramework/BenchControl/DataEntry/Standard/TestStartEndForm.designer.cs b/TestBenchFramework/BenchControl/DataEntry/Standard/TestStartEndForm.designer.cs index ed6ae7c81..4dc390f13 100644 --- a/TestBenchFramework/BenchControl/DataEntry/Standard/TestStartEndForm.designer.cs +++ b/TestBenchFramework/BenchControl/DataEntry/Standard/TestStartEndForm.designer.cs @@ -58,6 +58,12 @@ namespace TBF.BenchControl.DataEntry.Standard this.wmStateLabel6 = new System.Windows.Forms.Label(); this.startLabel = new System.Windows.Forms.Label(); this.endLabel = new System.Windows.Forms.Label(); + this.exclamation1 = new System.Windows.Forms.Label(); + this.exclamation2 = new System.Windows.Forms.Label(); + this.exclamation3 = new System.Windows.Forms.Label(); + this.exclamation4 = new System.Windows.Forms.Label(); + this.exclamation5 = new System.Windows.Forms.Label(); + this.exclamation6 = new System.Windows.Forms.Label(); this.groupBox2.SuspendLayout(); this.groupBox1.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -68,6 +74,7 @@ namespace TBF.BenchControl.DataEntry.Standard // // groupBox2 // + this.groupBox2.Controls.Add(this.exclamation2); this.groupBox2.Controls.Add(this.wmStartStateTextBox2); this.groupBox2.Controls.Add(this.wmEndStateTextBox2); this.groupBox2.Controls.Add(this.wmStateLabel2); @@ -75,7 +82,7 @@ namespace TBF.BenchControl.DataEntry.Standard this.groupBox2.ForeColor = System.Drawing.Color.Black; this.groupBox2.Location = new System.Drawing.Point(25, 122); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(538, 81); + this.groupBox2.Size = new System.Drawing.Size(547, 81); this.groupBox2.TabIndex = 2; this.groupBox2.TabStop = false; this.groupBox2.Text = "Water Meter 2"; @@ -95,6 +102,7 @@ namespace TBF.BenchControl.DataEntry.Standard this.wmEndStateTextBox2.Name = "wmEndStateTextBox2"; this.wmEndStateTextBox2.Size = new System.Drawing.Size(163, 31); this.wmEndStateTextBox2.TabIndex = 1; + this.wmEndStateTextBox2.TextChanged += new System.EventHandler(this.wmEndStateTextBox2_TextChanged); // // wmStateLabel2 // @@ -107,6 +115,7 @@ namespace TBF.BenchControl.DataEntry.Standard // // groupBox1 // + this.groupBox1.Controls.Add(this.exclamation1); this.groupBox1.Controls.Add(this.wmStartStateTextBox1); this.groupBox1.Controls.Add(this.wmEndStateTextBox1); this.groupBox1.Controls.Add(this.wmStateLabel1); @@ -114,7 +123,7 @@ namespace TBF.BenchControl.DataEntry.Standard this.groupBox1.ForeColor = System.Drawing.Color.Black; this.groupBox1.Location = new System.Drawing.Point(25, 32); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(538, 81); + this.groupBox1.Size = new System.Drawing.Size(547, 81); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "Water Meter 1"; @@ -134,6 +143,7 @@ namespace TBF.BenchControl.DataEntry.Standard this.wmEndStateTextBox1.Name = "wmEndStateTextBox1"; this.wmEndStateTextBox1.Size = new System.Drawing.Size(163, 31); this.wmEndStateTextBox1.TabIndex = 1; + this.wmEndStateTextBox1.TextChanged += new System.EventHandler(this.wmEndStateTextBox1_TextChanged); // // wmStateLabel1 // @@ -148,7 +158,7 @@ namespace TBF.BenchControl.DataEntry.Standard // this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.okButton.ForeColor = System.Drawing.Color.Black; - this.okButton.Location = new System.Drawing.Point(593, 46); + this.okButton.Location = new System.Drawing.Point(603, 46); this.okButton.Name = "okButton"; this.okButton.Size = new System.Drawing.Size(98, 63); this.okButton.TabIndex = 7; @@ -158,6 +168,7 @@ namespace TBF.BenchControl.DataEntry.Standard // // groupBox3 // + this.groupBox3.Controls.Add(this.exclamation3); this.groupBox3.Controls.Add(this.wmStartStateTextBox3); this.groupBox3.Controls.Add(this.wmEndStateTextBox3); this.groupBox3.Controls.Add(this.wmStateLabel3); @@ -165,7 +176,7 @@ namespace TBF.BenchControl.DataEntry.Standard this.groupBox3.ForeColor = System.Drawing.Color.Black; this.groupBox3.Location = new System.Drawing.Point(25, 212); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(538, 81); + this.groupBox3.Size = new System.Drawing.Size(547, 81); this.groupBox3.TabIndex = 3; this.groupBox3.TabStop = false; this.groupBox3.Text = "Water Meter 3"; @@ -185,6 +196,7 @@ namespace TBF.BenchControl.DataEntry.Standard this.wmEndStateTextBox3.Name = "wmEndStateTextBox3"; this.wmEndStateTextBox3.Size = new System.Drawing.Size(163, 31); this.wmEndStateTextBox3.TabIndex = 1; + this.wmEndStateTextBox3.TextChanged += new System.EventHandler(this.wmEndStateTextBox3_TextChanged); // // wmStateLabel3 // @@ -197,6 +209,7 @@ namespace TBF.BenchControl.DataEntry.Standard // // groupBox4 // + this.groupBox4.Controls.Add(this.exclamation4); this.groupBox4.Controls.Add(this.wmStartStateTextBox4); this.groupBox4.Controls.Add(this.wmEndStateTextBox4); this.groupBox4.Controls.Add(this.wmStateLabel4); @@ -204,7 +217,7 @@ namespace TBF.BenchControl.DataEntry.Standard this.groupBox4.ForeColor = System.Drawing.Color.Black; this.groupBox4.Location = new System.Drawing.Point(25, 302); this.groupBox4.Name = "groupBox4"; - this.groupBox4.Size = new System.Drawing.Size(538, 81); + this.groupBox4.Size = new System.Drawing.Size(547, 81); this.groupBox4.TabIndex = 4; this.groupBox4.TabStop = false; this.groupBox4.Text = "Water Meter 4"; @@ -224,6 +237,7 @@ namespace TBF.BenchControl.DataEntry.Standard this.wmEndStateTextBox4.Name = "wmEndStateTextBox4"; this.wmEndStateTextBox4.Size = new System.Drawing.Size(163, 31); this.wmEndStateTextBox4.TabIndex = 1; + this.wmEndStateTextBox4.TextChanged += new System.EventHandler(this.wmEndStateTextBox4_TextChanged); // // wmStateLabel4 // @@ -236,6 +250,7 @@ namespace TBF.BenchControl.DataEntry.Standard // // groupBox5 // + this.groupBox5.Controls.Add(this.exclamation5); this.groupBox5.Controls.Add(this.wmStartStateTextBox5); this.groupBox5.Controls.Add(this.wmEndStateTextBox5); this.groupBox5.Controls.Add(this.wmStateLabel5); @@ -243,7 +258,7 @@ namespace TBF.BenchControl.DataEntry.Standard this.groupBox5.ForeColor = System.Drawing.Color.Black; this.groupBox5.Location = new System.Drawing.Point(25, 392); this.groupBox5.Name = "groupBox5"; - this.groupBox5.Size = new System.Drawing.Size(538, 81); + this.groupBox5.Size = new System.Drawing.Size(547, 81); this.groupBox5.TabIndex = 5; this.groupBox5.TabStop = false; this.groupBox5.Text = "Water Meter 5"; @@ -263,6 +278,7 @@ namespace TBF.BenchControl.DataEntry.Standard this.wmEndStateTextBox5.Name = "wmEndStateTextBox5"; this.wmEndStateTextBox5.Size = new System.Drawing.Size(163, 31); this.wmEndStateTextBox5.TabIndex = 1; + this.wmEndStateTextBox5.TextChanged += new System.EventHandler(this.wmEndStateTextBox5_TextChanged); // // wmStateLabel5 // @@ -275,6 +291,7 @@ namespace TBF.BenchControl.DataEntry.Standard // // groupBox6 // + this.groupBox6.Controls.Add(this.exclamation6); this.groupBox6.Controls.Add(this.wmStartStateTextBox6); this.groupBox6.Controls.Add(this.wmEndStateTextBox6); this.groupBox6.Controls.Add(this.wmStateLabel6); @@ -282,7 +299,7 @@ namespace TBF.BenchControl.DataEntry.Standard this.groupBox6.ForeColor = System.Drawing.Color.Black; this.groupBox6.Location = new System.Drawing.Point(25, 482); this.groupBox6.Name = "groupBox6"; - this.groupBox6.Size = new System.Drawing.Size(538, 81); + this.groupBox6.Size = new System.Drawing.Size(547, 81); this.groupBox6.TabIndex = 6; this.groupBox6.TabStop = false; this.groupBox6.Text = "Water Meter 6"; @@ -302,6 +319,7 @@ namespace TBF.BenchControl.DataEntry.Standard this.wmEndStateTextBox6.Name = "wmEndStateTextBox6"; this.wmEndStateTextBox6.Size = new System.Drawing.Size(163, 31); this.wmEndStateTextBox6.TabIndex = 1; + this.wmEndStateTextBox6.TextChanged += new System.EventHandler(this.wmEndStateTextBox6_TextChanged); // // wmStateLabel6 // @@ -332,12 +350,84 @@ namespace TBF.BenchControl.DataEntry.Standard this.endLabel.TabIndex = 9; this.endLabel.Text = "End"; // + // exclamation1 + // + this.exclamation1.AutoSize = true; + this.exclamation1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.exclamation1.ForeColor = System.Drawing.Color.Red; + this.exclamation1.Location = new System.Drawing.Point(522, 34); + this.exclamation1.Name = "exclamation1"; + this.exclamation1.Size = new System.Drawing.Size(18, 23); + this.exclamation1.TabIndex = 3; + this.exclamation1.Text = "!"; + this.exclamation1.Visible = false; + // + // exclamation2 + // + this.exclamation2.AutoSize = true; + this.exclamation2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.exclamation2.ForeColor = System.Drawing.Color.Red; + this.exclamation2.Location = new System.Drawing.Point(522, 34); + this.exclamation2.Name = "exclamation2"; + this.exclamation2.Size = new System.Drawing.Size(18, 23); + this.exclamation2.TabIndex = 4; + this.exclamation2.Text = "!"; + this.exclamation2.Visible = false; + // + // exclamation3 + // + this.exclamation3.AutoSize = true; + this.exclamation3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.exclamation3.ForeColor = System.Drawing.Color.Red; + this.exclamation3.Location = new System.Drawing.Point(522, 34); + this.exclamation3.Name = "exclamation3"; + this.exclamation3.Size = new System.Drawing.Size(18, 23); + this.exclamation3.TabIndex = 5; + this.exclamation3.Text = "!"; + this.exclamation3.Visible = false; + // + // exclamation4 + // + this.exclamation4.AutoSize = true; + this.exclamation4.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.exclamation4.ForeColor = System.Drawing.Color.Red; + this.exclamation4.Location = new System.Drawing.Point(522, 34); + this.exclamation4.Name = "exclamation4"; + this.exclamation4.Size = new System.Drawing.Size(18, 23); + this.exclamation4.TabIndex = 5; + this.exclamation4.Text = "!"; + this.exclamation4.Visible = false; + // + // exclamation5 + // + this.exclamation5.AutoSize = true; + this.exclamation5.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.exclamation5.ForeColor = System.Drawing.Color.Red; + this.exclamation5.Location = new System.Drawing.Point(522, 34); + this.exclamation5.Name = "exclamation5"; + this.exclamation5.Size = new System.Drawing.Size(18, 23); + this.exclamation5.TabIndex = 5; + this.exclamation5.Text = "!"; + this.exclamation5.Visible = false; + // + // exclamation6 + // + this.exclamation6.AutoSize = true; + this.exclamation6.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.exclamation6.ForeColor = System.Drawing.Color.Red; + this.exclamation6.Location = new System.Drawing.Point(522, 34); + this.exclamation6.Name = "exclamation6"; + this.exclamation6.Size = new System.Drawing.Size(18, 23); + this.exclamation6.TabIndex = 5; + this.exclamation6.Text = "!"; + this.exclamation6.Visible = false; + // // TestStartEndForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.DarkGoldenrod; - this.ClientSize = new System.Drawing.Size(718, 586); + this.ClientSize = new System.Drawing.Size(729, 586); this.Controls.Add(this.endLabel); this.Controls.Add(this.startLabel); this.Controls.Add(this.groupBox6); @@ -399,6 +489,12 @@ namespace TBF.BenchControl.DataEntry.Standard private System.Windows.Forms.TextBox wmStartStateTextBox6; private System.Windows.Forms.Label startLabel; private System.Windows.Forms.Label endLabel; + private System.Windows.Forms.Label exclamation2; + private System.Windows.Forms.Label exclamation1; + private System.Windows.Forms.Label exclamation3; + private System.Windows.Forms.Label exclamation4; + private System.Windows.Forms.Label exclamation5; + private System.Windows.Forms.Label exclamation6; } } \ No newline at end of file diff --git a/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryForm.cs b/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryForm.cs index 09aaa7a8a..a3c3dd47c 100644 --- a/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryForm.cs +++ b/TestBenchFramework/BenchControl/DataEntry/WMStates/EntryForm.cs @@ -106,7 +106,7 @@ namespace TBF.BenchControl.DataEntry.WMStates } /// Reference to the operation - public IOperation ShowTestEndFormOp() + public IOperation ShowTestEndFormOp(float refVolume, float errLimLo, float errLimHi) { if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); currentOp = CurrentOp.EnterTestEndStates; diff --git a/TestBenchFramework/BenchControl/GenericDevices/IHasWMStatesForm.cs b/TestBenchFramework/BenchControl/GenericDevices/IHasWMStatesForm.cs index 76afb43e4..4b6ca03d8 100644 --- a/TestBenchFramework/BenchControl/GenericDevices/IHasWMStatesForm.cs +++ b/TestBenchFramework/BenchControl/GenericDevices/IHasWMStatesForm.cs @@ -25,6 +25,6 @@ namespace TBF.BenchControl.GenericDevices /// Displays form at the end of the test to enter water meter start start. /// /// Operation to be used in the sequence - IOperation ShowTestEndFormOp(); + IOperation ShowTestEndFormOp(float volumeRef, float errLimLo, float errLimHi); } } diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs index 3e1dc5bf3..18adbcfa9 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs @@ -450,6 +450,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection while (!e.Contains(Event.PreviousStopped)); + float volumeCTV = 1.00103f * 1000.0f * (tstRslt.MassEnd - tstRslt.MassStart) / + Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); + /// /// Enter watermeter end states here /// @@ -457,7 +460,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection { Bridge.OnActivity(this, "Enter the water meter data"); State.Create("FixedStartMassCollection : Enter end-state") - .AddOperation(dataEntryCmpnt.ShowTestEndFormOp()) + .AddOperation(dataEntryCmpnt.ShowTestEndFormOp(volumeCTV, tstRslt.ErrLimLo, tstRslt.ErrLimHi)) .AddOperation(checkUiOp) .EnterState(); do