From 25856496d84613064b3fb097ca2712f5ceeb2465 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Wed, 24 Mar 2021 13:39:48 +0100 Subject: [PATCH] Various.CoverTest component created, few Elde components removed, ver. 3.1.1609 --- TBF/Properties/AssemblyInfo.cs | 4 +- TBF/Rig/ControlBoard/Uni/UniCB.cs | 29 +- TBF/Rig/ControlBoard/Uni/UniCBCfg.cs | 11 +- TBF/Rig/Elde/CoverTest/CoverTestCfg.cs | 59 ---- TBF/Rig/Elde/CoverTest/CoverTestCfgCtrl.cs | 133 -------- .../CoverTest/CoverTestCfgCtrl.designer.cs | 194 ------------ TBF/Rig/Elde/CoverTest/CoverTestCfgCtrl.resx | 120 -------- TBF/Rig/Elde/TempMeter/ReadTempOp.cs | 62 ---- TBF/Rig/Elde/TempMeter/TempMeter.cs | 122 -------- TBF/Rig/Elde/TempMeter/TempMeterCfg.cs | 95 ------ .../TempMeter/TempMeterCfgCtrl.Designer.cs | 285 ------------------ TBF/Rig/Elde/TempMeter/TempMeterCfgCtrl.cs | 214 ------------- TBF/Rig/Elde/TempMeter/TempMeterCfgCtrl.resx | 120 -------- TBF/Rig/Elde/TempMeter/TempMeterFactory.cs | 27 -- TBF/Rig/Elde/TempMeterInternal/ReadTempOp.cs | 61 ---- TBF/Rig/Elde/TempMeterInternal/TempMeter.cs | 107 ------- .../Elde/TempMeterInternal/TempMeterCfg.cs | 94 ------ .../TempMeterCfgCtrl.Designer.cs | 272 ----------------- .../TempMeterInternal/TempMeterCfgCtrl.cs | 160 ---------- .../TempMeterInternal/TempMeterCfgCtrl.resx | 120 -------- .../TempMeterInternal/TempMeterFactory.cs | 27 -- .../{Elde => Various}/CoverTest/CoverTest.cs | 25 +- TBF/Rig/Various/CoverTest/CoverTestCfg.cs | 232 ++++++++++++++ .../CoverTest/CoverTestForm.cs | 4 +- .../CoverTest/CoverTestForm.designer.cs | 4 +- .../CoverTest/CoverTestForm.resx | 0 .../{Elde => Various}/CoverTest/Factory.cs | 8 +- TBF/TBF.csproj | 59 +--- TBF/UI/Bench/Metrology/MetrologyDlg.cs | 6 +- .../Bench/Uncertainties/UncertaintiesDlg.cs | 8 +- Users/Entities/Enums.cs | 1 + 31 files changed, 303 insertions(+), 2360 deletions(-) delete mode 100644 TBF/Rig/Elde/CoverTest/CoverTestCfg.cs delete mode 100644 TBF/Rig/Elde/CoverTest/CoverTestCfgCtrl.cs delete mode 100644 TBF/Rig/Elde/CoverTest/CoverTestCfgCtrl.designer.cs delete mode 100644 TBF/Rig/Elde/CoverTest/CoverTestCfgCtrl.resx delete mode 100644 TBF/Rig/Elde/TempMeter/ReadTempOp.cs delete mode 100644 TBF/Rig/Elde/TempMeter/TempMeter.cs delete mode 100644 TBF/Rig/Elde/TempMeter/TempMeterCfg.cs delete mode 100644 TBF/Rig/Elde/TempMeter/TempMeterCfgCtrl.Designer.cs delete mode 100644 TBF/Rig/Elde/TempMeter/TempMeterCfgCtrl.cs delete mode 100644 TBF/Rig/Elde/TempMeter/TempMeterCfgCtrl.resx delete mode 100644 TBF/Rig/Elde/TempMeter/TempMeterFactory.cs delete mode 100644 TBF/Rig/Elde/TempMeterInternal/ReadTempOp.cs delete mode 100644 TBF/Rig/Elde/TempMeterInternal/TempMeter.cs delete mode 100644 TBF/Rig/Elde/TempMeterInternal/TempMeterCfg.cs delete mode 100644 TBF/Rig/Elde/TempMeterInternal/TempMeterCfgCtrl.Designer.cs delete mode 100644 TBF/Rig/Elde/TempMeterInternal/TempMeterCfgCtrl.cs delete mode 100644 TBF/Rig/Elde/TempMeterInternal/TempMeterCfgCtrl.resx delete mode 100644 TBF/Rig/Elde/TempMeterInternal/TempMeterFactory.cs rename TBF/Rig/{Elde => Various}/CoverTest/CoverTest.cs (77%) create mode 100644 TBF/Rig/Various/CoverTest/CoverTestCfg.cs rename TBF/Rig/{Elde => Various}/CoverTest/CoverTestForm.cs (97%) rename TBF/Rig/{Elde => Various}/CoverTest/CoverTestForm.designer.cs (97%) rename TBF/Rig/{Elde => Various}/CoverTest/CoverTestForm.resx (100%) rename TBF/Rig/{Elde => Various}/CoverTest/Factory.cs (79%) diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index c82124633..79d69d114 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("3.1.1608.0")] -[assembly: AssemblyFileVersion("3.1.1608.0")] +[assembly: AssemblyVersion("3.1.1609.0")] +[assembly: AssemblyFileVersion("3.1.1609.0")] diff --git a/TBF/Rig/ControlBoard/Uni/UniCB.cs b/TBF/Rig/ControlBoard/Uni/UniCB.cs index 770d0bddc..4e8cc3ec7 100644 --- a/TBF/Rig/ControlBoard/Uni/UniCB.cs +++ b/TBF/Rig/ControlBoard/Uni/UniCB.cs @@ -134,6 +134,9 @@ namespace TBF.Rig.ControlBoard.Uni /// Queue actionQueue; + bool isEmergencyStop; + + /// UI actions are blocked when true public bool IsUIBlocked { get; set; } @@ -350,17 +353,31 @@ namespace TBF.Rig.ControlBoard.Uni route = (route & ~bitsChangedByUI) | (displayedRoutePlusUI & bitsChangedByUI); bitsChangedByUI = 0; } + if ((StateMachine.Time - lastReceivedTime) >= 5) { /// No connection to control board ... set indicator bit - route += ((UInt128)1) << cbCfg.BitNr; - } - if ((State & (ulong)StatusP.EmgcyStopActive) != 0) - { - /// No connection to control board ... set indicator bit - route += ((UInt128)1) << (cbCfg.BitNr + 1); + route |= ((UInt128)1) << cbCfg.BitNr; } } + + /// + /// Handle emergency stop signal + /// + bool newEmergencyStop = ((State & (ulong)StatusP.EmgcyStopActive) != 0); + if (newEmergencyStop) + { + /// Emergency stop ... set indicator bit + route |= ((UInt128)1) << (cbCfg.BitNr + 1); + + if (!isEmergencyStop) + { + /// Stop the cycle ... the same as pressing 'STOP' button in the BenchControlPanel + TBF.UiBridge.Bridge.Ui2Bench(TBF.UiBridge.UI2BenchCmd.Stop); + } + } + isEmergencyStop = newEmergencyStop; + log.DebugFormat("Route synced with RRoute and UI changes, new route = {0}", Utils.RouteToStr(route)); } diff --git a/TBF/Rig/ControlBoard/Uni/UniCBCfg.cs b/TBF/Rig/ControlBoard/Uni/UniCBCfg.cs index f526c766c..aa3493ae9 100644 --- a/TBF/Rig/ControlBoard/Uni/UniCBCfg.cs +++ b/TBF/Rig/ControlBoard/Uni/UniCBCfg.cs @@ -128,12 +128,6 @@ namespace TBF.Rig.ControlBoard.Uni public string ToString(int i) { - if (i == -1) - { - return string.Format("{0}: COM{1} DIVs={2} VBs={3} RVs={4} RelaysF={5} RelaysG={6} RelaysH={7}", - Name, ComPortNr, DivertersCount, DrainValvesCount, RegValvesCount, RelaysFInstalled, RelaysGInstalled, RelaysHInstalled); - } - switch (i) { case 0: return ComPortNr.ToString(); @@ -144,7 +138,10 @@ namespace TBF.Rig.ControlBoard.Uni case 5: return RelaysGInstalled ? Strings.yes : Strings.no; case 6: return RelaysHInstalled ? Strings.yes : Strings.no; case 7: return ShowState ? Strings.yes : Strings.no; - default: return string.Empty; + default: + return string.Format("{0}: COM{1} DIVs={2} VBs={3} RVs={4} RelaysF={5} RelaysG={6} RelaysH={7}", + Name, ComPortNr, DivertersCount, DrainValvesCount, RegValvesCount, + RelaysFInstalled, RelaysGInstalled, RelaysHInstalled); } } diff --git a/TBF/Rig/Elde/CoverTest/CoverTestCfg.cs b/TBF/Rig/Elde/CoverTest/CoverTestCfg.cs deleted file mode 100644 index cc8833acf..000000000 --- a/TBF/Rig/Elde/CoverTest/CoverTestCfg.cs +++ /dev/null @@ -1,59 +0,0 @@ -/// -/// Copyright (c) 2017 Sensus Metering Systems -/// -using System.IO; -using System.Collections.Generic; -using System.Xml.Serialization; -using Config.Entities; -using TBF.Rig.Generic; -using TBF.Resources; - -namespace TBF.Rig.Elde.CoverTest -{ - public class CoverTestCfg : ComponentCfgBase, IChildComponentCfg - { - public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CoverTestCfg) })[0]; - public override XmlSerializer GetSerializer() { return Serializer; } - - public IComponentCfgCtrl GetControl(IList cmpntEntities) { return new CoverTestCfgCtrl(); } - - /// - /// Serialized parameters - /// - public int BitPosition; - public bool Invert; - public string Message; - public Users.Entities.GID[] BypassLevel; - - /// Private parameterless constructor invoked by all other (public) constructors - CoverTestCfg() - { - Name = "CoverTest"; - ParentName = "CB"; - - /// Default values for closed cover test - BitPosition = 22; - Invert = false; - Message = Strings.Close_the_cover; - - BypassLevel = new Users.Entities.GID[] { Users.Entities.GID.TestingSpecialists }; - } - - public CoverTestCfg(IComponentFactory factory) - : this() - { - this.Factory = factory; - } - - public string ToString(int i) - { - return string.Format("{0} ({1}) Bit={2}, Inv={3}, Message={4}, BypassLelvel={5}", - Name, - (string.IsNullOrEmpty(ParentName) ? "-" : ParentName), - BitPosition, - Invert ? "yes" : "no", - Message, - BypassLevel); - } - } -} diff --git a/TBF/Rig/Elde/CoverTest/CoverTestCfgCtrl.cs b/TBF/Rig/Elde/CoverTest/CoverTestCfgCtrl.cs deleted file mode 100644 index 8405dc755..000000000 --- a/TBF/Rig/Elde/CoverTest/CoverTestCfgCtrl.cs +++ /dev/null @@ -1,133 +0,0 @@ -/// -/// Copyright (c) 2017 Sensus Metering Systems -/// -using System; -using System.Windows.Forms; -using Config.Entities; -using TBF.Rig.Generic; -using TBF.UI.Bench.Components; - -namespace TBF.Rig.Elde.CoverTest -{ - public partial class CoverTestCfgCtrl : UserControl, IComponentCfgCtrl - { - ComponentParametersDlg parent; - - public bool ShowMore { get { return false; } } - - CoverTestCfg config; - public IComponentCfg Config - { - get { return config as IComponentCfg; } - set - { - config = value as CoverTestCfg; - Redraw(); - } - } - - public CoverTestCfgCtrl() - { - InitializeComponent(); - } - - private void PumpCfgCtrl_Load(object sender, EventArgs e) - { - parent = ParentForm as ComponentParametersDlg; - if (parent == null) return; - - if (parent.CmpntEntities != null) - { - foreach (var cmpnt in parent.CmpntEntities) - { - if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.Factory) - { - parentNameComboBox.Items.Add(cmpnt.Name); - } - } - } - - for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++) - { - bypassLevelComboBox.Items.Add(gid.ToString()); - } - - Redraw(); - } - - public void Closing() - { - } - - void Redraw() - { - if (config == null) return; /// Control was not loaded, settings were not changed - - classNameLabel.Text = config.Factory.ClassName; - nameTextBox.Text = config.Name; - parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName; - bitPositionTextBox.Text = config.BitPosition.ToString(); - invertCheckBox.Checked = config.Invert; - messageTextBox.Text = config.Message; - bypassLevelComboBox.Text = config.BypassLevel == null ? "---" : ((config.BypassLevel.Length > 0) ? config.BypassLevel[0].ToString() : "---"); - } - - public void Unlock() - { - nameTextBox.Enabled = true; - parentNameComboBox.Enabled = true; - bitPositionTextBox.Enabled = true; - invertCheckBox.Enabled = true; - messageTextBox.Enabled = true; - bypassLevelComboBox.Enabled = true; - } - - public CfgUpdateFlags UpdateCfg() - { - CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd; - - 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.BitPosition = int.Parse(bitPositionTextBox.Text); - config.Invert = invertCheckBox.Checked; - config.Message = messageTextBox.Text; - - config.BypassLevel = null; - for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++) - { - if (bypassLevelComboBox.Text == gid.ToString()) - { - config.BypassLevel = new Users.Entities.GID[] { gid }; - break; - } - } - - return flags; - } - - public CfgUpdateFlags VerifyCfg(ref string message) - { - CfgUpdateFlags flags = CfgUpdateFlags.None; - - int dummy; - if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "Invalid 'Parent name'"; - } - if (!int.TryParse(bitPositionTextBox.Text, out dummy) || dummy < 0 || dummy >= 64) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'Bit position' should be between 0 and 63"; - } - if (!bypassLevelComboBox.Items.Contains(bypassLevelComboBox.Text)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "Invalid 'Bypass level'"; - } - return flags; - } - } -} diff --git a/TBF/Rig/Elde/CoverTest/CoverTestCfgCtrl.designer.cs b/TBF/Rig/Elde/CoverTest/CoverTestCfgCtrl.designer.cs deleted file mode 100644 index f47d868a7..000000000 --- a/TBF/Rig/Elde/CoverTest/CoverTestCfgCtrl.designer.cs +++ /dev/null @@ -1,194 +0,0 @@ -/// -/// Copyright (c) 2017 Sensus Metering Systems -/// -namespace TBF.Rig.Elde.CoverTest -{ - partial class CoverTestCfgCtrl - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.bitPositionTextBox = new System.Windows.Forms.TextBox(); - this.bitPositionLabel = 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.parentNameComboBox = new System.Windows.Forms.ComboBox(); - this.delayLabel = new System.Windows.Forms.Label(); - this.messageTextBox = new System.Windows.Forms.TextBox(); - this.bypassLevelComboBox = new System.Windows.Forms.ComboBox(); - this.bypassLevelLabel = new System.Windows.Forms.Label(); - this.invertCheckBox = new System.Windows.Forms.CheckBox(); - this.SuspendLayout(); - // - // bitPositionTextBox - // - this.bitPositionTextBox.Enabled = false; - this.bitPositionTextBox.Location = new System.Drawing.Point(122, 99); - this.bitPositionTextBox.Name = "bitPositionTextBox"; - this.bitPositionTextBox.Size = new System.Drawing.Size(46, 20); - this.bitPositionTextBox.TabIndex = 6; - // - // bitPositionLabel - // - this.bitPositionLabel.AutoSize = true; - this.bitPositionLabel.Location = new System.Drawing.Point(36, 102); - this.bitPositionLabel.Name = "bitPositionLabel"; - this.bitPositionLabel.Size = new System.Drawing.Size(58, 13); - this.bitPositionLabel.TabIndex = 5; - this.bitPositionLabel.Text = "Bit position"; - // - // parentNameLabel - // - this.parentNameLabel.AutoSize = true; - this.parentNameLabel.Location = new System.Drawing.Point(36, 76); - this.parentNameLabel.Name = "parentNameLabel"; - this.parentNameLabel.Size = new System.Drawing.Size(67, 13); - this.parentNameLabel.TabIndex = 3; - this.parentNameLabel.Text = "Parent name"; - // - // nameTextBox - // - this.nameTextBox.Enabled = false; - this.nameTextBox.Location = new System.Drawing.Point(122, 47); - 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(36, 50); - 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(119, 21); - this.classNameLabel.Name = "classNameLabel"; - this.classNameLabel.Size = new System.Drawing.Size(83, 13); - this.classNameLabel.TabIndex = 0; - this.classNameLabel.Text = "ComonentName"; - // - // parentNameComboBox - // - this.parentNameComboBox.Enabled = false; - this.parentNameComboBox.FormattingEnabled = true; - this.parentNameComboBox.Location = new System.Drawing.Point(122, 73); - this.parentNameComboBox.Name = "parentNameComboBox"; - this.parentNameComboBox.Size = new System.Drawing.Size(130, 21); - this.parentNameComboBox.TabIndex = 4; - // - // delayLabel - // - this.delayLabel.AutoSize = true; - this.delayLabel.Location = new System.Drawing.Point(36, 127); - this.delayLabel.Name = "delayLabel"; - this.delayLabel.Size = new System.Drawing.Size(50, 13); - this.delayLabel.TabIndex = 8; - this.delayLabel.Text = "Message"; - // - // messageTextBox - // - this.messageTextBox.Enabled = false; - this.messageTextBox.Location = new System.Drawing.Point(122, 124); - this.messageTextBox.Name = "messageTextBox"; - this.messageTextBox.Size = new System.Drawing.Size(130, 20); - this.messageTextBox.TabIndex = 9; - // - // bypassLevelComboBox - // - this.bypassLevelComboBox.Enabled = false; - this.bypassLevelComboBox.FormattingEnabled = true; - this.bypassLevelComboBox.Location = new System.Drawing.Point(122, 150); - this.bypassLevelComboBox.Name = "bypassLevelComboBox"; - this.bypassLevelComboBox.Size = new System.Drawing.Size(130, 21); - this.bypassLevelComboBox.TabIndex = 11; - // - // bypassLevelLabel - // - this.bypassLevelLabel.AutoSize = true; - this.bypassLevelLabel.Location = new System.Drawing.Point(36, 153); - this.bypassLevelLabel.Name = "bypassLevelLabel"; - this.bypassLevelLabel.Size = new System.Drawing.Size(66, 13); - this.bypassLevelLabel.TabIndex = 10; - this.bypassLevelLabel.Text = "Bypass level"; - // - // invertCheckBox - // - this.invertCheckBox.AutoSize = true; - this.invertCheckBox.Enabled = false; - this.invertCheckBox.Location = new System.Drawing.Point(190, 101); - this.invertCheckBox.Name = "invertCheckBox"; - this.invertCheckBox.Size = new System.Drawing.Size(67, 17); - this.invertCheckBox.TabIndex = 7; - this.invertCheckBox.Text = "Invert bit"; - this.invertCheckBox.UseVisualStyleBackColor = true; - // - // CoverTestCfgCtrl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.invertCheckBox); - this.Controls.Add(this.bypassLevelComboBox); - this.Controls.Add(this.bypassLevelLabel); - this.Controls.Add(this.messageTextBox); - this.Controls.Add(this.delayLabel); - this.Controls.Add(this.parentNameComboBox); - this.Controls.Add(this.bitPositionTextBox); - this.Controls.Add(this.bitPositionLabel); - this.Controls.Add(this.parentNameLabel); - this.Controls.Add(this.nameTextBox); - this.Controls.Add(this.nameLabel); - this.Controls.Add(this.classNameLabel); - this.Name = "CoverTestCfgCtrl"; - this.Size = new System.Drawing.Size(300, 200); - this.Load += new System.EventHandler(this.PumpCfgCtrl_Load); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TextBox bitPositionTextBox; - private System.Windows.Forms.Label bitPositionLabel; - private System.Windows.Forms.Label parentNameLabel; - private System.Windows.Forms.TextBox nameTextBox; - private System.Windows.Forms.Label nameLabel; - private System.Windows.Forms.Label classNameLabel; - private System.Windows.Forms.ComboBox parentNameComboBox; - private System.Windows.Forms.Label delayLabel; - private System.Windows.Forms.TextBox messageTextBox; - private System.Windows.Forms.ComboBox bypassLevelComboBox; - private System.Windows.Forms.Label bypassLevelLabel; - private System.Windows.Forms.CheckBox invertCheckBox; - } -} diff --git a/TBF/Rig/Elde/CoverTest/CoverTestCfgCtrl.resx b/TBF/Rig/Elde/CoverTest/CoverTestCfgCtrl.resx deleted file mode 100644 index 1af7de150..000000000 --- a/TBF/Rig/Elde/CoverTest/CoverTestCfgCtrl.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/TBF/Rig/Elde/TempMeter/ReadTempOp.cs b/TBF/Rig/Elde/TempMeter/ReadTempOp.cs deleted file mode 100644 index 9d13d9379..000000000 --- a/TBF/Rig/Elde/TempMeter/ReadTempOp.cs +++ /dev/null @@ -1,62 +0,0 @@ -/// -/// Copyright (c) 2013-2016 Sensus Metering Systems -/// -using System; -using log4net; -using TBF.Boxes; - -namespace TBF.Rig.Elde.TempMeter -{ - public class ReadTempOp : IOperation - { - private static readonly ILog log = LogManager.GetLogger(typeof(ReadTempOp)); - public override string ToString() { return string.Format("ReadTempOp({0},.,{1})", tempMeter.Name, eventDone); } - - /// Set by the constructor - readonly TempMeter tempMeter; - readonly DoubleBox temp; /// Box for the measured value - readonly Event eventDone; - - /// - /// Events: TempDone or Error - /// - /// TempMeter reference - /// Reference to the variable, value is in degree Celsius - /// Event to be returned by Run() when completed OK - public ReadTempOp(TempMeter tempMeter, ref DoubleBox temp, Event eventDone) - { - if (tempMeter == null) throw new ArgumentNullException("tempMeter"); - this.tempMeter = tempMeter; - this.temp = temp; - this.eventDone = eventDone; - - log.Debug(this.ToString()); - } - - public ReadTempOp(TempMeter tempMeter, ref DoubleBox temp) - : this(tempMeter, ref temp, Event.TempDone) - { - } - - /// Start this operation - public void Start() - { - if (temp != null) temp.Val = tempMeter.ReadTemperature(); - } - - /// Run this operation - /// - /// Event.TempInDone, Event.TempOutDone or Event.TempDivDone - /// - public Event Run() - { - if (temp != null) temp.Val = tempMeter.ReadTemperature(); - return eventDone; - } - - /// Stop this operation - public void Stop() - { - } - } -} diff --git a/TBF/Rig/Elde/TempMeter/TempMeter.cs b/TBF/Rig/Elde/TempMeter/TempMeter.cs deleted file mode 100644 index df6685b60..000000000 --- a/TBF/Rig/Elde/TempMeter/TempMeter.cs +++ /dev/null @@ -1,122 +0,0 @@ -/// -/// Copyright (c) 2013-2020 Sensus Slovensko a.s. -/// -using System; -using System.Collections.Generic; -using log4net; -using TBF.Rig.ControlBoard.Legacy; -using TBF.Rig.Generic; -using TBF.Boxes; -using TBF.Resources; - -namespace TBF.Rig.Elde.TempMeter -{ - public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItCmpnt - { - private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter)); - public override string ToString() { return string.Format("TempMeter({0})", Cfg.ToString(-1)); } - - readonly TempMeterCfg tempMtrCfg; - public SchematicDrawing.IDrawingItem DrawingItem { get { return tempMtrCfg as SchematicDrawing.IDrawingItem; } } - - public readonly CBoard ControlBoard; - - public int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..15 - public double A1 { get { return tempMtrCfg.A1; } } - public double A2 { get { return tempMtrCfg.A2; } } - public double A3 { get { return tempMtrCfg.A3; } } - public double A4 { get { return tempMtrCfg.A4; } } - public double A5 { get { return tempMtrCfg.A5; } } - - public TempMeter() - { - } - - public TempMeter(Generic.IComponentCfg cfg, IList components) - : base(cfg) - { - tempMtrCfg = cfg as TempMeterCfg; - - ControlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components); - if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent"); - - /// Prepare data for SendCalibData() control board component method - ControlBoard.TempCalibData[Idx0, 0] = (float)A1; - ControlBoard.TempCalibData[Idx0, 1] = (float)A2; - ControlBoard.TempCalibData[Idx0, 2] = (float)A3; - ControlBoard.TempCalibData[Idx0, 3] = (float)A4; - ControlBoard.TempCalibData[Idx0, 4] = (float)A5; - - log.Warn(this.ToString()); - } - - - public IList GetCalendarEvents() - { - DateTime calibrationDue = tempMtrCfg.CalibValidDate; - IList calendarEvents = new List(); - - if (calibrationDue > TBF.UI.Constants.MinDate) - { - /// Calibration due date calendar event - calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, - string.Format(Strings.Calibration_due_date_is_0, - calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)))); - if (DateTime.Now.Date <= calibrationDue.AddDays(-7)) - { - /// Weekly reminders (last 5 weeks) - calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, - string.Format(Strings.Calibration_due_date_is_0, - calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), - false)); - } - if (DateTime.Now.Date <= calibrationDue.Date) - { - /// Daily reminders (last 5 days) - calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, - string.Format(Strings.Calibration_due_date_is_0, - calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), - true)); - } - } - return calendarEvents; - } - - public double ReadTemperature() - { - if (Cfg.DebugLevel == Config.Entities.DebugMode.Normal) - { - return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections); - } - else if (Cfg.DebugLevel == Config.Entities.DebugMode.Simulate) - { - return tempMtrCfg.DefaultTemperature; - } - else - { - return 0; - } - } - - /// - /// Events: TempDone, Error - /// - /// Reference to a variable for the temperature in Celsius - /// ReadTempOp instance reference casted to IOperaton - public IOperation ReadTempOp(ref DoubleBox temp) - { - return new ReadTempOp(this, ref temp); - } - - /// - /// Events: tempDone, Error - /// - /// Reference to a variable for the temperature in Celsius - /// Event returned when measurement done - /// ReadTempOp instance reference casted to IOperaton - public IOperation ReadTempOp(ref DoubleBox temp, Event tempDone) - { - return new ReadTempOp(this, ref temp, tempDone); - } - } -} diff --git a/TBF/Rig/Elde/TempMeter/TempMeterCfg.cs b/TBF/Rig/Elde/TempMeter/TempMeterCfg.cs deleted file mode 100644 index 532272105..000000000 --- a/TBF/Rig/Elde/TempMeter/TempMeterCfg.cs +++ /dev/null @@ -1,95 +0,0 @@ -/// -/// Copyright (c) 2013-2020 Sensus Slovensko a.s. -/// -using System; -using System.Collections.Generic; -using System.IO; -using System.Xml.Serialization; -using Config.Entities; -using SchematicDrawing; -using TBF.Rig.Generic; - -namespace TBF.Rig.Elde.TempMeter -{ - public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.Rig.GenericDevices.ICalibInfoCfg, IDrawingItemWithMeasuredVal - { - public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0]; - public override XmlSerializer GetSerializer() { return Serializer; } - - public IComponentCfgCtrl GetControl(IList cmpntEntities) { return new TempMeterCfgCtrl(); } - - /// - /// Serialized parameters - /// - public int Idx0; /// 0 .. 15 - public double A1; - public double A2; - public double A3; - public double A4; - public double A5; - public double DefaultTemperature; - - /// Calibration info serialized parameters displayed in Metrology tab page - public string CalibCertificateNr { get; set; } - public DateTime CalibDate { get; set; } - public DateTime CalibValidDate { get; set; } - - /// Schematic drawing info - public SchematicDrawing.Shape Shape { get; set; } - public int X { get; set; } - public int Y { get; set; } - public Sz Sz { get; set; } - public Orient Orient { get; set; } - public bool Flip { get; set; } - public int LblX { get; set; } - public int LblY { get; set; } - public Orient LblOrient { get; set; } - public int MsrdX { get; set; } - public int MsrdY { get; set; } - public Orient MsrdOrient { get; set; } - public Config.Unit MsrdUnit { get; set; } - public string MsrdFormat { get; set; } - public double MsrdValLimLo { get; set; } - public double MsrdValLimHi { get; set; } - - [XmlIgnore] - public IList GNodes { get; set; } - - /// Private parameterless constructor invoked by all other (public) constructors - TempMeterCfg() - { - GNodes = new List(); - } - - public TempMeterCfg(IComponentFactory factory) - : this() - { - Shape = Shape.TempM; - Sz = Sz.M; - MsrdUnit = Config.Unit.C; - MsrdFormat = "{0:F1} °C"; - - Factory = factory; - Name = "T"; - ParentName = "CB"; - Idx0 = 0; - A1 = 0; - A2 = 0; - A3 = 0; - A4 = 0; - A5 = 0; - DefaultTemperature = 20.0; - } - - - - public string ToString(int i) - { - return string.Format("Name={0}, Parent={1}, Idx0={2}, A1={3}, A2={4}, A3={5}, A4={6}, A5={7}, Default={8}", - Name, - (string.IsNullOrEmpty(ParentName) ? "-" : ParentName), - Idx0, - A1, A2, A3, A4, A5, DefaultTemperature); - } - } -} diff --git a/TBF/Rig/Elde/TempMeter/TempMeterCfgCtrl.Designer.cs b/TBF/Rig/Elde/TempMeter/TempMeterCfgCtrl.Designer.cs deleted file mode 100644 index f28afd101..000000000 --- a/TBF/Rig/Elde/TempMeter/TempMeterCfgCtrl.Designer.cs +++ /dev/null @@ -1,285 +0,0 @@ -/// -/// Copyright (c) 2013-2015 Sensus Metering Systems -/// -namespace TBF.Rig.Elde.TempMeter -{ - partial class TempMeterCfgCtrl - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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.a1TextBox = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.a2TextBox = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.a3TextBox = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.a5TextBox = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - this.a4TextBox = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.parentNameComboBox = new System.Windows.Forms.ComboBox(); - this.defaultTempTextBox = new System.Windows.Forms.TextBox(); - this.label6 = new System.Windows.Forms.Label(); - this.importButton = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // positionTextBox - // - this.positionTextBox.Enabled = false; - this.positionTextBox.Location = new System.Drawing.Point(130, 83); - 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(20, 86); - 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(20, 61); - 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(130, 34); - this.nameTextBox.Name = "nameTextBox"; - this.nameTextBox.Size = new System.Drawing.Size(160, 20); - this.nameTextBox.TabIndex = 2; - // - // nameLabel - // - this.nameLabel.AutoSize = true; - this.nameLabel.Location = new System.Drawing.Point(20, 37); - 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(127, 10); - this.classNameLabel.Name = "classNameLabel"; - this.classNameLabel.Size = new System.Drawing.Size(83, 13); - this.classNameLabel.TabIndex = 0; - this.classNameLabel.Text = "ComonentName"; - // - // a1TextBox - // - this.a1TextBox.Enabled = false; - this.a1TextBox.Location = new System.Drawing.Point(130, 107); - this.a1TextBox.Name = "a1TextBox"; - this.a1TextBox.Size = new System.Drawing.Size(160, 20); - this.a1TextBox.TabIndex = 9; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(20, 110); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(20, 13); - this.label1.TabIndex = 8; - this.label1.Text = "A1"; - // - // a2TextBox - // - this.a2TextBox.Enabled = false; - this.a2TextBox.Location = new System.Drawing.Point(130, 128); - this.a2TextBox.Name = "a2TextBox"; - this.a2TextBox.Size = new System.Drawing.Size(160, 20); - this.a2TextBox.TabIndex = 11; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(20, 131); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(20, 13); - this.label2.TabIndex = 10; - this.label2.Text = "A2"; - // - // a3TextBox - // - this.a3TextBox.Enabled = false; - this.a3TextBox.Location = new System.Drawing.Point(130, 149); - this.a3TextBox.Name = "a3TextBox"; - this.a3TextBox.Size = new System.Drawing.Size(160, 20); - this.a3TextBox.TabIndex = 13; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(20, 152); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(20, 13); - this.label3.TabIndex = 12; - this.label3.Text = "A3"; - // - // a5TextBox - // - this.a5TextBox.Enabled = false; - this.a5TextBox.Location = new System.Drawing.Point(130, 191); - this.a5TextBox.Name = "a5TextBox"; - this.a5TextBox.Size = new System.Drawing.Size(160, 20); - this.a5TextBox.TabIndex = 17; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(20, 194); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(20, 13); - this.label5.TabIndex = 16; - this.label5.Text = "A5"; - // - // a4TextBox - // - this.a4TextBox.Enabled = false; - this.a4TextBox.Location = new System.Drawing.Point(130, 170); - this.a4TextBox.Name = "a4TextBox"; - this.a4TextBox.Size = new System.Drawing.Size(160, 20); - this.a4TextBox.TabIndex = 15; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(20, 173); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(20, 13); - this.label4.TabIndex = 14; - this.label4.Text = "A4"; - // - // parentNameComboBox - // - this.parentNameComboBox.Enabled = false; - this.parentNameComboBox.FormattingEnabled = true; - this.parentNameComboBox.Location = new System.Drawing.Point(130, 58); - this.parentNameComboBox.Name = "parentNameComboBox"; - this.parentNameComboBox.Size = new System.Drawing.Size(160, 21); - this.parentNameComboBox.TabIndex = 4; - // - // defaultTempTextBox - // - this.defaultTempTextBox.Enabled = false; - this.defaultTempTextBox.Location = new System.Drawing.Point(130, 217); - this.defaultTempTextBox.Name = "defaultTempTextBox"; - this.defaultTempTextBox.Size = new System.Drawing.Size(46, 20); - this.defaultTempTextBox.TabIndex = 19; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(20, 220); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(100, 13); - this.label6.TabIndex = 18; - this.label6.Text = "Default temperature"; - // - // importButton - // - this.importButton.Enabled = false; - this.importButton.Location = new System.Drawing.Point(182, 81); - this.importButton.Name = "importButton"; - this.importButton.Size = new System.Drawing.Size(108, 23); - this.importButton.TabIndex = 7; - this.importButton.Text = "Import A1 ... A5"; - this.importButton.UseVisualStyleBackColor = true; - this.importButton.Click += new System.EventHandler(this.importButton_Click); - // - // TempMeterCfgCtrl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.importButton); - this.Controls.Add(this.label6); - this.Controls.Add(this.defaultTempTextBox); - this.Controls.Add(this.parentNameComboBox); - this.Controls.Add(this.a5TextBox); - this.Controls.Add(this.label5); - this.Controls.Add(this.a4TextBox); - this.Controls.Add(this.label4); - this.Controls.Add(this.a3TextBox); - this.Controls.Add(this.label3); - this.Controls.Add(this.a2TextBox); - this.Controls.Add(this.label2); - this.Controls.Add(this.a1TextBox); - this.Controls.Add(this.label1); - 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 = "TempMeterCfgCtrl"; - this.Size = new System.Drawing.Size(350, 240); - this.Load += new System.EventHandler(this.TempMeterCfgCtrl_Load); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TextBox positionTextBox; - private System.Windows.Forms.Label positionLabel; - private System.Windows.Forms.Label parentNameLabel; - private System.Windows.Forms.TextBox nameTextBox; - private System.Windows.Forms.Label nameLabel; - private System.Windows.Forms.Label classNameLabel; - private System.Windows.Forms.TextBox a1TextBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox a2TextBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox a3TextBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox a5TextBox; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.TextBox a4TextBox; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.ComboBox parentNameComboBox; - private System.Windows.Forms.TextBox defaultTempTextBox; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Button importButton; - } -} diff --git a/TBF/Rig/Elde/TempMeter/TempMeterCfgCtrl.cs b/TBF/Rig/Elde/TempMeter/TempMeterCfgCtrl.cs deleted file mode 100644 index cb91fd6f9..000000000 --- a/TBF/Rig/Elde/TempMeter/TempMeterCfgCtrl.cs +++ /dev/null @@ -1,214 +0,0 @@ -/// -/// Copyright (c) 2013-2019 Sensus Slovensko a.s. -/// -using System; -using System.IO; -using System.Windows.Forms; -using Config.Entities; -using TBF.Rig.Generic; -using TBF.UI.Bench.Components; - -namespace TBF.Rig.Elde.TempMeter -{ - public partial class TempMeterCfgCtrl : UserControl, IComponentCfgCtrl - { - static string lastImportFileName; - - ComponentParametersDlg parent; - - public bool ShowMore { get { return false; } } - - TempMeterCfg config; - public IComponentCfg Config - { - get { return config as IComponentCfg; } - set - { - config = value as TempMeterCfg; - Redraw(); - } - } - - public TempMeterCfgCtrl() - { - InitializeComponent(); - } - - private void TempMeterCfgCtrl_Load(object sender, EventArgs e) - { - parent = ParentForm as ComponentParametersDlg; - if (parent == null) return; - - if (parent.CmpntEntities != null) - { - foreach (var cmpnt in parent.CmpntEntities) - { - if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.Factory) - { - parentNameComboBox.Items.Add(cmpnt.Name); - } - } - } - - Redraw(); - } - - public void Closing() - { - } - - void Redraw() - { - if (config == null) return; /// Control was not loaded, settings were not changed - - classNameLabel.Text = config.Factory.ClassName; - nameTextBox.Text = config.Name; - parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName; - positionTextBox.Text = config.Idx0.ToString(); - a1TextBox.Text = config.A1.ToString(); - a2TextBox.Text = config.A2.ToString(); - a3TextBox.Text = config.A3.ToString(); - a4TextBox.Text = config.A4.ToString(); - a5TextBox.Text = config.A5.ToString(); - defaultTempTextBox.Text = config.DefaultTemperature.ToString(); - } - - public void Unlock() - { - nameTextBox.Enabled = true; - parentNameComboBox.Enabled = true; - positionTextBox.Enabled = true; - importButton.Enabled = true; - a1TextBox.Enabled = true; - a2TextBox.Enabled = true; - a3TextBox.Enabled = true; - a4TextBox.Enabled = true; - a5TextBox.Enabled = true; - defaultTempTextBox.Enabled = true; - } - - public CfgUpdateFlags VerifyCfg(ref string message) - { - CfgUpdateFlags flags = CfgUpdateFlags.None; - - int dummy; - if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "Invalid 'Parent Name'"; - } - if (!int.TryParse(positionTextBox.Text, out dummy) || dummy < 0 || dummy > 15) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'Position' should be between 0 and 15"; - } - - double fdummy; - if (!Utils.TryParseEDouble(a1TextBox.Text, out fdummy)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'A1' is not valid"; - } - - if (!Utils.TryParseEDouble(a2TextBox.Text, out fdummy)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'A2' is not valid"; - } - - if (!Utils.TryParseEDouble(a3TextBox.Text, out fdummy)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'A3' is not valid"; - } - - if (!Utils.TryParseEDouble(a4TextBox.Text, out fdummy)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'A4' is not valid"; - } - - if (!Utils.TryParseEDouble(a5TextBox.Text, out fdummy)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'A5' is not valid"; - } - - if (!Utils.TryParseEDouble(defaultTempTextBox.Text, out fdummy)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'Default temperature' is not valid"; - } - - return flags; - } - - public CfgUpdateFlags UpdateCfg() - { - CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd; - - 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.Idx0 = int.Parse(positionTextBox.Text); - bool updateOk = Utils.TryParseEDouble(a1TextBox.Text, out config.A1) && - Utils.TryParseEDouble(a2TextBox.Text, out config.A2) && - Utils.TryParseEDouble(a3TextBox.Text, out config.A3) && - Utils.TryParseEDouble(a4TextBox.Text, out config.A4) && - Utils.TryParseEDouble(a5TextBox.Text, out config.A5) && - Utils.TryParseEDouble(defaultTempTextBox.Text, out config.DefaultTemperature); - - return flags; - } - - private void importButton_Click(object sender, EventArgs e) - { - OpenFileDialog dlg = new OpenFileDialog(); - if (!string.IsNullOrEmpty(lastImportFileName)) dlg.FileName = lastImportFileName; - if (dlg.ShowDialog() == DialogResult.OK) - { - using (TextReader reader = new StreamReader(dlg.FileName)) - { - try - { - string startOfLine = string.Format("Calch{0} =", positionTextBox.Text); - bool channelFound = false; - string line; - - do - { - line = reader.ReadLine(); - if (!string.IsNullOrEmpty(line) && (line.IndexOf(startOfLine) == 0)) - { - string[] factors = line.Substring(startOfLine.Length).Split(new char[] { ',' }); - int count = factors.Length; - double tmp; - if (count >= 1 && Utils.TryParseEDouble(factors[0].Trim(), out tmp)) a1TextBox.Text = factors[0].Trim(); - if (count >= 2 && Utils.TryParseEDouble(factors[1].Trim(), out tmp)) a2TextBox.Text = factors[1].Trim(); - if (count >= 3 && Utils.TryParseEDouble(factors[2].Trim(), out tmp)) a3TextBox.Text = factors[2].Trim(); - if (count >= 4 && Utils.TryParseEDouble(factors[3].Trim(), out tmp)) a4TextBox.Text = factors[3].Trim(); - if (count >= 5 && Utils.TryParseEDouble(factors[4].Trim(), out tmp)) a5TextBox.Text = factors[4].Trim(); - channelFound = true; - lastImportFileName = dlg.FileName; - break; - } - } - while (line != null); - - if (!channelFound) - { - MessageBox.Show(string.Format("Calibration factors for channel {0} not found.", positionTextBox.Text), - "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - } - } - catch - { - MessageBox.Show("Wrong file format, import failed.", - "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - } - } - } - } - } -} diff --git a/TBF/Rig/Elde/TempMeter/TempMeterCfgCtrl.resx b/TBF/Rig/Elde/TempMeter/TempMeterCfgCtrl.resx deleted file mode 100644 index 1af7de150..000000000 --- a/TBF/Rig/Elde/TempMeter/TempMeterCfgCtrl.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/TBF/Rig/Elde/TempMeter/TempMeterFactory.cs b/TBF/Rig/Elde/TempMeter/TempMeterFactory.cs deleted file mode 100644 index 0f4fe564a..000000000 --- a/TBF/Rig/Elde/TempMeter/TempMeterFactory.cs +++ /dev/null @@ -1,27 +0,0 @@ -/// -/// Copyright (c) 2013-2016 Sensus Metering Systems -/// -using System.Collections.Generic; -using TBF.Rig.Generic; - -namespace TBF.Rig.Elde.TempMeter -{ - public class TempMeterFactory : IComponentFactory - { - public string ClassName { get { return "TempMeter"; } } - public override string ToString() { return ClassName; } - - public void ResetStaticProperties() { TempMeter.ResetStaticProperties(); } - - public IComponent DummyComponent() { return new TempMeter(); } - - public IComponent GetComponent(IComponentCfg cfg, IList components) { return new TempMeter(cfg, components); } - - public IComponentCfg DefaultConfig() { return new TempMeterCfg(this); } - - public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component) - { - return ComponentCfgBase.CreateFromDbEntity(TempMeterCfg.Serializer, component, this); - } - } -} diff --git a/TBF/Rig/Elde/TempMeterInternal/ReadTempOp.cs b/TBF/Rig/Elde/TempMeterInternal/ReadTempOp.cs deleted file mode 100644 index 9dae03e6a..000000000 --- a/TBF/Rig/Elde/TempMeterInternal/ReadTempOp.cs +++ /dev/null @@ -1,61 +0,0 @@ -/// -/// Copyright (c) 2015-2016 Sensus Metering Systems -/// -using System; -using log4net; -using TBF.Boxes; - -namespace TBF.Rig.Elde.TempMeterInternal -{ - public class ReadTempOp : IOperation - { - private static readonly ILog log = LogManager.GetLogger(typeof(ReadTempOp)); - public override string ToString() { return string.Format("ReadTempOp({0},.,{1})", tempMeter.Name, eventDone); } - - /// Set by the constructor - TempMeter tempMeter; - Event eventDone; - DoubleBox temp; - - /// - /// Events: TempInDone, TempOutDone, TempDivDone or Error - /// - /// TempMeter reference - /// Reference to the variable, value is in degree Celsius - /// Event to be returned by Run() when completed OK - public ReadTempOp(TempMeter tempMeter, ref DoubleBox temp, Event eventDone) - { - if (tempMeter == null) throw new ArgumentNullException("tempMeter"); - this.tempMeter = tempMeter; - this.temp = temp; - this.eventDone = eventDone; - log.Debug(this.ToString()); - } - - public ReadTempOp(TempMeter tempMeter, ref DoubleBox temp) - : this(tempMeter, ref temp, Event.TempDone) - { - } - - /// Start this operation - public void Start() - { - temp.Val = tempMeter.ReadTemperature(); - } - - /// Run this operation - /// - /// Event.TempInDone, Event.TempOutDone or Event.TempDivDone - /// - public Event Run() - { - temp.Val = tempMeter.ReadTemperature(); - return eventDone; - } - - /// Stop this operation - public void Stop() - { - } - } -} diff --git a/TBF/Rig/Elde/TempMeterInternal/TempMeter.cs b/TBF/Rig/Elde/TempMeterInternal/TempMeter.cs deleted file mode 100644 index a2d687115..000000000 --- a/TBF/Rig/Elde/TempMeterInternal/TempMeter.cs +++ /dev/null @@ -1,107 +0,0 @@ -/// -/// Copyright (c) 2015-2020 Sensus Slovensko a.s. -/// -using System; -using System.Collections.Generic; -using log4net; -using TBF.Rig.ControlBoard.Legacy; -using TBF.Rig.Generic; -using TBF.Boxes; -using TBF.Resources; - -namespace TBF.Rig.Elde.TempMeterInternal -{ - public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItCmpnt - { - private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter)); - public override string ToString() { return string.Format("TempMeter({0})", Cfg.ToString(-1)); } - - readonly TempMeterCfg tempMtrCfg; - public SchematicDrawing.IDrawingItem DrawingItem { get { return tempMtrCfg as SchematicDrawing.IDrawingItem; } } - - public readonly CBoard ControlBoard; - - public int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..7 - - public TempMeter() - { - } - - public TempMeter(Generic.IComponentCfg cfg, IList components) - : base(cfg) - { - tempMtrCfg = cfg as TempMeterCfg; - - ControlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components); - if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent"); - - /// Prepare data for SendCalibData() control board component method - ControlBoard.TempCalibData[tempMtrCfg.CoefsIdx0, 0] = tempMtrCfg.A1; - ControlBoard.TempCalibData[tempMtrCfg.CoefsIdx0, 1] = tempMtrCfg.A2; - ControlBoard.TempCalibData[tempMtrCfg.CoefsIdx0, 2] = tempMtrCfg.A3; - ControlBoard.TempCalibData[tempMtrCfg.CoefsIdx0, 3] = tempMtrCfg.A4; - ControlBoard.TempCalibData[tempMtrCfg.CoefsIdx0, 4] = tempMtrCfg.A5; - - log.Warn(this.ToString()); - } - - - public IList GetCalendarEvents() - { - DateTime calibrationDue = tempMtrCfg.CalibValidDate; - IList calendarEvents = new List(); - - if (calibrationDue > TBF.UI.Constants.MinDate) - { - /// Calibration due date calendar event - calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, - string.Format(Strings.Calibration_due_date_is_0, - calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)))); - if (DateTime.Now.Date <= calibrationDue.AddDays(-7)) - { - /// Weekly reminders (last 5 weeks) - calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, - string.Format(Strings.Calibration_due_date_is_0, - calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), - false)); - } - if (DateTime.Now.Date <= calibrationDue.Date) - { - /// Daily reminders (last 5 days) - calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, - string.Format(Strings.Calibration_due_date_is_0, - calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), - true)); - } - } - return calendarEvents; - } - - - public double ReadTemperature() - { - return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections); - } - - /// - /// Events: TempDone, Error - /// - /// Reference to a variable for the temperature in Celsius - /// ReadTempOp instance reference casted to IOperaton - public IOperation ReadTempOp(ref DoubleBox temp) - { - return new ReadTempOp(this, ref temp); - } - - /// - /// Events: tempDone, Error - /// - /// Reference to a variable for the temperature in Celsius - /// Event returned when measurement done - /// ReadTempOp instance reference casted to IOperaton - public IOperation ReadTempOp(ref DoubleBox temp, Event tempDone) - { - return new ReadTempOp(this, ref temp, tempDone); - } - } -} diff --git a/TBF/Rig/Elde/TempMeterInternal/TempMeterCfg.cs b/TBF/Rig/Elde/TempMeterInternal/TempMeterCfg.cs deleted file mode 100644 index a7d56c69c..000000000 --- a/TBF/Rig/Elde/TempMeterInternal/TempMeterCfg.cs +++ /dev/null @@ -1,94 +0,0 @@ -/// -/// Copyright (c) 2015-2020 Sensus Slovensko a.s. -/// Author: Milan Hanajik -/// -using System; -using System.Collections.Generic; -using System.IO; -using System.Xml.Serialization; -using Config.Entities; -using SchematicDrawing; -using TBF.Rig.Generic; - -namespace TBF.Rig.Elde.TempMeterInternal -{ - public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.Rig.GenericDevices.ICalibInfoCfg, IDrawingItemWithMeasuredVal - { - public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0]; - public override XmlSerializer GetSerializer() { return Serializer; } - - public IComponentCfgCtrl GetControl(IList cmpntEntities) { return new TempMeterCfgCtrl(); } - - /// - /// Serialized parameters - /// - public int Idx0; /// 0..7 - public int CoefsIdx0; /// 0..7 - public float A1; - public float A2; - public float A3; - public float A4; - public float A5; - - /// Calibration info serialized parameters displayed in Metrology tab page - public string CalibCertificateNr { get; set; } - public DateTime CalibDate { get; set; } - public DateTime CalibValidDate { get; set; } - - /// Schematic drawing info - public Shape Shape { get; set; } - public int X { get; set; } - public int Y { get; set; } - public Sz Sz { get; set; } - public Orient Orient { get; set; } - public bool Flip { get; set; } - public int LblX { get; set; } - public int LblY { get; set; } - public Orient LblOrient { get; set; } - public int MsrdX { get; set; } - public int MsrdY { get; set; } - public Orient MsrdOrient { get; set; } - public Config.Unit MsrdUnit { get; set; } - public string MsrdFormat { get; set; } - public double MsrdValLimLo { get; set; } - public double MsrdValLimHi { get; set; } - - [XmlIgnore] - public IList GNodes { get; set; } - - /// Private parameterless constructor invoked by all other (public) constructors - TempMeterCfg() - { - GNodes = new List(); - } - - public TempMeterCfg(IComponentFactory factory) - : this() - { - Shape = Shape.TempM; - Sz = Sz.M; - MsrdUnit = Config.Unit.C; - MsrdFormat = "{0:F1} °C"; - - Name = "T"; - Factory = factory; - ParentName = "CB"; - Idx0 = 0; - CoefsIdx0 = 2; - A1 = 0; - A2 = 0; - A3 = 0; - A4 = 0; - A5 = 0; - } - - public string ToString(int i) - { - return string.Format("Name={0}, Parent={1}, Idx0={2}, CoefsIdx0={3}, A1={4}, A2={5}, A3={6}, A4={7}, A5={8}", - Name, - (string.IsNullOrEmpty(ParentName) ? "-" : ParentName), - Idx0, CoefsIdx0, - A1, A2, A3, A4, A5); - } - } -} diff --git a/TBF/Rig/Elde/TempMeterInternal/TempMeterCfgCtrl.Designer.cs b/TBF/Rig/Elde/TempMeterInternal/TempMeterCfgCtrl.Designer.cs deleted file mode 100644 index 531fb8549..000000000 --- a/TBF/Rig/Elde/TempMeterInternal/TempMeterCfgCtrl.Designer.cs +++ /dev/null @@ -1,272 +0,0 @@ -/// -/// Copyright (c) 2015 Sensus Metering Systems -/// Author: Milan Hanajik -/// -namespace TBF.Rig.Elde.TempMeterInternal -{ - partial class TempMeterCfgCtrl - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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.a1TextBox = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.a2TextBox = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.a3TextBox = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.a5TextBox = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - this.a4TextBox = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.parentNameComboBox = new System.Windows.Forms.ComboBox(); - this.coefsIdxTextBox = new System.Windows.Forms.TextBox(); - this.coefsIdxLabel = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // positionTextBox - // - this.positionTextBox.Enabled = false; - this.positionTextBox.Location = new System.Drawing.Point(130, 81); - 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(20, 84); - 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(20, 60); - 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(130, 34); - 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(20, 37); - 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(127, 10); - this.classNameLabel.Name = "classNameLabel"; - this.classNameLabel.Size = new System.Drawing.Size(83, 13); - this.classNameLabel.TabIndex = 0; - this.classNameLabel.Text = "ComonentName"; - // - // a1TextBox - // - this.a1TextBox.Enabled = false; - this.a1TextBox.Location = new System.Drawing.Point(130, 127); - this.a1TextBox.Name = "a1TextBox"; - this.a1TextBox.Size = new System.Drawing.Size(130, 20); - this.a1TextBox.TabIndex = 10; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(20, 130); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(20, 13); - this.label1.TabIndex = 9; - this.label1.Text = "A1"; - // - // a2TextBox - // - this.a2TextBox.Enabled = false; - this.a2TextBox.Location = new System.Drawing.Point(130, 148); - this.a2TextBox.Name = "a2TextBox"; - this.a2TextBox.Size = new System.Drawing.Size(130, 20); - this.a2TextBox.TabIndex = 12; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(20, 151); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(20, 13); - this.label2.TabIndex = 11; - this.label2.Text = "A2"; - // - // a3TextBox - // - this.a3TextBox.Enabled = false; - this.a3TextBox.Location = new System.Drawing.Point(130, 169); - this.a3TextBox.Name = "a3TextBox"; - this.a3TextBox.Size = new System.Drawing.Size(130, 20); - this.a3TextBox.TabIndex = 14; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(20, 172); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(20, 13); - this.label3.TabIndex = 13; - this.label3.Text = "A3"; - // - // a5TextBox - // - this.a5TextBox.Enabled = false; - this.a5TextBox.Location = new System.Drawing.Point(130, 211); - this.a5TextBox.Name = "a5TextBox"; - this.a5TextBox.Size = new System.Drawing.Size(130, 20); - this.a5TextBox.TabIndex = 18; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(20, 214); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(20, 13); - this.label5.TabIndex = 17; - this.label5.Text = "A5"; - // - // a4TextBox - // - this.a4TextBox.Enabled = false; - this.a4TextBox.Location = new System.Drawing.Point(130, 190); - this.a4TextBox.Name = "a4TextBox"; - this.a4TextBox.Size = new System.Drawing.Size(130, 20); - this.a4TextBox.TabIndex = 16; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(20, 193); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(20, 13); - this.label4.TabIndex = 15; - this.label4.Text = "A4"; - // - // parentNameComboBox - // - this.parentNameComboBox.Enabled = false; - this.parentNameComboBox.FormattingEnabled = true; - this.parentNameComboBox.Location = new System.Drawing.Point(130, 57); - this.parentNameComboBox.Name = "parentNameComboBox"; - this.parentNameComboBox.Size = new System.Drawing.Size(130, 21); - this.parentNameComboBox.TabIndex = 4; - // - // coefsIdxTextBox - // - this.coefsIdxTextBox.Enabled = false; - this.coefsIdxTextBox.Location = new System.Drawing.Point(130, 104); - this.coefsIdxTextBox.Name = "coefsIdxTextBox"; - this.coefsIdxTextBox.Size = new System.Drawing.Size(46, 20); - this.coefsIdxTextBox.TabIndex = 8; - // - // coefsIdxLabel - // - this.coefsIdxLabel.AutoSize = true; - this.coefsIdxLabel.Location = new System.Drawing.Point(20, 107); - this.coefsIdxLabel.Name = "coefsIdxLabel"; - this.coefsIdxLabel.Size = new System.Drawing.Size(78, 13); - this.coefsIdxLabel.TabIndex = 7; - this.coefsIdxLabel.Text = "Coeficients idx."; - // - // TempMeterCfgCtrl - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.coefsIdxTextBox); - this.Controls.Add(this.coefsIdxLabel); - this.Controls.Add(this.parentNameComboBox); - this.Controls.Add(this.a5TextBox); - this.Controls.Add(this.label5); - this.Controls.Add(this.a4TextBox); - this.Controls.Add(this.label4); - this.Controls.Add(this.a3TextBox); - this.Controls.Add(this.label3); - this.Controls.Add(this.a2TextBox); - this.Controls.Add(this.label2); - this.Controls.Add(this.a1TextBox); - this.Controls.Add(this.label1); - 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 = "TempMeterCfgCtrl"; - this.Size = new System.Drawing.Size(300, 240); - this.Load += new System.EventHandler(this.TempMeterCfgCtrl_Load); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TextBox positionTextBox; - private System.Windows.Forms.Label positionLabel; - private System.Windows.Forms.Label parentNameLabel; - private System.Windows.Forms.TextBox nameTextBox; - private System.Windows.Forms.Label nameLabel; - private System.Windows.Forms.Label classNameLabel; - private System.Windows.Forms.TextBox a1TextBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox a2TextBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox a3TextBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox a5TextBox; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.TextBox a4TextBox; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.ComboBox parentNameComboBox; - private System.Windows.Forms.TextBox coefsIdxTextBox; - private System.Windows.Forms.Label coefsIdxLabel; - } -} diff --git a/TBF/Rig/Elde/TempMeterInternal/TempMeterCfgCtrl.cs b/TBF/Rig/Elde/TempMeterInternal/TempMeterCfgCtrl.cs deleted file mode 100644 index d1b32c583..000000000 --- a/TBF/Rig/Elde/TempMeterInternal/TempMeterCfgCtrl.cs +++ /dev/null @@ -1,160 +0,0 @@ -/// -/// Copyright (c) 2015 Sensus Slovensko a.s. -/// -using System; -using System.Windows.Forms; -using Config.Entities; -using TBF.Rig.Generic; -using TBF.UI.Bench.Components; - -namespace TBF.Rig.Elde.TempMeterInternal -{ - public partial class TempMeterCfgCtrl : UserControl, IComponentCfgCtrl - { - ComponentParametersDlg parent; - - public bool ShowMore { get { return false; } } - - TempMeterCfg config; - public IComponentCfg Config - { - get { return config as IComponentCfg; } - set - { - config = value as TempMeterCfg; - Redraw(); - } - } - - public TempMeterCfgCtrl() - { - InitializeComponent(); - } - - private void TempMeterCfgCtrl_Load(object sender, EventArgs e) - { - parent = ParentForm as ComponentParametersDlg; - if (parent == null) return; - - if (parent.CmpntEntities != null) - { - foreach (var cmpnt in parent.CmpntEntities) - { - if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.Factory) - { - parentNameComboBox.Items.Add(cmpnt.Name); - } - } - } - - Redraw(); - } - - public void Closing() - { - } - - void Redraw() - { - if (config == null) return; /// Control was not loaded, settings were not changed - - classNameLabel.Text = config.Factory.ClassName; - nameTextBox.Text = config.Name; - parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName; - positionTextBox.Text = config.Idx0.ToString(); - coefsIdxTextBox.Text = config.CoefsIdx0.ToString(); - a1TextBox.Text = config.A1.ToString(); - a2TextBox.Text = config.A2.ToString(); - a3TextBox.Text = config.A3.ToString(); - a4TextBox.Text = config.A4.ToString(); - a5TextBox.Text = config.A5.ToString(); - } - - public void Unlock() - { - nameTextBox.Enabled = true; - parentNameComboBox.Enabled = true; - positionTextBox.Enabled = true; - coefsIdxTextBox.Enabled = true; - a1TextBox.Enabled = true; - a2TextBox.Enabled = true; - a3TextBox.Enabled = true; - a4TextBox.Enabled = true; - a5TextBox.Enabled = true; - } - - public CfgUpdateFlags VerifyCfg(ref string message) - { - CfgUpdateFlags flags = CfgUpdateFlags.None; - - int dummy; - if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "Invalid 'Parent Name'"; - } - if (!int.TryParse(positionTextBox.Text, out dummy) || dummy < 0 || dummy > 7) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'Position' should be between 0 and 7"; - } - if (!int.TryParse(coefsIdxTextBox.Text, out dummy) || dummy < 0 || dummy > 7) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'Coeficients idx.' should be between 0 and 7"; - } - - float fdummy; - if (!Utils.TryParseEFloat(a1TextBox.Text, out fdummy)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'A1' is not valid"; - } - - if (!Utils.TryParseEFloat(a2TextBox.Text, out fdummy)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'A2' is not valid"; - } - - if (!Utils.TryParseEFloat(a3TextBox.Text, out fdummy)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'A3' is not valid"; - } - - if (!Utils.TryParseEFloat(a4TextBox.Text, out fdummy)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'A4' is not valid"; - } - - if (!Utils.TryParseEFloat(a5TextBox.Text, out fdummy)) - { - flags |= CfgUpdateFlags.Error; - message += Environment.NewLine + "'A5' is not valid"; - } - - return flags; - } - - public CfgUpdateFlags UpdateCfg() - { - CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd; - - 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.Idx0 = int.Parse(positionTextBox.Text); - config.CoefsIdx0 = int.Parse(coefsIdxTextBox.Text); - bool updateOk = Utils.TryParseEFloat(a1TextBox.Text, out config.A1) && - Utils.TryParseEFloat(a2TextBox.Text, out config.A2) && - Utils.TryParseEFloat(a3TextBox.Text, out config.A3) && - Utils.TryParseEFloat(a4TextBox.Text, out config.A4) && - Utils.TryParseEFloat(a5TextBox.Text, out config.A5); - - return flags; - } - } -} diff --git a/TBF/Rig/Elde/TempMeterInternal/TempMeterCfgCtrl.resx b/TBF/Rig/Elde/TempMeterInternal/TempMeterCfgCtrl.resx deleted file mode 100644 index 1af7de150..000000000 --- a/TBF/Rig/Elde/TempMeterInternal/TempMeterCfgCtrl.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/TBF/Rig/Elde/TempMeterInternal/TempMeterFactory.cs b/TBF/Rig/Elde/TempMeterInternal/TempMeterFactory.cs deleted file mode 100644 index 1de947af2..000000000 --- a/TBF/Rig/Elde/TempMeterInternal/TempMeterFactory.cs +++ /dev/null @@ -1,27 +0,0 @@ -/// -/// Copyright (c) 2015-2016 Sensus Metering Systems -/// -using System.Collections.Generic; -using TBF.Rig.Generic; - -namespace TBF.Rig.Elde.TempMeterInternal -{ - public class TempMeterFactory : IComponentFactory - { - public string ClassName { get { return "TempMeterInternal"; } } - public override string ToString() { return ClassName; } - - public void ResetStaticProperties() { TempMeter.ResetStaticProperties(); } - - public IComponent DummyComponent() { return new TempMeter(); } - - public IComponent GetComponent(IComponentCfg cfg, IList components) { return new TempMeter(cfg, components); } - - public IComponentCfg DefaultConfig() { return new TempMeterCfg(this); } - - public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component) - { - return ComponentCfgBase.CreateFromDbEntity(TempMeterCfg.Serializer, component, this); - } - } -} diff --git a/TBF/Rig/Elde/CoverTest/CoverTest.cs b/TBF/Rig/Various/CoverTest/CoverTest.cs similarity index 77% rename from TBF/Rig/Elde/CoverTest/CoverTest.cs rename to TBF/Rig/Various/CoverTest/CoverTest.cs index ab0eaab69..fff4e8159 100644 --- a/TBF/Rig/Elde/CoverTest/CoverTest.cs +++ b/TBF/Rig/Various/CoverTest/CoverTest.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2017-2020 Sensus Slovensko a.s. +/// Copyright (c) 2017-2021 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -9,7 +9,7 @@ using TBF.Rig.ControlBoard.Legacy; using TBF.Rig.GenericDevices; using TBF.Resources; -namespace TBF.Rig.Elde.CoverTest +namespace TBF.Rig.Various.CoverTest { public class CoverTest : ComponentBase, IOperation, ISequenceCondition { @@ -21,9 +21,9 @@ namespace TBF.Rig.Elde.CoverTest readonly CoverTestCfg coverTestCfg; readonly CBoard controlBoard; - readonly int bitPosition; /// 0 .. 63 - readonly ulong mask; /// derived from bitPosition in the constructor - readonly ulong target; + readonly int bitPosition; /// 0 .. 127 + readonly UInt128 mask; /// derived from bitPosition in the constructor + readonly UInt128 target; readonly string message; readonly Users.Entities.GID[] bypassLevel; @@ -39,11 +39,16 @@ namespace TBF.Rig.Elde.CoverTest controlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components); if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent"); - bitPosition = coverTestCfg.BitPosition; - mask = (((ulong)1) << coverTestCfg.BitPosition); - target = coverTestCfg.Invert ? 0 : mask; + bitPosition = coverTestCfg.BitNr; + mask = (((UInt128)1) << coverTestCfg.BitNr); + target = coverTestCfg.Inverted ? 0 : mask; message = coverTestCfg.Message; - bypassLevel = coverTestCfg.BypassLevel; + var groups = new List(); + if (coverTestCfg.BypassGroup1 != Users.Entities.GID.None) groups.Add(coverTestCfg.BypassGroup1); + if (coverTestCfg.BypassGroup2 != Users.Entities.GID.None) groups.Add(coverTestCfg.BypassGroup2); + if (coverTestCfg.BypassGroup3 != Users.Entities.GID.None) groups.Add(coverTestCfg.BypassGroup3); + if (coverTestCfg.BypassGroup4 != Users.Entities.GID.None) groups.Add(coverTestCfg.BypassGroup4); + bypassLevel = groups.ToArray(); log.Warn(this.ToString()); } @@ -100,7 +105,7 @@ namespace TBF.Rig.Elde.CoverTest /// Event.ResultsPrinted public Event Run() { - bool conditionMet = ((controlBoard.DigitalInputs & mask) == target); + bool conditionMet = ((controlBoard.Route & mask) == target); if (completed || conditionMet) { diff --git a/TBF/Rig/Various/CoverTest/CoverTestCfg.cs b/TBF/Rig/Various/CoverTest/CoverTestCfg.cs new file mode 100644 index 000000000..0c5e7c2d3 --- /dev/null +++ b/TBF/Rig/Various/CoverTest/CoverTestCfg.cs @@ -0,0 +1,232 @@ +/// +/// Copyright (c) 2017-2021 Sensus Slovensko a.s. +/// +using System.IO; +using System.Collections.Generic; +using System.Xml.Serialization; +using Config; +using Config.Entities; +using SchematicDrawing; +using TBF.Rig.Generic; +using TBF.Resources; + +namespace TBF.Rig.Various.CoverTest +{ + public class CoverTestCfg : ComponentCfgBase, IComponentCfg, IParamsProvider, IDrawingItem + { + public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CoverTestCfg) })[0]; + public override XmlSerializer GetSerializer() { return Serializer; } + + public IComponentCfgCtrl GetControl(IList cmpntEntities) + { + return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); + } + + /// + /// Serialized parameters + /// + public int BitNr { get; set; } /// Bit-position + public bool Inverted { get; set; } /// When true the valve function is inverted: 0 = open, 1 = closed + public string Message; + public Users.Entities.GID BypassGroup1; + public Users.Entities.GID BypassGroup2; + public Users.Entities.GID BypassGroup3; + public Users.Entities.GID BypassGroup4; + + /// Schematic drawing info + public Shape Shape { get; set; } + public int X { get; set; } + public int Y { get; set; } + public Sz Sz { get; set; } + public Orient Orient { get; set; } + public bool Flip { get; set; } + public int LblX { get; set; } + public int LblY { get; set; } + public Orient LblOrient { get; set; } + + [XmlIgnore] + public IList GNodes { get; set; } + [XmlIgnore] + public IList EdgesToSet { get; set; } + + /// Private parameterless constructor invoked by all other (public) constructors + CoverTestCfg() + { + GNodes = new List(); + EdgesToSet = new List(); + } + + public CoverTestCfg(string name, IComponentFactory factory) + : this() + { + //Shape = Shape.RtBasedArrow; + Shape = Shape.Pump; + Sz = Sz.M; + Name = name; + Factory = factory; + ParentName = string.Empty; + InitializeAll(); + } + + public string ComponentName { get { return Name; } } + + public void InitializeAll() + { + BitNr = 22; + Inverted = false; + Message = Strings.Close_the_cover; + BypassGroup1 = Users.Entities.GID.TestingSpecialists; + BypassGroup2 = Users.Entities.GID.None; + BypassGroup3 = Users.Entities.GID.None; + BypassGroup4 = Users.Entities.GID.None; + } + + string[] paramNames = new string[] + { + "Route bit number", + "Inverted", + "Message when open", + "Group 1 to bypass cover test", + "Group 2 to bypass cover test", + "Group 3 to bypass cover test", + "Group 4 to bypass cover test", + }; + public string ParamName(int i) { return paramNames[i]; } + public int ParamsCount() { return paramNames.Length; } + + public ICollection ParamValues(int i) + { + switch (i) + { + case 1: + return new string[] { Strings.yes, Strings.no }; + case 3: + case 4: + case 5: + case 6: + ICollection values = new List(); + values.Add(Users.Entities.GID.None.ToString()); + for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++) + { + values.Add(gid.ToString()); + } + return values; + + default: + return null; + } + } + + public string ToString(int i) + { + switch (i) + { + case 0: return BitNr.ToString(); + case 1: return Inverted ? Strings.yes : Strings.no; + case 2: return Message; + case 3: return BypassGroup1.ToString(); + case 4: return BypassGroup2.ToString(); + case 5: return BypassGroup3.ToString(); + case 6: return BypassGroup4.ToString(); + default: + return string.Format("{0} Bit={1}, Inv={2}, Message={3}", Name, BitNr, Inverted, Message); + } + } + + public CfgUpdateFlags UpdateParam(int i, string str) + { + switch (i) + { + case 0: BitNr = int.Parse(str); return CfgUpdateFlags.RestartRqrd; + case 1: Inverted = (str == Strings.yes); return CfgUpdateFlags.RestartRqrd; + case 2: Message = str; return CfgUpdateFlags.RestartRqrd; + + case 3: + for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++) + { + if (gid.ToString() == str) { BypassGroup1 = gid; return CfgUpdateFlags.RestartRqrd; } + } + BypassGroup1 = Users.Entities.GID.None; + return CfgUpdateFlags.RestartRqrd; + + case 4: + for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++) + { + if (gid.ToString() == str) { BypassGroup2 = gid; return CfgUpdateFlags.RestartRqrd; } + } + BypassGroup2 = Users.Entities.GID.None; + return CfgUpdateFlags.RestartRqrd; + + case 5: + for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++) + { + if (gid.ToString() == str) { BypassGroup3 = gid; return CfgUpdateFlags.RestartRqrd; } + } + BypassGroup3 = Users.Entities.GID.None; + return CfgUpdateFlags.RestartRqrd; + + case 6: + for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++) + { + if (gid.ToString() == str) { BypassGroup4 = gid; return CfgUpdateFlags.RestartRqrd; } + } + BypassGroup4 = Users.Entities.GID.None; + return CfgUpdateFlags.RestartRqrd; + + default: + return CfgUpdateFlags.None; + } + } + + public bool ValidateParam(int i, string str, out string message) + { + message = string.Empty; + int n; + + switch (i) + { + case 0: + if (int.TryParse(str, out n) && n >= 0 && n <= 127) return true; + break; + case 2: + return true; + case 1: + case 3: + case 4: + case 5: + case 6: + if (ParamValues(i).Contains(str)) return true; + break; + default: + message = "Invalid index"; + return false; + } + + message = ParamName(i) + " is invalid"; + return false; + } + + void CopyContentTo(CoverTestCfg prms) + { + prms.BitNr = BitNr; + prms.Inverted = Inverted; + prms.Message = Message; + prms.BypassGroup1 = BypassGroup1; + prms.BypassGroup2 = BypassGroup2; + prms.BypassGroup3 = BypassGroup3; + prms.BypassGroup4 = BypassGroup4; + } + + public Config.Entities.IParamsProvider Clone() + { + var pars = new CoverTestCfg(); + CopyContentTo(pars); + return pars; + } + + public bool UpdateEmbeddedDbEntity() + { + return true; /// =OK, do nothing + } + } +} diff --git a/TBF/Rig/Elde/CoverTest/CoverTestForm.cs b/TBF/Rig/Various/CoverTest/CoverTestForm.cs similarity index 97% rename from TBF/Rig/Elde/CoverTest/CoverTestForm.cs rename to TBF/Rig/Various/CoverTest/CoverTestForm.cs index 48176b2a5..a598e0497 100644 --- a/TBF/Rig/Elde/CoverTest/CoverTestForm.cs +++ b/TBF/Rig/Various/CoverTest/CoverTestForm.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2017 Sensus Metering Systems +/// Copyright (c) 2017 Sensus Slovensko a.s. /// using System; using System.Drawing; @@ -7,7 +7,7 @@ using System.Windows.Forms; using log4net; using TBF.Resources; -namespace TBF.Rig.Elde.CoverTest +namespace TBF.Rig.Various.CoverTest { public partial class CoverTestForm : Form { diff --git a/TBF/Rig/Elde/CoverTest/CoverTestForm.designer.cs b/TBF/Rig/Various/CoverTest/CoverTestForm.designer.cs similarity index 97% rename from TBF/Rig/Elde/CoverTest/CoverTestForm.designer.cs rename to TBF/Rig/Various/CoverTest/CoverTestForm.designer.cs index d5c829add..99416f5ed 100644 --- a/TBF/Rig/Elde/CoverTest/CoverTestForm.designer.cs +++ b/TBF/Rig/Various/CoverTest/CoverTestForm.designer.cs @@ -1,7 +1,7 @@ /// -/// Copyright (c) 2017 Sensus Metering Systems +/// Copyright (c) 2017 Sensus Slovensko a.s. /// -namespace TBF.Rig.Elde.CoverTest +namespace TBF.Rig.Various.CoverTest { partial class CoverTestForm { diff --git a/TBF/Rig/Elde/CoverTest/CoverTestForm.resx b/TBF/Rig/Various/CoverTest/CoverTestForm.resx similarity index 100% rename from TBF/Rig/Elde/CoverTest/CoverTestForm.resx rename to TBF/Rig/Various/CoverTest/CoverTestForm.resx diff --git a/TBF/Rig/Elde/CoverTest/Factory.cs b/TBF/Rig/Various/CoverTest/Factory.cs similarity index 79% rename from TBF/Rig/Elde/CoverTest/Factory.cs rename to TBF/Rig/Various/CoverTest/Factory.cs index fd67e42c6..9b6bf3a5b 100644 --- a/TBF/Rig/Elde/CoverTest/Factory.cs +++ b/TBF/Rig/Various/CoverTest/Factory.cs @@ -1,14 +1,14 @@ /// -/// Copyright (c) 2017 Sensus Metering Systems +/// Copyright (c) 2017-2021 Sensus Slovensko a.s. /// using System.Collections.Generic; using TBF.Rig.Generic; -namespace TBF.Rig.Elde.CoverTest +namespace TBF.Rig.Various.CoverTest { public class Factory : IComponentFactory { - public string ClassName { get { return "Elde.CoverTest"; } } + public string ClassName { get { return GetType().Namespace.Substring(8); } } public override string ToString() { return ClassName; } public void ResetStaticProperties() { CoverTest.ResetStaticProperties(); } @@ -17,7 +17,7 @@ namespace TBF.Rig.Elde.CoverTest public IComponent GetComponent(IComponentCfg cfg, IList components) { return new CoverTest(cfg, components); } - public IComponentCfg DefaultConfig() { return new CoverTestCfg(this); } + public IComponentCfg DefaultConfig() { return new CoverTestCfg("Cover", this); } public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component) { diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index aab6f9479..f8f71f47f 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -561,21 +561,6 @@ - - Form - - - CoverTestForm.cs - - - - - UserControl - - - CoverTestCfgCtrl.cs - - @@ -594,16 +579,6 @@ FlowMeterCfgCtrl.cs - - - - - UserControl - - - TempMeterCfgCtrl.cs - - @@ -1651,6 +1626,15 @@ + + + + Form + + + CoverTestForm.cs + + @@ -1765,12 +1749,6 @@ - - UserControl - - - TempMeterCfgCtrl.cs - @@ -1883,10 +1861,6 @@ True Strings.zh-CN.resx - - - - @@ -2680,12 +2654,6 @@ RegulValveCfgCtrl.cs - - CoverTestForm.cs - - - CoverTestCfgCtrl.cs - FlowMeterCfgCtrl.cs @@ -2695,12 +2663,6 @@ FlowMeterCfgCtrl.cs - - TempMeterCfgCtrl.cs - - - TempMeterCfgCtrl.cs - MultimeterCfgCtrl.cs @@ -2998,6 +2960,9 @@ RegValveCfgCtrl.cs + + CoverTestForm.cs + WaterLevelForm.cs diff --git a/TBF/UI/Bench/Metrology/MetrologyDlg.cs b/TBF/UI/Bench/Metrology/MetrologyDlg.cs index 78e012c95..e6f4f7ed1 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlg.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlg.cs @@ -153,9 +153,9 @@ namespace TBF.UI.Bench.Metrology } /// Tab-pages for temperature meters - if (factory is Rig.Keithley.TempMeter.Factory || - factory is Rig.Modbus.TempMeter.Groch.Factory || - factory is Rig.Modbus.TempMeter.Meret.Factory) + if (factory is Rig.Modbus.TempMeter.Groch.Factory || + factory is Rig.Modbus.TempMeter.Meret.Factory || + factory is Rig.Keithley.TempMeter.Factory) { tempMetersCount++; TabPage tabPage = new TabPage(" " + cmpnt.Name + " "); diff --git a/TBF/UI/Bench/Uncertainties/UncertaintiesDlg.cs b/TBF/UI/Bench/Uncertainties/UncertaintiesDlg.cs index 51456d107..20b30ef81 100644 --- a/TBF/UI/Bench/Uncertainties/UncertaintiesDlg.cs +++ b/TBF/UI/Bench/Uncertainties/UncertaintiesDlg.cs @@ -130,11 +130,9 @@ namespace TBF.UI.Bench.Uncertainties } /// Tab-pages for temperature meters (incl. platinum temp. meter with Keithley) - if (factory is Rig.Elde.TempMeter.TempMeterFactory || - factory is Rig.Elde.TempMeterInternal.TempMeterFactory || - factory is Rig.Keithley.TempMeter.Factory || - factory is Rig.Modbus.TempMeter.Groch.Factory || - factory is Rig.Modbus.TempMeter.Meret.Factory) + if (factory is Rig.Modbus.TempMeter.Groch.Factory || + factory is Rig.Modbus.TempMeter.Meret.Factory || + factory is Rig.Keithley.TempMeter.Factory) { tempMetersCount++; TabPage tabPage = new TabPage(" " + cmpnt.Name + " "); diff --git a/Users/Entities/Enums.cs b/Users/Entities/Enums.cs index aee6e97b2..914c93753 100644 --- a/Users/Entities/Enums.cs +++ b/Users/Entities/Enums.cs @@ -55,5 +55,6 @@ namespace Users.Entities MetrologicalAuthority, WaterMeterAuthority, NrOfGroups, /// Number of groups (this is not a GroupID) + None, } }