Modbus.Easytherm component added, QuidoRS.TankSelector --> TankSelector, ver. 2.12.457

This commit is contained in:
Milan Hanajik 2017-02-10 13:43:41 +01:00
parent 7319a9aee4
commit e9070e5cc3
25 changed files with 778 additions and 54 deletions

View File

@ -261,7 +261,13 @@ namespace DeviceTest
if (className == "Keithley.TempMeter") radioButton1.Text = "ReadPressureOp";
else if (className == "Network.Camera.CLP1611") radioButton1.Text = "Livestream";
else if (className == "Network.Camera.Roi") radioButton1.Text = "RoiDetection";
else if (className == "TankSelector")
else if (className == "Modbus.Easytherm")
{
radioButton1.Text = "SetTemperature(10)";
radioButton2.Text = "SetTemperature(20)";
radioButton3.Text = "SetTemperature(30)";
}
else if (className == "Modbus.TankSelector")
{
radioButton1.Text = "SelectTank 1";
radioButton2.Text = "SelectTank 2";
@ -276,7 +282,13 @@ namespace DeviceTest
if (className == "Keithley.TempMeter") radioButton21.Text = "ReadPressureOp";
else if (className == "Network.Camera.CLP1611") radioButton21.Text = "Livestream";
else if (className == "Network.Camera.Roi") radioButton21.Text = "RoiDetection";
else if (className == "TankSelector")
else if (className == "Modbus.Easytherm")
{
radioButton21.Text = "SetTemperature(10)";
radioButton22.Text = "SetTemperature(20)";
radioButton23.Text = "SetTemperature(30)";
}
else if (className == "Modbus.TankSelector")
{
radioButton21.Text = "SelectTank 1";
radioButton22.Text = "SelectTank 2";
@ -291,7 +303,13 @@ namespace DeviceTest
if (className == "Keithley.TempMeter") radioButton31.Text = "ReadPressureOp";
else if (className == "Network.Camera.CLP1611") radioButton31.Text = "Livestream";
else if (className == "Network.Camera.Roi") radioButton31.Text = "RoiDetection";
else if (className == "TankSelector")
else if (className == "Modbus.Easytherm")
{
radioButton31.Text = "SetTemperature(10)";
radioButton32.Text = "SetTemperature(20)";
radioButton33.Text = "SetTemperature(30)";
}
else if (className == "Modbus.TankSelector")
{
radioButton31.Text = "SelectTank 1";
radioButton32.Text = "SelectTank 2";
@ -637,12 +655,18 @@ namespace DeviceTest
{
operation1 = (tbfComponent1forOp as TBF.BenchControl.Network.Camera.Roi.Roi).RoiDetectionOp();
}
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector)
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
{
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector).SelectTankOp(1);
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector).SelectTankOp(2);
operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector).SelectTankOp(3);
operation4 = (tbfComponent1forOp as TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector).SelectTankOp(0);
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(30);
}
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation4 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}
@ -659,12 +683,18 @@ namespace DeviceTest
{
operation21 = (tbfComponent2forOp as TBF.BenchControl.Network.Camera.Roi.Roi).RoiDetectionOp();
}
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector)
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
{
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector).SelectTankOp(1);
//operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector).SelectTankOp(2);
//operation23 = (tbfComponent2forOp as TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector).SelectTankOp(3);
//operation24 = (tbfComponent2forOp as TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector).SelectTankOp(0);
operation21 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation22 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
operation23 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(30);
}
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//operation23 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation24 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}
@ -681,12 +711,18 @@ namespace DeviceTest
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Network.Camera.Roi.Roi).RoiDetectionOp();
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector)
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector).SelectTankOp(1);
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector).SelectTankOp(2);
operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector).SelectTankOp(3);
operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.TankSelector.TankSelector).SelectTankOp(0);
operation31 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation32 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
operation33 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(30);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}

View File

@ -58,7 +58,7 @@ namespace TBF.BenchControl.Elde
public float RValvePosition(int rvNr1) { return controlCom.RValvePosition(rvNr1); }
public float DivSamples(int ms) { return controlCom.DivSamples(ms); }
public int ScopeSamples(int i, int j, int k) { return controlCom.ScopeSamples(i, j, k); }
public ulong DigitalInputs { get { return controlCom.DigitalInputs; } }
public uint DigitalInputs { get { return controlCom.DigitalInputs; } }
public float AnalogInput(int adcNr0) { return controlCom.AnalogInput(adcNr0); }
public uint AnalogInputRaw(int adcNr0, int bank) { return controlCom.AnalogInputRaw(adcNr0, bank); } /// adcNr0: 0=RV1, 1=RV2,... bank: 0=RV, 1=Temp
public float ReferenceVolume { get { return controlCom.TotalRefVolume; } }

