Advance components - StandingStartMassCollectionAdvance
This commit is contained in:
parent
783d51e71a
commit
7409af70ac
@ -193,6 +193,10 @@ namespace TBF.Rig
|
||||
new TestMethods.StandingStartMassCollection.Single.Factory(),
|
||||
new TestMethods.StandingStartMassCollection.Compound.Factory(),
|
||||
new TestMethods.StandingStartMassCollection.HeatMeters.Factory(),
|
||||
new TestMethods.StandingStartMassCollectionAdvance.Single.Factory(),
|
||||
new TestMethods.StandingStartMassCollectionAdvance.Compound.Factory(),
|
||||
new TestMethods.StandingStartMassCollectionAdvance.HeatMeters.Factory(),
|
||||
new TestMethods.StandingStartMassCollectionAdvanceCollect.Single.Factory(),
|
||||
new TestMethods.StandingStartMassCollWODiv.Factory(),
|
||||
new BuiltIn.Valve.ValveFactory(),
|
||||
new BuiltIn.ValveEx.ValveFactory(),
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance.Compound
|
||||
{
|
||||
public class Component : ComponentBase, GenericDevices.ITestMethod
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
public bool CanTest(MetersKind meters) { return meters == MetersKind.Combined; }
|
||||
public bool DoTransitions() { return true; }
|
||||
public bool CheckDeviceCaps(Test test, OutputPath devices, out string message)
|
||||
{
|
||||
return StandingStartMassCollectionAdvanceSeq.CheckDeviceCaps(test, devices, out message);
|
||||
}
|
||||
|
||||
public Component() { }
|
||||
///
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
///
|
||||
public override void Initialize() { }
|
||||
|
||||
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
|
||||
{
|
||||
return (new StandingStartMassCollectionAdvanceSeq()).Execute(test, repetNr, isLastRepetition, true, null, DebugLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Rig.Configs.NameOnly;
|
||||
|
||||
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance.Compound
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(8); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(20), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance.HeatMeters
|
||||
{
|
||||
public class Component : ComponentBase, GenericDevices.ITestMethod
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
public bool CanTest(MetersKind meters) { return meters == MetersKind.HeatMeter; }
|
||||
public bool DoTransitions() { return true; }
|
||||
public bool CheckDeviceCaps(Test test, OutputPath devices, out string message)
|
||||
{
|
||||
return StandingStartMassCollectionAdvanceSeq.CheckDeviceCaps(test, devices, out message);
|
||||
}
|
||||
|
||||
|
||||
readonly TestMethodCfg testMethodCfg;
|
||||
|
||||
public Component() { }
|
||||
///
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
testMethodCfg = cfg as TestMethodCfg;
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
///
|
||||
public override void Initialize() { }
|
||||
|
||||
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
|
||||
{
|
||||
return (new StandingStartMassCollectionAdvanceSeq()).Execute(test, repetNr, isLastRepetition, false, testMethodCfg.TestParams, DebugLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance.HeatMeters
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(8); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(20), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance.HeatMeters
|
||||
{
|
||||
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new TestMethodCfgCtrl(); }
|
||||
|
||||
/// <summary> Test parameters </summary>
|
||||
[XmlIgnore]
|
||||
public TestParams TestParams;
|
||||
public override IParamsProvider GetRuntimeTestParamsProvider() { return TestParams; }
|
||||
public override IParamsProvider CreateTestParamsProvider() { return new TestParams(true); }
|
||||
public override IParamsProvider GetUITestParamsProvider(Test test)
|
||||
{
|
||||
return (test.Method == Name) ? base.GetUITestParamsProvider(test) : null;
|
||||
}
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
TestMethodCfg()
|
||||
{
|
||||
TestParams = new TestParams(true);
|
||||
}
|
||||
|
||||
public TestMethodCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance.HeatMeters
|
||||
{
|
||||
public partial class TestMethodCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
TestMethodCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as TestMethodCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public TestMethodCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
86
TBF/Rig/TestMethods/StandingStartMassCollectionAdvance/HeatMeters/TestMethodCfgCtrl.designer.cs
generated
Normal file
86
TBF/Rig/TestMethods/StandingStartMassCollectionAdvance/HeatMeters/TestMethodCfgCtrl.designer.cs
generated
Normal file
@ -0,0 +1,86 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance.HeatMeters
|
||||
{
|
||||
partial class TestMethodCfgCtrl
|
||||
{
|
||||
/// <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(137, 57);
|
||||
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(27, 60);
|
||||
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(134, 33);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// BasicPrinterCfgCtrl
|
||||
//
|
||||
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 = "BasicPrinterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_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,198 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance.HeatMeters
|
||||
{
|
||||
public class TestParams : TestParamsBase, IParamsProvider, ITestParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestParams) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public float ErrorLimitLo; /// [%]
|
||||
public float ErrorLimitHi; /// [%]
|
||||
public bool EvaluateVolume; /// true = evaluate also the volume, false = evaluate only energy
|
||||
public float TempWarmLo; /// Low limit for warm temperature [°C]
|
||||
public float TempWarmHi; /// High limit for warm temperature [°C]
|
||||
public float TempColdLo; /// Low limit for cold temperature [°C]
|
||||
public float TempColdHi; /// High limit for cold temperature [°C]
|
||||
public bool FlowMeasuredAtHiTempPipe; /// true = flow measured at high temp. pipe, false = flow measured at low temp. pipe
|
||||
public float DeltaTempWarm;
|
||||
public float DeltaTempCold;
|
||||
public float ChangeInTimeWarm;
|
||||
public float ChangeInTimeCold;
|
||||
public string Prompt;
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
FlowMeasuredAtHiTempPipe = false;
|
||||
}
|
||||
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
Strings.Err_limit_neg_pct_chdr,
|
||||
Strings.Err_limit_pos_pct_chdr,
|
||||
Strings.Evaluate_volume,
|
||||
"T hi min",
|
||||
"T hi max",
|
||||
"T lo min",
|
||||
"T lo max",
|
||||
"Flow measured at high temp.pipe",
|
||||
"Delta T warm",
|
||||
"Delta T cold",
|
||||
"Change in time T warm",
|
||||
"Change in time T cold",
|
||||
Strings.Prompt,
|
||||
};
|
||||
public override string ParamName(int i) { return paramNames[i]; }
|
||||
public override int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public override string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return ErrorLimitLo.ToString();
|
||||
case 1: return ErrorLimitHi.ToString();
|
||||
case 2: return (EvaluateVolume ? Strings.yes : Strings.no);
|
||||
case 3: return TempWarmLo.ToString();
|
||||
case 4: return TempWarmHi.ToString();
|
||||
case 5: return TempColdLo.ToString();
|
||||
case 6: return TempColdHi.ToString();
|
||||
case 7: return (FlowMeasuredAtHiTempPipe ? Strings.yes : Strings.no);
|
||||
case 8: return DeltaTempWarm.ToString();
|
||||
case 9: return DeltaTempCold.ToString();
|
||||
case 10: return ChangeInTimeWarm.ToString();
|
||||
case 11: return ChangeInTimeCold.ToString();
|
||||
case 12: return Prompt;
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: ErrorLimitLo = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
|
||||
case 1: ErrorLimitHi = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
|
||||
case 2: EvaluateVolume = strValue.Equals(Strings.yes); return CfgUpdateFlags.None;
|
||||
case 3: TempWarmLo = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
|
||||
case 4: TempWarmHi = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
|
||||
case 5: TempColdLo = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
|
||||
case 6: TempColdHi = Utils.ParseSFloat(strValue); return CfgUpdateFlags.None;
|
||||
case 7: FlowMeasuredAtHiTempPipe = strValue.Equals(Strings.yes); return CfgUpdateFlags.None;
|
||||
case 8: DeltaTempWarm = Utils.ParseUFloat(strValue); return CfgUpdateFlags.None;
|
||||
case 9: DeltaTempCold = Utils.ParseUFloat(strValue); return CfgUpdateFlags.None;
|
||||
case 10: ChangeInTimeWarm = Utils.ParseUFloat(strValue); return CfgUpdateFlags.None;
|
||||
case 11: ChangeInTimeCold = Utils.ParseUFloat(strValue); return CfgUpdateFlags.None;
|
||||
case 12: Prompt = strValue; return CfgUpdateFlags.None;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
float dummy;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
if (Utils.TryParseSFloat(strValue, out dummy)) return true;
|
||||
break;
|
||||
case 2:
|
||||
case 7:
|
||||
if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true;
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
if (Utils.TryParseUFloat(strValue, out dummy)) return true;
|
||||
break;
|
||||
case 12:
|
||||
return true;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(TestParams prms)
|
||||
{
|
||||
prms.ErrorLimitLo = ErrorLimitLo;
|
||||
prms.ErrorLimitHi = ErrorLimitHi;
|
||||
prms.EvaluateVolume = EvaluateVolume;
|
||||
prms.TempWarmLo = TempWarmLo;
|
||||
prms.TempWarmHi = TempWarmHi;
|
||||
prms.TempColdLo = TempColdLo;
|
||||
prms.TempColdHi = TempColdHi;
|
||||
prms.FlowMeasuredAtHiTempPipe = FlowMeasuredAtHiTempPipe;
|
||||
prms.DeltaTempWarm = DeltaTempWarm;
|
||||
prms.DeltaTempCold = DeltaTempCold;
|
||||
prms.ChangeInTimeWarm = ChangeInTimeWarm;
|
||||
prms.ChangeInTimeCold = ChangeInTimeCold;
|
||||
prms.Prompt = Prompt;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
TestParams pars = new TestParams();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public override void UpdateFromDbEntity(ComponentTest dbEntity)
|
||||
{
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
{
|
||||
TestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as TestParams;
|
||||
|
||||
testParamsEntity = dbEntity;
|
||||
componentName = dbEntity.CmpntName;
|
||||
test = dbEntity.Test;
|
||||
|
||||
if (tmp != null) tmp.CopyContentTo(this);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor initializes the parameters
|
||||
/// </summary>
|
||||
public TestParams()
|
||||
{
|
||||
}
|
||||
|
||||
public TestParams(bool initialize)
|
||||
{
|
||||
if (initialize) InitializeAll();
|
||||
}
|
||||
|
||||
public TestParams(ComponentTest testParamsEntity, string componentName, Test test)
|
||||
{
|
||||
this.testParamsEntity = testParamsEntity;
|
||||
this.componentName = componentName;
|
||||
this.test = test;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance.Single
|
||||
{
|
||||
public class Component : ComponentBase, GenericDevices.ITestMethod
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
|
||||
public bool DoTransitions() { return true; }
|
||||
public bool CheckDeviceCaps(Test test, OutputPath devices, out string message)
|
||||
{
|
||||
return StandingStartMassCollectionAdvanceSeq.CheckDeviceCaps(test, devices, out message);
|
||||
}
|
||||
|
||||
public Component() { }
|
||||
///
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
///
|
||||
public override void Initialize() { }
|
||||
|
||||
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
|
||||
{
|
||||
return (new StandingStartMassCollectionAdvanceSeq()).Execute(test, repetNr, isLastRepetition, false, null, DebugLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Rig.Configs.NameOnly;
|
||||
|
||||
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvance.Single
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(8); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(20).Replace(".Single", ""), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,40 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
|
||||
|
||||
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect.Single
|
||||
{
|
||||
public class Component : ComponentBase, GenericDevices.ITestMethod
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
|
||||
public bool DoTransitions() { return true; }
|
||||
public bool CheckDeviceCaps(Test test, OutputPath devices, out string message)
|
||||
{
|
||||
return StandingStartMassCollectionAdvanceCollectSeq.CheckDeviceCaps(test, devices, out message);
|
||||
}
|
||||
|
||||
public Component() { }
|
||||
///
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
///
|
||||
public override void Initialize() { }
|
||||
|
||||
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
|
||||
{
|
||||
return (new StandingStartMassCollectionAdvanceCollectSeq()).Execute(test, repetNr, isLastRepetition, DebugLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Rig.Configs.NameOnly;
|
||||
|
||||
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect.Single
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(8); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(20).Replace(".Single", ""), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,396 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.UiBridge;
|
||||
|
||||
namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
|
||||
{
|
||||
public class StandingStartMassCollectionAdvanceCollectSeq : Sequences.SequenceBase
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(StandingStartMassCollectionAdvanceCollectSeq));
|
||||
|
||||
/// <summary>
|
||||
/// Check capabilities of devces in the output path required for this test method
|
||||
/// </summary>
|
||||
/// <param name="devices">Devices</param>
|
||||
/// <returns>true when capabilities of devices are OK</returns>
|
||||
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
|
||||
{
|
||||
if (!(StateMachine.ControlBoardMain is ControlBoard.Papouch.PapouchCB) &&
|
||||
!(StateMachine.ControlBoardMain is ControlBoard.Uni.UniCB))
|
||||
{
|
||||
/// Control board does not support this method
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.Scale is IScale))
|
||||
{
|
||||
/// Scale is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_scale);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (test.Volume > devices.Scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
/// Scale capacity is not sufficient
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Test_volume_exceeds_the_scale_capacity);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.Diverter is IDiverter))
|
||||
{
|
||||
/// Diverter is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_diverter);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.FlowMeter is IFlowMeter))
|
||||
{
|
||||
/// Flow meter is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_flow_meter);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||
{
|
||||
/// Regulation valve is missing
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||
return false;
|
||||
}
|
||||
|
||||
message = string.Empty;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fixed start mass collection method sequence
|
||||
/// </summary>
|
||||
/// <param name="test">Test entity</param>
|
||||
/// <returns>
|
||||
/// Event.Done . . . . . . . OK
|
||||
/// Event.MakeSecondPass . . OK, 2nd pass (=evaluation) required
|
||||
/// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
|
||||
/// Event.OpArgumentError . Target flow is out of range
|
||||
/// Event.Error . . . . . . Unspecified error
|
||||
/// </returns>
|
||||
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
|
||||
Common.DebugMode debugLevel)
|
||||
{
|
||||
ControlBoard.IControlBoard cBrd = StateMachine.ControlBoardMain;
|
||||
IScale scale = cBrd.Devices.Scale as IScale;
|
||||
|
||||
if ((outPath.FlowMeter is IFlowMeterSingle) &&
|
||||
(outPath.FlowMeter as IFlowMeterSingle).GetRange(test.TempLimLo, test.TempLimHi) == -1)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
|
||||
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
|
||||
}
|
||||
|
||||
IList<Event> e; /// Events from currently running operations
|
||||
int waterMetersCount = Math.Min(BenchInfo.WaterMetersCount, sensPath.RegisterReaders.Length);
|
||||
DateTimeBox timeStampStart = new DateTimeBox();
|
||||
DateTimeBox timeStampEnd = new DateTimeBox();
|
||||
FloatBox startSwitchTime = new FloatBox();
|
||||
FloatBox stopSwitchTime = new FloatBox();
|
||||
int tMass1 = 0;
|
||||
int tMass2 = 0;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
log.DebugFormat("WaitRunDevsRunOps - initialisation");
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
log.DebugFormat("WaitRunDevsRunOps - initialisation done");
|
||||
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
log.DebugFormat("ControlBoard.Uni.UniCB - initialisation done");
|
||||
|
||||
|
||||
|
||||
Event retVal = Event.Done;
|
||||
|
||||
int totalPulses = Convert.ToInt32(test.Volume / outPath.FlowMeter.LtrPerPulse);
|
||||
|
||||
///============================================================================================
|
||||
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
log.DebugFormat("Start the test - testName: {0}, test -> name: {1} -> Repeats: {2} -> repetitionNr: {3}", testName, test.Name, test.Repeats, repetitionNr);
|
||||
|
||||
|
||||
IOperation testInProgress = cBrd.StandingStartStopTestOp(test, 2 * totalPulses, Devices.Diverter is TBF.Rig.Uni.Diverter.Diverter);
|
||||
|
||||
|
||||
///
|
||||
/// Enter water meter begin states and read the start mass at the same time
|
||||
///
|
||||
GenericDevices.IHasWMStatesForm dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
|
||||
IOperation readStartMassOp = scale.ReadStableMassOp(ref StartMass, test.TimeFlow2Mass, test.MassMethod, test.MassRepeats, test.MassSpread);
|
||||
|
||||
log.DebugFormat("Collect process - Enter watermeter end states here");
|
||||
|
||||
///
|
||||
/// Enter watermeter end states here
|
||||
///
|
||||
if (dataEntryCmpnt != null)
|
||||
{
|
||||
string fileName = string.Format("{0}-{1}-end.bmp", test.Name, repetitionNr); //string.Format("{0}-end.bmp", test.Name);
|
||||
|
||||
IValve triggerValve = null;
|
||||
bool triggerSend = false;
|
||||
if (dataEntryCmpnt is GenericDevices.IDataEntryForCamera)
|
||||
{
|
||||
string[] endImages = new string[sensPath.RegisterReaders.Length];
|
||||
|
||||
(dataEntryCmpnt as GenericDevices.IDataEntryForCamera).EndImages = endImages;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Bridge.OnActivity(this, Strings.Enter_water_meter_data);
|
||||
State state = State.Create(string.Format("{0}({1}) : Entering the end-state", test.Method, test.Name));
|
||||
|
||||
{
|
||||
state.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders,
|
||||
0, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty));
|
||||
}
|
||||
state.AddOperation(checkUiOp)
|
||||
//.AddOperations(readTempPressOps)
|
||||
.AddOperation(testInProgress)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ModelessFormClosed));
|
||||
|
||||
|
||||
|
||||
{
|
||||
for (int i = 0; i < waterMetersCount; i++)
|
||||
{
|
||||
GenericDevices.IRegReader rr = sensPath.RegisterReaders[i];
|
||||
|
||||
if (rr is Rig.RegisterReaders.StandingStartStop.RegisterReader)
|
||||
(rr as Rig.RegisterReaders.StandingStartStop.RegisterReader).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
|
||||
if (rr is Rig.Network.Camera.RoiForFixedStart.Roi)
|
||||
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
|
||||
if (rr is Rig.Network.Camera.RoiForFixedStartKeyence.Roi)
|
||||
{
|
||||
(rr as Rig.Network.Camera.RoiForFixedStartKeyence.Roi).EndWMState =
|
||||
dataEntryCmpnt.WMEndState(i);
|
||||
log.DebugFormat(" StandingStartMassCollectionAdvanceSeq.cs - EndWMState [{0}] -> RoiForFixedStartKeyence.Roi",dataEntryCmpnt.WMEndState(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dataEntryCmpnt is IDataEntryForCamera && (dataEntryCmpnt as IDataEntryForCamera).SaveImages)
|
||||
{
|
||||
log.Debug("Save images EndWMState...");
|
||||
/// SaveImages==true ... copy images to the directory that will be archived at the end of the cycle
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
{
|
||||
var roi = sensPath.RegisterReaders[i] as IRegReaderStillCamera;
|
||||
if (roi != null)
|
||||
{
|
||||
string srcDir = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
|
||||
string destDir = Path.Combine(Program.ImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
|
||||
try
|
||||
{
|
||||
if (File.Exists(Path.Combine(srcDir, fileName)))
|
||||
{
|
||||
Directory.CreateDirectory(destDir);
|
||||
string destFName = string.IsNullOrEmpty((dataEntryCmpnt as IDataEntryForCamera).TestEndImgName(i, testName))
|
||||
? fileName : (dataEntryCmpnt as IDataEntryForCamera).TestEndImgName(i, testName);
|
||||
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, destFName), true);
|
||||
log.DebugFormat("Save images sourceFile: {0}, destFile: {1} ",Path.Combine(srcDir, fileName), Path.Combine(destDir, destFName));
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Failed to copy image {0} to {1}: {2}", fileName, destDir, exc.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_completed);
|
||||
//------------------------------------------------
|
||||
|
||||
/// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
|
||||
if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest;
|
||||
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
|
||||
|
||||
bool stopCycle = false;
|
||||
if (tstRslt != null)
|
||||
{
|
||||
Results.Utils.GetCounterStates(tstRslt, Program.LocalSettings.Counters);
|
||||
|
||||
/// Raw data
|
||||
UpdateTempPressDensAmb(tstRslt);
|
||||
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
|
||||
tstRslt.StartTime = TestStartTime;
|
||||
tstRslt.EndTime = TestEndTime;
|
||||
//tstRslt.FlowSetTime = flowSetTime;
|
||||
tstRslt.TestTime = Math.Max(1.0, DateTimeBox.DurationSec(timeStampStart, timeStampEnd)); /// Min. 1s to prevent division by zero
|
||||
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.RefPulses); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.MassStartRaw = StartMass.Val;
|
||||
tstRslt.MassEndRaw = EndMass.Val;
|
||||
tstRslt.TimeBtwnMassMsrmnts = tMass2 - tMass1;
|
||||
|
||||
/// Corrected values
|
||||
//tstRslt.MassStart = massStart;
|
||||
// tstRslt.MassEnd = massEnd;
|
||||
// tstRslt.MassOfEvapWater = massOfEvaporatedWater;
|
||||
|
||||
/// Main results
|
||||
//tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
//tstRslt.Flow = 3.6 * volumeCTV / tstRslt.TestTime; /// [m3/h]
|
||||
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
/// Test bench with Uni control board and q reference flow meter
|
||||
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse;
|
||||
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.Flow, tstRslt.TempDownMean);
|
||||
tstRslt.VolumeMaster = tstRslt.ConstMasterRaw * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
|
||||
tstRslt.ConstMaster = (tstRslt.VolumeMaster != 0) ? (tstRslt.ConstMasterRaw * tstRslt.VolumeCTV / tstRslt.VolumeMaster) : tstRslt.ConstMasterCorr;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Test bench with Papouch control board without reference flow meter
|
||||
//tstRslt.VolumeMaster = volumeCTV; /// [l] volume from the master flow meter
|
||||
tstRslt.ConstMasterRaw = 1; /// Uncorrected master flowmeter coefficient
|
||||
tstRslt.ConstMasterCorr = 1; /// Corrected master pulses per liter
|
||||
tstRslt.ConstMaster = 1;
|
||||
}
|
||||
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
|
||||
|
||||
tstRslt.FlowMean = (float)RefFlowStat.Average;
|
||||
tstRslt.FlowStart = (float)RefFlowStat.First;
|
||||
tstRslt.FlowEnd = (float)RefFlowStat.Last;
|
||||
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
||||
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
||||
|
||||
tstRslt.DiverterStart = startSwitchTime.Val;
|
||||
tstRslt.DiverterEnd = stopSwitchTime.Val;
|
||||
|
||||
long infoFlags = 0;
|
||||
tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, true, startSwitchTime.Val, stopSwitchTime.Val, out infoFlags, out stopCycle) : 0;
|
||||
tstRslt.InfoFlags = infoFlags;
|
||||
|
||||
|
||||
{
|
||||
///
|
||||
/// Single meters
|
||||
///
|
||||
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
if (!test.IsPartCompatible(Utils.PartNr(i + 1, BatchRslts.Batch.Compound))) continue;
|
||||
|
||||
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Common.CompoundMeterId.Single);
|
||||
GenericDevices.IRegReader regReader = sensPath.RegisterReaders[i];
|
||||
|
||||
if (meterRslt != null && regReader != null)
|
||||
{
|
||||
meterRslt.RegReaderType = (int)regReader.RegisterReaderType;
|
||||
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
|
||||
meterRslt.VolumeStart = regReader.BeginWMState;
|
||||
meterRslt.VolumeEnd = regReader.EndWMState;
|
||||
meterRslt.VolumeMeter = Math.Abs(meterRslt.VolumeEnd - meterRslt.VolumeStart);
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV; /// liter
|
||||
meterRslt.PulsesMeter = meterRslt.VolumeMeter;
|
||||
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
|
||||
meterRslt.TestTime = tstRslt.TestTime;
|
||||
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
|
||||
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.VolumeCTV, tstRslt.TestTime) + test.Uncertainty)
|
||||
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.VolumeCTV, tstRslt.TestTime) - test.Uncertainty)
|
||||
&& (tstRslt.ErrorFlags == 0);
|
||||
meterRslt.TestDone = true;
|
||||
tstRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegValve != null ? outPath.RegValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
if (ErrorFlagsComp != null)
|
||||
{
|
||||
if (BatchRslts.Batch != null && BatchRslts.Batch.WaterMeters != null)
|
||||
{
|
||||
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
if (BatchRslts.Batch.WaterMeters[i] != null && !BatchRslts.Batch.WaterMeters[i].Disabled)
|
||||
{
|
||||
long wmInfoFlags;
|
||||
BatchRslts.Batch.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.Batch.WaterMeters[i].MeterTestRslts, out wmInfoFlags);
|
||||
BatchRslts.Batch.WaterMeters[i].InfoFlags = wmInfoFlags;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Update results
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt));
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.TransitionAfter));
|
||||
|
||||
/// Append the results to the CSV-file
|
||||
allResults.Info(TestResult2CsvLine(testName, test.Part));
|
||||
|
||||
if (stopCycle) retVal = Event.ErrorFlagsStop;
|
||||
|
||||
stopTest:
|
||||
|
||||
StopRecordingStatistics();
|
||||
|
||||
|
||||
|
||||
return new List<Event> { retVal };
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1314,6 +1314,24 @@
|
||||
<Compile Include="Rig\TestMethods\S640Communication\S640Start.cs" />
|
||||
<Compile Include="Rig\TestMethods\S640Communication\S640StartCfg.cs" />
|
||||
<Compile Include="Rig\TestMethods\S640Communication\S640StartFactory.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvanceCollect\Single\Component.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvanceCollect\Single\Factory.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvanceCollect\StandingStartMassCollectionAdvanceCollectSeq.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvance\Compound\Component.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvance\Compound\Factory.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvance\HeatMeters\Component.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvance\HeatMeters\Factory.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvance\HeatMeters\TestMethodCfg.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvance\HeatMeters\TestMethodCfgCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvance\HeatMeters\TestMethodCfgCtrl.designer.cs">
|
||||
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvance\HeatMeters\TestParams.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvance\Single\Component.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvance\Single\Factory.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollectionAdvance\StandingStartMassCollectionAdvanceSeq.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollection\Compound\Component.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollection\Compound\Factory.cs" />
|
||||
<Compile Include="Rig\TestMethods\StandingStartMassCollection\HeatMeters\Component.cs" />
|
||||
@ -3038,6 +3056,9 @@
|
||||
<EmbeddedResource Include="Rig\TestMethods\S640Communication\S640CommForm.resx">
|
||||
<DependentUpon>S640CommForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Rig\TestMethods\StandingStartMassCollectionAdvance\HeatMeters\TestMethodCfgCtrl.resx">
|
||||
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Rig\TestMethods\StandingStartMassCollection\HeatMeters\TestMethodCfgCtrl.resx">
|
||||
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user