PumpTandem component added (to be completed), fixes in component config edit controls

This commit is contained in:
Milan Hanajik 2015-01-11 05:06:18 +01:00
parent 5a0c01688a
commit b79ae4b1aa
43 changed files with 748 additions and 79 deletions

View File

@ -55,13 +55,13 @@ namespace TBF.BenchControl.BenchId
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
///

View File

@ -73,7 +73,7 @@ namespace TBF.BenchControl.Cameras.CameraRoi
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
{
@ -93,7 +93,7 @@ namespace TBF.BenchControl.Cameras.CameraRoi
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -61,7 +61,7 @@ namespace TBF.BenchControl.Cameras.IdcCamera
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
@ -85,7 +85,7 @@ namespace TBF.BenchControl.Cameras.IdcCamera
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -56,13 +56,13 @@ namespace TBF.BenchControl.DataEntry.Munich
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -56,13 +56,13 @@ namespace TBF.BenchControl.DataEntry.Munich3
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -50,13 +50,13 @@ namespace TBF.BenchControl.DataEntry.WMStates
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -58,7 +58,7 @@ namespace TBF.BenchControl.Elde
/// <returns>See VerifyFlags</returns>
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy <= 0 || dummy > 999)
@ -75,7 +75,7 @@ namespace TBF.BenchControl.Elde
/// </summary>
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -71,7 +71,7 @@ namespace TBF.BenchControl.Elde.Diverter
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
@ -89,7 +89,7 @@ namespace TBF.BenchControl.Elde.Diverter
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -69,7 +69,7 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
{
@ -81,7 +81,7 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -74,7 +74,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
@ -98,7 +98,7 @@ namespace TBF.BenchControl.Elde.FlowMeter
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -10,7 +10,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
{
static readonly ILog log = LogManager.GetLogger(typeof(FlowMeterCfgCtrl));
ComponentParametersDlg parent;
ComponentParametersDlg parentDlg;
public bool ShowMore { get { return false; } }
@ -32,12 +32,12 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
private void FlowMeterCfgCtrl_Load(object sender, EventArgs e)
{
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
parentDlg = ParentForm as ComponentParametersDlg;
if (parentDlg == null) return;
if (parent.TbfComponents != null)
if (parentDlg.TbfComponents != null)
{
foreach (var cmpnt in parent.TbfComponents)
foreach (var cmpnt in parentDlg.TbfComponents)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.ControlBoardFactory)
{
@ -81,7 +81,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
{
@ -109,7 +109,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTwins
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -73,7 +73,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
@ -96,7 +96,7 @@ namespace TBF.BenchControl.Elde.PressureMeter
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -73,7 +73,7 @@ namespace TBF.BenchControl.Elde.Pump
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
@ -87,7 +87,7 @@ namespace TBF.BenchControl.Elde.Pump
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))

View File

@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using log4net;
namespace TBF.BenchControl.Elde.PumpTandem
{
public class Pump : ComponentBase, GenericDevices.IPumpFM, IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(Pump));
public override string ToString() { return string.Format("PumpTandem({0})", Cfg.ToString(1)); }
readonly PumpCfg pumpCfg;
readonly GenericDevices.IPump pump1;
readonly GenericDevices.IPump pump2;
public bool State { get { return pump1.State || pump2.State; } }
public int Delay { get { return Math.Max(pump1.Delay, pump2.Delay); } }
public float Power { get { return pumpCfg.TestParams.Power; } }
public Pump(PumpCfg cfg, IList<Generic.IComponent> components)
: base(cfg)
{
pumpCfg = cfg;
pump1 = (GenericDevices.IPump)TbfComponents.FindComponent(cfg.Pump1, components);
if (pump1 == null) throw new Exception("Cannot find component Pump 1");
pump2 = (GenericDevices.IPump)TbfComponents.FindComponent(cfg.Pump2, components);
if (pump2 == null) throw new Exception("Cannot find component Pump 2");
log.Debug(this.ToString());
}
public void TurnOnDfltPower()
{
// TODO
}
public void TurnOn(float powerArg)
{
// TODO
}
public void TurnOff()
{
// TODO
}
/// <summary>
/// The currently running operation.
/// </summary>
public enum CurrentOp
{
None,
TurnOnDfltPower,
TurnOn,
TurnOff,
}
///
CurrentOp currentOp;
float powerForOp;
/// <summary>
/// Turn the pump frequency inverter on.
/// </summary>
public IOperation TurnOnDfltPowerOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.TurnOnDfltPower;
return this;
}
/// <summary>
/// Turn the pump frequency inverter on.
/// </summary>
public IOperation TurnOnOp(float powerArg)
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.TurnOn;
powerForOp = powerArg;
return this;
}
/// <summary>
/// Turn the pump frequency inverter on.
/// </summary>
public IOperation TurnOffOp()
{
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.TurnOff;
return this;
}
/// <summary>Start the operation</summary>
public void Start()
{
switch (currentOp)
{
case CurrentOp.TurnOnDfltPower:
TurnOnDfltPower();
return;
case CurrentOp.TurnOn:
TurnOn(powerForOp);
return;
case CurrentOp.TurnOff:
default:
TurnOff();
return;
}
}
/// <summary>Run the operation</summary>
public Event Run()
{
return Event.TurnPumpOnOffDone;
}
/// <summary>Stop the operation</summary>
public void Stop()
{
currentOp = CurrentOp.None;
}
}
}

