Selectors are used in TestWizard in FlowSelection and TestProfileSelection, Map(x => x.selectors) in all paths, ver. 2.30.1930

This commit is contained in:
Milan Hanajik 2022-06-30 17:47:30 +02:00
parent b3df3307a0
commit 3bff80f64b
9 changed files with 211 additions and 58 deletions

View File

@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2015 Sensus Metering Systems /// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// ///
using FluentNHibernate.Mapping; using FluentNHibernate.Mapping;
using Config.Entities; using Config.Entities;
@ -15,7 +15,8 @@ namespace Config.Mappings
Map(x => x.Name); Map(x => x.Name);
Map(x => x.Qfrom); Map(x => x.Qfrom);
Map(x => x.Qto); Map(x => x.Qto);
Map(x => x.TempMtrUp).Column("TempIn"); Map(x => x.Selector);
Map(x => x.TempMtrUp).Column("TempIn");
Map(x => x.TempMtrDown).Column("TempOut"); Map(x => x.TempMtrDown).Column("TempOut");
Map(x => x.PressMtrUp).Column("PressIn"); Map(x => x.PressMtrUp).Column("PressIn");
Map(x => x.PressMtrDown).Column("PressOut"); Map(x => x.PressMtrDown).Column("PressOut");

View File

@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2015 Sensus Metering Systems /// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// ///
using FluentNHibernate.Mapping; using FluentNHibernate.Mapping;
using Config.Entities; using Config.Entities;
@ -15,7 +15,8 @@ namespace Config.Mappings
Map(x => x.Name); Map(x => x.Name);
Map(x => x.Qfrom); Map(x => x.Qfrom);
Map(x => x.Qto); Map(x => x.Qto);
Map(x => x.Pump); Map(x => x.Selector);
Map(x => x.Pump);
Map(x => x.RegulValvesPct); Map(x => x.RegulValvesPct);
Map(x => x.ValvesOpen) Map(x => x.ValvesOpen)
.CustomType("StringClob") .CustomType("StringClob")

View File

@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s. /// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// ///
using FluentNHibernate.Mapping; using FluentNHibernate.Mapping;
using Config.Entities; using Config.Entities;
@ -15,7 +15,8 @@ namespace Config.Mappings
Map(x => x.Name); Map(x => x.Name);
Map(x => x.Qfrom); Map(x => x.Qfrom);
Map(x => x.Qto); Map(x => x.Qto);
Map(x => x.RegulValve); Map(x => x.Selector);
Map(x => x.RegulValve);
Map(x => x.FlowMeter); Map(x => x.FlowMeter);
Map(x => x.PidCoef); Map(x => x.PidCoef);
Map(x => x.StartValve); Map(x => x.StartValve);

View File

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

View File

