PMaxTest and LeakTest methods implemented, added to the project

Order of two new test wizard dialog exchanged
Pressure Selection wizard dialog added
This commit is contained in:
Milan Hanajik 2015-02-19 08:37:37 +01:00
parent 93fd6a4f42
commit b07c7c5c9d
30 changed files with 2176 additions and 100 deletions

View File

@ -1,6 +1,7 @@
- dokoncenie process obrazovky
- brat desatinnu bodku aj ciarku
- dat zapamatanie polohy RV do Parametrov
- moznost prepinania klapky to Transition sekvencii (aby sa dala kontrolovat tesnost ventilov)
- Transitions sa nedaju vymazat
- kroky v transitions sa nedaju vymazat

View File

@ -31,8 +31,10 @@ namespace TBF.BenchControl
Factories.Add(new DataEntry.WMStates.EntryFormFactory());
Factories.Add(new Greco.AmbientFactory());
Factories.Add(new Cameras.IdcCamera.IdcCameraFactory());
Factories.Add(new TestMethods.LeakTest.TestMethodFactory());
Factories.Add(new MettlerToledo.BalanceFactory());
Factories.Add(new MettlerToledo.BalanceNewFactory());
Factories.Add(new TestMethods.PMaxTest.TestMethodFactory());
Factories.Add(new Elde.PressureMeter.PressureMeterFactory());
Factories.Add(new Elde.Pump.PumpFactory());
Factories.Add(new Danfoss.VLT2800.PumpFactory());

View File

@ -0,0 +1,114 @@
using System;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.TestMethods.LeakTest
{
public class LeakTestParams : TestParamsBase, IParamsProvider, ITestParams
{
public float PressureLo; /// Presure range low limit in bar
public float PressureHi; /// Presure range high limit in bar
public int Duration; /// Duration of the test in [s]
public override void InitializeAll()
{
PressureLo = 1.0f;
PressureHi = 2.0f;
Duration = 10;
}
string[] paramNames = new string[]
{
Strings.PressureLo_bar,
Strings.PressureHi_bar,
Strings.Duration_s,
};
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 PressureLo.ToString();
case 1: return PressureHi.ToString();
case 2: return Duration.ToString();
default: return string.Empty;
}
}
public void UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: PressureLo = Utils.ParseUFloat(strValue); return;
case 1: PressureHi = Utils.ParseSFloat(strValue); return;
case 2: Duration = int.Parse(strValue); return;
default: return;
}
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
float dummy;
int iDummy;
switch (i)
{
case 0:
case 1:
if (Utils.TryParseUFloat(strValue, out dummy)) return true;
break;
case 2:
if (int.TryParse(strValue, out iDummy)) 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
{
LeakTestParams tmp = (LeakTestParams)(new XmlSerializer(typeof(LeakTestParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
PressureLo = tmp.PressureLo;
PressureHi = tmp.PressureHi;
Duration = tmp.Duration;
}
catch
{
}
}
/// <summary>
/// Parameterless constructor initializes the parameters
/// </summary>
public LeakTestParams()
{
}
public LeakTestParams(Entities.ComponentTest testParamsEntity, string componentName, Entities.Test test)
{
this.testParamsEntity = testParamsEntity;
this.componentName = componentName;
this.test = test;
}
}
}

View File

@ -0,0 +1,277 @@
using System;
using System.Collections.Generic;
using System.Text;
using log4net;
using TBF.BenchControl;
using TBF.Boxes;
using TBF.Resources;
using TBF.UiBridge;
namespace TBF.BenchControl.TestMethods.LeakTest
{
public class LeakTestSeq : Sequences.SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(LeakTestSeq));
/// <summary>
/// Flying start mass collection method sequence
/// </summary>
/// <param name="test">Test entity</param>
/// <returns>
/// Event.Done . . . . . . . OK
/// 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(Entities.Test test, LeakTestParams testParams)
{
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
IList<Event> e = new List<Event>(); /// Events from currently running operations
Event retVal = Event.Done;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
ltrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
/// Notes:
/// float timeHr = volumeLtr / (1000.0f * targetFlow);
/// float timeSec = 3600.0f * timeHr;
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / ltrPerRefPulse + 0.5f);
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this);
int repetitionNr = 1; /// First test: repetitionNr=1
//====================================
// Transition or SetRoute - Start
//====================================
switch (Transition(transitionStart, TransitionContext.TestStart))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
}
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
Entities.TestResult tstRslt = new Entities.TestResult(test, repetitionNr, Entities.MetersKind.Single);
//------------------------------------------------
Bridge.OnActivity(this, Strings.Starting_the_pump);
//------------------------------------------------
int flowSetTime0 = StateMachine.Time;
float estFlowSetTime = 10.0f;
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create("LeakTest : Starting the pump")
.AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
.AddOperation(outPath.TempDiv.ReadTempOp(ref tempDiv))
.AddOperation(benchPath.PressIn.ReadPressureOp(ref pressIn))
.AddOperation(benchPath.PressOut.ReadPressureOp(ref pressOut))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_water_pressure);
//------------------------------------------------
const float pumpPowerStep = 3.0f;
float pumpPower = test.PumpPower;
int startTime = StateMachine.Time;
do
{
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(pumpPower);
State.Create("LeakTest : Setting the water pressure")
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
.AddOperation(outPath.TempDiv.ReadTempOp(ref tempDiv))
.AddOperation(benchPath.PressIn.ReadPressureOp(ref pressIn))
.AddOperation(benchPath.PressOut.ReadPressureOp(ref pressOut))
.AddOperation(new Operations.TimerOp(5))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto pressure_set;
}
while (e.Contains(Event.TimerBusy));
UiBridge.Bridge.OnLog(this, string.Format("time = {0}, pump_power = {1}%, pressure_up = {2}, pressure_down = {3}\r\n",
StateMachine.Time - startTime,
pumpPower.ToString("F0"),
pressIn.Val.ToString("F3"),
pressIn.Val.ToString("F3")));
if (pumpPower == 100.0f) break; /// Already at the max.pump power
pumpPower += pumpPowerStep;
if (pumpPower >= 100.0f) pumpPower = 100.0f; /// Max. 100%
}
while (testParams.PressureLo <= pressOut.Val && pressOut.Val <= testParams.PressureHi);
pressure_set:
int time = StateMachine.Time;
tstRslt.TimeStart = DateTime.Now;
ResetAveragedData();
bool firstTime = true;
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------
State.Create("LeakTest : Starting the test")
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
.AddOperation(outPath.TempDiv.ReadTempOp(ref tempDiv))
.AddOperation(benchPath.PressIn.ReadPressureOp(ref pressIn))
.AddOperation(benchPath.PressOut.ReadPressureOp(ref pressOut))
.AddOperation(new Operations.TimerOp(testParams.Duration))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
if (firstTime)
{
firstTime = false; /// Do the following only once
tstRslt.TempInStart = tempIn.Val;
tstRslt.TempOutStart = tempOut.Val;
tstRslt.TempDivStart = tempDiv.Val;
tstRslt.PressInStart = pressIn.Val;
tstRslt.PressOutStart = pressOut.Val;
}
tstRslt.TempInEnd = tempIn.Val;
tstRslt.TempOutEnd = tempOut.Val;
tstRslt.TempDivEnd = tempDiv.Val;
tstRslt.PressInEnd = pressIn.Val;
tstRslt.PressOutEnd = pressOut.Val;
tstRslt.MassEndRaw = mass.Val;
AccumulateAveragedData();
}
while (e.Contains(Event.TimerBusy));
/// Measurement loop - end
test_completed:
//------------------------------------------------
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 (cycleBeginFormOpened)
{
cycleBeginFormOpened = false;
if (CloseCycleBeginForm()) goto stopTest;
}
///
/// Populate TestResult data entity with data
///
UpdateTestRsltWithAveragedData(tstRslt);
tstRslt.TimeEnd = DateTime.Now;
tstRslt.BatchNr = Program.LocalSettings.BatchNr;
tstRslt.MassStart = 0;
tstRslt.MassEnd = 0;
tstRslt.MassDiff = 0;
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
tstRslt.Time = testParams.Duration; /// [s] measurement time
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 0; /// [l/h]
tstRslt.PulsesMaster = 0; /// Pulses of the master flow meter (test total)
tstRslt.VolumeMaster = 0; /// [l] volume from the master flow meter
tstRslt.ConstMaster = 0; /// Convert the flow to [m3/h]
tstRslt.VolumeCTV = 0; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0;
tstRslt.TimeDivStart0 = 0;
tstRslt.TimeDivStart1 = 0;
tstRslt.TimeDivStart2 = 0;
tstRslt.TimeDivStart3 = 0;
tstRslt.TimeDivStart4 = 0;
tstRslt.TimeDivStart5 = 0;
tstRslt.TimeDivEnd0 = 0;
tstRslt.TimeDivEnd1 = 0;
tstRslt.TimeDivEnd2 = 0;
tstRslt.TimeDivEnd3 = 0;
tstRslt.TimeDivEnd4 = 0;
tstRslt.TimeDivEnd5 = 0;
for (int i = 0; i < Program.WMsCount; i++)
{
if (sensPath.RegisterReaders[i] != null)
{
tstRslt.Meters[i].SerialNr = (WaterMeters.Count > i) ? WaterMeters[i].SerialNr : string.Empty;
tstRslt.Meters[i].VolumeStart = 0;
tstRslt.Meters[i].VolumeEnd = 0;
tstRslt.Meters[i].VolumeMeter = 0;
tstRslt.Meters[i].VolumeRef = 0;
tstRslt.Meters[i].PulsesMeter = 0;
tstRslt.Meters[i].PulsesMaster = 0;
tstRslt.Meters[i].Time = testParams.Duration;
tstRslt.Meters[i].VolumeErrorPct= 0;
tstRslt.Meters[i].Passed = true;
}
}
/// Add data - end
AddOrOverwriteResult(tstRslt);
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(tstRslt));
/// Append the results to the CSV-file
allResults.Info(TestResult2CsvLine(tstRslt));
stopTest:
///----------------------///
/// Quit this sequence ///
///----------------------///
State.Create("LeakTest : Stopping diverter, gate, etc.")
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.PreviousStopped));
/// Transition sequence at the end of test
/// Prevent overwriting 'retVal' in case it was set to non-default value earlier
switch (Transition(transitionStop, TransitionContext.TestEnd))
{
case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
}
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
}
}
}

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using log4net;
using TBF.BenchControl;
namespace TBF.BenchControl.TestMethods.LeakTest
{
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
public override string ToString() { return string.Format("TestMethods.LeakTest({0})", Cfg.ToString(1)); }
readonly TestMethodCfg testMethodCfg;
public bool Evaluate { get { return true; } }
public bool Publish { get { return true; } }
public bool CanTest(Entities.MetersKind meters) { return true; }
public TestMethod(TestMethodCfg cfg)
: base(cfg)
{
testMethodCfg = cfg;
log.Debug(this.ToString());
}
public IList<Event> Execute(Entities.Test test)
{
return (new LeakTestSeq()).Execute(test, testMethodCfg.TestParams);
}
}
}

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.LeakTest
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public IComponent GetComponent(IList<IComponent> components) { return new TestMethod(this); }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// <summary> Test parameters </summary>
[XmlIgnore]
public LeakTestParams TestParams;
public override IParamsProvider GetTestParams() { return TestParams; }
public override IParamsProvider CreateTestParams(Entities.Test test)
{
LeakTestParams testParams = new LeakTestParams();
testParams.UpdateTestParams(Name, test);
return testParams;
}
/// Private parameterless constructor invoked by all other (public) constructors
TestMethodCfg()
{
Name = "Leak-Test";
ParentName = string.Empty;
TestParams = new LeakTestParams();
}
public TestMethodCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
return string.Format("Name={0}", Name);
}
}
}