View File

@ -63,7 +63,7 @@ namespace TBF.BenchControl.Elde
public float RValvePosition(int rvNr1) { return 0; }
public float DivSamples(int ms) { return 0; }
public int ScopeSamples(int i, int j, int k) { return 0; }
public ulong DigitalInputs { get { return 0; } }
public uint DigitalInputs { get { return 0; } }
public float AnalogInput(int adcNr0) { return 0; }
public uint AnalogInputRaw(int adcNr0, int bank) { return 0; } /// bank0=RV, bank1=Temp
public float TotalRefVolume { get { return 0; } }

View File

@ -64,7 +64,7 @@ namespace TBF.BenchControl.Elde
}
public float DivSamples(int ms) { return ctrlBrdComponent.DIVSamples[ms, 0]; }
public int ScopeSamples(int i, int j, int k) { return ctrlBrdComponent.ScopeSamples[i, j, k]; }
public ulong DigitalInputs { get { return (ulong)ctrlBrdComponent.Vstupy; } }
public uint DigitalInputs { get { return ctrlBrdComponent.Vstupy; } }
public float AnalogInput(int adcNr0) { return ctrlBrdComponent.Analogy[adcNr0]; }
public uint AnalogInputRaw(int adcNr0, int bank) { return ctrlBrdComponent.AnalogyRaw[adcNr0, bank]; } /// bank0=RV, bank1=Temp

View File

@ -26,7 +26,7 @@ namespace TBF.BenchControl.Elde
float RValvePosition(int rvNr1);
float DivSamples(int ms);
int ScopeSamples(int i, int j, int k);
ulong DigitalInputs { get; }
uint DigitalInputs { get; }
float AnalogInput(int adcNr0);
uint AnalogInputRaw(int adcNr0, int bank);
float TotalRefVolume { get; }

View File

@ -0,0 +1,103 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using log4net;
using TBF.BenchControl.Generic;
using TBF.Boxes;
namespace TBF.BenchControl.Modbus.Easytherm
{
public class Easytherm : ComponentBase, IDevice
{
private static readonly ILog log = LogManager.GetLogger(typeof(Easytherm));
public override string ToString() { return string.Format("Easytherm({0})", Cfg.ToString(1)); }
readonly EasythermCfg easythermCfg;
readonly GenericDevices.IModbus modbus;
private ushort temperatureSetpoint;
public Easytherm()
{
}
public Easytherm(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
: base(cfg)
{
easythermCfg = cfg as EasythermCfg;
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
log.Debug(this.ToString());
}
/// <summary>Initialize this device</summary>
public void Initialize()
{
}
/// <summary>Run this device</summary>
public void RunDeviceBefore()
{
}
/// <summary>Run this device</summary>
public void RunDeviceAfter()
{
}
/// <summary>Stop this device</summary>
public void StopDevice()
{
}
/// <summary>
/// Set outputs of QuidoRS board
/// </summary>
/// <param name="temperature">output value</param>
public void SetTemperature(ushort temperature)
{
temperatureSetpoint = temperature;
SendTemperature(temperatureSetpoint);
}
private void SendTemperature(ushort temperatureSetpoint)
{
byte[] msg = new byte[8];
msg[0] = easythermCfg.ModbusAddress;
msg[1] = (byte)Function.PresetSingleRegister;
msg[2] = 0; /// Relative address Hi
msg[3] = 2; /// Relative address Lo
msg[4] = (byte)(temperatureSetpoint >> 8); /// Output data Hi
msg[5] = (byte)(temperatureSetpoint & 0xFF); /// Output data Lo
modbus.SendMessage(msg);
}
/// <summary>
/// Events: SetOpututsDone, Error
/// </summary>
/// <param name="temperatureSetpoint">Reference to a variable for the pressure in Bar</param>
/// <returns>SetOutputsOp instance reference casted to IOperaton</returns>
public IOperation SetTemperatureOp(ushort temperatureSetpoint)
{
return new SetTemperatureOp(this, temperatureSetpoint);
}
/// <summary>
/// Events: pressureDone, Error
/// </summary>
/// <param name="outValue">Reference to a variable for the pressure in Bar</param>
/// <param name="setOutputsDone">Event returned when SetOutput is done</param>
/// <returns>SetOutputsOp instance reference casted to IOperaton</returns>
public IOperation ReadTemperatureOp(ushort outValue, Event setOutputsDone)
{
return new ReadTemperatureOp(this, outValue, setOutputsDone);
}
}
}

View File

@ -0,0 +1,43 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Modbus.Easytherm
{
public class EasythermCfg : ComponentCfgBase, Generic.IChildComponentCfg
{
public IComponentCfgCtrl GetControl() { return new EasythermCfgCtrl(); }
///
/// Serialized parameters
///
public byte ModbusAddress; /// 1..255
/// Private parameterless constructor invoked by all other (public) constructors
EasythermCfg()
{
Name = "Easytherm";
ParentName = "Modbus";
ModbusAddress = 49;
}
public EasythermCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
return string.Format("Name={0}, ModbusAddr={1}, Parent={2}",
Name,
ModbusAddress,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName));
}
}
}