@ -2392,6 +2392,22 @@ namespace TBF.UI.Procedures
if (notUsed) break; if (notUsed) break;
} }
/// Find possible selector values.
/// Empty string or null (which is permitted) is not part of list 'selectorValues'
IList<string> selectorValues = new List<string>();
foreach (var fp in feedingPaths)
{
if (!string.IsNullOrEmpty(fp.Selector) && !selectorValues.Contains(fp.Selector)) selectorValues.Add(fp.Selector);
}
foreach (var bp in benchPaths)
{
if (!string.IsNullOrEmpty(bp.Selector) && !selectorValues.Contains(bp.Selector)) selectorValues.Add(bp.Selector);
}
foreach (var op in outputPaths)
{
if (!string.IsNullOrEmpty(op.Selector) && !selectorValues.Contains(op.Selector)) selectorValues.Add(op.Selector);
}
/// Add a test /// Add a test
Test test = new Test(newName, listViewEx.Items.Count, LoadedProcedure); Test test = new Test(newName, listViewEx.Items.Count, LoadedProcedure);
@ -2407,7 +2423,7 @@ namespace TBF.UI.Procedures
/// Run a create new test wizard /// Run a create new test wizard
TestWizard.MethodSelection methodDlg = new TestWizard.MethodSelection(true, false, test, TestMethods); TestWizard.MethodSelection methodDlg = new TestWizard.MethodSelection(true, false, test, TestMethods);
TestWizard.FlowSelection flowDlg = new TestWizard.FlowSelection(false, false, test, metersPaths); TestWizard.FlowSelection flowDlg = new TestWizard.FlowSelection(false, false, test, metersPaths, selectorValues);
TestWizard.VolumeAndErrorSelection volumeDlg = new TestWizard.VolumeAndErrorSelection(false, true, test); TestWizard.VolumeAndErrorSelection volumeDlg = new TestWizard.VolumeAndErrorSelection(false, true, test);
TestWizard.PressureSelection pressureDlg = new TestWizard.PressureSelection(false, true, test); TestWizard.PressureSelection pressureDlg = new TestWizard.PressureSelection(false, true, test);
TestWizard.HeatMetersSelection heatMetersDlg = new TestWizard.HeatMetersSelection(false, false, test); TestWizard.HeatMetersSelection heatMetersDlg = new TestWizard.HeatMetersSelection(false, false, test);
@ -2485,11 +2501,14 @@ namespace TBF.UI.Procedures
select_paths: select_paths:
string selector = flowDlg.Selector;
/// Depending on the chosen Q select the paths /// Depending on the chosen Q select the paths
float Qaver = (test.Qfrom + test.Qto) / 2.0f; float Qaver = (test.Qfrom + test.Qto) / 2.0f;
foreach (var path in feedingPaths) foreach (var path in feedingPaths)
{ {
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto)) if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto) &&
(string.IsNullOrEmpty(selector) || string.IsNullOrEmpty(path.Selector) || path.Selector == selector))
{ {
test.FeedingPath = path.Name; test.FeedingPath = path.Name;
break; break;
@ -2497,7 +2516,8 @@ namespace TBF.UI.Procedures
} }
foreach (var path in benchPaths) foreach (var path in benchPaths)
{ {
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto)) if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto) &&
(string.IsNullOrEmpty(selector) || string.IsNullOrEmpty(path.Selector) || path.Selector == selector))
{ {
test.BenchPath = path.Name; test.BenchPath = path.Name;
break; break;
@ -2505,7 +2525,8 @@ namespace TBF.UI.Procedures
} }
foreach (var path in outputPaths) foreach (var path in outputPaths)
{ {
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto)) if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto) &&
(string.IsNullOrEmpty(selector) || string.IsNullOrEmpty(path.Selector) || path.Selector == selector))
{ {
test.OutputPath = path.Name; test.OutputPath = path.Name;
break; break;

View File

@ -691,12 +691,18 @@ namespace TBF.UI.Procedures
public void CreateFromProfile() public void CreateFromProfile()
{ {
IList<Profile> profiles; IList<Profile> profiles;
IList<FeedingPath> fPaths;
IList<BenchPath> bPaths;
IList<OutputPath> oPaths;
try try
{ {
profiles = session.QueryOver<Profile>() profiles = session.QueryOver<Profile>()
.OrderBy(x => x.ItemNr).Asc .OrderBy(x => x.ItemNr).Asc
.List(); .List();
fPaths = session.QueryOver<FeedingPath>().OrderBy(x => x.ItemNr).Asc.List();
bPaths = session.QueryOver<BenchPath>().OrderBy(x => x.ItemNr).Asc.List();
oPaths = session.QueryOver<OutputPath>().OrderBy(x => x.ItemNr).Asc.List();
} }
catch (Exception) catch (Exception)
{ {
@ -705,7 +711,7 @@ namespace TBF.UI.Procedures
return; return;
} }
TestWizard.TestProfileSelection dlg = new TestWizard.TestProfileSelection(profiles); TestWizard.TestProfileSelection dlg = new TestWizard.TestProfileSelection(profiles, fPaths, bPaths, oPaths);
if (dlg.ShowDialog() != DialogResult.OK) return; if (dlg.ShowDialog() != DialogResult.OK) return;
/// Find an unused procedure name /// Find an unused procedure name

View File

@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2015 Senus Slovensko a.s. /// Copyright (c) 2013-2022 Senus Slovensko a.s.
/// ///
namespace TBF.UI.Procedures.TestWizard namespace TBF.UI.Procedures.TestWizard
{ {
@ -35,6 +35,8 @@ namespace TBF.UI.Procedures.TestWizard
this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.unitComboBox = new System.Windows.Forms.ComboBox(); this.unitComboBox = new System.Windows.Forms.ComboBox();
this.selectorComboBox = new System.Windows.Forms.ComboBox();
this.selectorLabel = new System.Windows.Forms.Label();
this.qFromLabel = new System.Windows.Forms.Label(); this.qFromLabel = new System.Windows.Forms.Label();
this.qToLabel = new System.Windows.Forms.Label(); this.qToLabel = new System.Windows.Forms.Label();
this.qFromTextBox = new System.Windows.Forms.TextBox(); this.qFromTextBox = new System.Windows.Forms.TextBox();
@ -77,6 +79,8 @@ namespace TBF.UI.Procedures.TestWizard
// horizSplitContainer.Panel1 // horizSplitContainer.Panel1
// //
this.horizSplitContainer.Panel1.Controls.Add(this.tabControl1); this.horizSplitContainer.Panel1.Controls.Add(this.tabControl1);
this.horizSplitContainer.Panel1.Controls.Add(this.selectorComboBox);
this.horizSplitContainer.Panel1.Controls.Add(this.selectorLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.sensorsComboBox); this.horizSplitContainer.Panel1.Controls.Add(this.sensorsComboBox);
this.horizSplitContainer.Panel1.Controls.Add(this.sensorsLabel); this.horizSplitContainer.Panel1.Controls.Add(this.sensorsLabel);
// //
@ -86,7 +90,7 @@ namespace TBF.UI.Procedures.TestWizard
this.horizSplitContainer.Panel2.Controls.Add(this.nextButton); this.horizSplitContainer.Panel2.Controls.Add(this.nextButton);
this.horizSplitContainer.Panel2.Controls.Add(this.backButton); this.horizSplitContainer.Panel2.Controls.Add(this.backButton);
this.horizSplitContainer.Size = new System.Drawing.Size(284, 262); this.horizSplitContainer.Size = new System.Drawing.Size(284, 262);
this.horizSplitContainer.SplitterDistance = 182; this.horizSplitContainer.SplitterDistance = 185;
this.horizSplitContainer.TabIndex = 1; this.horizSplitContainer.TabIndex = 1;
// //
// tabControl1 // tabControl1
@ -97,7 +101,7 @@ namespace TBF.UI.Procedures.TestWizard
this.tabControl1.Location = new System.Drawing.Point(0, 3); this.tabControl1.Location = new System.Drawing.Point(0, 3);
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0; this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(284, 123); this.tabControl1.Size = new System.Drawing.Size(284, 107);
this.tabControl1.TabIndex = 11; this.tabControl1.TabIndex = 11;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged); this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
// //
@ -112,24 +116,41 @@ namespace TBF.UI.Procedures.TestWizard
this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1"; this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(276, 97); this.tabPage1.Size = new System.Drawing.Size(276, 81);
this.tabPage1.TabIndex = 0; this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Q from / Q to"; this.tabPage1.Text = "Q from / Q to";
// //
// unitComboBox // unitComboBox
// //
this.unitComboBox.FormattingEnabled = true; this.unitComboBox.FormattingEnabled = true;
this.unitComboBox.Location = new System.Drawing.Point(182, 32); this.unitComboBox.Location = new System.Drawing.Point(182, 17);
this.unitComboBox.Name = "unitComboBox"; this.unitComboBox.Name = "unitComboBox";
this.unitComboBox.Size = new System.Drawing.Size(75, 21); this.unitComboBox.Size = new System.Drawing.Size(75, 21);
this.unitComboBox.TabIndex = 6; this.unitComboBox.TabIndex = 6;
this.unitComboBox.SelectedIndexChanged += new System.EventHandler(this.unitComboBox_SelectedIndexChanged); this.unitComboBox.SelectedIndexChanged += new System.EventHandler(this.unitComboBox_SelectedIndexChanged);
this.unitComboBox.TextChanged += new System.EventHandler(this.unitComboBox_TextChanged); this.unitComboBox.TextChanged += new System.EventHandler(this.unitComboBox_TextChanged);
// //
// selectorComboBox
//
this.selectorComboBox.FormattingEnabled = true;
this.selectorComboBox.Location = new System.Drawing.Point(98, 121);
this.selectorComboBox.Name = "selectorComboBox";
this.selectorComboBox.Size = new System.Drawing.Size(162, 21);
this.selectorComboBox.TabIndex = 7;
//
// selectorLabel
//
this.selectorLabel.AutoSize = true;
this.selectorLabel.Location = new System.Drawing.Point(21, 124);
this.selectorLabel.Name = "selectorLabel";
this.selectorLabel.Size = new System.Drawing.Size(46, 13);
this.selectorLabel.TabIndex = 6;
this.selectorLabel.Text = "Selector";
//
// qFromLabel // qFromLabel
// //
this.qFromLabel.AutoSize = true; this.qFromLabel.AutoSize = true;
this.qFromLabel.Location = new System.Drawing.Point(18, 35); this.qFromLabel.Location = new System.Drawing.Point(18, 20);
this.qFromLabel.Name = "qFromLabel"; this.qFromLabel.Name = "qFromLabel";
this.qFromLabel.Size = new System.Drawing.Size(38, 13); this.qFromLabel.Size = new System.Drawing.Size(38, 13);
this.qFromLabel.TabIndex = 1; this.qFromLabel.TabIndex = 1;
@ -138,7 +159,7 @@ namespace TBF.UI.Procedures.TestWizard
// qToLabel // qToLabel
// //
this.qToLabel.AutoSize = true; this.qToLabel.AutoSize = true;
this.qToLabel.Location = new System.Drawing.Point(18, 61); this.qToLabel.Location = new System.Drawing.Point(18, 46);
this.qToLabel.Name = "qToLabel"; this.qToLabel.Name = "qToLabel";
this.qToLabel.Size = new System.Drawing.Size(27, 13); this.qToLabel.Size = new System.Drawing.Size(27, 13);
this.qToLabel.TabIndex = 2; this.qToLabel.TabIndex = 2;
@ -146,7 +167,7 @@ namespace TBF.UI.Procedures.TestWizard
// //
// qFromTextBox // qFromTextBox
// //
this.qFromTextBox.Location = new System.Drawing.Point(95, 32); this.qFromTextBox.Location = new System.Drawing.Point(95, 17);
this.qFromTextBox.Name = "qFromTextBox"; this.qFromTextBox.Name = "qFromTextBox";
this.qFromTextBox.Size = new System.Drawing.Size(70, 20); this.qFromTextBox.Size = new System.Drawing.Size(70, 20);
this.qFromTextBox.TabIndex = 4; this.qFromTextBox.TabIndex = 4;
@ -154,7 +175,7 @@ namespace TBF.UI.Procedures.TestWizard
// //
// qToTextBox // qToTextBox
// //
this.qToTextBox.Location = new System.Drawing.Point(95, 58); this.qToTextBox.Location = new System.Drawing.Point(95, 43);
this.qToTextBox.Name = "qToTextBox"; this.qToTextBox.Name = "qToTextBox";
this.qToTextBox.Size = new System.Drawing.Size(70, 20); this.qToTextBox.Size = new System.Drawing.Size(70, 20);
this.qToTextBox.TabIndex = 5; this.qToTextBox.TabIndex = 5;
@ -171,14 +192,14 @@ namespace TBF.UI.Procedures.TestWizard
this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2"; this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(276, 97); this.tabPage2.Size = new System.Drawing.Size(276, 81);
this.tabPage2.TabIndex = 1; this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Q +/- dQ"; this.tabPage2.Text = "Q +/- dQ";
// //
// unit2ComboBox // unit2ComboBox
// //
this.unit2ComboBox.FormattingEnabled = true; this.unit2ComboBox.FormattingEnabled = true;
this.unit2ComboBox.Location = new System.Drawing.Point(182, 32); this.unit2ComboBox.Location = new System.Drawing.Point(182, 17);
this.unit2ComboBox.Name = "unit2ComboBox"; this.unit2ComboBox.Name = "unit2ComboBox";
this.unit2ComboBox.Size = new System.Drawing.Size(75, 21); this.unit2ComboBox.Size = new System.Drawing.Size(75, 21);
this.unit2ComboBox.TabIndex = 10; this.unit2ComboBox.TabIndex = 10;
@ -188,7 +209,7 @@ namespace TBF.UI.Procedures.TestWizard
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(18, 35); this.label1.Location = new System.Drawing.Point(18, 20);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(49, 13); this.label1.Size = new System.Drawing.Size(49, 13);
this.label1.TabIndex = 6; this.label1.TabIndex = 6;
@ -197,7 +218,7 @@ namespace TBF.UI.Procedures.TestWizard
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(18, 61); this.label2.Location = new System.Drawing.Point(18, 46);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(55, 13); this.label2.Size = new System.Drawing.Size(55, 13);
this.label2.TabIndex = 7; this.label2.TabIndex = 7;
@ -205,7 +226,7 @@ namespace TBF.UI.Procedures.TestWizard
// //
// q2TextBox // q2TextBox
// //
this.q2TextBox.Location = new System.Drawing.Point(95, 32); this.q2TextBox.Location = new System.Drawing.Point(95, 17);
this.q2TextBox.Name = "q2TextBox"; this.q2TextBox.Name = "q2TextBox";
this.q2TextBox.Size = new System.Drawing.Size(70, 20); this.q2TextBox.Size = new System.Drawing.Size(70, 20);
this.q2TextBox.TabIndex = 8; this.q2TextBox.TabIndex = 8;
@ -213,7 +234,7 @@ namespace TBF.UI.Procedures.TestWizard
// //
// dQTextBox // dQTextBox
// //
this.dQTextBox.Location = new System.Drawing.Point(95, 58); this.dQTextBox.Location = new System.Drawing.Point(95, 43);
this.dQTextBox.Name = "dQTextBox"; this.dQTextBox.Name = "dQTextBox";
this.dQTextBox.Size = new System.Drawing.Size(70, 20); this.dQTextBox.Size = new System.Drawing.Size(70, 20);
this.dQTextBox.TabIndex = 9; this.dQTextBox.TabIndex = 9;
@ -229,14 +250,14 @@ namespace TBF.UI.Procedures.TestWizard
this.tabPage3.Controls.Add(this.dQpctTextBox); this.tabPage3.Controls.Add(this.dQpctTextBox);
this.tabPage3.Location = new System.Drawing.Point(4, 22); this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3"; this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(276, 97); this.tabPage3.Size = new System.Drawing.Size(276, 81);
this.tabPage3.TabIndex = 2; this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Q +/- delta [%]"; this.tabPage3.Text = "Q +/- delta [%]";
// //
// unit3ComboBox // unit3ComboBox
// //
this.unit3ComboBox.FormattingEnabled = true; this.unit3ComboBox.FormattingEnabled = true;
this.unit3ComboBox.Location = new System.Drawing.Point(182, 32); this.unit3ComboBox.Location = new System.Drawing.Point(182, 17);
this.unit3ComboBox.Name = "unit3ComboBox"; this.unit3ComboBox.Name = "unit3ComboBox";
this.unit3ComboBox.Size = new System.Drawing.Size(75, 21); this.unit3ComboBox.Size = new System.Drawing.Size(75, 21);
this.unit3ComboBox.TabIndex = 10; this.unit3ComboBox.TabIndex = 10;
@ -246,7 +267,7 @@ namespace TBF.UI.Procedures.TestWizard
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(18, 35); this.label3.Location = new System.Drawing.Point(18, 20);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(49, 13); this.label3.Size = new System.Drawing.Size(49, 13);
this.label3.TabIndex = 6; this.label3.TabIndex = 6;
@ -255,7 +276,7 @@ namespace TBF.UI.Procedures.TestWizard
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(18, 61); this.label4.Location = new System.Drawing.Point(18, 46);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(38, 13); this.label4.Size = new System.Drawing.Size(38, 13);
this.label4.TabIndex = 7; this.label4.TabIndex = 7;
@ -263,7 +284,7 @@ namespace TBF.UI.Procedures.TestWizard
// //
// q3TextBox // q3TextBox
// //
this.q3TextBox.Location = new System.Drawing.Point(95, 32); this.q3TextBox.Location = new System.Drawing.Point(95, 17);
this.q3TextBox.Name = "q3TextBox"; this.q3TextBox.Name = "q3TextBox";
this.q3TextBox.Size = new System.Drawing.Size(70, 20); this.q3TextBox.Size = new System.Drawing.Size(70, 20);
this.q3TextBox.TabIndex = 8; this.q3TextBox.TabIndex = 8;
@ -271,7 +292,7 @@ namespace TBF.UI.Procedures.TestWizard
// //
// dQpctTextBox // dQpctTextBox
// //
this.dQpctTextBox.Location = new System.Drawing.Point(95, 58); this.dQpctTextBox.Location = new System.Drawing.Point(95, 43);
this.dQpctTextBox.Name = "dQpctTextBox"; this.dQpctTextBox.Name = "dQpctTextBox";
this.dQpctTextBox.Size = new System.Drawing.Size(70, 20); this.dQpctTextBox.Size = new System.Drawing.Size(70, 20);
this.dQpctTextBox.TabIndex = 9; this.dQpctTextBox.TabIndex = 9;
@ -280,16 +301,16 @@ namespace TBF.UI.Procedures.TestWizard
// sensorsComboBox // sensorsComboBox
// //
this.sensorsComboBox.FormattingEnabled = true; this.sensorsComboBox.FormattingEnabled = true;
this.sensorsComboBox.Location = new System.Drawing.Point(98, 145); this.sensorsComboBox.Location = new System.Drawing.Point(98, 150);
this.sensorsComboBox.Name = "sensorsComboBox"; this.sensorsComboBox.Name = "sensorsComboBox";
this.sensorsComboBox.Size = new System.Drawing.Size(124, 21); this.sensorsComboBox.Size = new System.Drawing.Size(163, 21);
this.sensorsComboBox.TabIndex = 7; this.sensorsComboBox.TabIndex = 7;
this.sensorsComboBox.SelectedIndexChanged += new System.EventHandler(this.anyTextBox_TextChanged); this.sensorsComboBox.SelectedIndexChanged += new System.EventHandler(this.anyTextBox_TextChanged);
// //
// sensorsLabel // sensorsLabel
// //
this.sensorsLabel.AutoSize = true; this.sensorsLabel.AutoSize = true;
this.sensorsLabel.Location = new System.Drawing.Point(21, 148); this.sensorsLabel.Location = new System.Drawing.Point(21, 153);
this.sensorsLabel.Name = "sensorsLabel"; this.sensorsLabel.Name = "sensorsLabel";
this.sensorsLabel.Size = new System.Drawing.Size(45, 13); this.sensorsLabel.Size = new System.Drawing.Size(45, 13);
this.sensorsLabel.TabIndex = 6; this.sensorsLabel.TabIndex = 6;
@ -299,7 +320,7 @@ namespace TBF.UI.Procedures.TestWizard
// //
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(186, 17); this.cancelButton.Location = new System.Drawing.Point(186, 14);
this.cancelButton.Name = "cancelButton"; this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 42); this.cancelButton.Size = new System.Drawing.Size(75, 42);
this.cancelButton.TabIndex = 27; this.cancelButton.TabIndex = 27;
@ -310,7 +331,7 @@ namespace TBF.UI.Procedures.TestWizard
// nextButton // nextButton
// //
this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.nextButton.Location = new System.Drawing.Point(105, 17); this.nextButton.Location = new System.Drawing.Point(105, 14);
this.nextButton.Name = "nextButton"; this.nextButton.Name = "nextButton";
this.nextButton.Size = new System.Drawing.Size(75, 42); this.nextButton.Size = new System.Drawing.Size(75, 42);
this.nextButton.TabIndex = 26; this.nextButton.TabIndex = 26;
@ -322,7 +343,7 @@ namespace TBF.UI.Procedures.TestWizard
// //
this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.backButton.DialogResult = System.Windows.Forms.DialogResult.Retry; this.backButton.DialogResult = System.Windows.Forms.DialogResult.Retry;
this.backButton.Location = new System.Drawing.Point(24, 17); this.backButton.Location = new System.Drawing.Point(24, 14);
this.backButton.Name = "backButton"; this.backButton.Name = "backButton";
this.backButton.Size = new System.Drawing.Size(75, 42); this.backButton.Size = new System.Drawing.Size(75, 42);
this.backButton.TabIndex = 25; this.backButton.TabIndex = 25;
@ -383,6 +404,7 @@ namespace TBF.UI.Procedures.TestWizard
private System.Windows.Forms.ComboBox unitComboBox; private System.Windows.Forms.ComboBox unitComboBox;
private System.Windows.Forms.ComboBox unit2ComboBox; private System.Windows.Forms.ComboBox unit2ComboBox;
private System.Windows.Forms.ComboBox unit3ComboBox; private System.Windows.Forms.ComboBox unit3ComboBox;
private System.Windows.Forms.ComboBox selectorComboBox;
private System.Windows.Forms.Label selectorLabel;
} }
} }