View File

@ -0,0 +1,53 @@
using System.IO;
using System.Collections.Generic;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.PumpTandem
{
public class PumpCfg : ComponentCfgBase, IChildComponentCfg
{
public IComponent GetComponent(IList<IComponent> components) { return new Pump(this, components); }
public IComponentCfgCtrl GetControl() { return new PumpCfgCtrl(); }
///
/// Serialized parameters
///
public string Pump1; /// Name of the pump 1 component
public string Pump2; /// Name of the pump 2 component
/// <summary> Test parameters </summary>
public PumpTestParams TestParams;
public override IParamsProvider GetTestParams() { return TestParams; }
public override IParamsProvider CreateTestParams(Entities.Test test)
{
PumpTestParams testParams = new PumpTestParams();
testParams.UpdateTestParams(Name, test);
return testParams;
}
/// Private parameterless constructor invoked by all other (public) constructors
PumpCfg()
{
Name = "PumpTandem";
ParentName = string.Empty;
Pump1 = string.Empty;
Pump2 = string.Empty;
TestParams = new PumpTestParams();
}
public PumpCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
return string.Format("Name={0}, Pump1={1}, Pump2={2}",
Name,
string.IsNullOrEmpty(Pump1) ? "-" : Pump1,
string.IsNullOrEmpty(Pump2) ? "-" : Pump2);
}
}
}

View File