View File

@ -0,0 +1,106 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Windows.Forms;
using log4net;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Modbus.Easytherm
{
public partial class EasythermCfgCtrl : UserControl, IComponentCfgCtrl
{
static readonly ILog log = LogManager.GetLogger(typeof(EasythermCfgCtrl));
ComponentParametersDlg parent;
public bool ShowMore { get { return false; } }
EasythermCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as EasythermCfg;
Redraw();
}
}
public EasythermCfgCtrl()
{
InitializeComponent();
}
private void QuidoRSCfgCtrl_Load(object sender, EventArgs e)
{
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
{
foreach (var cmpnt in parent.TbfComponents)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
{
parentNameComboBox.Items.Add(cmpnt.Name);
}
}
}
Redraw();
}
public void Closing()
{
}
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
componentNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
modbusAddressTextBox.Text = config.ModbusAddress.ToString();
}
public void Unlock()
{
nameTextBox.Enabled = true;
parentNameComboBox.Enabled = true;
modbusAddressTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Parent Name'";
}
if (!int.TryParse(modbusAddressTextBox.Text, out dummy) || dummy < 0 || dummy > 255)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Modbus Address' should be between 0 and 255";
}
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.ModbusAddress = (byte)int.Parse(modbusAddressTextBox.Text);
return flags;
}
}
}

View File

@ -0,0 +1,133 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
namespace TBF.BenchControl.Modbus.Easytherm
{
partial class EasythermCfgCtrl
{
/// <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 Component 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.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, 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;
//
// EasythermCfgCtrl
//
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 = "EasythermCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.QuidoRSCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label parentNameLabel;
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label componentNameLabel;
private System.Windows.Forms.Label modbusAddressLabel;
private System.Windows.Forms.TextBox modbusAddressTextBox;
private System.Windows.Forms.ComboBox parentNameComboBox;
}
}

View File

@ -0,0 +1,26 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Modbus.Easytherm
{
public class Factory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public void ResetStaticProperties() { Easytherm.ResetStaticProperties(); }
public IComponent DummyComponent() { return new Easytherm(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Easytherm(cfg, components); }
public IComponentCfg DefaultConfig() { return new EasythermCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(EasythermCfg), component, this);
}
}
}

View File

@ -0,0 +1,56 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using log4net;
using TBF.Boxes;
namespace TBF.BenchControl.Modbus.Easytherm
{
public class ReadTemperatureOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(SetTemperatureOp));
public override string ToString() { return string.Format("SetOutputsOp(.,{0},{1})", outValue, eventDone); }
/// Set by the constructor
readonly Easytherm easytherm;
readonly Event eventDone;
ushort outValue;
/// <summary>
/// Events: PressureInDone, PressureOutDone or Error
/// </summary>
/// <param name="easytherm">Pressure meter reference</param>
/// <param name="pressure">Reference to the measured pressure variable, value is in bar</param>
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
public ReadTemperatureOp(Easytherm easytherm, ushort outValue, Event eventDone)
{
if (easytherm == null) throw new ArgumentNullException("easytherm");
this.easytherm = easytherm;
this.outValue = outValue;
this.eventDone = eventDone;
log.Debug(this.ToString());
}
public ReadTemperatureOp(Easytherm easytherm, ushort outValue)
: this(easytherm, outValue, Event.SetOutputsDone)
{
}
/// <summary>Start this operation</summary>
public void Start()
{
}
/// <summary>Run this operation</summary>
public Event Run()
{
return eventDone;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
}
}
}

