- FlyingStart with corrections

- FlowMeterCouple -> FlowMeterTwins
This commit is contained in:
Milan Hanajik
2014-09-15 22:00:37 +02:00
parent a919a3e9d6
commit c187dc9abf
15 changed files with 132 additions and 47 deletions
@@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using log4net;
using TBF.Boxes;
namespace TBF.BenchControl.Elde.FlowMeterTwins
{
public class FlowMeter : Generic.IComponent, GenericDevices.IFlowMeter
{
/// <summary>
/// Info: StartMassMeasurement() and "Balance response = .., Mass = ..."
/// Warn: Start measurement when busy is true
/// </summary>
private static readonly ILog log = LogManager.GetLogger(typeof(FlowMeter));
public override string ToString()
{
return string.Format("FlowMeter({0})", Name);
}
public static void ResetStaticProperties() { }
FlowMeterCfg flowMeterCfg;
public Generic.IComponentCfg Cfg { get { return flowMeterCfg; } }
public string Name { get { return flowMeterCfg.Name; } }
public int Idx1 { get { return 0; } }
public IList<Entities.MeasurementCorrection> Corrections { get { return flowMeterCfg.Corrections; } }
public readonly ControlBoardDev ControlBoard;
public readonly TBF.BenchControl.Elde.FlowMeter.FlowMeter FlowMeter1;
public readonly TBF.BenchControl.Elde.FlowMeter.FlowMeter FlowMeter2;
readonly float nominalFlow;
public float NominalFlow { get { return nominalFlow; } }
/// The nominal flowed of a pair of flow meters is reached at 4000Hz
public float LtrPerPulse { get { return nominalFlow / 14400.0f; } }
/// Calculates the average of values of two flowmeters. Assumes the flow is divided evenly.
public float LtrPerPulseCorrected(float flow)
{
float flow2 = flow / 2;
return (FlowMeter1.LtrPerPulseCorrected(flow2) + FlowMeter2.LtrPerPulseCorrected(flow2)) / 2;
}
public FlowMeter(FlowMeterCfg cfg, IList<Generic.IComponent> components)
{
if (cfg == null) throw new ArgumentNullException("cfg");
this.flowMeterCfg = cfg;
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
FlowMeter1 = (TBF.BenchControl.Elde.FlowMeter.FlowMeter)TbfComponents.FindComponent(flowMeterCfg.FlowMeter1, components);
if (FlowMeter1 == null) throw new Exception("Cannot find FlowMeter1 component");
FlowMeter2 = (TBF.BenchControl.Elde.FlowMeter.FlowMeter)TbfComponents.FindComponent(flowMeterCfg.FlowMeter2, components);
if (FlowMeter2 == null) throw new Exception("Cannot find FlowMeter2 component");
nominalFlow = cfg.NominalFlow;
ControlBoard.EtCalib[Idx1] = NominalFlow;
/// Prepare data for SendCalibData() control board component method
log.Debug(this.ToString());
}
/// <summary>
/// Events: FlowDone, Error
/// </summary>
/// <param name="flow">Reference to a variable for the flow in Bar</param>
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
public IOperation ReadFlowOp(ref FloatBox flow)
{
return new ReadFlowOp(this, ref flow);
}
/// <summary>
/// Events: flowDone, Error
/// </summary>
/// <param name="flow">Reference to a variable for the flow in Bar</param>
/// <param name="flowDone">Event returned when measurement done</param>
/// <returns>ReadFlowOp instance reference casted to IOperaton</returns>
public IOperation ReadFlowOp(ref FloatBox flow, Event flowDone)
{
return new ReadFlowOp(this, ref flow, flowDone);
}
}
}
@@ -0,0 +1,62 @@
using System;
using System.IO;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.FlowMeterTwins
{
public class FlowMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg
{
public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz
public string FlowMeter1; /// Name of the flow meter 1 component
public string FlowMeter2; /// Name of the flow meter 2 component
/// Parameterless constructor
public FlowMeterCfg()
{
}
/// <summary>
/// Flow meter configuration parameters
/// </summary>
/// <param name="name">Flow meter name</param>
/// <param name="parentName">Parent component name</param>
/// <param name="nominalFlow">Nominal flow/param>
public FlowMeterCfg(IComponentFactory factory, string name, string parentName, float nominalFlow, string flowMeter1, string flowMeter2)
: base(factory, name, parentName)
{
this.NominalFlow = nominalFlow;
this.FlowMeter1 = flowMeter1;
this.FlowMeter2 = flowMeter2;
}
public IComponentCfg Clone()
{
return new FlowMeterCfg(Factory, Name, ParentName, NominalFlow, FlowMeter1, FlowMeter2);
}
public string ToString(int i)
{
return string.Format("nominalFlow={0}, flowmeter#1={1}, flowmeter#2={2}", NominalFlow, FlowMeter1, FlowMeter2);
}
public TBF.Entities.Component CreateDbEntity()
{
using (var writer = new StringWriter())
{
(new XmlSerializer(GetType())).Serialize(writer, this);
return Entities.Component.CreateFromCfg(Name, Factory.ClassName, ParentName, ItemNr, DebugLevel, LogLevel, writer.ToString());
}
}
public static IComponentCfg CreateFromDbEntity(Entities.Component component, IComponentFactory factory)
{
using (var reader = new StringReader(component.Parameters))
{
FlowMeterCfg config = (FlowMeterCfg)(new XmlSerializer(typeof(FlowMeterCfg))).Deserialize(reader);
config.InitCfgBaseFromEntity(component, factory);
return config;
}
}
}
}
@@ -0,0 +1,178 @@
namespace TBF.BenchControl.Elde.FlowMeterTwins
{
partial class FlowMeterCfgCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.parentNameLabel = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.nominalFlowTextBox = new System.Windows.Forms.TextBox();
this.nominalFlowLabel = new System.Windows.Forms.Label();
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
this.flowMeter1ComboBox = new System.Windows.Forms.ComboBox();
this.flowMeter1Label = new System.Windows.Forms.Label();
this.flowMeter2ComboBox = new System.Windows.Forms.ComboBox();
this.flowMeter2Label = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// parentNameLabel
//
this.parentNameLabel.AutoSize = true;
this.parentNameLabel.Location = new System.Drawing.Point(30, 72);
this.parentNameLabel.Name = "parentNameLabel";
this.parentNameLabel.Size = new System.Drawing.Size(69, 13);
this.parentNameLabel.TabIndex = 3;
this.parentNameLabel.Text = "Parent Name";
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(140, 43);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(30, 46);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(137, 19);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// nominalFlowTextBox
//
this.nominalFlowTextBox.Enabled = false;
this.nominalFlowTextBox.Location = new System.Drawing.Point(224, 150);
this.nominalFlowTextBox.Name = "nominalFlowTextBox";
this.nominalFlowTextBox.Size = new System.Drawing.Size(46, 20);
this.nominalFlowTextBox.TabIndex = 10;
//
// nominalFlowLabel
//
this.nominalFlowLabel.AutoSize = true;
this.nominalFlowLabel.Location = new System.Drawing.Point(30, 153);
this.nominalFlowLabel.Name = "nominalFlowLabel";
this.nominalFlowLabel.Size = new System.Drawing.Size(179, 13);
this.nominalFlowLabel.TabIndex = 9;
this.nominalFlowLabel.Text = "Sum of nominal flows [m3/h @4kHz]";
//
// parentNameComboBox
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(140, 69);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
this.parentNameComboBox.TabIndex = 4;
//
// flowMeter1ComboBox
//
this.flowMeter1ComboBox.Enabled = false;
this.flowMeter1ComboBox.FormattingEnabled = true;
this.flowMeter1ComboBox.Location = new System.Drawing.Point(140, 96);
this.flowMeter1ComboBox.Name = "flowMeter1ComboBox";
this.flowMeter1ComboBox.Size = new System.Drawing.Size(130, 21);
this.flowMeter1ComboBox.TabIndex = 6;
//
// flowMeter1Label
//
this.flowMeter1Label.AutoSize = true;
this.flowMeter1Label.Location = new System.Drawing.Point(30, 99);
this.flowMeter1Label.Name = "flowMeter1Label";
this.flowMeter1Label.Size = new System.Drawing.Size(68, 13);
this.flowMeter1Label.TabIndex = 5;
this.flowMeter1Label.Text = "Flow Meter 1";
//
// flowMeter2ComboBox
//
this.flowMeter2ComboBox.Enabled = false;
this.flowMeter2ComboBox.FormattingEnabled = true;
this.flowMeter2ComboBox.Location = new System.Drawing.Point(140, 123);
this.flowMeter2ComboBox.Name = "flowMeter2ComboBox";
this.flowMeter2ComboBox.Size = new System.Drawing.Size(130, 21);
this.flowMeter2ComboBox.TabIndex = 8;
//
// flowMeter2Label
//
this.flowMeter2Label.AutoSize = true;
this.flowMeter2Label.Location = new System.Drawing.Point(30, 126);
this.flowMeter2Label.Name = "flowMeter2Label";
this.flowMeter2Label.Size = new System.Drawing.Size(68, 13);
this.flowMeter2Label.TabIndex = 7;
this.flowMeter2Label.Text = "Flow Meter 2";
//
// FlowMeterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.flowMeter2ComboBox);
this.Controls.Add(this.flowMeter2Label);
this.Controls.Add(this.flowMeter1ComboBox);
this.Controls.Add(this.flowMeter1Label);
this.Controls.Add(this.parentNameComboBox);
this.Controls.Add(this.nominalFlowTextBox);
this.Controls.Add(this.nominalFlowLabel);
this.Controls.Add(this.parentNameLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "FlowMeterCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.FlowMeterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label parentNameLabel;
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.TextBox nominalFlowTextBox;
private System.Windows.Forms.Label nominalFlowLabel;
private System.Windows.Forms.ComboBox parentNameComboBox;
private System.Windows.Forms.ComboBox flowMeter1ComboBox;
private System.Windows.Forms.Label flowMeter1Label;
private System.Windows.Forms.ComboBox flowMeter2ComboBox;
private System.Windows.Forms.Label flowMeter2Label;
}
}
@@ -0,0 +1,114 @@
using System;
using System.Globalization;
using System.Windows.Forms;
using log4net;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.FlowMeterTwins
{
public partial class FlowMeterCfgCtrl : UserControl, IComponentCfgCtrl
{
static readonly ILog log = LogManager.GetLogger(typeof(FlowMeterCfgCtrl));
ComponentParametersDlg parent;
FlowMeterCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as FlowMeterCfg;
Redraw();
}
}
public FlowMeterCfgCtrl()
{
InitializeComponent();
}
private void FlowMeterCfgCtrl_Load(object sender, EventArgs e)
{
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
{
foreach (var cmpnt in parent.TbfComponents)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{
parentNameComboBox.Items.Add(cmpnt.Name);
}
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.FlowMeter.FlowMeterFactory)
{
flowMeter1ComboBox.Items.Add(cmpnt.Name);
flowMeter2ComboBox.Items.Add(cmpnt.Name);
}
}
}
Redraw();
}
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
flowMeter1ComboBox.Text = string.IsNullOrEmpty(config.FlowMeter1) ? "---" : config.FlowMeter1;
flowMeter2ComboBox.Text = string.IsNullOrEmpty(config.FlowMeter2) ? "---" : config.FlowMeter2;
nominalFlowTextBox.Text = config.NominalFlow.ToString();
}
public void Unlock()
{
nameTextBox.Enabled = true;
parentNameComboBox.Enabled = true;
flowMeter1ComboBox.Enabled = true;
flowMeter2ComboBox.Enabled = true;
nominalFlowTextBox.Enabled = true;
}
public CfgVerifyFlags VerifyCfg(ref string message)
{
CfgVerifyFlags flags = CfgVerifyFlags.None;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
{
flags |= CfgVerifyFlags.Error;
message += Environment.NewLine + "Invalid 'Parent Name'";
}
if (!flowMeter1ComboBox.Items.Contains(flowMeter1ComboBox.Text))
{
flags |= CfgVerifyFlags.Error;
message += Environment.NewLine + "Invalid 'Flow Meter 1'";
}
if (!flowMeter2ComboBox.Items.Contains(flowMeter2ComboBox.Text))
{
flags |= CfgVerifyFlags.Error;
message += Environment.NewLine + "Invalid 'Flow Meter 2'";
}
float fdummy;
if (!Utils.TryParseUFloat(nominalFlowTextBox.Text, out fdummy) || fdummy < 0.2 || fdummy > 1600)
{
flags |= CfgVerifyFlags.Error;
message += Environment.NewLine + "'Nominal flow' should be between 0.2 and 1600";
}
return flags;
}
public void UpdateCfg()
{
if (config == null) return; /// Control was not loaded, settings were not changed
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.FlowMeter1 = flowMeter1ComboBox.Text.Equals("---") ? string.Empty : flowMeter1ComboBox.Text;
config.FlowMeter2 = flowMeter2ComboBox.Text.Equals("---") ? string.Empty : flowMeter2ComboBox.Text;
Utils.TryParseUFloat(nominalFlowTextBox.Text, out config.NominalFlow);
}
}
}
@@ -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,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.FlowMeterTwins
{
public class FlowMeterFactory : IComponentFactory
{
public string ClassName { get { return "FlowMeterTwins"; } }
public bool HasProcedureParams { get { return false; } }
public bool HasTestParams { get { return false; } }
public IParamsProvider GetTestParams(Entities.ComponentTest testParams) { return null; }
public IParamsProvider GetProcedureParams(Entities.ComponentProcedure procedureParams) { return null; }
/// <summary>Max. number of components of this class in the system</summary>
public int MaxCount { get { return 1; } }
public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{
return new FlowMeterCfg(this, "FlowMeterTwins", "CB", 1600, "---", "---");
}
public IComponentCfgCtrl CreateCfgCtrl()
{
return new FlowMeterCfgCtrl();
}
public IComponent ComponentFromCmpntCfg(IComponentCfg config, IList<Generic.IComponent> components)
{
return new FlowMeter((FlowMeterCfg)config, components);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return FlowMeterCfg.CreateFromDbEntity(component, this);
}
public void ResetStaticProperties() { FlowMeter.ResetStaticProperties(); }
}
}
@@ -0,0 +1,66 @@
using System;
using log4net;
using TBF.Boxes;
namespace TBF.BenchControl.Elde.FlowMeterTwins
{
public class ReadFlowOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(ReadFlowOp));
public override string ToString() { return string.Format("ReadFlowOp(.,{0},{1},.)", eventDone, flowMeterNr); }
/// Set by the constructor
readonly ControlBoardDev controlBoard;
readonly int flowMeterNr;
readonly Event eventDone;
FloatBox flow;
/// <summary>
/// Events: FlowInDone, FlowOutDone or Error
/// </summary>
/// <param name="flowMeter">Flow meter reference</param>
/// <param name="flow">Reference to the measured flow variable, value is in bar</param>
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
public ReadFlowOp(FlowMeter flowMeter, ref FloatBox flow, Event eventDone)
{
if (flowMeter == null) throw new ArgumentNullException("flowMeter");
this.controlBoard = flowMeter.ControlBoard;
this.flowMeterNr = flowMeter.Idx1;
this.eventDone = eventDone;
this.flow = flow;
log.Debug(this.ToString());
}
public ReadFlowOp(FlowMeter flowMeter, ref FloatBox flow)
: this(flowMeter, ref flow, Event.FlowMeasurementDone)
{
}
/// <summary>Start this operation</summary>
public void Start()
{
}
/// <summary>Run this operation</summary>
/// <returns>
/// Event.FlowInDone or Event.FlowOutDone
/// </returns>
public Event Run()
{
if (flowMeterNr == (int)(controlBoard.StatusP & StatusP.RefFlowMeterMask))
{
flow.Val = controlBoard.ReferenceFlow;
return eventDone;
}
else
{
return Event.Error;
}
}
/// <summary>Stop this operation</summary>
public void Stop()
{
}
}
}