@ -0,0 +1,131 @@
namespace TBF.BenchControl.Elde.PumpTandem
{
partial class PumpCfgCtrl
{
/// <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.pump2ComboBox = new System.Windows.Forms.ComboBox();
this.pump2Label = new System.Windows.Forms.Label();
this.pump1ComboBox = new System.Windows.Forms.ComboBox();
this.pump1Label = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(140, 47);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(30, 50);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(119, 21);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// pump2ComboBox
//
this.pump2ComboBox.Enabled = false;
this.pump2ComboBox.FormattingEnabled = true;
this.pump2ComboBox.Location = new System.Drawing.Point(140, 96);
this.pump2ComboBox.Name = "pump2ComboBox";
this.pump2ComboBox.Size = new System.Drawing.Size(130, 21);
this.pump2ComboBox.TabIndex = 12;
//
// pump2Label
//
this.pump2Label.AutoSize = true;
this.pump2Label.Location = new System.Drawing.Point(30, 99);
this.pump2Label.Name = "pump2Label";
this.pump2Label.Size = new System.Drawing.Size(43, 13);
this.pump2Label.TabIndex = 11;
this.pump2Label.Text = "Pump 2";
//
// pump1ComboBox
//
this.pump1ComboBox.Enabled = false;
this.pump1ComboBox.FormattingEnabled = true;
this.pump1ComboBox.Location = new System.Drawing.Point(140, 71);
this.pump1ComboBox.Name = "pump1ComboBox";
this.pump1ComboBox.Size = new System.Drawing.Size(130, 21);
this.pump1ComboBox.TabIndex = 10;
//
// pump1Label
//
this.pump1Label.AutoSize = true;
this.pump1Label.Location = new System.Drawing.Point(30, 74);
this.pump1Label.Name = "pump1Label";
this.pump1Label.Size = new System.Drawing.Size(43, 13);
this.pump1Label.TabIndex = 9;
this.pump1Label.Text = "Pump 1";
//
// PumpCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.pump2ComboBox);
this.Controls.Add(this.pump2Label);
this.Controls.Add(this.pump1ComboBox);
this.Controls.Add(this.pump1Label);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "PumpCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Load += new System.EventHandler(this.PumpCfgCtrl_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;
private System.Windows.Forms.ComboBox pump2ComboBox;
private System.Windows.Forms.Label pump2Label;
private System.Windows.Forms.ComboBox pump1ComboBox;
private System.Windows.Forms.Label pump1Label;
}
}

View File

@ -0,0 +1,104 @@
using System;
using System.Windows.Forms;
using log4net;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.PumpTandem
{
public partial class PumpCfgCtrl : UserControl, IComponentCfgCtrl
{
static readonly ILog log = LogManager.GetLogger(typeof(PumpCfgCtrl));
ComponentParametersDlg parentDlg;
public bool ShowMore { get { return false; } }
PumpCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as PumpCfg;
Redraw();
}
}
public PumpCfgCtrl()
{
InitializeComponent();
}
private void PumpCfgCtrl_Load(object sender, EventArgs e)
{
parentDlg = ParentForm as ComponentParametersDlg;
if (parentDlg == null) return;
if (parentDlg.TbfComponents != null)
{
foreach (var cmpnt in parentDlg.TbfComponents)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.Pump.PumpFactory ||
TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.PumpWithFM.PumpFactory)
{
pump1ComboBox.Items.Add(cmpnt.Name);
pump2ComboBox.Items.Add(cmpnt.Name);
}
}
}
Redraw();
}
public void Closing()
{
}
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
pump1ComboBox.Text = string.IsNullOrEmpty(config.Pump1) ? "---" : config.Pump1;
pump2ComboBox.Text = string.IsNullOrEmpty(config.Pump2) ? "---" : config.Pump2;
}
public void Unlock()
{
nameTextBox.Enabled = true;
pump1ComboBox.Enabled = true;
pump2ComboBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (!pump1ComboBox.Items.Contains(pump1ComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Pump 1'";
}
if (!pump2ComboBox.Items.Contains(pump2ComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Pump 2'";
}
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;
config.Pump1 = pump1ComboBox.Text.Equals("---") ? string.Empty : pump1ComboBox.Text;
config.Pump2 = pump2ComboBox.Text.Equals("---") ? string.Empty : pump2ComboBox.Text;
return flags;
}
}
}

View File

@ -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>

View File

@ -0,0 +1,18 @@
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.PumpTandem
{
public class PumpFactory : IComponentFactory
{
public string ClassName { get { return "PumpTandem"; } }
public void ResetStaticProperties() { Pump.ResetStaticProperties(); }
public IComponentCfg DefaultConfig() { return new PumpCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(PumpCfg), component, this);
}
}
}

View File