View File

@ -0,0 +1,57 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using log4net;
using TBF.Boxes;
namespace TBF.BenchControl.Modbus.Easytherm
{
public class SetTemperatureOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(SetTemperatureOp));
public override string ToString() { return string.Format("SetTemperatureOp(.,{0},{1})", temperatureSetpoint, eventDone); }
/// Set by the constructor
readonly Easytherm easytherm;
readonly Event eventDone;
ushort temperatureSetpoint;
/// <summary>
/// Events: PressureInDone, PressureOutDone or Error
/// </summary>
/// <param name="easytherm">Pressure meter reference</param>
/// <param name="pressure">Reference to the measured pressure variable, value is in bar</param>
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
public SetTemperatureOp(Easytherm easytherm, ushort temperatureSetpoint, Event eventDone)
{
if (easytherm == null) throw new ArgumentNullException("easytherm");
this.easytherm = easytherm;
this.temperatureSetpoint = temperatureSetpoint;
this.eventDone = eventDone;
log.Debug(this.ToString());
}
public SetTemperatureOp(Easytherm easytherm, ushort outValue)
: this(easytherm, outValue, Event.SetOutputsDone)
{
}
/// <summary>Start this operation</summary>
public void Start()
{
easytherm.SetTemperature(temperatureSetpoint);
}
/// <summary>Run this operation</summary>
public Event Run()
{
return eventDone;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
}
}
}

View File

@ -7,14 +7,14 @@ namespace TBF.BenchControl.Modbus
{
public enum Function : byte
{
ReadCoilStatus = 0x01,
ReadSingleInput = 0x02,
ReadHoldingRegisters = 0x03,
ReadInputRegister = 0x04,
ForceSingleCoil = 0x05,
PresetSingleRegister = 0x06,
ForceMultipleCoils = 0x0F,
ReadCoilStatus = 0x01,
ReadSingleInput = 0x02,
ReadHoldingRegisters = 0x03,
ReadInputRegister = 0x04,
ForceSingleCoil = 0x05,
PresetSingleRegister = 0x06,
ForceMultipleCoils = 0x0F,
PresetMultipleRegisters = 0x10,
Identification = 0x11,
Identification = 0x11,
}
}

View File

