Refactoring : TestBenchFramework --> TBF ver. 2.18.789
This commit is contained in:
@@ -0,0 +1,204 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.WaterMeters.Munich
|
||||
{
|
||||
public class ProcParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ProcParams) })[0];
|
||||
protected override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public string ProductName; /// Znak fabryczny (PL)
|
||||
public string Producer; /// Producent (PL), Hersteller (D)
|
||||
|
||||
public float DN;
|
||||
public float L; /// stavebná dĺžka [mm]
|
||||
public Mounting Mounting;
|
||||
|
||||
public bool NewQnames; /// true = display Q4,Q3,Q2,Q1, false = display Qmax, Qn, Qt, Qmin
|
||||
public float Qn; /// [m3/h]
|
||||
public string MetrologicalClass; /// Metr. Klasse
|
||||
public string ApprovalInfo; /// Zulassungszeichen, WE (PL)
|
||||
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
ProductName = string.Empty;
|
||||
Producer = string.Empty;
|
||||
DN = 0;
|
||||
L = 0;
|
||||
Mounting = Mounting.NotSpecified;
|
||||
NewQnames = false;
|
||||
Qn = 2.5f;
|
||||
MetrologicalClass = "A";
|
||||
ApprovalInfo = string.Empty;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
#if MUNICH
|
||||
"Prüfvorlage;Zählertyp",
|
||||
#else
|
||||
Strings.Product_name,
|
||||
#endif
|
||||
Strings.Producer,
|
||||
"DN [mm]",
|
||||
"L [mm]",
|
||||
Strings.Mounting,
|
||||
Strings.New_Q_names,
|
||||
Strings.Qn,
|
||||
Strings.Metrological_class,
|
||||
Strings.Approval_info,
|
||||
};
|
||||
public override string ParamName(int i)
|
||||
{
|
||||
string name = paramNames[i];
|
||||
|
||||
if (NewQnames && name.Equals(Strings.Qmax)) name = "Q4 [m3/h]";
|
||||
if (NewQnames && name.Equals(Strings.Qn)) name = "Q3 [m3/h]";
|
||||
if (NewQnames && name.Equals(Strings.Qt)) name = "Q2 [m3/h]";
|
||||
if (NewQnames && name.Equals(Strings.Qmin)) name = "Q1 [m3/h]";
|
||||
|
||||
return name;
|
||||
}
|
||||
public override int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public override string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return ProductName;
|
||||
case 1: return Producer;
|
||||
case 2: return DN.ToString();
|
||||
case 3: return L.ToString();
|
||||
case 4: return Mounting.ToDescription();
|
||||
case 5: return (NewQnames ? Strings.yes : Strings.no);
|
||||
case 6: return Qn.ToString();
|
||||
case 7: return MetrologicalClass;
|
||||
case 8: return ApprovalInfo;
|
||||
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: ProductName = strValue; return;
|
||||
case 1: Producer = strValue; return;
|
||||
case 2: DN = Utils.ParseUFloat(strValue); return;
|
||||
case 3: L = Utils.ParseUFloat(strValue); return;
|
||||
case 4:
|
||||
for (Mounting m = 0; m < Mounting.Count; m++)
|
||||
{
|
||||
if (m.ToDescription().Equals(strValue)) { Mounting = m; return; }
|
||||
}
|
||||
break;
|
||||
case 5: NewQnames = strValue.Equals(Strings.yes); return;
|
||||
case 6: Qn = Utils.ParseUFloat(strValue); return;
|
||||
case 7: MetrologicalClass = strValue; return;
|
||||
case 8: ApprovalInfo = strValue; return;
|
||||
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
|
||||
float dummy;
|
||||
switch (i)
|
||||
{
|
||||
case 0: /// ProductName
|
||||
case 1: /// Producer
|
||||
case 7: /// MetrologicalClass
|
||||
case 8: /// ApprovalInfo
|
||||
return true;
|
||||
case 2: /// DN
|
||||
case 3: /// L
|
||||
case 6: /// Qn
|
||||
if (Utils.TryParseUFloat(strValue, out dummy)) return true;
|
||||
break;
|
||||
case 4:
|
||||
for (Mounting tc = 0; tc < Mounting.Count; tc++) if (tc.ToDescription().Equals(strValue)) return true;
|
||||
break;
|
||||
case 5:
|
||||
if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(ProcParams prms)
|
||||
{
|
||||
prms.ProductName = this.ProductName;
|
||||
prms.Producer = this.Producer;
|
||||
prms.DN = this.DN;
|
||||
prms.L = this.L;
|
||||
prms.Mounting = this.Mounting;
|
||||
prms.NewQnames = this.NewQnames;
|
||||
prms.Qn = this.Qn;
|
||||
prms.MetrologicalClass = this.MetrologicalClass;
|
||||
prms.ApprovalInfo = this.ApprovalInfo;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
ProcParams pars = new ProcParams();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public override void UpdateProcedureParams(ComponentProcedure dbEntity)
|
||||
{
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
{
|
||||
ProcParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as ProcParams;
|
||||
|
||||
procedureParamsEntity = dbEntity;
|
||||
componentName = dbEntity.CmpntName;
|
||||
procedure = dbEntity.Procedure;
|
||||
|
||||
if (tmp != null) tmp.CopyContentTo(this);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor initializes the parameters
|
||||
/// </summary>
|
||||
public ProcParams()
|
||||
{
|
||||
}
|
||||
|
||||
public ProcParams(bool initialize)
|
||||
{
|
||||
if (initialize) InitializeAll();
|
||||
}
|
||||
|
||||
public ProcParams(ComponentProcedure procParamsEntity, string componentName, Procedure procedure)
|
||||
{
|
||||
this.procedureParamsEntity = procParamsEntity;
|
||||
this.componentName = componentName;
|
||||
this.procedure = procedure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.BenchControl;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.BenchControl.WaterMeters.Munich
|
||||
{
|
||||
/// <summary>
|
||||
/// This component = instance of this class is a placeholder for a combined main watermeter
|
||||
/// </summary>
|
||||
public class WaterMeter : ComponentBase, GenericDevices.IWaterMeter
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(WaterMeter));
|
||||
public override string ToString() { return string.Format("WaterMeter({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly WaterMeterCfg waterMeterCfg;
|
||||
|
||||
/// <summary>WaterMeter type (product name) and producer</summary>
|
||||
public string ProductName { get { return waterMeterCfg.ProcParams.ProductName; } }
|
||||
public string Producer { get { return waterMeterCfg.ProcParams.Producer; } }
|
||||
|
||||
public double PulsesPerLtr { get { return 1.0; } }
|
||||
|
||||
/// <summary>Pipe diameter [mm]</summary>
|
||||
public float DN { get { return 0; } }
|
||||
|
||||
/// <summary>Build lenght [mm]</summary>
|
||||
public float L { get { return 0; } }
|
||||
|
||||
public Mounting Mounting { get { return Config.Entities.Mounting.NotSpecified; } }
|
||||
|
||||
/// <summary>Nominal water flow in [m3/h]</summary>
|
||||
public bool NewQnames { get { return waterMeterCfg.ProcParams.NewQnames; } }
|
||||
public float Q4_Qmax { get { return 0; } }
|
||||
public float Q3_Qn { get { return waterMeterCfg.ProcParams.Qn; } }
|
||||
public float Q2_Qt { get { return 0; } }
|
||||
public float Q1_Qmin { get { return 0; } }
|
||||
|
||||
/// <summary>Metrological class, etc</summary>
|
||||
public string MetrologicalClass { get { return waterMeterCfg.ProcParams.MetrologicalClass; } }
|
||||
public TemperatureClass TemperatureClass { get { return Config.Entities.TemperatureClass.NotSpecified; } }
|
||||
public PressureLossClass PressureLossClass { get { return Config.Entities.PressureLossClass.NotSpecified; } }
|
||||
public MaxAdmissiblePressure MaxAdmissiblePressure { get { return Config.Entities.MaxAdmissiblePressure.NotSpecified; } }
|
||||
public FlowProfileSensitivityClass FlowProfileSensitivityClass { get { return Config.Entities.FlowProfileSensitivityClass.NotSpecified; } }
|
||||
|
||||
/// <summary>WaterMeter approval information or signature</summary>
|
||||
public string ApprovalInfo { get { return waterMeterCfg.ProcParams.ApprovalInfo; } }
|
||||
public string Certificate { get { return string.Empty; } }
|
||||
|
||||
public string Text1 { get { return string.Empty; } }
|
||||
public string Text2 { get { return string.Empty; } }
|
||||
public string Text3 { get { return string.Empty; } }
|
||||
public string Text4 { get { return string.Empty; } }
|
||||
public string Text5 { get { return string.Empty; } }
|
||||
|
||||
/// <summary>Water: cold / hot</summary>
|
||||
public Config.Entities.Medium WaterTemp { get { return Config.Entities.Medium.NotSpecified; } }
|
||||
|
||||
/// Properties set by the Begin and the End form
|
||||
public string SerialNr
|
||||
{
|
||||
get { return serialNr; }
|
||||
set { serialNr = value; }
|
||||
}
|
||||
string serialNr;
|
||||
|
||||
public string EndState
|
||||
{
|
||||
get { return endState; }
|
||||
set { endState = value; }
|
||||
}
|
||||
string endState;
|
||||
|
||||
public string BeginState
|
||||
{
|
||||
get { return beginState; }
|
||||
set { beginState = value; }
|
||||
}
|
||||
string beginState;
|
||||
|
||||
public bool Disabled
|
||||
{
|
||||
get { return disabled; }
|
||||
set { disabled = value; }
|
||||
}
|
||||
bool disabled;
|
||||
|
||||
public WaterMeter()
|
||||
{
|
||||
ClearData();
|
||||
}
|
||||
|
||||
public WaterMeter(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
ClearData();
|
||||
waterMeterCfg = cfg as WaterMeterCfg;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public void ClearData()
|
||||
{
|
||||
serialNr = string.Empty;
|
||||
endState = string.Empty;
|
||||
beginState = string.Empty;
|
||||
disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.WaterMeters.Munich
|
||||
{
|
||||
public class WaterMeterCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(WaterMeterCfg) })[0];
|
||||
protected override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new WaterMeterCfgCtrl(); }
|
||||
|
||||
/// <summary> Procedure parameters </summary>
|
||||
[XmlIgnore]
|
||||
public ProcParams ProcParams;
|
||||
public override IParamsProvider GetProcedureParams() { return ProcParams; }
|
||||
public override IParamsProvider CreateProcedureParams(Procedure procedure)
|
||||
{
|
||||
ProcParams procParams = new ProcParams(true);
|
||||
procParams.UpdateProcedureParams(Name, procedure);
|
||||
return procParams;
|
||||
}
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
WaterMeterCfg()
|
||||
{
|
||||
Name = "WM";
|
||||
ParentName = string.Empty;
|
||||
ProcParams = new ProcParams(true);
|
||||
}
|
||||
|
||||
public WaterMeterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.WaterMeters.Munich
|
||||
{
|
||||
public partial class WaterMeterCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(WaterMeterCfgCtrl));
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
WaterMeterCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as WaterMeterCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public WaterMeterCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void WaterMeterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
nameLabel.Text = Strings.Name;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.WaterMeters.Munich
|
||||
{
|
||||
partial class WaterMeterCfgCtrl
|
||||
{
|
||||
/// <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.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(135, 55);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(25, 58);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(132, 31);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(60, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ClassName";
|
||||
//
|
||||
// WaterMeterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "WaterMeterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.WaterMeterCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2016 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.WaterMeters.Munich
|
||||
{
|
||||
public class WaterMeterFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
|
||||
public void ResetStaticProperties() { WaterMeter.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new WaterMeter(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new WaterMeter(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new WaterMeterCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(WaterMeterCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,345 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.WaterMeters.WaterMeter
|
||||
{
|
||||
public class ProcParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ProcParams) })[0];
|
||||
protected override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
|
||||
public string ProductName; /// Znak fabryczny (PL)
|
||||
public string Producer; /// Producent (PL), Hersteller (D)
|
||||
|
||||
public float DN;
|
||||
public float L; /// stavebná dĺžka [mm]
|
||||
public Mounting Mounting;
|
||||
|
||||
public bool NewQnames; /// true = display Q4,Q3,Q2,Q1, false = display Qmax, Qn, Qt, Qmin
|
||||
public float Qmax; /// [m3/h]
|
||||
public float Qn; /// [m3/h]
|
||||
public float Qt; /// [m3/h]
|
||||
public float Qmin; /// [m3/h]
|
||||
|
||||
public string MetrologicalClass; /// Metr. Klasse
|
||||
public TemperatureClass TemperatureClass;
|
||||
public PressureLossClass PressureLossClass;
|
||||
public MaxAdmissiblePressure MaxAdmissiblePressure;
|
||||
public FlowProfileSensitivityClass FlowProfileSensitivityClass;
|
||||
|
||||
public string ApprovalInfo; /// Zulassungszeichen, WE (PL)
|
||||
public string Certificate;
|
||||
|
||||
public double PulsesPerLtr; /// Target low limit of the flow increase or decrease
|
||||
|
||||
public string Text1;
|
||||
public string Text2;
|
||||
public string Text3;
|
||||
public string Text4;
|
||||
public string Text5;
|
||||
|
||||
public Medium WaterTemp; /// Woda: zimna / tepla (PL)
|
||||
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
ProductName = string.Empty;
|
||||
Producer = string.Empty;
|
||||
DN = 0;
|
||||
L = 0;
|
||||
Mounting = Mounting.NotSpecified;
|
||||
NewQnames = false;
|
||||
Qmax = 4.0f;
|
||||
Qn = 2.5f;
|
||||
Qt = 0.005f;
|
||||
Qmin = 0.003125f;
|
||||
MetrologicalClass = "A";
|
||||
TemperatureClass = TemperatureClass.NotSpecified;
|
||||
PressureLossClass = PressureLossClass.NotSpecified;
|
||||
MaxAdmissiblePressure = MaxAdmissiblePressure.NotSpecified;
|
||||
FlowProfileSensitivityClass = FlowProfileSensitivityClass.NotSpecified;
|
||||
ApprovalInfo = string.Empty;
|
||||
Certificate = string.Empty;
|
||||
PulsesPerLtr = 1.0;
|
||||
Text1 = string.Empty;
|
||||
Text2 = string.Empty;
|
||||
Text3 = string.Empty;
|
||||
Text4 = string.Empty;
|
||||
Text5 = string.Empty;
|
||||
|
||||
WaterTemp = Medium.ColdWater;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
Strings.Product_name,
|
||||
Strings.Producer,
|
||||
"DN",
|
||||
Strings.L,
|
||||
Strings.Mounting,
|
||||
Strings.New_Q_names,
|
||||
Strings.Qmax,
|
||||
Strings.Qn,
|
||||
Strings.Qt,
|
||||
Strings.Qmin,
|
||||
Strings.Metrological_class,
|
||||
Strings.Temperature_class,
|
||||
Strings.Pressure_loss_class,
|
||||
Strings.Maximum_admissible_pressure,
|
||||
Strings.Flow_profile_sensitivity_class,
|
||||
Strings.Approval_info,
|
||||
Strings.Certificate,
|
||||
Strings.PulsesPerLtr,
|
||||
"Text1",
|
||||
"Text2",
|
||||
"Text3",
|
||||
"Text4",
|
||||
"Text5",
|
||||
|
||||
Strings.Water, /// "Woda"
|
||||
};
|
||||
public override string ParamName(int i)
|
||||
{
|
||||
string name = paramNames[i];
|
||||
|
||||
if (NewQnames && name.Equals(Strings.Qmax)) name = "Q4";
|
||||
if (NewQnames && name.Equals(Strings.Qn)) name = "Q3";
|
||||
if (NewQnames && name.Equals(Strings.Qt)) name = "Q2";
|
||||
if (NewQnames && name.Equals(Strings.Qmin)) name = "Q1";
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
public override int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public override string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return ProductName;
|
||||
case 1: return Producer;
|
||||
case 2: return DN.ToString();
|
||||
case 3: return L.ToString();
|
||||
case 4: return Mounting.ToDescription();
|
||||
case 5: return (NewQnames ? Strings.yes : Strings.no);
|
||||
case 6: return Qmax.ToString();
|
||||
case 7: return Qn.ToString();
|
||||
case 8: return Qt.ToString();
|
||||
case 9: return Qmin.ToString();
|
||||
case 10: return MetrologicalClass;
|
||||
case 11: return TemperatureClass.ToDescription();
|
||||
case 12: return PressureLossClass.ToDescription();
|
||||
case 13: return MaxAdmissiblePressure.ToDescription();
|
||||
case 14: return FlowProfileSensitivityClass.ToDescription();
|
||||
case 15: return ApprovalInfo;
|
||||
case 16: return Certificate;
|
||||
case 17: return PulsesPerLtr.ToString();
|
||||
case 18: return Text1;
|
||||
case 19: return Text2;
|
||||
case 20: return Text3;
|
||||
case 21: return Text4;
|
||||
case 22: return Text5;
|
||||
|
||||
case 23: return (WaterTemp == Medium.HotWater) ? Strings.hot : Strings.cold; /// "tepla" : "zimna";
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: ProductName = strValue; return;
|
||||
case 1: Producer = strValue; return;
|
||||
case 2: DN = Utils.ParseUFloat(strValue); return;
|
||||
case 3: L = Utils.ParseUFloat(strValue); return;
|
||||
case 4:
|
||||
for (Mounting m = 0; m < Mounting.Count; m++)
|
||||
{
|
||||
if (m.ToDescription().Equals(strValue)) { Mounting = m; return; }
|
||||
}
|
||||
break;
|
||||
case 5: NewQnames = strValue.Equals(Strings.yes); return;
|
||||
case 6: Qmax = Utils.ParseUFloat(strValue); return;
|
||||
case 7: Qn = Utils.ParseUFloat(strValue); return;
|
||||
case 8: Qt = Utils.ParseUFloat(strValue); return;
|
||||
case 9: Qmin = Utils.ParseUFloat(strValue); return;
|
||||
case 10: MetrologicalClass = strValue; return;
|
||||
case 11:
|
||||
for (TemperatureClass tc = 0; tc < TemperatureClass.Count; tc++)
|
||||
{
|
||||
if (tc.ToDescription().Equals(strValue)) { TemperatureClass = tc; return; }
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
for (PressureLossClass dp = 0; dp < PressureLossClass.Count; dp++)
|
||||
{
|
||||
if (dp.ToDescription().Equals(strValue)) { PressureLossClass = dp; return; }
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
for (MaxAdmissiblePressure map = 0; map < MaxAdmissiblePressure.Count; map++)
|
||||
{
|
||||
if (map.ToDescription().Equals(strValue)) { MaxAdmissiblePressure = map; return; }
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
for (FlowProfileSensitivityClass fps = 0; fps < FlowProfileSensitivityClass.Count; fps++)
|
||||
{
|
||||
if (fps.ToDescription().Equals(strValue)) { FlowProfileSensitivityClass = fps; return; }
|
||||
}
|
||||
break;
|
||||
case 15: ApprovalInfo = strValue; return;
|
||||
case 16: Certificate = strValue; return;
|
||||
case 17: PulsesPerLtr = Utils.ParseUDouble(strValue); return;
|
||||
case 18: Text1 = strValue; return;
|
||||
case 19: Text2 = strValue; return;
|
||||
case 20: Text3 = strValue; return;
|
||||
case 21: Text4 = strValue; return;
|
||||
case 22: Text5 = strValue; return;
|
||||
|
||||
case 23: WaterTemp = strValue.Equals(Strings.hot) ? Medium.HotWater : Medium.ColdWater; return; /// "tepla"
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
|
||||
double dummy;
|
||||
switch (i)
|
||||
{
|
||||
case 0: /// ProductName
|
||||
case 1: /// Producer
|
||||
case 10: /// MetrologicalClass
|
||||
case 15: /// ApprovalInfo
|
||||
case 16: /// Certificate
|
||||
case 18: /// Text1
|
||||
case 19: /// Text2
|
||||
case 20: /// Text3
|
||||
case 21: /// Text4
|
||||
case 22: /// Text5
|
||||
return true;
|
||||
case 5:
|
||||
if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true;
|
||||
break;
|
||||
case 2: /// DN
|
||||
case 3: /// L
|
||||
case 6: /// Qmax
|
||||
case 7: /// Qn
|
||||
case 8: /// Qt
|
||||
case 9: /// Qmin
|
||||
case 17: /// PulsesPerLtr
|
||||
if (Utils.TryParseUDouble(strValue, out dummy)) return true;
|
||||
break;
|
||||
case 4:
|
||||
for (Mounting tc = 0; tc < Mounting.Count; tc++) if (tc.ToDescription().Equals(strValue)) return true;
|
||||
break;
|
||||
case 11:
|
||||
for (TemperatureClass tc = 0; tc < TemperatureClass.Count; tc++) if (tc.ToDescription().Equals(strValue)) return true;
|
||||
break;
|
||||
case 12:
|
||||
for (PressureLossClass tc = 0; tc < PressureLossClass.Count; tc++) if (tc.ToDescription().Equals(strValue)) return true;
|
||||
break;
|
||||
case 13:
|
||||
for (MaxAdmissiblePressure map = 0; map < MaxAdmissiblePressure.Count; map++) if (map.ToDescription().Equals(strValue)) return true;
|
||||
break;
|
||||
case 14:
|
||||
for (FlowProfileSensitivityClass tc = 0; tc < FlowProfileSensitivityClass.Count; tc++) if (tc.ToDescription().Equals(strValue)) return true;
|
||||
break;
|
||||
case 23:
|
||||
if (strValue.Equals(Strings.cold) || strValue.Equals(Strings.hot)) return true; /// "zimna", "tepla"
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(ProcParams prms)
|
||||
{
|
||||
prms.ProductName = this.ProductName;
|
||||
prms.Producer = this.Producer;
|
||||
prms.DN = this.DN;
|
||||
prms.L = this.L;
|
||||
prms.Mounting = this.Mounting;
|
||||
prms.NewQnames = this.NewQnames;
|
||||
prms.Qmax = this.Qmax;
|
||||
prms.Qn = this.Qn;
|
||||
prms.Qt = this.Qt;
|
||||
prms.Qmin = this.Qmin;
|
||||
prms.MetrologicalClass = this.MetrologicalClass;
|
||||
prms.TemperatureClass = this.TemperatureClass;
|
||||
prms.PressureLossClass = this.PressureLossClass;
|
||||
prms.MaxAdmissiblePressure = this.MaxAdmissiblePressure;
|
||||
prms.FlowProfileSensitivityClass = this.FlowProfileSensitivityClass;
|
||||
prms.ApprovalInfo = this.ApprovalInfo;
|
||||
prms.Certificate = this.Certificate;
|
||||
prms.PulsesPerLtr = this.PulsesPerLtr;
|
||||
prms.Text1 = this.Text1;
|
||||
prms.Text2 = this.Text2;
|
||||
prms.Text3 = this.Text3;
|
||||
prms.Text4 = this.Text4;
|
||||
prms.Text5 = this.Text5;
|
||||
|
||||
prms.WaterTemp = this.WaterTemp;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
ProcParams pars = new ProcParams();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public override void UpdateProcedureParams(ComponentProcedure dbEntity)
|
||||
{
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
{
|
||||
ProcParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as ProcParams;
|
||||
|
||||
procedureParamsEntity = dbEntity;
|
||||
componentName = dbEntity.CmpntName;
|
||||
procedure = dbEntity.Procedure;
|
||||
|
||||
if (tmp != null) tmp.CopyContentTo(this);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor initializes the parameters
|
||||
/// </summary>
|
||||
public ProcParams()
|
||||
{
|
||||
}
|
||||
|
||||
public ProcParams(bool initialize)
|
||||
{
|
||||
if (initialize) InitializeAll();
|
||||
}
|
||||
|
||||
public ProcParams(ComponentProcedure procParamsEntity, string componentName, Procedure procedure)
|
||||
{
|
||||
this.procedureParamsEntity = procParamsEntity;
|
||||
this.componentName = componentName;
|
||||
this.procedure = procedure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.BenchControl.WaterMeters.WaterMeter
|
||||
{
|
||||
/// <summary>
|
||||
/// This component = instance of this class is a placeholder for a combined main watermeter
|
||||
/// </summary>
|
||||
public class WaterMeter : ComponentBase, GenericDevices.IWaterMeter
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(WaterMeter));
|
||||
public override string ToString() { return string.Format("WaterMeter({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly WaterMeterCfg waterMeterCfg;
|
||||
|
||||
/// <summary>WaterMeter type (product name) and producer</summary>
|
||||
public string ProductName { get { return waterMeterCfg.ProcParams.ProductName; } }
|
||||
public string Producer { get { return waterMeterCfg.ProcParams.Producer; } }
|
||||
|
||||
public double PulsesPerLtr { get { return waterMeterCfg.ProcParams.PulsesPerLtr; } }
|
||||
|
||||
/// <summary>Pipe diameter [mm]</summary>
|
||||
public float DN { get { return waterMeterCfg.ProcParams.DN; } }
|
||||
|
||||
/// <summary>Build lenght [mm]</summary>
|
||||
public float L { get { return waterMeterCfg.ProcParams.L; } }
|
||||
|
||||
public Mounting Mounting { get { return waterMeterCfg.ProcParams.Mounting; } }
|
||||
|
||||
/// <summary>Nominal water flow in [m3/h]</summary>
|
||||
public bool NewQnames { get { return waterMeterCfg.ProcParams.NewQnames; } }
|
||||
public float Q4_Qmax { get { return waterMeterCfg.ProcParams.Qmax; } }
|
||||
public float Q3_Qn { get { return waterMeterCfg.ProcParams.Qn; } }
|
||||
public float Q2_Qt { get { return waterMeterCfg.ProcParams.Qt; } }
|
||||
public float Q1_Qmin { get { return waterMeterCfg.ProcParams.Qmin; } }
|
||||
|
||||
/// <summary>Metrological class, etc</summary>
|
||||
public string MetrologicalClass { get { return waterMeterCfg.ProcParams.MetrologicalClass; } }
|
||||
public TemperatureClass TemperatureClass { get { return waterMeterCfg.ProcParams.TemperatureClass; } }
|
||||
public PressureLossClass PressureLossClass { get { return waterMeterCfg.ProcParams.PressureLossClass; } }
|
||||
public MaxAdmissiblePressure MaxAdmissiblePressure { get { return waterMeterCfg.ProcParams.MaxAdmissiblePressure; } }
|
||||
public FlowProfileSensitivityClass FlowProfileSensitivityClass { get { return waterMeterCfg.ProcParams.FlowProfileSensitivityClass; } }
|
||||
|
||||
/// <summary>WaterMeter approval information or signature</summary>
|
||||
public string ApprovalInfo { get { return waterMeterCfg.ProcParams.ApprovalInfo; } }
|
||||
public string Certificate { get { return waterMeterCfg.ProcParams.Certificate; } }
|
||||
|
||||
public string Text1 { get { return waterMeterCfg.ProcParams.Text1; } }
|
||||
public string Text2 { get { return waterMeterCfg.ProcParams.Text2; } }
|
||||
public string Text3 { get { return waterMeterCfg.ProcParams.Text3; } }
|
||||
public string Text4 { get { return waterMeterCfg.ProcParams.Text4; } }
|
||||
public string Text5 { get { return waterMeterCfg.ProcParams.Text5; } }
|
||||
|
||||
/// <summary>Water: cold / hot</summary>
|
||||
public Config.Entities.Medium WaterTemp { get { return waterMeterCfg.ProcParams.WaterTemp; } }
|
||||
|
||||
#if IPERL
|
||||
public ushort OriginalCalibFactor;
|
||||
public ushort CalibFactor;
|
||||
public double Q2ErrorWOCorrection;
|
||||
public bool Q2CorrectionDone;
|
||||
public double Q2Correction;
|
||||
public int Q2CorrRFlow;
|
||||
public int Q2CorrLFlow;
|
||||
public double Diff2Hz8Hz;
|
||||
public bool Hz2CorrectionDone;
|
||||
public int Hz2CorrectionFactor;
|
||||
public string FWVersion;
|
||||
#endif
|
||||
|
||||
/// Properties set by the Begin and the End form or the iPerl head
|
||||
public string SerialNr
|
||||
{
|
||||
get { return serialNr; }
|
||||
set { serialNr = value; }
|
||||
}
|
||||
string serialNr;
|
||||
|
||||
public string EndState
|
||||
{
|
||||
get { return endState; }
|
||||
set { endState = value; }
|
||||
}
|
||||
string endState;
|
||||
|
||||
public string BeginState
|
||||
{
|
||||
get { return beginState; }
|
||||
set { beginState = value; }
|
||||
}
|
||||
string beginState;
|
||||
|
||||
public bool Disabled
|
||||
{
|
||||
get { return disabled; }
|
||||
set { disabled = value; }
|
||||
}
|
||||
bool disabled;
|
||||
|
||||
public WaterMeter()
|
||||
{
|
||||
ClearData();
|
||||
}
|
||||
|
||||
public WaterMeter(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
ClearData();
|
||||
waterMeterCfg = cfg as WaterMeterCfg;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public void ClearData()
|
||||
{
|
||||
serialNr = string.Empty;
|
||||
endState = string.Empty;
|
||||
beginState = string.Empty;
|
||||
disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.WaterMeters.WaterMeter
|
||||
{
|
||||
public class WaterMeterCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(WaterMeterCfg) })[0];
|
||||
protected override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new WaterMeterCfgCtrl(); }
|
||||
|
||||
/// <summary> Procedure parameters </summary>
|
||||
[XmlIgnore]
|
||||
public ProcParams ProcParams;
|
||||
public override IParamsProvider GetProcedureParams() { return ProcParams; }
|
||||
public override IParamsProvider CreateProcedureParams(Procedure procedure)
|
||||
{
|
||||
ProcParams procParams = new ProcParams(true);
|
||||
procParams.UpdateProcedureParams(Name, procedure);
|
||||
return procParams;
|
||||
}
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
WaterMeterCfg()
|
||||
{
|
||||
Name = "WM";
|
||||
ParentName = string.Empty;
|
||||
ProcParams = new ProcParams(true);
|
||||
}
|
||||
|
||||
public WaterMeterCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.WaterMeters.WaterMeter
|
||||
{
|
||||
public partial class WaterMeterCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(WaterMeterCfgCtrl));
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
WaterMeterCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as WaterMeterCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public WaterMeterCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void WaterMeterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
nameLabel.Text = Strings.Name;
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.BenchControl.WaterMeters.WaterMeter
|
||||
{
|
||||
partial class WaterMeterCfgCtrl
|
||||
{
|
||||
/// <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.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(135, 55);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(25, 58);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(132, 31);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(60, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ClassName";
|
||||
//
|
||||
// WaterMeterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "WaterMeterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.WaterMeterCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.WaterMeters.WaterMeter
|
||||
{
|
||||
public class WaterMeterFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "WaterMeter"; } }
|
||||
|
||||
public void ResetStaticProperties() { WaterMeter.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new WaterMeter(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new WaterMeter(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new WaterMeterCfg(this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(WaterMeterCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user