@ -0,0 +1,95 @@
using System;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.Elde.PumpTandem
{
public class PumpTestParams : TestParamsBase, IParamsProvider, ITestParams
{
public float Power; /// Target=terminal flow durning detection when increasing or decreasing the flow
public override void InitializeAll()
{
Power = 50.0f;
}
string[] paramNames = new string[]
{
Strings.PowerPct,
};
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 Power.ToString("F1");
default: return string.Empty;
}
}
public void UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: Power = Utils.ParseUFloat(strValue); return;
default: return;
}
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
float dummy;
switch (i)
{
case 0:
if (Utils.TryParseUFloat(strValue, out dummy)) return true;
break;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
public override void UpdateTestParams(Entities.ComponentTest dbEntity)
{
if (dbEntity == null) return;
try
{
PumpTestParams tmp = (PumpTestParams)(new XmlSerializer(typeof(PumpTestParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
Power = tmp.Power;
}
catch
{
}
}
/// Parameterless constructor
public PumpTestParams()
{
}
public PumpTestParams(Entities.ComponentTest testParamsEntity, string componentName, Entities.Test test)
{
this.testParamsEntity = testParamsEntity;
this.componentName = componentName;
this.test = test;
}
}
}

View File

@ -30,8 +30,6 @@ namespace TBF.BenchControl.Elde.PumpWithFM
get { return (controlBoard.Route & Mask) != 0; }
}
public float powerForOp;
public Pump(PumpCfg cfg, IList<Generic.IComponent> components)
: base(cfg)
{
@ -77,7 +75,9 @@ namespace TBF.BenchControl.Elde.PumpWithFM
///
CurrentOp currentOp;
/// <summary>
float powerForOp;
/// <summary>
/// Turn the pump frequency inverter on.
/// </summary>
public IOperation TurnOnDfltPowerOp()

View File

@ -75,7 +75,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
@ -90,7 +90,7 @@ namespace TBF.BenchControl.Elde.PumpWithFM
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))

View File

@ -71,7 +71,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
@ -89,7 +89,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -96,7 +96,7 @@ namespace TBF.BenchControl.Elde.RegulValve
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
@ -142,35 +142,35 @@ namespace TBF.BenchControl.Elde.RegulValve
if (!config.Name.Equals(nameTextBox.Text))
{
config.Name = nameTextBox.Text;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= CfgUpdateFlags.RestartRqrd;
}
string parentname = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
if (!config.ParentName.Equals(parentname))
{
config.ParentName = parentname;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= CfgUpdateFlags.RestartRqrd;
}
int tmp = int.Parse(positionTextBox.Text);
if (config.Idx1 != tmp)
{
config.Idx1 = tmp;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= CfgUpdateFlags.RestartRqrd;
}
tmp = int.Parse(dacClosedTextBox.Text);
if (config.DacValueClosed != tmp)
{
config.DacValueClosed = tmp;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= CfgUpdateFlags.RestartRqrd;
}
tmp = int.Parse(dacOpenTextBox.Text);
if (config.DacValueOpen != tmp)
{
config.DacValueOpen = tmp;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= CfgUpdateFlags.RestartRqrd;
}
tmp = int.Parse(stableTimeTextBox.Text);
@ -184,7 +184,7 @@ namespace TBF.BenchControl.Elde.RegulValve
if (config.StoredPositionReuse != btmp)
{
config.StoredPositionReuse = btmp;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= CfgUpdateFlags.RestartRqrd;
}
tmp = int.Parse(flowStableSecTextBox.Text);

View File

@ -82,7 +82,7 @@ namespace TBF.BenchControl.Elde.TempMeter
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
@ -132,7 +132,7 @@ namespace TBF.BenchControl.Elde.TempMeter
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -97,7 +97,7 @@ namespace TBF.BenchControl.Elde.Valve
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
@ -123,7 +123,7 @@ namespace TBF.BenchControl.Elde.Valve
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))

View File

@ -8,5 +8,10 @@ namespace TBF.BenchControl.GenericDevices
/// Pump state: true = on, false = off
/// </summary>
bool State { get; }
}
/// <summary>
/// Delay of the valve in [s] (open or close time, whichever is larger)
/// </summary>
int Delay { get; }
}
}

