diff --git a/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeter.cs b/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeter.cs new file mode 100644 index 000000000..5cd95eed6 --- /dev/null +++ b/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeter.cs @@ -0,0 +1,64 @@ +/// +/// Copyright (c) 2015 Sensus Metering Systems +/// Author: Milan Hanajik +/// +using System; +using System.Collections.Generic; +using log4net; +using TBF.BenchControl.Generic; +using TBF.Boxes; + +namespace TBF.BenchControl.Elde.PressureMeterInternal +{ + public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter + { + private static readonly ILog log = LogManager.GetLogger(typeof(PressureMeter)); + public override string ToString() { return string.Format("PressureMeter({0})", Cfg.ToString(1)); } + + readonly PressureMeterCfg pressureMeterCfg; + + public readonly ControlBoardDev ControlBoard; + + public int Idx0 { get { return pressureMeterCfg.Idx0; } } /// 0..7 + + public PressureMeter(PressureMeterCfg cfg, IList components) + : base(cfg) + { + pressureMeterCfg = cfg; + + ControlBoard = (ControlBoardDev)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[pressureMeterCfg.CoefsIdx0, 0] = pressureMeterCfg.A1; + ControlBoard.TempCalibData[pressureMeterCfg.CoefsIdx0, 1] = pressureMeterCfg.A2; + ControlBoard.TempCalibData[pressureMeterCfg.CoefsIdx0, 2] = pressureMeterCfg.A3; + ControlBoard.TempCalibData[pressureMeterCfg.CoefsIdx0, 3] = pressureMeterCfg.A4; + ControlBoard.TempCalibData[pressureMeterCfg.CoefsIdx0, 4] = pressureMeterCfg.A5; + + ControlBoard.MeretRS485Address[0] = 0; /// This disables Merets, Groch temperatures, enables on-board A/D pressure and temperature + log.Debug(this.ToString()); + } + + /// + /// Events: PressureDone, Error + /// + /// Reference to a variable for the pressure in Bar + /// ReadPressureOp instance reference casted to IOperaton + public IOperation ReadPressureOp(ref FloatBox pressure) + { + return new ReadPressureOp(this, ref pressure); + } + + /// + /// Events: pressureDone, Error + /// + /// Reference to a variable for the pressure in Bar + /// Event returned when measurement done + /// ReadPressureOp instance reference casted to IOperaton + public IOperation ReadPressureOp(ref FloatBox pressure, Event pressureDone) + { + return new ReadPressureOp(this, ref pressure, pressureDone); + } + } +} diff --git a/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterCfg.cs b/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterCfg.cs new file mode 100644 index 000000000..6d871e493 --- /dev/null +++ b/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterCfg.cs @@ -0,0 +1,58 @@ +/// +/// Copyright (c) 2015 Sensus Metering Systems +/// Author: Milan Hanajik +/// +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml.Serialization; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.Elde.PressureMeterInternal +{ + public class PressureMeterCfg : ComponentCfgBase, IChildComponentCfg + { + public IComponent GetComponent(IList components) { return new PressureMeter(this, components); } + public IComponentCfgCtrl GetControl() { return new PressureMeterCfgCtrl(); } + + /// + /// 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; + + /// Private parameterless constructor invoked by all other (public) constructors + PressureMeterCfg() + { + Name = "Pr"; + ParentName = "CB"; + Idx0 = 0; + CoefsIdx0 = 0; + A1 = 0; + A2 = 0; + A3 = 0; + A4 = 0; + A5 = 0; + } + + public PressureMeterCfg(IComponentFactory factory) + : this() + { + this.Factory = factory; + } + + 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/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterCfgCtrl.Designer.cs b/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterCfgCtrl.Designer.cs new file mode 100644 index 000000000..d65fd6c3d --- /dev/null +++ b/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterCfgCtrl.Designer.cs @@ -0,0 +1,272 @@ +/// +/// Copyright (c) 2015 Sensus Metering Systems +/// Author: Milan Hanajik +/// +namespace TBF.BenchControl.Elde.PressureMeterInternal +{ + partial class PressureMeterCfgCtrl + { + /// + /// 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/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterCfgCtrl.cs new file mode 100644 index 000000000..b0f4a3f20 --- /dev/null +++ b/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterCfgCtrl.cs @@ -0,0 +1,163 @@ +/// +/// Copyright (c) 2015 Sensus Metering Systems +/// Author: Milan Hanajik +/// +using System; +using System.Globalization; +using System.Windows.Forms; +using log4net; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.Elde.PressureMeterInternal +{ + public partial class PressureMeterCfgCtrl : UserControl, IComponentCfgCtrl + { + static readonly ILog log = LogManager.GetLogger(typeof(PressureMeterCfgCtrl)); + + ComponentParametersDlg parent; + + public bool ShowMore { get { return false; } } + + PressureMeterCfg config; + public IComponentCfg Config + { + get { return config as IComponentCfg; } + set + { + config = value as PressureMeterCfg; + Redraw(); + } + } + + public PressureMeterCfgCtrl() + { + InitializeComponent(); + } + + private void TempMeterCfgCtrl_Load(object sender, EventArgs e) + { + parent = ParentForm as ComponentParametersDlg; + if (parent == null) return; + + if (parent.TbfComponents != null) + { + foreach (var cmpnt in parent.TbfComponents) + { + if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory) + { + 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/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterCfgCtrl.resx b/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterCfgCtrl.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterCfgCtrl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterFactory.cs b/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterFactory.cs new file mode 100644 index 000000000..c9fa03f99 --- /dev/null +++ b/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/PressureMeterFactory.cs @@ -0,0 +1,22 @@ +/// +/// Copyright (c) 2015 Sensus Metering Systems +//// Author: Milan Hanajik +// +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.Elde.PressureMeterInternal +{ + public class PressureMeterFactory : IComponentFactory + { + public string ClassName { get { return "PressureMeterInternal"; } } + + public void ResetStaticProperties() { PressureMeter.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new PressureMeterCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(PressureMeterCfg), component, this); + } + } +} diff --git a/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/ReadPressureOp.cs b/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/ReadPressureOp.cs new file mode 100644 index 000000000..f3be8fd03 --- /dev/null +++ b/TestBenchFramework/BenchControl/Elde/PressureMeterInternal/ReadPressureOp.cs @@ -0,0 +1,64 @@ +/// +/// Copyright (c) 2015 Sensus Metering Systems +/// Author: Milan Hanajik +/// +using System; +using log4net; +using TBF.Boxes; + +namespace TBF.BenchControl.Elde.PressureMeterInternal +{ + public class ReadPressureOp : IOperation + { + private static readonly ILog log = LogManager.GetLogger(typeof(ReadPressureOp)); + public override string ToString() { return string.Format("ReadPressureOp(.,{0},{1},.)", eventDone, pressureMeterNr); } + + /// Set by the constructor + readonly ControlBoardDev controlBoardDev; + readonly int pressureMeterNr; + readonly Event eventDone; + FloatBox pressure; + + /// + /// Events: PressureInDone, PressureOutDone or Error + /// + /// Pressure meter reference + /// Reference to the measured pressure variable, value is in bar + /// Event to be returned by Run() when completed OK + public ReadPressureOp(PressureMeter pressureMeter, ref FloatBox pressure, Event eventDone) + { + if (pressureMeter == null) throw new ArgumentNullException("pressureMeter"); + this.controlBoardDev = pressureMeter.ControlBoard; + this.pressureMeterNr = pressureMeter.Idx0; + this.eventDone = eventDone; + this.pressure = pressure; + + log.Debug(this.ToString()); + } + public ReadPressureOp(PressureMeter pressureMeter, ref FloatBox pressure) + : this(pressureMeter, ref pressure, Event.PressureDone) + { + } + + /// Start this operation + public void Start() + { + pressure.Val = controlBoardDev.Pressure(pressureMeterNr); + } + + /// Run this operation + /// + /// Event.PressureInDone or Event.PressureOutDone + /// + public Event Run() + { + pressure.Val = controlBoardDev.Pressure(pressureMeterNr); + return eventDone; + } + + /// Stop this operation + public void Stop() + { + } + } +} diff --git a/TestBenchFramework/BenchControl/Elde/TempMeterInternal/ReadTempOp.cs b/TestBenchFramework/BenchControl/Elde/TempMeterInternal/ReadTempOp.cs new file mode 100644 index 000000000..3fe45695f --- /dev/null +++ b/TestBenchFramework/BenchControl/Elde/TempMeterInternal/ReadTempOp.cs @@ -0,0 +1,63 @@ +/// +/// Copyright (c) 2015 Sensus Metering Systems +/// Author: Milan Hanajik +/// +using System; +using log4net; +using TBF.Boxes; + +namespace TBF.BenchControl.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},.)", eventDone, tempMeterNr); } + + /// Set by the constructor + ControlBoardDev controlBoardDev; + Event eventDone; + int tempMeterNr; + FloatBox 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 FloatBox temp, Event eventDone) + { + if (tempMeter == null) throw new ArgumentNullException("tempMeter"); + this.controlBoardDev = tempMeter.ControlBoard; + this.tempMeterNr = tempMeter.Idx0; + this.temp = temp; + this.eventDone = eventDone; + log.Debug(this.ToString()); + } + public ReadTempOp(TempMeter tempMeter, ref FloatBox temp) + : this(tempMeter, ref temp, Event.TempDone) + { + } + + /// Start this operation + public void Start() + { + temp.Val = controlBoardDev.Temperature(tempMeterNr); + } + + /// Run this operation + /// + /// Event.TempInDone, Event.TempOutDone or Event.TempDivDone + /// + public Event Run() + { + temp.Val = controlBoardDev.Temperature(tempMeterNr); + return eventDone; + } + + /// Stop this operation + public void Stop() + { + } + } +} diff --git a/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeter.cs b/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeter.cs new file mode 100644 index 000000000..97b351a84 --- /dev/null +++ b/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeter.cs @@ -0,0 +1,63 @@ +/// +/// Copyright (c) 2015 Sensus Metering Systems +/// Author: Milan Hanajik +/// +using System; +using System.Collections.Generic; +using log4net; +using TBF.BenchControl.Generic; +using TBF.Boxes; + +namespace TBF.BenchControl.Elde.TempMeterInternal +{ + public class TempMeter : ComponentBase, GenericDevices.ITempMeter + { + 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 readonly ControlBoardDev ControlBoard; + + public int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..7 + + public TempMeter(TempMeterCfg cfg, IList components) + : base(cfg) + { + tempMtrCfg = cfg; + + ControlBoard = (ControlBoardDev)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.Debug(this.ToString()); + } + + /// + /// Events: TempDone, Error + /// + /// Reference to a variable for the temperature in Celsius + /// ReadTempOp instance reference casted to IOperaton + public IOperation ReadTempOp(ref FloatBox 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 FloatBox temp, Event tempDone) + { + return new ReadTempOp(this, ref temp, tempDone); + } + } +} diff --git a/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterCfg.cs b/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterCfg.cs new file mode 100644 index 000000000..e00f09baa --- /dev/null +++ b/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterCfg.cs @@ -0,0 +1,58 @@ +/// +/// Copyright (c) 2015 Sensus Metering Systems +/// Author: Milan Hanajik +/// +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml.Serialization; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.Elde.TempMeterInternal +{ + public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg + { + public IComponent GetComponent(IList components) { return new TempMeter(this, components); } + public IComponentCfgCtrl GetControl() { 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; + + /// Private parameterless constructor invoked by all other (public) constructors + TempMeterCfg() + { + Name = "T"; + ParentName = "CB"; + Idx0 = 0; + CoefsIdx0 = 2; + A1 = 0; + A2 = 0; + A3 = 0; + A4 = 0; + A5 = 0; + } + + public TempMeterCfg(IComponentFactory factory) + : this() + { + this.Factory = factory; + } + + 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/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterCfgCtrl.Designer.cs b/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterCfgCtrl.Designer.cs new file mode 100644 index 000000000..522971a6a --- /dev/null +++ b/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterCfgCtrl.Designer.cs @@ -0,0 +1,272 @@ +/// +/// Copyright (c) 2015 Sensus Metering Systems +/// Author: Milan Hanajik +/// +namespace TBF.BenchControl.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/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterCfgCtrl.cs b/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterCfgCtrl.cs new file mode 100644 index 000000000..c68e194e8 --- /dev/null +++ b/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterCfgCtrl.cs @@ -0,0 +1,163 @@ +/// +/// Copyright (c) 2015 Sensus Metering Systems +/// Author: Milan Hanajik +/// +using System; +using System.Globalization; +using System.Windows.Forms; +using log4net; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.Elde.TempMeterInternal +{ + public partial class TempMeterCfgCtrl : UserControl, IComponentCfgCtrl + { + static readonly ILog log = LogManager.GetLogger(typeof(TempMeterCfgCtrl)); + + 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.TbfComponents != null) + { + foreach (var cmpnt in parent.TbfComponents) + { + if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory) + { + 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/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterCfgCtrl.resx b/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterCfgCtrl.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterCfgCtrl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterFactory.cs b/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterFactory.cs new file mode 100644 index 000000000..45dd7eb26 --- /dev/null +++ b/TestBenchFramework/BenchControl/Elde/TempMeterInternal/TempMeterFactory.cs @@ -0,0 +1,22 @@ +/// +/// Copyright (c) 2015 Sensus Metering Systems +/// Author: Milan Hanajik +/// +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.Elde.TempMeterInternal +{ + public class TempMeterFactory : IComponentFactory + { + public string ClassName { get { return "TempMeterInternal"; } } + + public void ResetStaticProperties() { TempMeter.ResetStaticProperties(); } + + public IComponentCfg DefaultConfig() { return new TempMeterCfg(this); } + + public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component) + { + return ComponentCfgBase.CreateFromDbEntity(typeof(TempMeterCfg), component, this); + } + } +} diff --git a/TestBenchFramework/BenchControl/TbfComponents.cs b/TestBenchFramework/BenchControl/TbfComponents.cs index fc8307dd5..7d53c83a6 100644 --- a/TestBenchFramework/BenchControl/TbfComponents.cs +++ b/TestBenchFramework/BenchControl/TbfComponents.cs @@ -44,6 +44,7 @@ namespace TBF.BenchControl Factories.Add(new MettlerToledo.Multi.BalanceFactory()); Factories.Add(new TestMethods.PMaxTest.TestMethodFactory()); Factories.Add(new Elde.PressureMeter.PressureMeterFactory()); + Factories.Add(new Elde.PressureMeterInternal.PressureMeterFactory()); Factories.Add(new Elde.Pump.PumpFactory()); Factories.Add(new Danfoss.VLT2800.PumpFactory()); Factories.Add(new Elde.PumpWithFM.PumpFactory()); @@ -55,6 +56,7 @@ namespace TBF.BenchControl Factories.Add(new ResultsPrinters.Munich.PrinterFactory()); Factories.Add(new TestMethods.CameraRoiDetection.RoiDetectionFactory()); Factories.Add(new Elde.TempMeter.TempMeterFactory()); + Factories.Add(new Elde.TempMeterInternal.TempMeterFactory()); Factories.Add(new Elde.Valve.ValveFactory()); Factories.Add(new WaterMeter.WaterMeterFactory()); } diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index 117443578..cf81756e3 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.4.42.1")] -[assembly: AssemblyFileVersion("1.4.42.1")] +[assembly: AssemblyVersion("1.4.43.1")] +[assembly: AssemblyFileVersion("1.4.43.1")] diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj index f2c011e26..3575f31aa 100644 --- a/TestBenchFramework/TBF.csproj +++ b/TestBenchFramework/TBF.csproj @@ -92,7 +92,7 @@ true - + ..\packages\ControlBoard\Munich\ControlComponent3Munich.dll @@ -184,6 +184,26 @@ TestStartEndForm.cs + + + + UserControl + + + PressureMeterCfgCtrl.cs + + + + + + + + UserControl + + + TempMeterCfgCtrl.cs + + UserControl @@ -1245,6 +1265,9 @@ FlowMeterCfgCtrl.cs + + PressureMeterCfgCtrl.cs + PressureMeterCfgCtrl.cs @@ -1266,6 +1289,9 @@ RegulValveCfgCtrl.cs + + TempMeterCfgCtrl.cs + TempMeterCfgCtrl.cs