Schematic drawing with live function, bench control by mouse, Dijkstra algo, vacuum, etc.

This commit is contained in:
Milan Hanajik
2020-06-14 13:01:53 +02:00
parent 2945049288
commit 1f67899a5c
223 changed files with 5684 additions and 3772 deletions
+2 -2
View File
@@ -15,13 +15,13 @@ namespace TBF.BenchControl.Ambient.Comet
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
/// Connection settings: 9600 Bd 8-bits No-parity 2-stop-bits Flow control: none.
/// </summary>
public class Ambient : ComponentBase, IDevice, IOperation, GenericDevices.IAmbient, SchematicDrawing.IDrawingItemCmpnt
public class Ambient : ComponentBase, IDevice, IOperation, GenericDevices.IAmbient, SchematicDrawing.IDrawingItCmpnt
{
private static readonly ILog log = LogManager.GetLogger(typeof(Ambient));
public override string ToString() { return string.Format("Ambient({0})", Cfg.ToString(1)); }
private readonly AmbientCfg ambientCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return ambientCfg as SchematicDrawing.IDrawingItemCfg; } }
public SchematicDrawing.IDrawingItem DrawingItem { get { return ambientCfg as SchematicDrawing.IDrawingItem; } }
/// Private fields
SerialPort serialPort;
+21 -21
View File
@@ -5,11 +5,12 @@ using System.IO;
using System.Collections.Generic;
using System.IO.Ports;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Ambient.Comet
{
public class AmbientCfg : ComponentCfgBase, Generic.IComponentCfg, SchematicDrawing.IDrawingItemCfg
public class AmbientCfg : ComponentCfgBase, Generic.IComponentCfg, IDrawingItem
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(AmbientCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -28,24 +29,32 @@ namespace TBF.BenchControl.Ambient.Comet
public bool SetDtrToOne;
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
AmbientCfg()
{
GNodes = new List<GNode>();
}
public AmbientCfg(IComponentFactory factory)
: this()
{
Shape = Shape.Ambient;
Sz = Sz.M;
Factory = factory;
Name = "Ambient";
ParentName = string.Empty;
ComPortNr = 6;
@@ -55,21 +64,12 @@ namespace TBF.BenchControl.Ambient.Comet
StopBits = System.IO.Ports.StopBits.Two;
Handshake = System.IO.Ports.Handshake.None;
SetDtrToOne = false;
Shape = SchematicDrawing.Shape.Ambient;
}
public AmbientCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
return string.Format("Name={0}, Com{1}, {2}Bd, {3}-bits, parity={4}, stopBits={5}, {6}",
Name, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
return string.Format("{0} {1}[{2},{3}] Com{4}, {5}Bd, {6}-bits, parity={7}, stopBits={8}, {9}",
Name, Shape, X, Y, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
}
}
}
+4 -4
View File
@@ -9,13 +9,13 @@ using TBF.BenchControl.ControlBoard;
namespace TBF.BenchControl.BuiltIn.Pump
{
public class Pump : ComponentBase, GenericDevices.IPump, GenericDevices.IValve, SchematicDrawing.IDrawingItemCmpnt
public class Pump : ComponentBase, GenericDevices.IPump, GenericDevices.IValve, SchematicDrawing.IDrawingItCmpnt
{
private static readonly ILog log = LogManager.GetLogger(typeof(Pump));
public override string ToString() { return string.Format("Pump({0})", Cfg.ToString(1)); }
readonly PumpCfg pumpCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return pumpCfg as SchematicDrawing.IDrawingItemCfg; } }
public SchematicDrawing.IDrawingItem DrawingItem { get { return pumpCfg as SchematicDrawing.IDrawingItem; } }
public int Delay { get { return pumpCfg.Delay; } }
@@ -47,8 +47,8 @@ namespace TBF.BenchControl.BuiltIn.Pump
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as IControlBoard;
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
bitPosition = pumpCfg.BitPosition;
Mask = (((UInt128)1) << pumpCfg.BitPosition);
bitPosition = pumpCfg.BitNr;
Mask = (((UInt128)1) << pumpCfg.BitNr);
log.Debug(this.ToString());
}
+26 -20
View File
@@ -4,11 +4,12 @@
using System.IO;
using System.Collections.Generic;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BuiltIn.Pump
{
public class PumpCfg : ComponentCfgBase, IChildComponentCfg, SchematicDrawing.IDrawingItemCfg
public class PumpCfg : ComponentCfgBase, IChildComponentCfg, IRouteBasedDrawingItem
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PumpCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -18,49 +19,54 @@ namespace TBF.BenchControl.BuiltIn.Pump
///
/// Serialized parameters
///
public int BitPosition;
public int BitNr { get; set; }
public bool Inverted { get; set; } /// When true the pump function is inverted: 0 = on, 1 = off
public int Delay;
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
[XmlIgnore]
public IList<GEdge> EdgesToSet { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
PumpCfg()
{
Name = "P";
Shape = SchematicDrawing.Shape.Pump;
ParentName = "CB";
BitPosition = 0;
Delay = 1;
}
GNodes = new List<GNode>();
EdgesToSet = new List<GEdge>();
}
public PumpCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
Shape = Shape.Pump;
Sz = Sz.M;
Factory = factory;
Name = "P";
ParentName = "CB";
BitNr = 0;
Delay = 1;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
return string.Format("Name={0}, Parent={1}, Bit={2}, Delay={3}",
Name,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
BitPosition,
BitNr,
Delay);
}
}
+5 -4
View File
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.BuiltIn.Pump
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.BuiltIn.Pump
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (cmpnt.ClassName.Contains("ControlBoard"))
{
@@ -60,7 +61,7 @@ namespace TBF.BenchControl.BuiltIn.Pump
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
bitPositionTextBox.Text = config.BitPosition.ToString();
bitPositionTextBox.Text = config.BitNr.ToString();
delayTextBox.Text = config.Delay.ToString();
}
@@ -80,7 +81,7 @@ namespace TBF.BenchControl.BuiltIn.Pump
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.BitPosition = int.Parse(bitPositionTextBox.Text);
config.BitNr = int.Parse(bitPositionTextBox.Text);
config.Delay = int.Parse(delayTextBox.Text);
return flags;
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.BuiltIn.PumpTandem
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.BuiltIn.PumpTandem
parentDlg = ParentForm as ComponentParametersDlg;
if (parentDlg == null) return;
if (parentDlg.TbfComponents != null)
if (parentDlg.CmpntEntities != null)
{
foreach (var cmpnt in parentDlg.TbfComponents)
foreach (var cmpnt in parentDlg.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is BuiltIn.Pump.PumpFactory ||
TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.PumpWithFM.PumpFactory ||
+5 -5
View File
@@ -9,13 +9,13 @@ using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.BuiltIn.Valve
{
public class Valve : ValveBase, IValve, SchematicDrawing.IDrawingItemCmpnt
public class Valve : ValveBase, IValve, SchematicDrawing.IDrawingItCmpnt
{
private static readonly ILog log = LogManager.GetLogger(typeof(Valve));
public override string ToString() { return string.Format("Valve({0})", Cfg.ToString(1)); }
readonly ValveCfg valveCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return valveCfg as SchematicDrawing.IDrawingItemCfg; } }
public SchematicDrawing.IDrawingItem DrawingItem { get { return valveCfg as SchematicDrawing.IDrawingItem; } }
readonly TBF.BenchControl.ControlBoard.IControlBoard controlBoard;
@@ -32,7 +32,7 @@ namespace TBF.BenchControl.BuiltIn.Valve
public readonly UInt128 Mask; /// derived from bitPosition in the constructor
public int BitPosition { get { return valveCfg.BitPosition; } }
public int BitPosition { get { return valveCfg.BitNr; } }
public Valve()
@@ -47,11 +47,11 @@ namespace TBF.BenchControl.BuiltIn.Valve
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as TBF.BenchControl.ControlBoard.IControlBoard;
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
if (valveCfg.BitPosition < 0 || valveCfg.BitPosition >= 128)
if (valveCfg.BitNr < 0 || valveCfg.BitNr >= 128)
{
throw new ArgumentOutOfRangeException("position");
}
this.Mask = (((UInt128)1) << valveCfg.BitPosition);
this.Mask = (((UInt128)1) << valveCfg.BitNr);
if (valveCfg.CoupledToName != null)
{
+39 -31
View File
@@ -4,11 +4,12 @@
using System.IO;
using System.Collections.Generic;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.BuiltIn.Valve
{
public class ValveCfg : ComponentCfgBase, IChildComponentCfg, SchematicDrawing.IDrawingItemCfg
public class ValveCfg : ComponentCfgBase, IChildComponentCfg, IRouteBasedDrawingItem
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ValveCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -18,40 +19,50 @@ namespace TBF.BenchControl.BuiltIn.Valve
///
/// Serialized parameters
///
public int BitPosition; /// Bit-position
public ValveCategory Category; /// None, Feeding, Bench or Output
public int OpenCloseTime; /// Delay for SetValvesOp operations
public bool Inverted; /// The valve is inverted: 0=open, 1=closed
///
public string CoupledToName; /// Name of the coupled valve or null
public bool InvertCouple; /// The coupled valve has inverted position
public int LagOpening; /// Delay (referred to the master valve) when opening this valve in [s]
public int LagClosing; /// Delay (referred to the master valve) when closing this valve in [s]
/// Negative values of delays mean an earlier function of the coupled valve.
public int BitNr { get; set; } /// Bit-position
public bool Inverted { get; set; } /// When true the valve function is inverted: 0 = open, 1 = closed
public ValveCategory Category; /// None, Feeding, Bench or Output
public int OpenCloseTime; /// Delay for SetValvesOp operations
///
public string CoupledToName; /// Name of the coupled valve or null
public bool InvertCouple; /// The coupled valve has inverted position
public int LagOpening; /// Delay (referred to the master valve) when opening this valve in [s]
public int LagClosing; /// Delay (referred to the master valve) when closing this valve in [s]
/// Negative values of delays mean an earlier function of the coupled valve.
public SchematicDrawing.Shape Shape { get; set; }
/// Schematic drawing info
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
[XmlIgnore]
public IList<GEdge> EdgesToSet { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
ValveCfg()
{
GNodes = new List<GNode>();
EdgesToSet = new List<GEdge>();
}
public ValveCfg(IComponentFactory factory)
: this()
{
Shape = Shape.Valve;
Sz = Sz.M;
Factory = factory;
Name = "V";
Shape = SchematicDrawing.Shape.Valve;
ParentName = "CB";
BitPosition = 0;
BitNr = 0;
Category = ValveCategory.None;
OpenCloseTime = 1;
Inverted = false;
@@ -61,20 +72,17 @@ namespace TBF.BenchControl.BuiltIn.Valve
LagClosing = 0;
}
public ValveCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
return string.Format("Name={0} ({1}), Bit={2}, Cat.={5}, Inv.={3}, Delay={4}s, CoupledTo={6}, Inv.Couple={7}, LagOpen={8}s, LagClose={9}s",
return string.Format("{0}({1}) {2}[{3},{4}] bit={5} inv={6} delay={7}s cat={8} coupled to={9} inv.couple={10} lagO={11}s lagC={12}s",
Name,
string.IsNullOrEmpty(ParentName) ? "-" : ParentName,
BitPosition,
Shape,
X,
Y,
BitNr,
Inverted ? "yes" : "no",
OpenCloseTime,
Category,
@@ -5,6 +5,8 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.BuiltIn.Valve
{
@@ -41,11 +43,11 @@ namespace TBF.BenchControl.BuiltIn.Valve
categoryComboBox.Items.Add(ValveCategory.Output.ToString());
categoryComboBox.Items.Add(ValveCategory.None.ToString());
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
parentNameComboBox.Items.Add("---");
coupledToComboBox.Items.Add("---");
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (cmpnt.ClassName.Contains("ControlBoard"))
{
@@ -72,7 +74,7 @@ namespace TBF.BenchControl.BuiltIn.Valve
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
bitPositionTextBox.Text = config.BitPosition.ToString();
bitPositionTextBox.Text = config.BitNr.ToString();
invertedCheckBox.Checked = config.Inverted;
openCloseTimeTextBox.Text = config.OpenCloseTime.ToString();
categoryComboBox.Text = config.Category.ToString();
@@ -119,7 +121,7 @@ namespace TBF.BenchControl.BuiltIn.Valve
if (config.Name != nameTextBox.Text ||
config.ParentName != newParentName ||
config.BitPosition != newBitPosition ||
config.BitNr != newBitPosition ||
config.Category != newCategory ||
config.Inverted != invertedCheckBox.Checked ||
config.CoupledToName != newCoupledToName ||
@@ -127,7 +129,7 @@ namespace TBF.BenchControl.BuiltIn.Valve
{
config.Name = nameTextBox.Text;
config.ParentName = newParentName;
config.BitPosition = newBitPosition;
config.BitNr = newBitPosition;
config.Category = newCategory;
config.Inverted = invertedCheckBox.Checked;
config.CoupledToName = newCoupledToName;
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.BuiltIn.ValveEx
{
@@ -39,13 +40,13 @@ namespace TBF.BenchControl.BuiltIn.ValveEx
logicalOpComboBox.Items.Add("AND");
logicalOpComboBox.Items.Add("OR");
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
AddValvePumpItemsToCombo(input1ComboBox, parent.TbfComponents);
AddValvePumpItemsToCombo(input2ComboBox, parent.TbfComponents);
AddValvePumpItemsToCombo(input3ComboBox, parent.TbfComponents);
AddValvePumpItemsToCombo(input4ComboBox, parent.TbfComponents);
AddValvePumpItemsToCombo(input5ComboBox, parent.TbfComponents);
AddValvePumpItemsToCombo(input1ComboBox, parent.CmpntEntities);
AddValvePumpItemsToCombo(input2ComboBox, parent.CmpntEntities);
AddValvePumpItemsToCombo(input3ComboBox, parent.CmpntEntities);
AddValvePumpItemsToCombo(input4ComboBox, parent.CmpntEntities);
AddValvePumpItemsToCombo(input5ComboBox, parent.CmpntEntities);
}
Redraw();
-89
View File
@@ -1,89 +0,0 @@
///
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
///
namespace TBF.BenchControl
{
partial class ComponentParametersDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel2.SuspendLayout();
this.splitContainer.SuspendLayout();
this.SuspendLayout();
//
// splitContainer
//
this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer.Location = new System.Drawing.Point(0, 0);
this.splitContainer.Name = "splitContainer";
//
// splitContainer.Panel2
//
this.splitContainer.Panel2.Controls.Add(this.sharedButtons);
this.splitContainer.Size = new System.Drawing.Size(559, 354);
this.splitContainer.SplitterDistance = 455;
this.splitContainer.TabIndex = 1;
//
// sharedButtons
//
this.sharedButtons.Location = new System.Drawing.Point(0, 0);
this.sharedButtons.Name = "sharedButtons";
this.sharedButtons.Size = new System.Drawing.Size(100, 521);
this.sharedButtons.TabIndex = 0;
//
// ComponentParametersDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(559, 354);
this.Controls.Add(this.splitContainer);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.HelpButton = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ComponentParametersDlg";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Properties";
this.Load += new System.EventHandler(this.ComponentCfgForm_Load);
this.splitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
this.splitContainer.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer;
private TBF.UI.Shared.SharedButtons sharedButtons;
}
}
-141
View File
@@ -1,141 +0,0 @@
///
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using TBF.Resources;
using TBF.UI.Shared;
namespace TBF.BenchControl
{
public partial class ComponentParametersDlg : Form
{
public IComponentCfgCtrl ComponentCfgCtrl;
const int ComponentCfgCtrlHeight = 350;
const int ComponentCfgCtrlMoreHeight = 250;
public IComponentCfg Config
{
get
{
if (ComponentCfgCtrl == null) return null;
return ComponentCfgCtrl.Config;
}
}
public CfgUpdateFlags Flags;
public bool UnlockAfterStart;
/// <summary>
/// List of components (=component configuration instances)
/// </summary>
public IList<Config.Entities.Component> TbfComponents;
public ComponentParametersDlg()
{
InitializeComponent();
Flags = CfgUpdateFlags.None;
/// SharedDlgButtons configuration
sharedButtons.RequiredGroupMembership = new Users.Entities.GID[] { global::Users.Entities.GID.Metrologists };
sharedButtons.MoreButtonTop = ComponentCfgCtrlHeight - 45;
sharedButtons.OptionalButtons = SharedButtons.Buttons.None;
sharedButtons.Unlocked += Unlock;
sharedButtons.OKClicked += okButton_Click;
sharedButtons.CancelClicked += cancelButton_Click;
sharedButtons.MoreClicked += moreButton_Click;
}
private void ComponentCfgForm_Load(object sender, EventArgs e)
{
Text = Strings.Properties;
if (ComponentCfgCtrl != null)
{
splitContainer.Panel1.Controls.Add((UserControl)ComponentCfgCtrl);
}
if ((ComponentCfgCtrl != null) && ComponentCfgCtrl.ShowMore)
{
sharedButtons.OptionalButtons = SharedButtons.Buttons.More;
}
if (UnlockAfterStart)
{
sharedButtons.UnlockButtons();
ComponentCfgCtrl.Unlock();
}
}
/// <summary>
/// Handler of the Unlock button click
/// </summary>
private void Unlock(object sender, EventArgs e)
{
ComponentCfgCtrl.Unlock();
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
if (ComponentCfgCtrl == null) return CfgUpdateFlags.None; /// Nothing to verify -> OK
return ComponentCfgCtrl.VerifyCfg(ref message);
}
private void okButton_Click(object sender, EventArgs e)
{
string message = string.Empty;
CfgUpdateFlags flags = VerifyCfg(ref message);
if ((flags & CfgUpdateFlags.Error) == CfgUpdateFlags.Error)
{
MessageBox.Show(Strings.Please_change_the_following_settings + message,
Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (ComponentCfgCtrl != null)
{
flags = ComponentCfgCtrl.UpdateCfg();
if ((flags & CfgUpdateFlags.RestartRqrd) == CfgUpdateFlags.RestartRqrd)
{
MessageBox.Show(Strings.Program_restart_is_required_to_apply_some_settings,
Strings.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
ComponentCfgCtrl.Closing();
}
Flags = flags;
DialogResult = DialogResult.OK;
Close();
return;
}
private void cancelButton_Click(object sender, EventArgs e)
{
if (ComponentCfgCtrl != null) ComponentCfgCtrl.Closing();
DialogResult = DialogResult.Cancel;
Close();
return;
}
private void moreButton_Click(object sender, EventArgs e)
{
ComponentCfgCtrl.Unlock();
if (sharedButtons.MoreActive)
{
Height = Height + ComponentCfgCtrlMoreHeight;
}
else
{
Height = Height - ComponentCfgCtrlMoreHeight;
}
return;
}
}
}
@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -12,6 +12,7 @@ using Dirichlet.Numerics;
using TBF.BenchControl.Generic;
using TBF.BenchControl.GenericDevices;
using TBF.BenchControl.Modbus;
using TBF.BenchControl.Sequences;
namespace TBF.BenchControl.ControlBoard.Papouch
{
@@ -70,6 +71,19 @@ namespace TBF.BenchControl.ControlBoard.Papouch
}
}
TBF.UiBridge.Bridge.RouteChangeHandler += delegate(object sndr, TBF.UiBridge.RouteChangeArgs args)
{
UInt128 mask = ((UInt128)1) << args.BitNr;
if ((benchModelRoute & mask) == 0)
{
benchModelRoute |= mask;
}
else
{
benchModelRoute &= (~mask);
}
};
log.Debug(this.ToString());
}
@@ -114,6 +128,32 @@ namespace TBF.BenchControl.ControlBoard.Papouch
{
SetOutputs((UInt32)(benchModelRoute & 0xFFFFFFFF));
}
///
/// Collect measured values
///
if (ProcessData.MeasuredValues == null || ProcessData.Setpoints.Length != ProcessData.ComponentsWithMeasuredVal.Count)
{
ProcessData.MeasuredValues = new double[ProcessData.ComponentsWithMeasuredVal.Count];
}
for (int i = 0; i < ProcessData.ComponentsWithMeasuredVal.Count; i++)
{
ProcessData.MeasuredValues[i] = ProcessData.ComponentsWithMeasuredVal[i].MeasuredVal;
}
///
/// Collect setpoints
///
if (ProcessData.Setpoints == null || ProcessData.Setpoints.Length != ProcessData.ComponentsWithSetpoint.Count)
{
ProcessData.Setpoints = new double[ProcessData.ComponentsWithSetpoint.Count];
}
for (int i = 0; i < ProcessData.ComponentsWithSetpoint.Count; i++)
{
ProcessData.Setpoints[i] = ProcessData.ComponentsWithSetpoint[i].SetpointVal;
}
TBF.UiBridge.Bridge.OnStateMachineTick(this, new TBF.UiBridge.StateMachineTickEventArgs(benchModelRoute, ProcessData.MeasuredValues, ProcessData.Setpoints));
}
public void StopDevice()
@@ -124,6 +164,7 @@ namespace TBF.BenchControl.ControlBoard.Papouch
public void StopDevice2() { }
/// <summary>
/// Set outputs of QuidoRS board
/// </summary>
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.ControlBoard.Papouch
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.ControlBoard.Papouch
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
{
+54 -6
View File
@@ -8,6 +8,7 @@ using System.Text;
using log4net;
using Config.Entities;
using Dirichlet.Numerics;
using SchematicDrawing;
using TBF.BenchControl.ControlBoard;
using TBF.BenchControl.Generic;
@@ -67,13 +68,13 @@ namespace TBF.BenchControl.Danfoss.VLT2800
}
public class Pump : ComponentBase, IDevice, IOperation, GenericDevices.IPumpFM, GenericDevices.IValve, SchematicDrawing.IDrawingItemCmpnt
public class Pump : ComponentBase, IDevice, IOperation, GenericDevices.IPumpFM, GenericDevices.IValve, IDrawingItCmpntWithSetpoint
{
private static readonly ILog log = LogManager.GetLogger(typeof(Pump));
public override string ToString() { return string.Format("Pump-Danfoss-VLT2800({0})", Cfg.ToString(1)); }
private readonly PumpCfg pumpCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return pumpCfg as SchematicDrawing.IDrawingItemCfg; } }
public IDrawingItem DrawingItem { get { return pumpCfg as IDrawingItem; } }
public int Delay { get { return pumpCfg.Delay; } }
public ValveCategory Category { get { return ValveCategory.Feeding; } } /// Pump category is Feeding
@@ -90,10 +91,41 @@ namespace TBF.BenchControl.Danfoss.VLT2800
{
get { return power; }
}
///
public double SetpointVal
{
get { return power; }
set
{
power = (float)value;
if (power != 0) TurnOn(power);
}
}
///
public void IncreaseSetpoint()
{
power += 0.05f;
if (power > 100.0f) power = 100.0f;
TurnOn(power);
}
///
public void DecreaseSetpoint()
{
power -= 0.05f;
if (power <= 0)
{
power = 0;
TurnOff();
}
else
{
TurnOn(power);
}
}
readonly IControlBoard controlBoard;
readonly int bitPosition; /// 0 .. 63
readonly int bitNr; /// 0 .. 63
public readonly UInt128 Mask; /// derived from bitPosition in the constructor
@@ -125,9 +157,25 @@ namespace TBF.BenchControl.Danfoss.VLT2800
controlBoard = TbfComponents.FindComponent("CB", components) as IControlBoard; /// TODO: replace "CB"
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
bitPosition = pumpCfg.BitPosition;
Mask = (((UInt128)1) << bitPosition);
Mask |= (((UInt128)1) << (bitPosition + 1));
bitNr = pumpCfg.BitNr;
Mask = (((UInt128)1) << bitNr);
#if MUNICH
Mask |= (((UInt128)1) << (bitNr + 1));
#endif
TBF.UiBridge.Bridge.SetpointChangeHandler += delegate(object sndr, TBF.UiBridge.SetpointChangeArgs args)
{
if (args.Name == Name)
{
if (args.Increase)
{
IncreaseSetpoint();
}
else
{
DecreaseSetpoint();
}
}
};
log.Debug(this.ToString());
}
+43 -30
View File
@@ -5,11 +5,12 @@ using System.IO;
using System.Collections.Generic;
using System.IO.Ports;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Danfoss.VLT2800
{
public class PumpCfg : ComponentCfgBase, Generic.IComponentCfg, SchematicDrawing.IDrawingItemCfg
public class PumpCfg : ComponentCfgBase, Generic.IComponentCfg, IRouteBasedDrawingItem, IDrawingItemWithSetpoint
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PumpCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -19,10 +20,11 @@ namespace TBF.BenchControl.Danfoss.VLT2800
///
/// Serialized parameters
///
public int Delay; // Delay of the pump function in [s] (affects the duration of transition sequence steps)
public PumpProtocol Protocol; // Modbus or FC with Siemens address
public int BitPosition;
public int BusAddress; // Modbus or FC address in range 1..247 (Modbus) or 1..31 (FC with Siemens address)
public int BitNr { get; set; }
public bool Inverted { get; set; } /// When true the pump function is inverted: 0 = on, 1 = off
public int Delay; /// Delay of the pump function in [s] (affects the duration of transition sequence steps)
public PumpProtocol Protocol; /// Modbus or FC with Siemens address
public int BusAddress; /// Modbus or FC address in range 1..247 (Modbus) or 1..31 (FC with Siemens address)
public int ComPortNr;
public int BaudRate;
public Parity Parity;
@@ -30,46 +32,57 @@ namespace TBF.BenchControl.Danfoss.VLT2800
public StopBits StopBits;
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
public int SetpX { get; set; }
public int SetpY { get; set; }
public Orient SetpOrient { get; set; }
public string SetpFormat { get; set; }
public Config.Unit SetpUnits { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
[XmlIgnore]
public IList<GEdge> EdgesToSet { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
PumpCfg()
{
Name = "Pump-Danfoss";
ParentName = string.Empty;
Delay = 1;
ComPortNr = 3;
/// Default protocol settings (the same as Danfoss VLT2800 factory settings)
Protocol = PumpProtocol.FC;
BusAddress = 1;
BaudRate = 9600;
DataBits = 8;
Parity = System.IO.Ports.Parity.Even; /// 'Parity.None' is the default value for Protocol = PumpProtocol.Modbus
StopBits = System.IO.Ports.StopBits.One;
Shape = SchematicDrawing.Shape.PumpFM;
GNodes = new List<GNode>();
EdgesToSet = new List<GEdge>();
}
public PumpCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
Shape = Shape.PumpFM;
Sz = Sz.M;
SetpFormat = "{0:F0} %";
SetpUnits = Config.Unit.Pct;
Name = "Pump-Danfoss";
Factory = factory;
ParentName = string.Empty;
Delay = 1;
ComPortNr = 3;
/// Default protocol settings (the same as Danfoss VLT2800 factory settings)
Protocol = PumpProtocol.FC;
BusAddress = 1;
BaudRate = 9600;
DataBits = 8;
Parity = System.IO.Ports.Parity.Even; /// 'Parity.None' is the default value for Protocol = PumpProtocol.Modbus
StopBits = System.IO.Ports.StopBits.One;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
@@ -90,7 +90,15 @@ namespace TBF.BenchControl.Danfoss.VLT2800
private void AbbientCfgCtrl_Load(object sender, EventArgs e)
{
Redraw();
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (global::Config.Units.IsQuantity(units, global::Config.Quantity.Error))
{
unitsComboBox.Items.Add(units.ToString());
}
}
Redraw();
}
public void Closing()
@@ -104,7 +112,7 @@ namespace TBF.BenchControl.Danfoss.VLT2800
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
delayTextBox.Text = config.Delay.ToString();
bitPositionTextBox.Text = config.BitPosition.ToString();
bitPositionTextBox.Text = config.BitNr.ToString();
protocolComboBox.Text = config.Protocol.ToString();
busAddressTextBox.Text = config.BusAddress.ToString();
comPortNrTextBox.Text = config.ComPortNr.ToString();
@@ -112,7 +120,9 @@ namespace TBF.BenchControl.Danfoss.VLT2800
parityComboBox.Text = config.Parity.ToString();
dataBitsTextBox.Text = config.DataBits.ToString();
stopBitsComboBox.Text = config.StopBits.ToString();
}
formatTextBox.Text = config.SetpFormat;
unitsComboBox.Text = config.SetpUnits.ToString();
}
public void Unlock()
{
@@ -126,7 +136,9 @@ namespace TBF.BenchControl.Danfoss.VLT2800
parityComboBox.Enabled = true;
dataBitsTextBox.Enabled = true;
stopBitsComboBox.Enabled = true;
}
formatTextBox.Enabled = true;
unitsComboBox.Enabled = true;
}
public CfgUpdateFlags UpdateCfg()
{
@@ -136,7 +148,7 @@ namespace TBF.BenchControl.Danfoss.VLT2800
config.Name = nameTextBox.Text;
config.Delay = int.Parse(delayTextBox.Text);
config.BitPosition = int.Parse(bitPositionTextBox.Text);
config.BitNr = int.Parse(bitPositionTextBox.Text);
config.Protocol = protocolComboBox.Text.Equals(PumpProtocol.Modbus.ToString()) ? PumpProtocol.Modbus : PumpProtocol.FC;
config.BusAddress = int.Parse(busAddressTextBox.Text);
config.ComPortNr = int.Parse(comPortNrTextBox.Text);
@@ -145,6 +157,17 @@ namespace TBF.BenchControl.Danfoss.VLT2800
config.DataBits = int.Parse(dataBitsTextBox.Text);
config.StopBits = GetStopBits(stopBitsComboBox.SelectedItem.ToString());
config.SetpFormat = formatTextBox.Text;
config.SetpUnits = global::Config.Unit.None;
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (unitsComboBox.Text == units.ToString())
{
config.SetpUnits = units;
break;
}
}
return flags;
}
@@ -195,6 +218,12 @@ namespace TBF.BenchControl.Danfoss.VLT2800
message += Environment.NewLine + "'Data Bits' is not valid";
}
if (!unitsComboBox.Items.Contains(unitsComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Units'";
}
return flags;
}
}
+283 -236
View File
@@ -31,242 +31,285 @@ namespace TBF.BenchControl.Danfoss.VLT2800
/// </summary>
private void InitializeComponent()
{
this.comPortNrTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.baudRateLabel = new System.Windows.Forms.Label();
this.baudRateTextBox = new System.Windows.Forms.TextBox();
this.partityLabel = new System.Windows.Forms.Label();
this.dataBitsLabel = new System.Windows.Forms.Label();
this.dataBitsTextBox = new System.Windows.Forms.TextBox();
this.stopBitsLabel = new System.Windows.Forms.Label();
this.busAddressLabel = 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.parityComboBox = new System.Windows.Forms.ComboBox();
this.stopBitsComboBox = new System.Windows.Forms.ComboBox();
this.busAddressTextBox = new System.Windows.Forms.TextBox();
this.delayTextBox = new System.Windows.Forms.TextBox();
this.delayLabel = new System.Windows.Forms.Label();
this.protocolLabel = new System.Windows.Forms.Label();
this.protocolComboBox = new System.Windows.Forms.ComboBox();
this.bitPositionTextBox = new System.Windows.Forms.TextBox();
this.bitPositionLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// comPortNrTextBox
//
this.comPortNrTextBox.Enabled = false;
this.comPortNrTextBox.Location = new System.Drawing.Point(140, 129);
this.comPortNrTextBox.Name = "comPortNrTextBox";
this.comPortNrTextBox.Size = new System.Drawing.Size(34, 20);
this.comPortNrTextBox.TabIndex = 6;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(29, 132);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(98, 13);
this.label1.TabIndex = 5;
this.label1.Text = "Serial Port Number:";
//
// baudRateLabel
//
this.baudRateLabel.AutoSize = true;
this.baudRateLabel.Location = new System.Drawing.Point(29, 153);
this.baudRateLabel.Name = "baudRateLabel";
this.baudRateLabel.Size = new System.Drawing.Size(58, 13);
this.baudRateLabel.TabIndex = 7;
this.baudRateLabel.Text = "Baud Rate";
//
// baudRateTextBox
//
this.baudRateTextBox.Enabled = false;
this.baudRateTextBox.Location = new System.Drawing.Point(140, 150);
this.baudRateTextBox.Name = "baudRateTextBox";
this.baudRateTextBox.Size = new System.Drawing.Size(130, 20);
this.baudRateTextBox.TabIndex = 8;
//
// partityLabel
//
this.partityLabel.AutoSize = true;
this.partityLabel.Location = new System.Drawing.Point(29, 174);
this.partityLabel.Name = "partityLabel";
this.partityLabel.Size = new System.Drawing.Size(33, 13);
this.partityLabel.TabIndex = 9;
this.partityLabel.Text = "Parity";
//
// dataBitsLabel
//
this.dataBitsLabel.AutoSize = true;
this.dataBitsLabel.Location = new System.Drawing.Point(29, 196);
this.dataBitsLabel.Name = "dataBitsLabel";
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
this.dataBitsLabel.TabIndex = 11;
this.dataBitsLabel.Text = "Data Bits";
//
// dataBitsTextBox
//
this.dataBitsTextBox.Enabled = false;
this.dataBitsTextBox.Location = new System.Drawing.Point(140, 193);
this.dataBitsTextBox.Name = "dataBitsTextBox";
this.dataBitsTextBox.Size = new System.Drawing.Size(34, 20);
this.dataBitsTextBox.TabIndex = 12;
//
// stopBitsLabel
//
this.stopBitsLabel.AutoSize = true;
this.stopBitsLabel.Location = new System.Drawing.Point(29, 217);
this.stopBitsLabel.Name = "stopBitsLabel";
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
this.stopBitsLabel.TabIndex = 13;
this.stopBitsLabel.Text = "Stop Bits";
//
// busAddressLabel
//
this.busAddressLabel.AutoSize = true;
this.busAddressLabel.Location = new System.Drawing.Point(29, 110);
this.busAddressLabel.Name = "busAddressLabel";
this.busAddressLabel.Size = new System.Drawing.Size(66, 13);
this.busAddressLabel.TabIndex = 3;
this.busAddressLabel.Text = "Bus Address";
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(140, 23);
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(30, 26);
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(137, 5);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// parityComboBox
//
this.parityComboBox.Enabled = false;
this.parityComboBox.FormattingEnabled = true;
this.parityComboBox.Location = new System.Drawing.Point(140, 171);
this.parityComboBox.Name = "parityComboBox";
this.parityComboBox.Size = new System.Drawing.Size(130, 21);
this.parityComboBox.TabIndex = 10;
//
// stopBitsComboBox
//
this.stopBitsComboBox.Enabled = false;
this.stopBitsComboBox.FormattingEnabled = true;
this.stopBitsComboBox.Location = new System.Drawing.Point(140, 214);
this.stopBitsComboBox.Name = "stopBitsComboBox";
this.stopBitsComboBox.Size = new System.Drawing.Size(130, 21);
this.stopBitsComboBox.TabIndex = 14;
//
// busAddressTextBox
//
this.busAddressTextBox.Enabled = false;
this.busAddressTextBox.Location = new System.Drawing.Point(140, 108);
this.busAddressTextBox.Name = "busAddressTextBox";
this.busAddressTextBox.Size = new System.Drawing.Size(34, 20);
this.busAddressTextBox.TabIndex = 4;
//
// delayTextBox
//
this.delayTextBox.Enabled = false;
this.delayTextBox.Location = new System.Drawing.Point(140, 44);
this.delayTextBox.Name = "delayTextBox";
this.delayTextBox.Size = new System.Drawing.Size(34, 20);
this.delayTextBox.TabIndex = 16;
//
// delayLabel
//
this.delayLabel.AutoSize = true;
this.delayLabel.Location = new System.Drawing.Point(29, 46);
this.delayLabel.Name = "delayLabel";
this.delayLabel.Size = new System.Drawing.Size(45, 13);
this.delayLabel.TabIndex = 15;
this.delayLabel.Text = "Delay[s]";
//
// protocolLabel
//
this.protocolLabel.AutoSize = true;
this.protocolLabel.Location = new System.Drawing.Point(29, 89);
this.protocolLabel.Name = "protocolLabel";
this.protocolLabel.Size = new System.Drawing.Size(46, 13);
this.protocolLabel.TabIndex = 17;
this.protocolLabel.Text = "Protocol";
//
// protocolComboBox
//
this.protocolComboBox.Enabled = false;
this.protocolComboBox.FormattingEnabled = true;
this.protocolComboBox.Location = new System.Drawing.Point(140, 86);
this.protocolComboBox.Name = "protocolComboBox";
this.protocolComboBox.Size = new System.Drawing.Size(130, 21);
this.protocolComboBox.TabIndex = 18;
//
// bitPositionTextBox
//
this.bitPositionTextBox.Enabled = false;
this.bitPositionTextBox.Location = new System.Drawing.Point(140, 65);
this.bitPositionTextBox.Name = "bitPositionTextBox";
this.bitPositionTextBox.Size = new System.Drawing.Size(34, 20);
this.bitPositionTextBox.TabIndex = 20;
//
// bitPositionLabel
//
this.bitPositionLabel.AutoSize = true;
this.bitPositionLabel.Location = new System.Drawing.Point(30, 68);
this.bitPositionLabel.Name = "bitPositionLabel";
this.bitPositionLabel.Size = new System.Drawing.Size(89, 13);
this.bitPositionLabel.TabIndex = 19;
this.bitPositionLabel.Text = "Valve Bit Position";
//
// PumpCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.Controls.Add(this.bitPositionTextBox);
this.Controls.Add(this.bitPositionLabel);
this.Controls.Add(this.protocolComboBox);
this.Controls.Add(this.protocolLabel);
this.Controls.Add(this.delayTextBox);
this.Controls.Add(this.delayLabel);
this.Controls.Add(this.busAddressTextBox);
this.Controls.Add(this.stopBitsComboBox);
this.Controls.Add(this.parityComboBox);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Controls.Add(this.busAddressLabel);
this.Controls.Add(this.stopBitsLabel);
this.Controls.Add(this.dataBitsTextBox);
this.Controls.Add(this.dataBitsLabel);
this.Controls.Add(this.partityLabel);
this.Controls.Add(this.baudRateTextBox);
this.Controls.Add(this.baudRateLabel);
this.Controls.Add(this.comPortNrTextBox);
this.Controls.Add(this.label1);
this.Name = "PumpCfgCtrl";
this.Size = new System.Drawing.Size(300, 240);
this.Load += new System.EventHandler(this.AbbientCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
this.comPortNrTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.baudRateLabel = new System.Windows.Forms.Label();
this.baudRateTextBox = new System.Windows.Forms.TextBox();
this.partityLabel = new System.Windows.Forms.Label();
this.dataBitsLabel = new System.Windows.Forms.Label();
this.dataBitsTextBox = new System.Windows.Forms.TextBox();
this.stopBitsLabel = new System.Windows.Forms.Label();
this.busAddressLabel = 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.parityComboBox = new System.Windows.Forms.ComboBox();
this.stopBitsComboBox = new System.Windows.Forms.ComboBox();
this.busAddressTextBox = new System.Windows.Forms.TextBox();
this.delayTextBox = new System.Windows.Forms.TextBox();
this.delayLabel = new System.Windows.Forms.Label();
this.protocolLabel = new System.Windows.Forms.Label();
this.protocolComboBox = new System.Windows.Forms.ComboBox();
this.bitPositionTextBox = new System.Windows.Forms.TextBox();
this.bitPositionLabel = new System.Windows.Forms.Label();
this.unitsComboBox = new System.Windows.Forms.ComboBox();
this.unitsLabel = new System.Windows.Forms.Label();
this.formatTextBox = new System.Windows.Forms.TextBox();
this.formatLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// comPortNrTextBox
//
this.comPortNrTextBox.Enabled = false;
this.comPortNrTextBox.Location = new System.Drawing.Point(140, 129);
this.comPortNrTextBox.Name = "comPortNrTextBox";
this.comPortNrTextBox.Size = new System.Drawing.Size(34, 20);
this.comPortNrTextBox.TabIndex = 6;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(29, 132);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(98, 13);
this.label1.TabIndex = 5;
this.label1.Text = "Serial Port Number:";
//
// baudRateLabel
//
this.baudRateLabel.AutoSize = true;
this.baudRateLabel.Location = new System.Drawing.Point(29, 153);
this.baudRateLabel.Name = "baudRateLabel";
this.baudRateLabel.Size = new System.Drawing.Size(58, 13);
this.baudRateLabel.TabIndex = 7;
this.baudRateLabel.Text = "Baud Rate";
//
// baudRateTextBox
//
this.baudRateTextBox.Enabled = false;
this.baudRateTextBox.Location = new System.Drawing.Point(140, 150);
this.baudRateTextBox.Name = "baudRateTextBox";
this.baudRateTextBox.Size = new System.Drawing.Size(130, 20);
this.baudRateTextBox.TabIndex = 8;
//
// partityLabel
//
this.partityLabel.AutoSize = true;
this.partityLabel.Location = new System.Drawing.Point(29, 174);
this.partityLabel.Name = "partityLabel";
this.partityLabel.Size = new System.Drawing.Size(33, 13);
this.partityLabel.TabIndex = 9;
this.partityLabel.Text = "Parity";
//
// dataBitsLabel
//
this.dataBitsLabel.AutoSize = true;
this.dataBitsLabel.Location = new System.Drawing.Point(29, 196);
this.dataBitsLabel.Name = "dataBitsLabel";
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
this.dataBitsLabel.TabIndex = 11;
this.dataBitsLabel.Text = "Data Bits";
//
// dataBitsTextBox
//
this.dataBitsTextBox.Enabled = false;
this.dataBitsTextBox.Location = new System.Drawing.Point(140, 193);
this.dataBitsTextBox.Name = "dataBitsTextBox";
this.dataBitsTextBox.Size = new System.Drawing.Size(34, 20);
this.dataBitsTextBox.TabIndex = 12;
//
// stopBitsLabel
//
this.stopBitsLabel.AutoSize = true;
this.stopBitsLabel.Location = new System.Drawing.Point(29, 217);
this.stopBitsLabel.Name = "stopBitsLabel";
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
this.stopBitsLabel.TabIndex = 13;
this.stopBitsLabel.Text = "Stop Bits";
//
// busAddressLabel
//
this.busAddressLabel.AutoSize = true;
this.busAddressLabel.Location = new System.Drawing.Point(29, 110);
this.busAddressLabel.Name = "busAddressLabel";
this.busAddressLabel.Size = new System.Drawing.Size(66, 13);
this.busAddressLabel.TabIndex = 3;
this.busAddressLabel.Text = "Bus Address";
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(140, 23);
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(30, 26);
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(137, 5);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// parityComboBox
//
this.parityComboBox.Enabled = false;
this.parityComboBox.FormattingEnabled = true;
this.parityComboBox.Location = new System.Drawing.Point(140, 171);
this.parityComboBox.Name = "parityComboBox";
this.parityComboBox.Size = new System.Drawing.Size(130, 21);
this.parityComboBox.TabIndex = 10;
//
// stopBitsComboBox
//
this.stopBitsComboBox.Enabled = false;
this.stopBitsComboBox.FormattingEnabled = true;
this.stopBitsComboBox.Location = new System.Drawing.Point(140, 214);
this.stopBitsComboBox.Name = "stopBitsComboBox";
this.stopBitsComboBox.Size = new System.Drawing.Size(130, 21);
this.stopBitsComboBox.TabIndex = 14;
//
// busAddressTextBox
//
this.busAddressTextBox.Enabled = false;
this.busAddressTextBox.Location = new System.Drawing.Point(140, 108);
this.busAddressTextBox.Name = "busAddressTextBox";
this.busAddressTextBox.Size = new System.Drawing.Size(34, 20);
this.busAddressTextBox.TabIndex = 4;
//
// delayTextBox
//
this.delayTextBox.Enabled = false;
this.delayTextBox.Location = new System.Drawing.Point(140, 44);
this.delayTextBox.Name = "delayTextBox";
this.delayTextBox.Size = new System.Drawing.Size(34, 20);
this.delayTextBox.TabIndex = 16;
//
// delayLabel
//
this.delayLabel.AutoSize = true;
this.delayLabel.Location = new System.Drawing.Point(29, 46);
this.delayLabel.Name = "delayLabel";
this.delayLabel.Size = new System.Drawing.Size(45, 13);
this.delayLabel.TabIndex = 15;
this.delayLabel.Text = "Delay[s]";
//
// protocolLabel
//
this.protocolLabel.AutoSize = true;
this.protocolLabel.Location = new System.Drawing.Point(29, 89);
this.protocolLabel.Name = "protocolLabel";
this.protocolLabel.Size = new System.Drawing.Size(46, 13);
this.protocolLabel.TabIndex = 17;
this.protocolLabel.Text = "Protocol";
//
// protocolComboBox
//
this.protocolComboBox.Enabled = false;
this.protocolComboBox.FormattingEnabled = true;
this.protocolComboBox.Location = new System.Drawing.Point(140, 86);
this.protocolComboBox.Name = "protocolComboBox";
this.protocolComboBox.Size = new System.Drawing.Size(130, 21);
this.protocolComboBox.TabIndex = 18;
//
// bitPositionTextBox
//
this.bitPositionTextBox.Enabled = false;
this.bitPositionTextBox.Location = new System.Drawing.Point(140, 65);
this.bitPositionTextBox.Name = "bitPositionTextBox";
this.bitPositionTextBox.Size = new System.Drawing.Size(34, 20);
this.bitPositionTextBox.TabIndex = 20;
//
// bitPositionLabel
//
this.bitPositionLabel.AutoSize = true;
this.bitPositionLabel.Location = new System.Drawing.Point(30, 68);
this.bitPositionLabel.Name = "bitPositionLabel";
this.bitPositionLabel.Size = new System.Drawing.Size(89, 13);
this.bitPositionLabel.TabIndex = 19;
this.bitPositionLabel.Text = "Valve Bit Position";
//
// unitsComboBox
//
this.unitsComboBox.Enabled = false;
this.unitsComboBox.FormattingEnabled = true;
this.unitsComboBox.Location = new System.Drawing.Point(140, 257);
this.unitsComboBox.Name = "unitsComboBox";
this.unitsComboBox.Size = new System.Drawing.Size(80, 21);
this.unitsComboBox.TabIndex = 32;
//
// unitsLabel
//
this.unitsLabel.AutoSize = true;
this.unitsLabel.Location = new System.Drawing.Point(29, 260);
this.unitsLabel.Name = "unitsLabel";
this.unitsLabel.Size = new System.Drawing.Size(71, 13);
this.unitsLabel.TabIndex = 31;
this.unitsLabel.Text = "Setpoint units";
//
// formatTextBox
//
this.formatTextBox.Enabled = false;
this.formatTextBox.Location = new System.Drawing.Point(140, 236);
this.formatTextBox.Name = "formatTextBox";
this.formatTextBox.Size = new System.Drawing.Size(130, 20);
this.formatTextBox.TabIndex = 30;
//
// formatLabel
//
this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(29, 239);
this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(78, 13);
this.formatLabel.TabIndex = 29;
this.formatLabel.Text = "Setpoint format";
//
// PumpCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.Controls.Add(this.unitsComboBox);
this.Controls.Add(this.unitsLabel);
this.Controls.Add(this.formatTextBox);
this.Controls.Add(this.formatLabel);
this.Controls.Add(this.bitPositionTextBox);
this.Controls.Add(this.bitPositionLabel);
this.Controls.Add(this.protocolComboBox);
this.Controls.Add(this.protocolLabel);
this.Controls.Add(this.delayTextBox);
this.Controls.Add(this.delayLabel);
this.Controls.Add(this.busAddressTextBox);
this.Controls.Add(this.stopBitsComboBox);
this.Controls.Add(this.parityComboBox);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Controls.Add(this.busAddressLabel);
this.Controls.Add(this.stopBitsLabel);
this.Controls.Add(this.dataBitsTextBox);
this.Controls.Add(this.dataBitsLabel);
this.Controls.Add(this.partityLabel);
this.Controls.Add(this.baudRateTextBox);
this.Controls.Add(this.baudRateLabel);
this.Controls.Add(this.comPortNrTextBox);
this.Controls.Add(this.label1);
this.Name = "PumpCfgCtrl";
this.Size = new System.Drawing.Size(400, 300);
this.Load += new System.EventHandler(this.AbbientCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -293,6 +336,10 @@ namespace TBF.BenchControl.Danfoss.VLT2800
private System.Windows.Forms.ComboBox protocolComboBox;
private System.Windows.Forms.TextBox bitPositionTextBox;
private System.Windows.Forms.Label bitPositionLabel;
private System.Windows.Forms.ComboBox unitsComboBox;
private System.Windows.Forms.Label unitsLabel;
private System.Windows.Forms.TextBox formatTextBox;
private System.Windows.Forms.Label formatLabel;
}
}
@@ -1,11 +1,13 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
using System;
using TBF.BenchControl.GenericDevices;
using TBF.BenchControl.Sequences;
namespace TBF.BenchControl.DataEntry.Standard24
{
public class EntryForm : EntryFormNoStartEnd, IHasWMStatesForm
public class EntryForm : EntryFormNoStartEnd, IHasWMStatesForm, ISequenceCondition
{
public EntryForm()
: base()
@@ -16,5 +18,29 @@ namespace TBF.BenchControl.DataEntry.Standard24
: base(cfg)
{
}
}
public int ConditionsCount { get { return 1; } }
public string ConditionName(int i)
{
switch (i)
{
case 0: return "Start states form";
default: return string.Empty;
}
}
public IOperation ConditionOp(int i)
{
GenericDevices.IHasWMStatesForm wmStatesForm =
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
if (wmStatesForm != null)
{
if (i == 0)
{
return wmStatesForm.ShowAdvancedTestStartFormOp(ProcessData.RegisterReaders, ProcessData.BatchRslts.Batch.WaterMeters, true);
}
}
return null;
}
}
}
@@ -4,17 +4,18 @@
using System;
using System.Collections.Generic;
using log4net;
using SchematicDrawing;
using TBF.Boxes;
namespace TBF.BenchControl.Dummy.FlowMeter
{
public class FlowMeter : ComponentBase, GenericDevices.IFlowMeter, SchematicDrawing.IDrawingItemCmpnt
public class FlowMeter : ComponentBase, GenericDevices.IFlowMeter, IDrawingItCmpnt
{
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
public override string ToString() { return string.Format("FlowMeter({0})", Cfg.ToString(1)); }
readonly FlowMeterCfg flowMeterCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return flowMeterCfg as SchematicDrawing.IDrawingItemCfg; } }
public IDrawingItem DrawingItem { get { return flowMeterCfg as IDrawingItem; } }
public double NominalFlow { get { return flowMeterCfg.NominalFlow; } }
@@ -5,11 +5,12 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Dummy.FlowMeter
{
public class FlowMeterCfg : ComponentCfgBase, IComponentCfg, SchematicDrawing.IDrawingItemCfg
public class FlowMeterCfg : ComponentCfgBase, IComponentCfg, IDrawingItem
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FlowMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -21,41 +22,41 @@ namespace TBF.BenchControl.Dummy.FlowMeter
///
public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
FlowMeterCfg()
{
}
GNodes = new List<GNode>();
}
public FlowMeterCfg(string name, IComponentFactory factory)
: this()
{
Name = name;
Shape = Shape.FlowM;
Sz = Sz.M;
Name = name;
Factory = factory;
NominalFlow = 1.0f;
Shape = SchematicDrawing.Shape.FlowM;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
return string.Format("Name={0}, NominalFlow={1}", Name, NominalFlow);
return string.Format("{0} {1}[{2},{3}] NominalFlow={4}", Name, Shape, X, Y, NominalFlow);
}
}
}
@@ -5,7 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Dummy.FlowMeter
{
@@ -8,13 +8,13 @@ using TBF.Boxes;
namespace TBF.BenchControl.Dummy.RegulValve
{
public class RegulValve : ComponentBase, IDevice, GenericDevices.IRegulValve, SchematicDrawing.IDrawingItemCmpnt
public class RegulValve : ComponentBase, IDevice, GenericDevices.IRegulValve, SchematicDrawing.IDrawingItCmpnt
{
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
public readonly RegulValveCfg RegulValveCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return RegulValveCfg as SchematicDrawing.IDrawingItemCfg; } }
public SchematicDrawing.IDrawingItem DrawingItem { get { return RegulValveCfg as SchematicDrawing.IDrawingItem; } }
public ValveCategory Category { get { return RegulValveCfg.Category; } }
///
@@ -1,12 +1,14 @@
///
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
using TBF.BenchControl.Generic;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
using System.Collections.Generic;
namespace TBF.BenchControl.Dummy.RegulValve
{
public class RegulValveCfg : ComponentCfgBase, IComponentCfg, SchematicDrawing.IDrawingItemCfg
public class RegulValveCfg : ComponentCfgBase, IComponentCfg, IDrawingItem
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RegulValveCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -18,25 +20,24 @@ namespace TBF.BenchControl.Dummy.RegulValve
///
public ValveCategory Category; /// Feeding, Output or All
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
RegulValveCfg()
{
GNodes = new List<GNode>();
}
public RegulValveCfg(string name, IComponentFactory factory)
@@ -45,14 +46,15 @@ namespace TBF.BenchControl.Dummy.RegulValve
Name = name;
Factory = factory;
Category = ValveCategory.Output;
Shape = SchematicDrawing.Shape.RegV;
Shape = Shape.RegV;
Sz = Sz.M;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
return string.Format("Name={0}", Name);
return string.Format("{0} {1}[{2},{3}]", Name, Shape, X, Y);
}
}
}
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Dummy.RegulValve
{
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.CoverTest
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.CoverTest
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
+6 -6
View File
@@ -12,7 +12,7 @@ using TBF.Resources;
namespace TBF.BenchControl.Elde.Diverter
{
public class Diverter : ComponentBase, IDevice, GenericDevices.IDiverter, GenericDevices.ISequenceCondition, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItemCmpnt
public class Diverter : ComponentBase, IDevice, GenericDevices.IDiverter, GenericDevices.ISequenceCondition, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItCmpnt
{
private static readonly ILog log = LogManager.GetLogger(typeof(Diverter));
public override string ToString() { return string.Format("Diverter({0})", Cfg.ToString(1)); }
@@ -33,7 +33,7 @@ namespace TBF.BenchControl.Elde.Diverter
public int DiverterNr { get { return diverterNr0 + 1; } } /// 1-based public diverter number
readonly DiverterCfg diverterCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return diverterCfg as SchematicDrawing.IDrawingItemCfg; } }
public SchematicDrawing.IDrawingItem DrawingItem { get { return diverterCfg as SchematicDrawing.IDrawingItem; } }
readonly ControlBoardDev controlBoard;
readonly UInt128 mask; /// derived from bitPosition in the constructor
@@ -75,8 +75,8 @@ namespace TBF.BenchControl.Elde.Diverter
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as ControlBoardDev;
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
if (diverterCfg.BitPosition < 0 || diverterCfg.BitPosition >= 64) throw new ArgumentOutOfRangeException("position");
this.mask = (((UInt128)1) << diverterCfg.BitPosition);
if (diverterCfg.BitNr < 0 || diverterCfg.BitNr >= 64) throw new ArgumentOutOfRangeException("position");
this.mask = (((UInt128)1) << diverterCfg.BitNr);
switchTimeStart = new FloatBox(diverterCfg.DfltSwithTimeStartMs / 1000.0f);
switchTimeEnd = new FloatBox(diverterCfg.DfltSwithTimeEndMs / 1000.0f);
@@ -193,7 +193,7 @@ namespace TBF.BenchControl.Elde.Diverter
public void RunDeviceBefore()
{
int adcValue = (int)controlBoard.AnalogInputRaw(diverterCfg.AdcNr, 0);
Handlers.OnAdcChanged(this, new CmdResponseArgs(CfgChangeCmd.GetAdc, diverterCfg.BitPosition, adcValue));
Handlers.OnAdcChanged(this, new CmdResponseArgs(CfgChangeCmd.GetAdc, diverterCfg.BitNr, adcValue));
}
public void RunDeviceAfter() { }
public void StopDevice() { }
@@ -243,7 +243,7 @@ namespace TBF.BenchControl.Elde.Diverter
else if (args.Command == CfgChangeCmd.GetAdc1 || args.Command == CfgChangeCmd.GetAdc2)
{
int adcValue = (int)controlBoard.AnalogInputRaw(diverterCfg.AdcNr, 0);
DiverterCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(args.Command, diverterCfg.BitPosition, adcValue));
DiverterCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(args.Command, diverterCfg.BitNr, adcValue));
}
else if (args.Command == CfgChangeCmd.DivToTank)
{
+31 -26
View File
@@ -5,11 +5,12 @@ using System;
using System.IO;
using System.Collections.Generic;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.Diverter
{
public class DiverterCfg : ComponentCfgBase, IChildComponentCfg, GenericDevices.ICalibInfoCfg, SchematicDrawing.IDrawingItemCfg
public class DiverterCfg : ComponentCfgBase, IChildComponentCfg, GenericDevices.ICalibInfoCfg, IRouteBasedDrawingItem
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(DiverterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -19,8 +20,9 @@ namespace TBF.BenchControl.Elde.Diverter
///
/// Serialized parameters
///
public int BitPosition; /// 0..63
public int AdcNr; /// 0..15(?), number of the analog input
public int BitNr { get; set; } /// 0..127
public bool Inverted { get; set; } /// When true the diverter function is inverted: 0 = to the tank, 1 = off
public int AdcNr; /// 0..15(?), number of the analog input
public int AdcValueToSink; /// 0..1023
public int AdcValueToTank; /// 0..1023
public int StartingLevel; /// 0..100 in %, threshold for the ADC value to start the test
@@ -35,52 +37,55 @@ namespace TBF.BenchControl.Elde.Diverter
public DateTime CalibValidDate { get; set; }
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
[XmlIgnore]
public IList<GEdge> EdgesToSet { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
DiverterCfg()
{
Name = "Div";
Shape = SchematicDrawing.Shape.Div;
ParentName = "CB";
BitPosition = 0;
AdcNr = 5; /// Div1: AdcNr=5 , Div2: AdcNr=6
AdcValueToSink = 100;
AdcValueToTank = 500;
StartingLevel = 50;
ThresholdLo = 10;
ThresholdHi = 90;
CalibCertificateNr = string.Empty;
GNodes = new List<GNode>();
EdgesToSet = new List<GEdge>();
}
public DiverterCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
Shape = Shape.Div;
Sz = Sz.M;
Factory = factory;
Name = "Div";
ParentName = "CB";
BitNr = 0;
AdcNr = 5; /// Div1: AdcNr=5 , Div2: AdcNr=6
AdcValueToSink = 100;
AdcValueToTank = 500;
StartingLevel = 50;
ThresholdLo = 10;
ThresholdHi = 90;
CalibCertificateNr = string.Empty;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
return string.Format("Name={0}, Parent={1}, Bit={2}, ADC#={3}, ADC2Sink={4}, ADC2Tank={5}, Gate={6}%, Lo={7}%, Lo={8}%",
Name,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
BitPosition,
BitNr,
AdcNr,
AdcValueToSink,
AdcValueToTank,
@@ -6,6 +6,7 @@ using System.Windows.Forms;
using log4net;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.Diverter
{
@@ -38,9 +39,9 @@ namespace TBF.BenchControl.Elde.Diverter
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
@@ -73,7 +74,7 @@ namespace TBF.BenchControl.Elde.Diverter
classNameLabel.Text = config.Factory.ClassName;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
nameTextBox.Text = config.Name;
bitPositionTextBox.Text = config.BitPosition.ToString();
bitPositionTextBox.Text = config.BitNr.ToString();
adcNrTextBox.Text = config.AdcNr.ToString();
adcToSinkTextBox.Text = config.AdcValueToSink.ToString();
adcToTankTextBox.Text = config.AdcValueToTank.ToString();
@@ -198,9 +199,9 @@ namespace TBF.BenchControl.Elde.Diverter
}
int tmp = int.Parse(bitPositionTextBox.Text);
if (config.BitPosition != tmp)
if (config.BitNr != tmp)
{
config.BitPosition = tmp;
config.BitNr = tmp;
flags |= CfgUpdateFlags.RestartRqrd;
}
@@ -367,7 +368,7 @@ namespace TBF.BenchControl.Elde.Diverter
void OnAdcChanged(object sender, CmdResponseArgs data)
{
if (data.Command == CfgChangeCmd.GetAdc && data.Id == config.BitPosition)
if (data.Command == CfgChangeCmd.GetAdc && data.Id == config.BitNr)
{
adcTextBox.Text = data.Response.ToString();
}
+2 -2
View File
@@ -10,13 +10,13 @@ using TBF.Resources;
namespace TBF.BenchControl.Elde.FlowMeter
{
public class FlowMeter : ComponentBase, Generic.IDevice, GenericDevices.IFlowMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItemCmpnt
public class FlowMeter : ComponentBase, Generic.IDevice, GenericDevices.IFlowMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItCmpnt
{
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
public override string ToString() { return string.Format("FlowMeter({0})", Cfg.ToString(1)); }
readonly FlowMeterCfg flowMeterCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return flowMeterCfg as SchematicDrawing.IDrawingItemCfg; } }
public SchematicDrawing.IDrawingItem DrawingItem { get { return flowMeterCfg as SchematicDrawing.IDrawingItem; } }
readonly ControlBoardDev controlBoard;
+24 -19
View File
@@ -5,11 +5,12 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.FlowMeter
{
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibRangesCfg, IChildComponentCfg, SchematicDrawing.IDrawingItemCfg
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibRangesCfg, IChildComponentCfg, IDrawingItem
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FlowMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -68,20 +69,18 @@ namespace TBF.BenchControl.Elde.FlowMeter
public DateTime CalibValidDate5;
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
public bool RangeEnabled(int rangeIx1)
@@ -242,26 +241,32 @@ namespace TBF.BenchControl.Elde.FlowMeter
/// Private parameterless constructor invoked by all other (public) constructors
FlowMeterCfg()
{
Name = "FlowMeter";
Shape = SchematicDrawing.Shape.FlowM;
ParentName = "CB";
Idx1 = 1;
NominalFlow = 1;
}
GNodes = new List<GNode>();
}
public FlowMeterCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
Shape = Shape.FlowM;
Sz = Sz.M;
Factory = factory;
Name = "FlowMeter";
ParentName = "CB";
Idx1 = 1;
NominalFlow = 1;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
return string.Format("Name={0}, Parent={1}, Idx1={2}, NominalFlow={3}",
return string.Format("{0}({1}) {2}[{3},{4}] Idx1={5}, NominalFlow={6}",
Name,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
Shape,
X,
Y,
Idx1,
NominalFlow);
}
@@ -5,6 +5,7 @@ using System;
using Config.Entities;
using TBF.BenchControl.Configs;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.FlowMeter
{
@@ -36,9 +37,9 @@ namespace TBF.BenchControl.Elde.FlowMeter
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
@@ -5,6 +5,7 @@ using System;
using Config.Entities;
using TBF.BenchControl.Configs;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.FlowMeterDewa
{
@@ -40,9 +41,9 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
flowmeterComboBox2.Items.Add("---");
flowmeterComboBox3.Items.Add("---");
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.FlowMeterTriplet
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.FlowMeterTwins
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
parentDlg = ParentForm as ComponentParametersDlg;
if (parentDlg == null) return;
if (parentDlg.TbfComponents != null)
if (parentDlg.CmpntEntities != null)
{
foreach (var cmpnt in parentDlg.TbfComponents)
foreach (var cmpnt in parentDlg.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
@@ -11,13 +11,13 @@ using TBF.Resources;
namespace TBF.BenchControl.Elde.PressureMeter
{
public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItemCmpnt
public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItCmpnt
{
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 SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return pressureMeterCfg as SchematicDrawing.IDrawingItemCfg; } }
public SchematicDrawing.IDrawingItem DrawingItem { get { return pressureMeterCfg as SchematicDrawing.IDrawingItem; } }
public readonly ControlBoardDev ControlBoard;
@@ -6,11 +6,12 @@ using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Config.Entities;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.PressureMeter
{
public class PressureMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg, SchematicDrawing.IDrawingItemCfg
public class PressureMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg, IDrawingItem
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PressureMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -30,39 +31,40 @@ namespace TBF.BenchControl.Elde.PressureMeter
public DateTime CalibValidDate { get; set; }
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
PressureMeterCfg()
{
GNodes = new List<GNode>();
}
public PressureMeterCfg(IComponentFactory factory)
: this()
{
Shape = Shape.PressM;
Sz = Sz.M;
Factory = factory;
Name = "Pr";
Shape = SchematicDrawing.Shape.PressM;
ParentName = "CB";
Idx0 = 0;
Protocol = MeretProtocol.Modbus;
RS485Address = 99;
}
public PressureMeterCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.PressureMeter
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.PressureMeter
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
@@ -10,13 +10,13 @@ using TBF.Resources;
namespace TBF.BenchControl.Elde.PressureMeterInternal
{
public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItemCmpnt
public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItCmpnt
{
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 SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return pressureMeterCfg as SchematicDrawing.IDrawingItemCfg; } }
public SchematicDrawing.IDrawingItem DrawingItem { get { return pressureMeterCfg as SchematicDrawing.IDrawingItem; } }
public readonly ControlBoardDev ControlBoard;
@@ -5,11 +5,12 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.PressureMeterInternal
{
public class PressureMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg, SchematicDrawing.IDrawingItemCfg
public class PressureMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg, IDrawingItem
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PressureMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -33,43 +34,44 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
public DateTime CalibValidDate { get; set; }
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
PressureMeterCfg()
{
GNodes = new List<GNode>();
}
public PressureMeterCfg(IComponentFactory factory)
: this()
{
Shape = Shape.PressM;
Sz = Sz.M;
Factory = factory;
Name = "Pr";
Shape = SchematicDrawing.Shape.PressM;
ParentName = "CB";
Idx0 = 0;
CoefsIdx0 = 0;
A1 = 0;
CoefsIdx0 = 0;
A1 = 0;
A2 = 0;
A3 = 0;
A4 = 0;
A5 = 0;
}
public PressureMeterCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.PressureMeterInternal
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
+38 -9
View File
@@ -3,19 +3,20 @@
///
using System;
using System.Collections.Generic;
using Dirichlet.Numerics;
using log4net;
using Dirichlet.Numerics;
using SchematicDrawing;
using TBF.BenchControl.ControlBoard.Legacy;
namespace TBF.BenchControl.Elde.PumpWithFM
{
public class Pump : ComponentBase, GenericDevices.IPumpFM, GenericDevices.IValve, IOperation, SchematicDrawing.IDrawingItemCmpnt
public class Pump : ComponentBase, GenericDevices.IPumpFM, GenericDevices.IValve, IOperation, IDrawingItCmpntWithSetpoint
{
private static readonly ILog log = LogManager.GetLogger(typeof(Pump));
public override string ToString() { return string.Format("PumpWithFM({0})", Cfg.ToString(1)); }
readonly PumpCfg pumpCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return pumpCfg as SchematicDrawing.IDrawingItemCfg; } }
public IDrawingItem DrawingItem { get { return pumpCfg as IDrawingItem; } }
public int Delay { get { return pumpCfg.Delay; } }
public ValveCategory Category { get { return ValveCategory.Feeding; } } /// Pump category is Feeding
@@ -39,10 +40,38 @@ namespace TBF.BenchControl.Elde.PumpWithFM
/// Pump power in [%] in range 0 .. 100.0f
/// </summary>
private float power;
public float Power
{
get { return power; }
}
public float Power { get { return power; } }
///
public double SetpointVal
{
get { return power; }
set
{
power = (float)value;
if (power != 0) TurnOn(power);
}
}
///
public void IncreaseSetpoint()
{
power += 0.05f;
if (power > 100.0f) power = 100.0f;
TurnOn(power);
}
///
public void DecreaseSetpoint()
{
power -= 0.05f;
if (power <= 0)
{
power = 0;
TurnOff();
}
else
{
TurnOn(power);
}
}
public Pump()
@@ -62,8 +91,8 @@ namespace TBF.BenchControl.Elde.PumpWithFM
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
bitPosition = pumpCfg.BitPosition;
Mask = (((UInt128)1) << pumpCfg.BitPosition);
bitPosition = pumpCfg.BitNr;
Mask = (((UInt128)1) << pumpCfg.BitNr);
FMIndex = pumpCfg.FMIndex;
log.Debug(this.ToString());
+34 -21
View File
@@ -1,14 +1,15 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System.IO;
using System.Collections.Generic;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.PumpWithFM
{
public class PumpCfg : ComponentCfgBase, IChildComponentCfg, SchematicDrawing.IDrawingItemCfg
public class PumpCfg : ComponentCfgBase, IChildComponentCfg, IRouteBasedDrawingItem, IDrawingItemWithSetpoint
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PumpCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -18,51 +19,63 @@ namespace TBF.BenchControl.Elde.PumpWithFM
///
/// Serialized parameters
///
public int BitPosition;
public int BitNr { get; set; }
public bool Inverted { get; set; } /// When true the pump function is inverted: 0 = on, 1 = off
public int FMIndex;
public int Delay;
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
public int SetpX { get; set; }
public int SetpY { get; set; }
public Orient SetpOrient { get; set; }
public string SetpFormat { get; set; }
public Config.Unit SetpUnits { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
[XmlIgnore]
public IList<GEdge> EdgesToSet { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
PumpCfg()
{
Name = "P";
Shape = SchematicDrawing.Shape.PumpFM;
ParentName = "CB";
BitPosition = 0;
FMIndex = 0;
Delay = 1;
GNodes = new List<GNode>();
EdgesToSet = new List<GEdge>();
}
public PumpCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
Shape = Shape.PumpFM;
Sz = Sz.M;
SetpFormat = "{0:F0} %";
SetpUnits = Config.Unit.Pct;
Name = "P";
Factory = factory;
ParentName = "CB";
BitNr = 0;
FMIndex = 0;
Delay = 1;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
return string.Format("Name={0}, Parent={1}, Bit={2}, FMIndex={3}, Delay={4}",
Name,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
BitPosition,
BitNr,
FMIndex,
Delay);
}
+54 -7
View File
@@ -42,12 +42,16 @@ namespace TBF.BenchControl.Elde.PumpWithFM
this.fmIndexLabel = new System.Windows.Forms.Label();
this.delayTextBox = new System.Windows.Forms.TextBox();
this.delayLabel = new System.Windows.Forms.Label();
this.unitsComboBox = new System.Windows.Forms.ComboBox();
this.unitsLabel = new System.Windows.Forms.Label();
this.formatTextBox = new System.Windows.Forms.TextBox();
this.formatLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// bitPositionTextBox
//
this.bitPositionTextBox.Enabled = false;
this.bitPositionTextBox.Location = new System.Drawing.Point(122, 99);
this.bitPositionTextBox.Location = new System.Drawing.Point(146, 99);
this.bitPositionTextBox.Name = "bitPositionTextBox";
this.bitPositionTextBox.Size = new System.Drawing.Size(46, 20);
this.bitPositionTextBox.TabIndex = 6;
@@ -73,7 +77,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(122, 47);
this.nameTextBox.Location = new System.Drawing.Point(146, 47);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 2;
@@ -90,7 +94,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(119, 21);
this.classNameLabel.Location = new System.Drawing.Point(143, 21);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
@@ -100,7 +104,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(122, 73);
this.parentNameComboBox.Location = new System.Drawing.Point(146, 73);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
this.parentNameComboBox.TabIndex = 4;
@@ -108,7 +112,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
// fmIndexTextBox
//
this.fmIndexTextBox.Enabled = false;
this.fmIndexTextBox.Location = new System.Drawing.Point(122, 124);
this.fmIndexTextBox.Location = new System.Drawing.Point(146, 124);
this.fmIndexTextBox.Name = "fmIndexTextBox";
this.fmIndexTextBox.Size = new System.Drawing.Size(46, 20);
this.fmIndexTextBox.TabIndex = 8;
@@ -125,7 +129,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
// delayTextBox
//
this.delayTextBox.Enabled = false;
this.delayTextBox.Location = new System.Drawing.Point(122, 149);
this.delayTextBox.Location = new System.Drawing.Point(146, 149);
this.delayTextBox.Name = "delayTextBox";
this.delayTextBox.Size = new System.Drawing.Size(46, 20);
this.delayTextBox.TabIndex = 10;
@@ -139,10 +143,49 @@ namespace TBF.BenchControl.Elde.PumpWithFM
this.delayLabel.TabIndex = 9;
this.delayLabel.Text = "Delay [s]";
//
// unitsComboBox
//
this.unitsComboBox.Enabled = false;
this.unitsComboBox.FormattingEnabled = true;
this.unitsComboBox.Location = new System.Drawing.Point(146, 201);
this.unitsComboBox.Name = "unitsComboBox";
this.unitsComboBox.Size = new System.Drawing.Size(80, 21);
this.unitsComboBox.TabIndex = 32;
//
// unitsLabel
//
this.unitsLabel.AutoSize = true;
this.unitsLabel.Location = new System.Drawing.Point(36, 204);
this.unitsLabel.Name = "unitsLabel";
this.unitsLabel.Size = new System.Drawing.Size(71, 13);
this.unitsLabel.TabIndex = 31;
this.unitsLabel.Text = "Setpoint units";
//
// formatTextBox
//
this.formatTextBox.Enabled = false;
this.formatTextBox.Location = new System.Drawing.Point(146, 175);
this.formatTextBox.Name = "formatTextBox";
this.formatTextBox.Size = new System.Drawing.Size(130, 20);
this.formatTextBox.TabIndex = 30;
//
// formatLabel
//
this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(36, 178);
this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(78, 13);
this.formatLabel.TabIndex = 29;
this.formatLabel.Text = "Setpoint format";
//
// PumpCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.unitsComboBox);
this.Controls.Add(this.unitsLabel);
this.Controls.Add(this.formatTextBox);
this.Controls.Add(this.formatLabel);
this.Controls.Add(this.delayTextBox);
this.Controls.Add(this.delayLabel);
this.Controls.Add(this.fmIndexTextBox);
@@ -155,7 +198,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "PumpCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Size = new System.Drawing.Size(400, 250);
this.Load += new System.EventHandler(this.PumpCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
@@ -175,5 +218,9 @@ namespace TBF.BenchControl.Elde.PumpWithFM
private System.Windows.Forms.Label fmIndexLabel;
private System.Windows.Forms.TextBox delayTextBox;
private System.Windows.Forms.Label delayLabel;
private System.Windows.Forms.ComboBox unitsComboBox;
private System.Windows.Forms.Label unitsLabel;
private System.Windows.Forms.TextBox formatTextBox;
private System.Windows.Forms.Label formatLabel;
}
}
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.PumpWithFM
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.PumpWithFM
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
@@ -46,6 +47,14 @@ namespace TBF.BenchControl.Elde.PumpWithFM
}
}
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (global::Config.Units.IsQuantity(units, global::Config.Quantity.Error))
{
unitsComboBox.Items.Add(units.ToString());
}
}
Redraw();
}
@@ -60,9 +69,11 @@ namespace TBF.BenchControl.Elde.PumpWithFM
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
bitPositionTextBox.Text = config.BitPosition.ToString();
bitPositionTextBox.Text = config.BitNr.ToString();
fmIndexTextBox.Text = config.FMIndex.ToString();
delayTextBox.Text = config.Delay.ToString();
formatTextBox.Text = config.SetpFormat;
unitsComboBox.Text = config.SetpUnits.ToString();
}
public void Unlock()
@@ -72,6 +83,8 @@ namespace TBF.BenchControl.Elde.PumpWithFM
bitPositionTextBox.Enabled = true;
fmIndexTextBox.Enabled = true;
delayTextBox.Enabled = true;
formatTextBox.Enabled = true;
unitsComboBox.Enabled = true;
}
public CfgUpdateFlags UpdateCfg()
@@ -82,9 +95,19 @@ namespace TBF.BenchControl.Elde.PumpWithFM
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.BitPosition = int.Parse(bitPositionTextBox.Text);
config.BitNr = int.Parse(bitPositionTextBox.Text);
config.FMIndex = int.Parse(fmIndexTextBox.Text);
config.Delay = int.Parse(delayTextBox.Text);
config.SetpFormat = formatTextBox.Text;
config.SetpUnits = global::Config.Unit.None;
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (unitsComboBox.Text == units.ToString())
{
config.SetpUnits = units;
break;
}
}
return flags;
}
@@ -114,6 +137,11 @@ namespace TBF.BenchControl.Elde.PumpWithFM
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Delay' should be between 0 and 300s (5min)";
}
if (!unitsComboBox.Items.Contains(unitsComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Units'";
}
return flags;
}
}
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.RegisterReader
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.RegisterReader
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
+20 -2
View File
@@ -4,20 +4,21 @@
using System;
using System.Collections.Generic;
using log4net;
using SchematicDrawing;
using TBF.BenchControl.ControlBoard.Legacy;
using TBF.BenchControl.Generic;
using TBF.Boxes;
namespace TBF.BenchControl.Elde.RegulValve
{
public class RegulValve : ComponentBase, IDevice, GenericDevices.IRegulValve, SchematicDrawing.IDrawingItemCmpnt
public class RegulValve : ComponentBase, IDevice, GenericDevices.IRegulValve, IDrawingItCmpntWithSetpoint
{
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
public readonly RegulValveCfg RegulValveCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return RegulValveCfg as SchematicDrawing.IDrawingItemCfg; } }
public IDrawingItem DrawingItem { get { return RegulValveCfg as IDrawingItem; } }
IDictionary<double, float> dict;
public IDictionary<double, float> Dict { get { return dict; } }
@@ -35,6 +36,23 @@ namespace TBF.BenchControl.Elde.RegulValve
///
public float Position { get { return ControlBoard.RValvePosition(Idx1); } }
///
public double SetpointVal
{
get { return (double)ControlBoard.RValvePosition(Idx1); }
set { } // TODO
}
///
public void IncreaseSetpoint()
{
/// TODO
}
///
public void DecreaseSetpoint()
{
/// TODO
}
int adcChannel;
@@ -1,15 +1,16 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.RegulValve
{
public class RegulValveCfg : ComponentCfgBase, IChildComponentCfg, SchematicDrawing.IDrawingItemCfg
public class RegulValveCfg : ComponentCfgBase, IChildComponentCfg, IDrawingItemWithSetpoint
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RegulValveCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -29,21 +30,24 @@ namespace TBF.BenchControl.Elde.RegulValve
public bool ReTryCommands;
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
public int SetpX { get; set; }
public int SetpY { get; set; }
public Orient SetpOrient { get; set; }
public string SetpFormat { get; set; }
public Config.Unit SetpUnits { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
/// <summary>
/// Stabilization time when setting the flow: 0=200ms, step 50ms, max. 1.5 sec.
/// </summary>
@@ -52,13 +56,18 @@ namespace TBF.BenchControl.Elde.RegulValve
/// Private parameterless constructor invoked by all other (public) constructors
RegulValveCfg()
{
GNodes = new List<GNode>();
}
public RegulValveCfg(string name, IComponentFactory factory)
: this()
{
Shape = Shape.RegV;
Sz = Sz.M;
SetpFormat = "{0:F0} %";
SetpUnits = Config.Unit.Pct;
Name = name;
Shape = SchematicDrawing.Shape.RegV;
Factory = factory;
ParentName = "CB";
Category = ValveCategory.Output;
@@ -71,7 +80,7 @@ namespace TBF.BenchControl.Elde.RegulValve
ReTryCommands = false;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
@@ -70,6 +70,10 @@ namespace TBF.BenchControl.Elde.RegulValve
this.categoryComboBox = new System.Windows.Forms.ComboBox();
this.categoryLabel = new System.Windows.Forms.Label();
this.reTryCommandsCheckBox = new System.Windows.Forms.CheckBox();
this.unitsComboBox = new System.Windows.Forms.ComboBox();
this.unitsLabel = new System.Windows.Forms.Label();
this.formatTextBox = new System.Windows.Forms.TextBox();
this.formatLabel = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
@@ -436,10 +440,49 @@ namespace TBF.BenchControl.Elde.RegulValve
this.reTryCommandsCheckBox.Text = "Re-try commands";
this.reTryCommandsCheckBox.UseVisualStyleBackColor = true;
//
// unitsComboBox
//
this.unitsComboBox.Enabled = false;
this.unitsComboBox.FormattingEnabled = true;
this.unitsComboBox.Location = new System.Drawing.Point(138, 309);
this.unitsComboBox.Name = "unitsComboBox";
this.unitsComboBox.Size = new System.Drawing.Size(80, 21);
this.unitsComboBox.TabIndex = 32;
//
// unitsLabel
//
this.unitsLabel.AutoSize = true;
this.unitsLabel.Location = new System.Drawing.Point(28, 312);
this.unitsLabel.Name = "unitsLabel";
this.unitsLabel.Size = new System.Drawing.Size(71, 13);
this.unitsLabel.TabIndex = 31;
this.unitsLabel.Text = "Setpoint units";
//
// formatTextBox
//
this.formatTextBox.Enabled = false;
this.formatTextBox.Location = new System.Drawing.Point(138, 285);
this.formatTextBox.Name = "formatTextBox";
this.formatTextBox.Size = new System.Drawing.Size(130, 20);
this.formatTextBox.TabIndex = 30;
//
// formatLabel
//
this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(28, 288);
this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(78, 13);
this.formatLabel.TabIndex = 29;
this.formatLabel.Text = "Setpoint format";
//
// RegulValveCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.unitsComboBox);
this.Controls.Add(this.unitsLabel);
this.Controls.Add(this.formatTextBox);
this.Controls.Add(this.formatLabel);
this.Controls.Add(this.reTryCommandsCheckBox);
this.Controls.Add(this.categoryComboBox);
this.Controls.Add(this.categoryLabel);
@@ -519,5 +562,9 @@ namespace TBF.BenchControl.Elde.RegulValve
private System.Windows.Forms.ComboBox categoryComboBox;
private System.Windows.Forms.Label categoryLabel;
private System.Windows.Forms.CheckBox reTryCommandsCheckBox;
private System.Windows.Forms.ComboBox unitsComboBox;
private System.Windows.Forms.Label unitsLabel;
private System.Windows.Forms.TextBox formatTextBox;
private System.Windows.Forms.Label formatLabel;
}
}
@@ -1,11 +1,12 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.RegulValve
{
@@ -38,9 +39,9 @@ namespace TBF.BenchControl.Elde.RegulValve
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
@@ -61,6 +62,14 @@ namespace TBF.BenchControl.Elde.RegulValve
pct2 = 100;
}
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (global::Config.Units.IsQuantity(units, global::Config.Quantity.Error))
{
unitsComboBox.Items.Add(units.ToString());
}
}
Redraw();
StartResponseHandler();
}
@@ -85,6 +94,8 @@ namespace TBF.BenchControl.Elde.RegulValve
flowStableSecTextBox.Text = config.FlowStableSec.ToString();
storedPosReuseCheckBox.Checked = config.StoredPositionReuse;
reTryCommandsCheckBox.Checked = config.ReTryCommands;
formatTextBox.Text = config.SetpFormat;
unitsComboBox.Text = config.SetpUnits.ToString();
adcTextBox1.Text = adc1.ToString();
adcTextBox2.Text = adc2.ToString();
@@ -104,6 +115,8 @@ namespace TBF.BenchControl.Elde.RegulValve
flowStableSecTextBox.Enabled = true;
storedPosReuseCheckBox.Enabled = true;
reTryCommandsCheckBox.Enabled = true;
formatTextBox.Enabled = true;
unitsComboBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
@@ -155,6 +168,12 @@ namespace TBF.BenchControl.Elde.RegulValve
message += Environment.NewLine + "'Flow stable' should be between 0 and 60 sec";
}
if (!unitsComboBox.Items.Contains(unitsComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Units'";
}
return flags;
}
@@ -243,6 +262,17 @@ namespace TBF.BenchControl.Elde.RegulValve
RegulValve.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
}
config.SetpFormat = formatTextBox.Text;
config.SetpUnits = global::Config.Unit.None;
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (unitsComboBox.Text == units.ToString())
{
config.SetpUnits = units;
break;
}
}
return flags;
}
@@ -4,19 +4,20 @@
using System;
using System.Collections.Generic;
using log4net;
using SchematicDrawing;
using TBF.BenchControl.ControlBoard.Legacy;
using TBF.Boxes;
namespace TBF.BenchControl.Elde.RegulValveCoax
{
public class RegulValve : ComponentBase, GenericDevices.IRegulValve, SchematicDrawing.IDrawingItemCmpnt
public class RegulValve : ComponentBase, GenericDevices.IRegulValve, IDrawingItCmpntWithSetpoint
{
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
public readonly RegulValveCfg RegulValveCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return RegulValveCfg as SchematicDrawing.IDrawingItemCfg; } }
public IDrawingItem DrawingItem { get { return RegulValveCfg as IDrawingItem; } }
IDictionary<double, float> dict;
public IDictionary<double, float> Dict { get { return dict; } }
@@ -31,6 +32,22 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
public bool IsCoax { get { return true; } }
///
public float Position { get { return ControlBoard.RValvePosition(Idx1); } }
///
public double SetpointVal
{
get { return (double)ControlBoard.RValvePosition(Idx1); }
set { } // TODO
}
///
public void IncreaseSetpoint()
{
/// TODO
}
///
public void DecreaseSetpoint()
{
/// TODO
}
public RegulValve()
@@ -1,15 +1,16 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.RegulValveCoax
{
public class RegulValveCfg : ComponentCfgBase, IChildComponentCfg, SchematicDrawing.IDrawingItemCfg
public class RegulValveCfg : ComponentCfgBase, IChildComponentCfg, IDrawingItemWithSetpoint
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RegulValveCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -27,20 +28,23 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
public bool ReTryCommands;
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
public int SetpX { get; set; }
public int SetpY { get; set; }
public Orient SetpOrient { get; set; }
public string SetpFormat { get; set; }
public Config.Unit SetpUnits { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
/// <summary>
/// Stabilization time when setting the flow: 0=200ms, step 50ms, max. 1.5 sec.
@@ -50,13 +54,18 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
/// Private parameterless constructor invoked by all other (public) constructors
RegulValveCfg()
{
GNodes = new List<GNode>();
}
public RegulValveCfg(string name, IComponentFactory factory)
: this()
{
Shape = Shape.RegV;
Sz = Sz.M;
SetpFormat = "{0:F0} %";
SetpUnits = Config.Unit.Pct;
Name = name;
Shape = SchematicDrawing.Shape.RegV;
Factory = factory;
ParentName = "CB";
Category = ValveCategory.Output;
@@ -67,7 +76,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
ReTryCommands = false;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
@@ -31,219 +31,262 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
/// </summary>
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.parentNameComboBox = new System.Windows.Forms.ComboBox();
this.storedPosReuseCheckBox = new System.Windows.Forms.CheckBox();
this.stableTimeTextBox = new System.Windows.Forms.TextBox();
this.stableTimeLabel = new System.Windows.Forms.Label();
this.flowStableSecTextBox = new System.Windows.Forms.TextBox();
this.flowStableSecLabel = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.closeButton = new System.Windows.Forms.Button();
this.openButton = new System.Windows.Forms.Button();
this.categoryComboBox = new System.Windows.Forms.ComboBox();
this.categoryLabel = new System.Windows.Forms.Label();
this.reTryCommandsCheckBox = new System.Windows.Forms.CheckBox();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// positionTextBox
//
this.positionTextBox.Enabled = false;
this.positionTextBox.Location = new System.Drawing.Point(138, 115);
this.positionTextBox.Name = "positionTextBox";
this.positionTextBox.Size = new System.Drawing.Size(46, 20);
this.positionTextBox.TabIndex = 8;
//
// positionLabel
//
this.positionLabel.AutoSize = true;
this.positionLabel.Location = new System.Drawing.Point(28, 118);
this.positionLabel.Name = "positionLabel";
this.positionLabel.Size = new System.Drawing.Size(18, 13);
this.positionLabel.TabIndex = 7;
this.positionLabel.Text = "ID";
//
// parentNameLabel
//
this.parentNameLabel.AutoSize = true;
this.parentNameLabel.Location = new System.Drawing.Point(28, 68);
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(138, 41);
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(28, 44);
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(135, 14);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(89, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComponentName";
//
// parentNameComboBox
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(138, 65);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
this.parentNameComboBox.TabIndex = 4;
//
// storedPosReuseCheckBox
//
this.storedPosReuseCheckBox.AutoSize = true;
this.storedPosReuseCheckBox.Enabled = false;
this.storedPosReuseCheckBox.Location = new System.Drawing.Point(31, 192);
this.storedPosReuseCheckBox.Name = "storedPosReuseCheckBox";
this.storedPosReuseCheckBox.Size = new System.Drawing.Size(162, 17);
this.storedPosReuseCheckBox.TabIndex = 17;
this.storedPosReuseCheckBox.Text = "Enable stored position re-use";
this.storedPosReuseCheckBox.UseVisualStyleBackColor = true;
//
// stableTimeTextBox
//
this.stableTimeTextBox.Enabled = false;
this.stableTimeTextBox.Location = new System.Drawing.Point(138, 139);
this.stableTimeTextBox.Name = "stableTimeTextBox";
this.stableTimeTextBox.Size = new System.Drawing.Size(46, 20);
this.stableTimeTextBox.TabIndex = 14;
//
// stableTimeLabel
//
this.stableTimeLabel.AutoSize = true;
this.stableTimeLabel.Location = new System.Drawing.Point(28, 142);
this.stableTimeLabel.Name = "stableTimeLabel";
this.stableTimeLabel.Size = new System.Drawing.Size(81, 13);
this.stableTimeLabel.TabIndex = 13;
this.stableTimeLabel.Text = "Stable time [ms]";
//
// flowStableSecTextBox
//
this.flowStableSecTextBox.Enabled = false;
this.flowStableSecTextBox.Location = new System.Drawing.Point(138, 163);
this.flowStableSecTextBox.Name = "flowStableSecTextBox";
this.flowStableSecTextBox.Size = new System.Drawing.Size(46, 20);
this.flowStableSecTextBox.TabIndex = 16;
//
// flowStableSecLabel
//
this.flowStableSecLabel.AutoSize = true;
this.flowStableSecLabel.Location = new System.Drawing.Point(28, 166);
this.flowStableSecLabel.Name = "flowStableSecLabel";
this.flowStableSecLabel.Size = new System.Drawing.Size(74, 13);
this.flowStableSecLabel.TabIndex = 15;
this.flowStableSecLabel.Text = "Flow stable [s]";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.closeButton);
this.groupBox3.Controls.Add(this.openButton);
this.groupBox3.Location = new System.Drawing.Point(10, 527);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(280, 60);
this.groupBox3.TabIndex = 21;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Regulation valve";
//
// closeButton
//
this.closeButton.Location = new System.Drawing.Point(14, 19);
this.closeButton.Name = "closeButton";
this.closeButton.Size = new System.Drawing.Size(107, 28);
this.closeButton.TabIndex = 1;
this.closeButton.Text = "Close";
this.closeButton.UseVisualStyleBackColor = true;
this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
//
// openButton
//
this.openButton.Location = new System.Drawing.Point(160, 19);
this.openButton.Name = "openButton";
this.openButton.Size = new System.Drawing.Size(107, 28);
this.openButton.TabIndex = 0;
this.openButton.Text = "Open";
this.openButton.UseVisualStyleBackColor = true;
this.openButton.Click += new System.EventHandler(this.openButton_Click);
//
// categoryComboBox
//
this.categoryComboBox.Enabled = false;
this.categoryComboBox.FormattingEnabled = true;
this.categoryComboBox.Location = new System.Drawing.Point(138, 90);
this.categoryComboBox.Name = "categoryComboBox";
this.categoryComboBox.Size = new System.Drawing.Size(130, 21);
this.categoryComboBox.TabIndex = 6;
//
// categoryLabel
//
this.categoryLabel.AutoSize = true;
this.categoryLabel.Location = new System.Drawing.Point(28, 93);
this.categoryLabel.Name = "categoryLabel";
this.categoryLabel.Size = new System.Drawing.Size(49, 13);
this.categoryLabel.TabIndex = 5;
this.categoryLabel.Text = "Category";
//
// reTryCommandsCheckBox
//
this.reTryCommandsCheckBox.AutoSize = true;
this.reTryCommandsCheckBox.Enabled = false;
this.reTryCommandsCheckBox.Location = new System.Drawing.Point(31, 215);
this.reTryCommandsCheckBox.Name = "reTryCommandsCheckBox";
this.reTryCommandsCheckBox.Size = new System.Drawing.Size(108, 17);
this.reTryCommandsCheckBox.TabIndex = 18;
this.reTryCommandsCheckBox.Text = "Re-try commands";
this.reTryCommandsCheckBox.UseVisualStyleBackColor = true;
//
// RegulValveCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.reTryCommandsCheckBox);
this.Controls.Add(this.categoryComboBox);
this.Controls.Add(this.categoryLabel);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.flowStableSecTextBox);
this.Controls.Add(this.flowStableSecLabel);
this.Controls.Add(this.stableTimeTextBox);
this.Controls.Add(this.stableTimeLabel);
this.Controls.Add(this.storedPosReuseCheckBox);
this.Controls.Add(this.parentNameComboBox);
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 = "RegulValveCfgCtrl";
this.Size = new System.Drawing.Size(300, 700);
this.Load += new System.EventHandler(this.RegulationValveCfgCtrl_Load);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
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.parentNameComboBox = new System.Windows.Forms.ComboBox();
this.storedPosReuseCheckBox = new System.Windows.Forms.CheckBox();
this.stableTimeTextBox = new System.Windows.Forms.TextBox();
this.stableTimeLabel = new System.Windows.Forms.Label();
this.flowStableSecTextBox = new System.Windows.Forms.TextBox();
this.flowStableSecLabel = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.closeButton = new System.Windows.Forms.Button();
this.openButton = new System.Windows.Forms.Button();
this.categoryComboBox = new System.Windows.Forms.ComboBox();
this.categoryLabel = new System.Windows.Forms.Label();
this.reTryCommandsCheckBox = new System.Windows.Forms.CheckBox();
this.unitsComboBox = new System.Windows.Forms.ComboBox();
this.unitsLabel = new System.Windows.Forms.Label();
this.formatTextBox = new System.Windows.Forms.TextBox();
this.formatLabel = new System.Windows.Forms.Label();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// positionTextBox
//
this.positionTextBox.Enabled = false;
this.positionTextBox.Location = new System.Drawing.Point(138, 115);
this.positionTextBox.Name = "positionTextBox";
this.positionTextBox.Size = new System.Drawing.Size(46, 20);
this.positionTextBox.TabIndex = 8;
//
// positionLabel
//
this.positionLabel.AutoSize = true;
this.positionLabel.Location = new System.Drawing.Point(28, 118);
this.positionLabel.Name = "positionLabel";
this.positionLabel.Size = new System.Drawing.Size(18, 13);
this.positionLabel.TabIndex = 7;
this.positionLabel.Text = "ID";
//
// parentNameLabel
//
this.parentNameLabel.AutoSize = true;
this.parentNameLabel.Location = new System.Drawing.Point(28, 68);
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(138, 41);
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(28, 44);
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(135, 14);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(89, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComponentName";
//
// parentNameComboBox
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(138, 65);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
this.parentNameComboBox.TabIndex = 4;
//
// storedPosReuseCheckBox
//
this.storedPosReuseCheckBox.AutoSize = true;
this.storedPosReuseCheckBox.Enabled = false;
this.storedPosReuseCheckBox.Location = new System.Drawing.Point(31, 192);
this.storedPosReuseCheckBox.Name = "storedPosReuseCheckBox";
this.storedPosReuseCheckBox.Size = new System.Drawing.Size(162, 17);
this.storedPosReuseCheckBox.TabIndex = 17;
this.storedPosReuseCheckBox.Text = "Enable stored position re-use";
this.storedPosReuseCheckBox.UseVisualStyleBackColor = true;
//
// stableTimeTextBox
//
this.stableTimeTextBox.Enabled = false;
this.stableTimeTextBox.Location = new System.Drawing.Point(138, 139);
this.stableTimeTextBox.Name = "stableTimeTextBox";
this.stableTimeTextBox.Size = new System.Drawing.Size(46, 20);
this.stableTimeTextBox.TabIndex = 14;
//
// stableTimeLabel
//
this.stableTimeLabel.AutoSize = true;
this.stableTimeLabel.Location = new System.Drawing.Point(28, 142);
this.stableTimeLabel.Name = "stableTimeLabel";
this.stableTimeLabel.Size = new System.Drawing.Size(81, 13);
this.stableTimeLabel.TabIndex = 13;
this.stableTimeLabel.Text = "Stable time [ms]";
//
// flowStableSecTextBox
//
this.flowStableSecTextBox.Enabled = false;
this.flowStableSecTextBox.Location = new System.Drawing.Point(138, 163);
this.flowStableSecTextBox.Name = "flowStableSecTextBox";
this.flowStableSecTextBox.Size = new System.Drawing.Size(46, 20);
this.flowStableSecTextBox.TabIndex = 16;
//
// flowStableSecLabel
//
this.flowStableSecLabel.AutoSize = true;
this.flowStableSecLabel.Location = new System.Drawing.Point(28, 166);
this.flowStableSecLabel.Name = "flowStableSecLabel";
this.flowStableSecLabel.Size = new System.Drawing.Size(74, 13);
this.flowStableSecLabel.TabIndex = 15;
this.flowStableSecLabel.Text = "Flow stable [s]";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.closeButton);
this.groupBox3.Controls.Add(this.openButton);
this.groupBox3.Location = new System.Drawing.Point(10, 527);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(280, 60);
this.groupBox3.TabIndex = 21;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Regulation valve";
//
// closeButton
//
this.closeButton.Location = new System.Drawing.Point(14, 19);
this.closeButton.Name = "closeButton";
this.closeButton.Size = new System.Drawing.Size(107, 28);
this.closeButton.TabIndex = 1;
this.closeButton.Text = "Close";
this.closeButton.UseVisualStyleBackColor = true;
this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
//
// openButton
//
this.openButton.Location = new System.Drawing.Point(160, 19);
this.openButton.Name = "openButton";
this.openButton.Size = new System.Drawing.Size(107, 28);
this.openButton.TabIndex = 0;
this.openButton.Text = "Open";
this.openButton.UseVisualStyleBackColor = true;
this.openButton.Click += new System.EventHandler(this.openButton_Click);
//
// categoryComboBox
//
this.categoryComboBox.Enabled = false;
this.categoryComboBox.FormattingEnabled = true;
this.categoryComboBox.Location = new System.Drawing.Point(138, 90);
this.categoryComboBox.Name = "categoryComboBox";
this.categoryComboBox.Size = new System.Drawing.Size(130, 21);
this.categoryComboBox.TabIndex = 6;
//
// categoryLabel
//
this.categoryLabel.AutoSize = true;
this.categoryLabel.Location = new System.Drawing.Point(28, 93);
this.categoryLabel.Name = "categoryLabel";
this.categoryLabel.Size = new System.Drawing.Size(49, 13);
this.categoryLabel.TabIndex = 5;
this.categoryLabel.Text = "Category";
//
// reTryCommandsCheckBox
//
this.reTryCommandsCheckBox.AutoSize = true;
this.reTryCommandsCheckBox.Enabled = false;
this.reTryCommandsCheckBox.Location = new System.Drawing.Point(31, 215);
this.reTryCommandsCheckBox.Name = "reTryCommandsCheckBox";
this.reTryCommandsCheckBox.Size = new System.Drawing.Size(108, 17);
this.reTryCommandsCheckBox.TabIndex = 18;
this.reTryCommandsCheckBox.Text = "Re-try commands";
this.reTryCommandsCheckBox.UseVisualStyleBackColor = true;
//
// unitsComboBox
//
this.unitsComboBox.Enabled = false;
this.unitsComboBox.FormattingEnabled = true;
this.unitsComboBox.Location = new System.Drawing.Point(138, 264);
this.unitsComboBox.Name = "unitsComboBox";
this.unitsComboBox.Size = new System.Drawing.Size(80, 21);
this.unitsComboBox.TabIndex = 32;
//
// unitsLabel
//
this.unitsLabel.AutoSize = true;
this.unitsLabel.Location = new System.Drawing.Point(28, 267);
this.unitsLabel.Name = "unitsLabel";
this.unitsLabel.Size = new System.Drawing.Size(71, 13);
this.unitsLabel.TabIndex = 31;
this.unitsLabel.Text = "Setpoint units";
//
// formatTextBox
//
this.formatTextBox.Enabled = false;
this.formatTextBox.Location = new System.Drawing.Point(138, 240);
this.formatTextBox.Name = "formatTextBox";
this.formatTextBox.Size = new System.Drawing.Size(130, 20);
this.formatTextBox.TabIndex = 30;
//
// formatLabel
//
this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(28, 243);
this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(78, 13);
this.formatLabel.TabIndex = 29;
this.formatLabel.Text = "Setpoint format";
//
// RegulValveCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.unitsComboBox);
this.Controls.Add(this.unitsLabel);
this.Controls.Add(this.formatTextBox);
this.Controls.Add(this.formatLabel);
this.Controls.Add(this.reTryCommandsCheckBox);
this.Controls.Add(this.categoryComboBox);
this.Controls.Add(this.categoryLabel);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.flowStableSecTextBox);
this.Controls.Add(this.flowStableSecLabel);
this.Controls.Add(this.stableTimeTextBox);
this.Controls.Add(this.stableTimeLabel);
this.Controls.Add(this.storedPosReuseCheckBox);
this.Controls.Add(this.parentNameComboBox);
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 = "RegulValveCfgCtrl";
this.Size = new System.Drawing.Size(300, 700);
this.Load += new System.EventHandler(this.RegulationValveCfgCtrl_Load);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -267,5 +310,9 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
private System.Windows.Forms.ComboBox categoryComboBox;
private System.Windows.Forms.Label categoryLabel;
private System.Windows.Forms.CheckBox reTryCommandsCheckBox;
private System.Windows.Forms.ComboBox unitsComboBox;
private System.Windows.Forms.Label unitsLabel;
private System.Windows.Forms.TextBox formatTextBox;
private System.Windows.Forms.Label formatLabel;
}
}
@@ -1,10 +1,11 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.RegulValveCoax
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
@@ -50,6 +51,14 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
categoryComboBox.Items.Add(ValveCategory.Feeding.ToString());
categoryComboBox.Items.Add(ValveCategory.Output.ToString());
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (global::Config.Units.IsQuantity(units, global::Config.Quantity.Error))
{
unitsComboBox.Items.Add(units.ToString());
}
}
Redraw();
}
@@ -70,7 +79,9 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
flowStableSecTextBox.Text = config.FlowStableSec.ToString();
storedPosReuseCheckBox.Checked = config.StoredPositionReuse;
reTryCommandsCheckBox.Checked = config.ReTryCommands;
}
formatTextBox.Text = config.SetpFormat;
unitsComboBox.Text = config.SetpUnits.ToString();
}
public void Unlock()
{
@@ -82,6 +93,8 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
flowStableSecTextBox.Enabled = true;
storedPosReuseCheckBox.Enabled = true;
reTryCommandsCheckBox.Enabled = true;
formatTextBox.Enabled = true;
unitsComboBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
@@ -94,7 +107,6 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Parent Name'";
}
if (!categoryComboBox.Text.Equals(ValveCategory.All.ToString()) &&
!categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString()) &&
!categoryComboBox.Text.Equals(ValveCategory.Output.ToString()))
@@ -102,24 +114,26 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Category'";
}
if (!int.TryParse(positionTextBox.Text, out dummy) || dummy < 1 || dummy > 8)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Position' should be between 1 and 8";
}
if (!int.TryParse(stableTimeTextBox.Text, out dummy) || dummy < 200 || dummy > 1500 || (dummy % 50) != 0)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Stable time' should be between 200 and 1500 ms in 50 ms steps";
}
if (!int.TryParse(flowStableSecTextBox.Text, out dummy) || dummy < 0 || dummy > 60)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Flow stable' should be between 0 and 60 sec";
}
if (!unitsComboBox.Items.Contains(unitsComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Units'";
}
return flags;
}
@@ -189,6 +203,15 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
config.ReTryCommands = btmp;
flags |= CfgUpdateFlags.RestartRqrd;
}
config.SetpUnits = global::Config.Unit.None;
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (unitsComboBox.Text == units.ToString())
{
config.SetpUnits = units;
break;
}
}
return flags;
}
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.RegulValveTandem
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.RegulValve.RegulValveFactory)
{
+2 -2
View File
@@ -11,13 +11,13 @@ using TBF.Resources;
namespace TBF.BenchControl.Elde.TempMeter
{
public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItemCmpnt
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.IDrawingItemCfg DrawingItemCfg { get { return tempMtrCfg as SchematicDrawing.IDrawingItemCfg; } }
public SchematicDrawing.IDrawingItem DrawingItem { get { return tempMtrCfg as SchematicDrawing.IDrawingItem; } }
public readonly ControlBoardDev ControlBoard;
+29 -18
View File
@@ -5,11 +5,12 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.TempMeter
{
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg, SchematicDrawing.IDrawingItemCfg
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg, IDrawingItemWithMeasuredVal
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -36,21 +37,38 @@ namespace TBF.BenchControl.Elde.TempMeter
public SchematicDrawing.Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { 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 MsrdUnits { get; set; }
public string MsrdFormat { get; set; }
public double MsrdValLimLo { get; set; }
public double MsrdValLimHi { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
TempMeterCfg()
{
GNodes = new List<GNode>();
}
public TempMeterCfg(IComponentFactory factory)
: this()
{
Shape = Shape.TempM;
Sz = Sz.M;
MsrdUnits = Config.Unit.C;
MsrdFormat = "{0:F1} °C";
Factory = factory;
Name = "T";
ParentName = "CB";
Idx0 = 0;
@@ -59,17 +77,10 @@ namespace TBF.BenchControl.Elde.TempMeter
A3 = 0;
A4 = 0;
A5 = 0;
DefaultTemperature = 20.0;
Shape = SchematicDrawing.Shape.TempM;
DefaultTemperature = 20.0;
}
public TempMeterCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
@@ -6,6 +6,7 @@ using System.IO;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.TempMeter
{
@@ -38,9 +39,9 @@ namespace TBF.BenchControl.Elde.TempMeter
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
@@ -11,13 +11,13 @@ using TBF.Resources;
namespace TBF.BenchControl.Elde.TempMeterInternal
{
public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItemCmpnt
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.IDrawingItemCfg DrawingItemCfg { get { return tempMtrCfg as SchematicDrawing.IDrawingItemCfg; } }
public SchematicDrawing.IDrawingItem DrawingItem { get { return tempMtrCfg as SchematicDrawing.IDrawingItem; } }
public readonly ControlBoardDev ControlBoard;
@@ -1,16 +1,17 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// 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 SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.TempMeterInternal
{
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg, IDrawingItemWithMeasuredVal
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -34,39 +35,50 @@ namespace TBF.BenchControl.Elde.TempMeterInternal
public DateTime CalibValidDate { get; set; }
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { 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 MsrdUnits { get; set; }
public string MsrdFormat { get; set; }
public double MsrdValLimLo { get; set; }
public double MsrdValLimHi { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
TempMeterCfg()
{
Name = "T";
Shape = SchematicDrawing.Shape.TempM;
ParentName = "CB";
Idx0 = 0;
CoefsIdx0 = 2;
A1 = 0;
A2 = 0;
A3 = 0;
A4 = 0;
A5 = 0;
GNodes = new List<GNode>();
}
public TempMeterCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
Shape = Shape.TempM;
Sz = Sz.M;
MsrdUnits = 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)
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Elde.TempMeterInternal
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Elde.TempMeterInternal
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
@@ -10,14 +10,14 @@ using TBF.Resources;
namespace TBF.BenchControl.Elde.TempMeterMeret
{
public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItemCmpnt
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.IDrawingItemCfg DrawingItemCfg { get { return tempMtrCfg as SchematicDrawing.IDrawingItemCfg; } }
public SchematicDrawing.IDrawingItem DrawingItem { get { return tempMtrCfg as SchematicDrawing.IDrawingItem; } }
public readonly ControlBoardDev ControlBoard;
@@ -6,11 +6,12 @@ using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Config.Entities;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.TempMeterMeret
{
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, Config.Entities.IParamsProvider, TBF.BenchControl.GenericDevices.ICalibInfoCfg
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, Config.Entities.IParamsProvider, TBF.BenchControl.GenericDevices.ICalibInfoCfg, IDrawingItemWithMeasuredVal
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -47,34 +48,45 @@ namespace TBF.BenchControl.Elde.TempMeterMeret
public DateTime CalibValidDate { get; set; }
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { 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 MsrdUnits { get; set; }
public string MsrdFormat { get; set; }
public double MsrdValLimLo { get; set; }
public double MsrdValLimHi { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
TempMeterCfg()
{
Name = "T";
ParentName = "CB";
Shape = SchematicDrawing.Shape.TempM;
GNodes = new List<GNode>();
}
public TempMeterCfg(IComponentFactory factory)
: this()
{
Shape = Shape.TempM;
Sz = Sz.M;
MsrdUnits = Config.Unit.C;
MsrdFormat = "{0:F1} °C";
Factory = factory;
Name = "T";
ParentName = "CB";
Name = "T";
ParentName = "CB";
InitializeAll();
}
@@ -11,13 +11,13 @@ using TBF.Resources;
namespace TBF.BenchControl.Keithley.TempMeter
{
public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItemCmpnt
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("Keithley.TempMeter({0})", Cfg.ToString(1)); }
readonly TempMeterCfg tempMtrCfg; /// configuration
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return tempMtrCfg as SchematicDrawing.IDrawingItemCfg; } }
public SchematicDrawing.IDrawingItem DrawingItem { get { return tempMtrCfg as SchematicDrawing.IDrawingItem; } }
public readonly Multimeter Multimeter; /// parent component
@@ -5,11 +5,12 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Keithley.TempMeter
{
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg, SchematicDrawing.IDrawingItemCfg
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg, IDrawingItemWithMeasuredVal
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -41,41 +42,51 @@ namespace TBF.BenchControl.Keithley.TempMeter
public DateTime CalibValidDate { get; set; }
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { 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 MsrdUnits { get; set; }
public string MsrdFormat { get; set; }
public double MsrdValLimLo { get; set; }
public double MsrdValLimHi { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
TempMeterCfg()
{
GNodes = new List<GNode>();
}
public TempMeterCfg(string name, IComponentFactory factory)
: this()
{
this.Name = name;
this.Factory = factory;
Shape = Shape.TempM;
Sz = Sz.M;
MsrdUnits = Config.Unit.C;
MsrdFormat = "{0:F1} °C";
Name = name;
Factory = factory;
ParentName = "Keithley.Multimeter_2010_RS232";
Channel = 1;
UseITS90 = false;
R0 = 100.0;
A = 3.9083E-3;
B = -5.775E-7;
Shape = SchematicDrawing.Shape.TempM;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
@@ -6,6 +6,7 @@ using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Keithley.TempMeter
{
@@ -38,9 +39,9 @@ namespace TBF.BenchControl.Keithley.TempMeter
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Keithley.Multimeter_2010_RS232.Factory)
{
@@ -7,6 +7,7 @@ using System.Windows.Forms;
using System.IO.Ports;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.MettlerToledo.Multi
{
@@ -97,10 +98,10 @@ namespace TBF.BenchControl.MettlerToledo.Multi
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
drainValveComboBox.Items.Add("---");
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is BuiltIn.Valve.ValveFactory)
{
@@ -1,16 +1,17 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Collections.Generic;
using System.IO.Ports;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.MettlerToledo.Standard
{
public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg, GenericDevices.ITankDrainingCfg
public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg, GenericDevices.ITankDrainingCfg, IDrawingItemWithMeasuredVal
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(BalanceCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -33,8 +34,6 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public string DrainValve { get; set; }
public int DrainTimeSec { get; set; }
public string Evaporation { get; set; }
public string Format;
/// Buoyancy related serialized parameters displayed in Metrology tab page
public float BuoyancyTemp { get; set; }
@@ -48,24 +47,45 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public DateTime CalibValidDate { get; set; }
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
public int MsrdX { get; set; }
public int MsrdY { get; set; }
public Orient MsrdOrient { get; set; }
public string MsrdFormat { get; set; }
public Config.Unit MsrdUnits { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
[XmlIgnore]
public double MsrdValLimLo { get { return 0; } set { } }
[XmlIgnore]
public double MsrdValLimHi { get { return Capacity; } set { Capacity = (float)value; } }
/// Private parameterless constructor invoked by all other (public) constructors
BalanceCfg()
{
GNodes = new List<GNode>();
}
public BalanceCfg(IComponentFactory factory)
: this()
{
Shape = Shape.Scale;
Sz = Sz.M;
MsrdFormat = "{0:F3}";
MsrdUnits = Config.Unit.kg;
Factory = factory;
Name = "WT1";
ParentName = string.Empty;
ComPortNr = 3;
@@ -77,20 +97,14 @@ namespace TBF.BenchControl.MettlerToledo.Standard
Capacity = 200.0f;
Empty = 20.0f;
EmptyUp = 2.0f;
Format = "F3";
DrainValve = "VB1";
DrainTimeSec = 180;
DrainValve = "VB1";
DrainTimeSec = 180;
BuoyancyTemp = 20.0f;
BuoyancyPress = 1.0f;
BuoyancyHumi = 40.0f;
Shape = SchematicDrawing.Shape.Tank;
}
public BalanceCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
@@ -55,8 +55,6 @@ namespace TBF.BenchControl.MettlerToledo.Standard
this.label4 = new System.Windows.Forms.Label();
this.drainTimeTextBox = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.formatTextBox = new System.Windows.Forms.TextBox();
this.formatLabel = new System.Windows.Forms.Label();
this.drainValveComboBox = new System.Windows.Forms.ComboBox();
this.drainingValveLabel = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
@@ -64,6 +62,10 @@ namespace TBF.BenchControl.MettlerToledo.Standard
this.label7 = new System.Windows.Forms.Label();
this.evaporationComboBox = new System.Windows.Forms.ComboBox();
this.evaporationLabel = new System.Windows.Forms.Label();
this.unitsComboBox = new System.Windows.Forms.ComboBox();
this.unitsLabel = new System.Windows.Forms.Label();
this.formatTextBox = new System.Windows.Forms.TextBox();
this.formatLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// handshakeComboBox
@@ -275,23 +277,6 @@ namespace TBF.BenchControl.MettlerToledo.Standard
this.label5.TabIndex = 17;
this.label5.Text = "Drain time";
//
// formatTextBox
//
this.formatTextBox.Enabled = false;
this.formatTextBox.Location = new System.Drawing.Point(137, 50);
this.formatTextBox.Name = "formatTextBox";
this.formatTextBox.Size = new System.Drawing.Size(43, 20);
this.formatTextBox.TabIndex = 4;
//
// formatLabel
//
this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(26, 53);
this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(76, 13);
this.formatLabel.TabIndex = 3;
this.formatLabel.Text = "Decimal points";
//
// drainValveComboBox
//
this.drainValveComboBox.Enabled = false;
@@ -354,10 +339,49 @@ namespace TBF.BenchControl.MettlerToledo.Standard
this.evaporationLabel.TabIndex = 13;
this.evaporationLabel.Text = "Evaporation";
//
// unitsComboBox
//
this.unitsComboBox.Enabled = false;
this.unitsComboBox.FormattingEnabled = true;
this.unitsComboBox.Location = new System.Drawing.Point(137, 308);
this.unitsComboBox.Name = "unitsComboBox";
this.unitsComboBox.Size = new System.Drawing.Size(80, 21);
this.unitsComboBox.TabIndex = 35;
//
// unitsLabel
//
this.unitsLabel.AutoSize = true;
this.unitsLabel.Location = new System.Drawing.Point(27, 311);
this.unitsLabel.Name = "unitsLabel";
this.unitsLabel.Size = new System.Drawing.Size(31, 13);
this.unitsLabel.TabIndex = 34;
this.unitsLabel.Text = "Units";
//
// formatTextBox
//
this.formatTextBox.Enabled = false;
this.formatTextBox.Location = new System.Drawing.Point(137, 285);
this.formatTextBox.Name = "formatTextBox";
this.formatTextBox.Size = new System.Drawing.Size(130, 20);
this.formatTextBox.TabIndex = 33;
//
// formatLabel
//
this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(27, 288);
this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(71, 13);
this.formatLabel.TabIndex = 32;
this.formatLabel.Text = "Output format";
//
// BalanceCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.unitsComboBox);
this.Controls.Add(this.unitsLabel);
this.Controls.Add(this.formatTextBox);
this.Controls.Add(this.formatLabel);
this.Controls.Add(this.evaporationComboBox);
this.Controls.Add(this.evaporationLabel);
this.Controls.Add(this.label7);
@@ -365,8 +389,6 @@ namespace TBF.BenchControl.MettlerToledo.Standard
this.Controls.Add(this.emptyUpTextBox);
this.Controls.Add(this.drainValveComboBox);
this.Controls.Add(this.drainingValveLabel);
this.Controls.Add(this.formatTextBox);
this.Controls.Add(this.formatLabel);
this.Controls.Add(this.label4);
this.Controls.Add(this.drainTimeTextBox);
this.Controls.Add(this.label5);
@@ -425,8 +447,6 @@ namespace TBF.BenchControl.MettlerToledo.Standard
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox drainTimeTextBox;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox formatTextBox;
private System.Windows.Forms.Label formatLabel;
private System.Windows.Forms.ComboBox drainValveComboBox;
private System.Windows.Forms.Label drainingValveLabel;
private System.Windows.Forms.Label label6;
@@ -434,5 +454,9 @@ namespace TBF.BenchControl.MettlerToledo.Standard
private System.Windows.Forms.Label label7;
private System.Windows.Forms.ComboBox evaporationComboBox;
private System.Windows.Forms.Label evaporationLabel;
private System.Windows.Forms.ComboBox unitsComboBox;
private System.Windows.Forms.Label unitsLabel;
private System.Windows.Forms.TextBox formatTextBox;
private System.Windows.Forms.Label formatLabel;
}
}
@@ -6,6 +6,7 @@ using System.Windows.Forms;
using System.IO.Ports;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.MettlerToledo.Standard
{
@@ -98,11 +99,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
evaporationComboBox.Items.Add("---");
drainValveComboBox.Items.Add("---");
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is BuiltIn.Valve.ValveFactory)
{
@@ -115,6 +116,14 @@ namespace TBF.BenchControl.MettlerToledo.Standard
}
}
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (global::Config.Units.IsQuantity(units, global::Config.Quantity.Mass))
{
unitsComboBox.Items.Add(units.ToString());
}
}
Redraw();
}
@@ -131,7 +140,6 @@ namespace TBF.BenchControl.MettlerToledo.Standard
capacityTextBox.Text = config.Capacity.ToString();
emptyTextBox.Text = config.Empty.ToString();
emptyUpTextBox.Text = config.EmptyUp.ToString();
formatTextBox.Text = (config.Format.Length > 1) ? config.Format.Substring(1) : config.Format;
evaporationComboBox.Text = string.IsNullOrEmpty(config.Evaporation) ? "---" : config.Evaporation;
drainValveComboBox.Text = string.IsNullOrEmpty(config.DrainValve) ? "---" : config.DrainValve;
drainTimeTextBox.Text = config.DrainTimeSec.ToString();
@@ -142,6 +150,9 @@ namespace TBF.BenchControl.MettlerToledo.Standard
dataBitsTextBox.Text = config.DataBits.ToString();
stopBitsComboBox.Text = config.StopBits.ToString();
handshakeComboBox.Text = config.Handshake.ToString();
formatTextBox.Text = config.MsrdFormat;
unitsComboBox.Text = config.MsrdUnits.ToString();
}
public void Unlock()
@@ -161,6 +172,9 @@ namespace TBF.BenchControl.MettlerToledo.Standard
dataBitsTextBox.Enabled = true;
stopBitsComboBox.Enabled = true;
handshakeComboBox.Enabled = true;
formatTextBox.Enabled = true;
unitsComboBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
@@ -199,11 +213,6 @@ namespace TBF.BenchControl.MettlerToledo.Standard
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Tank Empty Up' is not valid";
}
if (!int.TryParse(formatTextBox.Text, out dummy) || dummy < 0 || dummy > 9)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Decimal points' should be between 0 and 9";
}
if (!evaporationComboBox.Items.Contains(evaporationComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
@@ -219,6 +228,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Tank drain time' should be between 1 and 999 sec";
}
if (!unitsComboBox.Items.Contains(unitsComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Units'";
}
return flags;
}
@@ -233,7 +247,6 @@ namespace TBF.BenchControl.MettlerToledo.Standard
config.Capacity = Utils.ParseUFloat(capacityTextBox.Text);
config.Empty = Utils.ParseUFloat(emptyTextBox.Text);
config.EmptyUp = Utils.ParseUFloat(emptyUpTextBox.Text);
config.Format = "F" + formatTextBox.Text;
config.Evaporation = evaporationComboBox.Text.Equals("---") ? string.Empty : evaporationComboBox.Text;
config.DrainTimeSec = int.Parse(drainTimeTextBox.Text);
config.DrainValve = drainValveComboBox.Text.Equals("---") ? string.Empty : drainValveComboBox.Text;
@@ -245,6 +258,17 @@ namespace TBF.BenchControl.MettlerToledo.Standard
config.StopBits = GetStopBits(stopBitsComboBox.SelectedItem.ToString());
config.Handshake = GetHandshake(handshakeComboBox.SelectedItem.ToString());
config.MsrdFormat = formatTextBox.Text;
config.MsrdUnits = global::Config.Unit.None;
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (unitsComboBox.Text == units.ToString())
{
config.MsrdUnits = units;
break;
}
}
return flags;
}
}
@@ -8,6 +8,7 @@ using System.Text;
using System.IO.Ports;
using log4net;
using Config.Entities;
using SchematicDrawing;
using TBF.BenchControl.Generic;
using TBF.BenchControl.GenericDevices;
using TBF.Boxes;
@@ -21,7 +22,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
/// <note>
/// Implemented and tested on 15.10.2013 by Milan Hanajik
/// </note>
public class BalanceDev : TankDraining, IDevice, GenericDevices.IScale, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItemCmpnt
public class BalanceDev : TankDraining, IDevice, GenericDevices.IScale, GenericDevices.IHasCalendarEvents, IDrawingItCmpntWithMeasuredVal
{
/// <summary>
/// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..."
@@ -31,7 +32,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public override string ToString() { return string.Format("MettlerToledo.Standard.Balance({0})", Cfg.ToString(1)); }
protected readonly BalanceCfg balanceCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return balanceCfg as SchematicDrawing.IDrawingItemCfg; } }
public IDrawingItem DrawingItem { get { return balanceCfg as IDrawingItem; } }
/// <summary>
/// Enumeration of balances via static fields and methods
@@ -72,16 +73,20 @@ namespace TBF.BenchControl.MettlerToledo.Standard
/// <summary>The mass after StartMassMeasurement() when MsrmntState == MsrmntState.Valid</summary>
public double Mass { get { return mass; } }
protected double mass;
public double MeasuredVal
{
get { return mass; }
set { } // TODO
}
/// <summary>The time stamp after StartMassMeasurement() when MsrmntState == MsrmntState.Valid</summary>
public int MsrmntTimeStamp { get { return msrmntTimeStamp; } }
protected int msrmntTimeStamp;
public string Format { get { return balanceCfg.Format; } }
public string Format { get { return balanceCfg.MsrdFormat; } }
public BalanceDev()
{
}
public BalanceDev() { }
/// <summary>
/// Constructor
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Modbus.CometAmbient
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Modbus.CometAmbient
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
{
+52 -5
View File
@@ -8,6 +8,7 @@ using System.Text;
using log4net;
using Config.Entities;
using Dirichlet.Numerics;
using SchematicDrawing;
using TBF.BenchControl.ControlBoard;
using TBF.BenchControl.Generic;
@@ -67,13 +68,13 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
}
public class Pump : ComponentBase, IDevice, IOperation, GenericDevices.IPumpFM, GenericDevices.IValve, SchematicDrawing.IDrawingItemCmpnt
public class Pump : ComponentBase, IDevice, IOperation, GenericDevices.IPumpFM, GenericDevices.IValve, IDrawingItCmpntWithSetpoint
{
private static readonly ILog log = LogManager.GetLogger(typeof(Pump));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(1)); }
private readonly PumpCfg pumpCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return pumpCfg as SchematicDrawing.IDrawingItemCfg; } }
public IDrawingItem DrawingItem { get { return pumpCfg as IDrawingItem; } }
public int Delay { get { return pumpCfg.Delay; } }
public ValveCategory Category { get { return ValveCategory.Feeding; } } /// Pump category is Feeding
@@ -87,11 +88,42 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
/// </summary>
float power;
public float Power { get { return power; } }
///
public double SetpointVal
{
get { return power; }
set
{
power = (float)value;
if (power != 0) TurnOn(power);
}
}
///
public void IncreaseSetpoint()
{
power += 5.0f;
if (power > 100.0f) power = 100.0f;
TurnOn(power);
}
///
public void DecreaseSetpoint()
{
power -= 5.0f;
if (power <= 0)
{
power = 0;
TurnOff();
}
else
{
TurnOn(power);
}
}
readonly GenericDevices.IModbus modbus;
readonly IControlBoard controlBoard;
readonly int bitPosition; /// 0 .. 63
readonly int bitNr; /// 0 .. 63
public readonly UInt128 Mask; /// derived from bitPosition in the constructor
@@ -118,8 +150,23 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
controlBoard = TbfComponents.FindComponent("CB", components) as IControlBoard; /// TODO: replace "CB"
if (controlBoard == null) throw new Exception("Cannot find a control board");
bitPosition = pumpCfg.BitPosition;
Mask = (((UInt128)1) << bitPosition);
bitNr = pumpCfg.BitNr;
Mask = (((UInt128)1) << bitNr);
TBF.UiBridge.Bridge.SetpointChangeHandler += delegate(object sndr, TBF.UiBridge.SetpointChangeArgs args)
{
if (args.Name == Name)
{
if (args.Increase)
{
IncreaseSetpoint();
}
else
{
DecreaseSetpoint();
}
}
};
log.Debug(this.ToString());
}
+35 -22
View File
@@ -3,11 +3,13 @@
///
using System;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
using System.Collections.Generic;
namespace TBF.BenchControl.Modbus.Danfoss.VLT
{
public class PumpCfg : ComponentCfgBase, Generic.IChildComponentCfg, SchematicDrawing.IDrawingItemCfg
public class PumpCfg : ComponentCfgBase, Generic.IChildComponentCfg, IRouteBasedDrawingItem, IDrawingItemWithSetpoint
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PumpCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -17,50 +19,61 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
///
/// Serialized parameters
///
public int BitPosition;
public int Delay; // Delay of the pump function in [s] (affects the duration of transition sequence steps)
public byte ModbusAddress; /// 1..254
public int BitNr { get; set; }
public bool Inverted { get; set; } /// When true the pump function is inverted: 0 = on, 1 = off
public int Delay; /// Delay of the pump function in [s] (affects the duration of transition sequence steps)
public byte ModbusAddress; /// 1..254
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
public Orient LblOrient { get; set; }
public int SetpX { get; set; }
public int SetpY { get; set; }
public Orient SetpOrient { get; set; }
public string SetpFormat { get; set; }
public Config.Unit SetpUnits { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
[XmlIgnore]
public IList<GEdge> EdgesToSet { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
PumpCfg()
{
Name = "P";
ParentName = "Modbus";
BitPosition = 0;
Delay = 1;
ModbusAddress = 49;
Shape = SchematicDrawing.Shape.PumpFM;
GNodes = new List<GNode>();
EdgesToSet = new List<GEdge>();
}
public PumpCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
Shape = Shape.PumpFM;
Sz = Sz.M;
SetpFormat = "{0:F0} %";
SetpUnits = Config.Unit.Pct;
Name = "P";
Factory = factory;
ParentName = "Modbus";
BitNr = 0;
Delay = 1;
ModbusAddress = 49;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
return string.Format("name={0} bit={1} delay={2} addr={3} parent={4}",
Name,
BitPosition,
BitNr,
Delay,
ModbusAddress,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName));
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Modbus.Danfoss.VLT
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
{
@@ -46,6 +47,14 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
}
}
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (global::Config.Units.IsQuantity(units, global::Config.Quantity.Error))
{
unitsComboBox.Items.Add(units.ToString());
}
}
Redraw();
}
@@ -60,10 +69,12 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
componentNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
bitPositionTextBox.Text = config.BitPosition.ToString();
bitPositionTextBox.Text = config.BitNr.ToString();
delayTextBox.Text = config.Delay.ToString();
modbusAddressTextBox.Text = config.ModbusAddress.ToString();
}
formatTextBox.Text = config.SetpFormat;
unitsComboBox.Text = config.SetpUnits.ToString();
}
public void Unlock()
{
@@ -72,7 +83,9 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
bitPositionTextBox.Enabled = true;
delayTextBox.Enabled = true;
modbusAddressTextBox.Enabled = true;
}
formatTextBox.Enabled = true;
unitsComboBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
@@ -84,25 +97,27 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Parent Name'";
}
if (!int.TryParse(bitPositionTextBox.Text, out dummy) || dummy < 0 || dummy >= 128)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Bit Position' should be between 0 and 127";
}
if (!int.TryParse(delayTextBox.Text, out dummy) || dummy < 0 || dummy > 300)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Delay' is not valid";
}
if (!int.TryParse(modbusAddressTextBox.Text, out dummy) || dummy < 0 || dummy > 254)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Modbus Address' should be between 0 and 254";
}
return flags;
if (!unitsComboBox.Items.Contains(unitsComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Units'";
}
return flags;
}
public CfgUpdateFlags UpdateCfg()
@@ -113,10 +128,21 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.BitPosition = int.Parse(bitPositionTextBox.Text);
config.BitNr = int.Parse(bitPositionTextBox.Text);
config.Delay = int.Parse(delayTextBox.Text);
config.ModbusAddress = (byte)int.Parse(modbusAddressTextBox.Text);
config.SetpFormat = formatTextBox.Text;
config.SetpUnits = global::Config.Unit.None;
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (unitsComboBox.Text == units.ToString())
{
config.SetpUnits = units;
break;
}
}
return flags;
}
}
+59 -12
View File
@@ -42,12 +42,16 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
this.bitPositionLabel = new System.Windows.Forms.Label();
this.delayTextBox = new System.Windows.Forms.TextBox();
this.delayLabel = new System.Windows.Forms.Label();
this.unitsComboBox = new System.Windows.Forms.ComboBox();
this.unitsLabel = new System.Windows.Forms.Label();
this.formatTextBox = new System.Windows.Forms.TextBox();
this.formatLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// parentNameLabel
//
this.parentNameLabel.AutoSize = true;
this.parentNameLabel.Location = new System.Drawing.Point(28, 81);
this.parentNameLabel.Location = new System.Drawing.Point(36, 81);
this.parentNameLabel.Name = "parentNameLabel";
this.parentNameLabel.Size = new System.Drawing.Size(69, 13);
this.parentNameLabel.TabIndex = 3;
@@ -56,7 +60,7 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(138, 52);
this.nameTextBox.Location = new System.Drawing.Point(146, 52);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 2;
@@ -64,7 +68,7 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(28, 55);
this.nameLabel.Location = new System.Drawing.Point(36, 55);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
@@ -73,7 +77,7 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
// componentNameLabel
//
this.componentNameLabel.AutoSize = true;
this.componentNameLabel.Location = new System.Drawing.Point(135, 28);
this.componentNameLabel.Location = new System.Drawing.Point(143, 28);
this.componentNameLabel.Name = "componentNameLabel";
this.componentNameLabel.Size = new System.Drawing.Size(83, 13);
this.componentNameLabel.TabIndex = 0;
@@ -82,7 +86,7 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
// modbusAddressLabel
//
this.modbusAddressLabel.AutoSize = true;
this.modbusAddressLabel.Location = new System.Drawing.Point(28, 157);
this.modbusAddressLabel.Location = new System.Drawing.Point(36, 157);
this.modbusAddressLabel.Name = "modbusAddressLabel";
this.modbusAddressLabel.Size = new System.Drawing.Size(86, 13);
this.modbusAddressLabel.TabIndex = 7;
@@ -91,7 +95,7 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
// modbusAddressTextBox
//
this.modbusAddressTextBox.Enabled = false;
this.modbusAddressTextBox.Location = new System.Drawing.Point(138, 154);
this.modbusAddressTextBox.Location = new System.Drawing.Point(146, 154);
this.modbusAddressTextBox.Name = "modbusAddressTextBox";
this.modbusAddressTextBox.Size = new System.Drawing.Size(46, 20);
this.modbusAddressTextBox.TabIndex = 8;
@@ -100,7 +104,7 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(138, 78);
this.parentNameComboBox.Location = new System.Drawing.Point(146, 78);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
this.parentNameComboBox.TabIndex = 4;
@@ -108,7 +112,7 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
// bitPositionTextBox
//
this.bitPositionTextBox.Enabled = false;
this.bitPositionTextBox.Location = new System.Drawing.Point(138, 104);
this.bitPositionTextBox.Location = new System.Drawing.Point(146, 104);
this.bitPositionTextBox.Name = "bitPositionTextBox";
this.bitPositionTextBox.Size = new System.Drawing.Size(46, 20);
this.bitPositionTextBox.TabIndex = 22;
@@ -116,7 +120,7 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
// bitPositionLabel
//
this.bitPositionLabel.AutoSize = true;
this.bitPositionLabel.Location = new System.Drawing.Point(28, 107);
this.bitPositionLabel.Location = new System.Drawing.Point(36, 107);
this.bitPositionLabel.Name = "bitPositionLabel";
this.bitPositionLabel.Size = new System.Drawing.Size(89, 13);
this.bitPositionLabel.TabIndex = 21;
@@ -125,7 +129,7 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
// delayTextBox
//
this.delayTextBox.Enabled = false;
this.delayTextBox.Location = new System.Drawing.Point(138, 129);
this.delayTextBox.Location = new System.Drawing.Point(146, 129);
this.delayTextBox.Name = "delayTextBox";
this.delayTextBox.Size = new System.Drawing.Size(46, 20);
this.delayTextBox.TabIndex = 24;
@@ -133,16 +137,55 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
// delayLabel
//
this.delayLabel.AutoSize = true;
this.delayLabel.Location = new System.Drawing.Point(27, 131);
this.delayLabel.Location = new System.Drawing.Point(35, 131);
this.delayLabel.Name = "delayLabel";
this.delayLabel.Size = new System.Drawing.Size(45, 13);
this.delayLabel.TabIndex = 23;
this.delayLabel.Text = "Delay[s]";
//
// unitsComboBox
//
this.unitsComboBox.Enabled = false;
this.unitsComboBox.FormattingEnabled = true;
this.unitsComboBox.Location = new System.Drawing.Point(146, 206);
this.unitsComboBox.Name = "unitsComboBox";
this.unitsComboBox.Size = new System.Drawing.Size(80, 21);
this.unitsComboBox.TabIndex = 28;
//
// unitsLabel
//
this.unitsLabel.AutoSize = true;
this.unitsLabel.Location = new System.Drawing.Point(36, 209);
this.unitsLabel.Name = "unitsLabel";
this.unitsLabel.Size = new System.Drawing.Size(71, 13);
this.unitsLabel.TabIndex = 27;
this.unitsLabel.Text = "Setpoint units";
//
// formatTextBox
//
this.formatTextBox.Enabled = false;
this.formatTextBox.Location = new System.Drawing.Point(146, 180);
this.formatTextBox.Name = "formatTextBox";
this.formatTextBox.Size = new System.Drawing.Size(130, 20);
this.formatTextBox.TabIndex = 26;
//
// formatLabel
//
this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(36, 183);
this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(78, 13);
this.formatLabel.TabIndex = 25;
this.formatLabel.Text = "Setpoint format";
//
// PumpCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.unitsComboBox);
this.Controls.Add(this.unitsLabel);
this.Controls.Add(this.formatTextBox);
this.Controls.Add(this.formatLabel);
this.Controls.Add(this.delayTextBox);
this.Controls.Add(this.delayLabel);
this.Controls.Add(this.bitPositionTextBox);
@@ -155,7 +198,7 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.componentNameLabel);
this.Name = "PumpCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Size = new System.Drawing.Size(400, 250);
this.Load += new System.EventHandler(this.PressureMeterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
@@ -175,5 +218,9 @@ namespace TBF.BenchControl.Modbus.Danfoss.VLT
private System.Windows.Forms.Label bitPositionLabel;
private System.Windows.Forms.TextBox delayTextBox;
private System.Windows.Forms.Label delayLabel;
private System.Windows.Forms.ComboBox unitsComboBox;
private System.Windows.Forms.Label unitsLabel;
private System.Windows.Forms.TextBox formatTextBox;
private System.Windows.Forms.Label formatLabel;
}
}
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Modbus.Easytherm
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Modbus.Easytherm
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
{
@@ -4,25 +4,30 @@
using System;
using System.Collections.Generic;
using log4net;
using SchematicDrawing;
using TBF.BenchControl.Generic;
using TBF.Boxes;
namespace TBF.BenchControl.Modbus.Meret.PressureMeter
{
public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter, IDevice, SchematicDrawing.IDrawingItemCmpnt
public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter, IDevice, IDrawingItCmpntWithMeasuredVal
{
private static readonly ILog log = LogManager.GetLogger(typeof(PressureMeter));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(1)); }
readonly PressureMeterCfg pressureMtrCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return pressureMtrCfg as SchematicDrawing.IDrawingItemCfg; } }
public IDrawingItem DrawingItem { get { return pressureMtrCfg as IDrawingItem; } }
readonly GenericDevices.IModbus modbus;
double receivedPressure;
public double MeasuredVal
{
get { return receivedPressure; }
set { } // TODO
}
public PressureMeter()
{
}
public PressureMeter() { }
public PressureMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
: base(cfg)
@@ -3,11 +3,13 @@
///
using System;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
using System.Collections.Generic;
namespace TBF.BenchControl.Modbus.Meret.PressureMeter
{
public class PressureMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg, SchematicDrawing.IDrawingItemCfg
public class PressureMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg, IDrawingItemWithMeasuredVal
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PressureMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -20,44 +22,55 @@ namespace TBF.BenchControl.Modbus.Meret.PressureMeter
public byte ModbusAddress; /// 1..255
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { 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 MsrdUnits { get; set; }
public string MsrdFormat { get; set; }
public double MsrdValLimLo { get; set; }
public double MsrdValLimHi { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
PressureMeterCfg()
{
Name = "Pr";
ParentName = "Modbus";
ModbusAddress = 49;
Shape = SchematicDrawing.Shape.PressM;
GNodes = new List<GNode>();
}
public PressureMeterCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
Shape = Shape.PressM;
Sz = Sz.M;
Factory = factory;
Name = "Pr";
ParentName = "Modbus";
ModbusAddress = 49;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
return string.Format("name={0} addr={1} parent={2}",
return string.Format("{0}(1) {2}[{3},{4}] addr={5}",
Name,
ModbusAddress,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName));
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
Shape,
X,
Y,
ModbusAddress);
}
}
}
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Modbus.Meret.PressureMeter
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Modbus.Meret.PressureMeter
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
{
@@ -46,6 +47,14 @@ namespace TBF.BenchControl.Modbus.Meret.PressureMeter
}
}
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (global::Config.Units.IsQuantity(units, global::Config.Quantity.Pressure))
{
unitsComboBox.Items.Add(units.ToString());
}
}
Redraw();
}
@@ -61,6 +70,8 @@ namespace TBF.BenchControl.Modbus.Meret.PressureMeter
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
modbusAddressTextBox.Text = config.ModbusAddress.ToString();
formatTextBox.Text = config.MsrdFormat;
unitsComboBox.Text = config.MsrdUnits.ToString();
}
public void Unlock()
@@ -68,6 +79,8 @@ namespace TBF.BenchControl.Modbus.Meret.PressureMeter
nameTextBox.Enabled = true;
parentNameComboBox.Enabled = true;
modbusAddressTextBox.Enabled = true;
formatTextBox.Enabled = true;
unitsComboBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
@@ -85,7 +98,12 @@ namespace TBF.BenchControl.Modbus.Meret.PressureMeter
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Modbus Address' should be between 0 and 255";
}
return flags;
if (!unitsComboBox.Items.Contains(unitsComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Units'";
}
return flags;
}
public CfgUpdateFlags UpdateCfg()
@@ -97,6 +115,16 @@ namespace TBF.BenchControl.Modbus.Meret.PressureMeter
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.ModbusAddress = (byte)int.Parse(modbusAddressTextBox.Text);
config.MsrdFormat = formatTextBox.Text;
config.MsrdUnits = global::Config.Unit.None;
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (unitsComboBox.Text == units.ToString())
{
config.MsrdUnits = units;
break;
}
}
return flags;
}
@@ -31,92 +31,135 @@ namespace TBF.BenchControl.Modbus.Meret.PressureMeter
/// </summary>
private void InitializeComponent()
{
this.parentNameLabel = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.componentNameLabel = new System.Windows.Forms.Label();
this.modbusAddressLabel = new System.Windows.Forms.Label();
this.modbusAddressTextBox = new System.Windows.Forms.TextBox();
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// parentNameLabel
//
this.parentNameLabel.AutoSize = true;
this.parentNameLabel.Location = new System.Drawing.Point(28, 81);
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(138, 52);
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(28, 55);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// componentNameLabel
//
this.componentNameLabel.AutoSize = true;
this.componentNameLabel.Location = new System.Drawing.Point(135, 28);
this.componentNameLabel.Name = "componentNameLabel";
this.componentNameLabel.Size = new System.Drawing.Size(83, 13);
this.componentNameLabel.TabIndex = 0;
this.componentNameLabel.Text = "ComonentName";
//
// modbusAddressLabel
//
this.modbusAddressLabel.AutoSize = true;
this.modbusAddressLabel.Location = new System.Drawing.Point(28, 133);
this.modbusAddressLabel.Name = "modbusAddressLabel";
this.modbusAddressLabel.Size = new System.Drawing.Size(86, 13);
this.modbusAddressLabel.TabIndex = 7;
this.modbusAddressLabel.Text = "Modbus Address";
//
// modbusAddressTextBox
//
this.modbusAddressTextBox.Enabled = false;
this.modbusAddressTextBox.Location = new System.Drawing.Point(138, 130);
this.modbusAddressTextBox.Name = "modbusAddressTextBox";
this.modbusAddressTextBox.Size = new System.Drawing.Size(46, 20);
this.modbusAddressTextBox.TabIndex = 8;
//
// parentNameComboBox
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(138, 78);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
this.parentNameComboBox.TabIndex = 4;
//
// ComponentCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.parentNameComboBox);
this.Controls.Add(this.modbusAddressTextBox);
this.Controls.Add(this.modbusAddressLabel);
this.Controls.Add(this.parentNameLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.componentNameLabel);
this.Name = "ComponentCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.PressureMeterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
this.parentNameLabel = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.componentNameLabel = new System.Windows.Forms.Label();
this.modbusAddressLabel = new System.Windows.Forms.Label();
this.modbusAddressTextBox = new System.Windows.Forms.TextBox();
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
this.formatTextBox = new System.Windows.Forms.TextBox();
this.formatLabel = new System.Windows.Forms.Label();
this.unitsComboBox = new System.Windows.Forms.ComboBox();
this.unitsLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// parentNameLabel
//
this.parentNameLabel.AutoSize = true;
this.parentNameLabel.Location = new System.Drawing.Point(28, 81);
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(138, 52);
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(28, 55);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// componentNameLabel
//
this.componentNameLabel.AutoSize = true;
this.componentNameLabel.Location = new System.Drawing.Point(135, 28);
this.componentNameLabel.Name = "componentNameLabel";
this.componentNameLabel.Size = new System.Drawing.Size(83, 13);
this.componentNameLabel.TabIndex = 0;
this.componentNameLabel.Text = "ComonentName";
//
// modbusAddressLabel
//
this.modbusAddressLabel.AutoSize = true;
this.modbusAddressLabel.Location = new System.Drawing.Point(28, 108);
this.modbusAddressLabel.Name = "modbusAddressLabel";
this.modbusAddressLabel.Size = new System.Drawing.Size(86, 13);
this.modbusAddressLabel.TabIndex = 7;
this.modbusAddressLabel.Text = "Modbus Address";
//
// modbusAddressTextBox
//
this.modbusAddressTextBox.Enabled = false;
this.modbusAddressTextBox.Location = new System.Drawing.Point(138, 105);
this.modbusAddressTextBox.Name = "modbusAddressTextBox";
this.modbusAddressTextBox.Size = new System.Drawing.Size(80, 20);
this.modbusAddressTextBox.TabIndex = 8;
//
// parentNameComboBox
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(138, 78);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
this.parentNameComboBox.TabIndex = 4;
//
// formatTextBox
//
this.formatTextBox.Enabled = false;
this.formatTextBox.Location = new System.Drawing.Point(138, 131);
this.formatTextBox.Name = "formatTextBox";
this.formatTextBox.Size = new System.Drawing.Size(130, 20);
this.formatTextBox.TabIndex = 10;
//
// formatLabel
//
this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(28, 134);
this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(71, 13);
this.formatLabel.TabIndex = 9;
this.formatLabel.Text = "Output format";
//
// unitsComboBox
//
this.unitsComboBox.Enabled = false;
this.unitsComboBox.FormattingEnabled = true;
this.unitsComboBox.Location = new System.Drawing.Point(138, 157);
this.unitsComboBox.Name = "unitsComboBox";
this.unitsComboBox.Size = new System.Drawing.Size(80, 21);
this.unitsComboBox.TabIndex = 12;
//
// unitsLabel
//
this.unitsLabel.AutoSize = true;
this.unitsLabel.Location = new System.Drawing.Point(28, 160);
this.unitsLabel.Name = "unitsLabel";
this.unitsLabel.Size = new System.Drawing.Size(31, 13);
this.unitsLabel.TabIndex = 11;
this.unitsLabel.Text = "Units";
//
// PressureMeterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.unitsComboBox);
this.Controls.Add(this.unitsLabel);
this.Controls.Add(this.formatTextBox);
this.Controls.Add(this.formatLabel);
this.Controls.Add(this.parentNameComboBox);
this.Controls.Add(this.modbusAddressTextBox);
this.Controls.Add(this.modbusAddressLabel);
this.Controls.Add(this.parentNameLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.componentNameLabel);
this.Name = "PressureMeterCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.PressureMeterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -129,5 +172,9 @@ namespace TBF.BenchControl.Modbus.Meret.PressureMeter
private System.Windows.Forms.Label modbusAddressLabel;
private System.Windows.Forms.TextBox modbusAddressTextBox;
private System.Windows.Forms.ComboBox parentNameComboBox;
private System.Windows.Forms.TextBox formatTextBox;
private System.Windows.Forms.Label formatLabel;
private System.Windows.Forms.ComboBox unitsComboBox;
private System.Windows.Forms.Label unitsLabel;
}
}
@@ -4,25 +4,30 @@
using System;
using System.Collections.Generic;
using log4net;
using SchematicDrawing;
using TBF.BenchControl.Generic;
using TBF.Boxes;
namespace TBF.BenchControl.Modbus.Meret.TempMeter
{
public class TempMeter : ComponentBase, GenericDevices.ITempMeter, IDevice, SchematicDrawing.IDrawingItemCmpnt
public class TempMeter : ComponentBase, GenericDevices.ITempMeter, IDevice, IDrawingItCmpntWithMeasuredVal
{
private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(1)); }
readonly TempMeterCfg tempMtrCfg;
public SchematicDrawing.IDrawingItemCfg DrawingItemCfg { get { return tempMtrCfg as SchematicDrawing.IDrawingItemCfg; } }
public IDrawingItem DrawingItem { get { return tempMtrCfg as IDrawingItem; } }
readonly GenericDevices.IModbus modbus;
double receivedTemp;
public double MeasuredVal
{
get { return receivedTemp; }
set { } // TODO
}
public TempMeter()
{
}
public TempMeter() { }
public TempMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
: base(cfg)
@@ -3,11 +3,13 @@
///
using System;
using System.Xml.Serialization;
using SchematicDrawing;
using TBF.BenchControl.Generic;
using System.Collections.Generic;
namespace TBF.BenchControl.Modbus.Meret.TempMeter
{
public class TempMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg, SchematicDrawing.IDrawingItemCfg
public class TempMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg, IDrawingItemWithMeasuredVal
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
@@ -20,44 +22,55 @@ namespace TBF.BenchControl.Modbus.Meret.TempMeter
public byte ModbusAddress; /// 1..254
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { 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 SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { 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 MsrdUnits { get; set; }
public string MsrdFormat { get; set; }
public double MsrdValLimLo { get; set; }
public double MsrdValLimHi { get; set; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
TempMeterCfg()
{
Name = "T";
ParentName = "Modbus";
ModbusAddress = 49;
Shape = SchematicDrawing.Shape.TempM;
GNodes = new List<GNode>();
}
public TempMeterCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
Shape = Shape.TempM;
Sz = Sz.M;
Factory = factory;
Name = "T";
ParentName = "Modbus";
ModbusAddress = 49;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
return string.Format("name={0} addr={1} parent={2}",
return string.Format("{0}(1) {2}[{3},{4}] addr={5}",
Name,
ModbusAddress,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName));
}
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
Shape,
X,
Y,
ModbusAddress);
}
}
}
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Modbus.Meret.TempMeter
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Modbus.Meret.TempMeter
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
{
@@ -46,6 +47,14 @@ namespace TBF.BenchControl.Modbus.Meret.TempMeter
}
}
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (global::Config.Units.IsQuantity(units, global::Config.Quantity.Temperature))
{
unitsComboBox.Items.Add(units.ToString());
}
}
Redraw();
}
@@ -61,14 +70,18 @@ namespace TBF.BenchControl.Modbus.Meret.TempMeter
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
modbusAddressTextBox.Text = config.ModbusAddress.ToString();
}
formatTextBox.Text = config.MsrdFormat;
unitsComboBox.Text = config.MsrdUnits.ToString();
}
public void Unlock()
{
nameTextBox.Enabled = true;
parentNameComboBox.Enabled = true;
modbusAddressTextBox.Enabled = true;
}
formatTextBox.Enabled = true;
unitsComboBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
@@ -85,7 +98,12 @@ namespace TBF.BenchControl.Modbus.Meret.TempMeter
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Modbus Address' should be between 0 and 255";
}
return flags;
if (!unitsComboBox.Items.Contains(unitsComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Units'";
}
return flags;
}
public CfgUpdateFlags UpdateCfg()
@@ -97,6 +115,16 @@ namespace TBF.BenchControl.Modbus.Meret.TempMeter
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.ModbusAddress = (byte)int.Parse(modbusAddressTextBox.Text);
config.MsrdFormat = formatTextBox.Text;
config.MsrdUnits = global::Config.Unit.None;
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
{
if (unitsComboBox.Text == units.ToString())
{
config.MsrdUnits = units;
break;
}
}
return flags;
}
@@ -31,92 +31,135 @@ namespace TBF.BenchControl.Modbus.Meret.TempMeter
/// </summary>
private void InitializeComponent()
{
this.parentNameLabel = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.componentNameLabel = new System.Windows.Forms.Label();
this.modbusAddressLabel = new System.Windows.Forms.Label();
this.modbusAddressTextBox = new System.Windows.Forms.TextBox();
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// parentNameLabel
//
this.parentNameLabel.AutoSize = true;
this.parentNameLabel.Location = new System.Drawing.Point(28, 81);
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(138, 52);
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(28, 55);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// componentNameLabel
//
this.componentNameLabel.AutoSize = true;
this.componentNameLabel.Location = new System.Drawing.Point(135, 28);
this.componentNameLabel.Name = "componentNameLabel";
this.componentNameLabel.Size = new System.Drawing.Size(83, 13);
this.componentNameLabel.TabIndex = 0;
this.componentNameLabel.Text = "ComonentName";
//
// modbusAddressLabel
//
this.modbusAddressLabel.AutoSize = true;
this.modbusAddressLabel.Location = new System.Drawing.Point(28, 133);
this.modbusAddressLabel.Name = "modbusAddressLabel";
this.modbusAddressLabel.Size = new System.Drawing.Size(86, 13);
this.modbusAddressLabel.TabIndex = 7;
this.modbusAddressLabel.Text = "Modbus Address";
//
// modbusAddressTextBox
//
this.modbusAddressTextBox.Enabled = false;
this.modbusAddressTextBox.Location = new System.Drawing.Point(138, 130);
this.modbusAddressTextBox.Name = "modbusAddressTextBox";
this.modbusAddressTextBox.Size = new System.Drawing.Size(46, 20);
this.modbusAddressTextBox.TabIndex = 8;
//
// parentNameComboBox
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(138, 78);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
this.parentNameComboBox.TabIndex = 4;
//
// ComponentCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.parentNameComboBox);
this.Controls.Add(this.modbusAddressTextBox);
this.Controls.Add(this.modbusAddressLabel);
this.Controls.Add(this.parentNameLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.componentNameLabel);
this.Name = "ComponentCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.PressureMeterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
this.parentNameLabel = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.componentNameLabel = new System.Windows.Forms.Label();
this.modbusAddressLabel = new System.Windows.Forms.Label();
this.modbusAddressTextBox = new System.Windows.Forms.TextBox();
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
this.unitsComboBox = new System.Windows.Forms.ComboBox();
this.unitsLabel = new System.Windows.Forms.Label();
this.formatTextBox = new System.Windows.Forms.TextBox();
this.formatLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// parentNameLabel
//
this.parentNameLabel.AutoSize = true;
this.parentNameLabel.Location = new System.Drawing.Point(28, 81);
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(138, 52);
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(28, 55);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// componentNameLabel
//
this.componentNameLabel.AutoSize = true;
this.componentNameLabel.Location = new System.Drawing.Point(135, 28);
this.componentNameLabel.Name = "componentNameLabel";
this.componentNameLabel.Size = new System.Drawing.Size(83, 13);
this.componentNameLabel.TabIndex = 0;
this.componentNameLabel.Text = "ComonentName";
//
// modbusAddressLabel
//
this.modbusAddressLabel.AutoSize = true;
this.modbusAddressLabel.Location = new System.Drawing.Point(28, 108);
this.modbusAddressLabel.Name = "modbusAddressLabel";
this.modbusAddressLabel.Size = new System.Drawing.Size(86, 13);
this.modbusAddressLabel.TabIndex = 7;
this.modbusAddressLabel.Text = "Modbus Address";
//
// modbusAddressTextBox
//
this.modbusAddressTextBox.Enabled = false;
this.modbusAddressTextBox.Location = new System.Drawing.Point(138, 105);
this.modbusAddressTextBox.Name = "modbusAddressTextBox";
this.modbusAddressTextBox.Size = new System.Drawing.Size(46, 20);
this.modbusAddressTextBox.TabIndex = 8;
//
// parentNameComboBox
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(138, 78);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
this.parentNameComboBox.TabIndex = 4;
//
// unitsComboBox
//
this.unitsComboBox.Enabled = false;
this.unitsComboBox.FormattingEnabled = true;
this.unitsComboBox.Location = new System.Drawing.Point(138, 157);
this.unitsComboBox.Name = "unitsComboBox";
this.unitsComboBox.Size = new System.Drawing.Size(80, 21);
this.unitsComboBox.TabIndex = 16;
//
// unitsLabel
//
this.unitsLabel.AutoSize = true;
this.unitsLabel.Location = new System.Drawing.Point(28, 160);
this.unitsLabel.Name = "unitsLabel";
this.unitsLabel.Size = new System.Drawing.Size(31, 13);
this.unitsLabel.TabIndex = 15;
this.unitsLabel.Text = "Units";
//
// formatTextBox
//
this.formatTextBox.Enabled = false;
this.formatTextBox.Location = new System.Drawing.Point(138, 131);
this.formatTextBox.Name = "formatTextBox";
this.formatTextBox.Size = new System.Drawing.Size(130, 20);
this.formatTextBox.TabIndex = 14;
//
// formatLabel
//
this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(28, 134);
this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(71, 13);
this.formatLabel.TabIndex = 13;
this.formatLabel.Text = "Output format";
//
// TempMeterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.unitsComboBox);
this.Controls.Add(this.unitsLabel);
this.Controls.Add(this.formatTextBox);
this.Controls.Add(this.formatLabel);
this.Controls.Add(this.parentNameComboBox);
this.Controls.Add(this.modbusAddressTextBox);
this.Controls.Add(this.modbusAddressLabel);
this.Controls.Add(this.parentNameLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.componentNameLabel);
this.Name = "TempMeterCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.PressureMeterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -129,5 +172,9 @@ namespace TBF.BenchControl.Modbus.Meret.TempMeter
private System.Windows.Forms.Label modbusAddressLabel;
private System.Windows.Forms.TextBox modbusAddressTextBox;
private System.Windows.Forms.ComboBox parentNameComboBox;
private System.Windows.Forms.ComboBox unitsComboBox;
private System.Windows.Forms.Label unitsLabel;
private System.Windows.Forms.TextBox formatTextBox;
private System.Windows.Forms.Label formatLabel;
}
}
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Modbus.QuidoRS
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.Modbus.QuidoRS
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
{
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Modbus.TankSelector
{
@@ -39,9 +40,9 @@ namespace TBF.BenchControl.Modbus.TankSelector
warmHeatingComboBox.Items.Add("---");
warmCoolingComboBox.Items.Add("---");
coldCoolingComboBox.Items.Add("---");
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.QuidoRS.Factory)
{
@@ -6,6 +6,7 @@ using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Network.Camera.CLP1611
{
@@ -38,9 +39,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.BenchControl.Network.Adapter.Factory)
{
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Network.Camera.Display
{
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Network.Camera.Roi
{
@@ -36,9 +37,9 @@ namespace TBF.BenchControl.Network.Camera.Roi
if (parent == null) return;
previousRoiComboBox.Items.Add("---");
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.BenchControl.Network.Camera.CLP1611.Factory)
{
@@ -7,6 +7,7 @@ using log4net;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Network.Camera.RoiForFixedStart
{
@@ -39,9 +40,9 @@ namespace TBF.BenchControl.Network.Camera.RoiForFixedStart
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.BenchControl.Network.Camera.CLP1611.Factory)
{
@@ -4,6 +4,7 @@
using System;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections
{
@@ -36,7 +37,7 @@ namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
diverter1ComboBox.Items.Add("---");
diverter2ComboBox.Items.Add("---");
@@ -45,7 +46,7 @@ namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections
diverter5ComboBox.Items.Add("---");
diverter6ComboBox.Items.Add("---");
///
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.BenchControl.Elde.Diverter.DiverterFactory)
{
@@ -4,6 +4,7 @@
using System;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
{
@@ -36,7 +37,7 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
flowmeter1ComboBox.Items.Add("---");
flowmeter2ComboBox.Items.Add("---");
@@ -46,7 +47,7 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
flowmeter6ComboBox.Items.Add("---");
flowmeter7ComboBox.Items.Add("---");
///
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.BenchControl.Elde.FlowMeter.FlowMeterFactory)
{
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.RegisterReaders.KPackE.DataEntryForRadio
{
@@ -37,9 +38,9 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.DataEntryForRadio
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Radio.Factory)
{
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.RegisterReaders.KPackE.RegisterReader
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.RegisterReaders.KPackE.RegisterReader
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Radio.Factory)
{
@@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.UI.Bench.Components;
namespace TBF.BenchControl.RegisterReaders.StandingStartStop
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.RegisterReaders.StandingStartStop
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.ControlBoardFactory)
{
+3 -3
View File
@@ -1080,9 +1080,9 @@ namespace TBF.BenchControl.Sequences
}
/// Update format for the water mass
Mass.Format = (outPath != null && outPath.Scale != null) ? outPath.Scale.Format : "F3";
StartMass.Format = (outPath != null && outPath.Scale != null) ? outPath.Scale.Format : "F3";
EndMass.Format = (outPath != null && outPath.Scale != null) ? outPath.Scale.Format : "F3";
Mass.Format = "F3";
StartMass.Format = "F3";
EndMass.Format = "F3";
ITestMethod testMethod = TbfComponents.FindComponent(test.Method) as ITestMethod;
if (testMethod != null && testMethod.CanTest(StateMachine.Procedure.MetersKind))
+13
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using log4net;
using SchematicDrawing;
using TBF.BenchControl.GenericDevices;
using TBF.Boxes;
@@ -20,6 +21,15 @@ namespace TBF.BenchControl.Sequences
public static IStatisticsMonitoring StatisticsMonitoringComp;
public static Output.DB.SensusOracle.Database OracleDB;
public static readonly IList<IDrawingItCmpntWithMeasuredVal> ComponentsWithMeasuredVal;
public static readonly IList<IDrawingItCmpntWithSetpoint> ComponentsWithSetpoint;
///
/// Measured values and setpoints to be displayed
///
public static double[] MeasuredValues;
public static double[] Setpoints;
///
/// State variables to be saved after each completed test
///
@@ -44,6 +54,9 @@ namespace TBF.BenchControl.Sequences
IsQ2PreCorrectionCalculated = false;
CalculatedQ2PreCorrectionLR = 0;
CalculatedQ2PreCorrectionRL = 0;
ComponentsWithMeasuredVal = new List<IDrawingItCmpntWithMeasuredVal>();
ComponentsWithSetpoint = new List<IDrawingItCmpntWithSetpoint>();
}
/// <summary>
+1 -1
View File
@@ -587,7 +587,7 @@ namespace TBF.BenchControl.Sequences
{
ISequenceCondition seqCondition = TbfComponents.FindComponent(fields[0]) as ISequenceCondition;
int condID;
if (int.TryParse(fields[1], out condID))
if ((seqCondition != null) && int.TryParse(fields[1], out condID))
{
conditionOperation = seqCondition.ConditionOp(condID);
}

Some files were not shown because too many files have changed in this diff Show More