@ -8,7 +8,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
{
public class Factory : IComponentFactory
{
public string ClassName { get { return "QuidoRS"; } }
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public void ResetStaticProperties() { QuidoRS.ResetStaticProperties(); }

View File

@ -51,8 +51,11 @@ namespace TBF.BenchControl.Modbus.QuidoRS
/// <summary>Run this device</summary>
public void RunDeviceAfter()
{
currentOutputs = (UInt16)((Int32)currentOutputs ^ (Int32)watchdogBitMask);
SendOutputs(currentOutputs);
if (watchdogBitMask != 0)
{
currentOutputs = (UInt16)((Int32)currentOutputs ^ (Int32)watchdogBitMask);
SendOutputs(currentOutputs);
}
}
/// <summary>Stop this device</summary>

View File

@ -4,11 +4,11 @@
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Modbus.QuidoRS.TankSelector
namespace TBF.BenchControl.Modbus.TankSelector
{
public class Factory : IComponentFactory
{
public string ClassName { get { return "TankSelector"; } }
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public void ResetStaticProperties() { TankSelector.ResetStaticProperties(); }

View File

@ -7,7 +7,7 @@ using log4net;
using TBF.BenchControl.Generic;
using TBF.Boxes;
namespace TBF.BenchControl.Modbus.QuidoRS.TankSelector
namespace TBF.BenchControl.Modbus.TankSelector
{
public class TankSelector : ComponentBase, IOperation
{
@ -15,7 +15,9 @@ namespace TBF.BenchControl.Modbus.QuidoRS.TankSelector
public override string ToString() { return string.Format("TankSelector({0})", Cfg.ToString(1)); }
readonly TankSelectorCfg tankSelectorCfg;
readonly QuidoRS quidoRS;
readonly TBF.BenchControl.Modbus.QuidoRS.QuidoRS quidoRS;
readonly TBF.BenchControl.Modbus.Easytherm.Easytherm easytherm;
readonly Elde.ControlBoardDev controlBoard;
public enum CurrentOp
@ -27,6 +29,27 @@ namespace TBF.BenchControl.Modbus.QuidoRS.TankSelector
CurrentOp currentOp;
/// <summary>
/// Quido digital out board outputs assignment
/// </summary>
private enum QuidoInputs
{
None = 0,
SelectColdTank = 0x0001,
SelectWarmTank = 0x0002,
SelectHotTank = 0x0004,
PumpToColdTank = 0x0008,
PumpToWarmTank = 0x0010,
PumpToHotTank = 0x0020,
Mixing = 0x0040,
HeatingHotTank = 0x0080,
HeatingWarmTank = 0x0100,
CoolingHotTank = 0x0200,
CoolingWarmTank = 0x0400,
CoolingColdTank = 0x0800,
}
public TankSelector()
{
}
@ -36,8 +59,11 @@ namespace TBF.BenchControl.Modbus.QuidoRS.TankSelector
{
tankSelectorCfg = cfg as TankSelectorCfg;
quidoRS = (QuidoRS)TbfComponents.FindComponent(cfg.ParentName, components);
if (quidoRS == null) throw new Exception("Cannot find " + Name + " parent");
quidoRS = (TBF.BenchControl.Modbus.QuidoRS.QuidoRS)TbfComponents.FindComponent(cfg.ParentName, components);
if (quidoRS == null) throw new Exception(string.Format("Cannot find parent '{0}' of the component {1}", cfg.ParentName, Name));
controlBoard = (Elde.ControlBoardDev)TbfComponents.FindComponent(tankSelectorCfg.ControlBoard, components);
if (controlBoard == null) throw new Exception(string.Format("Cannot find control board '{0}' for the component {1}", tankSelectorCfg.ControlBoard, Name));
log.Debug(this.ToString());
}

View File

@ -7,7 +7,7 @@ using System.IO;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Modbus.QuidoRS.TankSelector
namespace TBF.BenchControl.Modbus.TankSelector
{
public class TankSelectorCfg : ComponentCfgBase, Generic.IChildComponentCfg
{

View File

@ -6,7 +6,7 @@ using System.Windows.Forms;
using log4net;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Modbus.QuidoRS.TankSelector
namespace TBF.BenchControl.Modbus.TankSelector
{
public partial class TankSelectorCfgCtrl : UserControl, IComponentCfgCtrl
{

View File

@ -1,7 +1,7 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
namespace TBF.BenchControl.Modbus.QuidoRS.TankSelector
namespace TBF.BenchControl.Modbus.TankSelector
{
partial class TankSelectorCfgCtrl
{

View File

@ -0,0 +1,120 @@
<?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>

View File

@ -70,7 +70,10 @@ namespace TBF.BenchControl
Factories.Add(new MettlerToledo.Standard.BalanceNewFactory()); /// MettlerToledoBalanceSN
Factories.Add(new MettlerToledo.Multi.BalanceFactory()); /// MettlerToledo-Multi
Factories.Add(new Modbus.Common.Factory()); /// Modbus
Factories.Add(new Modbus.PressureMeter.Meret.Factory()); /// Meret pressure meter connected via modbus
Factories.Add(new Modbus.Easytherm.Factory()); /// Modbus.Easytherm
Factories.Add(new Modbus.PressureMeter.Meret.Factory()); /// Modbus.PressureMeter.Meret - Meret pressure meter connected via modbus
Factories.Add(new Modbus.QuidoRS.Factory()); /// Modbus.QuidoRS
Factories.Add(new Modbus.TankSelector.Factory()); /// Modbus.TankSelector
Factories.Add(new Network.Adapter.Factory());
Factories.Add(new Network.Camera.CLP1611.Factory());
Factories.Add(new Network.Camera.Roi.Factory());
@ -86,14 +89,12 @@ namespace TBF.BenchControl
Factories.Add(new Danfoss.VLT2800.PumpFactory());
Factories.Add(new Elde.PumpWithFM.PumpFactory());
Factories.Add(new Elde.PumpTandem.PumpFactory());
Factories.Add(new Modbus.QuidoRS.Factory()); /// QuidoRS
Factories.Add(new Elde.RegisterReader.Factory());
Factories.Add(new Elde.RegulValve.RegulValveFactory());
Factories.Add(new Elde.RegulValveTandem.RegulValveTandemFactory());
Factories.Add(new ResultsPrinters.Cevak.PrinterFactory());
Factories.Add(new ResultsPrinters.Munich.PrinterFactory());
Factories.Add(new DB.SensusOracle.DatabaseFactory());
Factories.Add(new Modbus.QuidoRS.TankSelector.Factory()); /// TankSelector
Factories.Add(new Elde.TempMeter.TempMeterFactory());
Factories.Add(new Elde.TempMeterInternal.TempMeterFactory());
Factories.Add(new Elde.Valve.ValveFactory());

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sensus")]
[assembly: AssemblyProduct("TestBenchFramework")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2016 Sensus Slovensko, a.s.")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2017 Sensus Slovensko, a.s.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.12.456.1")]
[assembly: AssemblyFileVersion("2.12.456.1")]
[assembly: AssemblyVersion("2.12.457.1")]
[assembly: AssemblyFileVersion("2.12.457.1")]

View File

@ -486,6 +486,17 @@
<Compile Include="BenchControl\MettlerToledo\Standard\ReadStableMassOp.cs" />
<Compile Include="BenchControl\MettlerToledo\Standard\SetUnitsOp.cs" />
<Compile Include="BenchControl\MettlerToledo\Standard\TaringOp.cs" />
<Compile Include="BenchControl\Modbus\Easytherm\Factory.cs" />
<Compile Include="BenchControl\Modbus\Easytherm\Easytherm.cs" />
<Compile Include="BenchControl\Modbus\Easytherm\EasythermCfg.cs" />
<Compile Include="BenchControl\Modbus\Easytherm\EasythermCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BenchControl\Modbus\Easytherm\EasythermCfgCtrl.designer.cs">
<DependentUpon>EasythermCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Modbus\Easytherm\ReadTemperatureOp.cs" />
<Compile Include="BenchControl\Modbus\Easytherm\SetTemperatureOp.cs" />
<Compile Include="BenchControl\Modbus\Enums.cs" />
<Compile Include="BenchControl\Modbus\Common\Modbus.cs" />
<Compile Include="BenchControl\Modbus\Common\ModbusCfg.cs" />
@ -516,13 +527,13 @@
</Compile>
<Compile Include="BenchControl\Modbus\QuidoRS\Factory.cs" />
<Compile Include="BenchControl\Modbus\QuidoRS\SetOutputsOp.cs" />
<Compile Include="BenchControl\Modbus\QuidoRS\TankSelector\Factory.cs" />
<Compile Include="BenchControl\Modbus\QuidoRS\TankSelector\TankSelector.cs" />
<Compile Include="BenchControl\Modbus\QuidoRS\TankSelector\TankSelectorCfg.cs" />
<Compile Include="BenchControl\Modbus\QuidoRS\TankSelector\TankSelectorCfgCtrl.cs">
<Compile Include="BenchControl\Modbus\TankSelector\Factory.cs" />
<Compile Include="BenchControl\Modbus\TankSelector\TankSelector.cs" />
<Compile Include="BenchControl\Modbus\TankSelector\TankSelectorCfg.cs" />
<Compile Include="BenchControl\Modbus\TankSelector\TankSelectorCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BenchControl\Modbus\QuidoRS\TankSelector\TankSelectorCfgCtrl.designer.cs">
<Compile Include="BenchControl\Modbus\TankSelector\TankSelectorCfgCtrl.designer.cs">
<DependentUpon>TankSelectorCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Network\Adapter\AdapterInfo.cs" />
@ -1877,13 +1888,16 @@
<EmbeddedResource Include="BenchControl\Modbus\Common\ModbusCfgCtrl.resx">
<DependentUpon>ModbusCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Modbus\Easytherm\EasythermCfgCtrl.resx">
<DependentUpon>EasythermCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Modbus\PressureMeter\Meret\PressureMeterCfgCtrl.resx">
<DependentUpon>PressureMeterCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Modbus\QuidoRS\QuidoRSCfgCtrl.resx">
<DependentUpon>QuidoRSCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Modbus\QuidoRS\TankSelector\TankSelectorCfgCtrl.resx">
<EmbeddedResource Include="BenchControl\Modbus\TankSelector\TankSelectorCfgCtrl.resx">
<DependentUpon>TankSelectorCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Network\Adapter\NetadapterCfgCtrl.resx">