View File

@ -0,0 +1,68 @@
using System;
using System.Windows.Forms;
using log4net;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.LeakTest
{
public partial class TestMethodCfgCtrl : UserControl, IComponentCfgCtrl
{
static readonly ILog log = LogManager.GetLogger(typeof(TestMethodCfgCtrl));
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;
}
}
}

View File

@ -0,0 +1,83 @@
namespace TBF.BenchControl.TestMethods.LeakTest
{
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;
}
}

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.TestMethods.LeakTest
{
public class TestMethodFactory : IComponentFactory
{
public string ClassName { get { return "Leak-Test"; } }
public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
}
}
}

View File

@ -0,0 +1,114 @@
using System;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.TestMethods.PMaxTest
{
public class PMaxTestParams : TestParamsBase, IParamsProvider, ITestParams
{
public float PressureLo; /// Presure range low limit in bar
public float PressureHi; /// Presure range high limit in bar
public int Duration; /// Duration of the test in [s]
public override void InitializeAll()
{
PressureLo = 1.0f;
PressureHi = 2.0f;
Duration = 10;
}
string[] paramNames = new string[]
{
Strings.PressureLo_bar,
Strings.PressureHi_bar,
Strings.Duration_s,
};
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 PressureLo.ToString();
case 1: return PressureHi.ToString();
case 2: return Duration.ToString();
default: return string.Empty;
}
}
public void UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: PressureLo = Utils.ParseUFloat(strValue); return;
case 1: PressureHi = Utils.ParseSFloat(strValue); return;
case 2: Duration = int.Parse(strValue); return;
default: return;
}
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
float dummy;
int iDummy;
switch (i)
{
case 0:
case 1:
if (Utils.TryParseUFloat(strValue, out dummy)) return true;
break;
case 2:
if (int.TryParse(strValue, out iDummy)) 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
{
PMaxTestParams tmp = (PMaxTestParams)(new XmlSerializer(typeof(PMaxTestParams)))
.Deserialize(new StringReader(dbEntity.Parameters));
testParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
test = dbEntity.Test;
PressureLo = tmp.PressureLo;
PressureHi = tmp.PressureHi;
Duration = tmp.Duration;
}
catch
{
}
}
/// <summary>
/// Parameterless constructor initializes the parameters
/// </summary>
public PMaxTestParams()
{
}
public PMaxTestParams(Entities.ComponentTest testParamsEntity, string componentName, Entities.Test test)
{
this.testParamsEntity = testParamsEntity;
this.componentName = componentName;
this.test = test;
}
}
}