View File

@ -20,19 +20,24 @@ namespace TBF.UI.Procedures.TestWizard
Q_dPct, Q_dPct,
} }
const string EmptySelector = "---";
Test test; Test test;
IList<MetersPath> sensorPaths; IList<MetersPath> sensorPaths;
ICollection<string> selectorValues; /// Empty string (permitted) is not part of this collection
QSpec qSpec; QSpec qSpec;
Unit flowUnit; Unit flowUnit;
public string Selector { get { return (selectorComboBox.Text == EmptySelector) ? string.Empty : selectorComboBox.Text; } }
public FlowSelection() public FlowSelection()
{ {
InitializeComponent(); InitializeComponent();
qSpec = QSpec.Qfrom_Qto; qSpec = QSpec.Qfrom_Qto;
Text = Strings.Flow_selection; Text = Strings.Flow_selection;
qFromLabel.Text = string.Format("{0}", Strings.Q_from); qFromLabel.Text = Strings.Q_from;
qToLabel.Text = string.Format("{0}", Strings.Q_to); qToLabel.Text = Strings.Q_to;
sensorsLabel.Text = Strings.Sensors; sensorsLabel.Text = Strings.Sensors;
for (Unit u = 0; u < Unit.Count; u++) for (Unit u = 0; u < Unit.Count; u++)
@ -47,13 +52,14 @@ namespace TBF.UI.Procedures.TestWizard
} }
} }
public FlowSelection(bool first, bool last, public FlowSelection(bool first, bool last, Test test,
Test test, IList<MetersPath> sensorPaths,
IList<MetersPath> sensorPaths) ICollection<string> selectorValues)
: this() : this()
{ {
this.test = test; this.test = test;
this.sensorPaths = sensorPaths; this.sensorPaths = sensorPaths;
this.selectorValues = selectorValues;
flowUnit = test.FlowUnit; flowUnit = test.FlowUnit;
unitComboBox.Text = unit2ComboBox.Text = unit3ComboBox.Text = flowUnit.ToDescription(); unitComboBox.Text = unit2ComboBox.Text = unit3ComboBox.Text = flowUnit.ToDescription();
@ -65,12 +71,15 @@ namespace TBF.UI.Procedures.TestWizard
cancelButton.Text = Strings.CancelBtnText; cancelButton.Text = Strings.CancelBtnText;
} }
private void FlowSelection_Load(object sender, EventArgs e) private void FlowSelection_Load(object sender, EventArgs e)
{ {
if (test == null) return; if (test == null) return;
foreach (var path in sensorPaths) sensorsComboBox.Items.Add(path.Name); foreach (var path in sensorPaths) sensorsComboBox.Items.Add(path.Name);
selectorComboBox.Items.Add(EmptySelector);
foreach (var selector in selectorValues) selectorComboBox.Items.Add(selector);
qFromTextBox.Text = Units.ConvertTo(flowUnit, test.Qfrom).ToString(); qFromTextBox.Text = Units.ConvertTo(flowUnit, test.Qfrom).ToString();
qToTextBox.Text = Units.ConvertTo(flowUnit, test.Qto).ToString(); qToTextBox.Text = Units.ConvertTo(flowUnit, test.Qto).ToString();
nextButton.Enabled = IsFormValid(); nextButton.Enabled = IsFormValid();
@ -121,16 +130,19 @@ namespace TBF.UI.Procedures.TestWizard
case QSpec.Qfrom_Qto: case QSpec.Qfrom_Qto:
return Utils.TryParseUFloat(qFromTextBox.Text, out dummy) && return Utils.TryParseUFloat(qFromTextBox.Text, out dummy) &&
Utils.TryParseUFloat(qToTextBox.Text, out dummy) && Utils.TryParseUFloat(qToTextBox.Text, out dummy) &&
selectorComboBox.Items.Contains(selectorComboBox.Text) &&
sensorsComboBox.Items.Contains(sensorsComboBox.Text); sensorsComboBox.Items.Contains(sensorsComboBox.Text);
case QSpec.Q_dQ: case QSpec.Q_dQ:
return Utils.TryParseUFloat(q2TextBox.Text, out dummy) && return Utils.TryParseUFloat(q2TextBox.Text, out dummy) &&
Utils.TryParseUFloat(dQTextBox.Text, out dummy) && Utils.TryParseUFloat(dQTextBox.Text, out dummy) &&
selectorComboBox.Items.Contains(selectorComboBox.Text) &&
sensorsComboBox.Items.Contains(sensorsComboBox.Text); sensorsComboBox.Items.Contains(sensorsComboBox.Text);
case QSpec.Q_dPct: case QSpec.Q_dPct:
return Utils.TryParseUFloat(q3TextBox.Text, out dummy) && return Utils.TryParseUFloat(q3TextBox.Text, out dummy) &&
Utils.TryParseUFloat(dQpctTextBox.Text, out dummy) && Utils.TryParseUFloat(dQpctTextBox.Text, out dummy) &&
selectorComboBox.Items.Contains(selectorComboBox.Text) &&
sensorsComboBox.Items.Contains(sensorsComboBox.Text); sensorsComboBox.Items.Contains(sensorsComboBox.Text);
} }
} }

