From e74c8692ce0c13504ae274a928bcb0f63463f2cf Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Tue, 13 Apr 2021 11:04:00 +0200 Subject: [PATCH] Paths : Selector : UI changes, Selector not mapped to the config DB yet. --- Config/Entities/BenchPath.cs | 4 +++- Config/Entities/FeedingPath.cs | 13 ++++++++----- Config/Entities/OutputPath.cs | 24 +++++++++++++----------- TBF/BenchControl/BenchPath.cs | 2 ++ TBF/BenchControl/FeedingPath.cs | 6 ++++-- TBF/BenchControl/OutputPath.cs | 2 ++ TBF/UI/Bench/Paths/PathsBenchCtrl.cs | 15 ++++++++++----- TBF/UI/Bench/Paths/PathsFeedingCtrl.cs | 16 +++++++++++----- TBF/UI/Bench/Paths/PathsOutputCtrl.cs | 13 +++++++++---- 9 files changed, 62 insertions(+), 33 deletions(-) diff --git a/Config/Entities/BenchPath.cs b/Config/Entities/BenchPath.cs index 8572a10d9..dd359adfa 100644 --- a/Config/Entities/BenchPath.cs +++ b/Config/Entities/BenchPath.cs @@ -14,6 +14,7 @@ namespace Config.Entities public virtual string OriName { get; set; } /// Not mapped to database public virtual float Qfrom { get; set; } /// Water flow in [m3/h] public virtual float Qto { get; set; } /// Water flow in [m3/h] + public virtual string Selector { get; set; } public virtual string TempMtrUp { get; set; } public virtual string TempMtrDown { get; set; } public virtual string PressMtrUp { get; set; } @@ -46,7 +47,8 @@ namespace Config.Entities result.Qfrom = Qfrom; result.Qto = Qto; - result.TempMtrUp = TempMtrUp; + result.Selector = Selector; + result.TempMtrUp = TempMtrUp; result.TempMtrDown = TempMtrDown; result.PressMtrUp = PressMtrUp; result.PressMtrDown = PressMtrDown; diff --git a/Config/Entities/FeedingPath.cs b/Config/Entities/FeedingPath.cs index dac4a6d59..55acfe51c 100644 --- a/Config/Entities/FeedingPath.cs +++ b/Config/Entities/FeedingPath.cs @@ -14,6 +14,7 @@ namespace Config.Entities public virtual string OriName { get; set; } /// Not mapped to database public virtual float Qfrom { get; set; } /// Water flow in [m3/h] public virtual float Qto { get; set; } /// Water flow in [m3/h] + public virtual string Selector { get; set; } public virtual string Pump { get; set; } public virtual string RegulValvesPct { get; set; } /// Positions of regulation valves in % separated by ';' @@ -40,12 +41,14 @@ namespace Config.Entities { FeedingPath result = new FeedingPath(name, itemNr); - result.Qfrom = Qfrom; - result.Qto = Qto; - result.Pump = Pump; + result.Qfrom = Qfrom; + result.Qto = Qto; + result.Selector = Selector; + result.Pump = Pump; result.RegulValvesPct = RegulValvesPct; - result.ValvesOpen = ValvesOpen; - result.ValvesClose = ValvesClose; + result.ValvesOpen = ValvesOpen; + result.ValvesClose = ValvesClose; + return result; } diff --git a/Config/Entities/OutputPath.cs b/Config/Entities/OutputPath.cs index 1a9b1ef1b..e2261dd6a 100644 --- a/Config/Entities/OutputPath.cs +++ b/Config/Entities/OutputPath.cs @@ -14,6 +14,7 @@ namespace Config.Entities public virtual string OriName { get; set; } /// Not mapped to database public virtual float Qfrom { get; set; } /// Water flow in [m3/h] public virtual float Qto { get; set; } /// Water flow in [m3/h] + public virtual string Selector { get; set; } public virtual string RegulValve { get; set; } public virtual string FlowMeter { get; set; } public virtual float PidCoef { get; set; } /// PID coefficient for the regulation path @@ -46,18 +47,19 @@ namespace Config.Entities { OutputPath result = new OutputPath(name, itemNr); - result.Name = Name; - result.Qfrom = Qfrom; - result.Qto = Qto; - result.RegulValve = RegulValve; - result.FlowMeter = FlowMeter; - result.PidCoef = PidCoef; - result.StartValve = StartValve; - result.Diverter = Diverter; - result.TempDiv = TempDiv; - result.Scale = Scale; + result.Name = Name; + result.Qfrom = Qfrom; + result.Qto = Qto; + result.Selector = Selector; + result.RegulValve = RegulValve; + result.FlowMeter = FlowMeter; + result.PidCoef = PidCoef; + result.StartValve = StartValve; + result.Diverter = Diverter; + result.TempDiv = TempDiv; + result.Scale = Scale; result.RegulValvesPct = RegulValvesPct; - result.ValvesOpen = ValvesOpen; + result.ValvesOpen = ValvesOpen; result.ValvesClose = ValvesClose; return result; diff --git a/TBF/BenchControl/BenchPath.cs b/TBF/BenchControl/BenchPath.cs index 04995df0b..79a9b244d 100644 --- a/TBF/BenchControl/BenchPath.cs +++ b/TBF/BenchControl/BenchPath.cs @@ -12,6 +12,7 @@ namespace TBF.BenchControl public string Name; public float Qfrom; public float Qto; + public string Selector; public ITempMeter TempMtrUp; public ITempMeter TempMtrDown; public IPressureMeter PressMtrUp; @@ -36,6 +37,7 @@ namespace TBF.BenchControl { Qfrom = entity.Qfrom; Qto = entity.Qto; + Selector = entity.Selector; TempMtrUp = TbfComponents.FindComponent(entity.TempMtrUp, components) as ITempMeter; TempMtrDown = TbfComponents.FindComponent(entity.TempMtrDown, components) as ITempMeter; PressMtrUp = TbfComponents.FindComponent(entity.PressMtrUp, components) as IPressureMeter; diff --git a/TBF/BenchControl/FeedingPath.cs b/TBF/BenchControl/FeedingPath.cs index c969f06b2..427ba89ab 100644 --- a/TBF/BenchControl/FeedingPath.cs +++ b/TBF/BenchControl/FeedingPath.cs @@ -12,7 +12,8 @@ namespace TBF.BenchControl public string Name; public float Qfrom; public float Qto; - public IValve Pump; /// pump to use with this path or null + public string Selector; + public IValve Pump; /// pump to use with this path or null public IList RegulValves; public IList RegulValvesPct; public IList ValvesOpen; /// a list of valves to open or null @@ -35,7 +36,8 @@ namespace TBF.BenchControl { Qfrom = entity.Qfrom; Qto = entity.Qto; - Pump = (IValve)TbfComponents.FindComponent(entity.Pump, components); + Selector = entity.Selector; + Pump = (IValve)TbfComponents.FindComponent(entity.Pump, components); /// /// Feeding regulation valve components diff --git a/TBF/BenchControl/OutputPath.cs b/TBF/BenchControl/OutputPath.cs index 8b928636f..d5afc7317 100644 --- a/TBF/BenchControl/OutputPath.cs +++ b/TBF/BenchControl/OutputPath.cs @@ -12,6 +12,7 @@ namespace TBF.BenchControl public string Name; public float Qfrom; public float Qto; + public string Selector; public IFlowMeter FlowMeter; public IRegulValve RegulValve; public float PidCoef; @@ -45,6 +46,7 @@ namespace TBF.BenchControl { Qfrom = entity.Qfrom; Qto = entity.Qto; + Selector = entity.Selector; FlowMeter = (IFlowMeter)TbfComponents.FindComponent(entity.FlowMeter, components); RegulValve = (IRegulValve)TbfComponents.FindComponent(entity.RegulValve, components); PidCoef = entity.PidCoef; diff --git a/TBF/UI/Bench/Paths/PathsBenchCtrl.cs b/TBF/UI/Bench/Paths/PathsBenchCtrl.cs index 4f716af37..3e5653040 100644 --- a/TBF/UI/Bench/Paths/PathsBenchCtrl.cs +++ b/TBF/UI/Bench/Paths/PathsBenchCtrl.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2017 Sensus Slovensko a.s. +/// Copyright (c) 2013-2021 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -28,6 +28,7 @@ namespace TBF.UI.Bench.Paths Name, Qfrom, Qto, + Selector, Tup, Tdown, Pup, @@ -67,8 +68,9 @@ namespace TBF.UI.Bench.Paths /// ListViewEx columns TBF.LocalSettings ls = Program.LocalSettings; Columns.Add(Strings.Name, (ls.BenchColumnCount > 0) ? ls.BenchColumnWidths[0] : 60 * parent.Dpi / Constants.Dpi100pct); - Columns.Add(string.Format("{0} [m3/h]", Strings.Q_from), (ls.BenchColumnCount > 1) ? ls.BenchColumnWidths[1] : 50 * parent.Dpi / Constants.Dpi100pct); - Columns.Add(string.Format("{0} [m3/h]", Strings.Q_to), (ls.BenchColumnCount > 2) ? ls.BenchColumnWidths[2] : 50 * parent.Dpi / Constants.Dpi100pct); + Columns.Add(string.Format("{0} [m3/h]", Strings.Q_from), (ls.BenchColumnCount > 1) ? ls.BenchColumnWidths[1] : 80 * parent.Dpi / Constants.Dpi100pct); + Columns.Add(string.Format("{0} [m3/h]", Strings.Q_to), (ls.BenchColumnCount > 2) ? ls.BenchColumnWidths[2] : 80 * parent.Dpi / Constants.Dpi100pct); + Columns.Add("Selector", (ls.BenchColumnCount > 0) ? ls.BenchColumnWidths[0] : 60 * parent.Dpi / Constants.Dpi100pct); Columns.Add(Strings.T_in, (ls.BenchColumnCount > 3) ? ls.BenchColumnWidths[3] : 50 * parent.Dpi / Constants.Dpi100pct); Columns.Add(Strings.T_out, (ls.BenchColumnCount > 4) ? ls.BenchColumnWidths[4] : 50 * parent.Dpi / Constants.Dpi100pct); Columns.Add(Strings.P_in, (ls.BenchColumnCount > 5) ? ls.BenchColumnWidths[5] : 50 * parent.Dpi / Constants.Dpi100pct); @@ -117,7 +119,8 @@ namespace TBF.UI.Bench.Paths editors[(int)Column.Name] = new TextBox(); /// Name editors[(int)Column.Qfrom] = new TextBox(); /// Q_from editors[(int)Column.Qto] = new TextBox(); /// Q_to - editors[(int)Column.Tup] = tUpCBox; + editors[(int)Column.Selector] = new TextBox(); /// Selector + editors[(int)Column.Tup] = tUpCBox; editors[(int)Column.Tdown] = tDownCBox; editors[(int)Column.Pup] = prUpCBox; editors[(int)Column.Pdown] = prDownCBox; @@ -198,7 +201,8 @@ namespace TBF.UI.Bench.Paths lvi.SubItems.Add(path.Qfrom.ToString()); lvi.SubItems.Add(path.Qto.ToString()); - lvi.SubItems.Add(path.TempMtrUp != null ? path.TempMtrUp.Cfg.Name : "---"); + lvi.SubItems.Add(path.Selector); + lvi.SubItems.Add(path.TempMtrUp != null ? path.TempMtrUp.Cfg.Name : "---"); lvi.SubItems.Add(path.TempMtrDown != null ? path.TempMtrDown.Cfg.Name : "---"); lvi.SubItems.Add(path.PressMtrUp != null ? path.PressMtrUp.Cfg.Name : "---"); lvi.SubItems.Add(path.PressMtrDown != null ? path.PressMtrDown.Cfg.Name : "---"); @@ -246,6 +250,7 @@ namespace TBF.UI.Bench.Paths allOk &= Utils.TryParseUFloat(lvi.SubItems[(int)Column.Qto].Text, out Qto); entity.Qto = Qto; + entity.Selector = lvi.SubItems[(int)Column.Selector].Text; entity.TempMtrUp = lvi.SubItems[(int)Column.Tup].Text; entity.TempMtrDown = lvi.SubItems[(int)Column.Tdown].Text; entity.PressMtrUp = lvi.SubItems[(int)Column.Pup].Text; diff --git a/TBF/UI/Bench/Paths/PathsFeedingCtrl.cs b/TBF/UI/Bench/Paths/PathsFeedingCtrl.cs index ac6fa4be4..e72f7475e 100644 --- a/TBF/UI/Bench/Paths/PathsFeedingCtrl.cs +++ b/TBF/UI/Bench/Paths/PathsFeedingCtrl.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2017 Sensus Slovensko a.s. +/// Copyright (c) 2013-2021 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -27,6 +27,7 @@ namespace TBF.UI.Bench.Paths Name, Qfrom, Qto, + Selector, Pump, FixedColumnsCount, } @@ -63,8 +64,9 @@ namespace TBF.UI.Bench.Paths /// ListViewEx columns TBF.LocalSettings ls = Program.LocalSettings; Columns.Add(Strings.Name, (ls.FeedingColumnCount > 0) ? ls.FeedingColumnWidths[0] : 60 * parent.Dpi / Constants.Dpi100pct); - Columns.Add(string.Format("{0} [m3/h]", Strings.Q_from), (ls.FeedingColumnCount > 1) ? ls.FeedingColumnWidths[1] : 50 * parent.Dpi / Constants.Dpi100pct); - Columns.Add(string.Format("{0} [m3/h]", Strings.Q_to), (ls.FeedingColumnCount > 2) ? ls.FeedingColumnWidths[2] : 50 * parent.Dpi / Constants.Dpi100pct); + Columns.Add(string.Format("{0} [m3/h]", Strings.Q_from), (ls.FeedingColumnCount > 1) ? ls.FeedingColumnWidths[1] : 80 * parent.Dpi / Constants.Dpi100pct); + Columns.Add(string.Format("{0} [m3/h]", Strings.Q_to), (ls.FeedingColumnCount > 2) ? ls.FeedingColumnWidths[2] : 80 * parent.Dpi / Constants.Dpi100pct); + Columns.Add("Selector", (ls.FeedingColumnCount > 0) ? ls.FeedingColumnWidths[0] : 60 * parent.Dpi / Constants.Dpi100pct); Columns.Add(Strings.Pump, (ls.FeedingColumnCount > 3) ? ls.FeedingColumnWidths[3] : 60 * parent.Dpi / Constants.Dpi100pct); int clmn = (int)Column.FixedColumnsCount; @@ -98,7 +100,8 @@ namespace TBF.UI.Bench.Paths editors[(int)Column.Name] = new TextBox(); /// Name editors[(int)Column.Qfrom] = new TextBox(); /// Q_from editors[(int)Column.Qto] = new TextBox(); /// Q_to - editors[(int)Column.Pump] = pumpCBox; + editors[(int)Column.Selector] = new TextBox(); /// Selector + editors[(int)Column.Pump] = pumpCBox; for (int i = 0; i < regvCount; i++) { ComboBox cb = new ComboBox(); @@ -186,6 +189,7 @@ namespace TBF.UI.Bench.Paths lvi.SubItems.Add(path.Qfrom.ToString()); lvi.SubItems.Add(path.Qto.ToString()); + lvi.SubItems.Add(path.Selector); lvi.SubItems.Add(path.Pump != null ? path.Pump.Cfg.Name : "---"); string[] rvPosStr = (entity.RegulValvesPct != null) ? entity.RegulValvesPct.Split(new char[] {';'}) @@ -236,7 +240,9 @@ namespace TBF.UI.Bench.Paths allOk &= Utils.TryParseUFloat(lvi.SubItems[(int)Column.Qto].Text, out Qto); entity.Qto = Qto; - ComboBox pumpCB = editors[(int)Column.Pump] as ComboBox; + entity.Selector = lvi.SubItems[(int)Column.Selector].Text; + + ComboBox pumpCB = editors[(int)Column.Pump] as ComboBox; if (pumpCB.Items.Contains(lvi.SubItems[(int)Column.Pump].Text)) { entity.Pump = lvi.SubItems[(int)Column.Pump].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)Column.Pump].Text; diff --git a/TBF/UI/Bench/Paths/PathsOutputCtrl.cs b/TBF/UI/Bench/Paths/PathsOutputCtrl.cs index 3e0089282..9cb02fce4 100644 --- a/TBF/UI/Bench/Paths/PathsOutputCtrl.cs +++ b/TBF/UI/Bench/Paths/PathsOutputCtrl.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2020 Sensus Slovensko a.s. +/// Copyright (c) 2013-2021 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -28,6 +28,7 @@ namespace TBF.UI.Bench.Paths Name, Qfrom, Qto, + Selector, RefFlowmtr, RegulValve, PidCoef, @@ -78,8 +79,9 @@ namespace TBF.UI.Bench.Paths /// ListViewEx columns TBF.LocalSettings ls = Program.LocalSettings; Columns.Add(Strings.Name, (ls.OutputColumnCount > 0) ? ls.OutputColumnWidths[0] : 60 * parent.Dpi / Constants.Dpi100pct); - Columns.Add(string.Format("{0} [m3/h]", Strings.Q_from), (ls.OutputColumnCount > 1) ? ls.OutputColumnWidths[1] : 50 * parent.Dpi / Constants.Dpi100pct); - Columns.Add(string.Format("{0} [m3/h]", Strings.Q_to), (ls.OutputColumnCount > 2) ? ls.OutputColumnWidths[2] : 50 * parent.Dpi / Constants.Dpi100pct); + Columns.Add(string.Format("{0} [m3/h]", Strings.Q_from), (ls.OutputColumnCount > 1) ? ls.OutputColumnWidths[1] : 80 * parent.Dpi / Constants.Dpi100pct); + Columns.Add(string.Format("{0} [m3/h]", Strings.Q_to), (ls.OutputColumnCount > 2) ? ls.OutputColumnWidths[2] : 80 * parent.Dpi / Constants.Dpi100pct); + Columns.Add("Selector", (ls.OutputColumnCount > 0) ? ls.OutputColumnWidths[0] : 60 * parent.Dpi / Constants.Dpi100pct); Columns.Add(Strings.Flowmeter, (ls.OutputColumnCount > 3) ? ls.OutputColumnWidths[3] : 85 * parent.Dpi / Constants.Dpi100pct); Columns.Add(Strings.Reg_valve, (ls.OutputColumnCount > 4) ? ls.OutputColumnWidths[4] : 80 * parent.Dpi / Constants.Dpi100pct); Columns.Add(Strings.PID, (ls.OutputColumnCount > 5) ? ls.OutputColumnWidths[5] : 50 * parent.Dpi / Constants.Dpi100pct); @@ -163,7 +165,8 @@ namespace TBF.UI.Bench.Paths editors[(int)Column.Name] = new TextBox(); /// Name editors[(int)Column.Qfrom] = new TextBox(); /// Q_from editors[(int)Column.Qto] = new TextBox(); /// Q_to - editors[(int)Column.RefFlowmtr] = flowMeterComboBox; + editors[(int)Column.Selector] = new TextBox(); /// Selector + editors[(int)Column.RefFlowmtr] = flowMeterComboBox; editors[(int)Column.RegulValve] = regulValveComboBox; editors[(int)Column.PidCoef] = new TextBox(); /// PID editors[(int)Column.Div] = diverterComboBox; @@ -268,6 +271,7 @@ namespace TBF.UI.Bench.Paths lvi.SubItems.Add(path.Qfrom.ToString()); lvi.SubItems.Add(path.Qto.ToString()); + lvi.SubItems.Add(path.Selector); lvi.SubItems.Add((path.FlowMeter != null) ? path.FlowMeter.Cfg.Name : "---"); lvi.SubItems.Add((path.RegulValve != null) ? path.RegulValve.Cfg.Name : "---"); lvi.SubItems.Add(path.PidCoef.ToString("F1")); @@ -343,6 +347,7 @@ namespace TBF.UI.Bench.Paths allOk &= Utils.TryParseUFloat(lvi.SubItems[(int)Column.Qto].Text, out Qto); entity.Qto = Qto; + entity.Selector = lvi.SubItems[(int)Column.Selector].Text; entity.FlowMeter = lvi.SubItems[(int)Column.RefFlowmtr].Text.Equals("---") ? null : lvi.SubItems[(int)Column.RefFlowmtr].Text; entity.RegulValve = lvi.SubItems[(int)Column.RegulValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.RegulValve].Text;