View File

@ -0,0 +1,277 @@
using System;
using System.Collections.Generic;
using System.Text;
using log4net;
using TBF.BenchControl;
using TBF.Boxes;
using TBF.Resources;
using TBF.UiBridge;
namespace TBF.BenchControl.TestMethods.PMaxTest
{
public class PMaxTestSeq : Sequences.SequenceBase
{
private static readonly ILog log = LogManager.GetLogger(typeof(PMaxTestSeq));
/// <summary>
/// Pressure test sequence
/// </summary>
/// <param name="test">Test entity</param>
/// <returns>
/// Event.Done . . . . . . . OK
/// 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(Entities.Test test, PMaxTestParams testParams)
{
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
IList<Event> e = new List<Event>(); /// Events from currently running operations
Event retVal = Event.Done;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
ltrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
/// Notes:
/// float timeHr = volumeLtr / (1000.0f * targetFlow);
/// float timeSec = 3600.0f * timeHr;
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / ltrPerRefPulse + 0.5f);
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this);
int repetitionNr = 1; /// First test: repetitionNr=1
//====================================
// Transition or SetRoute - Start
//====================================
switch (Transition(transitionStart, TransitionContext.TestStart))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
}
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
Entities.TestResult tstRslt = new Entities.TestResult(test, repetitionNr, Entities.MetersKind.Single);
//------------------------------------------------
Bridge.OnActivity(this, Strings.Starting_the_pump);
//------------------------------------------------
int flowSetTime0 = StateMachine.Time;
float estFlowSetTime = 10.0f;
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create("PMaxTest : Starting the pump")
.AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
.AddOperation(outPath.TempDiv.ReadTempOp(ref tempDiv))
.AddOperation(benchPath.PressIn.ReadPressureOp(ref pressIn))
.AddOperation(benchPath.PressOut.ReadPressureOp(ref pressOut))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.ValvesBusy));
//------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_water_pressure);
//------------------------------------------------
const float pumpPowerStep = 3.0f;
float pumpPower = test.PumpPower;
int startTime = StateMachine.Time;
do
{
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(pumpPower);
State.Create("PMaxTest : Setting the water pressure")
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
.AddOperation(outPath.TempDiv.ReadTempOp(ref tempDiv))
.AddOperation(benchPath.PressIn.ReadPressureOp(ref pressIn))
.AddOperation(benchPath.PressOut.ReadPressureOp(ref pressOut))
.AddOperation(new Operations.TimerOp(5))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto pressure_set;
}
while (e.Contains(Event.TimerBusy));
UiBridge.Bridge.OnLog(this, string.Format("time = {0}, pump_power = {1}%, pressure_up = {2}, pressure_down = {3}\r\n",
StateMachine.Time - startTime,
pumpPower.ToString("F0"),
pressIn.Val.ToString("F3"),
pressIn.Val.ToString("F3")));
if (pumpPower == 100.0f) break; /// Already at the max.pump power
pumpPower += pumpPowerStep;
if (pumpPower >= 100.0f) pumpPower = 100.0f; /// Max. 100%
}
while (testParams.PressureLo <= pressOut.Val && pressOut.Val <= testParams.PressureHi);
pressure_set:
int time = StateMachine.Time;
tstRslt.TimeStart = DateTime.Now;
ResetAveragedData();
bool firstTime = true;
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------
State.Create("PMaxTest : Starting the test")
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempIn.ReadTempOp(ref tempIn))
.AddOperation(benchPath.TempOut.ReadTempOp(ref tempOut))
.AddOperation(outPath.TempDiv.ReadTempOp(ref tempDiv))
.AddOperation(benchPath.PressIn.ReadPressureOp(ref pressIn))
.AddOperation(benchPath.PressOut.ReadPressureOp(ref pressOut))
.AddOperation(new Operations.TimerOp(testParams.Duration))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
if (firstTime)
{
firstTime = false; /// Do the following only once
tstRslt.TempInStart = tempIn.Val;
tstRslt.TempOutStart = tempOut.Val;
tstRslt.TempDivStart = tempDiv.Val;
tstRslt.PressInStart = pressIn.Val;
tstRslt.PressOutStart = pressOut.Val;
}
tstRslt.TempInEnd = tempIn.Val;
tstRslt.TempOutEnd = tempOut.Val;
tstRslt.TempDivEnd = tempDiv.Val;
tstRslt.PressInEnd = pressIn.Val;
tstRslt.PressOutEnd = pressOut.Val;
tstRslt.MassEndRaw = mass.Val;
AccumulateAveragedData();
}
while (e.Contains(Event.TimerBusy));
/// Measurement loop - end
test_completed:
//------------------------------------------------
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 (cycleBeginFormOpened)
{
cycleBeginFormOpened = false;
if (CloseCycleBeginForm()) goto stopTest;
}
///
/// Populate TestResult data entity with data
///
UpdateTestRsltWithAveragedData(tstRslt);
tstRslt.TimeEnd = DateTime.Now;
tstRslt.BatchNr = Program.LocalSettings.BatchNr;
tstRslt.MassStart = 0;
tstRslt.MassEnd = 0;
tstRslt.MassDiff = 0;
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
tstRslt.Time = testParams.Duration; /// [s] measurement time
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 0; /// [l/h]
tstRslt.PulsesMaster = 0; /// Pulses of the master flow meter (test total)
tstRslt.VolumeMaster = 0; /// [l] volume from the master flow meter
tstRslt.ConstMaster = 0; /// Convert the flow to [m3/h]
tstRslt.VolumeCTV = 0; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0;
tstRslt.TimeDivStart0 = 0;
tstRslt.TimeDivStart1 = 0;
tstRslt.TimeDivStart2 = 0;
tstRslt.TimeDivStart3 = 0;
tstRslt.TimeDivStart4 = 0;
tstRslt.TimeDivStart5 = 0;
tstRslt.TimeDivEnd0 = 0;
tstRslt.TimeDivEnd1 = 0;
tstRslt.TimeDivEnd2 = 0;
tstRslt.TimeDivEnd3 = 0;
tstRslt.TimeDivEnd4 = 0;
tstRslt.TimeDivEnd5 = 0;
for (int i = 0; i < Program.WMsCount; i++)
{
if (sensPath.RegisterReaders[i] != null)
{
tstRslt.Meters[i].SerialNr = (WaterMeters.Count > i) ? WaterMeters[i].SerialNr : string.Empty;
tstRslt.Meters[i].VolumeStart = 0;
tstRslt.Meters[i].VolumeEnd = 0;
tstRslt.Meters[i].VolumeMeter = 0;
tstRslt.Meters[i].VolumeRef = 0;
tstRslt.Meters[i].PulsesMeter = 0;
tstRslt.Meters[i].PulsesMaster = 0;
tstRslt.Meters[i].Time = testParams.Duration;
tstRslt.Meters[i].VolumeErrorPct= 0;
tstRslt.Meters[i].Passed = true;
}
}
/// Add data - end
AddOrOverwriteResult(tstRslt);
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(tstRslt));
/// Append the results to the CSV-file
allResults.Info(TestResult2CsvLine(tstRslt));
stopTest:
///----------------------///
/// Quit this sequence ///
///----------------------///
State.Create("PMaxTest : Stopping diverter, gate, etc.")
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.PreviousStopped));
/// Transition sequence at the end of test
/// Prevent overwriting 'retVal' in case it was set to non-default value earlier
switch (Transition(transitionStop, TransitionContext.TestEnd))
{
case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
}
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
}
}
}

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using log4net;
using TBF.BenchControl;
namespace TBF.BenchControl.TestMethods.PMaxTest
{
public class TestMethod : ComponentBase, GenericDevices.ITestMethod
{
private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod));
public override string ToString() { return string.Format("TestMethods.PMaxTest({0})", Cfg.ToString(1)); }
readonly TestMethodCfg testMethodCfg;
public bool Evaluate { get { return true; } }
public bool Publish { get { return true; } }
public bool CanTest(Entities.MetersKind meters) { return true; }
public TestMethod(TestMethodCfg cfg)
: base(cfg)
{
testMethodCfg = cfg;
log.Debug(this.ToString());
}
public IList<Event> Execute(Entities.Test test)
{
return (new PMaxTestSeq()).Execute(test, testMethodCfg.TestParams);
}
}
}

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.PMaxTest
{
public class TestMethodCfg : ComponentCfgBase, Generic.IComponentCfg
{
public IComponent GetComponent(IList<IComponent> components) { return new TestMethod(this); }
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
/// <summary> Test parameters </summary>
[XmlIgnore]
public PMaxTestParams TestParams;
public override IParamsProvider GetTestParams() { return TestParams; }
public override IParamsProvider CreateTestParams(Entities.Test test)
{
PMaxTestParams testParams = new PMaxTestParams();
testParams.UpdateTestParams(Name, test);
return testParams;
}
/// Private parameterless constructor invoked by all other (public) constructors
TestMethodCfg()
{
Name = "PMax-Test";
ParentName = string.Empty;
TestParams = new PMaxTestParams();
}
public TestMethodCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
return string.Format("Name={0}", Name);
}
}
}