View File

@ -18,7 +18,14 @@ namespace TBF.UI.Procedures.TestWizard
{ {
static readonly ILog log = LogManager.GetLogger(typeof(TestProfileSelection)); static readonly ILog log = LogManager.GetLogger(typeof(TestProfileSelection));
const int NameColumn = 0;
const int SelectorColumn = 5;
const string EmptySelector = "---";
IList<Profile> profiles; IList<Profile> profiles;
IList<FeedingPath> fPaths;
IList<BenchPath> bPaths;
IList<OutputPath> oPaths;
public Profile SelectedProfile; public Profile SelectedProfile;
public IList<Test> SelectedTests; public IList<Test> SelectedTests;
@ -26,24 +33,45 @@ namespace TBF.UI.Procedures.TestWizard
public string MetroClass; public string MetroClass;
public double QpQiRatio; public double QpQiRatio;
IList<string> selectorVals; /// Empty string or null (which is permitted) is not part of this list
TextBox testNameTextBox; TextBox testNameTextBox;
ComboBox selectorComboBox;
public TestProfileSelection(IList<Profile> profiles) public TestProfileSelection(IList<Profile> profiles,
IList<FeedingPath> fPaths,
IList<BenchPath> bPaths,
IList<OutputPath> oPaths)
{ {
this.profiles = profiles; this.profiles = profiles;
this.fPaths = fPaths;
this.bPaths = bPaths;
this.oPaths = oPaths;
InitializeComponent(); InitializeComponent();
/// Find possible selector values
selectorVals = new List<string>();
foreach (var p in fPaths) if (!string.IsNullOrEmpty(p.Selector) && !selectorVals.Contains(p.Selector)) selectorVals.Add(p.Selector);
foreach (var p in bPaths) if (!string.IsNullOrEmpty(p.Selector) && !selectorVals.Contains(p.Selector)) selectorVals.Add(p.Selector);
foreach (var p in oPaths) if (!string.IsNullOrEmpty(p.Selector) && !selectorVals.Contains(p.Selector)) selectorVals.Add(p.Selector);
testNameTextBox = new TextBox(); testNameTextBox = new TextBox();
testNameTextBox.Visible = false; testNameTextBox.Visible = false;
this.Controls.Add(testNameTextBox); this.Controls.Add(testNameTextBox);
selectorComboBox = new ComboBox();
selectorComboBox.Visible = false;
selectorComboBox.Items.Add(EmptySelector);
foreach (var s in selectorVals) selectorComboBox.Items.Add(s);
this.Controls.Add(selectorComboBox);
/// ListViewEx-es configuration /// ListViewEx-es configuration
listViewEx.Columns.Add(Strings.Name, 70); listViewEx.Columns.Add(Strings.Name, 70);
listViewEx.Columns.Add(Strings.Part, 40); listViewEx.Columns.Add(Strings.Part, 40);
listViewEx.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_tg), 80); listViewEx.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_tg), 80);
listViewEx.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_from), 80); listViewEx.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_from), 80);
listViewEx.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_to), 70); listViewEx.Columns.Add(string.Format("{0} [m3/h]", Strings.Q_to), 70);
listViewEx.Columns.Add("Selector");
listViewEx.Columns.Add(Strings.Err_limit_neg_pct_chdr, 80); listViewEx.Columns.Add(Strings.Err_limit_neg_pct_chdr, 80);
listViewEx.Columns.Add(Strings.Err_limit_pos_pct_chdr, 80); listViewEx.Columns.Add(Strings.Err_limit_pos_pct_chdr, 80);
@ -180,6 +208,7 @@ namespace TBF.UI.Procedures.TestWizard
Qtg.ToString(), Qtg.ToString(),
test.Qfrom.ToString(), test.Qfrom.ToString(),
test.Qto.ToString(), test.Qto.ToString(),
EmptySelector,
ptest.ErrLimLo.ToString(), ptest.ErrLimLo.ToString(),
ptest.ErrLimHi.ToString() }); ptest.ErrLimHi.ToString() });
} }
@ -190,6 +219,7 @@ namespace TBF.UI.Procedures.TestWizard
Qtg.ToString(), Qtg.ToString(),
test.Qfrom.ToString(), test.Qfrom.ToString(),
test.Qto.ToString(), test.Qto.ToString(),
EmptySelector,
Strings.calculated, Strings.calculated,
Strings.calculated }); Strings.calculated });
} }
@ -349,36 +379,95 @@ namespace TBF.UI.Procedures.TestWizard
private void listViewEx_SubItemClicked(object sender, SubItemEventArgs e) private void listViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{ {
if (e.SubItem != 0) return; if (e.SubItem == NameColumn)
{
listViewEx.StartEditing(testNameTextBox, e.Item, e.SubItem); listViewEx.StartEditing(testNameTextBox, e.Item, e.SubItem);
}
else if (e.SubItem == SelectorColumn)
{
listViewEx.StartEditing(selectorComboBox, e.Item, e.SubItem);
}
} }
private void listViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e) private void listViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
{ {
Test test = e.Item.Tag as Test; Test test = e.Item.Tag as Test;
foreach (var item in listViewEx.Items) if (e.SubItem == NameColumn)
{ {
var lvi = item as ListViewItem; foreach (var item in listViewEx.Items)
if (lvi != null && lvi != e.Item && (lvi.Tag is Test) && (lvi.Tag as Test).Name == e.DisplayText) {
var lvi = item as ListViewItem;
if (lvi != null && lvi != e.Item && (lvi.Tag is Test) && (lvi.Tag as Test).Name == e.DisplayText)
{
/// Test name was not unique, revert to the original one
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true;
return;
}
}
/// OK
test.Name = e.DisplayText;
}
else if (e.SubItem == SelectorColumn)
{
if (!selectorComboBox.Items.Contains(e.DisplayText))
{ {
/// Test name was not unique, revert to the original one /// Test name was not unique, revert to the original one
e.DisplayText = e.Item.SubItems[e.SubItem].Text; e.DisplayText = e.Item.SubItems[e.SubItem].Text;
e.Cancel = true; e.Cancel = true;
return; return;
} }
}
/// OK
test.Name = e.DisplayText; }
return;
} }
private void nextButton_Click(object sender, EventArgs e) private void nextButton_Click(object sender, EventArgs e)
{ {
if (IsFormValid()) if (IsFormValid())
{ {
foreach (var item in listViewEx.Items)
{
var lvi = item as ListViewItem;
string selector = (lvi.SubItems[SelectorColumn].Text == EmptySelector) ? string.Empty : lvi.SubItems[SelectorColumn].Text;
Test test = lvi.Tag as Test;
if (test != null)
{
/// Depending on the chosen Q select the paths
float Qaver = (test.Qfrom + test.Qto) / 2.0f;
foreach (var path in fPaths)
{
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto) &&
(string.IsNullOrEmpty(selector) || string.IsNullOrEmpty(path.Selector) || path.Selector == selector))
{
test.FeedingPath = path.Name;
break;
}
}
foreach (var path in bPaths)
{
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto) &&
(string.IsNullOrEmpty(selector) || string.IsNullOrEmpty(path.Selector) || path.Selector == selector))
{
test.BenchPath = path.Name;
break;
}
}
foreach (var path in oPaths)
{
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto) &&
(string.IsNullOrEmpty(selector) || string.IsNullOrEmpty(path.Selector) || path.Selector == selector))
{
test.OutputPath = path.Name;
break;
}
}
}
}
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
Close(); Close();
} }