View File

@ -124,7 +124,7 @@ namespace TBF.BenchControl.Greco
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
@ -141,7 +141,7 @@ namespace TBF.BenchControl.Greco
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999)

View File

@ -131,7 +131,7 @@ namespace TBF.BenchControl.MettlerToledo
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!int.TryParse(comPortNrTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
@ -171,7 +171,7 @@ namespace TBF.BenchControl.MettlerToledo
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -50,13 +50,13 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -50,13 +50,13 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -50,13 +50,13 @@ namespace TBF.BenchControl.ResultsWriters.Basic
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -25,7 +25,8 @@ namespace TBF.BenchControl
Factories.Add(new Elde.PressureMeter.PressureMeterFactory());
Factories.Add(new Elde.Pump.PumpFactory());
Factories.Add(new Elde.PumpWithFM.PumpFactory());
Factories.Add(new Elde.RegisterReader.RegisterReaderFactory());
Factories.Add(new Elde.PumpTandem.PumpFactory());
Factories.Add(new Elde.RegisterReader.RegisterReaderFactory());
Factories.Add(new Elde.RegulValve.RegulValveFactory());
Factories.Add(new Elde.TempMeter.TempMeterFactory());
Factories.Add(new Elde.Valve.ValveFactory());

View File

@ -50,13 +50,13 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -50,13 +50,13 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -50,13 +50,13 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -50,13 +50,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -50,13 +50,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -50,13 +50,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -50,13 +50,13 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -52,13 +52,13 @@ namespace TBF.BenchControl.WaterMeter
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.AnyChange;
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed

View File

@ -135,7 +135,7 @@ namespace TBF
if (debugCB.Text.Equals(level.ToString()))
{
cmpnt.Mode = level;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= CfgUpdateFlags.RestartRqrd;
return;
}
}
@ -148,7 +148,7 @@ namespace TBF
if (logCB.Text.Equals(level.ToString()))
{
cmpnt.Logging = level;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
flags |= CfgUpdateFlags.RestartRqrd;
return;
}
}
@ -253,6 +253,7 @@ namespace TBF
dr = cfgForm.ShowDialog();
if (dr != DialogResult.OK) return;
flags |= CfgUpdateFlags.RestartRqrd;
AddOne(cfgForm.Config.CreateDbEntity());
}

View File

@ -248,6 +248,16 @@
</Compile>
<Compile Include="BenchControl\Elde\FlowMeterTwins\FlowMeterFactory.cs" />
<Compile Include="BenchControl\Elde\FlowMeterTwins\ReadFlowOp.cs" />
<Compile Include="BenchControl\Elde\PumpTandem\PumpTestParams.cs" />
<Compile Include="BenchControl\Elde\PumpTandem\Pump.cs" />
<Compile Include="BenchControl\Elde\PumpTandem\PumpCfg.cs" />
<Compile Include="BenchControl\Elde\PumpTandem\PumpCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BenchControl\Elde\PumpTandem\PumpCfgCtrl.designer.cs">
<DependentUpon>PumpCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Elde\PumpTandem\PumpFactory.cs" />
<Compile Include="BenchControl\Elde\PumpWithFM\FMPumpTestParams.cs" />
<Compile Include="BenchControl\Elde\PumpWithFM\Pump.cs" />
<Compile Include="BenchControl\Elde\PumpWithFM\PumpCfg.cs" />
@ -994,6 +1004,9 @@
<EmbeddedResource Include="BenchControl\Elde\PressureMeter\PressureMeterCfgCtrl.resx">
<DependentUpon>PressureMeterCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Elde\PumpTandem\PumpCfgCtrl.resx">
<DependentUpon>PumpCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Elde\PumpWithFM\PumpCfgCtrl.resx">
<DependentUpon>PumpCfgCtrl.cs</DependentUpon>
</EmbeddedResource>