View File

@ -0,0 +1,68 @@
using System;
using System.Windows.Forms;
using log4net;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.TestMethods.PMaxTest
{
public partial class TestMethodCfgCtrl : UserControl, IComponentCfgCtrl
{
static readonly ILog log = LogManager.GetLogger(typeof(TestMethodCfgCtrl));
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;
}
}
}

View File

@ -0,0 +1,83 @@
namespace TBF.BenchControl.TestMethods.PMaxTest
{
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;
}
}

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.TestMethods.PMaxTest
{
public class TestMethodFactory : IComponentFactory
{
public string ClassName { get { return "PMax-Test"; } }
public void ResetStaticProperties() { TestMethod.ResetStaticProperties(); }
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(typeof(TestMethodCfg), component, this);
}
}
}

View File

@ -1141,28 +1141,34 @@ namespace TBF
Test test = new Test(newName, listViewEx.Items.Count, LoadedProcedure);
/// Run a create new test wizard
TestWizard.FlowSelection flowDlg = new TestWizard.FlowSelection(test);
TestWizard.MethodSelection methodDlg = new TestWizard.MethodSelection(test, TestMethods, metersPaths);
TestWizard.VolumeAndErrorSelection volumeDlg = new TestWizard.VolumeAndErrorSelection(test);
TestWizard.MethodSelection methodDlg = new TestWizard.MethodSelection(true, false, test, TestMethods);
TestWizard.FlowSelection flowDlg = new TestWizard.FlowSelection(false, false, test, metersPaths);
TestWizard.VolumeAndErrorSelection volumeDlg = new TestWizard.VolumeAndErrorSelection(false, true, test);
TestWizard.PressureSelection pressureDlg = new TestWizard.PressureSelection(false, true, test);
//TestWizard.SensorsSelection sensorsDlg = new TestWizard.SensorsSelection(test);
flowLabel:
switch (flowDlg.ShowDialog())
{
case DialogResult.Cancel: return;
}
methodLabel:
switch (methodDlg.ShowDialog())
{
case DialogResult.Cancel: return;
case DialogResult.Retry: goto flowLabel;
}
ITestMethod selectedMethod = TestMethods.FirstOrDefault<ITestMethod>(x => x.Name.Equals(test.Method));
if (selectedMethod is BenchControl.TestMethods.PMaxTest.TestMethod) goto pressure_label;
if (selectedMethod is BenchControl.TestMethods.LeakTest.TestMethod) goto pressure_label;
flowLabel:
switch (flowDlg.ShowDialog())
{
case DialogResult.Cancel: return;
case DialogResult.Retry: goto methodLabel;
}
switch (volumeDlg.ShowDialog())
{
case DialogResult.Cancel: return;
case DialogResult.Retry: goto methodLabel;
case DialogResult.Retry: goto flowLabel;
}
/// Depending on the chosen Q select the paths
@ -1192,6 +1198,18 @@ namespace TBF
}
}
goto done;
pressure_label:
switch (pressureDlg.ShowDialog())
{
case DialogResult.Cancel: return;
case DialogResult.Retry: goto methodLabel;
}
done:
LoadedProcedure.Tests.Add(test);
AddToMetrology12AndProcessTab(test);
foreach (var ctrl in testParamsCtrls)

View File

