Uni.RegValve function simplified, IFlowMeter includes functions from IIDrawingItCmpntWithMeasuredVal, ver. 3.1.1627

This commit is contained in:
Milan Hanajik
2021-03-11 14:55:21 +01:00
parent 21183ca801
commit 768fb69653
47 changed files with 180 additions and 1746 deletions
-148
View File
@@ -1,148 +0,0 @@
///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using TBF.Rig.ControlBoard.Legacy;
using TBF.Boxes;
using TBF.Resources;
namespace TBF.Rig.Elde.FlowMeter
{
public class FlowMeter : ComponentBase, Generic.IDevice, GenericDevices.IFlowMeter, GenericDevices.IHasCalendarEvents, SchematicDrawing.IDrawingItCmpnt
{
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
public override string ToString() { return string.Format("FlowMeter({0})", Cfg.ToString(1)); }
readonly FlowMeterCfg flowMeterCfg;
public SchematicDrawing.IDrawingItem DrawingItem { get { return flowMeterCfg as SchematicDrawing.IDrawingItem; } }
readonly CBoard controlBoard;
public int Idx1 { get { return flowMeterCfg.Idx1; } }
public double NominalFlow { get { return flowMeterCfg.NominalFlow; } }
public double LtrPerPulse { get { return flowMeterCfg.NominalFlow / 7200.0; } } /// Nominal frequency is 2000 Hz
public double LtrPerPulseCorrected(double flow, int rangeIx)
{
/// Apply correction
var rangeCorrections = new List<Config.Entities.MeasurementCorrection>();
foreach (var corr in Corrections)
{
if (corr.RangeIx == rangeIx) rangeCorrections.Add(corr);
}
double correctedFlow = Config.Formulas.CorrectedValue(flow, rangeCorrections);
return (LtrPerPulse * correctedFlow / flow);
}
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 = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
/// Prepare data for SendCalibData() control board component method
if (Idx1 < controlBoard.EtCalib.Length)
{
controlBoard.EtCalib[Idx1] = (float)flowMeterCfg.NominalFlow;
}
log.Warn(this.ToString());
}
///
/// IDevice interface functions
///
public void Initialize()
{
for (int r = 0; r <= 5; r++)
{
if (RangeEnabled(r) && flowMeterCfg.GetCalibValidDate(r) != DateTime.MinValue
&& flowMeterCfg.GetCalibValidDate(r).Date < DateTime.Now.Date)
{
throw new Exception(string.Format("{0}/r{1}: {2}", Name, r, Strings.Calibration_certificate_validity_expired));
}
}
log.FatalFormat("Successfully initialized device {0}", Name);
}
public void RunDeviceBefore() { }
public void RunDeviceAfter() { }
public void StopDevice() { }
public void StopDevice2() { }
///
/// Calendar support
///
public IList<Config.CalendarEvent.ICalendarEvent> GetCalendarEvents()
{
DateTime calibrationDue = flowMeterCfg.CalibValidDate;
IList<Config.CalendarEvent.ICalendarEvent> calendarEvents = new List<Config.CalendarEvent.ICalendarEvent>();
if (calibrationDue > TBF.UI.Constants.MinDate)
{
/// Calibration due date calendar event
calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name,
string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat))));
if (DateTime.Now.Date <= calibrationDue.AddDays(-7))
{
/// Weekly reminders (last 5 weeks)
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name,
string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
false));
}
if (DateTime.Now.Date <= calibrationDue.Date)
{
/// Daily reminders (last 5 days)
calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name,
string.Format(Strings.Calibration_due_date_is_0,
calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)),
true));
}
}
return calendarEvents;
}
public double ReadFlow() { return controlBoard.RefFlow; }
public double ReadFrequency() { return controlBoard.RefFrequency; }
/// <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);
}
}
}
-275
View File
@@ -1,275 +0,0 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Config.Entities;
using SchematicDrawing;
using TBF.Rig.Generic;
namespace TBF.Rig.Elde.FlowMeter
{
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibRangesCfg, IChildComponentCfg, IDrawingItem
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FlowMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new FlowMeterCfgCtrl(); }
///
/// Serialized parameters
///
public int Idx1; /// 1..7, (DEWA300 : I1+I2=48, I1+I3=80, I2_I3=96, I1+I2+I3=112)
public double NominalFlow; /// Nominal flow in m3/h at nominal output frequency (typ. 2000 Hz)
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;
/// 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; }
[XmlIgnore]
public IList<GNode> GNodes { get; set; }
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()
{
GNodes = new List<GNode>();
}
public FlowMeterCfg(IComponentFactory factory)
: this()
{
Shape = Shape.FlowM;
Sz = Sz.M;
Factory = factory;
Name = "FlowMeter";
ParentName = "CB";
Idx1 = 1;
NominalFlow = 1;
}
public string ToString(int i)
{
return string.Format("{0}({1}) {2}[{3},{4}] Idx1={5}, NominalFlow={6}",
Name,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
Shape,
X,
Y,
Idx1,
NominalFlow);
}
}
}
-504
View File
@@ -1,504 +0,0 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
namespace TBF.Rig.Elde.FlowMeter
{
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.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.nominalFlowTextBox = new System.Windows.Forms.TextBox();
this.nominalFlowLabel = 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.SuspendLayout();
//
// positionTextBox
//
this.positionTextBox.Enabled = false;
this.positionTextBox.Location = new System.Drawing.Point(224, 113);
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(30, 116);
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(30, 90);
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, 61);
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, 64);
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, 37);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// nominalFlowTextBox
//
this.nominalFlowTextBox.Enabled = false;
this.nominalFlowTextBox.Location = new System.Drawing.Point(224, 138);
this.nominalFlowTextBox.Name = "nominalFlowTextBox";
this.nominalFlowTextBox.Size = new System.Drawing.Size(46, 20);
this.nominalFlowTextBox.TabIndex = 8;
//
// nominalFlowLabel
//
this.nominalFlowLabel.AutoSize = true;
this.nominalFlowLabel.Location = new System.Drawing.Point(30, 141);
this.nominalFlowLabel.Name = "nominalFlowLabel";
this.nominalFlowLabel.Size = new System.Drawing.Size(140, 13);
this.nominalFlowLabel.TabIndex = 7;
this.nominalFlowLabel.Text = "Nominal flow [m3/h @2kHz]";
//
// parentNameComboBox
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(140, 87);
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, 205);
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, 205);
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, 205);
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, 205);
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, 228);
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, 228);
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, 228);
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, 228);
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, 251);
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, 251);
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, 251);
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, 251);
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, 274);
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, 274);
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, 274);
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, 274);
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, 297);
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, 297);
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, 297);
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, 297);
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, 207);
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, 230);
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, 253);
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, 276);
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, 299);
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, 186);
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, 186);
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, 186);
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, 186);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(49, 13);
this.label4.TabIndex = 42;
this.label4.Text = "Press. Hi";
//
// FlowMeterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
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.nominalFlowTextBox);
this.Controls.Add(this.nominalFlowLabel);
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 = "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.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 nominalFlowTextBox;
private System.Windows.Forms.Label nominalFlowLabel;
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;
}
}
-343
View File
@@ -1,343 +0,0 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using Config.Entities;
using TBF.Rig.Configs;
using TBF.Rig.Generic;
using TBF.UI.Bench.Components;
namespace TBF.Rig.Elde.FlowMeter
{
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;
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is ControlBoard.Legacy.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.Idx1.ToString();
nominalFlowTextBox.Text = config.NominalFlow.ToString();
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;
positionTextBox.Enabled = true;
nominalFlowTextBox.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;
int dummy;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Parent Name'";
}
#if MALTA_WSD25
if (!int.TryParse(positionTextBox.Text, out dummy) || dummy < 0 || dummy > 8)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Idx1' should be between 0 and 8";
}
#else
if (!int.TryParse(positionTextBox.Text, out dummy) || (dummy < 1) || (dummy > 7))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Idx1' should be between 1 and 7";
}
#endif
double ddummy;
if (!Utils.TryParseUDouble(nominalFlowTextBox.Text, out ddummy) || (ddummy < 0.01) || (ddummy > 1600))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Nominal flow' should be between 0.01 and 1600";
}
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);
}
flags |= UpdateDifferent(ref config.Idx1, positionTextBox.Text, CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.NominalFlow, nominalFlowTextBox.Text, 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);
}
}
}
@@ -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,27 +0,0 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.Rig.Generic;
namespace TBF.Rig.Elde.FlowMeter
{
public class FlowMeterFactory : IComponentFactory
{
public string ClassName { get { return "FlowMeter"; } }
public override string ToString() { return ClassName; }
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);
}
}
}
+4
View File
@@ -99,6 +99,10 @@ namespace TBF.Rig.Elde.FlowMeterDewa
public double GetPressLo(int ix) { return flowMeterCfg.GetPressLo(ix); }
public double GetPressHi(int ix) { return flowMeterCfg.GetPressHi(ix); }
public bool MsrmntAvailable { get { return true; } }
public double MeasuredVal { get { return ReadFlow(); } }
public string AltString { get { return "Invalid format"; } }
public FlowMeter()
{
@@ -50,7 +50,7 @@ namespace TBF.Rig.Elde.FlowMeterDewa
parentNameComboBox.Items.Add(cmpnt.Name);
}
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.FlowMeter.FlowMeterFactory)
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Uni.FlowMeter.Factory)
{
flowmeterComboBox1.Items.Add(cmpnt.Name);
flowmeterComboBox2.Items.Add(cmpnt.Name);
@@ -28,6 +28,11 @@ namespace TBF.Rig.Elde.FlowMeterTriplet
return (LtrPerPulse * correctedFlow / flow);
}
public bool MsrmntAvailable { get { return true; } }
public double MeasuredVal { get { return ReadFlow(); } }
public string AltString { get { return "Invalid format"; } }
public FlowMeter()
{
}
+12 -12
View File
@@ -17,8 +17,8 @@ namespace TBF.Rig.Elde.FlowMeterTwins
readonly FlowMeterCfg flowMeterCfg;
readonly CBoard controlBoard;
public readonly Elde.FlowMeter.FlowMeter FlowMeter1;
public readonly Elde.FlowMeter.FlowMeter FlowMeter2;
public readonly Uni.FlowMeter.FlowMeter FlowMeter1;
public readonly Uni.FlowMeter.FlowMeter FlowMeter2;
public int Idx1 { get { return 0; } }
public double NominalFlow { get { return flowMeterCfg.NominalFlow; } }
@@ -32,6 +32,10 @@ namespace TBF.Rig.Elde.FlowMeterTwins
double flow2 = flow / 2.0;
return (FlowMeter1.LtrPerPulseCorrected(flow2, rangeIx) + FlowMeter2.LtrPerPulseCorrected(flow2, rangeIx)) / 2;
}
public bool MsrmntAvailable { get { return true; } }
public double MeasuredVal { get { return ReadFlow(); } }
public string AltString { get { return "Invalid format"; } }
public FlowMeter()
@@ -43,23 +47,19 @@ namespace TBF.Rig.Elde.FlowMeterTwins
{
flowMeterCfg = cfg as FlowMeterCfg;
controlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as CBoard;
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
FlowMeter1 = TbfComponents.FindComponent(flowMeterCfg.FlowMeter1, components) as Elde.FlowMeter.FlowMeter;
FlowMeter1 = TbfComponents.FindComponent(flowMeterCfg.FlowMeter1, components) as Uni.FlowMeter.FlowMeter;
if (FlowMeter1 == null) throw new Exception("Cannot find FlowMeter1 component");
FlowMeter2 = TbfComponents.FindComponent(flowMeterCfg.FlowMeter2, components) as Elde.FlowMeter.FlowMeter;
FlowMeter2 = TbfComponents.FindComponent(flowMeterCfg.FlowMeter2, components) as Uni.FlowMeter.FlowMeter;
if (FlowMeter2 == null) throw new Exception("Cannot find FlowMeter2 component");
controlBoard.EtCalib[Idx1] = (float)flowMeterCfg.NominalFlow; /// Idx1==0 for FlowMeterTwins
/// Prepare data for SendCalibData() control board component method
log.Warn(this.ToString());
}
public double ReadFlow() { return controlBoard.RefFlow; }
public double ReadFlow() { return FlowMeter1.ReadFlow() + FlowMeter2.ReadFlow(); }
public double ReadFrequency() { return controlBoard.RefFrequency; }
/// <summary>
@@ -69,7 +69,7 @@ namespace TBF.Rig.Elde.FlowMeterTwins
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
public IOperation ReadFlowOp(ref DoubleBox flow)
{
return new ReadFlowOp(this, controlBoard, ref flow);
return new TBF.Rig.ControlBoard.Legacy.ReadFlowOp(this, controlBoard, ref flow);
}
/// <summary>
@@ -80,7 +80,7 @@ namespace TBF.Rig.Elde.FlowMeterTwins
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
public IOperation ReadFlowOp(ref DoubleBox flow, Event flowDone)
{
return new ReadFlowOp(this, controlBoard, ref flow, flowDone);
return new TBF.Rig.ControlBoard.Legacy.ReadFlowOp(this, controlBoard, ref flow, flowDone);
}
}
}
@@ -44,7 +44,7 @@ namespace TBF.Rig.Elde.FlowMeterTwins
{
parentNameComboBox.Items.Add(cmpnt.Name);
}
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.FlowMeter.FlowMeterFactory)
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Uni.FlowMeter.Factory)
{
flowMeter1ComboBox.Items.Add(cmpnt.Name);
flowMeter2ComboBox.Items.Add(cmpnt.Name);
+2 -2
View File
@@ -88,9 +88,9 @@ namespace TBF.Rig.Elde.RegulValveCoax
if (regulValve == null) throw new ArgumentNullException(string.Format("{0} is not Elde.RegulValveCoax.", _regulValve.Name));
regulValveNr = this.regulValve.Idx1;
if (flowMeter is Elde.FlowMeter.FlowMeter)
if (flowMeter is Uni.FlowMeter.FlowMeter)
{
this.flowMeterNr = (flowMeter as Elde.FlowMeter.FlowMeter).Idx1;
this.flowMeterNr = (flowMeter as Uni.FlowMeter.FlowMeter).Idx1;
}
else if (flowMeter is Elde.FlowMeterTwins.FlowMeter)
{
+2 -2
View File
@@ -94,9 +94,9 @@ namespace TBF.Rig.Elde.RegulValveTandem
this.fixedPctLo = fxdPctLo;
this.fixedPctHi = fxdPctHi;
if (flowMeter is Elde.FlowMeter.FlowMeter)
if (flowMeter is Uni.FlowMeter.FlowMeter)
{
this.flowMeterNr = (flowMeter as Elde.FlowMeter.FlowMeter).Idx1;
this.flowMeterNr = (flowMeter as Uni.FlowMeter.FlowMeter).Idx1;
}
else if (flowMeter is Elde.FlowMeterTwins.FlowMeter)
{