Elde.FlowMeterDewa : (1) Exact LtrPerPulseCorrected calc. (2) nominal flow and flowmeters bitfield (=Idx0) calculated from particular flowmeters.

This commit is contained in:
Milan Hanajik
2019-05-12 08:17:52 +02:00
parent 7724c004a0
commit d51edbfbfe
14 changed files with 1439 additions and 25 deletions
@@ -0,0 +1,26 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.FlowMeterDewa
{
public class Factory : IComponentFactory
{
public string ClassName { get { return "FlowMeterDewa"; } }
public void ResetStaticProperties() { FlowMeter.ResetStaticProperties(); }
public IComponent DummyComponent() { return new FlowMeter(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new FlowMeter(cfg, components); }
public IComponentCfg DefaultConfig() { return new FlowMeterCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(FlowMeterCfg.Serializer, component, this);
}
}
}
@@ -0,0 +1,111 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using TBF.Boxes;
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.Elde.FlowMeterDewa
{
public class FlowMeter : ComponentBase, IFlowMeter
{
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
public override string ToString() { return string.Format("FlowMeter({0})", Cfg.ToString(1)); }
readonly FlowMeterCfg flowMeterCfg;
readonly ControlBoardDev controlBoard;
readonly IFlowMeter flowMeter1;
readonly IFlowMeter flowMeter2;
readonly IFlowMeter flowMeter3;
readonly double nominalFlow;
readonly double ltrPerPulse;
readonly int flowMetersCount;
readonly int flowMetersBitfield;
public int Idx1 { get { return flowMetersBitfield; } }
public double NominalFlow { get { return nominalFlow; } }
public double LtrPerPulse { get { return ltrPerPulse; } }
double[] refFreq;
public double LtrPerPulseCorrected(double flow, int rangeIx)
{
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
refFreq[0] = controlBoard.ReferenceFreqs(0);
refFreq[2] = controlBoard.ReferenceFreqs(2);
refFreq[3] = controlBoard.ReferenceFreqs(3);
refFreq[1] = refFreq[0] - refFreq[2] - refFreq[3];
double ltrPerPulseCorrected = 0;
if (flowMeter1 != null) ltrPerPulseCorrected += refFreq[1] * flowMeter1.LtrPerPulseCorrected(flow * refFreq[1] / refFreq[0], rangeIx);
if (flowMeter2 != null) ltrPerPulseCorrected += refFreq[2] * flowMeter2.LtrPerPulseCorrected(flow * refFreq[2] / refFreq[0], rangeIx);
if (flowMeter3 != null) ltrPerPulseCorrected += refFreq[3] * flowMeter3.LtrPerPulseCorrected(flow * refFreq[3] / refFreq[0], rangeIx);
return ltrPerPulseCorrected / refFreq[0];
}
public bool RangeEnabled(int ix) { return flowMeterCfg.RangeEnabled(ix); }
public double GetTempLo(int ix) { return flowMeterCfg.GetTempLo(ix); }
public double GetTempHi(int ix) { return flowMeterCfg.GetTempHi(ix); }
public double GetPressLo(int ix) { return flowMeterCfg.GetPressLo(ix); }
public double GetPressHi(int ix) { return flowMeterCfg.GetPressHi(ix); }
public FlowMeter()
{
}
public FlowMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
: base(cfg)
{
flowMeterCfg = cfg as FlowMeterCfg;
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
if (!string.IsNullOrEmpty(flowMeterCfg.Flowmeter1)) flowMeter1 = TbfComponents.FindComponent(flowMeterCfg.Flowmeter1, components) as IFlowMeter;
if (!string.IsNullOrEmpty(flowMeterCfg.Flowmeter2)) flowMeter2 = TbfComponents.FindComponent(flowMeterCfg.Flowmeter2, components) as IFlowMeter;
if (!string.IsNullOrEmpty(flowMeterCfg.Flowmeter3)) flowMeter3 = TbfComponents.FindComponent(flowMeterCfg.Flowmeter3, components) as IFlowMeter;
nominalFlow = 0;
flowMetersCount = 0;
flowMetersBitfield = 0;
if (flowMeter1 != null) { nominalFlow += flowMeter1.NominalFlow; flowMetersBitfield |= (8 << flowMeter1.Idx1); flowMetersCount++; }
if (flowMeter2 != null) { nominalFlow += flowMeter2.NominalFlow; flowMetersBitfield |= (8 << flowMeter2.Idx1); flowMetersCount++; }
if (flowMeter3 != null) { nominalFlow += flowMeter3.NominalFlow; flowMetersBitfield |= (8 << flowMeter3.Idx1); flowMetersCount++; }
if (flowMetersCount == 0) throw new Exception("Missing flowmeters");
ltrPerPulse = nominalFlow / (flowMetersCount * 7200.0); /// Nominal freq. is flowMetersCount * 2000 Hz (2000, 4000 or 6000 Hz)
refFreq = new double[4];
log.Debug(this.ToString());
}
public double ReadFlow() { return controlBoard.ReferenceFlow; }
public double ReadFrequency() { return controlBoard.ReferenceFreq; }
/// <summary>
/// Events: FlowDone, Error
/// </summary>
/// <param name="flow">Reference to a variable for the flow in Bar</param>
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
public IOperation ReadFlowOp(ref DoubleBox flow)
{
return new ReadFlowOp(this, controlBoard, ref flow);
}
/// <summary>
/// Events: flowDone, Error
/// </summary>
/// <param name="flow">Reference to a variable for the flow in Bar</param>
/// <param name="flowDone">Event returned when measurement done</param>
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
public IOperation ReadFlowOp(ref DoubleBox flow, Event flowDone)
{
return new ReadFlowOp(this, controlBoard, ref flow, flowDone);
}
}
}
@@ -0,0 +1,250 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.FlowMeterDewa
{
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibRangesCfg, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FlowMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new FlowMeterCfgCtrl(); }
///
/// Serialized parameters
///
public string Flowmeter1; /// Flowmeter component name or string.Empty
public string Flowmeter2; /// - ' ' -
public string Flowmeter3; /// - ' ' -
public double Temp1Lo; /// 4x zero means the range is disabled
public double Temp1Hi;
public double Press1Lo;
public double Press1Hi;
public double Temp2Lo; /// 4x zero means the range is disabled
public double Temp2Hi;
public double Press2Lo;
public double Press2Hi;
public double Temp3Lo; /// 4x zero means the range is disabled
public double Temp3Hi;
public double Press3Lo;
public double Press3Hi;
public double Temp4Lo; /// 4x zero means the range is disabled
public double Temp4Hi;
public double Press4Lo;
public double Press4Hi;
public double Temp5Lo; /// 4x zero means the range is disabled
public double Temp5Hi;
public double Press5Lo;
public double Press5Hi;
/// Calibration info serialized parameters displayed in Metrology tab page
public string CalibCertificateNr;
public string CalibCertificate1;
public string CalibCertificate2;
public string CalibCertificate3;
public string CalibCertificate4;
public string CalibCertificate5;
public DateTime CalibDate;
public DateTime CalibDate1;
public DateTime CalibDate2;
public DateTime CalibDate3;
public DateTime CalibDate4;
public DateTime CalibDate5;
public DateTime CalibValidDate;
public DateTime CalibValidDate1;
public DateTime CalibValidDate2;
public DateTime CalibValidDate3;
public DateTime CalibValidDate4;
public DateTime CalibValidDate5;
public bool RangeEnabled(int rangeIx1)
{
switch (rangeIx1)
{
default:
case 0: return !(RangeEnabled(1) || RangeEnabled(2) || RangeEnabled(3) || RangeEnabled(4) || RangeEnabled(5));
case 1: return (Temp1Lo != 0) || (Temp1Hi != 0) || (Press1Lo != 0) || (Press1Hi != 0);
case 2: return (Temp2Lo != 0) || (Temp2Hi != 0) || (Press2Lo != 0) || (Press2Hi != 0);
case 3: return (Temp3Lo != 0) || (Temp3Hi != 0) || (Press3Lo != 0) || (Press3Hi != 0);
case 4: return (Temp4Lo != 0) || (Temp4Hi != 0) || (Press4Lo != 0) || (Press4Hi != 0);
case 5: return (Temp5Lo != 0) || (Temp5Hi != 0) || (Press5Lo != 0) || (Press5Hi != 0);
}
}
public double GetTempLo(int rangeIx1)
{
switch (rangeIx1)
{
default:
case 0: return 5.0; /// °C
case 1: return Temp1Lo;
case 2: return Temp2Lo;
case 3: return Temp3Lo;
case 4: return Temp4Lo;
case 5: return Temp5Lo;
}
}
public double GetTempHi(int rangeIx1)
{
switch (rangeIx1)
{
default:
case 0: return 95.0; /// °C
case 1: return Temp1Hi;
case 2: return Temp2Hi;
case 3: return Temp3Hi;
case 4: return Temp4Hi;
case 5: return Temp5Hi;
}
}
public double GetPressLo(int rangeIx1)
{
switch (rangeIx1)
{
default:
case 0: return 0; /// bar
case 1: return Press1Lo;
case 2: return Press2Lo;
case 3: return Press3Lo;
case 4: return Press4Lo;
case 5: return Press5Lo;
}
}
public double GetPressHi(int rangeIx1)
{
switch (rangeIx1)
{
default:
case 0: return 16.0; /// bar
case 1: return Press1Hi;
case 2: return Press2Hi;
case 3: return Press3Hi;
case 4: return Press4Hi;
case 5: return Press5Hi;
}
}
public string GetCalibCertificate(int rangeIx1)
{
switch (rangeIx1)
{
default:
case 0: return CalibCertificateNr;
case 1: return CalibCertificate1;
case 2: return CalibCertificate2;
case 3: return CalibCertificate3;
case 4: return CalibCertificate4;
case 5: return CalibCertificate5;
}
}
public void SetCalibCertificate(int rangeIx1, string certificate)
{
switch (rangeIx1)
{
default:
case 0: CalibCertificateNr = certificate; return;
case 1: CalibCertificate1 = certificate; return;
case 2: CalibCertificate2 = certificate; return;
case 3: CalibCertificate3 = certificate; return;
case 4: CalibCertificate4 = certificate; return;
case 5: CalibCertificate5 = certificate; return;
}
}
public DateTime GetCalibDate(int rangeIx1)
{
switch (rangeIx1)
{
default:
case 0: return CalibDate;
case 1: return CalibDate1;
case 2: return CalibDate2;
case 3: return CalibDate3;
case 4: return CalibDate4;
case 5: return CalibDate5;
}
}
public void SetCalibDate(int rangeIx1, DateTime calibDate)
{
switch (rangeIx1)
{
default:
case 0: CalibDate = calibDate; return;
case 1: CalibDate1 = calibDate; return;
case 2: CalibDate2 = calibDate; return;
case 3: CalibDate3 = calibDate; return;
case 4: CalibDate4 = calibDate; return;
case 5: CalibDate5 = calibDate; return;
}
}
public DateTime GetCalibValidDate(int rangeIx1)
{
switch (rangeIx1)
{
default:
case 0: return CalibValidDate;
case 1: return CalibValidDate1;
case 2: return CalibValidDate2;
case 3: return CalibValidDate3;
case 4: return CalibValidDate4;
case 5: return CalibValidDate5;
}
}
public void SetCalibValidDate(int rangeIx1, DateTime calibValidDate)
{
switch (rangeIx1)
{
default:
case 0: CalibValidDate = calibValidDate; return;
case 1: CalibValidDate1 = calibValidDate; return;
case 2: CalibValidDate2 = calibValidDate; return;
case 3: CalibValidDate3 = calibValidDate; return;
case 4: CalibValidDate4 = calibValidDate; return;
case 5: CalibValidDate5 = calibValidDate; return;
}
}
/// Private parameterless constructor invoked by all other (public) constructors
FlowMeterCfg()
{
Name = "FlowMeterDewa";
ParentName = "CB";
}
public FlowMeterCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
return string.Format("Name={0}, Parent={1}, {2} {3} {4}",
Name,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
Flowmeter1,
Flowmeter2,
Flowmeter3);
}
}
}
@@ -0,0 +1,530 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.Elde.FlowMeterDewa
{
partial class FlowMeterCfgCtrl
{
/// <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.classNameLabel = new System.Windows.Forms.Label();
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
this.tempLo1TextBox = new System.Windows.Forms.TextBox();
this.tempHi1TextBox = new System.Windows.Forms.TextBox();
this.pressLo1TextBox = new System.Windows.Forms.TextBox();
this.pressHi1TextBox = new System.Windows.Forms.TextBox();
this.pressHi2TextBox = new System.Windows.Forms.TextBox();
this.pressLo2TextBox = new System.Windows.Forms.TextBox();
this.tempHi2TextBox = new System.Windows.Forms.TextBox();
this.tempLo2TextBox = new System.Windows.Forms.TextBox();
this.pressHi3TextBox = new System.Windows.Forms.TextBox();
this.pressLo3TextBox = new System.Windows.Forms.TextBox();
this.tempHi3TextBox = new System.Windows.Forms.TextBox();
this.tempLo3TextBox = new System.Windows.Forms.TextBox();
this.pressHi4TextBox = new System.Windows.Forms.TextBox();
this.pressLo4TextBox = new System.Windows.Forms.TextBox();
this.tempHi4TextBox = new System.Windows.Forms.TextBox();
this.tempLo4TextBox = new System.Windows.Forms.TextBox();
this.pressHi5TextBox = new System.Windows.Forms.TextBox();
this.pressLo5TextBox = new System.Windows.Forms.TextBox();
this.tempHi5TextBox = new System.Windows.Forms.TextBox();
this.tempLo5TextBox = new System.Windows.Forms.TextBox();
this.rangeCheckBox1 = new System.Windows.Forms.CheckBox();
this.rangeCheckBox2 = new System.Windows.Forms.CheckBox();
this.rangeCheckBox3 = new System.Windows.Forms.CheckBox();
this.rangeCheckBox4 = new System.Windows.Forms.CheckBox();
this.rangeCheckBox5 = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.flowmeterComboBox1 = new System.Windows.Forms.ComboBox();
this.flowmeterLabel1 = new System.Windows.Forms.Label();
this.flowmeterComboBox2 = new System.Windows.Forms.ComboBox();
this.fowmeterLabel2 = new System.Windows.Forms.Label();
this.flowmeterComboBox3 = new System.Windows.Forms.ComboBox();
this.flowmeterLabel3 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// parentNameLabel
//
this.parentNameLabel.AutoSize = true;
this.parentNameLabel.Location = new System.Drawing.Point(30, 75);
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(140, 47);
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, 50);
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, 19);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// parentNameComboBox
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(140, 72);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
this.parentNameComboBox.TabIndex = 4;
//
// tempLo1TextBox
//
this.tempLo1TextBox.Enabled = false;
this.tempLo1TextBox.Location = new System.Drawing.Point(140, 217);
this.tempLo1TextBox.Name = "tempLo1TextBox";
this.tempLo1TextBox.Size = new System.Drawing.Size(68, 20);
this.tempLo1TextBox.TabIndex = 10;
//
// tempHi1TextBox
//
this.tempHi1TextBox.Enabled = false;
this.tempHi1TextBox.Location = new System.Drawing.Point(220, 217);
this.tempHi1TextBox.Name = "tempHi1TextBox";
this.tempHi1TextBox.Size = new System.Drawing.Size(68, 20);
this.tempHi1TextBox.TabIndex = 11;
//
// pressLo1TextBox
//
this.pressLo1TextBox.Enabled = false;
this.pressLo1TextBox.Location = new System.Drawing.Point(300, 217);
this.pressLo1TextBox.Name = "pressLo1TextBox";
this.pressLo1TextBox.Size = new System.Drawing.Size(68, 20);
this.pressLo1TextBox.TabIndex = 12;
//
// pressHi1TextBox
//
this.pressHi1TextBox.Enabled = false;
this.pressHi1TextBox.Location = new System.Drawing.Point(380, 217);
this.pressHi1TextBox.Name = "pressHi1TextBox";
this.pressHi1TextBox.Size = new System.Drawing.Size(68, 20);
this.pressHi1TextBox.TabIndex = 13;
//
// pressHi2TextBox
//
this.pressHi2TextBox.Enabled = false;
this.pressHi2TextBox.Location = new System.Drawing.Point(380, 240);
this.pressHi2TextBox.Name = "pressHi2TextBox";
this.pressHi2TextBox.Size = new System.Drawing.Size(68, 20);
this.pressHi2TextBox.TabIndex = 18;
//
// pressLo2TextBox
//
this.pressLo2TextBox.Enabled = false;
this.pressLo2TextBox.Location = new System.Drawing.Point(300, 240);
this.pressLo2TextBox.Name = "pressLo2TextBox";
this.pressLo2TextBox.Size = new System.Drawing.Size(68, 20);
this.pressLo2TextBox.TabIndex = 17;
//
// tempHi2TextBox
//
this.tempHi2TextBox.Enabled = false;
this.tempHi2TextBox.Location = new System.Drawing.Point(220, 240);
this.tempHi2TextBox.Name = "tempHi2TextBox";
this.tempHi2TextBox.Size = new System.Drawing.Size(68, 20);
this.tempHi2TextBox.TabIndex = 16;
//
// tempLo2TextBox
//
this.tempLo2TextBox.Enabled = false;
this.tempLo2TextBox.Location = new System.Drawing.Point(140, 240);
this.tempLo2TextBox.Name = "tempLo2TextBox";
this.tempLo2TextBox.Size = new System.Drawing.Size(68, 20);
this.tempLo2TextBox.TabIndex = 15;
//
// pressHi3TextBox
//
this.pressHi3TextBox.Enabled = false;
this.pressHi3TextBox.Location = new System.Drawing.Point(380, 263);
this.pressHi3TextBox.Name = "pressHi3TextBox";
this.pressHi3TextBox.Size = new System.Drawing.Size(68, 20);
this.pressHi3TextBox.TabIndex = 23;
//
// pressLo3TextBox
//
this.pressLo3TextBox.Enabled = false;
this.pressLo3TextBox.Location = new System.Drawing.Point(300, 263);
this.pressLo3TextBox.Name = "pressLo3TextBox";
this.pressLo3TextBox.Size = new System.Drawing.Size(68, 20);
this.pressLo3TextBox.TabIndex = 22;
//
// tempHi3TextBox
//
this.tempHi3TextBox.Enabled = false;
this.tempHi3TextBox.Location = new System.Drawing.Point(220, 263);
this.tempHi3TextBox.Name = "tempHi3TextBox";
this.tempHi3TextBox.Size = new System.Drawing.Size(68, 20);
this.tempHi3TextBox.TabIndex = 21;
//
// tempLo3TextBox
//
this.tempLo3TextBox.Enabled = false;
this.tempLo3TextBox.Location = new System.Drawing.Point(140, 263);
this.tempLo3TextBox.Name = "tempLo3TextBox";
this.tempLo3TextBox.Size = new System.Drawing.Size(68, 20);
this.tempLo3TextBox.TabIndex = 20;
//
// pressHi4TextBox
//
this.pressHi4TextBox.Enabled = false;
this.pressHi4TextBox.Location = new System.Drawing.Point(380, 286);
this.pressHi4TextBox.Name = "pressHi4TextBox";
this.pressHi4TextBox.Size = new System.Drawing.Size(68, 20);
this.pressHi4TextBox.TabIndex = 28;
//
// pressLo4TextBox
//
this.pressLo4TextBox.Enabled = false;
this.pressLo4TextBox.Location = new System.Drawing.Point(300, 286);
this.pressLo4TextBox.Name = "pressLo4TextBox";
this.pressLo4TextBox.Size = new System.Drawing.Size(68, 20);
this.pressLo4TextBox.TabIndex = 27;
//
// tempHi4TextBox
//
this.tempHi4TextBox.Enabled = false;
this.tempHi4TextBox.Location = new System.Drawing.Point(220, 286);
this.tempHi4TextBox.Name = "tempHi4TextBox";
this.tempHi4TextBox.Size = new System.Drawing.Size(68, 20);
this.tempHi4TextBox.TabIndex = 26;
//
// tempLo4TextBox
//
this.tempLo4TextBox.Enabled = false;
this.tempLo4TextBox.Location = new System.Drawing.Point(140, 286);
this.tempLo4TextBox.Name = "tempLo4TextBox";
this.tempLo4TextBox.Size = new System.Drawing.Size(68, 20);
this.tempLo4TextBox.TabIndex = 25;
//
// pressHi5TextBox
//
this.pressHi5TextBox.Enabled = false;
this.pressHi5TextBox.Location = new System.Drawing.Point(380, 309);
this.pressHi5TextBox.Name = "pressHi5TextBox";
this.pressHi5TextBox.Size = new System.Drawing.Size(68, 20);
this.pressHi5TextBox.TabIndex = 33;
//
// pressLo5TextBox
//
this.pressLo5TextBox.Enabled = false;
this.pressLo5TextBox.Location = new System.Drawing.Point(300, 309);
this.pressLo5TextBox.Name = "pressLo5TextBox";
this.pressLo5TextBox.Size = new System.Drawing.Size(68, 20);
this.pressLo5TextBox.TabIndex = 32;
//
// tempHi5TextBox
//
this.tempHi5TextBox.Enabled = false;
this.tempHi5TextBox.Location = new System.Drawing.Point(220, 309);
this.tempHi5TextBox.Name = "tempHi5TextBox";
this.tempHi5TextBox.Size = new System.Drawing.Size(68, 20);
this.tempHi5TextBox.TabIndex = 31;
//
// tempLo5TextBox
//
this.tempLo5TextBox.Enabled = false;
this.tempLo5TextBox.Location = new System.Drawing.Point(140, 309);
this.tempLo5TextBox.Name = "tempLo5TextBox";
this.tempLo5TextBox.Size = new System.Drawing.Size(68, 20);
this.tempLo5TextBox.TabIndex = 30;
//
// rangeCheckBox1
//
this.rangeCheckBox1.AutoSize = true;
this.rangeCheckBox1.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.rangeCheckBox1.Enabled = false;
this.rangeCheckBox1.Location = new System.Drawing.Point(32, 219);
this.rangeCheckBox1.Name = "rangeCheckBox1";
this.rangeCheckBox1.Size = new System.Drawing.Size(67, 17);
this.rangeCheckBox1.TabIndex = 34;
this.rangeCheckBox1.Text = "Range 1";
this.rangeCheckBox1.UseVisualStyleBackColor = true;
this.rangeCheckBox1.CheckedChanged += new System.EventHandler(this.rangeCheckBox1_CheckedChanged);
//
// rangeCheckBox2
//
this.rangeCheckBox2.AutoSize = true;
this.rangeCheckBox2.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.rangeCheckBox2.Enabled = false;
this.rangeCheckBox2.Location = new System.Drawing.Point(32, 242);
this.rangeCheckBox2.Name = "rangeCheckBox2";
this.rangeCheckBox2.Size = new System.Drawing.Size(67, 17);
this.rangeCheckBox2.TabIndex = 35;
this.rangeCheckBox2.Text = "Range 2";
this.rangeCheckBox2.UseVisualStyleBackColor = true;
this.rangeCheckBox2.CheckedChanged += new System.EventHandler(this.rangeCheckBox2_CheckedChanged);
//
// rangeCheckBox3
//
this.rangeCheckBox3.AutoSize = true;
this.rangeCheckBox3.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.rangeCheckBox3.Enabled = false;
this.rangeCheckBox3.Location = new System.Drawing.Point(32, 265);
this.rangeCheckBox3.Name = "rangeCheckBox3";
this.rangeCheckBox3.Size = new System.Drawing.Size(67, 17);
this.rangeCheckBox3.TabIndex = 36;
this.rangeCheckBox3.Text = "Range 3";
this.rangeCheckBox3.UseVisualStyleBackColor = true;
this.rangeCheckBox3.CheckedChanged += new System.EventHandler(this.rangeCheckBox3_CheckedChanged);
//
// rangeCheckBox4
//
this.rangeCheckBox4.AutoSize = true;
this.rangeCheckBox4.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.rangeCheckBox4.Enabled = false;
this.rangeCheckBox4.Location = new System.Drawing.Point(32, 288);
this.rangeCheckBox4.Name = "rangeCheckBox4";
this.rangeCheckBox4.Size = new System.Drawing.Size(67, 17);
this.rangeCheckBox4.TabIndex = 37;
this.rangeCheckBox4.Text = "Range 4";
this.rangeCheckBox4.UseVisualStyleBackColor = true;
this.rangeCheckBox4.CheckedChanged += new System.EventHandler(this.rangeCheckBox4_CheckedChanged);
//
// rangeCheckBox5
//
this.rangeCheckBox5.AutoSize = true;
this.rangeCheckBox5.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
this.rangeCheckBox5.Enabled = false;
this.rangeCheckBox5.Location = new System.Drawing.Point(32, 311);
this.rangeCheckBox5.Name = "rangeCheckBox5";
this.rangeCheckBox5.Size = new System.Drawing.Size(67, 17);
this.rangeCheckBox5.TabIndex = 38;
this.rangeCheckBox5.Text = "Range 5";
this.rangeCheckBox5.UseVisualStyleBackColor = true;
this.rangeCheckBox5.CheckedChanged += new System.EventHandler(this.rangeCheckBox5_CheckedChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(149, 198);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(52, 13);
this.label1.TabIndex = 39;
this.label1.Text = "Temp. Lo";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(229, 198);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(50, 13);
this.label2.TabIndex = 40;
this.label2.Text = "Temp. Hi";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(309, 198);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(51, 13);
this.label3.TabIndex = 41;
this.label3.Text = "Press. Lo";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(389, 198);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(49, 13);
this.label4.TabIndex = 42;
this.label4.Text = "Press. Hi";
//
// flowmeterComboBox1
//
this.flowmeterComboBox1.Enabled = false;
this.flowmeterComboBox1.FormattingEnabled = true;
this.flowmeterComboBox1.Location = new System.Drawing.Point(140, 110);
this.flowmeterComboBox1.Name = "flowmeterComboBox1";
this.flowmeterComboBox1.Size = new System.Drawing.Size(130, 21);
this.flowmeterComboBox1.TabIndex = 44;
//
// flowmeterLabel1
//
this.flowmeterLabel1.AutoSize = true;
this.flowmeterLabel1.Location = new System.Drawing.Point(30, 113);
this.flowmeterLabel1.Name = "flowmeterLabel1";
this.flowmeterLabel1.Size = new System.Drawing.Size(64, 13);
this.flowmeterLabel1.TabIndex = 43;
this.flowmeterLabel1.Text = "Flowmeter 1";
//
// flowmeterComboBox2
//
this.flowmeterComboBox2.Enabled = false;
this.flowmeterComboBox2.FormattingEnabled = true;
this.flowmeterComboBox2.Location = new System.Drawing.Point(140, 135);
this.flowmeterComboBox2.Name = "flowmeterComboBox2";
this.flowmeterComboBox2.Size = new System.Drawing.Size(130, 21);
this.flowmeterComboBox2.TabIndex = 46;
//
// fowmeterLabel2
//
this.fowmeterLabel2.AutoSize = true;
this.fowmeterLabel2.Location = new System.Drawing.Point(30, 138);
this.fowmeterLabel2.Name = "fowmeterLabel2";
this.fowmeterLabel2.Size = new System.Drawing.Size(64, 13);
this.fowmeterLabel2.TabIndex = 45;
this.fowmeterLabel2.Text = "Flowmeter 2";
//
// flowmeterComboBox3
//
this.flowmeterComboBox3.Enabled = false;
this.flowmeterComboBox3.FormattingEnabled = true;
this.flowmeterComboBox3.Location = new System.Drawing.Point(140, 160);
this.flowmeterComboBox3.Name = "flowmeterComboBox3";
this.flowmeterComboBox3.Size = new System.Drawing.Size(130, 21);
this.flowmeterComboBox3.TabIndex = 48;
//
// flowmeterLabel3
//
this.flowmeterLabel3.AutoSize = true;
this.flowmeterLabel3.Location = new System.Drawing.Point(30, 163);
this.flowmeterLabel3.Name = "flowmeterLabel3";
this.flowmeterLabel3.Size = new System.Drawing.Size(64, 13);
this.flowmeterLabel3.TabIndex = 47;
this.flowmeterLabel3.Text = "Flowmeter 3";
//
// FlowMeterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.flowmeterComboBox3);
this.Controls.Add(this.flowmeterLabel3);
this.Controls.Add(this.flowmeterComboBox2);
this.Controls.Add(this.fowmeterLabel2);
this.Controls.Add(this.flowmeterComboBox1);
this.Controls.Add(this.flowmeterLabel1);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.rangeCheckBox5);
this.Controls.Add(this.rangeCheckBox4);
this.Controls.Add(this.rangeCheckBox3);
this.Controls.Add(this.rangeCheckBox2);
this.Controls.Add(this.rangeCheckBox1);
this.Controls.Add(this.pressHi5TextBox);
this.Controls.Add(this.pressLo5TextBox);
this.Controls.Add(this.tempHi5TextBox);
this.Controls.Add(this.tempLo5TextBox);
this.Controls.Add(this.pressHi4TextBox);
this.Controls.Add(this.pressLo4TextBox);
this.Controls.Add(this.tempHi4TextBox);
this.Controls.Add(this.tempLo4TextBox);
this.Controls.Add(this.pressHi3TextBox);
this.Controls.Add(this.pressLo3TextBox);
this.Controls.Add(this.tempHi3TextBox);
this.Controls.Add(this.tempLo3TextBox);
this.Controls.Add(this.pressHi2TextBox);
this.Controls.Add(this.pressLo2TextBox);
this.Controls.Add(this.tempHi2TextBox);
this.Controls.Add(this.tempLo2TextBox);
this.Controls.Add(this.pressHi1TextBox);
this.Controls.Add(this.pressLo1TextBox);
this.Controls.Add(this.tempHi1TextBox);
this.Controls.Add(this.tempLo1TextBox);
this.Controls.Add(this.parentNameComboBox);
this.Controls.Add(this.parentNameLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "FlowMeterCfgCtrl";
this.Size = new System.Drawing.Size(492, 350);
this.Load += new System.EventHandler(this.FlowMeterCfgCtrl_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 classNameLabel;
private System.Windows.Forms.ComboBox parentNameComboBox;
private System.Windows.Forms.TextBox tempLo1TextBox;
private System.Windows.Forms.TextBox tempHi1TextBox;
private System.Windows.Forms.TextBox pressLo1TextBox;
private System.Windows.Forms.TextBox pressHi1TextBox;
private System.Windows.Forms.TextBox pressHi2TextBox;
private System.Windows.Forms.TextBox pressLo2TextBox;
private System.Windows.Forms.TextBox tempHi2TextBox;
private System.Windows.Forms.TextBox tempLo2TextBox;
private System.Windows.Forms.TextBox pressHi3TextBox;
private System.Windows.Forms.TextBox pressLo3TextBox;
private System.Windows.Forms.TextBox tempHi3TextBox;
private System.Windows.Forms.TextBox tempLo3TextBox;
private System.Windows.Forms.TextBox pressHi4TextBox;
private System.Windows.Forms.TextBox pressLo4TextBox;
private System.Windows.Forms.TextBox tempHi4TextBox;
private System.Windows.Forms.TextBox tempLo4TextBox;
private System.Windows.Forms.TextBox pressHi5TextBox;
private System.Windows.Forms.TextBox pressLo5TextBox;
private System.Windows.Forms.TextBox tempHi5TextBox;
private System.Windows.Forms.TextBox tempLo5TextBox;
private System.Windows.Forms.CheckBox rangeCheckBox1;
private System.Windows.Forms.CheckBox rangeCheckBox2;
private System.Windows.Forms.CheckBox rangeCheckBox3;
private System.Windows.Forms.CheckBox rangeCheckBox4;
private System.Windows.Forms.CheckBox rangeCheckBox5;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox flowmeterComboBox1;
private System.Windows.Forms.Label flowmeterLabel1;
private System.Windows.Forms.ComboBox flowmeterComboBox2;
private System.Windows.Forms.Label fowmeterLabel2;
private System.Windows.Forms.ComboBox flowmeterComboBox3;
private System.Windows.Forms.Label flowmeterLabel3;
}
}
@@ -0,0 +1,373 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Configs;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.FlowMeterDewa
{
public partial class FlowMeterCfgCtrl : ConfigCtrlUtils, IComponentCfgCtrl
{
ComponentParametersDlg parent;
public bool ShowMore { get { return false; } }
FlowMeterCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as FlowMeterCfg;
Redraw();
}
}
public FlowMeterCfgCtrl()
{
InitializeComponent();
}
private void FlowMeterCfgCtrl_Load(object sender, EventArgs e)
{
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
flowmeterComboBox1.Items.Add("---");
flowmeterComboBox2.Items.Add("---");
flowmeterComboBox3.Items.Add("---");
if (parent.TbfComponents != null)
{
foreach (var cmpnt in parent.TbfComponents)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{
parentNameComboBox.Items.Add(cmpnt.Name);
}
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.FlowMeter.FlowMeterFactory)
{
flowmeterComboBox1.Items.Add(cmpnt.Name);
flowmeterComboBox2.Items.Add(cmpnt.Name);
flowmeterComboBox3.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;
flowmeterComboBox1.Text = string.IsNullOrEmpty(config.Flowmeter1) ? "---" : config.Flowmeter1;
flowmeterComboBox2.Text = string.IsNullOrEmpty(config.Flowmeter2) ? "---" : config.Flowmeter2;
flowmeterComboBox3.Text = string.IsNullOrEmpty(config.Flowmeter3) ? "---" : config.Flowmeter3;
rangeCheckBox1.Checked = config.RangeEnabled(1);
tempLo1TextBox.Text = config.Temp1Lo.ToString();
tempHi1TextBox.Text = config.Temp1Hi.ToString();
pressLo1TextBox.Text = config.Press1Lo.ToString();
pressHi1TextBox.Text = config.Press1Hi.ToString();
rangeCheckBox2.Checked = config.RangeEnabled(2);
tempLo2TextBox.Text = config.Temp2Lo.ToString();
tempHi2TextBox.Text = config.Temp2Hi.ToString();
pressLo2TextBox.Text = config.Press2Lo.ToString();
pressHi2TextBox.Text = config.Press2Hi.ToString();
rangeCheckBox3.Checked = config.RangeEnabled(3);
tempLo3TextBox.Text = config.Temp3Lo.ToString();
tempHi3TextBox.Text = config.Temp3Hi.ToString();
pressLo3TextBox.Text = config.Press3Lo.ToString();
pressHi3TextBox.Text = config.Press3Hi.ToString();
rangeCheckBox4.Checked = config.RangeEnabled(4);
tempLo4TextBox.Text = config.Temp4Lo.ToString();
tempHi4TextBox.Text = config.Temp4Hi.ToString();
pressLo4TextBox.Text = config.Press4Lo.ToString();
pressHi4TextBox.Text = config.Press4Hi.ToString();
rangeCheckBox5.Checked = config.RangeEnabled(5);
tempLo5TextBox.Text = config.Temp5Lo.ToString();
tempHi5TextBox.Text = config.Temp5Hi.ToString();
pressLo5TextBox.Text = config.Press5Lo.ToString();
pressHi5TextBox.Text = config.Press5Hi.ToString();
}
public void Unlock()
{
nameTextBox.Enabled = true;
parentNameComboBox.Enabled = true;
flowmeterComboBox1.Enabled = true;
flowmeterComboBox2.Enabled = true;
flowmeterComboBox3.Enabled = true;
rangeCheckBox1.Enabled = true;
tempLo1TextBox.Enabled = rangeCheckBox1.Checked;
tempHi1TextBox.Enabled = rangeCheckBox1.Checked;
pressLo1TextBox.Enabled = rangeCheckBox1.Checked;
pressHi1TextBox.Enabled = rangeCheckBox1.Checked;
rangeCheckBox2.Enabled = true;
tempLo2TextBox.Enabled = rangeCheckBox2.Checked;
tempHi2TextBox.Enabled = rangeCheckBox2.Checked;
pressLo2TextBox.Enabled = rangeCheckBox2.Checked;
pressHi2TextBox.Enabled = rangeCheckBox2.Checked;
rangeCheckBox3.Enabled = true;
tempLo3TextBox.Enabled = rangeCheckBox3.Checked;
tempHi3TextBox.Enabled = rangeCheckBox3.Checked;
pressLo3TextBox.Enabled = rangeCheckBox3.Checked;
pressHi3TextBox.Enabled = rangeCheckBox3.Checked;
rangeCheckBox4.Enabled = true;
tempLo4TextBox.Enabled = rangeCheckBox4.Checked;
tempHi4TextBox.Enabled = rangeCheckBox4.Checked;
pressLo4TextBox.Enabled = rangeCheckBox4.Checked;
pressHi4TextBox.Enabled = rangeCheckBox4.Checked;
rangeCheckBox5.Enabled = true;
tempLo5TextBox.Enabled = rangeCheckBox5.Checked;
tempHi5TextBox.Enabled = rangeCheckBox5.Checked;
pressLo5TextBox.Enabled = rangeCheckBox5.Checked;
pressHi5TextBox.Enabled = rangeCheckBox5.Checked;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Parent Name'";
}
if (!flowmeterComboBox1.Items.Contains(flowmeterComboBox1.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Flowmeter 1'";
}
if (!flowmeterComboBox2.Items.Contains(flowmeterComboBox2.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Flowmeter 2'";
}
if (!flowmeterComboBox3.Items.Contains(flowmeterComboBox3.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Flowmeter 3'";
}
double ddummy;
if (rangeCheckBox1.Checked)
{
if (!Utils.TryParseUDouble(tempLo1TextBox.Text, out ddummy) || !Utils.TryParseUDouble(tempHi1TextBox.Text, out ddummy) ||
!Utils.TryParseUDouble(pressLo1TextBox.Text, out ddummy) || !Utils.TryParseUDouble(pressHi1TextBox.Text, out ddummy))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Ivalid 'Range 1'";
}
}
if (rangeCheckBox2.Checked)
{
if (!Utils.TryParseUDouble(tempLo2TextBox.Text, out ddummy) || !Utils.TryParseUDouble(tempHi2TextBox.Text, out ddummy) ||
!Utils.TryParseUDouble(pressLo2TextBox.Text, out ddummy) || !Utils.TryParseUDouble(pressHi2TextBox.Text, out ddummy))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Ivalid 'Range 2'";
}
}
if (rangeCheckBox3.Checked)
{
if (!Utils.TryParseUDouble(tempLo3TextBox.Text, out ddummy) || !Utils.TryParseUDouble(tempHi3TextBox.Text, out ddummy) ||
!Utils.TryParseUDouble(pressLo3TextBox.Text, out ddummy) || !Utils.TryParseUDouble(pressHi3TextBox.Text, out ddummy))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Ivalid 'Range 3'";
}
}
if (rangeCheckBox4.Checked)
{
if (!Utils.TryParseUDouble(tempLo4TextBox.Text, out ddummy) || !Utils.TryParseUDouble(tempHi4TextBox.Text, out ddummy) ||
!Utils.TryParseUDouble(pressLo4TextBox.Text, out ddummy) || !Utils.TryParseUDouble(pressHi4TextBox.Text, out ddummy))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Ivalid 'Range 4'";
}
}
if (rangeCheckBox5.Checked)
{
if (!Utils.TryParseUDouble(tempLo5TextBox.Text, out ddummy) || !Utils.TryParseUDouble(tempHi5TextBox.Text, out ddummy) ||
!Utils.TryParseUDouble(pressLo5TextBox.Text, out ddummy) || !Utils.TryParseUDouble(pressHi5TextBox.Text, out ddummy))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Ivalid 'Range 5'";
}
}
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
if (config.Name != nameTextBox.Text)
{
config.Name = nameTextBox.Text;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
string parentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
if (config.ParentName != parentName)
{
config.ParentName = parentName;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
string flowmeter1Name = flowmeterComboBox1.Text.Equals("---") ? string.Empty : flowmeterComboBox1.Text;
if (config.Flowmeter1 != flowmeter1Name)
{
config.Flowmeter1 = flowmeter1Name;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
string flowmeter2Name = flowmeterComboBox2.Text.Equals("---") ? string.Empty : flowmeterComboBox2.Text;
if (config.Flowmeter2 != flowmeter2Name)
{
config.Flowmeter2 = flowmeter2Name;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
string flowmeter3Name = flowmeterComboBox3.Text.Equals("---") ? string.Empty : flowmeterComboBox3.Text;
if (config.Flowmeter3 != flowmeter3Name)
{
config.Flowmeter3 = flowmeter3Name;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (rangeCheckBox1.Checked)
{
flags |= UpdateDifferent(ref config.Temp1Lo, tempLo1TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp1Hi, tempHi1TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press1Lo, pressLo1TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press1Hi, pressHi1TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
else
{
flags |= UpdateDifferent(ref config.Temp1Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp1Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press1Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press1Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (rangeCheckBox2.Checked)
{
flags |= UpdateDifferent(ref config.Temp2Lo, tempLo2TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp2Hi, tempHi2TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press2Lo, pressLo2TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press2Hi, pressHi2TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
else
{
flags |= UpdateDifferent(ref config.Temp2Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp2Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press2Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press2Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (rangeCheckBox3.Checked)
{
flags |= UpdateDifferent(ref config.Temp3Lo, tempLo3TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp3Hi, tempHi3TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press3Lo, pressLo3TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press3Hi, pressHi3TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
else
{
flags |= UpdateDifferent(ref config.Temp3Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp3Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press3Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press3Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (rangeCheckBox4.Checked)
{
flags |= UpdateDifferent(ref config.Temp4Lo, tempLo4TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp4Hi, tempHi4TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press4Lo, pressLo4TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press4Hi, pressHi4TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
else
{
flags |= UpdateDifferent(ref config.Temp4Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp4Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press4Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press4Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (rangeCheckBox5.Checked)
{
flags |= UpdateDifferent(ref config.Temp5Lo, tempLo5TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp5Hi, tempHi5TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press5Lo, pressLo5TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press5Hi, pressHi5TextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
else
{
flags |= UpdateDifferent(ref config.Temp5Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Temp5Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press5Lo, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Press5Hi, "0", CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
return flags;
}
private void rangeCheckBox1_CheckedChanged(object sender, EventArgs e)
{
tempLo1TextBox.Enabled = tempHi1TextBox.Enabled = pressLo1TextBox.Enabled = pressHi1TextBox.Enabled =
(rangeCheckBox1.Enabled && rangeCheckBox1.Checked);
}
private void rangeCheckBox2_CheckedChanged(object sender, EventArgs e)
{
tempLo2TextBox.Enabled = tempHi2TextBox.Enabled = pressLo2TextBox.Enabled = pressHi2TextBox.Enabled =
(rangeCheckBox2.Enabled && rangeCheckBox2.Checked);
}
private void rangeCheckBox3_CheckedChanged(object sender, EventArgs e)
{
tempLo3TextBox.Enabled = tempHi3TextBox.Enabled = pressLo3TextBox.Enabled = pressHi3TextBox.Enabled =
(rangeCheckBox3.Enabled && rangeCheckBox3.Checked);
}
private void rangeCheckBox4_CheckedChanged(object sender, EventArgs e)
{
tempLo4TextBox.Enabled = tempHi4TextBox.Enabled = pressLo4TextBox.Enabled = pressHi4TextBox.Enabled =
(rangeCheckBox4.Enabled && rangeCheckBox4.Checked);
}
private void rangeCheckBox5_CheckedChanged(object sender, EventArgs e)
{
tempLo5TextBox.Enabled = tempHi5TextBox.Enabled = pressLo5TextBox.Enabled = pressHi5TextBox.Enabled =
(rangeCheckBox5.Enabled && rangeCheckBox5.Checked);
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>