@ -1401,6 +1401,24 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Pressure Hi [bar].
/// </summary>
internal static string Pressure_hi_bar {
get {
return ResourceManager.GetString("Pressure_hi_bar", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Pressure Lo [bar].
/// </summary>
internal static string Pressure_lo_bar {
get {
return ResourceManager.GetString("Pressure_lo_bar", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Pressure meter.
/// </summary>
@ -1410,6 +1428,33 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Pressure Selection.
/// </summary>
internal static string Pressure_selection {
get {
return ResourceManager.GetString("Pressure_selection", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to PreasureHi [bar].
/// </summary>
internal static string PressureHi_bar {
get {
return ResourceManager.GetString("PressureHi_bar", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to PressureLo [bar].
/// </summary>
internal static string PressureLo_bar {
get {
return ResourceManager.GetString("PressureLo_bar", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Printer.
/// </summary>
@ -1869,6 +1914,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Setting the water pressure.
/// </summary>
internal static string Setting_the_water_pressure {
get {
return ResourceManager.GetString("Setting_the_water_pressure", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Single.
/// </summary>
@ -1914,6 +1968,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Starting the pump.
/// </summary>
internal static string Starting_the_pump {
get {
return ResourceManager.GetString("Starting_the_pump", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Start valve.
/// </summary>

View File

@ -952,4 +952,25 @@
<data name="Error_pct" xml:space="preserve">
<value>Error [%]</value>
</data>
<data name="Starting_the_pump" xml:space="preserve">
<value>Starting the pump</value>
</data>
<data name="Setting_the_water_pressure" xml:space="preserve">
<value>Setting the water pressure</value>
</data>
<data name="PressureHi_bar" xml:space="preserve">
<value>PreasureHi [bar]</value>
</data>
<data name="PressureLo_bar" xml:space="preserve">
<value>PressureLo [bar]</value>
</data>
<data name="Pressure_hi_bar" xml:space="preserve">
<value>Pressure Hi [bar]</value>
</data>
<data name="Pressure_lo_bar" xml:space="preserve">
<value>Pressure Lo [bar]</value>
</data>
<data name="Pressure_selection" xml:space="preserve">
<value>Pressure Selection</value>
</data>
</root>

View File

@ -524,6 +524,28 @@
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\TestMethods\FlyingStart\TestMethodFactory.cs" />
<Compile Include="BenchControl\TestMethods\LeakTest\LeakTestSeq.cs" />
<Compile Include="BenchControl\TestMethods\LeakTest\LeakTestParams.cs" />
<Compile Include="BenchControl\TestMethods\LeakTest\TestMethod.cs" />
<Compile Include="BenchControl\TestMethods\LeakTest\TestMethodCfg.cs" />
<Compile Include="BenchControl\TestMethods\LeakTest\TestMethodCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BenchControl\TestMethods\LeakTest\TestMethodCfgCtrl.designer.cs">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\TestMethods\LeakTest\TestMethodFactory.cs" />
<Compile Include="BenchControl\TestMethods\PMaxTest\PMaxTestParams.cs" />
<Compile Include="BenchControl\TestMethods\PMaxTest\PMaxTestSeq.cs" />
<Compile Include="BenchControl\TestMethods\PMaxTest\TestMethod.cs" />
<Compile Include="BenchControl\TestMethods\PMaxTest\TestMethodCfg.cs" />
<Compile Include="BenchControl\TestMethods\PMaxTest\TestMethodCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BenchControl\TestMethods\PMaxTest\TestMethodCfgCtrl.designer.cs">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\TestMethods\PMaxTest\TestMethodFactory.cs" />
<Compile Include="BenchControl\TestMethods\ReferenceFlowmeterCalibration\ReferenceFlowmeterCalibrationSeq.cs" />
<Compile Include="BenchControl\TestMethods\ReferenceFlowmeterCalibration\TestMethod.cs" />
<Compile Include="BenchControl\TestMethods\ReferenceFlowmeterCalibration\TestMethodCfg.cs" />
@ -870,6 +892,12 @@
<Compile Include="TestWizard\MethodSelection.Designer.cs">
<DependentUpon>MethodSelection.cs</DependentUpon>
</Compile>
<Compile Include="TestWizard\PressureSelection.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="TestWizard\PressureSelection.designer.cs">
<DependentUpon>PressureSelection.cs</DependentUpon>
</Compile>
<Compile Include="TestWizard\SensorsSelection.cs">
<SubType>Form</SubType>
</Compile>
@ -1114,6 +1142,12 @@
<EmbeddedResource Include="BenchControl\TestMethods\FlyingStart\TestMethodCfgCtrl.resx">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\TestMethods\LeakTest\TestMethodCfgCtrl.resx">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\TestMethods\PMaxTest\TestMethodCfgCtrl.resx">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\TestMethods\ReferenceFlowmeterCalibration\TestMethodCfgCtrl.resx">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
@ -1283,6 +1317,9 @@
<EmbeddedResource Include="TestWizard\MethodSelection.resx">
<DependentUpon>MethodSelection.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="TestWizard\PressureSelection.resx">
<DependentUpon>PressureSelection.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="TestWizard\SensorsSelection.resx">
<DependentUpon>SensorsSelection.cs</DependentUpon>
</EmbeddedResource>

View File

@ -29,12 +29,12 @@
private void InitializeComponent()
{
this.horizSplitContainer = new System.Windows.Forms.SplitContainer();
this.sensorsComboBox = new System.Windows.Forms.ComboBox();
this.sensorsLabel = new System.Windows.Forms.Label();
this.qToTextBox = new System.Windows.Forms.TextBox();
this.qFromTextBox = new System.Windows.Forms.TextBox();
this.testNameTextBox = new System.Windows.Forms.TextBox();
this.qToLabel = new System.Windows.Forms.Label();
this.qFromLabel = new System.Windows.Forms.Label();
this.testNameLabel = new System.Windows.Forms.Label();
this.cancelButton = new System.Windows.Forms.Button();
this.nextButton = new System.Windows.Forms.Button();
this.backButton = new System.Windows.Forms.Button();
@ -54,12 +54,12 @@
//
// horizSplitContainer.Panel1
//
this.horizSplitContainer.Panel1.Controls.Add(this.sensorsComboBox);
this.horizSplitContainer.Panel1.Controls.Add(this.sensorsLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.qToTextBox);
this.horizSplitContainer.Panel1.Controls.Add(this.qFromTextBox);
this.horizSplitContainer.Panel1.Controls.Add(this.testNameTextBox);
this.horizSplitContainer.Panel1.Controls.Add(this.qToLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.qFromLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.testNameLabel);
//
// horizSplitContainer.Panel2
//
@ -70,34 +70,44 @@
this.horizSplitContainer.SplitterDistance = 182;
this.horizSplitContainer.TabIndex = 1;
//
// sensorsComboBox
//
this.sensorsComboBox.FormattingEnabled = true;
this.sensorsComboBox.Location = new System.Drawing.Point(137, 105);
this.sensorsComboBox.Name = "sensorsComboBox";
this.sensorsComboBox.Size = new System.Drawing.Size(124, 21);
this.sensorsComboBox.TabIndex = 7;
this.sensorsComboBox.SelectedIndexChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// sensorsLabel
//
this.sensorsLabel.AutoSize = true;
this.sensorsLabel.Location = new System.Drawing.Point(21, 108);
this.sensorsLabel.Name = "sensorsLabel";
this.sensorsLabel.Size = new System.Drawing.Size(45, 13);
this.sensorsLabel.TabIndex = 6;
this.sensorsLabel.Text = "Sensors";
//
// qToTextBox
//
this.qToTextBox.Location = new System.Drawing.Point(126, 86);
this.qToTextBox.Location = new System.Drawing.Point(137, 74);
this.qToTextBox.Name = "qToTextBox";
this.qToTextBox.Size = new System.Drawing.Size(97, 20);
this.qToTextBox.Size = new System.Drawing.Size(124, 20);
this.qToTextBox.TabIndex = 5;
this.qToTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// qFromTextBox
//
this.qFromTextBox.Location = new System.Drawing.Point(126, 56);
this.qFromTextBox.Location = new System.Drawing.Point(137, 44);
this.qFromTextBox.Name = "qFromTextBox";
this.qFromTextBox.Size = new System.Drawing.Size(97, 20);
this.qFromTextBox.Size = new System.Drawing.Size(124, 20);
this.qFromTextBox.TabIndex = 4;
this.qFromTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// testNameTextBox
//
this.testNameTextBox.Location = new System.Drawing.Point(126, 26);
this.testNameTextBox.Name = "testNameTextBox";
this.testNameTextBox.Size = new System.Drawing.Size(97, 20);
this.testNameTextBox.TabIndex = 3;
this.testNameTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// qToLabel
//
this.qToLabel.AutoSize = true;
this.qToLabel.Location = new System.Drawing.Point(24, 89);
this.qToLabel.Location = new System.Drawing.Point(21, 77);
this.qToLabel.Name = "qToLabel";
this.qToLabel.Size = new System.Drawing.Size(61, 13);
this.qToLabel.TabIndex = 2;
@ -106,21 +116,12 @@
// qFromLabel
//
this.qFromLabel.AutoSize = true;
this.qFromLabel.Location = new System.Drawing.Point(24, 59);
this.qFromLabel.Location = new System.Drawing.Point(21, 47);
this.qFromLabel.Name = "qFromLabel";
this.qFromLabel.Size = new System.Drawing.Size(72, 13);
this.qFromLabel.TabIndex = 1;
this.qFromLabel.Text = "Q from [m3/h]";
//
// testNameLabel
//
this.testNameLabel.AutoSize = true;
this.testNameLabel.Location = new System.Drawing.Point(24, 29);
this.testNameLabel.Name = "testNameLabel";
this.testNameLabel.Size = new System.Drawing.Size(57, 13);
this.testNameLabel.TabIndex = 0;
this.testNameLabel.Text = "Test name";
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
@ -183,10 +184,10 @@
private System.Windows.Forms.Button backButton;
private System.Windows.Forms.TextBox qToTextBox;
private System.Windows.Forms.TextBox qFromTextBox;
private System.Windows.Forms.TextBox testNameTextBox;
private System.Windows.Forms.Label qToLabel;
private System.Windows.Forms.Label qFromLabel;
private System.Windows.Forms.Label testNameLabel;
private System.Windows.Forms.ComboBox sensorsComboBox;
private System.Windows.Forms.Label sensorsLabel;
}
}

View File

@ -13,38 +13,44 @@ namespace TBF.TestWizard
public partial class FlowSelection : Form
{
Entities.Test test;
IList<Entities.MetersPath> sensorPaths;
public FlowSelection()
{
InitializeComponent();
}
public FlowSelection(Entities.Test test)
public FlowSelection(bool first, bool last,
Entities.Test test,
IList<Entities.MetersPath> sensorPaths)
: this()
{
this.test = test;
this.sensorPaths = sensorPaths;
Text = Strings.Flow_selection;
qFromLabel.Text = Strings.Q_from_m3h;
qToLabel.Text = Strings.Q_to_m3h;
sensorsLabel.Text = Strings.Sensors;
backButton.Text = Strings.BackBtnText;
nextButton.Text = Strings.NextBtnText;
cancelButton.Text = Strings.CancelBtnText;
if (first) backButton.Visible = false;
if (last) nextButton.Text = Strings.FinishBtnText;
}
private void FlowSelection_Load(object sender, EventArgs e)
{
if (test == null) return;
backButton.Visible = false;
Text = Strings.Flow_selection;
testNameLabel.Text = Strings.Test_name;
qFromLabel.Text = Strings.Q_from_m3h;
qToLabel.Text = Strings.Q_to_m3h;
backButton.Text = Strings.BackBtnText;
nextButton.Text = Strings.NextBtnText;
cancelButton.Text = Strings.CancelBtnText;
foreach (var path in sensorPaths) sensorsComboBox.Items.Add(path.Name);
RefreshWizardPage();
}
void RefreshWizardPage()
{
testNameTextBox.Text = test.Name;
qFromTextBox.Text = test.Qfrom.ToString();
qToTextBox.Text = test.Qto.ToString();
nextButton.Enabled = IsFormValid();
@ -52,16 +58,21 @@ namespace TBF.TestWizard
void UpdateTest()
{
test.Name = testNameTextBox.Text;
test.Qfrom = Utils.ParseUFloat(qFromTextBox.Text);
test.Qto = Utils.ParseUFloat(qToTextBox.Text);
if (sensorsComboBox.Items.Contains(sensorsComboBox.Text))
{
test.MetersPath = sensorsComboBox.Text;
}
}
bool IsFormValid()
{
float dummy;
return Utils.TryParseUFloat(qFromTextBox.Text, out dummy) &&
Utils.TryParseUFloat(qToTextBox.Text, out dummy);
Utils.TryParseUFloat(qToTextBox.Text, out dummy) &&
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
}
private void backButton_Click(object sender, EventArgs e)

View File

@ -29,8 +29,8 @@
private void InitializeComponent()
{
this.horizSplitContainer = new System.Windows.Forms.SplitContainer();
this.sensorsComboBox = new System.Windows.Forms.ComboBox();
this.sensorsLabel = new System.Windows.Forms.Label();
this.testNameTextBox = new System.Windows.Forms.TextBox();
this.testNameLabel = new System.Windows.Forms.Label();
this.testMethodComboBox = new System.Windows.Forms.ComboBox();
this.testMethodLabel = new System.Windows.Forms.Label();
this.cancelButton = new System.Windows.Forms.Button();
@ -52,8 +52,8 @@
//
// horizSplitContainer.Panel1
//
this.horizSplitContainer.Panel1.Controls.Add(this.sensorsComboBox);
this.horizSplitContainer.Panel1.Controls.Add(this.sensorsLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.testNameTextBox);
this.horizSplitContainer.Panel1.Controls.Add(this.testNameLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.testMethodComboBox);
this.horizSplitContainer.Panel1.Controls.Add(this.testMethodLabel);
//
@ -66,28 +66,26 @@
this.horizSplitContainer.SplitterDistance = 182;
this.horizSplitContainer.TabIndex = 0;
//
// sensorsComboBox
// testNameTextBox
//
this.sensorsComboBox.FormattingEnabled = true;
this.sensorsComboBox.Location = new System.Drawing.Point(96, 84);
this.sensorsComboBox.Name = "sensorsComboBox";
this.sensorsComboBox.Size = new System.Drawing.Size(165, 21);
this.sensorsComboBox.TabIndex = 3;
this.sensorsComboBox.TextChanged += new System.EventHandler(this.sensorsComboBox_TextChanged);
this.testNameTextBox.Location = new System.Drawing.Point(99, 47);
this.testNameTextBox.Name = "testNameTextBox";
this.testNameTextBox.Size = new System.Drawing.Size(165, 20);
this.testNameTextBox.TabIndex = 5;
//
// sensorsLabel
// testNameLabel
//
this.sensorsLabel.AutoSize = true;
this.sensorsLabel.Location = new System.Drawing.Point(12, 87);
this.sensorsLabel.Name = "sensorsLabel";
this.sensorsLabel.Size = new System.Drawing.Size(45, 13);
this.sensorsLabel.TabIndex = 2;
this.sensorsLabel.Text = "Sensors";
this.testNameLabel.AutoSize = true;
this.testNameLabel.Location = new System.Drawing.Point(15, 50);
this.testNameLabel.Name = "testNameLabel";
this.testNameLabel.Size = new System.Drawing.Size(57, 13);
this.testNameLabel.TabIndex = 4;
this.testNameLabel.Text = "Test name";
//
// testMethodComboBox
//
this.testMethodComboBox.FormattingEnabled = true;
this.testMethodComboBox.Location = new System.Drawing.Point(96, 48);
this.testMethodComboBox.Location = new System.Drawing.Point(99, 96);
this.testMethodComboBox.Name = "testMethodComboBox";
this.testMethodComboBox.Size = new System.Drawing.Size(165, 21);
this.testMethodComboBox.TabIndex = 1;
@ -96,7 +94,7 @@
// testMethodLabel
//
this.testMethodLabel.AutoSize = true;
this.testMethodLabel.Location = new System.Drawing.Point(12, 51);
this.testMethodLabel.Location = new System.Drawing.Point(15, 99);
this.testMethodLabel.Name = "testMethodLabel";
this.testMethodLabel.Size = new System.Drawing.Size(66, 13);
this.testMethodLabel.TabIndex = 0;
@ -164,7 +162,7 @@
private System.Windows.Forms.Button backButton;
private System.Windows.Forms.ComboBox testMethodComboBox;
private System.Windows.Forms.Label testMethodLabel;
private System.Windows.Forms.ComboBox sensorsComboBox;
private System.Windows.Forms.Label sensorsLabel;
private System.Windows.Forms.TextBox testNameTextBox;
private System.Windows.Forms.Label testNameLabel;
}
}

View File

@ -14,61 +14,59 @@ namespace TBF.TestWizard
{
Entities.Test test;
IList<BenchControl.GenericDevices.ITestMethod> methods;
IList<Entities.MetersPath> sensorPaths;
public MethodSelection()
{
InitializeComponent();
}
public MethodSelection(Entities.Test test,
IList<BenchControl.GenericDevices.ITestMethod> methods,
IList<Entities.MetersPath> sensorPaths)
public MethodSelection(bool first, bool last,
Entities.Test test,
IList<BenchControl.GenericDevices.ITestMethod> methods)
: this()
{
this.test = test;
this.methods = methods;
this.sensorPaths = sensorPaths;
Text = Strings.Method_selection;
testNameLabel.Text = Strings.Test_name;
testMethodLabel.Text = Strings.Test_method;
backButton.Text = Strings.BackBtnText;
nextButton.Text = Strings.NextBtnText;
cancelButton.Text = Strings.CancelBtnText;
if (first) backButton.Visible = false;
if (last) nextButton.Text = Strings.FinishBtnText;
}
private void MethodSelection_Load(object sender, EventArgs e)
{
if (test == null) return;
Text = Strings.Method_selection;
testMethodLabel.Text = Strings.Test_method;
sensorsLabel.Text = Strings.Sensors;
backButton.Text = Strings.BackBtnText;
nextButton.Text = Strings.NextBtnText;
cancelButton.Text = Strings.CancelBtnText;
foreach (var method in methods) testMethodComboBox.Items.Add(method.Cfg.Name);
foreach (var path in sensorPaths) sensorsComboBox.Items.Add(path.Name);
RefreshWizardPage();
}
void RefreshWizardPage()
{
testNameTextBox.Text = test.Name;
nextButton.Enabled = IsFormValid();
}
void UpdateTest()
{
test.Name = testNameTextBox.Text;
if (testMethodComboBox.Items.Contains(testMethodComboBox.Text))
{
test.Method = testMethodComboBox.Text;
}
if (sensorsComboBox.Items.Contains(sensorsComboBox.Text))
{
test.MetersPath = sensorsComboBox.Text;
}
}
bool IsFormValid()
{
return testMethodComboBox.Items.Contains(testMethodComboBox.Text) &&
sensorsComboBox.Items.Contains(sensorsComboBox.Text);
return testMethodComboBox.Items.Contains(testMethodComboBox.Text);
}
private void backButton_Click(object sender, EventArgs e)

View File

@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TBF.Resources;
namespace TBF.TestWizard
{
public partial class PressureSelection : Form
{
Entities.Test test;
public PressureSelection()
{
InitializeComponent();
}
public PressureSelection(bool first, bool last, Entities.Test test)
: this()
{
this.test = test;
Text = Strings.Pressure_selection;
pressureLoLabel.Text = Strings.Pressure_lo_bar;
pressureHiLabel.Text = Strings.Pressure_hi_bar;
durationLabel.Text = Strings.Duration_s;
backButton.Text = Strings.BackBtnText;
nextButton.Text = Strings.NextBtnText;
cancelButton.Text = Strings.CancelBtnText;
if (first) backButton.Visible = false;
if (last) nextButton.Text = Strings.FinishBtnText;
}
private void FlowSelection_Load(object sender, EventArgs e)
{
if (test == null) return;
RefreshWizardPage();
}
void RefreshWizardPage()
{
pressureLoTextBox.Text = 1.0f.ToString(); /// TODO: replace constants
pressureHiTextBox.Text = 2.0f.ToString();
durationTextBox.Text = 10.ToString();
nextButton.Enabled = IsFormValid();
}
void UpdateTest()
{
/// TODO: complete
//test.Qfrom = Utils.ParseUFloat(pressureLoTextBox.Text);
//test.Qto = Utils.ParseUFloat(pressureHiTextBox.Text);
//test.TstTime = int.Parse(durationTextBox.Text);
}
bool IsFormValid()
{
float dummy;
int iDummy;
return Utils.TryParseUFloat(pressureLoTextBox.Text, out dummy) &&
Utils.TryParseUFloat(pressureHiTextBox.Text, out dummy) &&
int.TryParse(durationTextBox.Text, out iDummy);
}
private void backButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Retry;
Close();
}
private void nextButton_Click(object sender, EventArgs e)
{
if (test != null && IsFormValid())
{
UpdateTest();
DialogResult = DialogResult.OK;
Close();
}
else
{
DialogResult = DialogResult.None;
}
}
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void anyTextBox_TextChanged(object sender, EventArgs e)
{
nextButton.Enabled = IsFormValid();
}
}
}

View File

@ -0,0 +1,191 @@
namespace TBF.TestWizard
{
partial class PressureSelection
{
/// <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 Windows Form 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.horizSplitContainer = new System.Windows.Forms.SplitContainer();
this.durationTextBox = new System.Windows.Forms.TextBox();
this.durationLabel = new System.Windows.Forms.Label();
this.pressureHiTextBox = new System.Windows.Forms.TextBox();
this.pressureLoTextBox = new System.Windows.Forms.TextBox();
this.pressureHiLabel = new System.Windows.Forms.Label();
this.pressureLoLabel = new System.Windows.Forms.Label();
this.cancelButton = new System.Windows.Forms.Button();
this.nextButton = new System.Windows.Forms.Button();
this.backButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).BeginInit();
this.horizSplitContainer.Panel1.SuspendLayout();
this.horizSplitContainer.Panel2.SuspendLayout();
this.horizSplitContainer.SuspendLayout();
this.SuspendLayout();
//
// horizSplitContainer
//
this.horizSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.horizSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.horizSplitContainer.Location = new System.Drawing.Point(0, 0);
this.horizSplitContainer.Name = "horizSplitContainer";
this.horizSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// horizSplitContainer.Panel1
//
this.horizSplitContainer.Panel1.Controls.Add(this.durationTextBox);
this.horizSplitContainer.Panel1.Controls.Add(this.durationLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.pressureHiTextBox);
this.horizSplitContainer.Panel1.Controls.Add(this.pressureLoTextBox);
this.horizSplitContainer.Panel1.Controls.Add(this.pressureHiLabel);
this.horizSplitContainer.Panel1.Controls.Add(this.pressureLoLabel);
//
// horizSplitContainer.Panel2
//
this.horizSplitContainer.Panel2.Controls.Add(this.cancelButton);
this.horizSplitContainer.Panel2.Controls.Add(this.nextButton);
this.horizSplitContainer.Panel2.Controls.Add(this.backButton);
this.horizSplitContainer.Size = new System.Drawing.Size(284, 262);
this.horizSplitContainer.SplitterDistance = 182;
this.horizSplitContainer.TabIndex = 1;
//
// durationTextBox
//
this.durationTextBox.Location = new System.Drawing.Point(136, 103);
this.durationTextBox.Name = "durationTextBox";
this.durationTextBox.Size = new System.Drawing.Size(125, 20);
this.durationTextBox.TabIndex = 7;
//
// durationLabel
//
this.durationLabel.AutoSize = true;
this.durationLabel.Location = new System.Drawing.Point(21, 106);
this.durationLabel.Name = "durationLabel";
this.durationLabel.Size = new System.Drawing.Size(83, 13);
this.durationLabel.TabIndex = 6;
this.durationLabel.Text = "Test duration [s]";
//
// pressureHiTextBox
//
this.pressureHiTextBox.Location = new System.Drawing.Point(137, 74);
this.pressureHiTextBox.Name = "pressureHiTextBox";
this.pressureHiTextBox.Size = new System.Drawing.Size(124, 20);
this.pressureHiTextBox.TabIndex = 5;
this.pressureHiTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// pressureLoTextBox
//
this.pressureLoTextBox.Location = new System.Drawing.Point(137, 44);
this.pressureLoTextBox.Name = "pressureLoTextBox";
this.pressureLoTextBox.Size = new System.Drawing.Size(124, 20);
this.pressureLoTextBox.TabIndex = 4;
this.pressureLoTextBox.TextChanged += new System.EventHandler(this.anyTextBox_TextChanged);
//
// pressureHiLabel
//
this.pressureHiLabel.AutoSize = true;
this.pressureHiLabel.Location = new System.Drawing.Point(21, 77);
this.pressureHiLabel.Name = "pressureHiLabel";
this.pressureHiLabel.Size = new System.Drawing.Size(85, 13);
this.pressureHiLabel.TabIndex = 2;
this.pressureHiLabel.Text = "Pressure Hi [bar]";
//
// pressureLoLabel
//
this.pressureLoLabel.AutoSize = true;
this.pressureLoLabel.Location = new System.Drawing.Point(21, 47);
this.pressureLoLabel.Name = "pressureLoLabel";
this.pressureLoLabel.Size = new System.Drawing.Size(87, 13);
this.pressureLoLabel.TabIndex = 1;
this.pressureLoLabel.Text = "Pressure Lo [bar]";
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(186, 17);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 42);
this.cancelButton.TabIndex = 27;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// nextButton
//
this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.nextButton.Location = new System.Drawing.Point(105, 17);
this.nextButton.Name = "nextButton";
this.nextButton.Size = new System.Drawing.Size(75, 42);
this.nextButton.TabIndex = 26;
this.nextButton.Text = "&Next >";
this.nextButton.UseVisualStyleBackColor = true;
this.nextButton.Click += new System.EventHandler(this.nextButton_Click);
//
// backButton
//
this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.backButton.DialogResult = System.Windows.Forms.DialogResult.Retry;
this.backButton.Location = new System.Drawing.Point(24, 17);
this.backButton.Name = "backButton";
this.backButton.Size = new System.Drawing.Size(75, 42);
this.backButton.TabIndex = 25;
this.backButton.Text = "< &Back";
this.backButton.UseVisualStyleBackColor = true;
this.backButton.Click += new System.EventHandler(this.backButton_Click);
//
// PressureSelection
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 262);
this.Controls.Add(this.horizSplitContainer);
this.Name = "PressureSelection";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "PressureSelection";
this.Load += new System.EventHandler(this.FlowSelection_Load);
this.horizSplitContainer.Panel1.ResumeLayout(false);
this.horizSplitContainer.Panel1.PerformLayout();
this.horizSplitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.horizSplitContainer)).EndInit();
this.horizSplitContainer.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer horizSplitContainer;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button nextButton;
private System.Windows.Forms.Button backButton;
private System.Windows.Forms.TextBox pressureHiTextBox;
private System.Windows.Forms.TextBox pressureLoTextBox;
private System.Windows.Forms.Label pressureHiLabel;
private System.Windows.Forms.Label pressureLoLabel;
private System.Windows.Forms.TextBox durationTextBox;
private System.Windows.Forms.Label durationLabel;
}
}

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

@ -19,15 +19,10 @@ namespace TBF.TestWizard
InitializeComponent();
}
public VolumeAndErrorSelection(Entities.Test test)
public VolumeAndErrorSelection(bool first, bool last, Entities.Test test)
: this()
{
this.test = test;
}
private void VolumeAndErrorSelection_Load(object sender, EventArgs e)
{
if (test == null) return;
Text = Strings.Volume_and_error_selection;
volumeLabel.Text = Strings.Volume_ltr_chdr;
@ -38,6 +33,14 @@ namespace TBF.TestWizard
nextButton.Text = Strings.FinishBtnText;
cancelButton.Text = Strings.CancelBtnText;
if (first) backButton.Visible = false;
if (last) nextButton.Text = Strings.FinishBtnText;
}
private void VolumeAndErrorSelection_Load(object sender, EventArgs e)
{
if (test == null) return;
RefreshWizardPage();
}