UniCB DrShp, AltStrings, double Press, new Cfg style, Lbl,Setp,Msrd pos != 0, arrow keys, refactorization, ver. 3.1.1597
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config;
|
||||
using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
@@ -16,13 +18,45 @@ 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.IDrawingItCmpnt
|
||||
public class Ambient : ComponentBase, IDevice, IOperation, GenericDevices.IAmbient, IDrawingItCmpntWithMeasuredVal
|
||||
{
|
||||
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.IDrawingItem DrawingItem { get { return ambientCfg as SchematicDrawing.IDrawingItem; } }
|
||||
///
|
||||
/// Configuration and wrappers
|
||||
///
|
||||
private readonly AmbientCfg ambientCfg;
|
||||
///
|
||||
Unit TempUnit { get { return ambientCfg.TempUnit; } }
|
||||
double TempLimLo { get { return Units.ConvertFrom(TempUnit, ambientCfg.TempLimLo); } }
|
||||
double TempLimHi { get { return Units.ConvertFrom(TempUnit, ambientCfg.TempLimHi); } }
|
||||
double DefaultTemperature { get { return Units.ConvertFrom(TempUnit, ambientCfg.DefaultTemp); } }
|
||||
///
|
||||
Unit PressureUnit { get { return ambientCfg.PressureUnit; } }
|
||||
double PressureLimLo { get { return Units.ConvertFrom(PressureUnit, ambientCfg.PressureLimLo); } }
|
||||
double PressureLimHi { get { return Units.ConvertFrom(PressureUnit, ambientCfg.PressureLimHi); } }
|
||||
double DefaultPressure { get { return Units.ConvertFrom(PressureUnit, ambientCfg.DefaultPressure); } }
|
||||
///
|
||||
Unit HumiUnit { get { return ambientCfg.HumiUnit; } }
|
||||
double HumiLimLo { get { return Units.ConvertFrom(HumiUnit, ambientCfg.HumiLimLo); } }
|
||||
double HumiLimHi { get { return Units.ConvertFrom(HumiUnit, ambientCfg.HumiLimHi); } }
|
||||
double DefaultHumidity { get { return Units.ConvertFrom(HumiUnit, ambientCfg.DefaultHumi); } }
|
||||
|
||||
///
|
||||
/// IDrawingItCmpntWithMeasuredVal interface
|
||||
///
|
||||
public IDrawingItem DrawingItem { get { return ambientCfg as IDrawingItem; } }
|
||||
public double MeasuredVal { get { return temperature; } }
|
||||
public string AltString
|
||||
{
|
||||
get {
|
||||
return string.Format(ambientCfg.Format, Units.ConvertTo(TempUnit, temperature),
|
||||
Units.ConvertTo(PressureUnit, pressure),
|
||||
Units.ConvertTo(HumiUnit, humidity));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Private fields
|
||||
SerialPort serialPort;
|
||||
@@ -32,9 +66,9 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
int msrmntTimeStamp;
|
||||
|
||||
/// Measured values when MsrmntState == MsrmntState.Valid
|
||||
float temperature; /// [°C]
|
||||
float pressure; /// [bar]
|
||||
float humidity; /// [R%]
|
||||
double temperature; /// [°C]
|
||||
double pressure; /// [bar]
|
||||
double humidity; /// [R%]
|
||||
|
||||
|
||||
public Ambient()
|
||||
@@ -53,6 +87,11 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
: base(cfg)
|
||||
{
|
||||
ambientCfg = cfg as AmbientCfg;
|
||||
|
||||
temperature = DefaultTemperature;
|
||||
pressure = DefaultPressure;
|
||||
humidity = DefaultHumidity;
|
||||
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
@@ -60,10 +99,6 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
{
|
||||
if (ambientCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
temperature = 20.0f;
|
||||
humidity = 40.0f;
|
||||
pressure = 1.0f;
|
||||
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
return;
|
||||
@@ -105,13 +140,13 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
if ((receivedBytes == 13) && (byteArr[0] == 1) && (byteArr[1] == 3) && (byteArr[2] == 8) && Telegram.VerifyTelegramCRC(byteArr))
|
||||
{
|
||||
int value = (int)byteArr[3] * 256 + (int)byteArr[4];
|
||||
temperature = (float)value / 10.0f;
|
||||
temperature = value / 10.0;
|
||||
|
||||
value = (int)byteArr[5] * 256 + (int)byteArr[6];
|
||||
humidity = (float)value / 10.0f;
|
||||
humidity = value / 10.0;
|
||||
|
||||
value = (int)byteArr[9] * 256 + (int)byteArr[10];
|
||||
pressure = (float)value / 10000.0f;
|
||||
pressure = value / 10000.0;
|
||||
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
@@ -194,35 +229,35 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
|
||||
public void StopDevice2() { }
|
||||
|
||||
void UpdateProcessData(float temperature, float pressure, float humidity)
|
||||
void UpdateProcessData(double temperature, double pressure, double humidity)
|
||||
{
|
||||
TBF.BenchControl.Sequences.ProcessData.AmbTemp.Val = temperature;
|
||||
TBF.BenchControl.Sequences.ProcessData.AmbTemp.Val = temperature;
|
||||
TBF.BenchControl.Sequences.ProcessData.AmbPress.Val = pressure;
|
||||
TBF.BenchControl.Sequences.ProcessData.AmbHumi.Val = humidity;
|
||||
TBF.BenchControl.Sequences.ProcessData.AmbHumi.Val = humidity;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Boxes for the operation result
|
||||
///
|
||||
FloatBox tempBox;
|
||||
FloatBox pressureBox;
|
||||
FloatBox humiBox;
|
||||
DoubleBox tempBox;
|
||||
DoubleBox pressureBox;
|
||||
DoubleBox humiBox;
|
||||
|
||||
public IOperation ReadAmbientOp(FloatBox temperature, FloatBox pressure, FloatBox humidity)
|
||||
public IOperation ReadAmbientOp(DoubleBox temperature, DoubleBox pressure, DoubleBox humidity)
|
||||
{
|
||||
this.tempBox = temperature;
|
||||
this.tempBox = temperature;
|
||||
this.pressureBox = pressure;
|
||||
this.humiBox = humidity;
|
||||
this.humiBox = humidity;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
if (tempBox != null) tempBox.Val = temperature;
|
||||
if (tempBox != null) tempBox.Val = temperature;
|
||||
if (pressureBox != null) pressureBox.Val = pressure;
|
||||
if (humiBox != null) humiBox.Val = humidity;
|
||||
if (humiBox != null) humiBox.Val = humidity;
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
@@ -231,15 +266,13 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (tempBox != null) tempBox.Val = temperature;
|
||||
if (tempBox != null) tempBox.Val = temperature;
|
||||
if (pressureBox != null) pressureBox.Val = pressure;
|
||||
if (humiBox != null) humiBox.Val = humidity;
|
||||
if (humiBox != null) humiBox.Val = humidity;
|
||||
return Event.AmbientDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
public void Stop() { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,48 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Xml.Serialization;
|
||||
using Config;
|
||||
using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.Ambient.Comet
|
||||
{
|
||||
public class AmbientCfg : ComponentCfgBase, Generic.IComponentCfg, IDrawingItem
|
||||
public class AmbientCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider, IDrawingItemWithMeasuredVal
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(AmbientCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new AmbientCfgCtrl(); }
|
||||
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int ComPortNr;
|
||||
public int BaudRate;
|
||||
public Parity Parity;
|
||||
public int DataBits;
|
||||
public StopBits StopBits;
|
||||
public Handshake Handshake;
|
||||
public bool SetDtrToOne;
|
||||
public int ComPortNr; /// 0
|
||||
public int BaudRate; /// 1
|
||||
public Parity Parity; /// 2
|
||||
public int DataBits; /// 3
|
||||
public StopBits StopBits; /// 4
|
||||
public Handshake Handshake; /// 5
|
||||
public bool SetDtrToOne; /// 6
|
||||
public Unit TempUnit; /// 7
|
||||
public double TempLimLo; /// 8
|
||||
public double TempLimHi; /// 9
|
||||
public double DefaultTemp; /// 10
|
||||
public Unit PressureUnit; /// 11
|
||||
public double PressureLimLo; /// 12
|
||||
public double PressureLimHi; /// 13
|
||||
public double DefaultPressure; /// 14
|
||||
public Unit HumiUnit; /// 15
|
||||
public double HumiLimLo; /// 16
|
||||
public double HumiLimHi; /// 17
|
||||
public double DefaultHumi; /// 18
|
||||
public string Format; /// 19
|
||||
|
||||
/// Schematic drawing info
|
||||
public Shape Shape { get; set; }
|
||||
@@ -38,6 +54,18 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
public int LblX { get; set; }
|
||||
public int LblY { get; set; }
|
||||
public Orient LblOrient { get; set; }
|
||||
public int MsrdX { get; set; }
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string MsrdFormat { get { return string.Empty; } }
|
||||
[XmlIgnore]
|
||||
public Config.Unit MsrdUnit { get { return TempUnit; } }
|
||||
[XmlIgnore]
|
||||
public double MsrdValLimLo { get { return TempLimLo; } }
|
||||
[XmlIgnore]
|
||||
public double MsrdValLimHi { get { return TempLimHi; } }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
@@ -46,17 +74,24 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
AmbientCfg()
|
||||
{
|
||||
GNodes = new List<GNode>();
|
||||
Format = string.Empty;
|
||||
}
|
||||
|
||||
public AmbientCfg(IComponentFactory factory)
|
||||
public AmbientCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Shape = Shape.Ambient;
|
||||
Sz = Sz.M;
|
||||
|
||||
Factory = factory;
|
||||
Name = "Ambient";
|
||||
Name = name;
|
||||
ParentName = string.Empty;
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
ComPortNr = 6;
|
||||
BaudRate = 9600;
|
||||
Parity = System.IO.Ports.Parity.None;
|
||||
@@ -64,12 +99,255 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
StopBits = System.IO.Ports.StopBits.Two;
|
||||
Handshake = System.IO.Ports.Handshake.None;
|
||||
SetDtrToOne = false;
|
||||
TempUnit = Unit.C;
|
||||
TempLimLo = 15;
|
||||
TempLimHi = 30;
|
||||
DefaultTemp = 25;
|
||||
PressureUnit = Unit.hPa;
|
||||
PressureLimLo = 960;
|
||||
PressureLimHi = 1060;
|
||||
DefaultPressure = 1013;
|
||||
HumiUnit = Unit.RPct;
|
||||
HumiLimLo = 20;
|
||||
HumiLimHi = 80;
|
||||
DefaultHumi = 50;
|
||||
Format = "{0:F1} °C\n{1:F0} hPa\n{2:F0} R%";
|
||||
|
||||
MsrdY = 22;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Serial port number", /// 0
|
||||
"Baud rate", /// 1
|
||||
"Parity", /// 2
|
||||
"Data bits", /// 3
|
||||
"Stop bits", /// 4
|
||||
"Handshake", /// 5
|
||||
"Set DTR to one", /// 6
|
||||
"Unit of temperature", /// 7
|
||||
"Temperature limit Lo", /// 8
|
||||
"Temperature limit Hi", /// 9
|
||||
"Default temperature", /// 10
|
||||
"Unit of pressure", /// 11
|
||||
"Pressure limit Lo", /// 12
|
||||
"Pressure limit Hi", /// 13
|
||||
"Default pressure", /// 14
|
||||
"Unit of rel. humidity", /// 15
|
||||
"Rel. humidity limit Lo", /// 16
|
||||
"Rel. humidity limit Hi", /// 17
|
||||
"Default retl. humidity", /// 18
|
||||
"Display format", /// 19
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public IList<string> ParamValues(int i)
|
||||
{
|
||||
IList<string> values = new List<string>();
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
return new List<string>(new string[] { "150", "300", "600", "1200", "2400", "4800", "9600",
|
||||
"19200", "38400", "57600", "76800", "115200"});
|
||||
case 2:
|
||||
values.Add(Parity.None.ToString());
|
||||
values.Add(Parity.Odd.ToString());
|
||||
values.Add(Parity.Even.ToString());
|
||||
return values;
|
||||
case 3:
|
||||
return new List<string>(new string[] { "7", "8" });
|
||||
case 4:
|
||||
values.Add(StopBits.None.ToString());
|
||||
values.Add(StopBits.One.ToString());
|
||||
values.Add(StopBits.OnePointFive.ToString());
|
||||
values.Add(StopBits.Two.ToString());
|
||||
return values;
|
||||
case 5:
|
||||
values.Add(Handshake.None.ToString());
|
||||
values.Add(Handshake.XOnXOff.ToString());
|
||||
values.Add(Handshake.RequestToSend.ToString());
|
||||
values.Add(Handshake.RequestToSendXOnXOff.ToString());
|
||||
return values;
|
||||
case 6:
|
||||
return new List<string>(new string[] { Strings.yes, Strings.no });
|
||||
case 7:
|
||||
return new List<string>(new string[] { "°C", "°F", "K" });
|
||||
case 11:
|
||||
return new List<string>(new string[] { "Pa", "hPa", "mbar", "kPa", "inHg", "psi", "bar", "MPa" });
|
||||
case 15:
|
||||
return new List<string>(new string[] { "R%" });
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
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);
|
||||
switch (i)
|
||||
{
|
||||
case 0: return ComPortNr.ToString();
|
||||
case 1: return BaudRate.ToString();
|
||||
case 2: return Parity.ToString();
|
||||
case 3: return DataBits.ToString();
|
||||
case 4: return StopBits.ToString();
|
||||
case 5: return Handshake.ToString();
|
||||
case 6: return SetDtrToOne ? Strings.yes : Strings.no;
|
||||
case 7: return TempUnit.ToDescription();
|
||||
case 8: return TempLimLo.ToString();
|
||||
case 9: return TempLimHi.ToString();
|
||||
case 10: return DefaultTemp.ToString();
|
||||
case 11: return PressureUnit.ToDescription();
|
||||
case 12: return PressureLimLo.ToString();
|
||||
case 13: return PressureLimHi.ToString();
|
||||
case 14: return DefaultPressure.ToString();
|
||||
case 15: return HumiUnit.ToDescription();
|
||||
case 16: return HumiLimLo.ToString();
|
||||
case 17: return HumiLimHi.ToString();
|
||||
case 18: return DefaultHumi.ToString();
|
||||
case 19: return Format.Replace("\n", "<LF>");
|
||||
default:
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string str)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: ComPortNr = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: BaudRate = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: Parity = TBF.Utils.GetParity(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: DataBits = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: StopBits = TBF.Utils.GetStopBits(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: Handshake = TBF.Utils.GetHandshake(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 6: SetDtrToOne = (str == Strings.yes); return CfgUpdateFlags.RestartRqrd;
|
||||
case 7:
|
||||
foreach (var u in new Unit[] { Unit.C, Unit.F, Unit.K })
|
||||
{
|
||||
if (str == u.ToDescription()) { TempUnit = u; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
case 8: TempLimLo = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 9: TempLimHi = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 10: DefaultTemp = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 11:
|
||||
foreach (var u in new Unit[] { Unit.Pa, Unit.hPa, Unit.mbar, Unit.kPa, Unit.inHg, Unit.psi, Unit.bar, Unit.MPa })
|
||||
{
|
||||
if (str == u.ToDescription()) { PressureUnit = u; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
case 12: PressureLimLo = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 13: PressureLimHi = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 14: DefaultPressure = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 15:
|
||||
foreach (var u in new Unit[] { Unit.RPct })
|
||||
{
|
||||
if (str == u.ToDescription()) { HumiUnit = u; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
case 16: HumiLimLo = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 17: HumiLimHi = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 18: DefaultHumi = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 19: Format = str.Replace("<LF>", "\n"); return CfgUpdateFlags.RestartRqrd;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string str, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int idummy;
|
||||
double dummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (int.TryParse(str, out idummy) && idummy > 0) return true;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 11:
|
||||
case 15:
|
||||
if (ParamValues(i).Contains(str)) return true;
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
if (TBF.Utils.TryParseSDouble(str, out dummy)) return true;
|
||||
break;
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 16:
|
||||
case 17:
|
||||
case 18:
|
||||
if (TBF.Utils.TryParseUDouble(str, out dummy)) return true;
|
||||
break;
|
||||
case 19:
|
||||
return true;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(AmbientCfg prms)
|
||||
{
|
||||
prms.ParentName = this.ParentName;
|
||||
|
||||
prms.Shape = this.Shape;
|
||||
prms.Sz = this.Sz;
|
||||
prms.Orient = this.Orient;
|
||||
prms.Flip = this.Flip;
|
||||
prms.LblX = this.LblX;
|
||||
prms.LblY = this.LblY;
|
||||
prms.LblOrient = this.LblOrient;
|
||||
prms.MsrdX = this.MsrdX;
|
||||
prms.MsrdY = this.MsrdY;
|
||||
prms.MsrdOrient = this.MsrdOrient;
|
||||
|
||||
prms.ComPortNr = this.ComPortNr;
|
||||
prms.BaudRate = this.BaudRate;
|
||||
prms.Parity = this.Parity;
|
||||
prms.DataBits = this.DataBits;
|
||||
prms.StopBits = this.StopBits;
|
||||
prms.Handshake = this.Handshake;
|
||||
prms.SetDtrToOne = this.SetDtrToOne;
|
||||
prms.TempUnit = this.TempUnit;
|
||||
prms.TempLimLo = this.TempLimLo;
|
||||
prms.TempLimHi = this.TempLimHi;
|
||||
prms.DefaultTemp = this.DefaultTemp;
|
||||
prms.PressureUnit = this.PressureUnit;
|
||||
prms.PressureLimLo = this.PressureLimLo;
|
||||
prms.PressureLimHi = this.PressureLimHi;
|
||||
prms.DefaultPressure = this.DefaultPressure;
|
||||
prms.HumiUnit = this.HumiUnit;
|
||||
prms.HumiLimLo = this.HumiLimLo;
|
||||
prms.HumiLimHi = this.HumiLimHi;
|
||||
prms.DefaultHumi = this.DefaultHumi;
|
||||
prms.Format = this.Format;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
AmbientCfg pars = new AmbientCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,243 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Ambient.Comet
|
||||
{
|
||||
partial class AmbientCfgCtrl
|
||||
{
|
||||
/// <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.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.handshakeLabel = 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.handshakeComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.setDtrCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// comPortNrTextBox
|
||||
//
|
||||
this.comPortNrTextBox.Enabled = false;
|
||||
this.comPortNrTextBox.Location = new System.Drawing.Point(140, 52);
|
||||
this.comPortNrTextBox.Name = "comPortNrTextBox";
|
||||
this.comPortNrTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.comPortNrTextBox.TabIndex = 4;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(29, 55);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(98, 13);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Serial Port Number:";
|
||||
//
|
||||
// baudRateLabel
|
||||
//
|
||||
this.baudRateLabel.AutoSize = true;
|
||||
this.baudRateLabel.Location = new System.Drawing.Point(29, 79);
|
||||
this.baudRateLabel.Name = "baudRateLabel";
|
||||
this.baudRateLabel.Size = new System.Drawing.Size(58, 13);
|
||||
this.baudRateLabel.TabIndex = 5;
|
||||
this.baudRateLabel.Text = "Baud Rate";
|
||||
//
|
||||
// baudRateTextBox
|
||||
//
|
||||
this.baudRateTextBox.Enabled = false;
|
||||
this.baudRateTextBox.Location = new System.Drawing.Point(140, 76);
|
||||
this.baudRateTextBox.Name = "baudRateTextBox";
|
||||
this.baudRateTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.baudRateTextBox.TabIndex = 6;
|
||||
//
|
||||
// partityLabel
|
||||
//
|
||||
this.partityLabel.AutoSize = true;
|
||||
this.partityLabel.Location = new System.Drawing.Point(29, 103);
|
||||
this.partityLabel.Name = "partityLabel";
|
||||
this.partityLabel.Size = new System.Drawing.Size(33, 13);
|
||||
this.partityLabel.TabIndex = 7;
|
||||
this.partityLabel.Text = "Parity";
|
||||
//
|
||||
// dataBitsLabel
|
||||
//
|
||||
this.dataBitsLabel.AutoSize = true;
|
||||
this.dataBitsLabel.Location = new System.Drawing.Point(29, 127);
|
||||
this.dataBitsLabel.Name = "dataBitsLabel";
|
||||
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
|
||||
this.dataBitsLabel.TabIndex = 9;
|
||||
this.dataBitsLabel.Text = "Data Bits";
|
||||
//
|
||||
// dataBitsTextBox
|
||||
//
|
||||
this.dataBitsTextBox.Enabled = false;
|
||||
this.dataBitsTextBox.Location = new System.Drawing.Point(140, 124);
|
||||
this.dataBitsTextBox.Name = "dataBitsTextBox";
|
||||
this.dataBitsTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.dataBitsTextBox.TabIndex = 10;
|
||||
//
|
||||
// stopBitsLabel
|
||||
//
|
||||
this.stopBitsLabel.AutoSize = true;
|
||||
this.stopBitsLabel.Location = new System.Drawing.Point(29, 151);
|
||||
this.stopBitsLabel.Name = "stopBitsLabel";
|
||||
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
|
||||
this.stopBitsLabel.TabIndex = 11;
|
||||
this.stopBitsLabel.Text = "Stop Bits";
|
||||
//
|
||||
// handshakeLabel
|
||||
//
|
||||
this.handshakeLabel.AutoSize = true;
|
||||
this.handshakeLabel.Location = new System.Drawing.Point(29, 175);
|
||||
this.handshakeLabel.Name = "handshakeLabel";
|
||||
this.handshakeLabel.Size = new System.Drawing.Size(62, 13);
|
||||
this.handshakeLabel.TabIndex = 13;
|
||||
this.handshakeLabel.Text = "Handshake";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(140, 28);
|
||||
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, 31);
|
||||
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, 7);
|
||||
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, 100);
|
||||
this.parityComboBox.Name = "parityComboBox";
|
||||
this.parityComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.parityComboBox.TabIndex = 8;
|
||||
//
|
||||
// stopBitsComboBox
|
||||
//
|
||||
this.stopBitsComboBox.Enabled = false;
|
||||
this.stopBitsComboBox.FormattingEnabled = true;
|
||||
this.stopBitsComboBox.Location = new System.Drawing.Point(140, 148);
|
||||
this.stopBitsComboBox.Name = "stopBitsComboBox";
|
||||
this.stopBitsComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.stopBitsComboBox.TabIndex = 12;
|
||||
//
|
||||
// handshakeComboBox
|
||||
//
|
||||
this.handshakeComboBox.Enabled = false;
|
||||
this.handshakeComboBox.FormattingEnabled = true;
|
||||
this.handshakeComboBox.Location = new System.Drawing.Point(140, 172);
|
||||
this.handshakeComboBox.Name = "handshakeComboBox";
|
||||
this.handshakeComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.handshakeComboBox.TabIndex = 14;
|
||||
//
|
||||
// setDtrCheckBox
|
||||
//
|
||||
this.setDtrCheckBox.AutoSize = true;
|
||||
this.setDtrCheckBox.Enabled = false;
|
||||
this.setDtrCheckBox.Location = new System.Drawing.Point(140, 201);
|
||||
this.setDtrCheckBox.Name = "setDtrCheckBox";
|
||||
this.setDtrCheckBox.Size = new System.Drawing.Size(89, 17);
|
||||
this.setDtrCheckBox.TabIndex = 15;
|
||||
this.setDtrCheckBox.Text = "Set DTR to 1";
|
||||
this.setDtrCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// AmbientCfgCtrl
|
||||
//
|
||||
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.setDtrCheckBox);
|
||||
this.Controls.Add(this.handshakeComboBox);
|
||||
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.handshakeLabel);
|
||||
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 = "AmbientCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 240);
|
||||
this.Load += new System.EventHandler(this.AbbientCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox comPortNrTextBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label baudRateLabel;
|
||||
private System.Windows.Forms.TextBox baudRateTextBox;
|
||||
private System.Windows.Forms.Label partityLabel;
|
||||
private System.Windows.Forms.Label dataBitsLabel;
|
||||
private System.Windows.Forms.TextBox dataBitsTextBox;
|
||||
private System.Windows.Forms.Label stopBitsLabel;
|
||||
private System.Windows.Forms.Label handshakeLabel;
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.ComboBox parityComboBox;
|
||||
private System.Windows.Forms.ComboBox stopBitsComboBox;
|
||||
private System.Windows.Forms.ComboBox handshakeComboBox;
|
||||
private System.Windows.Forms.CheckBox setDtrCheckBox;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.IO.Ports;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Ambient.Comet
|
||||
{
|
||||
public partial class AmbientCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
AmbientCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as AmbientCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public AmbientCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
parityComboBox.Items.Add(Parity.None.ToString());
|
||||
parityComboBox.Items.Add(Parity.Even.ToString());
|
||||
parityComboBox.Items.Add(Parity.Odd.ToString());
|
||||
|
||||
stopBitsComboBox.Items.Add(StopBits.None.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.One.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.OnePointFive.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.Two.ToString());
|
||||
|
||||
handshakeComboBox.Items.Add(Handshake.None.ToString());
|
||||
handshakeComboBox.Items.Add(Handshake.RequestToSend.ToString());
|
||||
handshakeComboBox.Items.Add(Handshake.XOnXOff.ToString());
|
||||
}
|
||||
|
||||
int GetParityIx(Parity par)
|
||||
{
|
||||
if (par == Parity.None) return 0;
|
||||
if (par == Parity.Even) return 0;
|
||||
if (par == Parity.Odd) return 0;
|
||||
return -1;
|
||||
}
|
||||
Parity GetParity(string str)
|
||||
{
|
||||
if (str.Equals(Parity.None.ToString())) return Parity.None;
|
||||
if (str.Equals(Parity.Even.ToString())) return Parity.Even;
|
||||
if (str.Equals(Parity.Odd.ToString())) return Parity.Odd;
|
||||
return (Parity)(-1);
|
||||
}
|
||||
|
||||
int GetStopBitsIx(StopBits sb)
|
||||
{
|
||||
if (sb == StopBits.None) return 0;
|
||||
if (sb == StopBits.One) return 1;
|
||||
if (sb == StopBits.OnePointFive) return 2;
|
||||
if (sb == StopBits.Two) return 3;
|
||||
return -1;
|
||||
}
|
||||
StopBits GetStopBits(string str)
|
||||
{
|
||||
if (str.Equals(StopBits.None.ToString())) return StopBits.None;
|
||||
if (str.Equals(StopBits.One.ToString())) return StopBits.One;
|
||||
if (str.Equals(StopBits.OnePointFive.ToString())) return StopBits.OnePointFive;
|
||||
if (str.Equals(StopBits.Two.ToString())) return StopBits.Two;
|
||||
return (StopBits)(-1);
|
||||
}
|
||||
|
||||
int GetHandshakeIx(Handshake par)
|
||||
{
|
||||
if (par == Handshake.None) return 0;
|
||||
if (par == Handshake.RequestToSend) return 0;
|
||||
if (par == Handshake.XOnXOff) return 0;
|
||||
return -1;
|
||||
}
|
||||
Handshake GetHandshake(string str)
|
||||
{
|
||||
if (str.Equals(Handshake.None.ToString())) return Handshake.None;
|
||||
if (str.Equals(Handshake.RequestToSend.ToString())) return Handshake.RequestToSend;
|
||||
if (str.Equals(Handshake.XOnXOff.ToString())) return Handshake.XOnXOff;
|
||||
return (Handshake)(-1);
|
||||
}
|
||||
|
||||
private void AbbientCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
comPortNrTextBox.Text = config.ComPortNr.ToString();
|
||||
baudRateTextBox.Text = config.BaudRate.ToString();
|
||||
parityComboBox.Text = config.Parity.ToString();
|
||||
dataBitsTextBox.Text = config.DataBits.ToString();
|
||||
stopBitsComboBox.Text = config.StopBits.ToString();
|
||||
handshakeComboBox.Text = config.Handshake.ToString();
|
||||
setDtrCheckBox.Checked = config.SetDtrToOne;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
comPortNrTextBox.Enabled = true;
|
||||
baudRateTextBox.Enabled = true;
|
||||
parityComboBox.Enabled = true;
|
||||
dataBitsTextBox.Enabled = true;
|
||||
stopBitsComboBox.Enabled = true;
|
||||
handshakeComboBox.Enabled = true;
|
||||
setDtrCheckBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ComPortNr = int.Parse(comPortNrTextBox.Text);
|
||||
config.BaudRate = int.Parse(baudRateTextBox.Text);
|
||||
config.Parity = GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.DataBits = int.Parse(dataBitsTextBox.Text);
|
||||
config.StopBits = GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
config.Handshake = GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
config.SetDtrToOne = setDtrCheckBox.Checked;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
int dummy;
|
||||
if (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Serial Port Number' is not valid";
|
||||
}
|
||||
|
||||
if (!int.TryParse(baudRateTextBox.Text, out dummy) || dummy < 150 || dummy > 115200)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Baud Rate' is not valid";
|
||||
}
|
||||
|
||||
if (!int.TryParse(dataBitsTextBox.Text, out dummy) || dummy < 7 || dummy > 8)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Data Bits' is not valid";
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
@@ -8,7 +8,7 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "Comet-Ambient"; } }
|
||||
public string ClassName { get { return GetType().Namespace.Substring(17); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public void ResetStaticProperties() { Ambient.ResetStaticProperties(); }
|
||||
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.Ambient.Comet
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Ambient(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new AmbientCfg(this); }
|
||||
public IComponentCfg DefaultConfig() { return new AmbientCfg("Ambient", this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,9 @@ using System.Globalization;
|
||||
using System.IO.Ports;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Config;
|
||||
using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
@@ -17,12 +19,41 @@ namespace TBF.BenchControl.Ambient.Greco
|
||||
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
|
||||
/// Connection settings: 19200 Bd 8-bits No-parity 1-stop-bit Flow control: none or hardware.
|
||||
/// </summary>
|
||||
public class Ambient : ComponentBase, IDevice, IOperation, GenericDevices.IAmbient
|
||||
public class Ambient : ComponentBase, IDevice, IOperation, GenericDevices.IAmbient, IDrawingItCmpntWithMeasuredVal
|
||||
{
|
||||
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;
|
||||
///
|
||||
Unit TempUnit { get { return ambientCfg.TempUnit; } }
|
||||
double TempLimLo { get { return Units.ConvertFrom(TempUnit, ambientCfg.TempLimLo); } }
|
||||
double TempLimHi { get { return Units.ConvertFrom(TempUnit, ambientCfg.TempLimHi); } }
|
||||
double DefaultTemperature { get { return Units.ConvertFrom(TempUnit, ambientCfg.DefaultTemp); } }
|
||||
///
|
||||
Unit PressureUnit { get { return ambientCfg.PressureUnit; } }
|
||||
double PressureLimLo { get { return Units.ConvertFrom(PressureUnit, ambientCfg.PressureLimLo); } }
|
||||
double PressureLimHi { get { return Units.ConvertFrom(PressureUnit, ambientCfg.PressureLimHi); } }
|
||||
double DefaultPressure { get { return Units.ConvertFrom(PressureUnit, ambientCfg.DefaultPressure); } }
|
||||
///
|
||||
Unit HumiUnit { get { return ambientCfg.HumiUnit; } }
|
||||
double HumiLimLo { get { return Units.ConvertFrom(HumiUnit, ambientCfg.HumiLimLo); } }
|
||||
double HumiLimHi { get { return Units.ConvertFrom(HumiUnit, ambientCfg.HumiLimHi); } }
|
||||
double DefaultHumidity { get { return Units.ConvertFrom(HumiUnit, ambientCfg.DefaultHumi); } }
|
||||
|
||||
///
|
||||
/// IDrawingItCmpntWithMeasuredVal interface
|
||||
///
|
||||
public IDrawingItem DrawingItem { get { return ambientCfg as IDrawingItem; } }
|
||||
public double MeasuredVal { get { return temperature; } }
|
||||
public string AltString
|
||||
{
|
||||
get {
|
||||
return string.Format(ambientCfg.Format, Units.ConvertTo(TempUnit, temperature),
|
||||
Units.ConvertTo(PressureUnit, pressure),
|
||||
Units.ConvertTo(HumiUnit, humidity));
|
||||
}
|
||||
}
|
||||
|
||||
/// Private fields
|
||||
SerialPort serialPort;
|
||||
@@ -34,9 +65,9 @@ namespace TBF.BenchControl.Ambient.Greco
|
||||
///
|
||||
/// Measured values when MsrmntState == MsrmntState.Valid
|
||||
///
|
||||
float temperature; /// [°C]
|
||||
float pressure; /// [bar]
|
||||
float humidity; /// [R%]
|
||||
double temperature; /// [°C]
|
||||
double pressure; /// [bar]
|
||||
double humidity; /// [R%]
|
||||
|
||||
/// <summary>Measurement time stamp when MsrmntState == MsrmntState.Valid</summary>
|
||||
int msrmntTimeStamp;
|
||||
@@ -58,6 +89,11 @@ namespace TBF.BenchControl.Ambient.Greco
|
||||
: base(cfg)
|
||||
{
|
||||
ambientCfg = cfg as AmbientCfg;
|
||||
|
||||
temperature = DefaultTemperature;
|
||||
pressure = DefaultPressure;
|
||||
humidity = DefaultHumidity;
|
||||
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
@@ -65,9 +101,6 @@ namespace TBF.BenchControl.Ambient.Greco
|
||||
{
|
||||
if (ambientCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
temperature = 20.0f;
|
||||
humidity = 40.0f;
|
||||
pressure = 1.0f;
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
return;
|
||||
@@ -116,23 +149,23 @@ namespace TBF.BenchControl.Ambient.Greco
|
||||
string measurement = measurementBuilder.ToString();
|
||||
measurementBuilder.Clear();
|
||||
|
||||
float t = 0;
|
||||
float h = 0;
|
||||
float p = 0;
|
||||
if (float.TryParse(measurement.Substring(len - 22, 6), NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite,
|
||||
double t = 0;
|
||||
double h = 0;
|
||||
double p = 0;
|
||||
if (double.TryParse(measurement.Substring(len - 22, 6), NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite,
|
||||
CultureInfo.InvariantCulture, out t) &&
|
||||
measurement[len - 16] == '\t' &&
|
||||
float.TryParse(measurement.Substring(len - 15, 6), NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite,
|
||||
double.TryParse(measurement.Substring(len - 15, 6), NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite,
|
||||
CultureInfo.InvariantCulture, out h) &&
|
||||
measurement[len - 9] == '\t' &&
|
||||
float.TryParse(measurement.Substring(len - 8, 6), NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite,
|
||||
double.TryParse(measurement.Substring(len - 8, 6), NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite,
|
||||
CultureInfo.InvariantCulture, out p) &&
|
||||
measurement[len - 2] == '\r' &&
|
||||
measurement[len - 1] == '\n')
|
||||
{
|
||||
temperature = t;
|
||||
humidity = h;
|
||||
pressure = p / 1000.0F;
|
||||
pressure = p / 1000.0;
|
||||
|
||||
UpdateProcessData(temperature, pressure, humidity);
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
@@ -171,21 +204,21 @@ namespace TBF.BenchControl.Ambient.Greco
|
||||
|
||||
public void StopDevice2() { }
|
||||
|
||||
void UpdateProcessData(float temperature, float pressure, float humidity)
|
||||
void UpdateProcessData(double temperature, double pressure, double humidity)
|
||||
{
|
||||
TBF.BenchControl.Sequences.ProcessData.AmbTemp.Val = temperature;
|
||||
TBF.BenchControl.Sequences.ProcessData.AmbTemp.Val = temperature;
|
||||
TBF.BenchControl.Sequences.ProcessData.AmbPress.Val = pressure;
|
||||
TBF.BenchControl.Sequences.ProcessData.AmbHumi.Val = humidity;
|
||||
TBF.BenchControl.Sequences.ProcessData.AmbHumi.Val = humidity;
|
||||
}
|
||||
|
||||
///
|
||||
/// Boxes for the operation result
|
||||
///
|
||||
FloatBox tempBox;
|
||||
FloatBox pressureBox;
|
||||
FloatBox humiBox;
|
||||
DoubleBox tempBox;
|
||||
DoubleBox pressureBox;
|
||||
DoubleBox humiBox;
|
||||
|
||||
public IOperation ReadAmbientOp(FloatBox temperature, FloatBox pressure, FloatBox humidity)
|
||||
public IOperation ReadAmbientOp(DoubleBox temperature, DoubleBox pressure, DoubleBox humidity)
|
||||
{
|
||||
this.tempBox = temperature;
|
||||
this.pressureBox = pressure;
|
||||
@@ -214,8 +247,6 @@ namespace TBF.BenchControl.Ambient.Greco
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
public void Stop() { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,54 +1,344 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Xml.Serialization;
|
||||
using Config;
|
||||
using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Ambient.Greco
|
||||
{
|
||||
public class AmbientCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
public class AmbientCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider, IDrawingItemWithMeasuredVal
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(AmbientCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new AmbientCfgCtrl(); }
|
||||
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int ComPortNr;
|
||||
public int BaudRate;
|
||||
public Parity Parity;
|
||||
public int DataBits;
|
||||
public StopBits StopBits;
|
||||
public Handshake Handshake;
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int ComPortNr; /// 0
|
||||
public int BaudRate; /// 1
|
||||
public Parity Parity; /// 2
|
||||
public int DataBits; /// 3
|
||||
public StopBits StopBits; /// 4
|
||||
public Handshake Handshake; /// 5
|
||||
public Unit TempUnit; /// 6
|
||||
public double TempLimLo; /// 7
|
||||
public double TempLimHi; /// 8
|
||||
public double DefaultTemp; /// 9
|
||||
public Unit PressureUnit; /// 10
|
||||
public double PressureLimLo; /// 11
|
||||
public double PressureLimHi; /// 12
|
||||
public double DefaultPressure; /// 13
|
||||
public Unit HumiUnit; /// 14
|
||||
public double HumiLimLo; /// 15
|
||||
public double HumiLimHi; /// 16
|
||||
public double DefaultHumi; /// 17
|
||||
public string Format; /// 18
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
AmbientCfg()
|
||||
{
|
||||
Name = "Ambient";
|
||||
/// Schematic drawing info
|
||||
public Shape Shape { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public Sz Sz { get; set; }
|
||||
public Orient Orient { get; set; }
|
||||
public bool Flip { get; set; }
|
||||
public int LblX { get; set; }
|
||||
public int LblY { get; set; }
|
||||
public Orient LblOrient { get; set; }
|
||||
public int MsrdX { get; set; }
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string MsrdFormat { get { return string.Empty; } }
|
||||
[XmlIgnore]
|
||||
public Config.Unit MsrdUnit { get { return TempUnit; } }
|
||||
[XmlIgnore]
|
||||
public double MsrdValLimLo { get { return TempLimLo; } }
|
||||
[XmlIgnore]
|
||||
public double MsrdValLimHi { get { return TempLimHi; } }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
AmbientCfg()
|
||||
{
|
||||
GNodes = new List<GNode>();
|
||||
Format = string.Empty;
|
||||
}
|
||||
|
||||
public AmbientCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Shape = Shape.Ambient;
|
||||
Sz = Sz.M;
|
||||
Factory = factory;
|
||||
Name = name;
|
||||
ParentName = string.Empty;
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
ComPortNr = 6;
|
||||
BaudRate = 19200;
|
||||
Parity = System.IO.Ports.Parity.None;
|
||||
DataBits = 8;
|
||||
StopBits = System.IO.Ports.StopBits.One;
|
||||
Handshake = System.IO.Ports.Handshake.None;
|
||||
TempUnit = Unit.C;
|
||||
TempLimLo = 15;
|
||||
TempLimHi = 30;
|
||||
DefaultTemp = 25;
|
||||
PressureUnit = Unit.hPa;
|
||||
PressureLimLo = 960;
|
||||
PressureLimHi = 1060;
|
||||
DefaultPressure = 1013;
|
||||
HumiUnit = Unit.RPct;
|
||||
HumiLimLo = 20;
|
||||
HumiLimHi = 80;
|
||||
DefaultHumi = 50;
|
||||
Format = "{0:F1} °C\n{1:F0} hPa\n{2:F0} R%";
|
||||
|
||||
MsrdY = 22;
|
||||
}
|
||||
|
||||
public AmbientCfg(IComponentFactory factory)
|
||||
: this()
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
this.Factory = factory;
|
||||
"Serial port number", /// 0
|
||||
"Baud rate", /// 1
|
||||
"Parity", /// 2
|
||||
"Data bits", /// 3
|
||||
"Stop bits", /// 4
|
||||
"Handshake", /// 5
|
||||
"Unit of temperature", /// 6
|
||||
"Temperature limit Lo", /// 7
|
||||
"Temperature limit Hi", /// 8
|
||||
"Default temperature", /// 9
|
||||
"Unit of pressure", /// 10
|
||||
"Pressure limit Lo", /// 11
|
||||
"Pressure limit Hi", /// 12
|
||||
"Default pressure", /// 13
|
||||
"Unit of rel. humidity", /// 14
|
||||
"Rel. humidity limit Lo", /// 15
|
||||
"Rel. humidity limit Hi", /// 16
|
||||
"Default retl. humidity", /// 17
|
||||
"Display format", /// 18
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public IList<string> ParamValues(int i)
|
||||
{
|
||||
IList<string> values = new List<string>();
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
return new List<string>(new string[] { "150", "300", "600", "1200", "2400", "4800", "9600",
|
||||
"19200", "38400", "57600", "76800", "115200"});
|
||||
case 2:
|
||||
values.Add(Parity.None.ToString());
|
||||
values.Add(Parity.Odd.ToString());
|
||||
values.Add(Parity.Even.ToString());
|
||||
return values;
|
||||
case 3:
|
||||
return new List<string>(new string[] { "7", "8" });
|
||||
case 4:
|
||||
values.Add(StopBits.None.ToString());
|
||||
values.Add(StopBits.One.ToString());
|
||||
values.Add(StopBits.OnePointFive.ToString());
|
||||
values.Add(StopBits.Two.ToString());
|
||||
return values;
|
||||
case 5:
|
||||
values.Add(Handshake.None.ToString());
|
||||
values.Add(Handshake.XOnXOff.ToString());
|
||||
values.Add(Handshake.RequestToSend.ToString());
|
||||
values.Add(Handshake.RequestToSendXOnXOff.ToString());
|
||||
return values;
|
||||
case 6:
|
||||
return new List<string>(new string[] { "°C", "°F", "K" });
|
||||
case 10:
|
||||
return new List<string>(new string[] { "Pa", "hPa", "mbar", "kPa", "inHg", "psi", "bar", "MPa" });
|
||||
case 14:
|
||||
return new List<string>(new string[] { "R%" });
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
public string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return ComPortNr.ToString();
|
||||
case 1: return BaudRate.ToString();
|
||||
case 2: return Parity.ToString();
|
||||
case 3: return DataBits.ToString();
|
||||
case 4: return StopBits.ToString();
|
||||
case 5: return Handshake.ToString();
|
||||
case 6: return TempUnit.ToDescription();
|
||||
case 7: return TempLimLo.ToString();
|
||||
case 8: return TempLimHi.ToString();
|
||||
case 9: return DefaultTemp.ToString();
|
||||
case 10: return PressureUnit.ToDescription();
|
||||
case 11: return PressureLimLo.ToString();
|
||||
case 12: return PressureLimHi.ToString();
|
||||
case 13: return DefaultPressure.ToString();
|
||||
case 14: return HumiUnit.ToDescription();
|
||||
case 15: return HumiLimLo.ToString();
|
||||
case 16: return HumiLimHi.ToString();
|
||||
case 17: return DefaultHumi.ToString();
|
||||
case 18: return Format.Replace("\n", "<LF>");
|
||||
default:
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string str)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: ComPortNr = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: BaudRate = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: Parity = TBF.Utils.GetParity(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: DataBits = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: StopBits = TBF.Utils.GetStopBits(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: Handshake = TBF.Utils.GetHandshake(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 6:
|
||||
foreach (var u in new Unit[] { Unit.C, Unit.F, Unit.K })
|
||||
{
|
||||
if (str == u.ToDescription()) { TempUnit = u; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
case 7: TempLimLo = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 8: TempLimHi = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 9: DefaultTemp = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 10:
|
||||
foreach (var u in new Unit[] { Unit.Pa, Unit.hPa, Unit.mbar, Unit.kPa, Unit.inHg, Unit.psi, Unit.bar, Unit.MPa })
|
||||
{
|
||||
if (str == u.ToDescription()) { PressureUnit = u; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
case 11: PressureLimLo = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 12: PressureLimHi = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 13: DefaultPressure = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 14:
|
||||
foreach (var u in new Unit[] { Unit.RPct })
|
||||
{
|
||||
if (str == u.ToDescription()) { HumiUnit = u; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
case 15: HumiLimLo = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 16: HumiLimHi = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 17: DefaultHumi = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 18: Format = str.Replace("<LF>", "\n"); return CfgUpdateFlags.RestartRqrd;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string str, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int idummy;
|
||||
double dummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (int.TryParse(str, out idummy) && idummy > 0) return true;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 10:
|
||||
case 14:
|
||||
if (ParamValues(i).Contains(str)) return true;
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
if (TBF.Utils.TryParseSDouble(str, out dummy)) return true;
|
||||
break;
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 15:
|
||||
case 16:
|
||||
case 17:
|
||||
if (TBF.Utils.TryParseUDouble(str, out dummy)) return true;
|
||||
break;
|
||||
case 18:
|
||||
return true;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(AmbientCfg prms)
|
||||
{
|
||||
prms.ParentName = this.ParentName;
|
||||
|
||||
prms.Shape = this.Shape;
|
||||
prms.Sz = this.Sz;
|
||||
prms.Orient = this.Orient;
|
||||
prms.Flip = this.Flip;
|
||||
prms.LblX = this.LblX;
|
||||
prms.LblY = this.LblY;
|
||||
prms.LblOrient = this.LblOrient;
|
||||
prms.MsrdX = this.MsrdX;
|
||||
prms.MsrdY = this.MsrdY;
|
||||
prms.MsrdOrient = this.MsrdOrient;
|
||||
|
||||
prms.ComPortNr = this.ComPortNr;
|
||||
prms.BaudRate = this.BaudRate;
|
||||
prms.Parity = this.Parity;
|
||||
prms.DataBits = this.DataBits;
|
||||
prms.StopBits = this.StopBits;
|
||||
prms.Handshake = this.Handshake;
|
||||
prms.TempUnit = this.TempUnit;
|
||||
prms.TempLimLo = this.TempLimLo;
|
||||
prms.TempLimHi = this.TempLimHi;
|
||||
prms.DefaultTemp = this.DefaultTemp;
|
||||
prms.PressureUnit = this.PressureUnit;
|
||||
prms.PressureLimLo = this.PressureLimLo;
|
||||
prms.PressureLimHi = this.PressureLimHi;
|
||||
prms.DefaultPressure = this.DefaultPressure;
|
||||
prms.HumiUnit = this.HumiUnit;
|
||||
prms.HumiLimLo = this.HumiLimLo;
|
||||
prms.HumiLimHi = this.HumiLimHi;
|
||||
prms.DefaultHumi = this.DefaultHumi;
|
||||
prms.Format = this.Format;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
AmbientCfg pars = new AmbientCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,229 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Ambient.Greco
|
||||
{
|
||||
partial class AmbientCfgCtrl
|
||||
{
|
||||
/// <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.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.handshakeLabel = 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.handshakeComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// comPortNrTextBox
|
||||
//
|
||||
this.comPortNrTextBox.Enabled = false;
|
||||
this.comPortNrTextBox.Location = new System.Drawing.Point(140, 52);
|
||||
this.comPortNrTextBox.Name = "comPortNrTextBox";
|
||||
this.comPortNrTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.comPortNrTextBox.TabIndex = 4;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(29, 55);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(98, 13);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Serial Port Number:";
|
||||
//
|
||||
// baudRateLabel
|
||||
//
|
||||
this.baudRateLabel.AutoSize = true;
|
||||
this.baudRateLabel.Location = new System.Drawing.Point(29, 79);
|
||||
this.baudRateLabel.Name = "baudRateLabel";
|
||||
this.baudRateLabel.Size = new System.Drawing.Size(58, 13);
|
||||
this.baudRateLabel.TabIndex = 5;
|
||||
this.baudRateLabel.Text = "Baud Rate";
|
||||
//
|
||||
// baudRateTextBox
|
||||
//
|
||||
this.baudRateTextBox.Enabled = false;
|
||||
this.baudRateTextBox.Location = new System.Drawing.Point(140, 76);
|
||||
this.baudRateTextBox.Name = "baudRateTextBox";
|
||||
this.baudRateTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.baudRateTextBox.TabIndex = 6;
|
||||
//
|
||||
// partityLabel
|
||||
//
|
||||
this.partityLabel.AutoSize = true;
|
||||
this.partityLabel.Location = new System.Drawing.Point(29, 103);
|
||||
this.partityLabel.Name = "partityLabel";
|
||||
this.partityLabel.Size = new System.Drawing.Size(33, 13);
|
||||
this.partityLabel.TabIndex = 7;
|
||||
this.partityLabel.Text = "Parity";
|
||||
//
|
||||
// dataBitsLabel
|
||||
//
|
||||
this.dataBitsLabel.AutoSize = true;
|
||||
this.dataBitsLabel.Location = new System.Drawing.Point(29, 127);
|
||||
this.dataBitsLabel.Name = "dataBitsLabel";
|
||||
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
|
||||
this.dataBitsLabel.TabIndex = 9;
|
||||
this.dataBitsLabel.Text = "Data Bits";
|
||||
//
|
||||
// dataBitsTextBox
|
||||
//
|
||||
this.dataBitsTextBox.Enabled = false;
|
||||
this.dataBitsTextBox.Location = new System.Drawing.Point(140, 124);
|
||||
this.dataBitsTextBox.Name = "dataBitsTextBox";
|
||||
this.dataBitsTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.dataBitsTextBox.TabIndex = 10;
|
||||
//
|
||||
// stopBitsLabel
|
||||
//
|
||||
this.stopBitsLabel.AutoSize = true;
|
||||
this.stopBitsLabel.Location = new System.Drawing.Point(29, 151);
|
||||
this.stopBitsLabel.Name = "stopBitsLabel";
|
||||
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
|
||||
this.stopBitsLabel.TabIndex = 11;
|
||||
this.stopBitsLabel.Text = "Stop Bits";
|
||||
//
|
||||
// handshakeLabel
|
||||
//
|
||||
this.handshakeLabel.AutoSize = true;
|
||||
this.handshakeLabel.Location = new System.Drawing.Point(29, 175);
|
||||
this.handshakeLabel.Name = "handshakeLabel";
|
||||
this.handshakeLabel.Size = new System.Drawing.Size(62, 13);
|
||||
this.handshakeLabel.TabIndex = 13;
|
||||
this.handshakeLabel.Text = "Handshake";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(140, 28);
|
||||
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, 31);
|
||||
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, 7);
|
||||
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, 100);
|
||||
this.parityComboBox.Name = "parityComboBox";
|
||||
this.parityComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.parityComboBox.TabIndex = 8;
|
||||
//
|
||||
// stopBitsComboBox
|
||||
//
|
||||
this.stopBitsComboBox.Enabled = false;
|
||||
this.stopBitsComboBox.FormattingEnabled = true;
|
||||
this.stopBitsComboBox.Location = new System.Drawing.Point(140, 148);
|
||||
this.stopBitsComboBox.Name = "stopBitsComboBox";
|
||||
this.stopBitsComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.stopBitsComboBox.TabIndex = 12;
|
||||
//
|
||||
// handshakeComboBox
|
||||
//
|
||||
this.handshakeComboBox.Enabled = false;
|
||||
this.handshakeComboBox.FormattingEnabled = true;
|
||||
this.handshakeComboBox.Location = new System.Drawing.Point(140, 172);
|
||||
this.handshakeComboBox.Name = "handshakeComboBox";
|
||||
this.handshakeComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.handshakeComboBox.TabIndex = 14;
|
||||
//
|
||||
// AmbientCfgCtrl
|
||||
//
|
||||
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.handshakeComboBox);
|
||||
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.handshakeLabel);
|
||||
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 = "AmbientCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 240);
|
||||
this.Load += new System.EventHandler(this.AbbientCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox comPortNrTextBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label baudRateLabel;
|
||||
private System.Windows.Forms.TextBox baudRateTextBox;
|
||||
private System.Windows.Forms.Label partityLabel;
|
||||
private System.Windows.Forms.Label dataBitsLabel;
|
||||
private System.Windows.Forms.TextBox dataBitsTextBox;
|
||||
private System.Windows.Forms.Label stopBitsLabel;
|
||||
private System.Windows.Forms.Label handshakeLabel;
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.ComboBox parityComboBox;
|
||||
private System.Windows.Forms.ComboBox stopBitsComboBox;
|
||||
private System.Windows.Forms.ComboBox handshakeComboBox;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.IO.Ports;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Ambient.Greco
|
||||
{
|
||||
public partial class AmbientCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
AmbientCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as AmbientCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public AmbientCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
parityComboBox.Items.Add(Parity.None.ToString());
|
||||
parityComboBox.Items.Add(Parity.Even.ToString());
|
||||
parityComboBox.Items.Add(Parity.Odd.ToString());
|
||||
|
||||
stopBitsComboBox.Items.Add(StopBits.None.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.One.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.OnePointFive.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.Two.ToString());
|
||||
|
||||
handshakeComboBox.Items.Add(Handshake.None.ToString());
|
||||
handshakeComboBox.Items.Add(Handshake.RequestToSend.ToString());
|
||||
handshakeComboBox.Items.Add(Handshake.XOnXOff.ToString());
|
||||
}
|
||||
|
||||
int GetParityIx(Parity par)
|
||||
{
|
||||
if (par == Parity.None) return 0;
|
||||
if (par == Parity.Even) return 0;
|
||||
if (par == Parity.Odd) return 0;
|
||||
return -1;
|
||||
}
|
||||
Parity GetParity(string str)
|
||||
{
|
||||
if (str.Equals(Parity.None.ToString())) return Parity.None;
|
||||
if (str.Equals(Parity.Even.ToString())) return Parity.Even;
|
||||
if (str.Equals(Parity.Odd.ToString())) return Parity.Odd;
|
||||
return (Parity)(-1);
|
||||
}
|
||||
|
||||
int GetStopBitsIx(StopBits sb)
|
||||
{
|
||||
if (sb == StopBits.None) return 0;
|
||||
if (sb == StopBits.One) return 1;
|
||||
if (sb == StopBits.OnePointFive) return 2;
|
||||
if (sb == StopBits.Two) return 3;
|
||||
return -1;
|
||||
}
|
||||
StopBits GetStopBits(string str)
|
||||
{
|
||||
if (str.Equals(StopBits.None.ToString())) return StopBits.None;
|
||||
if (str.Equals(StopBits.One.ToString())) return StopBits.One;
|
||||
if (str.Equals(StopBits.OnePointFive.ToString())) return StopBits.OnePointFive;
|
||||
if (str.Equals(StopBits.Two.ToString())) return StopBits.Two;
|
||||
return (StopBits)(-1);
|
||||
}
|
||||
|
||||
int GetHandshakeIx(Handshake par)
|
||||
{
|
||||
if (par == Handshake.None) return 0;
|
||||
if (par == Handshake.RequestToSend) return 0;
|
||||
if (par == Handshake.XOnXOff) return 0;
|
||||
return -1;
|
||||
}
|
||||
Handshake GetHandshake(string str)
|
||||
{
|
||||
if (str.Equals(Handshake.None.ToString())) return Handshake.None;
|
||||
if (str.Equals(Handshake.RequestToSend.ToString())) return Handshake.RequestToSend;
|
||||
if (str.Equals(Handshake.XOnXOff.ToString())) return Handshake.XOnXOff;
|
||||
return (Handshake)(-1);
|
||||
}
|
||||
|
||||
private void AbbientCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
comPortNrTextBox.Text = config.ComPortNr.ToString();
|
||||
baudRateTextBox.Text = config.BaudRate.ToString();
|
||||
parityComboBox.Text = config.Parity.ToString();
|
||||
dataBitsTextBox.Text = config.DataBits.ToString();
|
||||
stopBitsComboBox.Text = config.StopBits.ToString();
|
||||
handshakeComboBox.Text = config.Handshake.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
comPortNrTextBox.Enabled = true;
|
||||
baudRateTextBox.Enabled = true;
|
||||
parityComboBox.Enabled = true;
|
||||
dataBitsTextBox.Enabled = true;
|
||||
stopBitsComboBox.Enabled = true;
|
||||
handshakeComboBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ComPortNr = int.Parse(comPortNrTextBox.Text);
|
||||
config.BaudRate = int.Parse(baudRateTextBox.Text);
|
||||
config.Parity = GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.DataBits = int.Parse(dataBitsTextBox.Text);
|
||||
config.StopBits = GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
config.Handshake = GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
int dummy;
|
||||
if (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Serial Port Number' is not valid";
|
||||
}
|
||||
|
||||
if (!int.TryParse(baudRateTextBox.Text, out dummy) || dummy < 150 || dummy > 115200)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Baud Rate' is not valid";
|
||||
}
|
||||
|
||||
if (!int.TryParse(dataBitsTextBox.Text, out dummy) || dummy < 7 || dummy > 8)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Data Bits' is not valid";
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
@@ -8,7 +8,7 @@ namespace TBF.BenchControl.Ambient.Greco
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "Greco Ambient"; } }
|
||||
public string ClassName { get { return GetType().Namespace.Substring(17); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public void ResetStaticProperties() { Ambient.ResetStaticProperties(); }
|
||||
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.Ambient.Greco
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Ambient(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new AmbientCfg(this); }
|
||||
public IComponentCfg DefaultConfig() { return new AmbientCfg("Ambient", this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,9 @@ using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.BuiltIn.Valve
|
||||
{
|
||||
/// <summary>
|
||||
/// Plain valve, open/close state is controlled by 1 bit from the route
|
||||
/// </summary>
|
||||
public class Valve : ValveBase, IValve, SchematicDrawing.IDrawingItCmpnt
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Valve));
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace TBF.BenchControl.BuiltIn.Valve
|
||||
|
||||
Factory = factory;
|
||||
Name = "V";
|
||||
ParentName = "CB";
|
||||
ParentName = "UniCB";
|
||||
BitNr = 0;
|
||||
Category = ValveCategory.None;
|
||||
OpenCloseTime = 1;
|
||||
|
||||
@@ -666,9 +666,9 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
|
||||
public IOperation SetFlowOp(double reqrdFlowLo, double reqrdFlowHi, TBF.Boxes.DoubleBox measuredFlow, int timeout)
|
||||
{
|
||||
if (Devices.RegulValve == null || Devices.FlowMeter == null) return null;
|
||||
if (Devices.RegValve == null || Devices.FlowMeter == null) return null;
|
||||
|
||||
return Devices.RegulValve.SetFlowOp(Devices.FlowMeter, reqrdFlowLo, reqrdFlowHi, measuredFlow, timeout);
|
||||
return Devices.RegValve.SetFlowOp(Devices.FlowMeter, reqrdFlowLo, reqrdFlowHi, measuredFlow, timeout);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -78,16 +78,16 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
if (outputPath.FlowMeter == null) throw new ArgumentNullException("Flow meter is missing");
|
||||
flowMeterNr = outputPath.FlowMeter.Idx1;
|
||||
|
||||
this.regulValve = outputPath.RegulValve;
|
||||
this.regulValve = outputPath.RegValve;
|
||||
if (regulValve is Elde.RegulValve.RegulValve)
|
||||
{
|
||||
Elde.RegulValve.RegulValve rv = outputPath.RegulValve as Elde.RegulValve.RegulValve;
|
||||
Elde.RegulValve.RegulValve rv = outputPath.RegValve as Elde.RegulValve.RegulValve;
|
||||
regulValveNr = rv.Idx1;
|
||||
regulValveStableTime = rv.StableTime;
|
||||
}
|
||||
else if (regulValve is Elde.RegulValveCoax.RegulValve)
|
||||
{
|
||||
Elde.RegulValveCoax.RegulValve rv = outputPath.RegulValve as Elde.RegulValveCoax.RegulValve;
|
||||
Elde.RegulValveCoax.RegulValve rv = outputPath.RegValve as Elde.RegulValveCoax.RegulValve;
|
||||
regulValveNr = rv.Idx1;
|
||||
regulValveStableTime = rv.StableTime;
|
||||
}
|
||||
|
||||
@@ -142,31 +142,8 @@ namespace TBF.BenchControl.ControlBoard.Papouch
|
||||
RequestInputs();
|
||||
}
|
||||
|
||||
///
|
||||
/// 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));
|
||||
ProcessData.UpdateMeasuredValuesAndSetpoints();
|
||||
TBF.UiBridge.Bridge.OnStateMachineTick(this, new TBF.UiBridge.StateMachineTickEventArgs(benchModelRoute, ProcessData.MeasuredValues, ProcessData.AltStrings, ProcessData.Setpoints));
|
||||
}
|
||||
|
||||
public void StopDevice()
|
||||
@@ -377,7 +354,7 @@ namespace TBF.BenchControl.ControlBoard.Papouch
|
||||
string loLimStr = reqrdFlowLo.ToString(Config.Utils.SignificantDigitsToFmt(reqrdFlowLo, 2));
|
||||
string hiLimStr = reqrdFlowHi.ToString(Config.Utils.SignificantDigitsToFmt(reqrdFlowHi, 2));
|
||||
this.promptMsg = string.Format("Set flow measured by {0} withing {1} and {2} m3/h by regulation valve {3}",
|
||||
devices.FlowMeter.Name, loLimStr, hiLimStr, devices.RegulValve.Name);
|
||||
devices.FlowMeter.Name, loLimStr, hiLimStr, devices.RegValve.Name);
|
||||
this.backColor = System.Drawing.Color.LightSalmon;
|
||||
|
||||
scheduledOp = SelectedOp.SetFlow;
|
||||
|
||||
@@ -10,20 +10,30 @@ using Common;
|
||||
using Config.Entities;
|
||||
using Dirichlet.Numerics;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.BenchControl.Sequences;
|
||||
|
||||
namespace TBF.BenchControl.ControlBoard.Uni
|
||||
{
|
||||
public class CBoard : ComponentBase, IControlBoard
|
||||
public class CBoard : ComponentBase, IControlBoard, SchematicDrawing.IDrawingItCmpntWithMeasuredVal
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CBoard));
|
||||
public override string ToString() { return string.Format("CBoard({0})", cBoardCfg != null ? cBoardCfg.ToString(1) : string.Empty); }
|
||||
|
||||
/// TBF component configuration
|
||||
readonly CBoardCfg cBoardCfg;
|
||||
|
||||
/// IDrawingItCmpnt interface implementation
|
||||
public SchematicDrawing.IDrawingItem DrawingItem { get { return cBoardCfg as SchematicDrawing.IDrawingItem; } }
|
||||
|
||||
public double MeasuredVal { get { return 0.1; } }
|
||||
public string AltString { get { return "hovno"; } }
|
||||
|
||||
/// Wrappers
|
||||
int comPortNr { get { return cBoardCfg.ComPortNr; } }
|
||||
int virtValvesRngLo { get { return cBoardCfg.VirtValvesRangeLo; } }
|
||||
int virtValvesRngHi { get { return cBoardCfg.VirtValvesRangeHi; } }
|
||||
|
||||
|
||||
/// Propagated from configurations of other components
|
||||
UInt128 valvesToInvert;
|
||||
|
||||
@@ -75,7 +85,16 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
/// Select devices used for control and measurement
|
||||
/// </summary>
|
||||
/// <param name="outPath"></param>
|
||||
public OutputPath Devices { set; get; }
|
||||
public OutputPath Devices
|
||||
{
|
||||
set { devices = value; }
|
||||
get { return devices; }
|
||||
}
|
||||
|
||||
OutputPath devices;
|
||||
IFlowMeter flowMeter { get { return devices.FlowMeter; } }
|
||||
IRegulValve regValve { get { return devices.RegValve; } }
|
||||
IDiverter diverter { get { return devices.Diverter; } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -84,6 +103,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
/// </summary>
|
||||
public CBoard()
|
||||
{
|
||||
devices = new OutputPath(string.Empty, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -103,13 +123,14 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
#endif
|
||||
cBoardCfg = cfg as CBoardCfg;
|
||||
|
||||
devices = new OutputPath(string.Empty, 0);
|
||||
msgQueue = new Queue<IOutputMessage>();
|
||||
|
||||
Data = new GeneralData();
|
||||
divTransitionData = null;
|
||||
scopeAnalyzerData = null;
|
||||
switchCounterData = null;
|
||||
|
||||
msgQueue = new Queue<IOutputMessage>();
|
||||
|
||||
serialPort = null;
|
||||
buffer = new byte[BUFFER_SIZE];
|
||||
rcvdData = new byte[BUFFER_SIZE];
|
||||
@@ -267,13 +288,12 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
}
|
||||
}
|
||||
|
||||
if (msgQueue.Count > 0)
|
||||
{
|
||||
/// There is a message in the message queue => write it to the serial port
|
||||
var message = msgQueue.Dequeue();
|
||||
byte[] outData = message.GetMessage();
|
||||
serialPort.Write(outData, 0, outData.Length);
|
||||
IOutputMessage message = (msgQueue.Count > 0) ? msgQueue.Dequeue() : OutputMessage.CreateDataRequestMsg();
|
||||
|
||||
byte[] outData = message.GetMessage();
|
||||
if (outData != null && outData.Length > 0)
|
||||
{
|
||||
serialPort.Write(outData, 0, outData.Length);
|
||||
string s1 = message.ToString();
|
||||
string s2 = Telegram.LogTelegram("Message ", outData);
|
||||
Debug.WriteLine(s1);
|
||||
@@ -281,6 +301,9 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
log.Debug(s1);
|
||||
log.Debug(s2);
|
||||
}
|
||||
|
||||
ProcessData.UpdateMeasuredValuesAndSetpoints();
|
||||
TBF.UiBridge.Bridge.OnStateMachineTick(this, new TBF.UiBridge.StateMachineTickEventArgs(Route, ProcessData.MeasuredValues, ProcessData.AltStrings, ProcessData.Setpoints));
|
||||
}
|
||||
|
||||
public void StopDevice()
|
||||
@@ -295,16 +318,6 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
|
||||
#endregion
|
||||
|
||||
public void SendCommand(Command cmd, int etalonNr, int regValveNr, int divNr, ulong totalPulsesCount, ulong massPuleseCount, UInt128 route)
|
||||
{
|
||||
msgQueue.Enqueue(new CommandMsg(cmd, etalonNr, regValveNr, divNr, totalPulsesCount, massPuleseCount, route));
|
||||
}
|
||||
|
||||
public void ValveMove(Command cmd, int etalonNr, int regValveNr, int divNr, ulong totalPulsesCount, ulong massPuleseCount, UInt128 route)
|
||||
{
|
||||
msgQueue.Enqueue(new CommandMsg(cmd, etalonNr, regValveNr, divNr, totalPulsesCount, massPuleseCount, route));
|
||||
}
|
||||
|
||||
#region IControlBoard interface
|
||||
|
||||
///
|
||||
@@ -322,6 +335,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
///
|
||||
public IOperation SetFlowOp(double flowLimLo, double flowLimHi, TBF.Boxes.DoubleBox measuredFlow, int timeout)
|
||||
{
|
||||
//var msg = new OutputMessage(Command.Start, );
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.ControlBoard.Uni
|
||||
@@ -12,7 +13,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
/// <summary>
|
||||
/// Holds backup and security options - serializable configuration.
|
||||
/// </summary>
|
||||
public class CBoardCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider
|
||||
public class CBoardCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, IDrawingItemWithMeasuredVal
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CBoardCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
@@ -26,13 +27,42 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
public int VirtValvesRangeLo;
|
||||
public int VirtValvesRangeHi;
|
||||
|
||||
/// Schematic drawing info
|
||||
public Shape Shape { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public Sz Sz { get; set; }
|
||||
public Orient Orient { get; set; }
|
||||
public bool Flip { get; set; }
|
||||
public int LblX { get; set; }
|
||||
public int LblY { get; set; }
|
||||
public Orient LblOrient { get; set; }
|
||||
public int MsrdX { get; set; }
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
public Config.Unit MsrdUnit { get; set; }
|
||||
public string MsrdFormat { get; set; }
|
||||
public double MsrdValLimLo { get; set; }
|
||||
public double MsrdValLimHi { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
[XmlIgnore]
|
||||
public IList<GEdge> EdgesToSet { get; set; }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
CBoardCfg() { }
|
||||
CBoardCfg()
|
||||
{
|
||||
GNodes = new List<GNode>();
|
||||
EdgesToSet = new List<GEdge>();
|
||||
}
|
||||
|
||||
public CBoardCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Shape = Shape.UniCB;
|
||||
Sz = Sz.L;
|
||||
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
/// A/D converters: Feedback from RV-s and diverters
|
||||
for (int i = 0; i < Const.ADCsCount; i++) /// Byte 25 .. 56
|
||||
{
|
||||
AnalogInput[i] = GetInt16(data, offs + (int)Poz.Analogy + 2 * i);
|
||||
AnalogInput[15 - i] = GetInt16(data, offs + (int)Poz.Analogy + 2 * i);
|
||||
}
|
||||
|
||||
/// Groch temperature meters
|
||||
|
||||
+56
-28
@@ -7,28 +7,56 @@ using Dirichlet.Numerics;
|
||||
|
||||
namespace TBF.BenchControl.ControlBoard.Uni
|
||||
{
|
||||
public class CommandMsg : IOutputMessage
|
||||
public class OutputMessage : IOutputMessage
|
||||
{
|
||||
public int PayloadLen { get { return 38; } }
|
||||
public byte MessageCode { get { return (byte)' '; } }
|
||||
|
||||
readonly Command cmd;
|
||||
readonly int etalonNr;
|
||||
readonly int regValveNr;
|
||||
readonly int divNr;
|
||||
readonly ulong totalPulsesCount;
|
||||
readonly ulong massPuleseCount;
|
||||
readonly UInt128 route;
|
||||
Command command;
|
||||
byte startOrStopParams;
|
||||
UInt32 totalPulsesCount;
|
||||
UInt32 massPuleseCount;
|
||||
UInt128 route;
|
||||
|
||||
public CommandMsg(Command cmd, int etalonNr, int regValveNr, int divNr, ulong totalPulsesCount, ulong massPuleseCount, UInt128 route)
|
||||
OutputMessage()
|
||||
{
|
||||
this.cmd = cmd;
|
||||
this.etalonNr = etalonNr;
|
||||
this.regValveNr = regValveNr;
|
||||
this.divNr = divNr;
|
||||
this.totalPulsesCount = totalPulsesCount;
|
||||
this.massPuleseCount = massPuleseCount;
|
||||
this.route = route;
|
||||
command = Command.RequestData;
|
||||
startOrStopParams = 0;
|
||||
totalPulsesCount = 0;
|
||||
massPuleseCount = 0;
|
||||
}
|
||||
|
||||
public static OutputMessage CreateDataRequestMsg()
|
||||
{
|
||||
var msg = new OutputMessage();
|
||||
msg.command = Command.RequestData;
|
||||
return msg;
|
||||
}
|
||||
|
||||
public static OutputMessage CreateSetFlowMsg(OutputPath devices, float flowLo, float flowHi, int timeOut)
|
||||
{
|
||||
var msg = new OutputMessage();
|
||||
msg.command = Command.RequestData;
|
||||
return msg;
|
||||
}
|
||||
|
||||
public static OutputMessage CreateTestStartCmd(int etalonNr, int regValveNr, int divNr, long totalPulsesCount, long massPulsesCount = -1)
|
||||
{
|
||||
var msg = new OutputMessage();
|
||||
//msg.command = Command.Start;
|
||||
//msg.etalonNr = etalonNr;
|
||||
//msg.regValveNr = regValveNr;
|
||||
//msg.divNr = divNr;
|
||||
//msg.totalPulsesCount = totalPulsesCount;
|
||||
//msg.massPuleseCount = (massPulsesCount >= 0) ? massPulsesCount : totalPulsesCount;
|
||||
return msg;
|
||||
}
|
||||
|
||||
public static OutputMessage CreateTestStopCmd()
|
||||
{
|
||||
var msg = new OutputMessage();
|
||||
msg.command = Command.Stop;
|
||||
return msg;
|
||||
}
|
||||
|
||||
public byte[] GetMessage()
|
||||
@@ -37,22 +65,22 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
|
||||
/// Header (3 bytes)
|
||||
message[0] = Const.STX;
|
||||
message[1] = 1; /// Control board addres
|
||||
message[2] = (byte)PayloadLen; /// Payload length
|
||||
message[1] = 1; /// Control board addres
|
||||
message[2] = (byte)PayloadLen; /// Payload length
|
||||
|
||||
/// Command
|
||||
message[3] = MessageCode;
|
||||
message[4] = (byte)cmd;
|
||||
//message[5] = GetCmdParameter(message[4]);
|
||||
//message[6] = (byte)(pulsesCount & 0xFF);
|
||||
//message[7] = (byte)((pulsesCount >> 8) & 0xFF);
|
||||
//message[8] = (byte)((pulsesCount >> 16) & 0xFF);
|
||||
//message[9] = 0;
|
||||
message[4] = (byte)command;
|
||||
message[5] = startOrStopParams;
|
||||
message[6] = 0; /// nn | (paralelEt << 3);
|
||||
message[7] = (byte)(totalPulsesCount & 0xFF);
|
||||
message[8] = (byte)((totalPulsesCount >> 8) & 0xFF);
|
||||
message[9] = (byte)((totalPulsesCount >> 16) & 0xFF);
|
||||
message[10] = (byte)(massPuleseCount & 0xFF);
|
||||
message[11] = (byte)((massPuleseCount >> 8) & 0xFF);
|
||||
message[12] = (byte)((massPuleseCount >> 16) & 0xFF);
|
||||
|
||||
///// Valves
|
||||
//message[10] = (byte)GetValveChgFlag();
|
||||
//message[11] = (byte)(route & 0xFF);
|
||||
//message[12] = (byte)((route >> 8) & 0xFF);
|
||||
//message[13] = (byte)((route >> 16) & 0xFF);
|
||||
//message[14] = (byte)((route >> 24) & 0xFF);
|
||||
//message[15] = (byte)((route >> 32) & 0xFF);
|
||||
@@ -98,7 +126,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("CommandMessage : {0}", cmd);
|
||||
return string.Format("CommandMessage : {0}", command);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ namespace TBF.BenchControl.Danfoss.VLT2800
|
||||
public int SetpY { get; set; }
|
||||
public Orient SetpOrient { get; set; }
|
||||
public string SetpFormat { get; set; }
|
||||
public Config.Unit SetpUnits { get; set; }
|
||||
public Config.Unit SetpUnit { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
@@ -65,7 +65,7 @@ namespace TBF.BenchControl.Danfoss.VLT2800
|
||||
Shape = Shape.PumpFM;
|
||||
Sz = Sz.M;
|
||||
SetpFormat = "{0:F0} %";
|
||||
SetpUnits = Config.Unit.Pct;
|
||||
SetpUnit = Config.Unit.Pct;
|
||||
|
||||
Name = "Pump-Danfoss";
|
||||
Factory = factory;
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace TBF.BenchControl.Danfoss.VLT2800
|
||||
dataBitsTextBox.Text = config.DataBits.ToString();
|
||||
stopBitsComboBox.Text = config.StopBits.ToString();
|
||||
formatTextBox.Text = config.SetpFormat;
|
||||
unitsComboBox.Text = config.SetpUnits.ToString();
|
||||
unitsComboBox.Text = config.SetpUnit.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
@@ -158,12 +158,12 @@ namespace TBF.BenchControl.Danfoss.VLT2800
|
||||
config.StopBits = GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
|
||||
config.SetpFormat = formatTextBox.Text;
|
||||
config.SetpUnits = global::Config.Unit.None;
|
||||
config.SetpUnit = global::Config.Unit.None;
|
||||
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
|
||||
{
|
||||
if (unitsComboBox.Text == units.ToString())
|
||||
{
|
||||
config.SetpUnits = units;
|
||||
config.SetpUnit = units;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using TBF.BenchControl.Generic;
|
||||
namespace TBF.BenchControl.DataContainer.Density
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds backup and security options - serializable configuration.
|
||||
/// Holds water density - serializable configuration.
|
||||
/// </summary>
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, TBF.BenchControl.GenericDevices.ICalibInfoCfg
|
||||
{
|
||||
|
||||
@@ -91,11 +91,10 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
/// Returns the water pressure and convert from kPa to default units
|
||||
/// </summary>
|
||||
/// <returns>Pressure</returns>
|
||||
public float ReadPressure()
|
||||
public double ReadPressure()
|
||||
{
|
||||
double rawPressure = Config.Units.ConvertFrom(Config.Unit.kPa, ControlBoard.Pressure(Idx0));
|
||||
double correctedPressure = Config.Formulas.CorrectedValue(rawPressure, Corrections);
|
||||
return (float)correctedPressure;
|
||||
return Config.Formulas.CorrectedValue(rawPressure, Corrections);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +103,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
/// </summary>
|
||||
/// <param name="pressure">Reference to a variable for the pressure in Bar</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadPressureOp(ref FloatBox pressure)
|
||||
public IOperation ReadPressureOp(ref DoubleBox pressure)
|
||||
{
|
||||
return new ReadPressureOp(this, ref pressure);
|
||||
}
|
||||
@@ -115,7 +114,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
/// <param name="pressure">Reference to a variable for the pressure in Bar</param>
|
||||
/// <param name="pressureDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadPressureOp(ref FloatBox pressure, Event pressureDone)
|
||||
public IOperation ReadPressureOp(ref DoubleBox pressure, Event pressureDone)
|
||||
{
|
||||
return new ReadPressureOp(this, ref pressure, pressureDone);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
readonly Event eventDone;
|
||||
|
||||
/// Measured value
|
||||
FloatBox pressure;
|
||||
DoubleBox pressure;
|
||||
|
||||
/// <summary>
|
||||
/// Events: PressureInDone, PressureOutDone or Error
|
||||
@@ -25,7 +25,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
/// <param name="pressureMeter">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 ReadPressureOp(PressureMeter pressureMeter, ref FloatBox pressure, Event eventDone)
|
||||
public ReadPressureOp(PressureMeter pressureMeter, ref DoubleBox pressure, Event eventDone)
|
||||
{
|
||||
if (pressureMeter == null) throw new ArgumentNullException("pressureMeter");
|
||||
this.pressureMeter = pressureMeter;
|
||||
@@ -34,7 +34,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadPressureOp(PressureMeter pressureMeter, ref FloatBox pressure)
|
||||
public ReadPressureOp(PressureMeter pressureMeter, ref DoubleBox pressure)
|
||||
: this(pressureMeter, ref pressure, Event.PressureDone)
|
||||
{
|
||||
}
|
||||
@@ -57,8 +57,6 @@ namespace TBF.BenchControl.Elde.PressureMeter
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
public void Stop() { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,7 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
|
||||
public int Idx0 { get { return pressureMeterCfg.Idx0; } } /// 0..7
|
||||
|
||||
public PressureMeter()
|
||||
{
|
||||
}
|
||||
public PressureMeter() { }
|
||||
|
||||
public PressureMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
@@ -82,11 +80,10 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
/// Returns the water pressure and convert from kPa to default units
|
||||
/// </summary>
|
||||
/// <returns>Pressure</returns>
|
||||
public float ReadPressure()
|
||||
public double ReadPressure()
|
||||
{
|
||||
double rawPressure = Config.Units.ConvertFrom(Config.Unit.kPa, ControlBoard.Pressure(Idx0));
|
||||
double correctedPressure = Config.Formulas.CorrectedValue(rawPressure, Corrections);
|
||||
return (float)correctedPressure;
|
||||
return Config.Formulas.CorrectedValue(rawPressure, Corrections);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +92,7 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
/// </summary>
|
||||
/// <param name="pressure">Reference to a variable for the pressure in Bar</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadPressureOp(ref FloatBox pressure)
|
||||
public IOperation ReadPressureOp(ref DoubleBox pressure)
|
||||
{
|
||||
return new ReadPressureOp(this, ref pressure);
|
||||
}
|
||||
@@ -106,7 +103,7 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
/// <param name="pressure">Reference to a variable for the pressure in Bar</param>
|
||||
/// <param name="pressureDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadPressureOp(ref FloatBox pressure, Event pressureDone)
|
||||
public IOperation ReadPressureOp(ref DoubleBox pressure, Event pressureDone)
|
||||
{
|
||||
return new ReadPressureOp(this, ref pressure, pressureDone);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
@@ -15,7 +15,7 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
/// Set by the constructor
|
||||
readonly PressureMeter pressureMeter;
|
||||
readonly Event eventDone;
|
||||
FloatBox pressureBox;
|
||||
DoubleBox pressureBox;
|
||||
|
||||
/// <summary>
|
||||
/// Events: PressureInDone, PressureOutDone or Error
|
||||
@@ -23,7 +23,7 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
/// <param name="pressureMeter">Pressure meter reference</param>
|
||||
/// <param name="pressureBox">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 ReadPressureOp(PressureMeter pressureMeter, ref FloatBox pressureBox, Event eventDone)
|
||||
public ReadPressureOp(PressureMeter pressureMeter, ref DoubleBox pressureBox, Event eventDone)
|
||||
{
|
||||
if (pressureMeter == null) throw new ArgumentNullException("pressureMeter");
|
||||
this.pressureMeter = pressureMeter;
|
||||
@@ -32,7 +32,7 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadPressureOp(PressureMeter pressureMeter, ref FloatBox pressure)
|
||||
public ReadPressureOp(PressureMeter pressureMeter, ref DoubleBox pressure)
|
||||
: this(pressureMeter, ref pressure, Event.PressureDone)
|
||||
{
|
||||
}
|
||||
@@ -54,8 +54,6 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
public void Stop() { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
|
||||
public int SetpY { get; set; }
|
||||
public Orient SetpOrient { get; set; }
|
||||
public string SetpFormat { get; set; }
|
||||
public Config.Unit SetpUnits { get; set; }
|
||||
public Config.Unit SetpUnit { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
@@ -58,7 +58,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
|
||||
Shape = Shape.PumpFM;
|
||||
Sz = Sz.M;
|
||||
SetpFormat = "{0:F0} %";
|
||||
SetpUnits = Config.Unit.Pct;
|
||||
SetpUnit = Config.Unit.Pct;
|
||||
|
||||
Name = "P";
|
||||
Factory = factory;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
|
||||
fmIndexTextBox.Text = config.FMIndex.ToString();
|
||||
delayTextBox.Text = config.Delay.ToString();
|
||||
formatTextBox.Text = config.SetpFormat;
|
||||
unitsComboBox.Text = config.SetpUnits.ToString();
|
||||
unitsComboBox.Text = config.SetpUnit.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
@@ -99,12 +99,12 @@ namespace TBF.BenchControl.Elde.PumpWithFM
|
||||
config.FMIndex = int.Parse(fmIndexTextBox.Text);
|
||||
config.Delay = int.Parse(delayTextBox.Text);
|
||||
config.SetpFormat = formatTextBox.Text;
|
||||
config.SetpUnits = global::Config.Unit.None;
|
||||
config.SetpUnit = global::Config.Unit.None;
|
||||
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
|
||||
{
|
||||
if (unitsComboBox.Text == units.ToString())
|
||||
{
|
||||
config.SetpUnits = units;
|
||||
config.SetpUnit = units;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
public int SetpY { get; set; }
|
||||
public Orient SetpOrient { get; set; }
|
||||
public string SetpFormat { get; set; }
|
||||
public Config.Unit SetpUnits { get; set; }
|
||||
public Config.Unit SetpUnit { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
@@ -65,7 +65,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
Shape = Shape.RegV;
|
||||
Sz = Sz.M;
|
||||
SetpFormat = "{0:F0} %";
|
||||
SetpUnits = Config.Unit.Pct;
|
||||
SetpUnit = Config.Unit.Pct;
|
||||
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
storedPosReuseCheckBox.Checked = config.StoredPositionReuse;
|
||||
reTryCommandsCheckBox.Checked = config.ReTryCommands;
|
||||
formatTextBox.Text = config.SetpFormat;
|
||||
unitsComboBox.Text = config.SetpUnits.ToString();
|
||||
unitsComboBox.Text = config.SetpUnit.ToString();
|
||||
|
||||
adcTextBox1.Text = adc1.ToString();
|
||||
adcTextBox2.Text = adc2.ToString();
|
||||
@@ -259,12 +259,12 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
}
|
||||
|
||||
config.SetpFormat = formatTextBox.Text;
|
||||
config.SetpUnits = global::Config.Unit.None;
|
||||
config.SetpUnit = global::Config.Unit.None;
|
||||
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
|
||||
{
|
||||
if (unitsComboBox.Text == units.ToString())
|
||||
{
|
||||
config.SetpUnits = units;
|
||||
config.SetpUnit = units;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
public int SetpY { get; set; }
|
||||
public Orient SetpOrient { get; set; }
|
||||
public string SetpFormat { get; set; }
|
||||
public Config.Unit SetpUnits { get; set; }
|
||||
public Config.Unit SetpUnit { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
@@ -63,7 +63,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
Shape = Shape.RegV;
|
||||
Sz = Sz.M;
|
||||
SetpFormat = "{0:F0} %";
|
||||
SetpUnits = Config.Unit.Pct;
|
||||
SetpUnit = Config.Unit.Pct;
|
||||
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
storedPosReuseCheckBox.Checked = config.StoredPositionReuse;
|
||||
reTryCommandsCheckBox.Checked = config.ReTryCommands;
|
||||
formatTextBox.Text = config.SetpFormat;
|
||||
unitsComboBox.Text = config.SetpUnits.ToString();
|
||||
unitsComboBox.Text = config.SetpUnit.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
@@ -199,12 +199,12 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
config.ReTryCommands = btmp;
|
||||
flags |= CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
config.SetpUnits = global::Config.Unit.None;
|
||||
config.SetpUnit = global::Config.Unit.None;
|
||||
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
|
||||
{
|
||||
if (unitsComboBox.Text == units.ToString())
|
||||
{
|
||||
config.SetpUnits = units;
|
||||
config.SetpUnit = units;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace TBF.BenchControl.Elde.TempMeter
|
||||
public int MsrdX { get; set; }
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
public Config.Unit MsrdUnits { get; set; }
|
||||
public Config.Unit MsrdUnit { get; set; }
|
||||
public string MsrdFormat { get; set; }
|
||||
public double MsrdValLimLo { get; set; }
|
||||
public double MsrdValLimHi { get; set; }
|
||||
@@ -65,7 +65,7 @@ namespace TBF.BenchControl.Elde.TempMeter
|
||||
{
|
||||
Shape = Shape.TempM;
|
||||
Sz = Sz.M;
|
||||
MsrdUnits = Config.Unit.C;
|
||||
MsrdUnit = Config.Unit.C;
|
||||
MsrdFormat = "{0:F1} °C";
|
||||
|
||||
Factory = factory;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace TBF.BenchControl.Elde.TempMeterInternal
|
||||
public int MsrdX { get; set; }
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
public Config.Unit MsrdUnits { get; set; }
|
||||
public Config.Unit MsrdUnit { get; set; }
|
||||
public string MsrdFormat { get; set; }
|
||||
public double MsrdValLimLo { get; set; }
|
||||
public double MsrdValLimHi { get; set; }
|
||||
@@ -66,7 +66,7 @@ namespace TBF.BenchControl.Elde.TempMeterInternal
|
||||
{
|
||||
Shape = Shape.TempM;
|
||||
Sz = Sz.M;
|
||||
MsrdUnits = Config.Unit.C;
|
||||
MsrdUnit = Config.Unit.C;
|
||||
MsrdFormat = "{0:F1} °C";
|
||||
|
||||
Name = "T";
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace TBF.BenchControl.Elde.TempMeterMeret
|
||||
public int MsrdX { get; set; }
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
public Config.Unit MsrdUnits { get; set; }
|
||||
public Config.Unit MsrdUnit { get; set; }
|
||||
public string MsrdFormat { get; set; }
|
||||
public double MsrdValLimLo { get; set; }
|
||||
public double MsrdValLimHi { get; set; }
|
||||
@@ -79,7 +79,7 @@ namespace TBF.BenchControl.Elde.TempMeterMeret
|
||||
{
|
||||
Shape = Shape.TempM;
|
||||
Sz = Sz.M;
|
||||
MsrdUnits = Config.Unit.C;
|
||||
MsrdUnit = Config.Unit.C;
|
||||
MsrdFormat = "{0:F1} °C";
|
||||
|
||||
Factory = factory;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
@@ -11,10 +11,10 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// <summary>
|
||||
/// Events: Event.AmbientDone, Event.Error
|
||||
/// </summary>
|
||||
/// <param name="temperature">FloatBox for the air temperature in [deg.C]</param>
|
||||
/// <param name="pressure">FloatBox for the air pressure in [mBar]</param>
|
||||
/// <param name="humidity">FloatBox for the air humidity in [%]</param>
|
||||
/// <param name="temperature">DoubleBox for the air temperature in [deg.C]</param>
|
||||
/// <param name="pressure">DoubleBox for the air pressure in [mBar]</param>
|
||||
/// <param name="humidity">DoubleBox for the air humidity in [%]</param>
|
||||
/// <returns>Operation</returns>
|
||||
IOperation ReadAmbientOp(FloatBox temperature, FloatBox pressure, FloatBox humidity);
|
||||
IOperation ReadAmbientOp(DoubleBox temperature, DoubleBox pressure, DoubleBox humidity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// </summary>
|
||||
/// <param name="pressure">Reference to a variable for the measured pressure in bar</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadPressureOp(ref FloatBox pressure);
|
||||
IOperation ReadPressureOp(ref DoubleBox pressure);
|
||||
|
||||
/// <summary>
|
||||
/// Events: pressureDone, Error
|
||||
@@ -31,6 +31,6 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// <param name="pressure">Reference to a variable for the measured pressure in bar</param>
|
||||
/// <param name="pressureDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadPressureOp(ref FloatBox pressure, Event pressureDone);
|
||||
IOperation ReadPressureOp(ref DoubleBox pressure, Event pressureDone);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace TBF.BenchControl.Keithley.TempMeter
|
||||
public int MsrdX { get; set; }
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
public Config.Unit MsrdUnits { get; set; }
|
||||
public Config.Unit MsrdUnit { get; set; }
|
||||
public string MsrdFormat { get; set; }
|
||||
public double MsrdValLimLo { get; set; }
|
||||
public double MsrdValLimHi { get; set; }
|
||||
@@ -73,7 +73,7 @@ namespace TBF.BenchControl.Keithley.TempMeter
|
||||
{
|
||||
Shape = Shape.TempM;
|
||||
Sz = Sz.M;
|
||||
MsrdUnits = Config.Unit.C;
|
||||
MsrdUnit = Config.Unit.C;
|
||||
MsrdFormat = "{0:F1} °C";
|
||||
|
||||
Name = name;
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
public string MsrdFormat { get; set; }
|
||||
public Config.Unit MsrdUnits { get; set; }
|
||||
public Config.Unit MsrdUnit { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
@@ -92,7 +92,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
Shape = Shape.Scale;
|
||||
Sz = Sz.M;
|
||||
MsrdFormat = "{0:F3}";
|
||||
MsrdUnits = Config.Unit.kg;
|
||||
MsrdUnit = Config.Unit.kg;
|
||||
|
||||
Factory = factory;
|
||||
Name = "WT1";
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
handshakeComboBox.Text = config.Handshake.ToString();
|
||||
|
||||
formatTextBox.Text = config.MsrdFormat;
|
||||
unitsComboBox.Text = config.MsrdUnits.ToString();
|
||||
unitsComboBox.Text = config.MsrdUnit.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
@@ -279,12 +279,12 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
config.Handshake = GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
|
||||
config.MsrdFormat = formatTextBox.Text;
|
||||
config.MsrdUnits = global::Config.Unit.None;
|
||||
config.MsrdUnit = global::Config.Unit.None;
|
||||
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
|
||||
{
|
||||
if (unitsComboBox.Text == units.ToString())
|
||||
{
|
||||
config.MsrdUnits = units;
|
||||
config.MsrdUnit = units;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,11 +81,8 @@ 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
|
||||
}
|
||||
public double MeasuredVal { get { return mass; } }
|
||||
public string AltString { get { return string.Empty; } }
|
||||
|
||||
/// <summary>The time stamp after StartMassMeasurement() when MsrmntState == MsrmntState.Valid</summary>
|
||||
public int MsrmntTimeStamp { get { return msrmntTimeStamp; } }
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
///
|
||||
/// Copyright (c) 2017-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config;
|
||||
using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
@@ -14,12 +16,46 @@ namespace TBF.BenchControl.Modbus.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
|
||||
public class Ambient : ComponentBase, IDevice, IOperation, GenericDevices.IAmbient, IDrawingItCmpntWithMeasuredVal
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Ambient));
|
||||
public override string ToString() { return string.Format("Ambient({0})", Cfg.ToString(1)); }
|
||||
|
||||
///
|
||||
/// Configuration and wrappers
|
||||
///
|
||||
readonly AmbientCfg ambientCfg;
|
||||
///
|
||||
Unit TempUnit { get { return ambientCfg.TempUnit; } }
|
||||
double TempLimLo { get { return Units.ConvertFrom(TempUnit, ambientCfg.TempLimLo); } }
|
||||
double TempLimHi { get { return Units.ConvertFrom(TempUnit, ambientCfg.TempLimHi); } }
|
||||
double DefaultTemperature { get { return Units.ConvertFrom(TempUnit, ambientCfg.DefaultTemp); } }
|
||||
///
|
||||
Unit PressureUnit { get { return ambientCfg.PressureUnit; } }
|
||||
double PressureLimLo { get { return Units.ConvertFrom(PressureUnit, ambientCfg.PressureLimLo); } }
|
||||
double PressureLimHi { get { return Units.ConvertFrom(PressureUnit, ambientCfg.PressureLimHi); } }
|
||||
double DefaultPressure { get { return Units.ConvertFrom(PressureUnit, ambientCfg.DefaultPressure); } }
|
||||
///
|
||||
Unit HumiUnit { get { return ambientCfg.HumiUnit; } }
|
||||
double HumiLimLo { get { return Units.ConvertFrom(HumiUnit, ambientCfg.HumiLimLo); } }
|
||||
double HumiLimHi { get { return Units.ConvertFrom(HumiUnit, ambientCfg.HumiLimHi); } }
|
||||
double DefaultHumidity { get { return Units.ConvertFrom(HumiUnit, ambientCfg.DefaultHumi); } }
|
||||
|
||||
///
|
||||
/// IDrawingItCmpntWithMeasuredVal interface
|
||||
///
|
||||
public IDrawingItem DrawingItem { get { return ambientCfg as IDrawingItem; } }
|
||||
public double MeasuredVal { get { return temperature; } }
|
||||
public string AltString
|
||||
{
|
||||
get {
|
||||
return string.Format(ambientCfg.Format, Units.ConvertTo(TempUnit, temperature),
|
||||
Units.ConvertTo(PressureUnit, pressure),
|
||||
Units.ConvertTo(HumiUnit, humidity));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
readonly GenericDevices.IModbus modbus;
|
||||
|
||||
/// <summary>The state of the measurement</summary>
|
||||
@@ -28,9 +64,10 @@ namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
///
|
||||
/// Measured values when MsrmntState == MsrmntState.Valid
|
||||
///
|
||||
float temperature; /// [°C]
|
||||
float pressure; /// [bar]
|
||||
float humidity; /// [R%]
|
||||
double temperature; /// [°C]
|
||||
double pressure; /// [bar]
|
||||
double humidity; /// [R%]
|
||||
|
||||
|
||||
/// <summary>Measurement time stamp when MsrmntState == MsrmntState.Valid</summary>
|
||||
int msrmntTimeStamp;
|
||||
@@ -50,6 +87,10 @@ namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
temperature = DefaultTemperature;
|
||||
pressure = DefaultPressure;
|
||||
humidity = DefaultHumidity;
|
||||
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
@@ -57,10 +98,7 @@ namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
{
|
||||
if (ambientCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
temperature = 20.0f;
|
||||
humidity = 40.0f;
|
||||
pressure = 1.0f;
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
return;
|
||||
}
|
||||
@@ -87,13 +125,13 @@ namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
if (telegram.Length == 13 && telegram[1] == 3 && telegram[2] == 8)
|
||||
{
|
||||
int value = (int)telegram[3] * 256 + (int)telegram[4];
|
||||
temperature = (float)value / 10.0f;
|
||||
temperature = value / 10.0;
|
||||
|
||||
value = (int)telegram[5] * 256 + (int)telegram[6];
|
||||
humidity = (float)value / 10.0f;
|
||||
humidity = value / 10.0;
|
||||
|
||||
value = (int)telegram[9] * 256 + (int)telegram[10];
|
||||
pressure = (float)value / 10000.0f;
|
||||
pressure = value / 10000.0;
|
||||
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
@@ -112,7 +150,7 @@ namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
|
||||
/// Prepare data to be sent
|
||||
byte[] msg = new byte[8];
|
||||
msg[0] = ambientCfg.ModbusAddress;
|
||||
msg[0] = (byte)ambientCfg.ModbusAddress;
|
||||
msg[1] = 3; /// CMD = Read registers
|
||||
msg[2] = (byte)(regAddr >> 8); /// Control Word Hi
|
||||
msg[3] = (byte)(regAddr & 0xFF); /// Control Word Lo
|
||||
@@ -127,7 +165,7 @@ namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
public void StopDevice() { }
|
||||
public void StopDevice2() { }
|
||||
|
||||
void UpdateProcessData(float temperature, float pressure, float humidity)
|
||||
void UpdateProcessData(double temperature, double pressure, double humidity)
|
||||
{
|
||||
TBF.BenchControl.Sequences.ProcessData.AmbTemp.Val = temperature;
|
||||
TBF.BenchControl.Sequences.ProcessData.AmbPress.Val = pressure;
|
||||
@@ -138,11 +176,11 @@ namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
///
|
||||
/// Boxes for the operation result
|
||||
///
|
||||
FloatBox tempBox;
|
||||
FloatBox pressureBox;
|
||||
FloatBox humiBox;
|
||||
DoubleBox tempBox;
|
||||
DoubleBox pressureBox;
|
||||
DoubleBox humiBox;
|
||||
|
||||
public IOperation ReadAmbientOp(FloatBox temperature, FloatBox pressure, FloatBox humidity)
|
||||
public IOperation ReadAmbientOp(DoubleBox temperature, DoubleBox pressure, DoubleBox humidity)
|
||||
{
|
||||
this.tempBox = temperature;
|
||||
this.pressureBox = pressure;
|
||||
@@ -171,8 +209,6 @@ namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
public void Stop() { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +1,288 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Config;
|
||||
using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
{
|
||||
public class AmbientCfg : ComponentCfgBase, Generic.IChildComponentCfg
|
||||
public class AmbientCfg : ComponentCfgBase, IChildComponentCfg, IParamsProvider, IDrawingItemWithMeasuredVal
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(AmbientCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new AmbientCfgCtrl(); }
|
||||
|
||||
public IComponentCfgCtrl GetControl()
|
||||
{
|
||||
return new Configs.ParamsProvider.ComponentCfgCtrl(this, new List<string>(new string[] { "Modbus" }));
|
||||
}
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public byte ModbusAddress; /// 1..255
|
||||
public int ModbusAddress; /// 0 1..254
|
||||
public Unit TempUnit; /// 1
|
||||
public double TempLimLo; /// 2
|
||||
public double TempLimHi; /// 3
|
||||
public double DefaultTemp; /// 4
|
||||
public Unit PressureUnit; /// 5
|
||||
public double PressureLimLo; /// 6
|
||||
public double PressureLimHi; /// 7
|
||||
public double DefaultPressure; /// 8
|
||||
public Unit HumiUnit; /// 9
|
||||
public double HumiLimLo; /// 10
|
||||
public double HumiLimHi; /// 11
|
||||
public double DefaultHumi; /// 12
|
||||
public string Format; /// 13
|
||||
|
||||
/// Schematic drawing info
|
||||
public Shape Shape { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public Sz Sz { get; set; }
|
||||
public Orient Orient { get; set; }
|
||||
public bool Flip { get; set; }
|
||||
public int LblX { get; set; }
|
||||
public int LblY { get; set; }
|
||||
public Orient LblOrient { get; set; }
|
||||
public int MsrdX { get; set; }
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public string MsrdFormat { get { return string.Empty; } }
|
||||
[XmlIgnore]
|
||||
public Config.Unit MsrdUnit { get { return TempUnit; } }
|
||||
[XmlIgnore]
|
||||
public double MsrdValLimLo { get { return TempLimLo; } }
|
||||
[XmlIgnore]
|
||||
public double MsrdValLimHi { get { return TempLimHi; } }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
AmbientCfg()
|
||||
{
|
||||
Name = "Ambient";
|
||||
ParentName = "Modbus";
|
||||
ModbusAddress = 1;
|
||||
}
|
||||
GNodes = new List<GNode>();
|
||||
Format = string.Empty;
|
||||
}
|
||||
|
||||
public AmbientCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
Shape = Shape.PressM;
|
||||
Sz = Sz.M;
|
||||
Factory = factory;
|
||||
Name = "Ambient";
|
||||
ParentName = "Modbus";
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
ModbusAddress = 1;
|
||||
TempUnit = Unit.C;
|
||||
TempLimLo = 15;
|
||||
TempLimHi = 30;
|
||||
DefaultTemp = 25;
|
||||
PressureUnit = Unit.hPa;
|
||||
PressureLimLo = 960;
|
||||
PressureLimHi = 1060;
|
||||
DefaultPressure = 1013;
|
||||
HumiUnit = Unit.RPct;
|
||||
HumiLimLo = 20;
|
||||
HumiLimHi = 80;
|
||||
DefaultHumi = 50;
|
||||
Format = "{0:F1} °C\n{1:F0} hPa\n{2:F0} R%";
|
||||
|
||||
MsrdY = 22;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Modbus address", /// 0
|
||||
"Unit of temperature", /// 1
|
||||
"Temperature limit Lo", /// 2
|
||||
"Temperature limit Hi", /// 3
|
||||
"Default temperature", /// 4
|
||||
"Unit of pressure", /// 5
|
||||
"Pressure limit Lo", /// 6
|
||||
"Pressure limit Hi", /// 7
|
||||
"Default pressure", /// 8
|
||||
"Unit of rel. humidity", /// 9
|
||||
"Rel. humidity limit Lo", /// 10
|
||||
"Rel. humidity limit Hi", /// 11
|
||||
"Default retl. humidity", /// 12
|
||||
"Display format", /// 13
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public IList<string> ParamValues(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
return new List<string>(new string[] { "°C", "°F", "K" });
|
||||
case 5:
|
||||
return new List<string>(new string[] { "Pa", "hPa", "mbar", "kPa", "inHg", "psi", "bar", "MPa" });
|
||||
case 9:
|
||||
return new List<string>(new string[] { "R%" });
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, ModbusAddr={1}, Parent={2}",
|
||||
Name,
|
||||
ModbusAddress,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName));
|
||||
switch (i)
|
||||
{
|
||||
case 0: return ModbusAddress.ToString();
|
||||
case 1: return TempUnit.ToDescription();
|
||||
case 2: return TempLimLo.ToString();
|
||||
case 3: return TempLimHi.ToString();
|
||||
case 4: return DefaultTemp.ToString();
|
||||
case 5: return PressureUnit.ToDescription();
|
||||
case 6: return PressureLimLo.ToString();
|
||||
case 7: return PressureLimHi.ToString();
|
||||
case 8: return DefaultPressure.ToString();
|
||||
case 9: return HumiUnit.ToDescription();
|
||||
case 10: return HumiLimLo.ToString();
|
||||
case 11: return HumiLimHi.ToString();
|
||||
case 12: return DefaultHumi.ToString();
|
||||
case 13: return Format.Replace("\n", "<LF>");
|
||||
default:
|
||||
return string.Format("Name={0}, Parent={1}, ModbusAddr={2}", Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName), ModbusAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string str)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: ModbusAddress = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1:
|
||||
foreach (var u in new Unit[] { Unit.C, Unit.F, Unit.K })
|
||||
{
|
||||
if (str == u.ToDescription()) { TempUnit = u; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
case 2: TempLimLo = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: TempLimHi = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: DefaultTemp = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 5:
|
||||
foreach (var u in new Unit[] { Unit.Pa, Unit.hPa, Unit.mbar, Unit.kPa, Unit.inHg, Unit.psi, Unit.bar, Unit.MPa })
|
||||
{
|
||||
if (str == u.ToDescription()) { PressureUnit = u; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
case 6: PressureLimLo = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 7: PressureLimHi = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 8: DefaultPressure = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 9:
|
||||
foreach (var u in new Unit[] { Unit.RPct })
|
||||
{
|
||||
if (str == u.ToDescription()) { HumiUnit = u; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
case 10: HumiLimLo = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 11: HumiLimHi = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 12: DefaultHumi = Utils.ParseUDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 13: Format = str.Replace("<LF>", "\n"); return CfgUpdateFlags.RestartRqrd;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string str, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int idummy;
|
||||
double dummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (int.TryParse(str, out idummy) && idummy >= 1 && idummy <= 254) return true;
|
||||
break;
|
||||
case 1:
|
||||
case 5:
|
||||
case 9:
|
||||
if (ParamValues(i).Contains(str)) return true;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
if (TBF.Utils.TryParseSDouble(str, out dummy)) return true;
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
if (TBF.Utils.TryParseUDouble(str, out dummy)) return true;
|
||||
break;
|
||||
case 13:
|
||||
return true;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(AmbientCfg prms)
|
||||
{
|
||||
prms.ParentName = this.ParentName;
|
||||
|
||||
prms.Shape = this.Shape;
|
||||
prms.Sz = this.Sz;
|
||||
prms.Orient = this.Orient;
|
||||
prms.Flip = this.Flip;
|
||||
prms.LblX = this.LblX;
|
||||
prms.LblY = this.LblY;
|
||||
prms.LblOrient = this.LblOrient;
|
||||
prms.MsrdX = this.MsrdX;
|
||||
prms.MsrdY = this.MsrdY;
|
||||
prms.MsrdOrient = this.MsrdOrient;
|
||||
|
||||
prms.ModbusAddress = this.ModbusAddress;
|
||||
prms.TempUnit = this.TempUnit;
|
||||
prms.TempLimLo = this.TempLimLo;
|
||||
prms.TempLimHi = this.TempLimHi;
|
||||
prms.DefaultTemp = this.DefaultTemp;
|
||||
prms.PressureUnit = this.PressureUnit;
|
||||
prms.PressureLimLo = this.PressureLimLo;
|
||||
prms.PressureLimHi = this.PressureLimHi;
|
||||
prms.DefaultPressure = this.DefaultPressure;
|
||||
prms.HumiUnit = this.HumiUnit;
|
||||
prms.HumiLimLo = this.HumiLimLo;
|
||||
prms.HumiLimHi = this.HumiLimHi;
|
||||
prms.DefaultHumi = this.DefaultHumi;
|
||||
prms.Format = this.Format;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
AmbientCfg pars = new AmbientCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
{
|
||||
partial class AmbientCfgCtrl
|
||||
{
|
||||
/// <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.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.AmbientCfgCtrl_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;
|
||||
private System.Windows.Forms.TextBox reservoirNrTextBox;
|
||||
private System.Windows.Forms.Label reservoirNrLabel;
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.UI.Bench.Components;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
{
|
||||
public partial class AmbientCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
ComponentParametersDlg parent;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
AmbientCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as AmbientCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public AmbientCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void AmbientCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
parent = ParentForm as ComponentParametersDlg;
|
||||
if (parent == null) return;
|
||||
|
||||
if (parent.CmpntEntities != null)
|
||||
{
|
||||
foreach (var cmpnt in parent.CmpntEntities)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -8,7 +8,7 @@ namespace TBF.BenchControl.Modbus.Ambient.Comet
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
public string ClassName { get { return GetType().Namespace.Substring(17); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public void ResetStaticProperties() { Ambient.ResetStaticProperties(); }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
@@ -8,7 +8,7 @@ namespace TBF.BenchControl.Modbus.Common
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "Modbus"; } }
|
||||
public string ClassName { get { return GetType().Namespace.Substring(17); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public void ResetStaticProperties() { Modbus.ResetStaticProperties(); }
|
||||
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.Modbus.Common
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Modbus(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new ModbusCfg(this); }
|
||||
public IComponentCfg DefaultConfig() { return new ModbusCfg("Modbus", this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Common
|
||||
{
|
||||
public class ModbusCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
public class ModbusCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ModbusCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new ModbusCfgCtrl(); }
|
||||
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
@@ -27,10 +28,20 @@ namespace TBF.BenchControl.Modbus.Common
|
||||
public Handshake Handshake;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
ModbusCfg()
|
||||
ModbusCfg() { }
|
||||
|
||||
public ModbusCfg(string name, IComponentFactory factory)
|
||||
{
|
||||
Name = "Modbus";
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
ComPortNr = 3;
|
||||
BaudRate = 9600;
|
||||
Parity = System.IO.Ports.Parity.None;
|
||||
@@ -39,16 +50,128 @@ namespace TBF.BenchControl.Modbus.Common
|
||||
Handshake = System.IO.Ports.Handshake.None;
|
||||
}
|
||||
|
||||
public ModbusCfg(IComponentFactory factory)
|
||||
: this()
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
this.Factory = factory;
|
||||
"Serial port number", /// 0
|
||||
"Baud rate", /// 1
|
||||
"Parity", /// 2
|
||||
"Data bits", /// 3
|
||||
"Stop bits", /// 4
|
||||
"Handshake", /// 5
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public IList<string> ParamValues(int i)
|
||||
{
|
||||
IList<string> values = new List<string>();
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
return new List<string>(new string[] { "150", "300", "600", "1200", "2400", "4800", "9600",
|
||||
"19200", "38400", "57600", "76800", "115200"});
|
||||
case 2:
|
||||
values.Add(Parity.None.ToString());
|
||||
values.Add(Parity.Odd.ToString());
|
||||
values.Add(Parity.Even.ToString());
|
||||
return values;
|
||||
case 3:
|
||||
values.Add(7.ToString());
|
||||
values.Add(8.ToString());
|
||||
return values;
|
||||
case 4:
|
||||
values.Add(StopBits.None.ToString());
|
||||
values.Add(StopBits.One.ToString());
|
||||
values.Add(StopBits.OnePointFive.ToString());
|
||||
values.Add(StopBits.Two.ToString());
|
||||
return values;
|
||||
case 5:
|
||||
values.Add(Handshake.None.ToString());
|
||||
values.Add(Handshake.XOnXOff.ToString());
|
||||
values.Add(Handshake.RequestToSend.ToString());
|
||||
values.Add(Handshake.RequestToSendXOnXOff.ToString());
|
||||
return values;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
public string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return ComPortNr.ToString();
|
||||
case 1: return BaudRate.ToString();
|
||||
case 2: return Parity.ToString();
|
||||
case 3: return DataBits.ToString();
|
||||
case 4: return StopBits.ToString();
|
||||
case 5: return Handshake.ToString();
|
||||
default:
|
||||
return string.Format("{0}: Com{1}, {2}Bd, {3}-bits, parity={4}, stopBits={5}, {6}",
|
||||
Name, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string str)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: ComPortNr = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: BaudRate = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: Parity = TBF.Utils.GetParity(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: DataBits = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: StopBits = TBF.Utils.GetStopBits(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: Handshake = TBF.Utils.GetHandshake(str); return CfgUpdateFlags.RestartRqrd;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int idummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (int.TryParse(strValue, out idummy) && idummy > 0) return true;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
if (ParamValues(i).Contains(strValue)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(ModbusCfg prms)
|
||||
{
|
||||
prms.ComPortNr = this.ComPortNr;
|
||||
prms.BaudRate = this.BaudRate;
|
||||
prms.Parity = this.Parity;
|
||||
prms.DataBits = this.DataBits;
|
||||
prms.StopBits = this.StopBits;
|
||||
prms.Handshake = this.Handshake;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
ModbusCfg pars = new ModbusCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,171 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.IO.Ports;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.Common
|
||||
{
|
||||
public partial class ModbusCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
ModbusCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as ModbusCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public ModbusCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
parityComboBox.Items.Add(Parity.None.ToString());
|
||||
parityComboBox.Items.Add(Parity.Even.ToString());
|
||||
parityComboBox.Items.Add(Parity.Odd.ToString());
|
||||
|
||||
stopBitsComboBox.Items.Add(StopBits.None.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.One.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.OnePointFive.ToString());
|
||||
stopBitsComboBox.Items.Add(StopBits.Two.ToString());
|
||||
|
||||
handshakeComboBox.Items.Add(Handshake.None.ToString());
|
||||
handshakeComboBox.Items.Add(Handshake.RequestToSend.ToString());
|
||||
handshakeComboBox.Items.Add(Handshake.XOnXOff.ToString());
|
||||
}
|
||||
|
||||
int GetParityIx(Parity par)
|
||||
{
|
||||
if (par == Parity.None) return 0;
|
||||
if (par == Parity.Even) return 0;
|
||||
if (par == Parity.Odd) return 0;
|
||||
return -1;
|
||||
}
|
||||
Parity GetParity(string str)
|
||||
{
|
||||
if (str.Equals(Parity.None.ToString())) return Parity.None;
|
||||
if (str.Equals(Parity.Even.ToString())) return Parity.Even;
|
||||
if (str.Equals(Parity.Odd.ToString())) return Parity.Odd;
|
||||
return (Parity)(-1);
|
||||
}
|
||||
|
||||
int GetStopBitsIx(StopBits sb)
|
||||
{
|
||||
if (sb == StopBits.None) return 0;
|
||||
if (sb == StopBits.One) return 1;
|
||||
if (sb == StopBits.OnePointFive) return 2;
|
||||
if (sb == StopBits.Two) return 3;
|
||||
return -1;
|
||||
}
|
||||
StopBits GetStopBits(string str)
|
||||
{
|
||||
if (str.Equals(StopBits.None.ToString())) return StopBits.None;
|
||||
if (str.Equals(StopBits.One.ToString())) return StopBits.One;
|
||||
if (str.Equals(StopBits.OnePointFive.ToString())) return StopBits.OnePointFive;
|
||||
if (str.Equals(StopBits.Two.ToString())) return StopBits.Two;
|
||||
return (StopBits)(-1);
|
||||
}
|
||||
|
||||
int GetHandshakeIx(Handshake par)
|
||||
{
|
||||
if (par == Handshake.None) return 0;
|
||||
if (par == Handshake.RequestToSend) return 0;
|
||||
if (par == Handshake.XOnXOff) return 0;
|
||||
return -1;
|
||||
}
|
||||
Handshake GetHandshake(string str)
|
||||
{
|
||||
if (str.Equals(Handshake.None.ToString())) return Handshake.None;
|
||||
if (str.Equals(Handshake.RequestToSend.ToString())) return Handshake.RequestToSend;
|
||||
if (str.Equals(Handshake.XOnXOff.ToString())) return Handshake.XOnXOff;
|
||||
return (Handshake)(-1);
|
||||
}
|
||||
|
||||
private void ModbusCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
nameLabel.Text = Strings.Name;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
comPortNrTextBox.Text = config.ComPortNr.ToString();
|
||||
baudRateTextBox.Text = config.BaudRate.ToString();
|
||||
parityComboBox.Text = config.Parity.ToString();
|
||||
dataBitsTextBox.Text = config.DataBits.ToString();
|
||||
stopBitsComboBox.Text = config.StopBits.ToString();
|
||||
handshakeComboBox.Text = config.Handshake.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
comPortNrTextBox.Enabled = true;
|
||||
baudRateTextBox.Enabled = true;
|
||||
parityComboBox.Enabled = true;
|
||||
dataBitsTextBox.Enabled = true;
|
||||
stopBitsComboBox.Enabled = true;
|
||||
handshakeComboBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ComPortNr = int.Parse(comPortNrTextBox.Text);
|
||||
config.BaudRate = int.Parse(baudRateTextBox.Text);
|
||||
config.Parity = GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.DataBits = int.Parse(dataBitsTextBox.Text);
|
||||
config.StopBits = GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
config.Handshake = GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
int dummy;
|
||||
if (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Serial Port Number' is not valid";
|
||||
}
|
||||
|
||||
if (!int.TryParse(baudRateTextBox.Text, out dummy) || dummy < 150 || dummy > 115200)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Baud Rate' is not valid";
|
||||
}
|
||||
|
||||
if (!int.TryParse(dataBitsTextBox.Text, out dummy) || dummy < 7 || dummy > 8)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Data Bits' is not valid";
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,229 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Modbus.Common
|
||||
{
|
||||
partial class ModbusCfgCtrl
|
||||
{
|
||||
/// <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.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.handshakeLabel = 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.handshakeComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// comPortNrTextBox
|
||||
//
|
||||
this.comPortNrTextBox.Enabled = false;
|
||||
this.comPortNrTextBox.Location = new System.Drawing.Point(140, 52);
|
||||
this.comPortNrTextBox.Name = "comPortNrTextBox";
|
||||
this.comPortNrTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.comPortNrTextBox.TabIndex = 4;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(29, 55);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(98, 13);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Serial Port Number:";
|
||||
//
|
||||
// baudRateLabel
|
||||
//
|
||||
this.baudRateLabel.AutoSize = true;
|
||||
this.baudRateLabel.Location = new System.Drawing.Point(29, 79);
|
||||
this.baudRateLabel.Name = "baudRateLabel";
|
||||
this.baudRateLabel.Size = new System.Drawing.Size(58, 13);
|
||||
this.baudRateLabel.TabIndex = 5;
|
||||
this.baudRateLabel.Text = "Baud Rate";
|
||||
//
|
||||
// baudRateTextBox
|
||||
//
|
||||
this.baudRateTextBox.Enabled = false;
|
||||
this.baudRateTextBox.Location = new System.Drawing.Point(140, 76);
|
||||
this.baudRateTextBox.Name = "baudRateTextBox";
|
||||
this.baudRateTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.baudRateTextBox.TabIndex = 6;
|
||||
//
|
||||
// partityLabel
|
||||
//
|
||||
this.partityLabel.AutoSize = true;
|
||||
this.partityLabel.Location = new System.Drawing.Point(29, 103);
|
||||
this.partityLabel.Name = "partityLabel";
|
||||
this.partityLabel.Size = new System.Drawing.Size(33, 13);
|
||||
this.partityLabel.TabIndex = 7;
|
||||
this.partityLabel.Text = "Parity";
|
||||
//
|
||||
// dataBitsLabel
|
||||
//
|
||||
this.dataBitsLabel.AutoSize = true;
|
||||
this.dataBitsLabel.Location = new System.Drawing.Point(29, 127);
|
||||
this.dataBitsLabel.Name = "dataBitsLabel";
|
||||
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
|
||||
this.dataBitsLabel.TabIndex = 9;
|
||||
this.dataBitsLabel.Text = "Data Bits";
|
||||
//
|
||||
// dataBitsTextBox
|
||||
//
|
||||
this.dataBitsTextBox.Enabled = false;
|
||||
this.dataBitsTextBox.Location = new System.Drawing.Point(140, 124);
|
||||
this.dataBitsTextBox.Name = "dataBitsTextBox";
|
||||
this.dataBitsTextBox.Size = new System.Drawing.Size(34, 20);
|
||||
this.dataBitsTextBox.TabIndex = 10;
|
||||
//
|
||||
// stopBitsLabel
|
||||
//
|
||||
this.stopBitsLabel.AutoSize = true;
|
||||
this.stopBitsLabel.Location = new System.Drawing.Point(29, 151);
|
||||
this.stopBitsLabel.Name = "stopBitsLabel";
|
||||
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
|
||||
this.stopBitsLabel.TabIndex = 11;
|
||||
this.stopBitsLabel.Text = "Stop Bits";
|
||||
//
|
||||
// handshakeLabel
|
||||
//
|
||||
this.handshakeLabel.AutoSize = true;
|
||||
this.handshakeLabel.Location = new System.Drawing.Point(29, 175);
|
||||
this.handshakeLabel.Name = "handshakeLabel";
|
||||
this.handshakeLabel.Size = new System.Drawing.Size(62, 13);
|
||||
this.handshakeLabel.TabIndex = 13;
|
||||
this.handshakeLabel.Text = "Handshake";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(140, 28);
|
||||
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, 31);
|
||||
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, 7);
|
||||
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, 100);
|
||||
this.parityComboBox.Name = "parityComboBox";
|
||||
this.parityComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.parityComboBox.TabIndex = 8;
|
||||
//
|
||||
// stopBitsComboBox
|
||||
//
|
||||
this.stopBitsComboBox.Enabled = false;
|
||||
this.stopBitsComboBox.FormattingEnabled = true;
|
||||
this.stopBitsComboBox.Location = new System.Drawing.Point(140, 148);
|
||||
this.stopBitsComboBox.Name = "stopBitsComboBox";
|
||||
this.stopBitsComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.stopBitsComboBox.TabIndex = 12;
|
||||
//
|
||||
// handshakeComboBox
|
||||
//
|
||||
this.handshakeComboBox.Enabled = false;
|
||||
this.handshakeComboBox.FormattingEnabled = true;
|
||||
this.handshakeComboBox.Location = new System.Drawing.Point(140, 172);
|
||||
this.handshakeComboBox.Name = "handshakeComboBox";
|
||||
this.handshakeComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.handshakeComboBox.TabIndex = 14;
|
||||
//
|
||||
// AmbientCfgCtrl
|
||||
//
|
||||
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.handshakeComboBox);
|
||||
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.handshakeLabel);
|
||||
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 = "AmbientCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 240);
|
||||
this.Load += new System.EventHandler(this.ModbusCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox comPortNrTextBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label baudRateLabel;
|
||||
private System.Windows.Forms.TextBox baudRateTextBox;
|
||||
private System.Windows.Forms.Label partityLabel;
|
||||
private System.Windows.Forms.Label dataBitsLabel;
|
||||
private System.Windows.Forms.TextBox dataBitsTextBox;
|
||||
private System.Windows.Forms.Label stopBitsLabel;
|
||||
private System.Windows.Forms.Label handshakeLabel;
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.ComboBox parityComboBox;
|
||||
private System.Windows.Forms.ComboBox stopBitsComboBox;
|
||||
private System.Windows.Forms.ComboBox handshakeComboBox;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
+1
-1
@@ -8,7 +8,7 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
public string ClassName { get { return GetType().Namespace.Substring(17); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public void ResetStaticProperties() { PressureMeter.ResetStaticProperties(); }
|
||||
+9
-11
@@ -20,11 +20,9 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
|
||||
readonly GenericDevices.IModbus modbus;
|
||||
double receivedPressure;
|
||||
public double MeasuredVal
|
||||
{
|
||||
get { return receivedPressure; }
|
||||
set { } // TODO
|
||||
}
|
||||
|
||||
public double MeasuredVal { get { return receivedPressure; } }
|
||||
public string AltString { get { return string.Empty; } }
|
||||
|
||||
|
||||
public PressureMeter() { }
|
||||
@@ -77,7 +75,7 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
{
|
||||
const byte Function = 4; /// Read input registers
|
||||
const ushort Address = 0; /// Pressure
|
||||
modbus.SendMessage(pressureMtrCfg.ModbusAddress, Function, Address, 2);
|
||||
modbus.SendMessage((byte)pressureMtrCfg.ModbusAddress, Function, Address, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,15 +88,15 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
/// Returns the water pressure
|
||||
/// </summary>
|
||||
/// <returns>Pressure in mBar</returns>
|
||||
public float ReadPressure()
|
||||
public double ReadPressure()
|
||||
{
|
||||
if (Cfg.DebugLevel == Config.Entities.DebugMode.Normal)
|
||||
{
|
||||
return Convert.ToSingle(Config.Formulas.CorrectedValue(receivedPressure, Corrections));
|
||||
return Config.Formulas.CorrectedValue(receivedPressure, Corrections);
|
||||
}
|
||||
else if (Cfg.DebugLevel == Config.Entities.DebugMode.Simulate)
|
||||
{
|
||||
return 1.0F;
|
||||
return 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -111,7 +109,7 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
/// </summary>
|
||||
/// <param name="pressureBox">Reference to a variable for the pressure in Bar</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadPressureOp(ref FloatBox pressureBox)
|
||||
public IOperation ReadPressureOp(ref DoubleBox pressureBox)
|
||||
{
|
||||
return new ReadPressureOp(this, ref pressureBox);
|
||||
}
|
||||
@@ -122,7 +120,7 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
/// <param name="pressureBox">Reference to a variable for the pressure in Bar</param>
|
||||
/// <param name="pressureDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
public IOperation ReadPressureOp(ref FloatBox pressureBox, Event pressureDone)
|
||||
public IOperation ReadPressureOp(ref DoubleBox pressureBox, Event pressureDone)
|
||||
{
|
||||
return new ReadPressureOp(this, ref pressureBox, pressureDone);
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Config;
|
||||
using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
{
|
||||
public class PressureMeterCfg : ComponentCfgBase, IChildComponentCfg, GenericDevices.ICalibInfoCfg, IParamsProvider,
|
||||
IDrawingItemWithMeasuredVal
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PressureMeterCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl()
|
||||
{
|
||||
return new Configs.ParamsProvider.ComponentCfgCtrl(this, new List<string>(new string[] { "Modbus" }));
|
||||
}
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int ModbusAddress; /// 0 (1..254)
|
||||
public double DefaultPressure; /// 1
|
||||
public string MsrdFormat { get; set; } /// 2
|
||||
public Config.Unit MsrdUnit { get; set; } /// 3
|
||||
public double MsrdValLimLo { get; set; } /// 4
|
||||
public double MsrdValLimHi { get; set; } /// 5
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
public string CalibCertificateNr { get; set; }
|
||||
public DateTime CalibDate { get; set; }
|
||||
public DateTime CalibValidDate { get; set; }
|
||||
|
||||
/// Schematic drawing info
|
||||
public Shape Shape { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public Sz Sz { get; set; }
|
||||
public Orient Orient { get; set; }
|
||||
public bool Flip { get; set; }
|
||||
public int LblX { get; set; }
|
||||
public int LblY { get; set; }
|
||||
public Orient LblOrient { get; set; }
|
||||
public int MsrdX { get; set; }
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
|
||||
[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";
|
||||
ParentName = "Modbus";
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
ModbusAddress = 49;
|
||||
DefaultPressure = 2.34;
|
||||
MsrdFormat = "{0:F2} bar";
|
||||
MsrdUnit = Config.Unit.bar;
|
||||
MsrdValLimLo = -0.1;
|
||||
MsrdValLimHi = 25.0;
|
||||
|
||||
MsrdY = 22;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Modbus address", /// 0
|
||||
"Default pressure", /// 1
|
||||
"Display format", /// 2
|
||||
"Unit of pressure", /// 3
|
||||
"Pressure limit Lo", /// 4
|
||||
"Pressure limit Hi", /// 5
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public IList<string> ParamValues(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 3:
|
||||
return new List<string>(new string[] { "Pa", "hPa", "mbar", "kPa", "inHg", "psi", "bar", "MPa" });
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return ModbusAddress.ToString();
|
||||
case 1: return DefaultPressure.ToString();
|
||||
case 2: return MsrdFormat;
|
||||
case 3: return MsrdUnit.ToString();
|
||||
case 4: return MsrdValLimLo.ToString();
|
||||
case 5: return MsrdValLimHi.ToString();
|
||||
default:
|
||||
return string.Format("{0}(1) {2}[{3},{4}] addr={5}", Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName), Shape, X, Y, ModbusAddress);
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string str)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: ModbusAddress = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: DefaultPressure = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: MsrdFormat = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 3:
|
||||
foreach (var u in new Unit[] { Unit.Pa, Unit.hPa, Unit.mbar, Unit.kPa, Unit.inHg, Unit.psi, Unit.bar, Unit.MPa })
|
||||
{
|
||||
if (str == u.ToString())
|
||||
{
|
||||
MsrdUnit = u;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
case 4: MsrdValLimLo = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: MsrdValLimHi = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string str, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int idummy;
|
||||
double dummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (int.TryParse(str, out idummy) && idummy >= 1 && idummy <= 254) return true;
|
||||
break;
|
||||
case 1:
|
||||
case 4:
|
||||
case 5:
|
||||
if (TBF.Utils.TryParseSDouble(str, out dummy)) return true;
|
||||
break;
|
||||
case 2:
|
||||
return true;
|
||||
case 3:
|
||||
if (ParamValues(3).Contains(str)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(PressureMeterCfg prms)
|
||||
{
|
||||
prms.ParentName = this.ParentName;
|
||||
|
||||
prms.CalibCertificateNr = this.CalibCertificateNr;
|
||||
prms.CalibDate = this.CalibDate;
|
||||
prms.CalibValidDate = this.CalibValidDate;
|
||||
prms.Shape = this.Shape;
|
||||
prms.Sz = this.Sz;
|
||||
prms.Orient = this.Orient;
|
||||
prms.Flip = this.Flip;
|
||||
prms.LblX = this.LblX;
|
||||
prms.LblY = this.LblY;
|
||||
prms.LblOrient = this.LblOrient;
|
||||
prms.MsrdX = this.MsrdX;
|
||||
prms.MsrdY = this.MsrdY;
|
||||
prms.MsrdOrient = this.MsrdOrient;
|
||||
|
||||
prms.ModbusAddress = this.ModbusAddress;
|
||||
prms.DefaultPressure = this.DefaultPressure;
|
||||
prms.MsrdFormat = this.MsrdFormat;
|
||||
prms.MsrdUnit = this.MsrdUnit;
|
||||
prms.MsrdValLimLo = this.MsrdValLimLo;
|
||||
prms.MsrdValLimHi = this.MsrdValLimHi;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
PressureMeterCfg pars = new PressureMeterCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-7
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
|
||||
/// Set by the constructor
|
||||
readonly PressureMeter pressureMeter;
|
||||
readonly FloatBox pressure; /// Box for the measured value
|
||||
readonly DoubleBox pressure; /// Box for the measured value
|
||||
readonly Event eventDone;
|
||||
|
||||
/// <summary>
|
||||
@@ -23,7 +23,7 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
/// <param name="pressureMeter">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 ReadPressureOp(PressureMeter pressureMeter, ref FloatBox pressure, Event eventDone)
|
||||
public ReadPressureOp(PressureMeter pressureMeter, ref DoubleBox pressure, Event eventDone)
|
||||
{
|
||||
if (pressureMeter == null) throw new ArgumentNullException("pressureMeter");
|
||||
this.pressureMeter = pressureMeter;
|
||||
@@ -32,7 +32,7 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadPressureOp(PressureMeter pressureMeter, ref FloatBox pressure)
|
||||
public ReadPressureOp(PressureMeter pressureMeter, ref DoubleBox pressure)
|
||||
: this(pressureMeter, ref pressure, Event.PressureDone)
|
||||
{
|
||||
}
|
||||
@@ -55,8 +55,6 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
public void Stop() { }
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
{
|
||||
public class PressureMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg, IDrawingItemWithMeasuredVal
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PressureMeterCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new PressureMeterCfgCtrl(); }
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public byte ModbusAddress; /// 1..255
|
||||
|
||||
/// Schematic drawing info
|
||||
public Shape Shape { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public Sz Sz { get; set; }
|
||||
public Orient Orient { get; set; }
|
||||
public bool Flip { get; set; }
|
||||
public int LblX { get; set; }
|
||||
public int LblY { get; set; }
|
||||
public Orient LblOrient { get; set; }
|
||||
public int MsrdX { get; set; }
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
public Config.Unit 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()
|
||||
{
|
||||
GNodes = new List<GNode>();
|
||||
}
|
||||
|
||||
public PressureMeterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Shape = Shape.PressM;
|
||||
Sz = Sz.M;
|
||||
|
||||
Factory = factory;
|
||||
Name = "Pr";
|
||||
ParentName = "Modbus";
|
||||
ModbusAddress = 49;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("{0}(1) {2}[{3},{4}] addr={5}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
Shape,
|
||||
X,
|
||||
Y,
|
||||
ModbusAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2016-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.Modbus.PressureMeter.Meret
|
||||
{
|
||||
public partial class PressureMeterCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
ComponentParametersDlg parent;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
PressureMeterCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as PressureMeterCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public PressureMeterCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void PressureMeterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
parent = ParentForm as ComponentParametersDlg;
|
||||
if (parent == null) return;
|
||||
|
||||
if (parent.CmpntEntities != null)
|
||||
{
|
||||
foreach (var cmpnt in parent.CmpntEntities)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
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)
|
||||
{
|
||||
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";
|
||||
}
|
||||
if (!unitsComboBox.Items.Contains(unitsComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Units'";
|
||||
}
|
||||
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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
-180
@@ -1,180 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.Modbus.PressureMeter.Meret
|
||||
{
|
||||
partial class PressureMeterCfgCtrl
|
||||
{
|
||||
/// <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.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();
|
||||
|
||||
}
|
||||
|
||||
#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;
|
||||
private System.Windows.Forms.TextBox formatTextBox;
|
||||
private System.Windows.Forms.Label formatLabel;
|
||||
private System.Windows.Forms.ComboBox unitsComboBox;
|
||||
private System.Windows.Forms.Label unitsLabel;
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -37,7 +37,7 @@ namespace TBF.BenchControl.Modbus.PumpFM.DanfossVLT
|
||||
public int SetpY { get; set; }
|
||||
public Orient SetpOrient { get; set; }
|
||||
public string SetpFormat { get; set; }
|
||||
public Config.Unit SetpUnits { get; set; }
|
||||
public Config.Unit SetpUnit { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
@@ -57,7 +57,7 @@ namespace TBF.BenchControl.Modbus.PumpFM.DanfossVLT
|
||||
Shape = Shape.PumpFM;
|
||||
Sz = Sz.M;
|
||||
SetpFormat = "{0:F0} %";
|
||||
SetpUnits = Config.Unit.Pct;
|
||||
SetpUnit = Config.Unit.Pct;
|
||||
|
||||
Name = "P";
|
||||
Factory = factory;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace TBF.BenchControl.Modbus.PumpFM.DanfossVLT
|
||||
delayTextBox.Text = config.Delay.ToString();
|
||||
modbusAddressTextBox.Text = config.ModbusAddress.ToString();
|
||||
formatTextBox.Text = config.SetpFormat;
|
||||
unitsComboBox.Text = config.SetpUnits.ToString();
|
||||
unitsComboBox.Text = config.SetpUnit.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
@@ -133,12 +133,12 @@ namespace TBF.BenchControl.Modbus.PumpFM.DanfossVLT
|
||||
config.ModbusAddress = (byte)int.Parse(modbusAddressTextBox.Text);
|
||||
|
||||
config.SetpFormat = formatTextBox.Text;
|
||||
config.SetpUnits = global::Config.Unit.None;
|
||||
config.SetpUnit = global::Config.Unit.None;
|
||||
for (Config.Unit units = 0; units < global::Config.Unit.Count; units++)
|
||||
{
|
||||
if (unitsComboBox.Text == units.ToString())
|
||||
{
|
||||
config.SetpUnits = units;
|
||||
config.SetpUnit = units;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config;
|
||||
using TBF.BenchControl.ControlBoard.Legacy;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
@@ -11,22 +12,29 @@ using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Groch
|
||||
{
|
||||
public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItCmpnt
|
||||
public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItCmpntWithMeasuredVal
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter));
|
||||
public override string ToString() { return string.Format("TempMeter({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly TempMeterCfg tempMtrCfg;
|
||||
///
|
||||
int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..15
|
||||
double A1 { get { return tempMtrCfg.A1; } }
|
||||
double A2 { get { return tempMtrCfg.A2; } }
|
||||
double A3 { get { return tempMtrCfg.A3; } }
|
||||
double A4 { get { return tempMtrCfg.A4; } }
|
||||
double A5 { get { return tempMtrCfg.A5; } }
|
||||
double DefaultTemp { get { return tempMtrCfg != null ? Units.ConvertFrom(tempMtrCfg.MsrdUnit, tempMtrCfg.DefaultTemp) : 0; } }
|
||||
double MsrdValLimLo { get { return Units.ConvertFrom(tempMtrCfg.MsrdUnit, tempMtrCfg.MsrdValLimLo); } }
|
||||
double MsrdValLimHi { get { return Units.ConvertFrom(tempMtrCfg.MsrdUnit, tempMtrCfg.MsrdValLimHi); } }
|
||||
|
||||
public SchematicDrawing.IDrawingItem DrawingItem { get { return tempMtrCfg as SchematicDrawing.IDrawingItem; } }
|
||||
|
||||
readonly Common.Modbus modbus;
|
||||
|
||||
int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..15
|
||||
double A1 { get { return tempMtrCfg.A1; } }
|
||||
double A2 { get { return tempMtrCfg.A2; } }
|
||||
double A3 { get { return tempMtrCfg.A3; } }
|
||||
double A4 { get { return tempMtrCfg.A4; } }
|
||||
double A5 { get { return tempMtrCfg.A5; } }
|
||||
public double MeasuredVal { get { return ReadTemperature(); } }
|
||||
public string AltString { get { return "Invalid format"; } }
|
||||
|
||||
public TempMeter()
|
||||
{
|
||||
@@ -40,6 +48,8 @@ namespace TBF.BenchControl.Modbus.TempMeter.Groch
|
||||
modbus = TbfComponents.FindComponent(cfg.ParentName, components) as Common.Modbus;
|
||||
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
|
||||
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
@@ -83,7 +93,7 @@ namespace TBF.BenchControl.Modbus.TempMeter.Groch
|
||||
}
|
||||
else if (Cfg.DebugLevel == Config.Entities.DebugMode.Simulate)
|
||||
{
|
||||
return tempMtrCfg.DefaultTemperature;
|
||||
return DefaultTemp;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -3,30 +3,39 @@
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using Config;
|
||||
using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Groch
|
||||
{
|
||||
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg, IDrawingItemWithMeasuredVal
|
||||
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, GenericDevices.ICalibInfoCfg, IParamsProvider,
|
||||
IDrawingItemWithMeasuredVal
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new TempMeterCfgCtrl(); }
|
||||
public IComponentCfgCtrl GetControl()
|
||||
{
|
||||
return new Configs.ParamsProvider.ComponentCfgCtrl(this, new List<string>(new string[]{ "Modbus" }));
|
||||
}
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int Idx0; /// 0 .. 15
|
||||
public double A1;
|
||||
public double A2;
|
||||
public double A3;
|
||||
public double A4;
|
||||
public double A5;
|
||||
public double DefaultTemperature;
|
||||
public int Idx0; /// 0 (0..15)
|
||||
public double A1; /// 1
|
||||
public double A2; /// 2
|
||||
public double A3; /// 3
|
||||
public double A4; /// 4
|
||||
public double A5; /// 5
|
||||
public double DefaultTemp; /// 6
|
||||
public string MsrdFormat { get; set; } /// 7
|
||||
public Config.Unit MsrdUnit { get; set; } /// 8
|
||||
public double MsrdValLimLo { get; set; } /// 9
|
||||
public double MsrdValLimHi { get; set; } /// 10
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
public string CalibCertificateNr { get; set; }
|
||||
@@ -46,10 +55,6 @@ namespace TBF.BenchControl.Modbus.TempMeter.Groch
|
||||
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; }
|
||||
@@ -65,30 +70,183 @@ namespace TBF.BenchControl.Modbus.TempMeter.Groch
|
||||
{
|
||||
Shape = Shape.TempM;
|
||||
Sz = Sz.M;
|
||||
MsrdUnits = Config.Unit.C;
|
||||
MsrdFormat = "{0:F1} °C";
|
||||
|
||||
Factory = factory;
|
||||
Name = "T";
|
||||
ParentName = "CB";
|
||||
ParentName = "Modbus";
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
Idx0 = 0;
|
||||
A1 = 0;
|
||||
A2 = 0;
|
||||
A3 = 0;
|
||||
A4 = 0;
|
||||
A5 = 0;
|
||||
DefaultTemperature = 20.0;
|
||||
DefaultTemp = 20.0;
|
||||
MsrdFormat = "{0:F1} °C";
|
||||
MsrdUnit = Config.Unit.C;
|
||||
MsrdValLimLo = 5;
|
||||
MsrdValLimHi = 95;
|
||||
|
||||
MsrdY = 22;
|
||||
}
|
||||
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"0-based index", /// 0
|
||||
"A1", /// 1
|
||||
"A2", /// 2
|
||||
"A3", /// 3
|
||||
"A4", /// 4
|
||||
"A5", /// 5
|
||||
"Default temperature", /// 6
|
||||
"Display format", /// 7
|
||||
"Unit of temperature", /// 8
|
||||
"Temperature limit Lo", /// 9
|
||||
"Temperature limit Hi", /// 10
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public IList<string> ParamValues(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
var values = new List<string>();
|
||||
for (int j = 0; j < 16; j++) values.Add(j.ToString());
|
||||
return values;
|
||||
case 8:
|
||||
return new List<string>(new string[] { "°C", "°F", "K" });
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, Idx0={2}, A1={3}, A2={4}, A3={5}, A4={6}, A5={7}, Default={8}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
Idx0,
|
||||
A1, A2, A3, A4, A5, DefaultTemperature);
|
||||
switch (i)
|
||||
{
|
||||
case 0: return Idx0.ToString();
|
||||
case 1: return A1.ToString();
|
||||
case 2: return A2.ToString();
|
||||
case 3: return A3.ToString();
|
||||
case 4: return A4.ToString();
|
||||
case 5: return A5.ToString();
|
||||
case 6: return DefaultTemp.ToString();
|
||||
case 7: return MsrdFormat;
|
||||
case 8: return (MsrdUnit == Unit.K) ? "K" : (MsrdUnit == Unit.F) ? "°F" : "°C";
|
||||
case 9: return MsrdValLimLo.ToString();
|
||||
case 10: return MsrdValLimHi.ToString();
|
||||
default:
|
||||
return string.Format("Name={0}, Parent={1}, Idx0={2}, A1={3}, A2={4}, A3={5}, A4={6}, A5={7}, Default={8}",
|
||||
Name, (string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
Idx0, A1, A2, A3, A4, A5, DefaultTemp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string str)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: Idx0 = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: A1 = TBF.Utils.ParseEDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: A2 = TBF.Utils.ParseEDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: A3 = TBF.Utils.ParseEDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: A4 = TBF.Utils.ParseEDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: A5 = TBF.Utils.ParseEDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 6: DefaultTemp = TBF.Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 7: MsrdFormat = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 8: MsrdUnit = (str == "°K" || str == "K") ? Unit.K
|
||||
: (str == "°F" || str == "F") ? Unit.F
|
||||
: Unit.C; return CfgUpdateFlags.RestartRqrd;
|
||||
case 9: MsrdValLimLo = TBF.Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 10: MsrdValLimHi = TBF.Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string str, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int idummy;
|
||||
double dummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (int.TryParse(str, out idummy) && idummy >= 0 && idummy <= 15) return true;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
if (TBF.Utils.TryParseEDouble(str, out dummy)) return true;
|
||||
break;
|
||||
case 6:
|
||||
case 9:
|
||||
case 10:
|
||||
if (TBF.Utils.TryParseSDouble(str, out dummy)) return true;
|
||||
break;
|
||||
case 7: return true;
|
||||
case 8:
|
||||
if (str == "K" || str == "°K" || str == "°F" || str == "F" || str == "°C" || str == "C") return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(TempMeterCfg prms)
|
||||
{
|
||||
prms.ParentName = this.ParentName;
|
||||
|
||||
prms.CalibCertificateNr = this.CalibCertificateNr;
|
||||
prms.CalibDate = this.CalibDate;
|
||||
prms.CalibValidDate = this.CalibValidDate;
|
||||
prms.Shape = this.Shape;
|
||||
prms.Sz = this.Sz;
|
||||
prms.Orient = this.Orient;
|
||||
prms.Flip = this.Flip;
|
||||
prms.LblX = this.LblX;
|
||||
prms.LblY = this.LblY;
|
||||
prms.LblOrient = this.LblOrient;
|
||||
prms.MsrdX = this.MsrdX;
|
||||
prms.MsrdY = this.MsrdY;
|
||||
prms.MsrdOrient = this.MsrdOrient;
|
||||
|
||||
prms.Idx0 = this.Idx0;
|
||||
prms.A1 = this.A1;
|
||||
prms.A2 = this.A2;
|
||||
prms.A3 = this.A3;
|
||||
prms.A4 = this.A4;
|
||||
prms.A5 = this.A5;
|
||||
prms.DefaultTemp = this.DefaultTemp;
|
||||
prms.MsrdFormat = this.MsrdFormat;
|
||||
prms.MsrdUnit = this.MsrdUnit;
|
||||
prms.MsrdValLimLo = this.MsrdValLimLo;
|
||||
prms.MsrdValLimHi = this.MsrdValLimHi;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
TempMeterCfg pars = new TempMeterCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,285 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Groch
|
||||
{
|
||||
partial class TempMeterCfgCtrl
|
||||
{
|
||||
/// <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.positionTextBox = new System.Windows.Forms.TextBox();
|
||||
this.positionLabel = new System.Windows.Forms.Label();
|
||||
this.parentNameLabel = new System.Windows.Forms.Label();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.a1TextBox = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.a2TextBox = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.a3TextBox = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.a5TextBox = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.a4TextBox = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.defaultTempTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.importButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// positionTextBox
|
||||
//
|
||||
this.positionTextBox.Enabled = false;
|
||||
this.positionTextBox.Location = new System.Drawing.Point(130, 83);
|
||||
this.positionTextBox.Name = "positionTextBox";
|
||||
this.positionTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.positionTextBox.TabIndex = 6;
|
||||
//
|
||||
// positionLabel
|
||||
//
|
||||
this.positionLabel.AutoSize = true;
|
||||
this.positionLabel.Location = new System.Drawing.Point(20, 86);
|
||||
this.positionLabel.Name = "positionLabel";
|
||||
this.positionLabel.Size = new System.Drawing.Size(44, 13);
|
||||
this.positionLabel.TabIndex = 5;
|
||||
this.positionLabel.Text = "Position";
|
||||
//
|
||||
// parentNameLabel
|
||||
//
|
||||
this.parentNameLabel.AutoSize = true;
|
||||
this.parentNameLabel.Location = new System.Drawing.Point(20, 61);
|
||||
this.parentNameLabel.Name = "parentNameLabel";
|
||||
this.parentNameLabel.Size = new System.Drawing.Size(69, 13);
|
||||
this.parentNameLabel.TabIndex = 3;
|
||||
this.parentNameLabel.Text = "Parent Name";
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(130, 34);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(20, 37);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(127, 10);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// a1TextBox
|
||||
//
|
||||
this.a1TextBox.Enabled = false;
|
||||
this.a1TextBox.Location = new System.Drawing.Point(130, 107);
|
||||
this.a1TextBox.Name = "a1TextBox";
|
||||
this.a1TextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.a1TextBox.TabIndex = 9;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(20, 110);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(20, 13);
|
||||
this.label1.TabIndex = 8;
|
||||
this.label1.Text = "A1";
|
||||
//
|
||||
// a2TextBox
|
||||
//
|
||||
this.a2TextBox.Enabled = false;
|
||||
this.a2TextBox.Location = new System.Drawing.Point(130, 128);
|
||||
this.a2TextBox.Name = "a2TextBox";
|
||||
this.a2TextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.a2TextBox.TabIndex = 11;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(20, 131);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(20, 13);
|
||||
this.label2.TabIndex = 10;
|
||||
this.label2.Text = "A2";
|
||||
//
|
||||
// a3TextBox
|
||||
//
|
||||
this.a3TextBox.Enabled = false;
|
||||
this.a3TextBox.Location = new System.Drawing.Point(130, 149);
|
||||
this.a3TextBox.Name = "a3TextBox";
|
||||
this.a3TextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.a3TextBox.TabIndex = 13;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(20, 152);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(20, 13);
|
||||
this.label3.TabIndex = 12;
|
||||
this.label3.Text = "A3";
|
||||
//
|
||||
// a5TextBox
|
||||
//
|
||||
this.a5TextBox.Enabled = false;
|
||||
this.a5TextBox.Location = new System.Drawing.Point(130, 191);
|
||||
this.a5TextBox.Name = "a5TextBox";
|
||||
this.a5TextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.a5TextBox.TabIndex = 17;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(20, 194);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(20, 13);
|
||||
this.label5.TabIndex = 16;
|
||||
this.label5.Text = "A5";
|
||||
//
|
||||
// a4TextBox
|
||||
//
|
||||
this.a4TextBox.Enabled = false;
|
||||
this.a4TextBox.Location = new System.Drawing.Point(130, 170);
|
||||
this.a4TextBox.Name = "a4TextBox";
|
||||
this.a4TextBox.Size = new System.Drawing.Size(160, 20);
|
||||
this.a4TextBox.TabIndex = 15;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(20, 173);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(20, 13);
|
||||
this.label4.TabIndex = 14;
|
||||
this.label4.Text = "A4";
|
||||
//
|
||||
// parentNameComboBox
|
||||
//
|
||||
this.parentNameComboBox.Enabled = false;
|
||||
this.parentNameComboBox.FormattingEnabled = true;
|
||||
this.parentNameComboBox.Location = new System.Drawing.Point(130, 58);
|
||||
this.parentNameComboBox.Name = "parentNameComboBox";
|
||||
this.parentNameComboBox.Size = new System.Drawing.Size(160, 21);
|
||||
this.parentNameComboBox.TabIndex = 4;
|
||||
//
|
||||
// defaultTempTextBox
|
||||
//
|
||||
this.defaultTempTextBox.Enabled = false;
|
||||
this.defaultTempTextBox.Location = new System.Drawing.Point(130, 217);
|
||||
this.defaultTempTextBox.Name = "defaultTempTextBox";
|
||||
this.defaultTempTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.defaultTempTextBox.TabIndex = 19;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(20, 220);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(100, 13);
|
||||
this.label6.TabIndex = 18;
|
||||
this.label6.Text = "Default temperature";
|
||||
//
|
||||
// importButton
|
||||
//
|
||||
this.importButton.Enabled = false;
|
||||
this.importButton.Location = new System.Drawing.Point(182, 81);
|
||||
this.importButton.Name = "importButton";
|
||||
this.importButton.Size = new System.Drawing.Size(108, 23);
|
||||
this.importButton.TabIndex = 7;
|
||||
this.importButton.Text = "Import A1 ... A5";
|
||||
this.importButton.UseVisualStyleBackColor = true;
|
||||
this.importButton.Click += new System.EventHandler(this.importButton_Click);
|
||||
//
|
||||
// TempMeterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.importButton);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.defaultTempTextBox);
|
||||
this.Controls.Add(this.parentNameComboBox);
|
||||
this.Controls.Add(this.a5TextBox);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.a4TextBox);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.a3TextBox);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.a2TextBox);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.a1TextBox);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.positionTextBox);
|
||||
this.Controls.Add(this.positionLabel);
|
||||
this.Controls.Add(this.parentNameLabel);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "TempMeterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(350, 240);
|
||||
this.Load += new System.EventHandler(this.TempMeterCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox positionTextBox;
|
||||
private System.Windows.Forms.Label positionLabel;
|
||||
private System.Windows.Forms.Label parentNameLabel;
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.TextBox a1TextBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox a2TextBox;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox a3TextBox;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox a5TextBox;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox a4TextBox;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.ComboBox parentNameComboBox;
|
||||
private System.Windows.Forms.TextBox defaultTempTextBox;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Button importButton;
|
||||
}
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.UI.Bench.Components;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Groch
|
||||
{
|
||||
public partial class TempMeterCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
static string lastImportFileName;
|
||||
|
||||
ComponentParametersDlg parent;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
TempMeterCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as TempMeterCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public TempMeterCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void TempMeterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
parent = ParentForm as ComponentParametersDlg;
|
||||
if (parent == null) return;
|
||||
|
||||
if (parent.CmpntEntities != null)
|
||||
{
|
||||
foreach (var cmpnt in parent.CmpntEntities)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is 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
|
||||
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
|
||||
positionTextBox.Text = config.Idx0.ToString();
|
||||
a1TextBox.Text = config.A1.ToString();
|
||||
a2TextBox.Text = config.A2.ToString();
|
||||
a3TextBox.Text = config.A3.ToString();
|
||||
a4TextBox.Text = config.A4.ToString();
|
||||
a5TextBox.Text = config.A5.ToString();
|
||||
defaultTempTextBox.Text = config.DefaultTemperature.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
parentNameComboBox.Enabled = true;
|
||||
positionTextBox.Enabled = true;
|
||||
importButton.Enabled = true;
|
||||
a1TextBox.Enabled = true;
|
||||
a2TextBox.Enabled = true;
|
||||
a3TextBox.Enabled = true;
|
||||
a4TextBox.Enabled = true;
|
||||
a5TextBox.Enabled = true;
|
||||
defaultTempTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
int dummy;
|
||||
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Parent Name'";
|
||||
}
|
||||
if (!int.TryParse(positionTextBox.Text, out dummy) || dummy < 0 || dummy > 15)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Position' should be between 0 and 15";
|
||||
}
|
||||
|
||||
double fdummy;
|
||||
if (!Utils.TryParseEDouble(a1TextBox.Text, out fdummy))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'A1' is not valid";
|
||||
}
|
||||
|
||||
if (!Utils.TryParseEDouble(a2TextBox.Text, out fdummy))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'A2' is not valid";
|
||||
}
|
||||
|
||||
if (!Utils.TryParseEDouble(a3TextBox.Text, out fdummy))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'A3' is not valid";
|
||||
}
|
||||
|
||||
if (!Utils.TryParseEDouble(a4TextBox.Text, out fdummy))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'A4' is not valid";
|
||||
}
|
||||
|
||||
if (!Utils.TryParseEDouble(a5TextBox.Text, out fdummy))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'A5' is not valid";
|
||||
}
|
||||
|
||||
if (!Utils.TryParseEDouble(defaultTempTextBox.Text, out fdummy))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Default temperature' is not valid";
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
|
||||
config.Idx0 = int.Parse(positionTextBox.Text);
|
||||
bool updateOk = Utils.TryParseEDouble(a1TextBox.Text, out config.A1) &&
|
||||
Utils.TryParseEDouble(a2TextBox.Text, out config.A2) &&
|
||||
Utils.TryParseEDouble(a3TextBox.Text, out config.A3) &&
|
||||
Utils.TryParseEDouble(a4TextBox.Text, out config.A4) &&
|
||||
Utils.TryParseEDouble(a5TextBox.Text, out config.A5) &&
|
||||
Utils.TryParseEDouble(defaultTempTextBox.Text, out config.DefaultTemperature);
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
private void importButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
if (!string.IsNullOrEmpty(lastImportFileName)) dlg.FileName = lastImportFileName;
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
using (TextReader reader = new StreamReader(dlg.FileName))
|
||||
{
|
||||
try
|
||||
{
|
||||
string startOfLine = string.Format("Calch{0} =", positionTextBox.Text);
|
||||
bool channelFound = false;
|
||||
string line;
|
||||
|
||||
do
|
||||
{
|
||||
line = reader.ReadLine();
|
||||
if (!string.IsNullOrEmpty(line) && (line.IndexOf(startOfLine) == 0))
|
||||
{
|
||||
string[] factors = line.Substring(startOfLine.Length).Split(new char[] { ',' });
|
||||
int count = factors.Length;
|
||||
double tmp;
|
||||
if (count >= 1 && Utils.TryParseEDouble(factors[0].Trim(), out tmp)) a1TextBox.Text = factors[0].Trim();
|
||||
if (count >= 2 && Utils.TryParseEDouble(factors[1].Trim(), out tmp)) a2TextBox.Text = factors[1].Trim();
|
||||
if (count >= 3 && Utils.TryParseEDouble(factors[2].Trim(), out tmp)) a3TextBox.Text = factors[2].Trim();
|
||||
if (count >= 4 && Utils.TryParseEDouble(factors[3].Trim(), out tmp)) a4TextBox.Text = factors[3].Trim();
|
||||
if (count >= 5 && Utils.TryParseEDouble(factors[4].Trim(), out tmp)) a5TextBox.Text = factors[4].Trim();
|
||||
channelFound = true;
|
||||
lastImportFileName = dlg.FileName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (line != null);
|
||||
|
||||
if (!channelFound)
|
||||
{
|
||||
MessageBox.Show(string.Format("Calibration factors for channel {0} not found.", positionTextBox.Text),
|
||||
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Wrong file format, import failed.",
|
||||
"Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -20,11 +20,8 @@ namespace TBF.BenchControl.Modbus.TempMeter.Meret
|
||||
|
||||
readonly GenericDevices.IModbus modbus;
|
||||
double receivedTemp;
|
||||
public double MeasuredVal
|
||||
{
|
||||
get { return receivedTemp; }
|
||||
set { } // TODO
|
||||
}
|
||||
public double MeasuredVal { get { return receivedTemp; } }
|
||||
public string AltString { get { return string.Empty; } }
|
||||
|
||||
|
||||
public TempMeter() { }
|
||||
@@ -78,7 +75,7 @@ namespace TBF.BenchControl.Modbus.TempMeter.Meret
|
||||
{
|
||||
const byte Function = 4; /// Read input registers
|
||||
const ushort Address = 0; /// Temperature
|
||||
modbus.SendMessage(tempMtrCfg.ModbusAddress, Function, Address, 2);
|
||||
modbus.SendMessage((byte)tempMtrCfg.ModbusAddress, Function, Address, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,37 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Config;
|
||||
using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.BenchControl.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Meret
|
||||
{
|
||||
public class TempMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg, IDrawingItemWithMeasuredVal
|
||||
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, GenericDevices.ICalibInfoCfg, IParamsProvider,
|
||||
IDrawingItemWithMeasuredVal
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new TempMeterCfgCtrl(); }
|
||||
public IComponentCfgCtrl GetControl()
|
||||
{
|
||||
return new Configs.ParamsProvider.ComponentCfgCtrl(this, new List<string>(new string[] { "Modbus" }));
|
||||
}
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public byte ModbusAddress; /// 1..254
|
||||
public int ModbusAddress; /// 0 (1..254)
|
||||
public double DefaultTemp; /// 1
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
public string CalibCertificateNr { get; set; }
|
||||
public DateTime CalibDate { get; set; }
|
||||
public DateTime CalibValidDate { get; set; }
|
||||
|
||||
/// Schematic drawing info
|
||||
public Shape Shape { get; set; }
|
||||
@@ -34,10 +46,11 @@ namespace TBF.BenchControl.Modbus.TempMeter.Meret
|
||||
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; }
|
||||
|
||||
public string MsrdFormat { get; set; } /// 2
|
||||
public Config.Unit MsrdUnit { get; set; } /// 3
|
||||
public double MsrdValLimLo { get; set; } /// 4
|
||||
public double MsrdValLimHi { get; set; } /// 5
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
@@ -53,24 +66,148 @@ namespace TBF.BenchControl.Modbus.TempMeter.Meret
|
||||
{
|
||||
Shape = Shape.TempM;
|
||||
Sz = Sz.M;
|
||||
|
||||
Factory = factory;
|
||||
Name = "T";
|
||||
ParentName = "Modbus";
|
||||
ModbusAddress = 49;
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
ModbusAddress = 49;
|
||||
DefaultTemp = 20.0;
|
||||
MsrdFormat = "{0:F1} °C";
|
||||
MsrdUnit = Config.Unit.C;
|
||||
MsrdValLimLo = 5;
|
||||
MsrdValLimHi = 95;
|
||||
|
||||
MsrdY = 22;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Modbus address", /// 0
|
||||
"Default temperature", /// 1
|
||||
"Display format", /// 2
|
||||
"Unit of temperature", /// 3
|
||||
"Temperature limit Lo", /// 4
|
||||
"Temperature limit Hi", /// 5
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public IList<string> ParamValues(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 3:
|
||||
return new List<string>(new string[] { "°C", "°F", "K" });
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("{0}(1) {2}[{3},{4}] addr={5}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
Shape,
|
||||
X,
|
||||
Y,
|
||||
ModbusAddress);
|
||||
switch (i)
|
||||
{
|
||||
case 0: return ModbusAddress.ToString();
|
||||
case 1: return DefaultTemp.ToString();
|
||||
case 2: return MsrdFormat;
|
||||
case 3: return (MsrdUnit == Unit.K) ? "K" : (MsrdUnit == Unit.F) ? "°F" : "°C";
|
||||
case 4: return MsrdValLimLo.ToString();
|
||||
case 5: return MsrdValLimHi.ToString();
|
||||
default:
|
||||
return string.Format("{0}(1) {2}[{3},{4}] addr={5}", Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName), Shape, X, Y, ModbusAddress);
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string str)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: ModbusAddress = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: DefaultTemp = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: MsrdFormat = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: MsrdUnit = (str == "°K" || str == "K") ? Unit.K
|
||||
: (str == "°F" || str == "F") ? Unit.F
|
||||
: Unit.C; return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: MsrdValLimLo = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: MsrdValLimHi = Utils.ParseSDouble(str); return CfgUpdateFlags.RestartRqrd;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string str, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int idummy;
|
||||
double dummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (int.TryParse(str, out idummy) && idummy >= 1 && idummy <= 254) return true;
|
||||
break;
|
||||
case 1:
|
||||
case 4:
|
||||
case 5:
|
||||
if (TBF.Utils.TryParseSDouble(str, out dummy)) return true;
|
||||
break;
|
||||
case 2:
|
||||
return true;
|
||||
case 3:
|
||||
if (str == "°K" || str == "K" || str == "°F" || str == "F" || str == "°C" || str == "C") return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(TempMeterCfg prms)
|
||||
{
|
||||
prms.ParentName = this.ParentName;
|
||||
|
||||
prms.CalibCertificateNr = this.CalibCertificateNr;
|
||||
prms.CalibDate = this.CalibDate;
|
||||
prms.CalibValidDate = this.CalibValidDate;
|
||||
prms.Shape = this.Shape;
|
||||
prms.Sz = this.Sz;
|
||||
prms.Orient = this.Orient;
|
||||
prms.Flip = this.Flip;
|
||||
prms.LblX = this.LblX;
|
||||
prms.LblY = this.LblY;
|
||||
prms.LblOrient = this.LblOrient;
|
||||
prms.MsrdX = this.MsrdX;
|
||||
prms.MsrdY = this.MsrdY;
|
||||
prms.MsrdOrient = this.MsrdOrient;
|
||||
|
||||
prms.ModbusAddress = this.ModbusAddress;
|
||||
prms.DefaultTemp = this.DefaultTemp;
|
||||
prms.MsrdFormat = this.MsrdFormat;
|
||||
prms.MsrdUnit = this.MsrdUnit;
|
||||
prms.MsrdValLimLo = this.MsrdValLimLo;
|
||||
prms.MsrdValLimHi = this.MsrdValLimHi;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
TempMeterCfg pars = new TempMeterCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 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.Modbus.TempMeter.Meret
|
||||
{
|
||||
public partial class TempMeterCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
ComponentParametersDlg parent;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
TempMeterCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as TempMeterCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public TempMeterCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void PressureMeterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
parent = ParentForm as ComponentParametersDlg;
|
||||
if (parent == null) return;
|
||||
|
||||
if (parent.CmpntEntities != null)
|
||||
{
|
||||
foreach (var cmpnt in parent.CmpntEntities)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.Common.Factory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
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)
|
||||
{
|
||||
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";
|
||||
}
|
||||
if (!unitsComboBox.Items.Contains(unitsComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Units'";
|
||||
}
|
||||
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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.Modbus.TempMeter.Meret
|
||||
{
|
||||
partial class TempMeterCfgCtrl
|
||||
{
|
||||
/// <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.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();
|
||||
|
||||
}
|
||||
|
||||
#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;
|
||||
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,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>
|
||||
@@ -45,9 +45,9 @@ namespace TBF.BenchControl.Network.Comet.Ambient
|
||||
///
|
||||
/// Measured values when MsrmntState == MsrmntState.Valid
|
||||
///
|
||||
float temperature; /// [°C]
|
||||
float pressure; /// [bar]
|
||||
float humidity; /// [R%]
|
||||
double temperature; /// [°C]
|
||||
double pressure; /// [bar]
|
||||
double humidity; /// [R%]
|
||||
|
||||
/// <summary>Measurement time stamp when MsrmntState == MsrmntState.Valid</summary>
|
||||
int msrmntTimeStamp;
|
||||
@@ -75,9 +75,9 @@ namespace TBF.BenchControl.Network.Comet.Ambient
|
||||
{
|
||||
if (myCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
temperature = 20.0f;
|
||||
humidity = 40.0f;
|
||||
pressure = 1.0f;
|
||||
temperature = 20.0;
|
||||
humidity = 40.0;
|
||||
pressure = 1.0;
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.FatalFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
|
||||
@@ -121,7 +121,7 @@ namespace TBF.BenchControl.Network.Comet.Ambient
|
||||
{
|
||||
case State.WaitingForTemperature:
|
||||
value = (int)bytes[9] * 256 + (int)bytes[10];
|
||||
temperature = (float)(value / 10.0); /// Conversion to °C
|
||||
temperature = value / 10.0; /// Conversion to °C
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("Ambient temperature = {0:F1} C", temperature);
|
||||
@@ -129,7 +129,7 @@ namespace TBF.BenchControl.Network.Comet.Ambient
|
||||
break;
|
||||
case State.WaitingForHumidity:
|
||||
value = (int)bytes[9] * 256 + (int)bytes[10];
|
||||
humidity = (float)(value / 10.0); /// Conversion to R%
|
||||
humidity = value / 10.0; /// Conversion to R%
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("Ambient humidity = {0:F1} %", humidity);
|
||||
@@ -137,7 +137,7 @@ namespace TBF.BenchControl.Network.Comet.Ambient
|
||||
break;
|
||||
case State.WaitingForPressure:
|
||||
value = (int)bytes[9] * 256 + (int)bytes[10];
|
||||
pressure = (float)(value / 10000.0); /// Conversion to bar
|
||||
pressure = value / 10000.0; /// Conversion to bar
|
||||
msrmntTimeStamp = StateMachine.Time;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
log.InfoFormat("Ambient pressure = {0:F0} mbar", 1000 * pressure);
|
||||
@@ -224,24 +224,24 @@ namespace TBF.BenchControl.Network.Comet.Ambient
|
||||
///
|
||||
/// Boxes for the operation result
|
||||
///
|
||||
FloatBox tempBox;
|
||||
FloatBox pressureBox;
|
||||
FloatBox humiBox;
|
||||
DoubleBox tempBox;
|
||||
DoubleBox pressureBox;
|
||||
DoubleBox humiBox;
|
||||
|
||||
public IOperation ReadAmbientOp(FloatBox tempBox, FloatBox pressureBox, FloatBox humiBox)
|
||||
public IOperation ReadAmbientOp(DoubleBox tempBox, DoubleBox pressureBox, DoubleBox humiBox)
|
||||
{
|
||||
this.tempBox = tempBox;
|
||||
this.tempBox = tempBox;
|
||||
this.pressureBox = pressureBox;
|
||||
this.humiBox = humiBox;
|
||||
this.humiBox = humiBox;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
if (tempBox != null) tempBox.Val = temperature;
|
||||
if (tempBox != null) tempBox.Val = temperature;
|
||||
if (pressureBox != null) pressureBox.Val = pressure;
|
||||
if (humiBox != null) humiBox.Val = humidity;
|
||||
if (humiBox != null) humiBox.Val = humidity;
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
@@ -250,15 +250,13 @@ namespace TBF.BenchControl.Network.Comet.Ambient
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (tempBox != null) tempBox.Val = temperature;
|
||||
if (tempBox != null) tempBox.Val = temperature;
|
||||
if (pressureBox != null) pressureBox.Val = pressure;
|
||||
if (humiBox != null) humiBox.Val = humidity;
|
||||
if (humiBox != null) humiBox.Val = humidity;
|
||||
return Event.AmbientDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
public void Stop() { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace TBF.BenchControl
|
||||
public float Qfrom;
|
||||
public float Qto;
|
||||
public IFlowMeter FlowMeter;
|
||||
public IRegulValve RegulValve;
|
||||
public IRegulValve RegValve;
|
||||
public float PidCoef;
|
||||
public IDiverter Diverter;
|
||||
public ITempMeter TempDiv;
|
||||
public ITempMeter TempMtrDiv;
|
||||
public IScaleOrTank Scale;
|
||||
public IValve StartValve1;
|
||||
public bool InvertSV1;
|
||||
@@ -45,10 +45,10 @@ namespace TBF.BenchControl
|
||||
Qfrom = outputPathEntity.Qfrom;
|
||||
Qto = outputPathEntity.Qto;
|
||||
FlowMeter = (IFlowMeter)TbfComponents.FindComponent(outputPathEntity.FlowMeter, components);
|
||||
RegulValve = (IRegulValve)TbfComponents.FindComponent(outputPathEntity.RegValve, components);
|
||||
RegValve = (IRegulValve)TbfComponents.FindComponent(outputPathEntity.RegValve, components);
|
||||
PidCoef = outputPathEntity.PidCoef;
|
||||
Diverter = (IDiverter)TbfComponents.FindComponent(outputPathEntity.Diverter, components);
|
||||
TempDiv = (ITempMeter)TbfComponents.FindComponent(outputPathEntity.TempMtrDiv, components);
|
||||
TempMtrDiv = (ITempMeter)TbfComponents.FindComponent(outputPathEntity.TempMtrDiv, components);
|
||||
Scale = (IScaleOrTank)TbfComponents.FindComponent(outputPathEntity.Scale, components);
|
||||
|
||||
string[] svs = outputPathEntity.StartValve != null ? outputPathEntity.StartValve.Split(new char[] { '~' }) : new string[0];
|
||||
@@ -76,7 +76,7 @@ namespace TBF.BenchControl
|
||||
{
|
||||
return string.Format("{0} RV={1}, Flowm.={2}, Div.={3}, Scale={4}",
|
||||
Name,
|
||||
(RegulValve != null) ? RegulValve.Name : "---",
|
||||
(RegValve != null) ? RegValve.Name : "---",
|
||||
(FlowMeter != null) ? FlowMeter.Name : "---",
|
||||
(Diverter != null) ? Diverter.Name : "---",
|
||||
(Scale != null) ? Scale.Name : "---");
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace TBF.BenchControl.Sequences
|
||||
/// Measured values and setpoints to be displayed
|
||||
///
|
||||
public static double[] MeasuredValues;
|
||||
public static string[] AltStrings;
|
||||
public static double[] Setpoints;
|
||||
|
||||
///
|
||||
@@ -186,15 +187,15 @@ namespace TBF.BenchControl.Sequences
|
||||
///
|
||||
public static IRegReader[] RegisterReaders;
|
||||
///
|
||||
public static FloatBox AmbTemp = new FloatBox() { Name = "Ambient Temperature", Format = "F1" }; /// [Celsius]
|
||||
public static FloatBox AmbPress = new FloatBox() { Name = "Ambient Pressure", Format = "F0", Factor = 1000 }; /// [bar], printed by ToString() in [mbar]
|
||||
public static FloatBox AmbHumi = new FloatBox() { Name = "Ambient Humidity", Format = "F1" }; /// [%]
|
||||
public static DoubleBox AmbTemp = new DoubleBox() { Name = "Ambient Temperature", Format = "F1" }; /// [Celsius]
|
||||
public static DoubleBox AmbPress = new DoubleBox() { Name = "Ambient Pressure", Format = "F0", Factor = 1000 }; /// [bar], printed by ToString() in [mbar]
|
||||
public static DoubleBox AmbHumi = new DoubleBox() { Name = "Ambient Humidity", Format = "F1" }; /// [%]
|
||||
public static DoubleBox TempUp = new DoubleBox() { Name = "Temperature Up", Format = "F2" }; /// [°C]
|
||||
public static DoubleBox TempDown = new DoubleBox() { Name = "Temperature Dn", Format = "F2" }; /// [°C]
|
||||
public static DoubleBox TempDiv = new DoubleBox() { Name = "Temperature Div", Format = "F2" }; /// [°C]
|
||||
public static FloatBox PressUp = new FloatBox() { Name = "Pressure Up", Format = "F2" }; /// [bar]
|
||||
public static FloatBox PressDown = new FloatBox() { Name = "Pressure Dn", Format = "F2" }; /// [bar]
|
||||
public static FloatBox PressDelta = new FloatBox() { Name = "Pressure Delta", Format = "F2" }; /// [bar]
|
||||
public static DoubleBox PressUp = new DoubleBox() { Name = "Pressure Up", Format = "F2" }; /// [bar]
|
||||
public static DoubleBox PressDown = new DoubleBox() { Name = "Pressure Dn", Format = "F2" }; /// [bar]
|
||||
public static DoubleBox PressDelta = new DoubleBox() { Name = "Pressure Delta", Format = "F2" }; /// [bar]
|
||||
public static FloatBox Conductivity = new FloatBox(750) { Name = "Conductivity", Format = "F0" }; /// [uS/cm], default is 750
|
||||
|
||||
public static double LtrPerRefPulse; /// to calculate the ref.volume
|
||||
@@ -235,6 +236,35 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
|
||||
|
||||
public static void UpdateMeasuredValuesAndSetpoints()
|
||||
{
|
||||
/// Collect measured values and alternative strings
|
||||
if (ProcessData.MeasuredValues == null || ProcessData.MeasuredValues.Length != ProcessData.ComponentsWithMeasuredVal.Count)
|
||||
{
|
||||
ProcessData.MeasuredValues = new double[ProcessData.ComponentsWithMeasuredVal.Count];
|
||||
}
|
||||
if (ProcessData.AltStrings == null || ProcessData.AltStrings.Length != ProcessData.ComponentsWithMeasuredVal.Count)
|
||||
{
|
||||
ProcessData.AltStrings = new string[ProcessData.ComponentsWithMeasuredVal.Count];
|
||||
}
|
||||
for (int i = 0; i < ProcessData.ComponentsWithMeasuredVal.Count; i++)
|
||||
{
|
||||
ProcessData.MeasuredValues[i] = ProcessData.ComponentsWithMeasuredVal[i].MeasuredVal;
|
||||
ProcessData.AltStrings[i] = ProcessData.ComponentsWithMeasuredVal[i].AltString;
|
||||
}
|
||||
|
||||
/// 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Statistics of 'continuous' variables (temperature, pressure, flow, etc.).
|
||||
/// All statistics are re-initialized in each test.
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace TBF.BenchControl.Sequences
|
||||
AmbTemp, /// ambient temperature in degree C
|
||||
AmbHumi, /// ambient humidity in R%
|
||||
AmbPress, /// ambient pressure in mbar (= 1 hPa)
|
||||
outPath.RegulValve.Position.ToString("F1")); /// regulation valve position in % (0=closed / 100=open)
|
||||
outPath.RegValve.Position.ToString("F1")); /// regulation valve position in % (0=closed / 100=open)
|
||||
}
|
||||
|
||||
public void LogProcessDataHeaderHeatMeters(ILog logger, string sectionName)
|
||||
@@ -168,7 +168,7 @@ namespace TBF.BenchControl.Sequences
|
||||
AmbTemp,
|
||||
AmbHumi,
|
||||
AmbPress,
|
||||
outPath.RegulValve.Position.ToString("F1"),
|
||||
outPath.RegValve.Position.ToString("F1"),
|
||||
TempRefHi1,
|
||||
TempRefHi2,
|
||||
TempRefLo1,
|
||||
@@ -819,7 +819,7 @@ namespace TBF.BenchControl.Sequences
|
||||
/// Set flow for the next test
|
||||
State.Create(string.Format("SequenceBase : AfterTestWithOverlap - Setting the flow to {0} - {1} m3/h", nextQfrom, nextQto))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(nextOutPath.RegulValve.SetFlowAndMeasureOp(nextOutPath.FlowMeter, nextQfrom, nextQto, RefFlow, FlowSettingTimeoutSec, 0))
|
||||
.AddOperation(nextOutPath.RegValve.SetFlowAndMeasureOp(nextOutPath.FlowMeter, nextQfrom, nextQto, RefFlow, FlowSettingTimeoutSec, 0))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -1074,7 +1074,7 @@ namespace TBF.BenchControl.Sequences
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
|
||||
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
|
||||
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
|
||||
.AddOperation(outPath.TempMtrDiv == null ? null : outPath.TempMtrDiv.ReadTempOp(ref TempDiv))
|
||||
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
|
||||
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
@@ -1565,7 +1565,7 @@ namespace TBF.BenchControl.Sequences
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
|
||||
@@ -1698,7 +1698,7 @@ namespace TBF.BenchControl.Sequences
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
}
|
||||
@@ -1832,7 +1832,7 @@ namespace TBF.BenchControl.Sequences
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
|
||||
@@ -1866,7 +1866,7 @@ namespace TBF.BenchControl.Sequences
|
||||
log.FatalFormat(" Output path: {0}", (outPath != null) ? outPath.ToString() : "none");
|
||||
if (inPath.Pump is IPump) log.FatalFormat(" Pump power: {0}%", (inPath.Pump as IPump).Power);
|
||||
else if (inPath.Pump is IValve) log.FatalFormat(" Feeding valve: {0}", (inPath.Pump as IValve).State ? "open" : "close");
|
||||
if (outPath.RegulValve is IRegulValve) log.FatalFormat(" Regulation valve position: {0}%", outPath.RegulValve.Position);
|
||||
if (outPath.RegValve is IRegulValve) log.FatalFormat(" Regulation valve position: {0}%", outPath.RegValve.Position);
|
||||
log.FatalFormat(" Flow: {0}", RefFlow);
|
||||
log.FatalFormat(" Mass: {0}", Mass);
|
||||
log.FatalFormat(" Start mass: {0}", StartMass);
|
||||
|
||||
@@ -15,14 +15,16 @@ namespace TBF.BenchControl
|
||||
{
|
||||
Factories = new List<IComponentFactory>();
|
||||
|
||||
Factories.Add(new Ambient.Comet.Factory());
|
||||
Factories.Add(new Ambient.Greco.Factory());
|
||||
Factories.Add(new ControlBoard.Papouch.CBoardFactory());
|
||||
Factories.Add(new ControlBoard.Uni.Factory());
|
||||
Factories.Add(new DataContainer.BackupAndSecurityOptions.Factory());
|
||||
Factories.Add(new DataContainer.BenchInfo.Factory());
|
||||
Factories.Add(new DataContainer.Buoyancy.Factory());
|
||||
Factories.Add(new DataContainer.Density.Factory());
|
||||
Factories.Add(new DataContainer.Evaporation.Factory());
|
||||
Factories.Add(new DataContainer.iPerlBenchInfo.Factory());
|
||||
Factories.Add(new ControlBoard.Papouch.CBoardFactory());
|
||||
Factories.Add(new ControlBoard.Uni.Factory());
|
||||
Factories.Add(new DataEntry.Combined.EntryFormFactory());
|
||||
Factories.Add(new DataEntry.HeatMeters6.Factory());
|
||||
Factories.Add(new DataEntry.HeatMeters12.Factory());
|
||||
@@ -107,8 +109,6 @@ namespace TBF.BenchControl
|
||||
Factories.Add(new TestMethods.SensitivityTest.Factory());
|
||||
Factories.Add(new TestMethods.iPerlCommunication.TestMethodFactory()); /// iPerlCommunication
|
||||
Factories.Add(new TestMethods.RoiDetection.RoiDetectionFactory());
|
||||
Factories.Add(new Ambient.Comet.Factory());
|
||||
Factories.Add(new Ambient.Greco.Factory());
|
||||
Factories.Add(new Hart.Common.Factory());
|
||||
Factories.Add(new Hart.Nivotrack.Factory());
|
||||
Factories.Add(new Keithley.Multimeter_2010_RS232.Factory()); /// Keithley.Multimeter_2010_RS232
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -145,7 +145,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -501,7 +501,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -139,7 +139,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -294,7 +294,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(outPath.RegulValve.SetFlowAndMeasureOp(outPath.FlowMeter, test.Qfrom, test.Qto, RefFlow, FlowSettingTimeoutSec, (float)test.ShortPulses))
|
||||
.AddOperation(outPath.RegValve.SetFlowAndMeasureOp(outPath.FlowMeter, test.Qfrom, test.Qto, RefFlow, FlowSettingTimeoutSec, (float)test.ShortPulses))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -351,7 +351,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(outPath.RegulValve.ChangeRegulValvePositionOp(rvPulse))
|
||||
.AddOperation(outPath.RegValve.ChangeRegulValvePositionOp(rvPulse))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -521,7 +521,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, qfrom_detected, qto_detected, RefFlow, FlowSettingTimeoutSec))
|
||||
.AddOperation(outPath.RegValve.SetFlowOp(outPath.FlowMeter, qfrom_detected, qto_detected, RefFlow, FlowSettingTimeoutSec))
|
||||
//.AddOp(pOut.RegulValve.SetPositionOp(35.0f, 38.0f, uint.MaxValue))
|
||||
.EnterState();
|
||||
do {
|
||||
@@ -831,7 +831,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -137,7 +137,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if(benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if(benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if(outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if(outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if(benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if(benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if(benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -888,7 +888,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -115,7 +115,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -497,7 +497,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -113,7 +113,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -1019,7 +1019,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -121,7 +121,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -676,7 +676,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -131,7 +131,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -864,7 +864,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
tstRslt.TestDone = false;
|
||||
}
|
||||
|
||||
+3
-3
@@ -52,7 +52,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -131,7 +131,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -1058,7 +1058,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
+3
-3
@@ -54,7 +54,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -155,7 +155,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -1016,7 +1016,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
tstRslt.TestDone = false;
|
||||
}
|
||||
|
||||
+3
-3
@@ -52,7 +52,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -131,7 +131,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -1220,7 +1220,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
+3
-3
@@ -52,7 +52,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -136,7 +136,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -878,7 +878,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.TestMethods.FlowAdjustment
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -355,7 +355,7 @@ namespace TBF.BenchControl.TestMethods.FlowAdjustment
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -720,7 +720,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
+3
-3
@@ -60,7 +60,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -152,7 +152,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -1088,7 +1088,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
+3
-3
@@ -60,7 +60,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -172,7 +172,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -1195,7 +1195,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
+3
-3
@@ -51,7 +51,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -149,7 +149,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -1141,7 +1141,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
+3
-3
@@ -60,7 +60,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -148,7 +148,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if(benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if(benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if(outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if(outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if(benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if(benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if(benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -1063,7 +1063,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
cBrd.Devices.Scale.Name,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
+3
-3
@@ -58,7 +58,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegulValve is GenericDevices.IRegulValve))
|
||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
@@ -155,7 +155,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -761,7 +761,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace TBF.BenchControl.TestMethods.LeakTest
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -463,7 +463,7 @@ namespace TBF.BenchControl.TestMethods.LeakTest
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update results
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace TBF.BenchControl.TestMethods.ManualEntry
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
|
||||
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
|
||||
if (outPath.TempMtrDiv != null) readTempPressOps.Add(outPath.TempMtrDiv.ReadTempOp(ref TempDiv));
|
||||
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
|
||||
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
@@ -291,7 +291,7 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update results
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user