ITempMeter iface added to Modbus.Easytherm.Easytherm, SetReservoirTemp() added to IControlCom and used by Easytherm, Modbus uses queues, sends 1 telegram/s, ver. 2.14.575
This commit is contained in:
@@ -219,6 +219,10 @@ namespace TBF.BenchControl.Elde
|
||||
}
|
||||
}
|
||||
|
||||
public void SetReservoirTemp(int nr, float temp)
|
||||
{
|
||||
controlCom.SetReservoirTemp(nr, temp);
|
||||
}
|
||||
|
||||
public ControlBoardDev()
|
||||
{
|
||||
|
||||
@@ -80,6 +80,9 @@ namespace TBF.BenchControl.Elde
|
||||
}
|
||||
bool manualUIAllowed = true;
|
||||
|
||||
public void SetReservoirTemp(int nr, float temp) { }
|
||||
|
||||
|
||||
///
|
||||
/// Private initialization data updated by contructors of children components
|
||||
/// and sent to 'controlCom2panel' by SendCalibData() method.
|
||||
|
||||
@@ -96,6 +96,13 @@ namespace TBF.BenchControl.Elde
|
||||
log.DebugFormat("SetWeight(pos={0}, mass={1}", pos, mass);
|
||||
}
|
||||
|
||||
public void SetReservoirTemp(int nr, float temp)
|
||||
{
|
||||
#if GENESIS
|
||||
if (nr > 0 && nr <= 3) ctrlBrdComponent.TankTemp[nr - 1] = temp;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Reference to the control board component
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace TBF.BenchControl.Elde
|
||||
uint[] WMeterCont { get; }
|
||||
bool ManualUIAllowed { get; set; }
|
||||
|
||||
void SetReservoirTemp(int nr, float temp);
|
||||
|
||||
/// <summary>
|
||||
/// Sends calibration and configuration data to the control board.
|
||||
/// </summary>
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace TBF.BenchControl.Modbus.Common
|
||||
}
|
||||
Queue<byte[]>[] receivedTelegrams;
|
||||
|
||||
Queue<byte[]> telegramsToSend;
|
||||
|
||||
public Modbus()
|
||||
{
|
||||
@@ -51,6 +52,7 @@ namespace TBF.BenchControl.Modbus.Common
|
||||
{
|
||||
receivedTelegrams[i] = new Queue<byte[]>();
|
||||
}
|
||||
telegramsToSend = new Queue<byte[]>();
|
||||
|
||||
serialPort = null;
|
||||
modbusCommonCfg = cfg as ModbusCfg;
|
||||
@@ -66,7 +68,7 @@ namespace TBF.BenchControl.Modbus.Common
|
||||
if (modbusCommonCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
serialPort = null;
|
||||
log.FatalFormat("Simulated device {0}", ToString());
|
||||
log.FatalFormat("{0} - Device simulated", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -79,7 +81,7 @@ namespace TBF.BenchControl.Modbus.Common
|
||||
//workerThread = new Thread(Worker);
|
||||
//workerThread.Start();
|
||||
|
||||
log.FatalFormat("Successfully initialized device {0}", ToString());
|
||||
log.FatalFormat("{0} - Device successfully initialized", Name);
|
||||
}
|
||||
|
||||
|
||||
@@ -96,11 +98,12 @@ namespace TBF.BenchControl.Modbus.Common
|
||||
|
||||
Telegram.UpdateTelegramCRC(message);
|
||||
|
||||
serialPort.Write(message, 0, message.Length);
|
||||
telegramsToSend.Enqueue(message);
|
||||
|
||||
Debug.WriteLine(Telegram.LogTelegram("Sending message ", message));
|
||||
log.Debug(Telegram.LogTelegram("Sending message ", message));
|
||||
}
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Enqueueing message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -125,14 +128,9 @@ namespace TBF.BenchControl.Modbus.Common
|
||||
0,
|
||||
0,
|
||||
};
|
||||
Telegram.UpdateTelegramCRC(message);
|
||||
|
||||
serialPort.Write(message, 0, message.Length);
|
||||
|
||||
string s = Telegram.LogTelegram("Sending message ", message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
@@ -151,15 +149,15 @@ namespace TBF.BenchControl.Modbus.Common
|
||||
|
||||
if ((nrBytes >= 4) && Telegram.VerifyTelegramCRC(buffer))
|
||||
{
|
||||
//receivedTelegrams[deviceAddress].Enqueue(buffer);
|
||||
receivedTelegrams[deviceAddress].Enqueue(buffer);
|
||||
|
||||
string s = string.Format("{0} address={1} count={2}", Telegram.LogTelegram("Telegram received: ", buffer), deviceAddress, receivedTelegrams[deviceAddress].Count);
|
||||
string s = string.Format("{0} - {1} address={2} count={3}", Name, Telegram.LogTelegram("Telegram received: ", buffer), deviceAddress, receivedTelegrams[deviceAddress].Count);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
string s = Telegram.LogTelegram("Invalid data received ", buffer);
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Invalid data received ", Name), buffer);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
@@ -169,7 +167,18 @@ namespace TBF.BenchControl.Modbus.Common
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
}
|
||||
if (serialPort == null) return;
|
||||
|
||||
if (telegramsToSend.Count > 0)
|
||||
{
|
||||
byte[] message = telegramsToSend.Dequeue();
|
||||
serialPort.Write(message, 0, message.Length);
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Sending message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
|
||||
@@ -6,10 +6,11 @@ using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Easytherm
|
||||
{
|
||||
public class Easytherm : ComponentBase, IDevice
|
||||
public class Easytherm : ComponentBase, IDevice, GenericDevices.ITempMeter
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Easytherm));
|
||||
public override string ToString() { return string.Format("Easytherm({0})", Cfg.ToString(1)); }
|
||||
@@ -19,10 +20,10 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
|
||||
private float temperatureSetPoint;
|
||||
private bool temperatureSetPointValid;
|
||||
private bool temperatureSetPointRequested;
|
||||
|
||||
public float requiredTemp { get { return easythermCfg.ProcParams.RequiredTemp; } }
|
||||
|
||||
|
||||
public Easytherm()
|
||||
{
|
||||
}
|
||||
@@ -35,38 +36,89 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
temperatureSetPointValid = false;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Initialize this device</summary>
|
||||
public void Initialize()
|
||||
{
|
||||
if (easythermCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
temperatureSetPointValid = false;
|
||||
temperatureSetPointRequested = false;
|
||||
actualTemperatureIsValid = false;
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (easythermCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
|
||||
if (modbus.ReceivedTelegrams[easythermCfg.ModbusAddress].Count > 0)
|
||||
{
|
||||
byte[] telegram = modbus.ReceivedTelegrams[easythermCfg.ModbusAddress].Dequeue();
|
||||
if (telegram.Length == 7 && telegram[1] == (byte)Function.ReadHoldingRegisters && telegram[2] == 2)
|
||||
{
|
||||
ushort value = (ushort)(256 * telegram[3] + telegram[4]);
|
||||
temperatureSetPoint = (float)value * 0.04f;
|
||||
temperatureSetPointValid = true;
|
||||
|
||||
log.InfoFormat("{0} - Received current temperature setpoint = {1}", Name, temperatureSetPoint);
|
||||
}
|
||||
else if (telegram.Length == 7 && telegram[1] == (byte)Function.ReadInputRegister && telegram[2] == 2)
|
||||
{
|
||||
ushort value = (ushort)(256 * telegram[3] + telegram[4]);
|
||||
actualTemperature = (double)value * 0.04;
|
||||
actualTemperatureIsValid = true;
|
||||
|
||||
log.InfoFormat("{0} - Received actual temperature = {1}", Name, actualTemperature);
|
||||
|
||||
if (easythermCfg.ReservoirNr > 0 && easythermCfg.ReservoirNr <= 3)
|
||||
{
|
||||
StateMachine.ControlBoard.SetReservoirTemp(easythermCfg.ReservoirNr, (float)actualTemperature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!temperatureSetPointValid && !temperatureSetPointRequested)
|
||||
{
|
||||
RequestTemperatureSetpoint();
|
||||
temperatureSetPointRequested = true;
|
||||
}
|
||||
else if (temperatureSetPointValid && requiredTemp != temperatureSetPoint)
|
||||
{
|
||||
SetTemperatureSetpoint(requiredTemp);
|
||||
log.InfoFormat("{0} - Set new temperature setpoint = {1}", Name, requiredTemp);
|
||||
}
|
||||
else if ((StateMachine.Time % 10) == (easythermCfg.ModbusAddress % 10)) /// This is to prevent overflow of the Modbus component queue for sending data
|
||||
{
|
||||
RequestActualTemperature();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (easythermCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (easythermCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set Easytherm controller to required temperature procedure parameter
|
||||
/// </summary>
|
||||
/// <returns>true = OK, false = any error</returns>
|
||||
public bool SetRequiredTemperature()
|
||||
public bool SetTemperatureSetpoint()
|
||||
{
|
||||
return SetTemperature(requiredTemp);
|
||||
return SetTemperatureSetpoint(requiredTemp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -74,7 +126,7 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
/// </summary>
|
||||
/// <param name="temperature">Temperature in °C</param>
|
||||
/// <returns>true = OK, false = any error</returns>
|
||||
public bool SetTemperature(float temperature)
|
||||
public bool SetTemperatureSetpoint(float temperature)
|
||||
{
|
||||
if (temperature < 0 || temperature > 100.0f)
|
||||
{
|
||||
@@ -86,52 +138,57 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
return true; /// already set to the required temperature
|
||||
}
|
||||
|
||||
//ushort temperatureSetpoint = (ushort)temperature; // in °C
|
||||
//ushort destAddress = (ushort)1002;
|
||||
ushort usTempSetpoint = (ushort)((10000.0f / 400.0f) * temperature); // in 0.01% of range (400 °C)
|
||||
ushort destAddress = (ushort)2;
|
||||
///
|
||||
SendValueToEasytherm(Function.PresetSingleRegister, destAddress, usTempSetpoint);
|
||||
|
||||
temperatureSetPoint = temperature;
|
||||
temperatureSetPointValid = true;
|
||||
|
||||
//ushort temperatureSetpoint = (ushort)temperature; // in °C
|
||||
//ushort destAddress = (ushort)1002;
|
||||
ushort temperatureSetpoint = (ushort)((10000.0f / 400.0f) * temperature); // in 0.01% of range (400 °C)
|
||||
ushort destAddress = (ushort)2;
|
||||
|
||||
byte[] msg = new byte[8];
|
||||
|
||||
msg[0] = easythermCfg.ModbusAddress;
|
||||
msg[1] = (byte)Function.PresetSingleRegister;
|
||||
msg[2] = (byte)(destAddress >> 8); /// Relative address Hi
|
||||
msg[3] = (byte)(destAddress & 0xFF); /// Relative address Lo
|
||||
msg[4] = (byte)(temperatureSetpoint >> 8); /// Output data Hi
|
||||
msg[5] = (byte)(temperatureSetpoint & 0xFF); /// Output data Lo
|
||||
|
||||
modbus.SendMessage(msg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set outputs of QuidoRS board
|
||||
/// </summary>
|
||||
/// <param name="temperature">output value</param>
|
||||
public void GetSomething(ushort address, int len)
|
||||
{
|
||||
ReadSomething(address, len);
|
||||
}
|
||||
public void RequestTemperatureSetpoint()
|
||||
{
|
||||
SendValueToEasytherm(Function.ReadHoldingRegisters, (ushort)2, (ushort)1); // rel.address=2, 1 word
|
||||
}
|
||||
|
||||
private void ReadSomething(ushort address, int len)
|
||||
public void RequestActualTemperature()
|
||||
{
|
||||
SendValueToEasytherm(Function.ReadInputRegister, (ushort)0, (ushort)1); // rel.address=x, 1 word
|
||||
}
|
||||
|
||||
void SendValueToEasytherm(Function function, ushort address, ushort value)
|
||||
{
|
||||
byte[] msg = new byte[8];
|
||||
|
||||
msg[0] = easythermCfg.ModbusAddress;
|
||||
msg[1] = (byte)Function.ReadInputRegister;
|
||||
msg[2] = (byte)(address >> 8); /// Relative address Hi
|
||||
msg[3] = (byte)(address & 0xFF); /// Relative address Lo
|
||||
msg[4] = (byte)((len >> 8) & 0xFF); /// Data length Hi
|
||||
msg[5] = (byte)(len & 0xFF); /// Data length Lo
|
||||
msg[1] = (byte)function;
|
||||
msg[2] = (byte)(address >> 8); /// Relative address Hi
|
||||
msg[3] = (byte)(address & 0xFF); /// Relative address Lo
|
||||
msg[4] = (byte)(value >> 8); /// Data Hi
|
||||
msg[5] = (byte)(value & 0xFF); /// Data Lo
|
||||
|
||||
modbus.SendMessage(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
///
|
||||
/// Operations, etc.
|
||||
///
|
||||
|
||||
double actualTemperature;
|
||||
bool actualTemperatureIsValid;
|
||||
|
||||
public double ReadTemperature()
|
||||
{
|
||||
return actualTemperature;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Events: SetOpututsDone, Error
|
||||
/// </summary>
|
||||
@@ -150,5 +207,15 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
{
|
||||
return new SetTemperatureOp(this, temperature);
|
||||
}
|
||||
|
||||
public IOperation ReadTempOp(ref DoubleBox temp)
|
||||
{
|
||||
return new ReadTempOp(this, ref temp);
|
||||
}
|
||||
|
||||
public IOperation ReadTempOp(ref DoubleBox temp, Event eventDone)
|
||||
{
|
||||
return new ReadTempOp(this, ref temp, eventDone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
/// Serialized parameters
|
||||
///
|
||||
public byte ModbusAddress; /// 1..255
|
||||
public int ReservoirNr;
|
||||
|
||||
|
||||
/// <summary> Procedure parameters </summary>
|
||||
|
||||
@@ -63,14 +63,16 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
nameTextBox.Text = config.Name;
|
||||
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
|
||||
modbusAddressTextBox.Text = config.ModbusAddress.ToString();
|
||||
}
|
||||
reservoirNrTextBox.Text = config.ReservoirNr.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
parentNameComboBox.Enabled = true;
|
||||
modbusAddressTextBox.Enabled = true;
|
||||
}
|
||||
reservoirNrTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
@@ -87,6 +89,11 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Modbus Address' should be between 0 and 255";
|
||||
}
|
||||
if (!int.TryParse(reservoirNrTextBox.Text, out dummy) || dummy < 0 || dummy > 3)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Reservoir Nr.' should be between 0 and 3";
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
@@ -99,6 +106,7 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
|
||||
config.ModbusAddress = (byte)int.Parse(modbusAddressTextBox.Text);
|
||||
config.ReservoirNr = int.Parse(reservoirNrTextBox.Text);
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
+109
-86
@@ -31,92 +31,113 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
/// </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();
|
||||
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.reservoirNrTextBox = new System.Windows.Forms.TextBox();
|
||||
this.reservoirNrLabel = 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;
|
||||
//
|
||||
// reservoirNrTextBox
|
||||
//
|
||||
this.reservoirNrTextBox.Enabled = false;
|
||||
this.reservoirNrTextBox.Location = new System.Drawing.Point(138, 130);
|
||||
this.reservoirNrTextBox.Name = "reservoirNrTextBox";
|
||||
this.reservoirNrTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.reservoirNrTextBox.TabIndex = 10;
|
||||
//
|
||||
// reservoirNrLabel
|
||||
//
|
||||
this.reservoirNrLabel.AutoSize = true;
|
||||
this.reservoirNrLabel.Location = new System.Drawing.Point(28, 133);
|
||||
this.reservoirNrLabel.Name = "reservoirNrLabel";
|
||||
this.reservoirNrLabel.Size = new System.Drawing.Size(67, 13);
|
||||
this.reservoirNrLabel.TabIndex = 9;
|
||||
this.reservoirNrLabel.Text = "Reservoir nr.";
|
||||
//
|
||||
// EasythermCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.reservoirNrTextBox);
|
||||
this.Controls.Add(this.reservoirNrLabel);
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
@@ -129,5 +150,7 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
private System.Windows.Forms.Label modbusAddressLabel;
|
||||
private System.Windows.Forms.TextBox modbusAddressTextBox;
|
||||
private System.Windows.Forms.ComboBox parentNameComboBox;
|
||||
private System.Windows.Forms.TextBox reservoirNrTextBox;
|
||||
private System.Windows.Forms.Label reservoirNrLabel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Easytherm
|
||||
{
|
||||
public class ReadTempOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadTempOp));
|
||||
public override string ToString() { return string.Format("ReadTempOp({0},.,{1})", easytherm.Name, eventDone); }
|
||||
|
||||
/// Set by the constructor
|
||||
Easytherm easytherm;
|
||||
Event eventDone;
|
||||
DoubleBox temp;
|
||||
|
||||
/// <summary>
|
||||
/// Events: TempInDone, TempOutDone, TempDivDone or Error
|
||||
/// </summary>
|
||||
/// <param name="easytherm">TempMeter reference</param>
|
||||
/// <param name="temp">Reference to the variable, value is in degree Celsius</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadTempOp(Easytherm easytherm, ref DoubleBox temp, Event eventDone)
|
||||
{
|
||||
if (easytherm == null) throw new ArgumentNullException("easytherm");
|
||||
this.easytherm = easytherm;
|
||||
this.temp = temp;
|
||||
this.eventDone = eventDone;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public ReadTempOp(Easytherm tempMeter, ref DoubleBox temp)
|
||||
: this(tempMeter, ref temp, Event.TempDone)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
temp.Val = easytherm.ReadTemperature();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.TempInDone, Event.TempOutDone or Event.TempDivDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
temp.Val = easytherm.ReadTemperature();
|
||||
return eventDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
easytherm.SetRequiredTemperature();
|
||||
easytherm.SetTemperatureSetpoint();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
easytherm.SetTemperature(temperatureSetpoint);
|
||||
easytherm.SetTemperatureSetpoint(temperatureSetpoint);
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.14.574.1")]
|
||||
[assembly: AssemblyFileVersion("2.14.574.1")]
|
||||
[assembly: AssemblyVersion("2.14.575.1")]
|
||||
[assembly: AssemblyFileVersion("2.14.575.1")]
|
||||
|
||||
@@ -535,6 +535,7 @@
|
||||
<DependentUpon>EasythermCfgCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\Modbus\Easytherm\ProcParams.cs" />
|
||||
<Compile Include="BenchControl\Modbus\Easytherm\ReadTempOp.cs" />
|
||||
<Compile Include="BenchControl\Modbus\Easytherm\SetRequiredTemperatureOp.cs" />
|
||||
<Compile Include="BenchControl\Modbus\Easytherm\SetTemperatureOp.cs" />
|
||||
<Compile Include="BenchControl\Modbus\Enums.cs" />
|
||||
|
||||
Reference in New Issue
Block a user