Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60cb1c0562 | ||
|
|
1c001cbb1a | ||
|
|
6f2c39d44c | ||
|
|
9d2e2b857e |
@@ -437,18 +437,22 @@ namespace Results.Entities
|
||||
|
||||
Workflow = string.Empty;
|
||||
ErrorFlags = 0;
|
||||
InfoFlags = 0;
|
||||
LastRecordIsNok = false;
|
||||
|
||||
/// Initialize strings
|
||||
SerialNr = string.Empty;
|
||||
SerialNrAux = string.Empty;
|
||||
RadioAddress = string.Empty;
|
||||
PurchaseOrder = string.Empty;
|
||||
EndState = string.Empty;
|
||||
EndStateAux = string.Empty;
|
||||
ArchivePath = string.Empty;
|
||||
Remark = string.Empty;
|
||||
#if IPERL
|
||||
FWVersion = string.Empty;
|
||||
#endif
|
||||
#if TURA_SPECIAL
|
||||
RadioAddress = string.Empty;
|
||||
ProdUserName = string.Empty;
|
||||
ProdPurchaseOrder = string.Empty;
|
||||
#endif
|
||||
@@ -464,6 +468,7 @@ namespace Results.Entities
|
||||
|
||||
SerialNr = src.SerialNr;
|
||||
SerialNrAux = src.SerialNrAux;
|
||||
RadioAddress = src.RadioAddress;
|
||||
PurchaseOrder = src.PurchaseOrder;
|
||||
YearOfProduction = src.YearOfProduction;
|
||||
WMPosition = src.WMPosition;
|
||||
@@ -492,22 +497,22 @@ namespace Results.Entities
|
||||
FWVersion = src.FWVersion;
|
||||
#endif
|
||||
#if TURA_SPECIAL
|
||||
RadioAddress = src.RadioAddress;
|
||||
PaletteNr = src.PaletteNr;
|
||||
UmkartonNr = src.UmkartonNr;
|
||||
ProdTestBench = src.ProdTestBench;
|
||||
ProdWMPosition = src.ProdWMPosition;
|
||||
ProdUserName = src.ProdUserName;
|
||||
ProdPurchaseOrder = src.ProdPurchaseOrder;
|
||||
ProdPassed = src.ProdPassed;
|
||||
ProdResultCode = src.ProdResultCode;
|
||||
ProdQ2CorrRL = src.ProdQ2CorrRL;
|
||||
ProdQ2CorrLR = src.ProdQ2CorrLR;
|
||||
PaletteNr = src.PaletteNr;
|
||||
UmkartonNr = src.UmkartonNr;
|
||||
ProdTestBench = src.ProdTestBench;
|
||||
ProdWMPosition = src.ProdWMPosition;
|
||||
ProdUserName = src.ProdUserName;
|
||||
ProdPurchaseOrder = src.ProdPurchaseOrder;
|
||||
ProdPassed = src.ProdPassed;
|
||||
ProdResultCode = src.ProdResultCode;
|
||||
ProdQ2CorrRL = src.ProdQ2CorrRL;
|
||||
ProdQ2CorrLR = src.ProdQ2CorrLR;
|
||||
#endif
|
||||
AssignedSerialNr = src.AssignedSerialNr;
|
||||
Prefix = src.Prefix;
|
||||
Suffix = src.Suffix;
|
||||
CompleteSerialNr = src.CompleteSerialNr;
|
||||
OriRadioAddress = src.OriRadioAddress;
|
||||
WMTypeRevision = src.WMTypeRevision;
|
||||
Pruefindex = src.Pruefindex;
|
||||
HydrPruefung = src.HydrPruefung;
|
||||
@@ -643,6 +648,7 @@ namespace Results.Entities
|
||||
writer.Write(Id);
|
||||
writer.Write((SerialNr != null) ? SerialNr : string.Empty);
|
||||
writer.Write((SerialNrAux != null) ? SerialNrAux : string.Empty);
|
||||
writer.Write((RadioAddress != null) ? RadioAddress : string.Empty);
|
||||
writer.Write((PurchaseOrder != null) ? PurchaseOrder : string.Empty);
|
||||
writer.Write(YearOfProduction);
|
||||
writer.Write(WMPosition);
|
||||
@@ -671,7 +677,6 @@ namespace Results.Entities
|
||||
writer.Write((FWVersion != null) ? FWVersion : string.Empty);
|
||||
#endif
|
||||
#if TURA_SPECIAL
|
||||
writer.Write((RadioAddress != null) ? RadioAddress : string.Empty);
|
||||
writer.Write(PaletteNr);
|
||||
writer.Write(UmkartonNr);
|
||||
writer.Write((ProdTestBench != null) ? ProdTestBench : string.Empty);
|
||||
@@ -687,6 +692,7 @@ namespace Results.Entities
|
||||
writer.Write((Prefix != null) ? Prefix : string.Empty);
|
||||
writer.Write((Suffix != null) ? Suffix : string.Empty);
|
||||
writer.Write((CompleteSerialNr != null) ? CompleteSerialNr : string.Empty);
|
||||
writer.Write((OriRadioAddress != null) ? OriRadioAddress : string.Empty);
|
||||
writer.Write(WMTypeRevision);
|
||||
writer.Write(Pruefindex);
|
||||
writer.Write(HydrPruefung);
|
||||
@@ -736,6 +742,7 @@ namespace Results.Entities
|
||||
Id = reader.ReadInt32();
|
||||
SerialNr = reader.ReadString();
|
||||
SerialNrAux = reader.ReadString();
|
||||
RadioAddress = reader.ReadString();
|
||||
PurchaseOrder = reader.ReadString();
|
||||
YearOfProduction = reader.ReadInt32();
|
||||
WMPosition = reader.ReadInt32();
|
||||
@@ -764,7 +771,6 @@ namespace Results.Entities
|
||||
FWVersion = reader.ReadString();
|
||||
#endif
|
||||
#if TURA_SPECIAL
|
||||
RadioAddress = reader.ReadString();
|
||||
PaletteNr = reader.ReadInt32();
|
||||
UmkartonNr = reader.ReadInt32();
|
||||
ProdTestBench = reader.ReadString();
|
||||
@@ -780,6 +786,7 @@ namespace Results.Entities
|
||||
Prefix = reader.ReadString();
|
||||
Suffix = reader.ReadString();
|
||||
CompleteSerialNr = reader.ReadString();
|
||||
OriRadioAddress = reader.ReadString();
|
||||
WMTypeRevision = reader.ReadInt32();
|
||||
Pruefindex = reader.ReadInt32();
|
||||
HydrPruefung = reader.ReadInt32();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
@@ -61,9 +61,9 @@ namespace Results.Mappings
|
||||
Map(x => x.Suffix);
|
||||
Map(x => x.CompleteSerialNr);
|
||||
Map(x => x.OriRadioAddress);
|
||||
Map(x => x.WMTypeRevision);
|
||||
Map(x => x.Pruefindex);
|
||||
Map(x => x.HydrPruefung);
|
||||
Map(x => x.WMTypeRevision);
|
||||
#endif
|
||||
References(x => x.WaterMeterData);
|
||||
References(x => x.Batch);
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("3.1.1857.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.1857.0")]
|
||||
[assembly: AssemblyVersion("3.1.1861.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.1861.0")]
|
||||
|
||||
Generated
+9
@@ -879,6 +879,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Close form keys.
|
||||
/// </summary>
|
||||
internal static string Close_form_keys {
|
||||
get {
|
||||
return ResourceManager.GetString("Close_form_keys", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Close the cover.
|
||||
/// </summary>
|
||||
|
||||
@@ -2365,4 +2365,7 @@
|
||||
<data name="Cover" xml:space="preserve">
|
||||
<value>Cover</value>
|
||||
</data>
|
||||
<data name="Close_form_keys" xml:space="preserve">
|
||||
<value>Close form keys</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Config.Entities;
|
||||
using Dirichlet.Numerics;
|
||||
using TBF.Boxes;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Rig.GenericDevices;
|
||||
|
||||
@@ -53,7 +54,18 @@ namespace TBF.Rig.ControlBoard
|
||||
/// <param name="measuredFlow">Reference to calss keeping current flow value</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <returns>Operation</returns>
|
||||
IOperation SetFlowOp(double qFrom, double qTo, TBF.Boxes.DoubleBox measuredFlow, int timeout);
|
||||
IOperation SetFlowOp(double qFrom, double qTo, DoubleBox measuredFlow, int timeout);
|
||||
|
||||
/// <summary>
|
||||
/// Returns operation which sets the flow. Events:
|
||||
/// </summary>
|
||||
/// <param name="qFrom">Lower limit for the water flow</param>
|
||||
/// <param name="qTo">Upper limit for the water flow</param>
|
||||
/// <param name="measuredFlow">Reference to calss keeping current flow value</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <param name="delay">Delay of flow setting start in [s], default = 0</param>
|
||||
/// <returns>Operation</returns>
|
||||
IOperation SetFlowOp(double qFrom, double qTo, DoubleBox measuredFlow, int timeout, int delay);
|
||||
|
||||
IOperation StopFlowRegulationOp();
|
||||
|
||||
|
||||
@@ -419,8 +419,13 @@ namespace TBF.Rig.ControlBoard.Papouch
|
||||
/// <param name="reqrdFlowHi">Upper limit</param>
|
||||
/// <param name="measuredFlow">Reference to a box for the measured flow or null</param>
|
||||
/// <param name="timeout">Flow set timeout</param>
|
||||
/// <param name="delay">Flow setting starts after this delay [s]</param>
|
||||
/// <returns>Operation</returns>
|
||||
public IOperation SetFlowOp(double reqrdFlowLo, double reqrdFlowHi, TBF.Boxes.DoubleBox measuredFlow, int timeout)
|
||||
public IOperation SetFlowOp(double reqrdFlowLo, double reqrdFlowHi, DoubleBox measuredFlow, int timeout)
|
||||
{
|
||||
return SetFlowOp(reqrdFlowLo, reqrdFlowHi, measuredFlow, timeout, 0);
|
||||
}
|
||||
public IOperation SetFlowOp(double reqrdFlowLo, double reqrdFlowHi, DoubleBox measuredFlow, int timeout, int delay)
|
||||
{
|
||||
string loLimStr = reqrdFlowLo.ToString(Common.Utils.SignificantDigitsToFmt(reqrdFlowLo, 2));
|
||||
string hiLimStr = reqrdFlowHi.ToString(Common.Utils.SignificantDigitsToFmt(reqrdFlowHi, 2));
|
||||
|
||||
@@ -637,9 +637,14 @@ namespace TBF.Rig.ControlBoard.Uni
|
||||
///
|
||||
/// Operations
|
||||
///
|
||||
public IOperation SetFlowOp(double flowLimLo, double flowLimHi, TBF.Boxes.DoubleBox measuredFlow, int timeout)
|
||||
/// <param name="delay">Delay of flow setting start in [s], default = 0</param>
|
||||
public IOperation SetFlowOp(double flowLimLo, double flowLimHi, DoubleBox measuredFlow, int timeout)
|
||||
{
|
||||
return Devices.RegValve.SetFlowOp(Devices.FlowMeter, flowLimLo, flowLimHi, measuredFlow, timeout);
|
||||
return SetFlowOp(flowLimLo, flowLimHi, measuredFlow, timeout, 0);
|
||||
}
|
||||
public IOperation SetFlowOp(double flowLimLo, double flowLimHi, DoubleBox measuredFlow, int timeout, int delay)
|
||||
{
|
||||
return Devices.RegValve.SetFlowOp(Devices.FlowMeter, flowLimLo, flowLimHi, measuredFlow, timeout, delay);
|
||||
}
|
||||
|
||||
public IOperation StopFlowRegulationOp()
|
||||
|
||||
@@ -51,12 +51,12 @@ namespace TBF.Rig.DataContainer.BenchInfo
|
||||
: base(cfg)
|
||||
{
|
||||
myCfg = cfg as ComponentCfg;
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SharedDatabase.EventsDB.SetBenchName(myCfg.TestBenchName);
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,24 +51,9 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
public ProcedureSelection Source4; /// 24
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
string calibCertificateNr;
|
||||
DateTime calibDate;
|
||||
DateTime calibValidDate;
|
||||
public string CalibCertificateNr
|
||||
{
|
||||
get { return calibCertificateNr; }
|
||||
set { calibCertificateNr = value; }
|
||||
}
|
||||
public DateTime CalibDate
|
||||
{
|
||||
get { return calibDate; }
|
||||
set { calibDate = value; }
|
||||
}
|
||||
public DateTime CalibValidDate
|
||||
{
|
||||
get { return calibValidDate; }
|
||||
set { calibValidDate = value; }
|
||||
}
|
||||
public string CalibCertificateNr { get; set; }
|
||||
public DateTime CalibDate { get; set; }
|
||||
public DateTime CalibValidDate { get; set; }
|
||||
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
@@ -112,6 +97,10 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
Source2 = ProcedureSelection.FromLocalDB;
|
||||
Source3 = ProcedureSelection.None;
|
||||
Source4 = ProcedureSelection.None;
|
||||
|
||||
CalibCertificateNr = string.Empty;
|
||||
CalibDate = TBF.UI.Constants.MinDate;
|
||||
CalibValidDate = TBF.UI.Constants.MaxDate;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2020-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -66,7 +66,6 @@ namespace TBF.Rig.DataEntry.Single
|
||||
: base(cfg)
|
||||
{
|
||||
entryFormCfg = cfg as EntryFormCfg;
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -77,6 +76,7 @@ namespace TBF.Rig.DataEntry.Single
|
||||
wmEndState = new double[TBF.Data.WMsCount];
|
||||
wmCycleEndState = new string[TBF.Data.WMsCount];
|
||||
currentOp = CurrentOp.None;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ namespace TBF.Rig.DataEntry.Standard12
|
||||
: base(cfg)
|
||||
{
|
||||
entryFormCfg = cfg as EntryFormCfg;
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -77,6 +76,7 @@ namespace TBF.Rig.DataEntry.Standard12
|
||||
wmEndState = new double[TBF.Data.WMsCount];
|
||||
wmCycleEndState = new string[TBF.Data.WMsCount];
|
||||
currentOp = CurrentOp.None;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.Rig.Generic;
|
||||
@@ -19,6 +20,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
///
|
||||
public bool EnterSerialNrsAtTheEnd;
|
||||
public bool ShowCycleEndForm;
|
||||
public string CloseFormKeys;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
EntryFormCfg()
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
{
|
||||
enterSNsAtTheEndCheckBox.Text = Strings.Enter_SNs_at_the_end;
|
||||
showEndStateFormCheckBox.Text = Strings.Show_cycle_end_form;
|
||||
closeKeysLabel.Text = Strings.Close_form_keys;
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
@@ -53,6 +54,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
nameTextBox.Text = config.Name;
|
||||
enterSNsAtTheEndCheckBox.Checked = config.EnterSerialNrsAtTheEnd;
|
||||
showEndStateFormCheckBox.Checked = config.ShowCycleEndForm;
|
||||
closeKeysTextBox.Text = config.CloseFormKeys;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
@@ -60,6 +62,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
nameTextBox.Enabled = true;
|
||||
enterSNsAtTheEndCheckBox.Enabled = true;
|
||||
showEndStateFormCheckBox.Enabled = true;
|
||||
closeKeysTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
@@ -77,6 +80,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
config.Name = nameTextBox.Text;
|
||||
config.EnterSerialNrsAtTheEnd = enterSNsAtTheEndCheckBox.Checked;
|
||||
config.ShowCycleEndForm = showEndStateFormCheckBox.Checked;
|
||||
config.CloseFormKeys = closeKeysTextBox.Text;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
+92
-69
@@ -31,75 +31,96 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
/// </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.showEndStateFormCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.enterSNsAtTheEndCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(99, 57);
|
||||
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(35, 60);
|
||||
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(96, 33);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// showEndStateFormCheckBox
|
||||
//
|
||||
this.showEndStateFormCheckBox.AutoSize = true;
|
||||
this.showEndStateFormCheckBox.Enabled = false;
|
||||
this.showEndStateFormCheckBox.Location = new System.Drawing.Point(99, 112);
|
||||
this.showEndStateFormCheckBox.Name = "showEndStateFormCheckBox";
|
||||
this.showEndStateFormCheckBox.Size = new System.Drawing.Size(151, 17);
|
||||
this.showEndStateFormCheckBox.TabIndex = 4;
|
||||
this.showEndStateFormCheckBox.Text = "Watermeter end state form";
|
||||
this.showEndStateFormCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// enterSNsAtTheEndCheckBox
|
||||
//
|
||||
this.enterSNsAtTheEndCheckBox.AutoSize = true;
|
||||
this.enterSNsAtTheEndCheckBox.Enabled = false;
|
||||
this.enterSNsAtTheEndCheckBox.Location = new System.Drawing.Point(99, 89);
|
||||
this.enterSNsAtTheEndCheckBox.Name = "enterSNsAtTheEndCheckBox";
|
||||
this.enterSNsAtTheEndCheckBox.Size = new System.Drawing.Size(167, 17);
|
||||
this.enterSNsAtTheEndCheckBox.TabIndex = 3;
|
||||
this.enterSNsAtTheEndCheckBox.Text = "Enter serial number at the end";
|
||||
this.enterSNsAtTheEndCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// EntryFormCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.enterSNsAtTheEndCheckBox);
|
||||
this.Controls.Add(this.showEndStateFormCheckBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "EntryFormCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.showEndStateFormCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.enterSNsAtTheEndCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.closeKeysTextBox = new System.Windows.Forms.TextBox();
|
||||
this.closeKeysLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(113, 57);
|
||||
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(24, 60);
|
||||
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(110, 33);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// showEndStateFormCheckBox
|
||||
//
|
||||
this.showEndStateFormCheckBox.AutoSize = true;
|
||||
this.showEndStateFormCheckBox.Enabled = false;
|
||||
this.showEndStateFormCheckBox.Location = new System.Drawing.Point(113, 112);
|
||||
this.showEndStateFormCheckBox.Name = "showEndStateFormCheckBox";
|
||||
this.showEndStateFormCheckBox.Size = new System.Drawing.Size(151, 17);
|
||||
this.showEndStateFormCheckBox.TabIndex = 4;
|
||||
this.showEndStateFormCheckBox.Text = "Watermeter end state form";
|
||||
this.showEndStateFormCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// enterSNsAtTheEndCheckBox
|
||||
//
|
||||
this.enterSNsAtTheEndCheckBox.AutoSize = true;
|
||||
this.enterSNsAtTheEndCheckBox.Enabled = false;
|
||||
this.enterSNsAtTheEndCheckBox.Location = new System.Drawing.Point(113, 89);
|
||||
this.enterSNsAtTheEndCheckBox.Name = "enterSNsAtTheEndCheckBox";
|
||||
this.enterSNsAtTheEndCheckBox.Size = new System.Drawing.Size(167, 17);
|
||||
this.enterSNsAtTheEndCheckBox.TabIndex = 3;
|
||||
this.enterSNsAtTheEndCheckBox.Text = "Enter serial number at the end";
|
||||
this.enterSNsAtTheEndCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// closeKeysTextBox
|
||||
//
|
||||
this.closeKeysTextBox.Enabled = false;
|
||||
this.closeKeysTextBox.Location = new System.Drawing.Point(113, 142);
|
||||
this.closeKeysTextBox.Name = "closeKeysTextBox";
|
||||
this.closeKeysTextBox.Size = new System.Drawing.Size(36, 20);
|
||||
this.closeKeysTextBox.TabIndex = 6;
|
||||
//
|
||||
// closeKeysLabel
|
||||
//
|
||||
this.closeKeysLabel.AutoSize = true;
|
||||
this.closeKeysLabel.Location = new System.Drawing.Point(24, 145);
|
||||
this.closeKeysLabel.Name = "closeKeysLabel";
|
||||
this.closeKeysLabel.Size = new System.Drawing.Size(81, 13);
|
||||
this.closeKeysLabel.TabIndex = 5;
|
||||
this.closeKeysLabel.Text = "Close form keys";
|
||||
//
|
||||
// EntryFormCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.closeKeysTextBox);
|
||||
this.Controls.Add(this.closeKeysLabel);
|
||||
this.Controls.Add(this.enterSNsAtTheEndCheckBox);
|
||||
this.Controls.Add(this.showEndStateFormCheckBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "EntryFormCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -110,5 +131,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.CheckBox showEndStateFormCheckBox;
|
||||
private System.Windows.Forms.CheckBox enterSNsAtTheEndCheckBox;
|
||||
private System.Windows.Forms.TextBox closeKeysTextBox;
|
||||
private System.Windows.Forms.Label closeKeysLabel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -39,6 +39,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
|
||||
|
||||
Common.Unit volumeUnit;
|
||||
double refVolume;
|
||||
double errLimLo;
|
||||
double errLimHi;
|
||||
@@ -66,7 +67,6 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
: base(cfg)
|
||||
{
|
||||
entryFormCfg = cfg as EntryFormCfg;
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -76,7 +76,9 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
wmStartStateStr = new string[TBF.Data.WMsCount];
|
||||
wmEndState = new double[TBF.Data.WMsCount];
|
||||
wmEndStateStr = new string[TBF.Data.WMsCount];
|
||||
volumeUnit = (TBF.Rig.Sequences.ProcessData.BenchInfo != null) ? TBF.Rig.Sequences.ProcessData.BenchInfo.VolumeUnit : Common.Unit.l;
|
||||
currentOp = CurrentOp.None;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +152,8 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
///
|
||||
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, myRef.disabled);
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, myRef.disabled,
|
||||
myRef.entryFormCfg.CloseFormKeys, volumeUnit);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
@@ -166,7 +169,8 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
///
|
||||
void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, wmStartStateStr, disabled,
|
||||
refVolume, errLimLo, errLimHi, volumeUnit);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
|
||||
@@ -254,6 +258,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
volumeUnit = dlg.VolumeUnit;
|
||||
for (int i = 0; i < dlg.WaterMetersCount; i++)
|
||||
{
|
||||
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
|
||||
@@ -270,6 +275,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
volumeUnit = dlg.VolumeUnit;
|
||||
for (int i = 0; i < dlg.WaterMetersCount; i++)
|
||||
{
|
||||
if (!(((i < disabled.Length) && disabled[i]) || ((i < regReaders.Length) && (regReaders[i] == null))))
|
||||
|
||||
@@ -5,6 +5,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
|
||||
@@ -20,7 +22,6 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
End,
|
||||
}
|
||||
|
||||
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TestStartEndForm));
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
@@ -31,20 +32,17 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
readonly string closeFormKeys;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public double[] WMStartState;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public readonly string[] WMStartStateStr;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public double[] WMEndState;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public readonly string[] WMEndStateStr;
|
||||
|
||||
Kind kind; /// false=start states, true=end states
|
||||
public Unit VolumeUnit;
|
||||
|
||||
Kind kind; /// false=start states, true=end states
|
||||
double refVolume;
|
||||
double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
@@ -101,6 +99,11 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
activeTextBoxes = new List<TextBox>();
|
||||
activeWmNrs = new List<int>();
|
||||
|
||||
for (Unit u = 0; u < Unit.Count; u++)
|
||||
{
|
||||
if (Units.IsVolume(u)) unitComboBox.Items.Add(u.ToDescription());
|
||||
}
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
@@ -110,7 +113,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled, string closeFormKeys, Unit initialVolumeUnit)
|
||||
: this()
|
||||
{
|
||||
kind = Kind.Start;
|
||||
@@ -118,11 +121,15 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
this.WaterMetersCount = waterMetersCount;
|
||||
this.regReaders = regReaders;
|
||||
this.disabled = disabled;
|
||||
this.closeFormKeys = closeFormKeys;
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
WMStartState = new double[waterMetersCount];
|
||||
WMStartStateStr = new string[waterMetersCount];
|
||||
|
||||
VolumeUnit = initialVolumeUnit;
|
||||
unitComboBox.Text = VolumeUnit.ToDescription();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -158,7 +165,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
double refVolume, double errLimLo, double errLimHi, Unit initialVolumeUnit)
|
||||
: this()
|
||||
{
|
||||
kind = Kind.End;
|
||||
@@ -176,8 +183,12 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
|
||||
ShuffleTextBoxes();
|
||||
|
||||
WMStartState = new double[waterMetersCount];
|
||||
WMEndState = new double[waterMetersCount];
|
||||
WMEndStateStr = new string[waterMetersCount];
|
||||
|
||||
VolumeUnit = initialVolumeUnit;
|
||||
unitComboBox.Text = VolumeUnit.ToDescription();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -207,7 +218,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
}
|
||||
}
|
||||
|
||||
private void CycleEndForm_Load(object sender, EventArgs e)
|
||||
private void TestStartEndForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
@@ -269,7 +280,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
if ((activeTextBoxes.Count > 0) && (activeWmNrs.Count > 0))
|
||||
{
|
||||
activeTextBoxes[0].Focus();
|
||||
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, activeWmNrs[0] + 1, string.Empty);
|
||||
largeTextBox.Text = string.Format("{0}: {1}", activeWmNrs[0] + 1, string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,8 +289,8 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
Text = Strings.Water_Meter_States;
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
labels[i].Text = string.Format("{0} {1}", Strings.Water_Meter, i + 1);
|
||||
}
|
||||
labels[i].Text = (i + 1).ToString();
|
||||
}
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
@@ -287,36 +298,32 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
|
||||
private void okButton_Click(object sender, EventArgs eArgs)
|
||||
{
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < Math.Min(WaterMetersCount, TextBoxesCount); i++)
|
||||
{
|
||||
double startVol, endVol;
|
||||
|
||||
if (kind == Kind.End)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(WaterMetersCount, TextBoxesCount); i++)
|
||||
if (endTextBoxes[i].Visible &&
|
||||
endTextBoxes[i].Enabled &&
|
||||
Utils.TryParseUDouble(startTextBoxes[i].Text, out startVol) &&
|
||||
Utils.TryParseUDouble(endTextBoxes[i].Text, out endVol))
|
||||
{
|
||||
if (endTextBoxes[i].Visible && endTextBoxes[i].Enabled)
|
||||
{
|
||||
WMEndStateStr[i] = endTextBoxes[i].Text;
|
||||
WMEndState[i] = Utils.ParseUDouble(endTextBoxes[i].Text);
|
||||
}
|
||||
WMStartState[i] = Units.ConvertFrom(VolumeUnit, startVol);
|
||||
WMEndState[i] = Units.ConvertFrom(VolumeUnit, endVol);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Math.Min(WaterMetersCount, TextBoxesCount); i++)
|
||||
{
|
||||
if (startTextBoxes[i].Visible && startTextBoxes[i].Enabled)
|
||||
{
|
||||
WMStartStateStr[i] = startTextBoxes[i].Text;
|
||||
WMStartState[i] = Utils.ParseUDouble(startTextBoxes[i].Text);
|
||||
}
|
||||
if (startTextBoxes[i].Visible &&
|
||||
startTextBoxes[i].Enabled &&
|
||||
Utils.TryParseUDouble(startTextBoxes[i].Text, out startVol))
|
||||
{
|
||||
WMStartStateStr[i] = startTextBoxes[i].Text;
|
||||
WMStartState[i] = Units.ConvertFrom(VolumeUnit, startVol);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.ErrorFormat("Exception: {0}", e.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
@@ -359,19 +366,26 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
}
|
||||
}
|
||||
|
||||
double err = 0;
|
||||
try
|
||||
{
|
||||
double endState = Utils.ParseUDouble(endTextBoxes[wmIx].Text);
|
||||
double startState = Utils.ParseUDouble(startTextBoxes[wmIx].Text);
|
||||
err = 100.0 * (endState - startState - refVolume) / refVolume;
|
||||
}
|
||||
catch { err = 1000.0f; };
|
||||
if (wmIx < 0 || wmIx >= TextBoxesCount) return;
|
||||
|
||||
bool errorOoR = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
exclamations[wmIx].Visible = errorOoR;
|
||||
largeExclamationLabel.Visible = errorOoR;
|
||||
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, wmIx + 1, endTextBoxes[wmIx].Text);
|
||||
double startVol, endVol;
|
||||
|
||||
if (Utils.TryParseUDouble(startTextBoxes[wmIx].Text, out startVol) &&
|
||||
Utils.TryParseUDouble(endTextBoxes[wmIx].Text, out endVol))
|
||||
{
|
||||
double startState = Units.ConvertFrom(VolumeUnit, startVol);
|
||||
double endState = Units.ConvertFrom(VolumeUnit, endVol);
|
||||
double err = (refVolume != 0) ? 100.0 * (endState - startState - refVolume) / refVolume : 1000.0;
|
||||
largeExclamationLabel.Visible =
|
||||
exclamations[wmIx].Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
else
|
||||
{
|
||||
largeExclamationLabel.Visible =
|
||||
exclamations[wmIx].Visible = !string.IsNullOrEmpty(endTextBoxes[wmIx].Text);
|
||||
}
|
||||
|
||||
largeTextBox.Text = string.Format("{0}: {1}", wmIx + 1, endTextBoxes[wmIx].Text);
|
||||
}
|
||||
|
||||
private void endTextBox1_TextChanged(object sndr, EventArgs e) { ProcEndTextChanged(sndr, e, endTextBox1); }
|
||||
@@ -432,11 +446,18 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
/// <param name="currentFocusOwner">TextBox control which received the event</param>
|
||||
private void ProcKeyPress(object sender, KeyPressEventArgs e, TextBox currentFocusOwner)
|
||||
{
|
||||
if (e.KeyChar == '+')
|
||||
{
|
||||
/// Process '+' key ..... Form completed
|
||||
okButton_Click(sender, e);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(closeFormKeys))
|
||||
{
|
||||
/// Close the form if any 'close form key' was pressed
|
||||
for (int ix = 0; ix < closeFormKeys.Length; ix++)
|
||||
{
|
||||
if (e.KeyChar == closeFormKeys[ix])
|
||||
{
|
||||
okButton_Click(sender, e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
@@ -450,7 +471,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
/// Change focus to the next enabled text box
|
||||
int newTBIdx = (i + 1) % activeTextBoxes.Count;
|
||||
activeTextBoxes[newTBIdx].Focus();
|
||||
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, activeWmNrs[newTBIdx] + 1, activeTextBoxes[newTBIdx].Text);
|
||||
largeTextBox.Text = string.Format("{0}: {1}", activeWmNrs[newTBIdx] + 1, activeTextBoxes[newTBIdx].Text);
|
||||
largeExclamationLabel.Visible = false;
|
||||
return;
|
||||
}
|
||||
@@ -515,7 +536,7 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
{
|
||||
if (startTextBoxes[i] == startTBox)
|
||||
{
|
||||
largeTextBox.Text = string.Format("{0} {1}: {2}", Strings.Water_Meter, i + 1, startTextBoxes[i].Text);
|
||||
largeTextBox.Text = string.Format("{0}: {1}", i + 1, startTextBoxes[i].Text);
|
||||
largeExclamationLabel.Visible = false;
|
||||
break;
|
||||
}
|
||||
@@ -571,5 +592,44 @@ namespace TBF.Rig.DataEntry.Standard24
|
||||
private void startTextBox22_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox22); }
|
||||
private void startTextBox23_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox23); }
|
||||
private void startTextBox24_MouseClick(object sender, MouseEventArgs e) { ProcStartTextChanged(sender, e, startTextBox24); }
|
||||
|
||||
private void unitComboBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
unitComboBox_SelectedIndexChanged(sender, e);
|
||||
}
|
||||
|
||||
private void unitComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var newUnit = Units.FromDescription(unitComboBox.Text);
|
||||
|
||||
if (Units.IsVolume(newUnit))
|
||||
{
|
||||
VolumeUnit = newUnit;
|
||||
|
||||
if (kind == Kind.End)
|
||||
{
|
||||
for (int i = 0; i < TextBoxesCount; i++)
|
||||
{
|
||||
double startVol, endVol;
|
||||
|
||||
if (Utils.TryParseUDouble(startTextBoxes[i].Text, out startVol) &&
|
||||
Utils.TryParseUDouble(endTextBoxes[i].Text, out endVol))
|
||||
{
|
||||
double startState = Units.ConvertFrom(VolumeUnit, startVol);
|
||||
double endState = Units.ConvertFrom(VolumeUnit, endVol);
|
||||
double err = (refVolume != 0) ? 100.0 * (endState - startState - refVolume) / refVolume : 1000.0;
|
||||
exclamations[i].Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||
}
|
||||
else
|
||||
{
|
||||
exclamations[i].Visible = !string.IsNullOrEmpty(endTextBoxes[i].Text);
|
||||
}
|
||||
}
|
||||
|
||||
largeTextBox.Text = string.Empty;
|
||||
largeExclamationLabel.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+170
-154
File diff suppressed because it is too large
Load Diff
@@ -66,7 +66,6 @@ namespace TBF.Rig.DataEntry.Standard48
|
||||
: base(cfg)
|
||||
{
|
||||
entryFormCfg = cfg as EntryFormCfg;
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -77,6 +76,7 @@ namespace TBF.Rig.DataEntry.Standard48
|
||||
wmEndState = new double[TBF.Data.WMsCount];
|
||||
wmCycleEndState = new string[TBF.Data.WMsCount];
|
||||
currentOp = CurrentOp.None;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@ namespace TBF.Rig.DataEntry.Standard6
|
||||
: base(cfg)
|
||||
{
|
||||
entryFormCfg = cfg as EntryFormCfg;
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -73,6 +72,7 @@ namespace TBF.Rig.DataEntry.Standard6
|
||||
wmStartStateStr = new string[TBF.Data.WMsCount];
|
||||
wmEndState = new double[TBF.Data.WMsCount];
|
||||
currentOp = CurrentOp.None;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -117,7 +117,6 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
: base(cfg)
|
||||
{
|
||||
entryFormCfg = cfg as EntryFormCfg;
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
@@ -128,6 +127,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
wmEndState = new double[TBF.Data.WMsCount];
|
||||
wmCycleEndState = new string[TBF.Data.WMsCount];
|
||||
currentOp = CurrentOp.None;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -51,11 +51,12 @@ namespace TBF.Rig.Dummy.RegValve
|
||||
/// <param name="requiredFlowHi">Higher limit of the required flow [m3/h]</param>
|
||||
/// <param name="measuredFlow">Measured flow [m3/h]</param>
|
||||
/// <param name="timeout">Timeout in [s]</param>
|
||||
/// <param name="delay">Flow setting starts after this delay in [s]</param>
|
||||
/// <returns>SetFlowOp instance</returns>
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox measuredFlow, int timeout)
|
||||
DoubleBox measuredFlow, int timeout, int delay)
|
||||
{
|
||||
return new SetFlowOp(this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout);
|
||||
return new SetFlowOp(this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, delay);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -71,7 +72,7 @@ namespace TBF.Rig.Dummy.RegValve
|
||||
public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox measuredFlow, int timeout, float filterConstant)
|
||||
{
|
||||
return new SetFlowOp(this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, true);
|
||||
return new SetFlowOp(this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, 0, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace TBF.Rig.Dummy.RegValve
|
||||
readonly double reqFlowHi;
|
||||
readonly double reqFlowAve;
|
||||
readonly int timeout;
|
||||
readonly int delay;
|
||||
readonly bool leaveMeasurementRunning;
|
||||
|
||||
readonly double nominalFlow;
|
||||
@@ -45,10 +46,11 @@ namespace TBF.Rig.Dummy.RegValve
|
||||
/// <param name="requiredFlowHi">Upper limit of the flow to be achieved in [m3/h]</param>
|
||||
/// <param name="pidCoef">PID coefficient (float)</param>
|
||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||
/// <param name="delay">Flow setting starts after this delay in [s]</param>
|
||||
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public SetFlowOp(IRegValve regulValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox measuredFlow, int timeout, bool leaveMeasurementRunning)
|
||||
DoubleBox measuredFlow, int timeout, int delay, bool leaveMeasurementRunning)
|
||||
{
|
||||
this.regulValve = regulValve as RegValve;
|
||||
if (this.regulValve == null) throw new ArgumentNullException("regValve is null or not Dummy.RegulValve");
|
||||
@@ -62,6 +64,7 @@ namespace TBF.Rig.Dummy.RegValve
|
||||
this.measuredFlow = measuredFlow;
|
||||
|
||||
this.timeout = timeout;
|
||||
this.delay = delay;
|
||||
|
||||
this.leaveMeasurementRunning = leaveMeasurementRunning;
|
||||
|
||||
@@ -72,17 +75,8 @@ namespace TBF.Rig.Dummy.RegValve
|
||||
/// Set required water flow - Do not leave the measurement running.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(IRegValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
||||
: this(regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set required water flow - No timeout.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(IRegValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow)
|
||||
: this(regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, int.MaxValue, false)
|
||||
public SetFlowOp(IRegValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout, int delay)
|
||||
: this(regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, delay, false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF.Rig.GenericDevices
|
||||
{
|
||||
public interface IHasClearSessionData
|
||||
{
|
||||
void ClearSessionData();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF.Rig.GenericDevices
|
||||
{
|
||||
public interface IHasTestName
|
||||
{
|
||||
string TestName { set; }
|
||||
int TestRepeats { set; }
|
||||
int RepetitionNr { set; }
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.Rig.GenericDevices
|
||||
{
|
||||
@@ -9,6 +10,8 @@ namespace TBF.Rig.GenericDevices
|
||||
{
|
||||
IOperation ReadDatastreamOp();
|
||||
|
||||
void TestIsGoingToStartSoon(Test test, int repetitionNr);
|
||||
|
||||
bool NoSamples { get; }
|
||||
double VolumeLtrStart { get; }
|
||||
double VolumeLtrEnd { get; }
|
||||
|
||||
@@ -39,9 +39,10 @@ namespace TBF.Rig.GenericDevices
|
||||
/// <param name="pidCoef">PID coefficient (float)</param>
|
||||
/// <param name="measuredFlow">Measured flow [m3/h]</param>
|
||||
/// <param name="timeout">Timeout in [s]</param>
|
||||
/// <param name="delay">Flow setting starts after this delay in [s]</param>
|
||||
/// <returns>SetFlowOp instance</returns>
|
||||
IOperation SetFlowOp(IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox measuredFlow, int timeout);
|
||||
DoubleBox measuredFlow, int timeout, int delay);
|
||||
|
||||
/// <summary>
|
||||
/// Operation to set the water flow within tolerances. Leave the measurement running.
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF.Rig.GenericDevices
|
||||
{
|
||||
public interface ISessionDataMngmnt
|
||||
{
|
||||
/// <summary>
|
||||
/// Called when a new session is started
|
||||
/// </summary>
|
||||
/// <param name="dataStreamFileName">File name for the log file</param>
|
||||
void StartSession();
|
||||
|
||||
/// <summary>
|
||||
/// Called when a mark inside a session nees to be saved
|
||||
/// </summary>
|
||||
/// <param name="mark">Arbitrary object, ToString() method is used to show marks in log files</param>
|
||||
void SaveMark(object mark);
|
||||
|
||||
/// <summary>
|
||||
/// Called when a new session is completed
|
||||
/// </summary>
|
||||
void EndSession();
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
///
|
||||
public void StopDevice()
|
||||
{
|
||||
if (tracingCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
if (tracingCfg.DebugLevel != DebugMode.Normal) return;
|
||||
|
||||
using (ISession session = SessionFactory.OpenSession())
|
||||
{
|
||||
@@ -165,7 +165,6 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
session.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
public void StopDevice2() {}
|
||||
|
||||
public IList<OrderInfo> ReadOrders(ISession session = null)
|
||||
|
||||
@@ -61,17 +61,17 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
|
||||
DatabaseCfg dbCfg;
|
||||
|
||||
public DBUsed DBUsed { get { return (dbCfg == null || dbCfg.ProcParams == null) ? DBUsed.None : dbCfg.ProcParams.DBUsed; } }
|
||||
public WMKind WMKind { get { return (dbCfg == null || dbCfg.ProcParams == null) ? WMKind.iPERL : dbCfg.ProcParams.WMKind; } }
|
||||
public int WMTypeId { get { return (dbCfg == null || dbCfg.ProcParams == null) ? 0 : Math.Max(0, dbCfg.ProcParams.WMTypeId); } } /// >= 0
|
||||
public bool IsAutoWMType { get { return (dbCfg == null || dbCfg.ProcParams == null) ? false : (dbCfg.ProcParams.WMTypeId == -1); } }
|
||||
public DBUsed DBUsed { get { return (dbCfg == null || dbCfg.ProcParams == null) ? DBUsed.None : dbCfg.ProcParams.DBUsed; } }
|
||||
public WMKind WMKind { get { return (dbCfg == null || dbCfg.ProcParams == null) ? WMKind.iPERL : dbCfg.ProcParams.WMKind; } }
|
||||
public int WMTypeId { get { return (dbCfg == null || dbCfg.ProcParams == null) ? 0 : Math.Max(0, dbCfg.ProcParams.WMTypeId); } } /// >= 0
|
||||
public bool IsAutoWMType { get { return (dbCfg == null || dbCfg.ProcParams == null) ? false : (dbCfg.ProcParams.WMTypeId == -1); } }
|
||||
public bool CreateWztypIfMissing { get { return (dbCfg == null || dbCfg.ProcParams == null) ? false : dbCfg.ProcParams.CreateWztypIfMissing; } }
|
||||
public int YearOfManufacture { get { return (dbCfg == null || dbCfg.ProcParams == null) ? DateTime.Now.Year : dbCfg.ProcParams.YearOfManufacture; } }
|
||||
public bool SaveResults { get { return (dbCfg == null || dbCfg.ProcParams == null) ? false : dbCfg.ProcParams.SaveResults; } }
|
||||
public bool ReadStartInfo { get { return (dbCfg == null || dbCfg.ProcParams == null) ? true : dbCfg.ProcParams.ReadStartInfo; } }
|
||||
public bool StartInfoIsRequired { get { return (dbCfg == null || dbCfg.ProcParams == null) ? false : dbCfg.ProcParams.StartInfoIsRequired; } }
|
||||
public DesigMode DesigMode { get { return (dbCfg == null || dbCfg.ProcParams == null) ? DesigMode.Auto : dbCfg.ProcParams.DesigMode; } }
|
||||
public LogType DesigType { get { return (dbCfg == null || dbCfg.ProcParams == null) ? LogType.Just_Q3Q2Q1 : dbCfg.ProcParams.DesigType; } }
|
||||
public int YearOfManufacture { get { return (dbCfg == null || dbCfg.ProcParams == null) ? DateTime.Now.Year : dbCfg.ProcParams.YearOfManufacture; } }
|
||||
public bool SaveResults { get { return (dbCfg == null || dbCfg.ProcParams == null) ? false : dbCfg.ProcParams.SaveResults; } }
|
||||
public bool ReadStartInfo { get { return (dbCfg == null || dbCfg.ProcParams == null) ? true : dbCfg.ProcParams.ReadStartInfo; } }
|
||||
public bool StartInfoIsRequired { get { return (dbCfg == null || dbCfg.ProcParams == null) ? false : dbCfg.ProcParams.StartInfoIsRequired; } }
|
||||
public DesigMode DesigMode { get { return (dbCfg == null || dbCfg.ProcParams == null) ? DesigMode.Auto : dbCfg.ProcParams.DesigMode; } }
|
||||
public LogType DesigType { get { return (dbCfg == null || dbCfg.ProcParams == null) ? LogType.Just_Q3Q2Q1 : dbCfg.ProcParams.DesigType; } }
|
||||
|
||||
enum OpState
|
||||
{
|
||||
@@ -541,7 +541,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
"FROM vt_zaehler_pindex_pd " +
|
||||
"WHERE vt_fernum = :1 AND anbid = :2", conn);
|
||||
cmd.Parameters.Add(new OracleParameter { ParameterName = "1", OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid});
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid });
|
||||
dr = cmd.ExecuteReader();
|
||||
while (dr.Read())
|
||||
{
|
||||
@@ -565,7 +565,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
"FROM vt_ip_zaehler_pindex_pd " +
|
||||
"WHERE vt_fernum = :1 AND anbid = :2", conn);
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid});
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid });
|
||||
dr = cmd.ExecuteReader();
|
||||
while (dr.Read())
|
||||
{
|
||||
@@ -589,7 +589,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
"WHERE vt_fernum = :1 AND pruefindex = :2 AND anbid = :3", conn);
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 100 * testBenchID + maxPruefindex });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid});
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid });
|
||||
|
||||
dr = cmd.ExecuteReader();
|
||||
while (dr.Read())
|
||||
@@ -943,7 +943,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
" druckentwaessern, spueldurchflussist, programmversion) " +
|
||||
"VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17)", conn);
|
||||
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid});
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = dbCfg.TestBenchGroupId + b.TestBenchId });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = b.BatchNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32,
|
||||
@@ -1000,7 +1000,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
" beginndruck_hinten, enddruck_vorne, enddruck_hinten, tvwz, ivwz, verwendeter_vz, beginngewicht, endgewicht) " +
|
||||
"VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20, :21, :22, :23)", conn);
|
||||
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid});
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = dbCfg.TestBenchGroupId + b.TestBenchId });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = b.BatchNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = pruefungsnr });
|
||||
@@ -1112,7 +1112,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
void SaveOrUpdateIperl(OracleConnection conn, Results.Entities.WaterMeter wm, int max_Pruefindex, int hydr_Pruefung, VtWztypSd record)
|
||||
{
|
||||
int sekundaere_Adr = wm.Passed ? 1 : 0;
|
||||
int idBenutzer = (ProducerAnbid== 4) ? 6 : 365; /// TODO: wm.Batch.UserNumber;
|
||||
int idBenutzer = (ProducerAnbid == 4) ? 6 : 365; /// TODO: wm.Batch.UserNumber;
|
||||
|
||||
if (dbCfg.DebugLevel == DebugMode.Normal)
|
||||
{
|
||||
@@ -1146,7 +1146,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = sekundaere_Adr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = hydr_Pruefung });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = idBenutzer });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid});
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = YearOfManufacture });
|
||||
|
||||
insertedRows = cmd.ExecuteNonQuery();
|
||||
@@ -1181,7 +1181,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = max_Pruefindex });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid});
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = dbCfg.TestBenchGroupId + wm.Batch.TestBenchId });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Batch.BatchNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = hydr_Pruefung });
|
||||
@@ -1263,7 +1263,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = max_Pruefindex });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid});
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Hz2CorrectionDone ? 1 : 0 });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = wm.Hz2Correction });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Math.Min(99.0, Math.Max(-99.0, wm.Diff2Hz8Hz)) });
|
||||
@@ -1422,7 +1422,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = max_Pruefindex });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid});
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProducerAnbid });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = dbCfg.TestBenchGroupId + wm.Batch.TestBenchId });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Batch.BatchNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = hydr_Pruefung });
|
||||
|
||||
@@ -91,6 +91,17 @@ namespace TBF.Rig.RegisterReaders.DataStream.Reader
|
||||
public double EndWMState { get { return endWMState; } } /// Test end state of the water meter
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Store/update values to be used as a part of the opto-data log file name.
|
||||
/// </summary>
|
||||
/// <param name="test">Currently executed test</param>
|
||||
/// <param name="repetitionNr">Currently executed repetition number</param>
|
||||
public void TestIsGoingToStartSoon(Config.Entities.Test test, int repetitionNr)
|
||||
{
|
||||
/// Nothing needs to be updated
|
||||
}
|
||||
|
||||
|
||||
/// To be used at the beginning of a test
|
||||
public void Clear()
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace TBF.Rig.RegisterReaders.S640Stream
|
||||
/// <summary>
|
||||
/// This component = instance of this class is a placeholder for a combined main watermeter
|
||||
/// </summary>
|
||||
public class S640Stream : ComponentBase, IDevice, IRegReaderDatastream, IHasTestName, IHasClearSessionData, IOperation
|
||||
public class S640Stream : ComponentBase, IDevice, IRegReaderDatastream, ISessionDataMngmnt, IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(S640Stream));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
@@ -51,11 +51,19 @@ namespace TBF.Rig.RegisterReaders.S640Stream
|
||||
double wmTestTime;
|
||||
|
||||
|
||||
/// <summary> Name set by the test, to be used as a part of the opto-data log file name </summary>
|
||||
public string TestName { set { testName = value; } }
|
||||
public int TestRepeats { set { testRepeats = value; } }
|
||||
public int RepetitionNr { set { repetitionNr = value; } }
|
||||
///
|
||||
/// <summary>
|
||||
/// Store/update values to be used as a part of the opto-data log file name.
|
||||
/// </summary>
|
||||
/// <param name="test">Currently executed test</param>
|
||||
/// <param name="repetitionNr">Currently executed repetition number</param>
|
||||
public void TestIsGoingToStartSoon(Config.Entities.Test test, int repetitionNr)
|
||||
{
|
||||
/// Store/update values to be used as a part of the opto-data log file name
|
||||
testName = test.Name;
|
||||
testRepeats = test.Repeats;
|
||||
this.repetitionNr = repetitionNr;
|
||||
}
|
||||
///
|
||||
string testName;
|
||||
int testRepeats;
|
||||
int repetitionNr;
|
||||
@@ -170,7 +178,7 @@ namespace TBF.Rig.RegisterReaders.S640Stream
|
||||
/// <summary>
|
||||
/// Clear data related to a specific water meter
|
||||
/// </summary>
|
||||
public void ClearSessionData()
|
||||
public void StartSession()
|
||||
{
|
||||
currentRawVolumeUnwrapped = 0;
|
||||
currentRawTimeUnwrapped = 0;
|
||||
@@ -194,9 +202,17 @@ namespace TBF.Rig.RegisterReaders.S640Stream
|
||||
partOfTelegram = string.Empty;
|
||||
}
|
||||
|
||||
public void SaveMark(object mark)
|
||||
{
|
||||
}
|
||||
|
||||
public void EndSession()
|
||||
{
|
||||
datastreamParsingEnabled = false;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
ClearSessionData();
|
||||
datastreamParsingEnabled = false;
|
||||
|
||||
/// Allocate memory for opto-data from iPerl
|
||||
@@ -312,6 +328,11 @@ namespace TBF.Rig.RegisterReaders.S640Stream
|
||||
ReadPulses();
|
||||
}
|
||||
|
||||
public void TestCompleted()
|
||||
{
|
||||
/// TODO: Implement
|
||||
}
|
||||
|
||||
|
||||
int timeFromStart; /// This is to determine when the test start sample should be taken
|
||||
|
||||
@@ -473,7 +494,7 @@ namespace TBF.Rig.RegisterReaders.S640Stream
|
||||
beginWMState = volumeLtr0;
|
||||
endWMState = volumeLtr;
|
||||
wmVolume = Math.Abs(endWMState - beginWMState);
|
||||
wmPulses = (int)(wmVolume * (double)PulsesPerLtr + 0.5);
|
||||
wmPulses = Convert.ToInt32(Math.Round(wmVolume * PulsesPerLtr));
|
||||
wmRefPulses = StateMachine.ControlBoard.RefPulses;
|
||||
wmTestTime = timestampSec - timestampSec0;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Common;
|
||||
|
||||
namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
{
|
||||
@@ -10,13 +11,13 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
public readonly int FrameLength; /// Frame length in characters/bytes, 0 = unknown
|
||||
public readonly double FrameFrequency; /// Number of frames per second (Hz)
|
||||
|
||||
public readonly Common.Unit VolumeUnits;
|
||||
public readonly Unit VolumeUnits;
|
||||
public readonly double VolumeScaleFactor; /// Volume in VolumeInits = volmeRaw / VolumeScaleFactor
|
||||
public readonly int VolumeFieldStart; /// Start of the volume field: 0-based index of the first character, -1 = no volume field in the frame
|
||||
public readonly int VolumeFieldEnd; /// End of the volume field: 0-based index of the last character
|
||||
public readonly FieldFormat VolumeFieldFormat; /// Hexadecimal or Decimal
|
||||
|
||||
public readonly Common.Unit TimeUnits;
|
||||
public readonly Unit TimeUnits;
|
||||
public readonly double TimeScaleFactor; /// Time in TimeUnits = timeRaw / TimeScaleFactor
|
||||
public readonly int TimeFieldStart; /// Start of the time field: 0-based index of the first character, -1 = no time field in the frame
|
||||
public readonly int TimeFieldEnd; /// End of the time field: 0-based index of the last character
|
||||
@@ -38,9 +39,9 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
public readonly long RawTimeIncrementPerFrame;
|
||||
|
||||
public FrameFormat(int frameLength, double frameFrequency,
|
||||
Common.Unit volumeUnits, double volumeScaleFactor,
|
||||
Unit volumeUnits, double volumeScaleFactor,
|
||||
int volumeFieldStart, int volumeFieldEnd, FieldFormat volumeFieldFormat,
|
||||
Common.Unit timeUnits, double timeScaleFactor,
|
||||
Unit timeUnits, double timeScaleFactor,
|
||||
int timeFieldStart, int timeFieldEnd, FieldFormat timeFieldFormat)
|
||||
{
|
||||
FrameLength = frameLength;
|
||||
|
||||
@@ -112,9 +112,9 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
case 2: FrameFrequency = Utils.ParseUDouble(strValue); return CfgUpdateFlags.None;
|
||||
|
||||
case 3:
|
||||
for (Common.Unit u = 0; u < Common.Unit.Count; u++)
|
||||
for (Unit u = 0; u < Unit.Count; u++)
|
||||
{
|
||||
if (Common.Units.IsQuantity(u, Quantity.Volume) && u.ToDescription().Equals(strValue))
|
||||
if (Units.IsQuantity(u, Quantity.Volume) && u.ToDescription().Equals(strValue))
|
||||
{
|
||||
VolumeUnits = u;
|
||||
return CfgUpdateFlags.None;
|
||||
@@ -132,9 +132,9 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
break;
|
||||
|
||||
case 8:
|
||||
for (Common.Unit u = 0; u < Common.Unit.Count; u++)
|
||||
for (Unit u = 0; u < Unit.Count; u++)
|
||||
{
|
||||
if (Common.Units.IsQuantity(u, Quantity.Time) && u.ToDescription().Equals(strValue))
|
||||
if (Units.IsQuantity(u, Quantity.Time) && u.ToDescription().Equals(strValue))
|
||||
{
|
||||
TimeUnits = u;
|
||||
return CfgUpdateFlags.None;
|
||||
@@ -180,9 +180,9 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
break;
|
||||
|
||||
case 3:
|
||||
for (Common.Unit u = 0; u < Common.Unit.Count; u++)
|
||||
for (Unit u = 0; u < Unit.Count; u++)
|
||||
{
|
||||
if (Common.Units.IsQuantity(u, Quantity.Volume) && u.ToDescription().Equals(strValue))
|
||||
if (Units.IsQuantity(u, Quantity.Volume) && u.ToDescription().Equals(strValue))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -199,9 +199,9 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
break;
|
||||
|
||||
case 8:
|
||||
for (Common.Unit u = 0; u < Common.Unit.Count; u++)
|
||||
for (Unit u = 0; u < Unit.Count; u++)
|
||||
{
|
||||
if (Common.Units.IsQuantity(u, Quantity.Time) && u.ToDescription().Equals(strValue))
|
||||
if (Units.IsQuantity(u, Quantity.Time) && u.ToDescription().Equals(strValue))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
/// <summary>
|
||||
/// This component = instance of this class is a placeholder for a combined main watermeter
|
||||
/// </summary>
|
||||
public class SerialStream : ComponentBase, IDevice, IRegReaderDatastream, IHasTestName, IHasClearSessionData, IOperation
|
||||
public class SerialStream : ComponentBase, IDevice, IRegReaderDatastream, ISessionDataMngmnt, IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(SerialStream));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
@@ -92,18 +92,24 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
double wmTestTime;
|
||||
|
||||
|
||||
|
||||
/// <summary> Name set by the test, to be used as a part of the opto-data log file name </summary>
|
||||
public string TestName { set { testName = value; } }
|
||||
public int TestRepeats { set { testRepeats = value; } }
|
||||
public int RepetitionNr { set { repetitionNr = value; } }
|
||||
/// <summary>
|
||||
/// Store/update values to be used as a part of the opto-data log file name.
|
||||
/// Stop data stream processing and saving, if it is enabled.
|
||||
/// </summary>
|
||||
/// <param name="test">Currently executed test</param>
|
||||
/// <param name="repetitionNr">Currently executed repetition number</param>
|
||||
public void TestIsGoingToStartSoon(Config.Entities.Test test, int repetitionNr)
|
||||
{
|
||||
/// Store/update values to be used as a part of the opto-data log file name
|
||||
testName = test.Name;
|
||||
testRepeats = test.Repeats;
|
||||
this.repetitionNr = repetitionNr;
|
||||
}
|
||||
///
|
||||
string testName;
|
||||
int testRepeats;
|
||||
int repetitionNr;
|
||||
|
||||
/// <summary> Name set by the test, to be used as a part of the opto-data log file name </summary>
|
||||
public string BenchName;
|
||||
|
||||
///
|
||||
/// Volume of water from the opto telegram
|
||||
@@ -123,6 +129,7 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
///
|
||||
/// Timestamp from the opto telegram
|
||||
///
|
||||
bool lastTimestampValid;
|
||||
private Int64 lastTimestamp;
|
||||
private double timestampSec;
|
||||
private double timestampSec0;
|
||||
@@ -183,22 +190,10 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
: base(cfg)
|
||||
{
|
||||
myCfg = cfg as SerialStreamCfg;
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear data related to a specific water meter
|
||||
/// </summary>
|
||||
public void ClearSessionData()
|
||||
{
|
||||
commFailed = false;
|
||||
datastreamFramesCount = 0;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
ClearSessionData();
|
||||
|
||||
datastreamParsingEnabled = false;
|
||||
currentFrameFormat = new FrameFormat(FrameLength, FrameFrequency,
|
||||
VolumeUnits, VolumeScaleFactor,
|
||||
@@ -228,7 +223,8 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
myCfg.StopBits);
|
||||
serialPort.Handshake = myCfg.Handshake;
|
||||
|
||||
serialPort.Open();
|
||||
serialPort.Open();
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
else if (DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
@@ -240,7 +236,32 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
{
|
||||
MessageBox.Show("Missing file C:\\TBF\\Simulate\\seriastream.txt");
|
||||
}
|
||||
log.FatalFormat("{0} simulated: {1}", Name, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
serialPort = null;
|
||||
log.FatalFormat("{0} in other mode: {1}", Name, this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear data related to a specific water meter
|
||||
/// </summary>
|
||||
public void StartSession()
|
||||
{
|
||||
commFailed = false;
|
||||
datastreamFramesCount = 0;
|
||||
}
|
||||
|
||||
public void SaveMark(object mark)
|
||||
{
|
||||
/// TODO
|
||||
}
|
||||
|
||||
public void EndSession()
|
||||
{
|
||||
datastreamParsingEnabled = false;
|
||||
}
|
||||
|
||||
public void RunDeviceBefore()
|
||||
@@ -313,6 +334,11 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
ReadPulses();
|
||||
}
|
||||
|
||||
public void TestCompleted()
|
||||
{
|
||||
/// TODO: Implement
|
||||
}
|
||||
|
||||
|
||||
int sampleNr; /// This is to determine when the test start sample should be taken
|
||||
|
||||
@@ -426,8 +452,8 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
beginWMState = volumeLtr0;
|
||||
endWMState = volumeLtr;
|
||||
wmVolume = Math.Abs(endWMState - beginWMState);
|
||||
wmPulses = (int)(wmVolume * (double)PulsesPerLtr + 0.5);
|
||||
wmRefPulses = StateMachine.ControlBoard.RefPulses;
|
||||
wmPulses = Convert.ToInt32(Math.Round(wmVolume * PulsesPerLtr));
|
||||
wmRefPulses = StateMachine.ControlBoard.RefPulses;
|
||||
wmTestTime = timestampSec - timestampSec0;
|
||||
}
|
||||
|
||||
@@ -610,7 +636,7 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
|
||||
public static double UnitVolume(Common.Unit units, double scaleFactor)
|
||||
{
|
||||
if (Common.Units.IsQuantity(units, Quantity.Volume))
|
||||
if (Units.IsQuantity(units, Quantity.Volume))
|
||||
{
|
||||
return Common.Units.ConvertFrom(units, 1.0) * scaleFactor;
|
||||
}
|
||||
|
||||
@@ -551,11 +551,15 @@ namespace TBF.Rig.Sequences
|
||||
|
||||
/// Open iPerlCommunicationForm
|
||||
ProcessData.RegisterReaders = StateMachine.GetMetersPath(simultWithPurgingTests[0]).RegisterReaders;
|
||||
#if IPERL
|
||||
Program.MainWnd.Invoke(new CommunicationFormDlgt(OpenIPerlCommForm), new object[] { this, simultWithPurgingCfg, simultWithPurgingProcParams, simultWithPurgingTests, simultWithPurgingTestParams });
|
||||
#else
|
||||
Program.MainWnd.Invoke(new CommunicationFormDlgt(OpenS640CommForm), new object[] { this, simultWithPurgingCfg, simultWithPurgingProcParams, simultWithPurgingTests, simultWithPurgingTestParams });
|
||||
#endif
|
||||
var firstRR = ProcessData.RegisterReaders.FirstOrDefault<IRegReader>(x => x != null);
|
||||
if (firstRR is TBF.Rig.TestMethods.iPerlCommunication.iPerlHead.IperlHead)
|
||||
{
|
||||
Program.MainWnd.Invoke(new CommunicationFormDlgt(OpenIPerlCommForm), new object[] { this, simultWithPurgingCfg, simultWithPurgingProcParams, simultWithPurgingTests, simultWithPurgingTestParams });
|
||||
}
|
||||
else if (firstRR is TBF.Rig.RegisterReaders.S640Stream.S640Stream)
|
||||
{
|
||||
Program.MainWnd.Invoke(new CommunicationFormDlgt(OpenS640CommForm), new object[] { this, simultWithPurgingCfg, simultWithPurgingProcParams, simultWithPurgingTests, simultWithPurgingTestParams });
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
@@ -565,10 +569,10 @@ namespace TBF.Rig.Sequences
|
||||
switch (evt)
|
||||
{
|
||||
case Event.Error:
|
||||
if (simultWithPurgingCount > 0) CloseCommunicationForm();
|
||||
if (simultWithPurgingCount > 0) CloseCommunicationForm();
|
||||
goto error;
|
||||
case Event.UiCmdStop:
|
||||
if (simultWithPurgingCount > 0) CloseCommunicationForm();
|
||||
if (simultWithPurgingCount > 0) CloseCommunicationForm();
|
||||
goto stop;
|
||||
default:
|
||||
break;
|
||||
@@ -929,22 +933,7 @@ namespace TBF.Rig.Sequences
|
||||
goto select_cycle_or_test;
|
||||
}
|
||||
StateMachine.ControlBoard.Devices = outPath;
|
||||
|
||||
if ((sensPath != null) && (sensPath.RegisterReaders != null))
|
||||
{
|
||||
ProcessData.RegisterReaders = sensPath.RegisterReaders;
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if ((rr is TestMethods.iPerlCommunication.iPerlHead.IperlHead) && (BenchInfo != null))
|
||||
{
|
||||
(rr as TestMethods.iPerlCommunication.iPerlHead.IperlHead).BenchName = BenchInfo.TestBenchName;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessData.RegisterReaders = null;
|
||||
}
|
||||
ProcessData.RegisterReaders = (sensPath != null && sensPath.RegisterReaders != null) ? sensPath.RegisterReaders : null;
|
||||
|
||||
///
|
||||
/// Execute one test (single repetition of a repeated test)
|
||||
@@ -1064,22 +1053,7 @@ namespace TBF.Rig.Sequences
|
||||
StateMachine.LoadTestParams(dfrrdData.Test);
|
||||
|
||||
StateMachine.ControlBoard.Devices = outPath;
|
||||
|
||||
if ((sensPath != null) && (sensPath.RegisterReaders != null))
|
||||
{
|
||||
ProcessData.RegisterReaders = sensPath.RegisterReaders;
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if ((rr is TestMethods.iPerlCommunication.iPerlHead.IperlHead) && (BenchInfo != null))
|
||||
{
|
||||
(rr as TestMethods.iPerlCommunication.iPerlHead.IperlHead).BenchName = BenchInfo.TestBenchName;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessData.RegisterReaders = null;
|
||||
}
|
||||
ProcessData.RegisterReaders = (sensPath != null && sensPath.RegisterReaders != null) ? sensPath.RegisterReaders : null;
|
||||
|
||||
e = testMethod.Execute2ndPass(dfrrdData.Test, dfrrdData.RepetNr, dfrrdData.IntermediateData);
|
||||
|
||||
@@ -1141,7 +1115,6 @@ namespace TBF.Rig.Sequences
|
||||
if (testMethod != null && testMethod.CanTest(StateMachine.Procedure.MetersKind))
|
||||
{
|
||||
StateMachine.LoadTestParams(test);
|
||||
|
||||
string errMsg;
|
||||
if (!testMethod.CheckDeviceCaps(test, outPath, out errMsg))
|
||||
{
|
||||
@@ -1149,22 +1122,7 @@ namespace TBF.Rig.Sequences
|
||||
goto select_cycle_or_test;
|
||||
}
|
||||
StateMachine.ControlBoard.Devices = outPath;
|
||||
|
||||
if ((sensPath != null) && (sensPath.RegisterReaders != null))
|
||||
{
|
||||
ProcessData.RegisterReaders = sensPath.RegisterReaders;
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if ((rr is TestMethods.iPerlCommunication.iPerlHead.IperlHead) && (BenchInfo != null))
|
||||
{
|
||||
(rr as TestMethods.iPerlCommunication.iPerlHead.IperlHead).BenchName = BenchInfo.TestBenchName;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ProcessData.RegisterReaders = null;
|
||||
}
|
||||
ProcessData.RegisterReaders = (sensPath != null && sensPath.RegisterReaders != null) ? sensPath.RegisterReaders : null;
|
||||
|
||||
Event rsltTransBefore = Event.Done;
|
||||
Event rsltTransAfter = Event.Done;
|
||||
@@ -1224,7 +1182,6 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
///------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/// Cycle or test completed
|
||||
goto select_cycle_or_test;
|
||||
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace TBF.Rig.Sequences
|
||||
///
|
||||
foreach (var cmpnt in StateMachine.Components)
|
||||
{
|
||||
if (cmpnt is IHasClearSessionData) (cmpnt as IHasClearSessionData).ClearSessionData();
|
||||
if (cmpnt is ISessionDataMngmnt) (cmpnt as ISessionDataMngmnt).StartSession();
|
||||
}
|
||||
|
||||
IsQ2PreCorrectionCalculated = false;
|
||||
|
||||
@@ -25,13 +25,7 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="batchNr"></param>
|
||||
/// <param name="testName"></param>
|
||||
/// <param name="repetition"></param>
|
||||
/// <returns>Graph ID</returns>
|
||||
|
||||
public int StartGraph(int batchNr, string testName, int repetition)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -490,7 +490,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(outPath.RegValve.SetFlowOp(outPath.FlowMeter, qfrom_detected, qto_detected, RefFlow, FlowSettingTimeoutSec))
|
||||
.AddOperation(outPath.RegValve.SetFlowOp(outPath.FlowMeter, qfrom_detected, qto_detected, RefFlow, FlowSettingTimeoutSec, 0))
|
||||
//.AddOp(pOut.RegulValve.SetPositionOp(35.0f, 38.0f, uint.MaxValue))
|
||||
.EnterState();
|
||||
do {
|
||||
|
||||
@@ -164,17 +164,6 @@ namespace TBF.Rig.TestMethods.DiverterTest
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Checking_tank_capacity);
|
||||
@@ -476,6 +465,11 @@ namespace TBF.Rig.TestMethods.DiverterTest
|
||||
{
|
||||
LogProcessDataHeader(processDataLogger, string.Format("Measurement {0}", divRepetNr));
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is IRegReaderDatastream) (rr as IRegReaderDatastream).TestIsGoingToStartSoon(test, repetitionNr);
|
||||
}
|
||||
|
||||
int remainingRepetitions = testParams.DivRepetitions - divRepetNr + 1;
|
||||
int pulsesNow = (remainingPulses + remainingRepetitions - 1) / remainingRepetitions;
|
||||
remainingPulses -= pulsesNow;
|
||||
|
||||
@@ -163,18 +163,6 @@ namespace TBF.Rig.TestMethods.Endurance
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Starting_the_pump);
|
||||
//------------------------------------------------
|
||||
@@ -298,6 +286,10 @@ namespace TBF.Rig.TestMethods.Endurance
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp());
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is IRegReaderDatastream) (rr as IRegReaderDatastream).TestIsGoingToStartSoon(test, repetitionNr);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
@@ -149,17 +149,6 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Optionally display prompt to emerge temperature meters to appropriate baths for heat meters test
|
||||
///
|
||||
@@ -384,6 +373,11 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
IList<IOperation> cameraMeasurementOps = new List<IOperation>();
|
||||
foreach (var camera in cameras) cameraMeasurementOps.Add(camera.MeasurementOp());
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is IRegReaderDatastream) (rr as IRegReaderDatastream).TestIsGoingToStartSoon(test, repetitionNr);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
|
||||
+4
-11
@@ -187,17 +187,6 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
bool drainTheTank = false;
|
||||
|
||||
if (repetitionNr == 1)
|
||||
@@ -531,6 +520,10 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
log.WarnFormat("Start mass = {0}kg", StartMass);
|
||||
}
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is IRegReaderDatastream) (rr as IRegReaderDatastream).TestIsGoingToStartSoon(test, repetitionNr);
|
||||
}
|
||||
|
||||
if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "Measurement");
|
||||
else LogProcessDataHeaderHeatMeters(processDataLogger, "Measurement");
|
||||
|
||||
+6
-11
@@ -202,17 +202,6 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Checking_tank_capacity);
|
||||
@@ -627,6 +616,12 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
}
|
||||
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is IRegReaderDatastream) (rr as IRegReaderDatastream).TestIsGoingToStartSoon(test, repetitionNr);
|
||||
}
|
||||
|
||||
|
||||
if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "Measurement");
|
||||
else LogProcessDataHeaderHeatMeters(processDataLogger, "Measurement");
|
||||
|
||||
|
||||
+6
-11
@@ -181,17 +181,6 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Checking_tank_capacity);
|
||||
@@ -530,6 +519,12 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
log.WarnFormat("Start mass = {0}kg", StartMass);
|
||||
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is IRegReaderDatastream) (rr as IRegReaderDatastream).TestIsGoingToStartSoon(test, repetitionNr);
|
||||
}
|
||||
|
||||
|
||||
if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "Measurement");
|
||||
else LogProcessDataHeaderHeatMeters(processDataLogger, "Measurement");
|
||||
|
||||
|
||||
@@ -417,27 +417,6 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
|
||||
temperature_set:
|
||||
|
||||
///
|
||||
/// Prepare datastream read operations
|
||||
///
|
||||
IList<IOperation> readDatastreamOps = new List<IOperation>();
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
var rrWithTestName = rr as GenericDevices.IHasTestName;
|
||||
if (rrWithTestName != null)
|
||||
{
|
||||
rrWithTestName.TestName = test.Name;
|
||||
rrWithTestName.TestRepeats = test.Repeats;
|
||||
rrWithTestName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
|
||||
var datastreamRR = rr as GenericDevices.IRegReaderDatastream;
|
||||
if (datastreamRR != null) readDatastreamOps.Add(datastreamRR.ReadDatastreamOp());
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Prepare cameras, ROI-s and measurementOperations
|
||||
///
|
||||
@@ -474,6 +453,21 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
cameraMeasurementOps.Add(camera.MeasurementOp());
|
||||
}
|
||||
|
||||
/// Prepare datastream read operations
|
||||
IList<IOperation> readDatastreamOps = new List<IOperation>();
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
var datastreamRR = rr as GenericDevices.IRegReaderDatastream;
|
||||
if (datastreamRR != null)
|
||||
{
|
||||
datastreamRR.TestIsGoingToStartSoon(test, repetitionNr);
|
||||
readDatastreamOps.Add(datastreamRR.ReadDatastreamOp());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (drainTheTank)
|
||||
{
|
||||
@@ -1097,13 +1091,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
if (rr is IRegReaderDatastream) (rr as IRegReaderDatastream).TestIsGoingToStartSoon(test, repetitionNr);
|
||||
}
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
|
||||
|
||||
@@ -186,18 +186,6 @@ namespace TBF.Rig.TestMethods.FlyingStartTankCollection
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Optionally drain the water tank
|
||||
///
|
||||
@@ -377,6 +365,11 @@ namespace TBF.Rig.TestMethods.FlyingStartTankCollection
|
||||
IList<IOperation> cameraMeasurementOps = new List<IOperation>();
|
||||
foreach (var camera in cameras) cameraMeasurementOps.Add(camera.MeasurementOp());
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
if (rr is IRegReaderDatastream) (rr as IRegReaderDatastream).TestIsGoingToStartSoon(test, repetitionNr);
|
||||
}
|
||||
|
||||
|
||||
LogProcessDataTestInfo(processDataLogger, test.Procedure.Name, test.Name);
|
||||
LogProcessDataHeader(processDataLogger, "Measurement");
|
||||
|
||||
@@ -408,8 +408,8 @@ namespace TBF.Rig.TestMethods.StandingStart
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
IOperation testInProgress = cBrd.StandingStartStopTestOp(test, 2 * totalPulses, true);
|
||||
IOperation controlFlowOp = cBrd.SetFlowOp(test.Qfrom, test.Qto, RefFlow, int.MaxValue);
|
||||
IOperation testInProgress = cBrd.StandingStartStopTestOp(test, 2 * totalPulses, false);
|
||||
IOperation controlFlowOp = cBrd.SetFlowOp(test.Qfrom, test.Qto, RefFlow, int.MaxValue, test.TimeBeforeFlow);
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Start the standing start/stop test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
|
||||
@@ -459,7 +459,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
IOperation testInProgress = cBrd.StandingStartStopTestOp(test, 2 * totalPulses, true);
|
||||
IOperation controlFlowOp = cBrd.SetFlowOp(test.Qfrom, test.Qto, RefFlow, int.MaxValue);
|
||||
IOperation controlFlowOp = cBrd.SetFlowOp(test.Qfrom, test.Qto, RefFlow, int.MaxValue, test.TimeBeforeFlow);
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Start the standing start/stop test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
public class TestMethodFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(8); } }
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new TestMethod(); }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -68,6 +68,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionGreeceIncl05Str);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionRLIncl05Str);
|
||||
retVal.Add(iPerlCommunicationForm.WriteQ2CorrectionLRIncl05Str);
|
||||
retVal.Add(iPerlCommunicationSeq.Q2correctedFromCmd + "Qx");
|
||||
retVal.Add(iPerlCommunicationSeq.StrictQ2ErrorCheckStr + "Qx");
|
||||
retVal.Add(iPerlCommunicationSeq.Q2correctionCheckCmd);
|
||||
retVal.Add(iPerlCommunicationSeq.IperlCheckCmd);
|
||||
retVal.Add(iPerlCommunicationForm.UpdateBothQ2FactorsTestRLOnlyStr);
|
||||
retVal.Add(iPerlCommunicationForm.UpdateBothQ2FactorsTestLROnlyStr);
|
||||
retVal.Add(iPerlCommunicationForm.UpdateQ2CorrectionsStr);
|
||||
@@ -80,6 +84,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
retVal.Add("---");
|
||||
retVal.Add(iPerlCommunicationForm.Reset2HzCorrectionStr);
|
||||
retVal.Add(iPerlCommunicationForm.Write2HzCorrectionStr);
|
||||
retVal.Add(iPerlCommunicationForm.DewaReworkRLStr);
|
||||
retVal.Add(iPerlCommunicationForm.DewaReworkLRStr);
|
||||
retVal.Add(string.Format("{0} if enabled", iPerlCommunicationForm.ReadConfigurationStr));
|
||||
retVal.Add(string.Format("{0} 80", iPerlCommunicationForm.SetTestModeStr));
|
||||
retVal.Add("iPerl_check prevWorkStep direction q2factors");
|
||||
|
||||
@@ -18,6 +18,11 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(iPerlCommunicationSeq));
|
||||
|
||||
public const string Q2correctedFromCmd = "q2 corrected from ";
|
||||
public const string StrictQ2ErrorCheckStr = "strict Q2 error check ";
|
||||
public const string Q2correctionCheckCmd = "q2 correction check ";
|
||||
public const string IperlCheckCmd = "iperl_check ";
|
||||
|
||||
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
///
|
||||
@@ -55,10 +60,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
const string Q2correctedFromCmd = "q2 corrected from ";
|
||||
const string Q2correctionCheckCmd = "q2 correction check ";
|
||||
const string IperlCheckCmd = "iperl_check ";
|
||||
|
||||
if (testParams.Activity.ToLower().Equals(iPerlCommunicationForm.GetDefaultQ2CorrectionsStr.ToLower()))
|
||||
{
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
|
||||
@@ -129,6 +130,22 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
|
||||
return new List<Event> { Event.Done };
|
||||
}
|
||||
else if (testParams.Activity.ToLower().Contains(StrictQ2ErrorCheckStr))
|
||||
{
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.JustStarted));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.FlowSetting));
|
||||
|
||||
string fromTestName = testParams.Activity.Substring(Q2correctedFromCmd.Length);
|
||||
|
||||
StrictQ2ErrorCheck(test.Name, fromTestName);
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.Completed));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(test.Name, 0)));
|
||||
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
|
||||
|
||||
return new List<Event> { Event.Done };
|
||||
}
|
||||
else if (testParams.Activity.ToLower().Contains(Q2correctionCheckCmd))
|
||||
{
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
|
||||
@@ -159,7 +176,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
int maxTestIndex = (ProcessData.BenchInfo is DataContainer.iPerlBenchInfo.Component)
|
||||
? (ProcessData.BenchInfo as DataContainer.iPerlBenchInfo.Component).MaxTestIndex
|
||||
: int.MaxValue;
|
||||
|
||||
|
||||
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(test.Name, 0);
|
||||
|
||||
if (tstRslt != null)
|
||||
@@ -267,77 +284,77 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
|
||||
return new List<Event> { Event.Done };
|
||||
}
|
||||
else if (testParams.Activity.ToLower().Contains("simulate "))
|
||||
{
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 } );
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.JustStarted));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.FlowSetting));
|
||||
else if (testParams.Activity.ToLower().Contains("simulate "))
|
||||
{
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.JustStarted));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.FlowSetting));
|
||||
|
||||
if (testParams.Activity.ToLower().Contains("q3")) MakeSimulated(test, 1, 0, -0.5f);
|
||||
else if (testParams.Activity.ToLower().Contains("q2")) MakeSimulated(test, 1, 0, 0.5f);
|
||||
else if (testParams.Activity.ToLower().Contains("q1")) MakeSimulated(test, 1, 0, -5.1f);
|
||||
else if (testParams.Activity.ToLower().Contains("compound ok")) MakeSimulatedCompound(test, 1, 0, 0.7f, 1.0f);
|
||||
else if (testParams.Activity.ToLower().Contains("compound nok")) MakeSimulatedCompound(test, 1, 0, 4.7f, 0.9f);
|
||||
else if (testParams.Activity.ToLower().Contains("compound rise")) MakeSimulatedCompound(test, 1, 0, 0.7f, 0.0f);
|
||||
else if (testParams.Activity.ToLower().Contains("compound fall")) MakeSimulatedCompound(test, 1, 0, 0.7f, 0.9f);
|
||||
if (testParams.Activity.ToLower().Contains("q3")) MakeSimulated(test, 1, 0, -0.5f);
|
||||
else if (testParams.Activity.ToLower().Contains("q2")) MakeSimulated(test, 1, 0, 0.5f);
|
||||
else if (testParams.Activity.ToLower().Contains("q1")) MakeSimulated(test, 1, 0, -5.1f);
|
||||
else if (testParams.Activity.ToLower().Contains("compound ok")) MakeSimulatedCompound(test, 1, 0, 0.7f, 1.0f);
|
||||
else if (testParams.Activity.ToLower().Contains("compound nok")) MakeSimulatedCompound(test, 1, 0, 4.7f, 0.9f);
|
||||
else if (testParams.Activity.ToLower().Contains("compound rise")) MakeSimulatedCompound(test, 1, 0, 0.7f, 0.0f);
|
||||
else if (testParams.Activity.ToLower().Contains("compound fall")) MakeSimulatedCompound(test, 1, 0, 0.7f, 0.9f);
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.Completed));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(Results.Utils.GetTestName(test.Name, 1, 1), 0)));
|
||||
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.Completed));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(Results.Utils.GetTestName(test.Name, 1, 1), 0)));
|
||||
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, testParams.Activity);
|
||||
//------------------------------------------------
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, testParams.Activity);
|
||||
//------------------------------------------------
|
||||
|
||||
State.Create(string.Format("iPerlCommunicationSeq : {0}", testParams.Activity))
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
State.Create(string.Format("iPerlCommunicationSeq : {0}", testParams.Activity))
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
if (TestAndLogUiCmdStop(test, e))
|
||||
{
|
||||
return new List<Event> { Event.UiCmdStop };
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
/// Show the modeless dialog with error indication
|
||||
///
|
||||
Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, cfg, test, testParams });
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
/// Show the modeless dialog with error indication
|
||||
///
|
||||
Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, cfg, test, testParams });
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.iPerl_Communication_in_progress);
|
||||
//------------------------------------------------
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.iPerl_Communication_in_progress);
|
||||
//------------------------------------------------
|
||||
|
||||
bool stopPressed = false; /// true when STOP button pressed
|
||||
bool completed = false;
|
||||
bool stopPressed = false; /// true when STOP button pressed
|
||||
bool completed = false;
|
||||
|
||||
State.Create("iPerlCommunicationSeq : Wait until the entry form is closed")
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
stopPressed = TestAndLogUiCmdStop(test,e);
|
||||
completed = (modelessDlg is GenericDevices.IHasCompleted)
|
||||
&& (modelessDlg as GenericDevices.IHasCompleted).Completed;
|
||||
}
|
||||
while (!stopPressed && !completed);
|
||||
State.Create("iPerlCommunicationSeq : Wait until the entry form is closed")
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
stopPressed = TestAndLogUiCmdStop(test, e);
|
||||
completed = (modelessDlg is GenericDevices.IHasCompleted)
|
||||
&& (modelessDlg as GenericDevices.IHasCompleted).Completed;
|
||||
}
|
||||
while (!stopPressed && !completed);
|
||||
|
||||
if (stopPressed)
|
||||
{
|
||||
CloseIPerlCommForm();
|
||||
return new List<Event> { Event.UiCmdStop };
|
||||
}
|
||||
else
|
||||
{
|
||||
TBF.UiBridge.Bridge.OnTestProgress(null, new TBF.UiBridge.TestProgressEventArgs(test.Name, Progress.Completed));
|
||||
}
|
||||
if (stopPressed)
|
||||
{
|
||||
CloseIPerlCommForm();
|
||||
return new List<Event> { Event.UiCmdStop };
|
||||
}
|
||||
else
|
||||
{
|
||||
TBF.UiBridge.Bridge.OnTestProgress(null, new TBF.UiBridge.TestProgressEventArgs(test.Name, Progress.Completed));
|
||||
}
|
||||
|
||||
/// Test 'Quit'
|
||||
modelessDlg = null; /// Modeless dialog is closed now
|
||||
}
|
||||
/// Test 'Quit'
|
||||
modelessDlg = null; /// Modeless dialog is closed now
|
||||
}
|
||||
|
||||
return new List<Event> { Event.Done };
|
||||
}
|
||||
@@ -603,6 +620,151 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluate a given Q2 test result agains stricter error limits when Oruefindex == 1.
|
||||
/// </summary>
|
||||
/// <param name="testName">This test name</param>
|
||||
/// <param name="oriTestRslt">Name of Q2 test done before Q2 correction (Q2adj)</param>
|
||||
/// <remarks>Assuming this test does not have multiple parts (part = 0)</remarks>
|
||||
void StrictQ2ErrorCheck(string testName, string oriTestName)
|
||||
{
|
||||
Results.Entities.TestRslt oriTestRslt = ProcessData.BatchRslts.GetTestRslt(oriTestName, 0);
|
||||
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(testName, 0);
|
||||
|
||||
if (oriTestRslt == null || tstRslt == null) return;
|
||||
|
||||
tstRslt.Components = oriTestRslt.Components;
|
||||
|
||||
/// Auxiliary results, as in SequenceBase.UpdateTemoPressDensAmb()
|
||||
tstRslt.AmbTempMean = oriTestRslt.AmbTempMean;
|
||||
tstRslt.AmbTempStart = oriTestRslt.AmbTempStart;
|
||||
tstRslt.AmbTempEnd = oriTestRslt.AmbTempEnd;
|
||||
tstRslt.AmbTempMin = oriTestRslt.AmbTempMin;
|
||||
tstRslt.AmbTempMax = oriTestRslt.AmbTempMax;
|
||||
tstRslt.AmbPressMean = oriTestRslt.AmbPressMean;
|
||||
tstRslt.AmbPressStart = oriTestRslt.AmbPressStart;
|
||||
tstRslt.AmbPressEnd = oriTestRslt.AmbPressEnd;
|
||||
tstRslt.AmbPressMin = oriTestRslt.AmbPressMin;
|
||||
tstRslt.AmbPressMax = oriTestRslt.AmbPressMax;
|
||||
tstRslt.AmbHumiMean = oriTestRslt.AmbHumiMean;
|
||||
tstRslt.AmbHumiStart = oriTestRslt.AmbHumiStart;
|
||||
tstRslt.AmbHumiEnd = oriTestRslt.AmbHumiEnd;
|
||||
tstRslt.AmbHumiMin = oriTestRslt.AmbHumiMin;
|
||||
tstRslt.AmbHumiMax = oriTestRslt.AmbHumiMax;
|
||||
tstRslt.PressUpMean = oriTestRslt.PressUpMean;
|
||||
tstRslt.PressUpStart = oriTestRslt.PressUpStart;
|
||||
tstRslt.PressUpEnd = oriTestRslt.PressUpEnd;
|
||||
tstRslt.PressUpMin = oriTestRslt.PressUpMin;
|
||||
tstRslt.PressUpMax = oriTestRslt.PressUpMax;
|
||||
tstRslt.PressDownMean = oriTestRslt.PressDownMean;
|
||||
tstRslt.PressDownStart = oriTestRslt.PressDownStart;
|
||||
tstRslt.PressDownEnd = oriTestRslt.PressDownEnd;
|
||||
tstRslt.PressDownMin = oriTestRslt.PressDownMin;
|
||||
tstRslt.PressDownMax = oriTestRslt.PressDownMax;
|
||||
tstRslt.PressDeltaMean = oriTestRslt.PressDeltaMean;
|
||||
tstRslt.PressDeltaStart = oriTestRslt.PressDeltaStart;
|
||||
tstRslt.PressDeltaEnd = oriTestRslt.PressDeltaEnd;
|
||||
tstRslt.PressDeltaMin = oriTestRslt.PressDeltaMin;
|
||||
tstRslt.PressDeltaMax = oriTestRslt.PressDeltaMax;
|
||||
tstRslt.ConductMean = oriTestRslt.ConductMean;
|
||||
tstRslt.ConductStart = oriTestRslt.ConductStart;
|
||||
tstRslt.ConductEnd = oriTestRslt.ConductEnd;
|
||||
tstRslt.ConductMin = oriTestRslt.ConductMin;
|
||||
tstRslt.ConductMax = oriTestRslt.ConductMax;
|
||||
tstRslt.TempUpMean = oriTestRslt.TempUpMean;
|
||||
tstRslt.TempUpStart = oriTestRslt.TempUpStart;
|
||||
tstRslt.TempUpEnd = oriTestRslt.TempUpEnd;
|
||||
tstRslt.TempUpMin = oriTestRslt.TempUpMin;
|
||||
tstRslt.TempUpMax = oriTestRslt.TempUpMax;
|
||||
tstRslt.TempDownMean = oriTestRslt.TempDownMean;
|
||||
tstRslt.TempDownStart = oriTestRslt.TempDownStart;
|
||||
tstRslt.TempDownEnd = oriTestRslt.TempDownEnd;
|
||||
tstRslt.TempDownMin = oriTestRslt.TempDownMin;
|
||||
tstRslt.TempDownMax = oriTestRslt.TempDownMax;
|
||||
tstRslt.TempDivMean = oriTestRslt.TempDivMean;
|
||||
tstRslt.TempDivStart = oriTestRslt.TempDivStart;
|
||||
tstRslt.TempDivEnd = oriTestRslt.TempDivEnd;
|
||||
tstRslt.TempDivMin = oriTestRslt.TempDivMin;
|
||||
tstRslt.TempDivMax = oriTestRslt.TempDivMax;
|
||||
tstRslt.DensityIn = oriTestRslt.DensityIn;
|
||||
tstRslt.DensityLine = oriTestRslt.DensityLine;
|
||||
tstRslt.DensityDiv = oriTestRslt.DensityDiv;
|
||||
|
||||
tstRslt.StartTime = oriTestRslt.StartTime;
|
||||
tstRslt.EndTime = oriTestRslt.EndTime;
|
||||
tstRslt.FlowSetTime = oriTestRslt.FlowSetTime;
|
||||
tstRslt.TestTime = oriTestRslt.TestTime;
|
||||
tstRslt.PulsesMaster = oriTestRslt.PulsesMaster;
|
||||
tstRslt.ConstMasterRaw = oriTestRslt.ConstMasterRaw;
|
||||
tstRslt.ConstMaster = oriTestRslt.ConstMaster;
|
||||
tstRslt.MassStartRaw = oriTestRslt.MassStartRaw;
|
||||
tstRslt.MassStart = oriTestRslt.MassStart;
|
||||
tstRslt.MassEndRaw = oriTestRslt.MassEndRaw;
|
||||
tstRslt.MassEnd = oriTestRslt.MassEnd;
|
||||
tstRslt.MassOfEvapWater = oriTestRslt.MassOfEvapWater;
|
||||
tstRslt.FlowMass = oriTestRslt.FlowMass;
|
||||
tstRslt.FlowVolume = oriTestRslt.FlowVolume;
|
||||
tstRslt.VolumeCTV = oriTestRslt.VolumeCTV;
|
||||
tstRslt.VolumeMaster = oriTestRslt.VolumeMaster;
|
||||
tstRslt.ErrorMaster = oriTestRslt.ErrorMaster;
|
||||
|
||||
tstRslt.FlowMean = oriTestRslt.FlowMean;
|
||||
tstRslt.FlowMin = oriTestRslt.FlowMin;
|
||||
tstRslt.FlowMax = oriTestRslt.FlowMax;
|
||||
|
||||
tstRslt.Custom1 = oriTestRslt.Custom1;
|
||||
tstRslt.Custom2 = oriTestRslt.Custom2;
|
||||
tstRslt.Custom3 = oriTestRslt.Custom3;
|
||||
tstRslt.Custom4 = oriTestRslt.Custom4;
|
||||
tstRslt.Custom5 = oriTestRslt.Custom5;
|
||||
tstRslt.Custom6 = oriTestRslt.Custom6;
|
||||
tstRslt.Custom7 = oriTestRslt.Custom7;
|
||||
tstRslt.Custom8 = oriTestRslt.Custom8;
|
||||
|
||||
for (int i = 0; i < ProcessData.BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
Results.Entities.MeterTestRslt oriMeterRslt = ProcessData.BatchRslts.GetMeterTestRslt(oriTestName, i, CompoundMeterId.Single);
|
||||
Results.Entities.MeterTestRslt meterRslt = ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
|
||||
|
||||
/// Reference to iPerl water meter or null:
|
||||
TestMethods.iPerlCommunication.iPerlHead.IperlHead iPerl = ((sensPath != null) && (sensPath.RegisterReaders != null) && (i < sensPath.RegisterReaders.Length))
|
||||
? (sensPath.RegisterReaders[i] as TestMethods.iPerlCommunication.iPerlHead.IperlHead)
|
||||
: null;
|
||||
|
||||
#if ORACLE_DB
|
||||
meterRslt.ErrorBC = oriMeterRslt.Error;
|
||||
#endif
|
||||
meterRslt.PulsesMeter = oriMeterRslt.PulsesMeter;
|
||||
meterRslt.PulsesMaster = oriMeterRslt.PulsesMaster;
|
||||
meterRslt.PulsesPerLiter = oriMeterRslt.PulsesPerLiter;
|
||||
meterRslt.VolumeRef = oriMeterRslt.VolumeRef;
|
||||
meterRslt.TestTime = oriMeterRslt.TestTime;
|
||||
|
||||
if (iPerl != null && ProcessData.BatchRslts.Batch.WaterMeters[i] != null &&
|
||||
!ProcessData.BatchRslts.Batch.WaterMeters[i].Disabled)
|
||||
{
|
||||
/// Either no iPerl head or no Q2 correction
|
||||
meterRslt.Error = oriMeterRslt.Error;
|
||||
meterRslt.VolumeMeter = oriMeterRslt.VolumeMeter;
|
||||
meterRslt.VolumeStart = oriMeterRslt.VolumeStart;
|
||||
meterRslt.VolumeEnd = oriMeterRslt.VolumeEnd;
|
||||
#if ORACLE_DB
|
||||
if (ProcessData.BatchRslts.Batch.WaterMeters[i].Pruefindex == 1)
|
||||
{
|
||||
meterRslt.Passed = (oriMeterRslt.Error >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin()
|
||||
&& oriMeterRslt.Error <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin());
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
meterRslt.Passed = oriMeterRslt.Passed;
|
||||
}
|
||||
meterRslt.TestDone = true;
|
||||
tstRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Check results of 2 tests: before Q2 correction and after Q2 correction.
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
|
||||
|
||||
namespace TBF.Rig.TestMethods.iPerlCommunication
|
||||
{
|
||||
public class iPerlDataWrite
|
||||
{
|
||||
public MessageID MessageID;
|
||||
public int Offset;
|
||||
public byte[] Data;
|
||||
public string Description;
|
||||
|
||||
public iPerlDataWrite(MessageID mesageID, int offset, byte[] data, string description)
|
||||
{
|
||||
MessageID = mesageID;
|
||||
Offset = offset;
|
||||
Data = data;
|
||||
Description = description;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,9 +99,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
Count /// Number of flow states
|
||||
}
|
||||
|
||||
public enum OptoState
|
||||
public enum DataStreamState
|
||||
{
|
||||
Read,
|
||||
Flush,
|
||||
Flush = 0,
|
||||
ProcessAndSave,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,25 +11,26 @@ using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Rig.Output;
|
||||
using TBF.Rig.Sequences;
|
||||
|
||||
namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
{
|
||||
/// <summary>
|
||||
/// This component = instance of this class is a placeholder for a combined main watermeter
|
||||
/// </summary>
|
||||
public class IperlHead : ComponentBase, IDevice, IRegReaderDatastream, IHasTestName, IHasClearSessionData, IOperation
|
||||
public class IperlHead : ComponentBase, IDevice, IRegReaderDatastream, ISessionDataMngmnt, IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(IperlHead));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
#if TURA_SPECIAL
|
||||
public const int MaxOptoDataCount = 250000;
|
||||
public const int OptoDataBufferSize = 250000;
|
||||
#else
|
||||
public const int MaxOptoDataCount = 40000;
|
||||
public const int OptoDataBufferSize = 40000; /// Opto data count is not limitted by the buffer size
|
||||
#endif
|
||||
public const string OptoDataDirectory = "C:\\TBF\\ProcessData";
|
||||
public const int StartOptoDataCount = MaxOptoDataCount / 2;
|
||||
public const int EndOptoDataCount = MaxOptoDataCount - StartOptoDataCount;
|
||||
public const int StartOptoDataCount = OptoDataBufferSize / 2;
|
||||
public const int EndOptoDataCount = OptoDataBufferSize - StartOptoDataCount;
|
||||
public const int StartEndFilterSamplesCount2 = 20; /// StartEndFilterSamplesCount = 2 * StartEndFilterSamplesCount2 + 1
|
||||
public const int FeatureVectorSize = 9;
|
||||
|
||||
@@ -212,7 +213,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
/// <returns>Calculated Q2 correction factor</returns>
|
||||
public double CalculateQ2CorrectionFactor(Results.Entities.MeterTestRslt q2adjResult, double calibTarget, double nominalFlow, int currentFactor = 0)
|
||||
{
|
||||
double nominalTestFlowLph = Common.Units.ConvertTo(Common.Unit.lph, nominalFlow);
|
||||
double nominalTestFlowLph = Units.ConvertTo(Common.Unit.lph, nominalFlow);
|
||||
double volumeRefShiftedToTarget = q2adjResult.VolumeRef * (1.0 + calibTarget / 100.0);
|
||||
double q2adjErrorShiftedToTarget = Formulas.ErrorFromVolumes(q2adjResult.VolumeMeter, volumeRefShiftedToTarget);
|
||||
|
||||
@@ -273,18 +274,57 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Name set by the test, to be used as a part of the opto-data log file name </summary>
|
||||
public string TestName { set { testName = value; } }
|
||||
public int TestRepeats { set { testRepeats = value; } }
|
||||
public int RepetitionNr { set { repetitionNr = value; } }
|
||||
/// <summary>
|
||||
/// Store/update values to be used as a part of the opto-data log file name.
|
||||
/// Stop data stream processing and saving, if it is enabled.
|
||||
/// </summary>
|
||||
/// <param name="test">Currently executed test</param>
|
||||
/// <param name="repetitionNr">Currently executed repetition number</param>
|
||||
public void TestIsGoingToStartSoon(Test test, int repetitionNr)
|
||||
{
|
||||
/// Store/update values to be used as a part of the opto-data log file name
|
||||
testName = test.Name;
|
||||
testRepeats = test.Repeats;
|
||||
this.repetitionNr = repetitionNr;
|
||||
|
||||
if (IsDataStreamProcessing())
|
||||
{
|
||||
StopDataStreamProcessing();
|
||||
|
||||
/// Dummy '#### start test ####' and '#### end of test ####' marks are added
|
||||
/// to the raw data file on request of Joern Goege
|
||||
if (optoDataCount >= 100 && optoDataCount <= optoData.Length &&
|
||||
optoData[40].Flags == OptoTelegramFlags.OK &&
|
||||
optoData[optoDataCount - 40].Flags == OptoTelegramFlags.OK)
|
||||
{
|
||||
optoData[40].Flags = OptoTelegramFlags.OK_TestStart;
|
||||
optoData[optoDataCount - 40].Flags = OptoTelegramFlags.OK_TestEnd;
|
||||
}
|
||||
|
||||
DataStreamPostProcessing();
|
||||
|
||||
string pcbNr = (ConfigStruct != null) ? ConfigStruct.GetPcbNrString() : "UnknownPcbNr";
|
||||
string wmPosition = Name.Substring(5); /// WMPosition is extracted from a component name in form 'iPerl#'
|
||||
if (wmPosition.Length == 1) wmPosition = "0" + wmPosition;
|
||||
string cycleStartTime = StateMachine.CycleStartTimeStamp.ToString("HH_mm_ss");
|
||||
///
|
||||
string relativeDirectory = Path.Combine(StateMachine.CycleStartTimeStamp.ToString("yy"),
|
||||
StateMachine.CycleStartTimeStamp.ToString("MM"),
|
||||
StateMachine.CycleStartTimeStamp.ToString("dd"));
|
||||
string directory = Path.Combine(OptoDataDirectory, relativeDirectory);
|
||||
string fileName = string.Format("{0}_{1}_{2}_{3}.txt", pcbNr, wmPosition, "WM", cycleStartTime);
|
||||
|
||||
if (SaveOptoDataToFile(directory, fileName))
|
||||
{
|
||||
extraDataPath = Path.Combine(relativeDirectory, fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
///
|
||||
string testName;
|
||||
int testRepeats;
|
||||
int repetitionNr;
|
||||
|
||||
/// <summary> Name set by the test, to be used as a part of the opto-data log file name </summary>
|
||||
public string BenchName;
|
||||
|
||||
|
||||
///
|
||||
/// Indices to determine centers of start / end samples
|
||||
@@ -341,8 +381,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
|
||||
|
||||
OptoTelegramRaw[] optoData;
|
||||
int optoDataCount;
|
||||
string optoDataLogFileName;
|
||||
int optoDataCount; /// Real opto deta count, can be larger then optoData.Length
|
||||
///
|
||||
OptoTelegramRaw toBeFlushed;
|
||||
|
||||
@@ -363,26 +402,25 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
ClearSessionData();
|
||||
flowDirectionDetection = new FlowDirectionDetection();
|
||||
|
||||
/// Allocate memory for opto-data from iPerl
|
||||
optoData = new OptoTelegramRaw[MaxOptoDataCount];
|
||||
for (int i = 0; i < MaxOptoDataCount; i++)
|
||||
optoData = new OptoTelegramRaw[OptoDataBufferSize];
|
||||
for (int i = 0; i < OptoDataBufferSize; i++)
|
||||
{
|
||||
optoData[i] = new OptoTelegramRaw();
|
||||
}
|
||||
|
||||
toBeFlushed = new OptoTelegramRaw();
|
||||
|
||||
optoSerialPortParsingEnabled = false;
|
||||
dataStreamState = DataStreamState.Flush;
|
||||
synchronized = false;
|
||||
synchronized2 = false;
|
||||
partOfTelegram = string.Empty;
|
||||
|
||||
if (DebugLevel == DebugMode.Normal)
|
||||
{
|
||||
/// Prepare serial port
|
||||
/// Open serial port: 9600 Bd, 8 data bits, 1 stop bit, no parity
|
||||
string portName = string.Format("COM{0}", iperlHeadCfg.OptoComPortNr);
|
||||
optoSerialPort = new SerialPort(portName, 9600, Parity.None, 8, StopBits.One);
|
||||
optoSerialPort.Handshake = Handshake.None;
|
||||
@@ -399,7 +437,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
/// <summary>
|
||||
/// Clear data related to a specific water meter
|
||||
/// </summary>
|
||||
public void ClearSessionData()
|
||||
public void StartSession()
|
||||
{
|
||||
ResultCode = 0;
|
||||
|
||||
@@ -418,12 +456,20 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
Q2ErrWOCorrection = 0;
|
||||
Q2CorrRL = 0;
|
||||
Q2CorrLR = 0;
|
||||
|
||||
/// Clear the data buffer
|
||||
optoDataCount = 0;
|
||||
|
||||
dataStreamState = DataStreamState.Flush;
|
||||
|
||||
currentFlowDir = InitFlowDir;
|
||||
if (flowDirectionDetection != null) flowDirectionDetection.ClearFifo(); /// Clear FIFO for flow direction detection
|
||||
}
|
||||
|
||||
public void SaveMark(object mark)
|
||||
{
|
||||
/// TODO
|
||||
}
|
||||
|
||||
public void EndSession()
|
||||
{
|
||||
StopDataStreamProcessing();
|
||||
}
|
||||
|
||||
|
||||
@@ -462,7 +508,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
{
|
||||
try
|
||||
{
|
||||
ReadOptoData(optoSerialPortParsingEnabled ? OptoState.Read : OptoState.Flush);
|
||||
ReadOptoData(dataStreamState);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -520,137 +566,107 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
timestampSec = 0;
|
||||
timestampSec0 = 0;
|
||||
|
||||
/// Clear the feature vector
|
||||
for (int i = 0; i < FeatureVectorSize; i++) x[i] = 0;
|
||||
extraDataPath = null;
|
||||
|
||||
ReadPulses();
|
||||
/// Clear the feature vector
|
||||
for (int i = 0; i < FeatureVectorSize; i++)
|
||||
{
|
||||
x[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void TestCompleted()
|
||||
{
|
||||
/// TODO: Implement
|
||||
}
|
||||
|
||||
|
||||
int timeFromStart; /// [s] Time from test start to determine when the test start sample should be taken
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
/// <summary>
|
||||
/// Start this operation
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
Clear();
|
||||
|
||||
/// Reset opto data, etc.
|
||||
timeFromStart = 0;
|
||||
optoDataCount = 0;
|
||||
currentTelegramIx = -1;
|
||||
startSampleAcquired = false;
|
||||
TestStartTelegramIx = 0;
|
||||
endTelegramIdx1 = 0;
|
||||
endTelegramIdx2 = 0;
|
||||
endTelegramIdx3 = 0;
|
||||
TestEndTelegramIx = 0;
|
||||
|
||||
|
||||
///
|
||||
/// Determine opto data file name: PCB_AA_BB_HH_MI_SS..txt
|
||||
///
|
||||
Results.Output.SensusTestInfo[] localTestInfos = Sequences.ProcessData.CompleteTestInfos;
|
||||
if (localTestInfos == null && StateMachine.Procedure != null)
|
||||
lock (this)
|
||||
{
|
||||
localTestInfos = Results.Output.SensusTestInfo.CreateFromProcedure(StateMachine.Procedure);
|
||||
Clear();
|
||||
ReadPulses();
|
||||
StartDataStreamProcessing();
|
||||
}
|
||||
///
|
||||
string fullTestName = Results.Utils.GetTestName(testName, testRepeats, repetitionNr);
|
||||
string qBezeichnungOpto = null; /// To be determined from TestInfo-s (if there are any)
|
||||
if (localTestInfos != null)
|
||||
{
|
||||
foreach (var ti in localTestInfos)
|
||||
{
|
||||
if ((ti.PruefungsNrOpto != 0) && (ti.TestName == fullTestName))
|
||||
{
|
||||
qBezeichnungOpto = string.IsNullOrEmpty(ti.QBezeichnungOpto) ? ti.PruefungsNrOpto.ToString("D2") : ti.QBezeichnungOpto;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (qBezeichnungOpto == null)
|
||||
{
|
||||
qBezeichnungOpto = fullTestName; /// No appropriate TestInfo found => set default opto data file name
|
||||
}
|
||||
///
|
||||
string pcbNr = (ConfigStruct != null) ? ConfigStruct.GetPcbNrString() : "UnknownPcbNr";
|
||||
string wmPosition = Name.Substring(5); /// WMPosition is extracted from a component name in form 'iPerl#'
|
||||
if (wmPosition.Length == 1) wmPosition = "0" + wmPosition;
|
||||
string cycleStartTime = StateMachine.CycleStartTimeStamp.ToString("HH_mm_ss");
|
||||
///
|
||||
optoDataLogFileName = string.Format("{0}_{1}_{2}_{3}.txt", pcbNr, wmPosition, qBezeichnungOpto, cycleStartTime);
|
||||
|
||||
extraDataPath = null;
|
||||
|
||||
StartParsingOptoSerialPort();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <summary>
|
||||
/// Run this operation
|
||||
/// </summary>
|
||||
/// <returns>eventDone</returns>
|
||||
public Event Run()
|
||||
{
|
||||
timeFromStart += StateMachine.Period;
|
||||
ReadPulses();
|
||||
lock (this)
|
||||
{
|
||||
timeFromStart += StateMachine.Period;
|
||||
ReadPulses();
|
||||
|
||||
if (!startSampleAcquired && (timeFromStart >= 8) && (currentTelegramIx >= 0))
|
||||
{
|
||||
/// Take the test start sample
|
||||
startSampleAcquired = true;
|
||||
TestStartTelegramIx = currentTelegramIx;
|
||||
}
|
||||
else if (startSampleAcquired)
|
||||
{
|
||||
/// Shift data in pipelines
|
||||
TestEndTelegramIx = endTelegramIdx3;
|
||||
endTelegramIdx3 = endTelegramIdx2;
|
||||
endTelegramIdx2 = endTelegramIdx1;
|
||||
endTelegramIdx1 = currentTelegramIx;
|
||||
if (!startSampleAcquired && (timeFromStart >= 8) && (currentTelegramIx >= 0))
|
||||
{
|
||||
/// Take the test start sample
|
||||
startSampleAcquired = true;
|
||||
TestStartTelegramIx = currentTelegramIx;
|
||||
}
|
||||
else if (startSampleAcquired)
|
||||
{
|
||||
/// Shift data in pipelines
|
||||
TestEndTelegramIx = endTelegramIdx3;
|
||||
endTelegramIdx3 = endTelegramIdx2;
|
||||
endTelegramIdx2 = endTelegramIdx1;
|
||||
endTelegramIdx1 = currentTelegramIx;
|
||||
}
|
||||
}
|
||||
|
||||
return Event.ReadRegisterDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
/// <summary>
|
||||
/// Stop this operation
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
int startIx = BufferIdx(TestStartTelegramIx);
|
||||
int endIx = BufferIdx(TestEndTelegramIx);
|
||||
|
||||
log.WarnFormat("IperlHeadd.Stop() startIx={0} endIx={1} optoData.Len={2} filename={3}", startIx, endIx, optoData.Length, !string.IsNullOrEmpty(optoDataLogFileName) ? optoDataLogFileName : "<null>");
|
||||
|
||||
if ((startIx > 0) && (startIx < StartOptoDataCount) && (optoData[startIx].Flags == OptoTelegramFlags.OK))
|
||||
{
|
||||
optoData[startIx].Flags = OptoTelegramFlags.OK_TestStart;
|
||||
OptoTelegramRaw.TestStartTimestampDec = optoData[startIx].TimestampDec();
|
||||
}
|
||||
|
||||
if ((endIx > 0) && (optoData[endIx].Flags == OptoTelegramFlags.OK))
|
||||
{
|
||||
optoData[endIx].Flags = OptoTelegramFlags.OK_TestEnd;
|
||||
}
|
||||
|
||||
log.DebugFormat("Flow filtering start: {0:HH:mm:ss.fff}", DateTime.Now);
|
||||
|
||||
StopParsingOptoSerialPort();
|
||||
if (optoDataCount <= MaxOptoDataCount)
|
||||
{
|
||||
FIRFilterFlow(optoData, 0, optoDataCount - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
FIRFilterFlow(optoData, 0, StartOptoDataCount - 1);
|
||||
FIRFilterFlow(optoData, (optoDataCount - EndOptoDataCount), optoDataCount - 1);
|
||||
}
|
||||
|
||||
log.DebugFormat("Flow filtering end, feature vector calculation start: {0:HH:mm:ss.fff}", DateTime.Now);
|
||||
|
||||
Common.Utils.CalculateFeatureVector(optoData, optoDataCount, startIx, endIx, ref x);
|
||||
int startIx;
|
||||
int endIx;
|
||||
|
||||
log.DebugFormat("Feature vector calculation end, save opto-file start: {0:HH:mm:ss.fff}", DateTime.Now);
|
||||
lock (this)
|
||||
{
|
||||
StopDataStreamProcessing();
|
||||
AddTestStartEndMarksToData(out startIx, out endIx);
|
||||
}
|
||||
|
||||
extraDataPath = SaveOptoData();
|
||||
DataStreamPostProcessing();
|
||||
|
||||
log.DebugFormat("Save opto-file end: {0:HH:mm:ss.fff}", DateTime.Now);
|
||||
// TODO: Enable when calculations completed
|
||||
//
|
||||
// float[] offsetV, kOhmsR, kOhmsC, dutFlow, refFlow, flowRatio, magField, emfV;
|
||||
// x = Common.StatisticalMetrics.Calculate(optoData, optoDataCount, startIx, endIx, true,
|
||||
// out offsetV, out kOhmsR, out kOhmsC, out dutFlow,
|
||||
// out refFlow, out flowRatio, out magField, out emfV);
|
||||
//
|
||||
// log.DebugFormat("Feature vector calculation end, save opto-file start: {0:HH:mm:ss.fff}", DateTime.Now);
|
||||
|
||||
string relativeDirectory = Path.Combine(StateMachine.CycleStartTimeStamp.ToString("yy"),
|
||||
StateMachine.CycleStartTimeStamp.ToString("MM"),
|
||||
StateMachine.CycleStartTimeStamp.ToString("dd"));
|
||||
string directory = Path.Combine(OptoDataDirectory, relativeDirectory);
|
||||
string fileName = DetermineExtraDataFileName();
|
||||
if (!string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
if (SaveOptoDataToFile(directory, fileName))
|
||||
{
|
||||
extraDataPath = Path.Combine(relativeDirectory, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
log.WarnFormat("IperlHeadd.Stop() startIx={0} endIx={1} optoData.Len={2} filename={3}", startIx, endIx, optoData.Length, !string.IsNullOrEmpty(fileName) ? fileName : "<null>");
|
||||
|
||||
if (TestStartTelegramIx == 0 || optoDataCount < 100)
|
||||
{
|
||||
@@ -662,73 +678,163 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save opto data to a file.
|
||||
/// </summary>
|
||||
string SaveOptoData()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(optoDataLogFileName))
|
||||
void AddTestStartEndMarksToData(out int startIx, out int endIx)
|
||||
{
|
||||
startIx = BufferIdx(TestStartTelegramIx);
|
||||
if ((startIx > 0) && (startIx < StartOptoDataCount) && (optoData[startIx].Flags == OptoTelegramFlags.OK))
|
||||
{
|
||||
string relativeDirectory = Path.Combine(StateMachine.CycleStartTimeStamp.ToString("yy"),
|
||||
StateMachine.CycleStartTimeStamp.ToString("MM"),
|
||||
StateMachine.CycleStartTimeStamp.ToString("dd"));
|
||||
string fullFileName = Path.Combine(OptoDataDirectory, relativeDirectory, optoDataLogFileName);
|
||||
|
||||
log.WarnFormat("Saving {0} opto data to {1}", Name, fullFileName);
|
||||
|
||||
try
|
||||
optoData[startIx].Flags = OptoTelegramFlags.OK_TestStart;
|
||||
OptoTelegramRaw.TestStartTimestampDec = optoData[startIx].TimestampDec();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int ix = 0; ix < StartOptoDataCount; ix++)
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(OptoDataDirectory, relativeDirectory));
|
||||
|
||||
double scalFact = ScalingFactor();
|
||||
|
||||
using (TextWriter optoLogFile = new StreamWriter(fullFileName))
|
||||
if (optoData[ix].Flags == OptoTelegramFlags.OK)
|
||||
{
|
||||
if (optoDataCount <= MaxOptoDataCount)
|
||||
{
|
||||
/// Telegrams are stored continuously, save them.
|
||||
optoLogFile.WriteLine(optoData[0].ToString(scalFact, null));
|
||||
for (int i = 1; i < optoDataCount; i++)
|
||||
{
|
||||
optoLogFile.WriteLine(optoData[i].ToString(scalFact, optoData[i - 1]));
|
||||
}
|
||||
}
|
||||
else /// if (optoDataCount > MaxOptoDataCount)
|
||||
{
|
||||
/// Buffer overflow
|
||||
/// First part of the buffer is saved as is
|
||||
optoLogFile.WriteLine(optoData[0].ToString(scalFact, null));
|
||||
for (int i = 1; i < StartOptoDataCount; i++)
|
||||
{
|
||||
optoLogFile.WriteLine(optoData[i].ToString(scalFact, optoData[i - 1]));
|
||||
}
|
||||
|
||||
optoLogFile.WriteLine(" ...");
|
||||
|
||||
/// Second part of the buffer is an overflowed circular buffer
|
||||
optoLogFile.WriteLine(optoData[BufferIdx(optoDataCount)].ToString(scalFact, null));
|
||||
for (int i = optoDataCount - EndOptoDataCount + 1; i < optoDataCount; i++)
|
||||
{
|
||||
optoLogFile.WriteLine(optoData[BufferIdx(i)].ToString(scalFact, optoData[BufferIdx(i - 1)]));
|
||||
}
|
||||
}
|
||||
|
||||
log.WarnFormat("{0} opto data successfully saved: {1} lines", Name, optoDataCount);
|
||||
|
||||
optoLogFile.Close();
|
||||
/// This is the first correct opto-telegram received
|
||||
OptoTelegramRaw.TestStartTimestampDec = optoData[ix].TimestampDec();
|
||||
break;
|
||||
}
|
||||
|
||||
return Path.Combine(relativeDirectory, optoDataLogFileName);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
File.Delete(fullFileName);
|
||||
log.ErrorFormat(string.Format("Error writing into file {0}", fullFileName));
|
||||
log.ErrorFormat(string.Format("Exception message: {0}", exc.Message));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
endIx = BufferIdx(TestEndTelegramIx);
|
||||
if ((endIx > 0) && (optoData[endIx].Flags == OptoTelegramFlags.OK))
|
||||
{
|
||||
optoData[endIx].Flags = OptoTelegramFlags.OK_TestEnd;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data stream post processing:
|
||||
/// Flow from a reference flowmeter is FIR filtered
|
||||
/// </summary>
|
||||
void DataStreamPostProcessing()
|
||||
{
|
||||
if (optoDataCount <= OptoDataBufferSize)
|
||||
{
|
||||
FIRFilterFlow(optoData, 0, optoDataCount - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
FIRFilterFlow(optoData, 0, StartOptoDataCount - 1);
|
||||
FIRFilterFlow(optoData, (optoDataCount - EndOptoDataCount), optoDataCount - 1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine opto data file name: PCB_AA_BB_HH_MI_SS..txt
|
||||
/// </summary>
|
||||
/// <param name="testName">Test name</param>
|
||||
/// <param name="testRepeats">Test repeats count (>= 1)</param>
|
||||
/// <param name="repetitionNr">Repetition number (1 .. testRepeats)</param>
|
||||
/// <returns></returns>
|
||||
string DetermineExtraDataFileName()
|
||||
{
|
||||
///
|
||||
/// Select or create appropriate test infos
|
||||
///
|
||||
Results.Output.SensusTestInfo[] testInfos = Sequences.ProcessData.CompleteTestInfos;
|
||||
///
|
||||
if ((ProcessData.OracleDB != null && ProcessData.OracleDB.DesigMode == Output.DB.SensusOracle.DesigMode.Based_on_procedure) ||
|
||||
(testInfos == null && StateMachine.Procedure != null))
|
||||
{
|
||||
testInfos = Results.Output.SensusTestInfo.CreateFromProcedure(StateMachine.Procedure);
|
||||
}
|
||||
|
||||
///
|
||||
/// Select or create appropriate 'qBezeichnung'
|
||||
///
|
||||
string fullTestName = Results.Utils.GetTestName(testName, testRepeats, repetitionNr);
|
||||
string qBezeichnungOpto = null; /// To be determined from TestInfo-s (if there are any)
|
||||
foreach (var ti in testInfos)
|
||||
{
|
||||
if ((ti.PruefungsNrOpto != 0) && (ti.TestName == fullTestName))
|
||||
{
|
||||
qBezeichnungOpto = string.IsNullOrEmpty(ti.QBezeichnungOpto) ? ti.PruefungsNrOpto.ToString("D2") : ti.QBezeichnungOpto;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (qBezeichnungOpto == null)
|
||||
{
|
||||
qBezeichnungOpto = fullTestName; /// No appropriate TestInfo found => set default opto data file name
|
||||
}
|
||||
|
||||
///
|
||||
/// Get other required pieces of information
|
||||
///
|
||||
string pcbNr = (ConfigStruct != null) ? ConfigStruct.GetPcbNrString() : "UnknownPcbNr";
|
||||
string wmPosition = Name.Substring(5); /// WMPosition is extracted from a component name in form 'iPerl#'
|
||||
if (wmPosition.Length == 1) wmPosition = "0" + wmPosition;
|
||||
string cycleStartTime = StateMachine.CycleStartTimeStamp.ToString("HH_mm_ss");
|
||||
|
||||
///
|
||||
/// Return the file name
|
||||
///
|
||||
return string.Format("{0}_{1}_{2}_{3}.txt", pcbNr, wmPosition, qBezeichnungOpto, cycleStartTime);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Save opto data to a file.
|
||||
/// </summary>
|
||||
bool SaveOptoDataToFile(string directory, string fileName)
|
||||
{
|
||||
string fullFileName = Path.Combine(directory, fileName);
|
||||
log.WarnFormat("Saving {0} opto data to {1}", Name, fullFileName);
|
||||
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(directory);
|
||||
|
||||
double scalFact = ScalingFactor();
|
||||
|
||||
using (TextWriter optoLogFile = new StreamWriter(fullFileName))
|
||||
{
|
||||
if (optoDataCount <= OptoDataBufferSize)
|
||||
{
|
||||
/// Telegrams are stored continuously, save them.
|
||||
optoLogFile.WriteLine(optoData[0].ToString(scalFact, null));
|
||||
for (int i = 1; i < optoDataCount; i++)
|
||||
{
|
||||
optoLogFile.WriteLine(optoData[i].ToString(scalFact, optoData[i - 1]));
|
||||
}
|
||||
}
|
||||
else /// if (optoDataCount > MaxOptoDataCount)
|
||||
{
|
||||
/// Buffer overflow
|
||||
/// First part of the buffer is saved as is
|
||||
optoLogFile.WriteLine(optoData[0].ToString(scalFact, null));
|
||||
for (int i = 1; i < StartOptoDataCount; i++)
|
||||
{
|
||||
optoLogFile.WriteLine(optoData[i].ToString(scalFact, optoData[i - 1]));
|
||||
}
|
||||
|
||||
optoLogFile.WriteLine(" ...");
|
||||
|
||||
/// Second part of the buffer is an overflowed circular buffer
|
||||
optoLogFile.WriteLine(optoData[BufferIdx(optoDataCount)].ToString(scalFact, null));
|
||||
for (int i = optoDataCount - EndOptoDataCount + 1; i < optoDataCount; i++)
|
||||
{
|
||||
optoLogFile.WriteLine(optoData[BufferIdx(i)].ToString(scalFact, optoData[BufferIdx(i - 1)]));
|
||||
}
|
||||
}
|
||||
|
||||
log.WarnFormat("{0} opto data successfully saved: {1} lines", Name, optoDataCount);
|
||||
|
||||
optoLogFile.Close();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
File.Delete(fullFileName);
|
||||
log.ErrorFormat(string.Format("Error writing into file {0}", fullFileName));
|
||||
log.ErrorFormat(string.Format("Exception message: {0}", exc.Message));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void ReadPulses()
|
||||
@@ -742,18 +848,46 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
}
|
||||
|
||||
|
||||
bool optoSerialPortParsingEnabled;
|
||||
DataStreamState dataStreamState;
|
||||
|
||||
/// <summary> Flush internal buffers and start parsing the opto serial port data </summary>
|
||||
void StartParsingOptoSerialPort()
|
||||
/// <summary>
|
||||
/// Reset counters / indices / time and start processing and saving datastream data
|
||||
/// </summary>
|
||||
public void StartDataStreamProcessing()
|
||||
{
|
||||
optoSerialPortParsingEnabled = true;
|
||||
/// Reset opto-data, etc.
|
||||
optoDataCount = 0;
|
||||
timeFromStart = 0;
|
||||
currentTelegramIx = -1;
|
||||
startSampleAcquired = false;
|
||||
TestStartTelegramIx = 0;
|
||||
endTelegramIdx1 = 0;
|
||||
endTelegramIdx2 = 0;
|
||||
endTelegramIdx3 = 0;
|
||||
TestEndTelegramIx = 0;
|
||||
|
||||
if (optoSerialPort != null && optoSerialPort.IsOpen) optoSerialPort.DiscardInBuffer();
|
||||
|
||||
if (flowDirectionDetection != null) flowDirectionDetection.ClearFifo(); /// Clear FIFO for flow direction detection
|
||||
|
||||
/// Enable opto-data parsing and saving
|
||||
dataStreamState = DataStreamState.ProcessAndSave;
|
||||
}
|
||||
|
||||
/// <summary> Stop parsig the opto serial port data </summary>
|
||||
void StopParsingOptoSerialPort()
|
||||
/// <summary>
|
||||
/// Returns true when processing and saving datastream data is in progress
|
||||
/// </summary>
|
||||
bool IsDataStreamProcessing()
|
||||
{
|
||||
optoSerialPortParsingEnabled = false;
|
||||
return dataStreamState == DataStreamState.ProcessAndSave;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop processing and saving datastream data
|
||||
/// </summary>
|
||||
void StopDataStreamProcessing()
|
||||
{
|
||||
dataStreamState = DataStreamState.Flush;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -764,110 +898,111 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
string partOfTelegram;
|
||||
|
||||
/// <summary>
|
||||
/// 9600 Bd, 8 data bits, 1 stop bit, no parity
|
||||
///
|
||||
/// Reads opto-datastream via serual port. Invoked from RunDeviceBefore()
|
||||
///
|
||||
/// Telegram description:
|
||||
///
|
||||
/// AAAAAA[tab]BBBB[tab]CCCC[tab]DDDDDD[tab]EEEE[tab]FFFFFFFF[tab]GG[cr][lf] (42 bytes)
|
||||
///
|
||||
/// AAAAAA[tab]BBBB[tab]CCCC[tab]DDDDDD[tab]EEEE[tab]FFFFFFFF[tab]GG[cr][lf] (42 bytes)
|
||||
/// Example:
|
||||
/// FFFFFE 51EA 0000 65324E 0087 F6319DFF 86
|
||||
/// FFDD3A 51F9 0000 65324E 0088 F631A60B 45
|
||||
/// FFFFFE 51EA 0000 65324E 0087 F6319DFF 86
|
||||
/// FFDD3A 51F9 0000 65324E 0088 F631A60B 45
|
||||
/// ...
|
||||
/// </summary>
|
||||
/// <param name="optoState">OptoState.Read or OptoState.Flush</param>
|
||||
void ReadOptoData(OptoState optoState)
|
||||
void ReadOptoData(DataStreamState optoState)
|
||||
{
|
||||
int nrBytes = optoSerialPort.BytesToRead;
|
||||
if (nrBytes > 0)
|
||||
{
|
||||
char[] buffer = new char[nrBytes];
|
||||
optoSerialPort.Read(buffer, 0, nrBytes);
|
||||
string received = new string(buffer);
|
||||
lock (this)
|
||||
{
|
||||
int nrBytes = optoSerialPort.BytesToRead;
|
||||
if (nrBytes > 0)
|
||||
{
|
||||
char[] buffer = new char[nrBytes];
|
||||
optoSerialPort.Read(buffer, 0, nrBytes);
|
||||
string received = new string(buffer);
|
||||
|
||||
string allRcvd = partOfTelegram + received;
|
||||
string allRcvd = partOfTelegram + received;
|
||||
|
||||
while (true)
|
||||
{
|
||||
int pos = allRcvd.IndexOf("\r\n");
|
||||
while (true)
|
||||
{
|
||||
int pos = allRcvd.IndexOf("\r\n");
|
||||
|
||||
if (pos < 0)
|
||||
{
|
||||
/// No CR+LF found, wait for more characters in the next invocation
|
||||
partOfTelegram = allRcvd;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// CR+LF found
|
||||
if (optoState == OptoState.Read)
|
||||
{
|
||||
int bufferIx = BufferIdx(optoDataCount);
|
||||
if (pos < 0)
|
||||
{
|
||||
/// No CR+LF found, wait for more characters in the next invocation
|
||||
partOfTelegram = allRcvd;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// CR+LF found
|
||||
if (optoState == DataStreamState.ProcessAndSave)
|
||||
{
|
||||
int bufferIx = BufferIdx(optoDataCount);
|
||||
|
||||
if (pos < OptoTelegramRaw.Length - 2)
|
||||
{
|
||||
/// CR+LF found too early, truncate the beginning incl CR+LF and keep scanning in this loop
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
if (synchronized)
|
||||
{
|
||||
optoData[bufferIx].Counter = optoDataCount;
|
||||
optoData[bufferIx].SetFlags(OptoTelegramFlags.SyncError);
|
||||
}
|
||||
synchronized = true;
|
||||
}
|
||||
else if (optoData[bufferIx].UpdateFromString(allRcvd.Substring(pos - OptoTelegramRaw.Length + 2),
|
||||
optoDataCount,
|
||||
Convert.ToSingle(Sequences.ProcessData.RefFlow.Val),
|
||||
ref volumeRawExtLast, ref timestampExtLast))
|
||||
{
|
||||
/// CR+LF was found && (pos >= OptoTelegramRaw.Length - 2) && the telegram is OK
|
||||
flowDirectionDetection.WriteToFifo(volumeRawExtLast, timestampExtLast);
|
||||
OptoTelegramRreceived(optoDataCount, synchronized2, volumeRawExtLast, timestampExtLast);
|
||||
synchronized2 = synchronized;
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// CR+LF was found && (pos >= OptoTelegramRaw.Length - 2) but the telgram was not OK
|
||||
optoData[bufferIx].Counter = optoDataCount;
|
||||
optoDataCount++;
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
}
|
||||
if (pos < OptoTelegramRaw.Length - 2)
|
||||
{
|
||||
/// CR+LF found too early, truncate the beginning incl CR+LF and keep scanning in this loop
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
if (synchronized)
|
||||
{
|
||||
optoData[bufferIx].Counter = optoDataCount;
|
||||
optoData[bufferIx].SetFlags(OptoTelegramFlags.SyncError);
|
||||
}
|
||||
synchronized = true;
|
||||
}
|
||||
else if (optoData[bufferIx].UpdateFromString(allRcvd.Substring(pos - OptoTelegramRaw.Length + 2),
|
||||
optoDataCount,
|
||||
Convert.ToSingle(Sequences.ProcessData.RefFlow.Val),
|
||||
ref volumeRawExtLast, ref timestampExtLast))
|
||||
{
|
||||
/// CR+LF was found && (pos >= OptoTelegramRaw.Length - 2) && the telegram is OK
|
||||
flowDirectionDetection.WriteToFifo(volumeRawExtLast, timestampExtLast);
|
||||
OptoTelegramRreceived(optoDataCount, synchronized2, volumeRawExtLast, timestampExtLast);
|
||||
synchronized2 = synchronized;
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// CR+LF was found && (pos >= OptoTelegramRaw.Length - 2) but the telgram was not OK
|
||||
optoData[bufferIx].Counter = optoDataCount;
|
||||
optoDataCount++;
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
}
|
||||
|
||||
optoDataCount++;
|
||||
}
|
||||
else /// optoState == OptoState.Flush
|
||||
{
|
||||
if (pos < OptoTelegramRaw.Length - 2)
|
||||
{
|
||||
/// CR+LF found too early, truncate the beginning incl CR+LF and keep scanning in this loop
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
synchronized = true;
|
||||
}
|
||||
// CR+LF found and (pos >= OptoTelegram.Length - 2)
|
||||
else if (toBeFlushed.UpdateFromString(allRcvd.Substring(pos - OptoTelegramRaw.Length + 2),
|
||||
0,
|
||||
Convert.ToSingle(Sequences.ProcessData.RefFlow.Val),
|
||||
ref volumeRawExtLast, ref timestampExtLast))
|
||||
{
|
||||
flowDirectionDetection.WriteToFifo(volumeRawExtLast, timestampExtLast);
|
||||
synchronized2 = synchronized;
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
optoDataCount++;
|
||||
}
|
||||
else /// optoState == OptoState.Flush
|
||||
{
|
||||
if (pos < OptoTelegramRaw.Length - 2)
|
||||
{
|
||||
/// CR+LF found too early, truncate the beginning incl CR+LF and keep scanning in this loop
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
synchronized = true;
|
||||
}
|
||||
// CR+LF found and (pos >= OptoTelegram.Length - 2)
|
||||
else if (toBeFlushed.UpdateFromString(allRcvd.Substring(pos - OptoTelegramRaw.Length + 2),
|
||||
0,
|
||||
Convert.ToSingle(Sequences.ProcessData.RefFlow.Val),
|
||||
ref volumeRawExtLast, ref timestampExtLast))
|
||||
{
|
||||
flowDirectionDetection.WriteToFifo(volumeRawExtLast, timestampExtLast);
|
||||
synchronized2 = synchronized;
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
allRcvd = allRcvd.Substring(pos + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//OnOptoReceived(this, new OptoReceivedEventArgs(s));
|
||||
}
|
||||
else
|
||||
{
|
||||
//OnOptoReceived(this, new OptoReceivedEventArgs("."));
|
||||
}
|
||||
//OnOptoReceived(this, new OptoReceivedEventArgs(s));
|
||||
}
|
||||
else
|
||||
{
|
||||
//OnOptoReceived(this, new OptoReceivedEventArgs("."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1113,13 +1248,13 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
/// <returns>Index to the buffer</returns>
|
||||
public static int BufferIdx(int index)
|
||||
{
|
||||
if (index < IperlHead.MaxOptoDataCount)
|
||||
if (index < IperlHead.OptoDataBufferSize)
|
||||
{
|
||||
return index;
|
||||
}
|
||||
else
|
||||
{
|
||||
return IperlHead.StartOptoDataCount + (index - IperlHead.MaxOptoDataCount) % IperlHead.EndOptoDataCount;
|
||||
return IperlHead.StartOptoDataCount + (index - IperlHead.OptoDataBufferSize) % IperlHead.EndOptoDataCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
|
||||
{
|
||||
|
||||
@@ -179,9 +179,9 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// <param name="measuredFlow">Measured flow [m3/h]</param>
|
||||
/// <param name="timeout">Timeout in [s]</param>
|
||||
/// <returns>SetFlowOp instance</returns>
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout, int delay)
|
||||
{
|
||||
return new SetFlowOp(UniCB, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout);
|
||||
return new SetFlowOp(UniCB, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, delay);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -197,7 +197,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox measuredFlow, int timeout, float filterConstant)
|
||||
{
|
||||
return new SetFlowOp(UniCB, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, true);
|
||||
return new SetFlowOp(UniCB, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, 0, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
readonly double shrinkedTgtFlowHi;
|
||||
readonly double targetFlowAve;
|
||||
readonly int timeout;
|
||||
readonly int delay;
|
||||
readonly bool leaveFlowControlRunning;
|
||||
|
||||
readonly double maximalFlow;
|
||||
@@ -59,6 +60,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
double targetPositionHi;
|
||||
|
||||
int startTime;
|
||||
int setFlowTime;
|
||||
int expireTime;
|
||||
DoubleBox flowBox;
|
||||
int isFlowOkDuration;
|
||||
@@ -75,10 +77,11 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// <param name="qTo">Upper limit of the flow to be achieved in [m3/h]</param>
|
||||
/// <param name="pidCoef">PID coefficient (float)</param>
|
||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||
/// <param name="delay">Flow setting starts after this delay [s]</param>
|
||||
/// <param name="leaveFlowControlRunning">true = Leave the measurement running after op. stop</param>
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox flowBox,
|
||||
int timeout, bool leaveFlowControlRunning)
|
||||
int timeout, int delay, bool leaveFlowControlRunning)
|
||||
{
|
||||
this.uniCB = uniCB;
|
||||
if (this.uniCB == null) throw new ArgumentNullException("cBoard is null or not Uni");
|
||||
@@ -101,18 +104,28 @@ namespace TBF.Rig.Uni.RegValve
|
||||
if (this.flowBox == null) throw new ArgumentNullException("flowBox");
|
||||
|
||||
this.timeout = timeout;
|
||||
this.delay = delay;
|
||||
|
||||
this.leaveFlowControlRunning = leaveFlowControlRunning;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set required water flow - Do not leave the measurement running.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox flowbox, int timeout, int delay)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, flowbox, timeout, delay, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set required water flow - Do not leave the measurement running.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox flowbox, int timeout)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, flowbox, timeout, false)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, flowbox, timeout, 0, false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -121,7 +134,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox flowbox)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, flowbox, int.MaxValue, false)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, flowbox, int.MaxValue, 0, false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -168,6 +181,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
|
||||
/// Store the current time, etc.
|
||||
startTime = StateMachine.Time;
|
||||
setFlowTime = StateMachine.Time + delay;
|
||||
expireTime = StateMachine.Time + timeout;
|
||||
if (expireTime < 0) expireTime = int.MaxValue;
|
||||
|
||||
@@ -212,12 +226,16 @@ namespace TBF.Rig.Uni.RegValve
|
||||
return Event.OpArgumentError;
|
||||
}
|
||||
|
||||
uniCB.SetFlow(false, regV.Idx1, 2000 * currentReqFlowLo / flowMeter.NominalFlow,
|
||||
2000 * currentReqFlowHi / flowMeter.NominalFlow);
|
||||
if (StateMachine.Time > setFlowTime)
|
||||
{
|
||||
uniCB.SetFlow(false, regV.Idx1, 2000 * currentReqFlowLo / flowMeter.NominalFlow,
|
||||
2000 * currentReqFlowHi / flowMeter.NominalFlow);
|
||||
|
||||
log.InfoFormat("Run(): rv#={0} TARGET: flowLo={1} flowHi={2}", regV.Idx1, currentReqFlowLo, currentReqFlowHi);
|
||||
log.InfoFormat("Run(): rv#={0} TARGET: flowLo={1} flowHi={2}", regV.Idx1, currentReqFlowLo, currentReqFlowHi);
|
||||
|
||||
opState = OpState.SettingFlow;
|
||||
}
|
||||
|
||||
opState = OpState.SettingFlow;
|
||||
return Event.Starting;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,10 +86,11 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
/// <param name="pidCoef">PID coefficient (float)</param>
|
||||
/// <param name="measuredFlow">Measured flow [m3/h]</param>
|
||||
/// <param name="timeout">Timeout in [s]</param>
|
||||
/// <param name="delay">Flow setting starts after this delay in [s]</param>
|
||||
/// <returns>SetFlowOp instance</returns>
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox measuredFlow, int timeout)
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox measuredFlow, int timeout, int delay)
|
||||
{
|
||||
return new SetFlowOp(uniCB, this, flowMeter, qFrom, qTo, measuredFlow, regValveCfg.ReTryCommands, timeout);
|
||||
return new SetFlowOp(uniCB, this, flowMeter, qFrom, qTo, measuredFlow, regValveCfg.ReTryCommands, timeout, delay);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -105,7 +106,7 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, double qFrom, double qTo,
|
||||
DoubleBox measuredFlow, int timeout, float filterConstant)
|
||||
{
|
||||
return new SetFlowOp(uniCB, this, flowMeter, qFrom, qTo, measuredFlow, regValveCfg.ReTryCommands, timeout, true);
|
||||
return new SetFlowOp(uniCB, this, flowMeter, qFrom, qTo, measuredFlow, regValveCfg.ReTryCommands, timeout, 0, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
readonly double finalReqFlowHi;
|
||||
readonly double reqFlowAve;
|
||||
readonly int timeout;
|
||||
readonly int delay;
|
||||
readonly bool leaveFlowControlRunning;
|
||||
readonly bool reTryCommands;
|
||||
|
||||
@@ -74,11 +75,12 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
/// <param name="requiredFlowHi">Upper limit of the flow to be achieved in [m3/h]</param>
|
||||
/// <param name="pidCoef">PID coefficient (float)</param>
|
||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||
/// <param name="delay">Flow setting starts after this delay in [s]</param>
|
||||
/// <param name="leaveFlowControlRunning">true = Leave the measurement running after op. stop</param>
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public SetFlowOp(TBF.Rig.ControlBoard.IControlBoard cb, IRegValve _regulValve, IFlowMeter flowMeter,
|
||||
double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow,
|
||||
bool reTryCmds, int timeout, bool leaveFlowControlRunning)
|
||||
bool reTryCmds, int timeout, int delay, bool leaveFlowControlRunning)
|
||||
{
|
||||
uniCB = cb as UniCB;
|
||||
if (uniCB == null) throw new ArgumentNullException("ctrlBoard");
|
||||
@@ -105,11 +107,11 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2;
|
||||
this.finalReqFlowLo = (0.7 * requiredFlowLo) + (0.3 * this.reqFlowAve); /// Move the lower limit 15% of the range up
|
||||
this.finalReqFlowHi = (0.7 * requiredFlowHi) + (0.3 * this.reqFlowAve); /// Move the upper limit 15% of the range down
|
||||
this.measuredFlow = measuredFlow;
|
||||
|
||||
this.measuredFlow = measuredFlow;
|
||||
this.reTryCommands = reTryCmds;
|
||||
|
||||
this.timeout = timeout;
|
||||
|
||||
this.delay = delay;
|
||||
this.leaveFlowControlRunning = leaveFlowControlRunning;
|
||||
|
||||
log.Warn(this.ToString());
|
||||
@@ -120,18 +122,8 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo,
|
||||
DoubleBox measuredFlow, bool reTryCmds, int timeout)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, measuredFlow, reTryCmds, timeout, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set required water flow - No timeout.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo,
|
||||
DoubleBox measuredFlow, bool reTryCmds)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, measuredFlow, reTryCmds, int.MaxValue, false)
|
||||
DoubleBox measuredFlow, bool reTryCmds, int timeout, int delay)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, measuredFlow, reTryCmds, timeout, delay, false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -73,10 +73,11 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
/// <param name="measuredFlow">Measured flow [m3/h]</param>
|
||||
/// <param name="timeout">Timeout in [s]</param>
|
||||
/// <returns>SetFlowOp instance</returns>
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox measuredFlow, int timeout, int delay)
|
||||
{
|
||||
return new SetFlowOp(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi,
|
||||
flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout);
|
||||
return new SetFlowOp(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi,
|
||||
measuredFlow, timeout, delay);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -93,7 +94,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
DoubleBox measuredFlow, int timeout, float filterConstant)
|
||||
{
|
||||
return new SetFlowOp(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi,
|
||||
flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, true);
|
||||
flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, 0, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
readonly double finalReqFlowHi;
|
||||
readonly double reqFlowAve;
|
||||
readonly int timeout;
|
||||
readonly int delay;
|
||||
readonly bool leaveFlowControlRunning;
|
||||
|
||||
readonly double nominalFlow;
|
||||
@@ -76,7 +77,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public SetFlowOp(TBF.Rig.ControlBoard.IControlBoard cb, IRegValve regV, IRegValve fxdRV, float fxdPctLo, float fxdPctHi,
|
||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow,
|
||||
int timeout, bool leaveFlowControlRunning)
|
||||
int timeout, int delay, bool leaveFlowControlRunning)
|
||||
{
|
||||
this.uniCB = cb as UniCB;
|
||||
if (uniCB == null) throw new ArgumentNullException("ctrlBoard is not Uni");
|
||||
@@ -111,10 +112,10 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2;
|
||||
this.finalReqFlowLo = (0.7 * requiredFlowLo) + (0.3 * this.reqFlowAve); /// Move the lower limit 15% of the range up
|
||||
this.finalReqFlowHi = (0.7 * requiredFlowHi) + (0.3 * this.reqFlowAve); /// Move the upper limit 15% of the range down
|
||||
///
|
||||
this.measuredFlow = measuredFlow;
|
||||
|
||||
this.timeout = timeout;
|
||||
|
||||
this.delay = delay;
|
||||
this.leaveFlowControlRunning = leaveFlowControlRunning;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
@@ -124,19 +125,9 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
/// Set required water flow - Do not leave the measurement running.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IRegValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
||||
: this(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set required water flow - No timeout.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IRegValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow)
|
||||
: this(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, int.MaxValue, false)
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IRegValve fixedRV, float fixedPctLo, float fixedPctHi, IFlowMeter flowMeter,
|
||||
double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout, int delay)
|
||||
: this(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, delay, false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -586,14 +586,13 @@
|
||||
<Compile Include="Rig\GenericDevices\IEvaporation.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IEventTrigger.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IHasCalendarEvents.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IHasClearSessionData.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IParallelOutput.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IReceivesDataFromRadio.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IRegReaderPulses.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IResultsProcessor.cs" />
|
||||
<Compile Include="Rig\GenericDevices\ISessionDataMngmnt.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IStartInfoReader.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IHart.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IHasTestName.cs" />
|
||||
<Compile Include="Rig\GenericDevices\ICameraDisplay.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IDataEntryForCamera.cs" />
|
||||
<Compile Include="Rig\GenericDevices\IErrorFlags.cs" />
|
||||
|
||||
@@ -8,5 +8,6 @@ namespace TBF.UI
|
||||
public const string DateFormat = "dd.MM.yyyy";
|
||||
public const string DateTimeFormat = "dd.MM.yyyy HH:mm";
|
||||
public static readonly DateTime MinDate = new DateTime(2016, 1, 1);
|
||||
public static readonly DateTime MaxDate = new DateTime(2039, 12, 31);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -722,7 +722,6 @@ namespace TBF.UI
|
||||
private void passwdTSMItem_Click(object s, EventArgs e) { new SharedDatabase.Forms.PasswordChangeDlg(GlobalData.GetCurrentUserName()).ShowDialog(); }
|
||||
private void aboutTSMItem_Click(object s, EventArgs e) { new TBF.UI.Help.AboutDlg().ShowDialog(); }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Read the database and re-initialize procedureComboBox items.
|
||||
/// Try to preserve the original selection.
|
||||
|
||||
+114
-103
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -791,9 +791,8 @@ namespace TBF.UI.Procedures
|
||||
TestTime,
|
||||
ErrLimLo,
|
||||
ErrLimHi,
|
||||
TempLimLo,
|
||||
TempLimHi,
|
||||
TempUnit,
|
||||
Uncertainty,
|
||||
Repeats,
|
||||
Method,
|
||||
ColumnsCount
|
||||
}
|
||||
@@ -814,9 +813,8 @@ namespace TBF.UI.Procedures
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_time_s_chdr, Width = 70 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Err_limit_neg_pct_chdr, Width = 80 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Err_limit_pos_pct_chdr, Width = 80 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Temp_lim_lo_chdr, Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Temp_lim_hi_chdr, Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = "Unit", Width = 50 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Uncertainty_pct_chdr, Width = 90 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Repeats_nr_chdr, Width = 90 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Method_chdr, Width = 200 });
|
||||
|
||||
methodCBox = new ComboBox();
|
||||
@@ -824,7 +822,11 @@ namespace TBF.UI.Procedures
|
||||
|
||||
var flowUnitBox = new ComboBox();
|
||||
var volUnitBox = new ComboBox();
|
||||
var tempUnitBox = new ComboBox();
|
||||
for (Common.Unit u = 0; u < Common.Unit.Count; u++)
|
||||
{
|
||||
if (Units.IsFlow(u)) flowUnitBox.Items.Add(u.ToDescription());
|
||||
if (Units.IsVolume(u)) volUnitBox.Items.Add(u.ToDescription());
|
||||
}
|
||||
|
||||
metrology1Editors = new Control[]
|
||||
{
|
||||
@@ -841,19 +843,11 @@ namespace TBF.UI.Procedures
|
||||
new TextBox(), /// Test time
|
||||
new TextBox(), /// Err.Lim. -
|
||||
new TextBox(), /// Err.Lim. +
|
||||
new TextBox(), /// Temp.Lim. -
|
||||
new TextBox(), /// Temp.Lim. +
|
||||
tempUnitBox,
|
||||
new TextBox(), /// Uncertainty
|
||||
new TextBox(), /// Repeats count
|
||||
methodCBox, /// Method
|
||||
};
|
||||
|
||||
for (Unit u = 0; u < Unit.Count; u++)
|
||||
{
|
||||
if (Units.IsFlow(u)) flowUnitBox.Items.Add(u.ToDescription());
|
||||
if (Units.IsVolume(u)) volUnitBox.Items.Add(u.ToDescription());
|
||||
if (Units.IsTemperature(u)) tempUnitBox.Items.Add(u.ToDescription());
|
||||
}
|
||||
|
||||
foreach (var ctrl in metrology1Editors)
|
||||
{
|
||||
metrology1TabPage.Controls.Add(ctrl);
|
||||
@@ -894,9 +888,8 @@ namespace TBF.UI.Procedures
|
||||
lvi.SubItems.Add(test.TestTime.ToString());
|
||||
lvi.SubItems.Add(test.ErrLimLo.ToString());
|
||||
lvi.SubItems.Add(test.ErrLimHi.ToString());
|
||||
lvi.SubItems.Add(Units.ConvertTo(test.TempUnit, test.TempLimLo).ToString());
|
||||
lvi.SubItems.Add(Units.ConvertTo(test.TempUnit, test.TempLimHi).ToString());
|
||||
lvi.SubItems.Add(test.TempUnit.ToDescription());
|
||||
lvi.SubItems.Add(test.Uncertainty.ToString());
|
||||
lvi.SubItems.Add(test.Repeats.ToString());
|
||||
lvi.SubItems.Add((test.Method != null) ? test.Method.ToString() : string.Empty);
|
||||
|
||||
test.ResetChngdFlags();
|
||||
@@ -924,6 +917,7 @@ namespace TBF.UI.Procedures
|
||||
test.Part = part;
|
||||
}
|
||||
|
||||
int itmp;
|
||||
float tmp;
|
||||
double dtmp;
|
||||
#if TEST_PROFILES
|
||||
@@ -940,14 +934,12 @@ namespace TBF.UI.Procedures
|
||||
test.Volume = (float)Units.ConvertFrom(test.VolumeUnit, dtmp);
|
||||
|
||||
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.TestTime].Text, out tmp)) test.TestTime = tmp;
|
||||
if (Utils.TryParseSFloat(lvi.SubItems[(int)MtrlgyClmn.ErrLimLo].Text, out tmp)) test.ErrLimLo = tmp;
|
||||
|
||||
if (Utils.TryParseSFloat(lvi.SubItems[(int)MtrlgyClmn.ErrLimLo].Text, out tmp)) test.ErrLimLo = tmp;
|
||||
if (Utils.TryParseSFloat(lvi.SubItems[(int)MtrlgyClmn.ErrLimHi].Text, out tmp)) test.ErrLimHi = tmp;
|
||||
if (Utils.TryParseUFloat(lvi.SubItems[(int)MtrlgyClmn.Uncertainty].Text, out tmp)) test.Uncertainty = tmp;
|
||||
|
||||
if (test.TempLimLoTextChngd && Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.TempLimLo].Text, out dtmp))
|
||||
test.TempLimLo = (float)Units.ConvertFrom(test.TempUnit, dtmp);
|
||||
|
||||
if (test.TempLimHiTextChngd && Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.TempLimHi].Text, out dtmp))
|
||||
test.TempLimHi = (float)Units.ConvertFrom(test.TempUnit, dtmp);
|
||||
if (int.TryParse(lvi.SubItems[(int)MtrlgyClmn.Repeats].Text, out itmp)) test.Repeats = itmp;
|
||||
|
||||
if (methodCBox.Items.Contains(lvi.SubItems[(int)MtrlgyClmn.Method].Text))
|
||||
{
|
||||
@@ -964,7 +956,7 @@ namespace TBF.UI.Procedures
|
||||
if (e.SubItem == (int)MtrlgyClmn.Qtg) return;
|
||||
#endif
|
||||
/// Unit change is allowed when locked
|
||||
if ((column != MtrlgyClmn.FlowUnit && column != MtrlgyClmn.VolumeUnit && column != MtrlgyClmn.TempUnit) &&
|
||||
if ((column != MtrlgyClmn.FlowUnit && column != MtrlgyClmn.VolumeUnit) &&
|
||||
(!unlocked || column >= MtrlgyClmn.ColumnsCount))
|
||||
{
|
||||
return;
|
||||
@@ -975,7 +967,6 @@ namespace TBF.UI.Procedures
|
||||
MtrlgyClmn.Name,
|
||||
MtrlgyClmn.Qfrom, MtrlgyClmn.Qto,
|
||||
MtrlgyClmn.ErrLimLo, MtrlgyClmn.ErrLimHi,
|
||||
MtrlgyClmn.TempLimLo, MtrlgyClmn.TempLimHi
|
||||
};
|
||||
if (((e.Item.Tag as Test).Profile >= TestProfile.Protected) && protectedColumns.Contains<MtrlgyClmn>(column)) return;
|
||||
|
||||
@@ -1007,7 +998,6 @@ namespace TBF.UI.Procedures
|
||||
{
|
||||
case MtrlgyClmn.FlowUnit: UpdateFlow(item, Units.FromDescription(value)); break;
|
||||
case MtrlgyClmn.VolumeUnit: UpdateVolume(item, Units.FromDescription(value)); break;
|
||||
case MtrlgyClmn.TempUnit: UpdateTemperature(item, Units.FromDescription(value)); break;
|
||||
}
|
||||
}
|
||||
else if (item == e.Item)
|
||||
@@ -1053,20 +1043,12 @@ namespace TBF.UI.Procedures
|
||||
if (Utils.TryParseSFloat(e.DisplayText, out fdummy)) return;
|
||||
break;
|
||||
|
||||
case MtrlgyClmn.TempLimLo:
|
||||
if (Utils.TryParseUFloat(e.DisplayText, out fdummy))
|
||||
{
|
||||
if (e.DisplayText != e.Item.SubItems[e.SubItem].Text) test.TempLimLoTextChngd = true;
|
||||
return; /// OK
|
||||
}
|
||||
case MtrlgyClmn.Uncertainty:
|
||||
if (Utils.TryParseUFloat(e.DisplayText, out fdummy)) return;
|
||||
break;
|
||||
|
||||
case MtrlgyClmn.TempLimHi:
|
||||
if (Utils.TryParseUFloat(e.DisplayText, out fdummy))
|
||||
{
|
||||
if (e.DisplayText != e.Item.SubItems[e.SubItem].Text) test.TempLimHiTextChngd = true;
|
||||
return; /// OK
|
||||
}
|
||||
case MtrlgyClmn.Repeats:
|
||||
if (int.TryParse(e.DisplayText, out dummy)) return; /// OK
|
||||
break;
|
||||
|
||||
case MtrlgyClmn.FlowUnit:
|
||||
@@ -1081,12 +1063,6 @@ namespace TBF.UI.Procedures
|
||||
UpdateVolume(e.Item, newUnit);
|
||||
return;
|
||||
|
||||
case MtrlgyClmn.TempUnit:
|
||||
newUnit = Units.FromDescription(e.DisplayText);
|
||||
if (!Units.IsTemperature(newUnit)) break;
|
||||
UpdateTemperature(e.Item, newUnit);
|
||||
return;
|
||||
|
||||
case MtrlgyClmn.Method:
|
||||
if (methodCBox.Items.Contains(e.DisplayText)) return;
|
||||
break;
|
||||
@@ -1215,11 +1191,11 @@ namespace TBF.UI.Procedures
|
||||
Unit oriUnit = test.TempUnit;
|
||||
test.TempUnit = newUnit;
|
||||
|
||||
int ix = (int)MtrlgyClmn.TempLimLo;
|
||||
int ix = (int)Mtrlgy2Clmn.TempLimLo;
|
||||
double tempC = Units.ConvertFrom(oriUnit, Utils.ParseUDouble(item.SubItems[ix].Text));
|
||||
item.SubItems[ix].Text = Units.ConvertTo(newUnit, test.TempLimLoTextChngd ? tempC : test.TempLimLo).ToString();
|
||||
|
||||
ix = (int)MtrlgyClmn.TempLimHi;
|
||||
ix = (int)Mtrlgy2Clmn.TempLimHi;
|
||||
tempC = Units.ConvertFrom(oriUnit, Utils.ParseUDouble(item.SubItems[ix].Text));
|
||||
item.SubItems[ix].Text = Units.ConvertTo(newUnit, test.TempLimHiTextChngd ? tempC : test.TempLimHi).ToString();
|
||||
}
|
||||
@@ -1232,8 +1208,9 @@ namespace TBF.UI.Procedures
|
||||
{
|
||||
Name,
|
||||
Part,
|
||||
Uncertainty,
|
||||
Repeats,
|
||||
TempLimLo,
|
||||
TempLimHi,
|
||||
TempUnit,
|
||||
ControlWaterTemp,
|
||||
ShortPulses,
|
||||
Publish,
|
||||
@@ -1248,24 +1225,31 @@ namespace TBF.UI.Procedures
|
||||
ListViewEx lv = metrology2ListViewEx;
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Uncertainty_pct_chdr, Width = 90 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Repeats_nr_chdr, Width = 90 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Temp_lim_lo_chdr, Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Temp_lim_hi_chdr, Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = "Unit", Width = 50 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Control_water_temp_chdr, Width = 110 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Short_pulses, Width = 100 }); /// Strings.Tol_red_pct_chdr
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Publish, Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Evaluate, Width = 100 });
|
||||
|
||||
ComboBox publishCBox = new ComboBox(); /// control for Publish
|
||||
ComboBox publishCBox = new ComboBox(); /// control for Publish
|
||||
for (Publish pb = 0; pb < Publish.Count; pb++)
|
||||
{
|
||||
publishCBox.Items.Add(pb.ToDescription());
|
||||
}
|
||||
|
||||
ComboBox yesNo2CBox = new ComboBox(); /// control for Control water temp.
|
||||
ComboBox tempUnitBox = new ComboBox();
|
||||
for (Common.Unit u = 0; u < Common.Unit.Count; u++)
|
||||
{
|
||||
if (Units.IsTemperature(u)) tempUnitBox.Items.Add(u.ToDescription());
|
||||
}
|
||||
|
||||
ComboBox yesNo2CBox = new ComboBox(); /// control for Control water temp.
|
||||
yesNo2CBox.Items.Add(Strings.yes);
|
||||
yesNo2CBox.Items.Add(Strings.no);
|
||||
|
||||
ComboBox yesNo3CBox = new ComboBox(); /// control for Evaluate
|
||||
ComboBox yesNo3CBox = new ComboBox(); /// control for Evaluate
|
||||
yesNo3CBox.Items.Add(Strings.yes);
|
||||
yesNo3CBox.Items.Add(Strings.no);
|
||||
|
||||
@@ -1273,8 +1257,9 @@ namespace TBF.UI.Procedures
|
||||
{
|
||||
new TextBox(), /// Name
|
||||
new TextBox(), /// Part
|
||||
new TextBox(), /// Uncertainty
|
||||
new TextBox(), /// Repeats count
|
||||
new TextBox(), /// Temp.Lim. -
|
||||
new TextBox(), /// Temp.Lim. +
|
||||
tempUnitBox,
|
||||
yesNo2CBox, /// Control water temp.
|
||||
new TextBox(), /// Short pulses
|
||||
publishCBox, /// Publish
|
||||
@@ -1306,8 +1291,9 @@ namespace TBF.UI.Procedures
|
||||
ListViewItem lvi = new ListViewItem(test.Name); /// Name
|
||||
lvi.Tag = test;
|
||||
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
|
||||
lvi.SubItems.Add(test.Uncertainty.ToString());
|
||||
lvi.SubItems.Add(test.Repeats.ToString());
|
||||
lvi.SubItems.Add(Units.ConvertTo(test.TempUnit, test.TempLimLo).ToString());
|
||||
lvi.SubItems.Add(Units.ConvertTo(test.TempUnit, test.TempLimHi).ToString());
|
||||
lvi.SubItems.Add(test.TempUnit.ToDescription());
|
||||
lvi.SubItems.Add(test.DoControlWaterTemp ? Strings.yes : Strings.no);
|
||||
lvi.SubItems.Add(test.ShortPulses.ToString());
|
||||
lvi.SubItems.Add(((Publish)test.Publish).ToDescription());
|
||||
@@ -1318,6 +1304,8 @@ namespace TBF.UI.Procedures
|
||||
|
||||
void UpdateFromMetrology2Tab()
|
||||
{
|
||||
double dtmp;
|
||||
|
||||
for (int i = 0; i < metrology2ListViewEx.Items.Count; i++)
|
||||
{
|
||||
try
|
||||
@@ -1327,12 +1315,16 @@ namespace TBF.UI.Procedures
|
||||
entity.ItemNr = i;
|
||||
entity.Name = lvi.SubItems[(int)Mtrlgy2Clmn.Name].Text;
|
||||
entity.Part = lvi.SubItems[(int)Mtrlgy2Clmn.Part].Text.Equals("-") ? 0 : int.Parse(lvi.SubItems[(int)Mtrlgy2Clmn.Part].Text);
|
||||
entity.Uncertainty = Utils.ParseUFloat(lvi.SubItems[(int)Mtrlgy2Clmn.Uncertainty].Text);
|
||||
entity.Repeats = int.Parse(lvi.SubItems[(int)Mtrlgy2Clmn.Repeats].Text);
|
||||
entity.DoControlWaterTemp = lvi.SubItems[(int)Mtrlgy2Clmn.ControlWaterTemp].Text.Equals(Strings.yes);
|
||||
entity.ShortPulses = int.Parse(lvi.SubItems[(int)Mtrlgy2Clmn.ShortPulses].Text);
|
||||
entity.DoEvaluate = lvi.SubItems[(int)Mtrlgy2Clmn.Evaluate].Text.Equals(Strings.yes);
|
||||
|
||||
if (entity.TempLimLoTextChngd && Utils.TryParseUDouble(lvi.SubItems[(int)Mtrlgy2Clmn.TempLimLo].Text, out dtmp))
|
||||
entity.TempLimLo = (float)Units.ConvertFrom(entity.TempUnit, dtmp);
|
||||
|
||||
if (entity.TempLimHiTextChngd && Utils.TryParseUDouble(lvi.SubItems[(int)Mtrlgy2Clmn.TempLimHi].Text, out dtmp))
|
||||
entity.TempLimHi = (float)Units.ConvertFrom(entity.TempUnit, dtmp);
|
||||
|
||||
for (Publish pb = 0; pb < Publish.Count; pb++)
|
||||
{
|
||||
if (lvi.SubItems[(int)Mtrlgy2Clmn.Publish].Text.Equals(pb.ToDescription()))
|
||||
@@ -1351,11 +1343,18 @@ namespace TBF.UI.Procedures
|
||||
|
||||
private void metrology2ListViewEx_SubItemClicked(object sender, SubItemEventArgs e)
|
||||
{
|
||||
if (!unlocked || e.SubItem >= (int)Mtrlgy2Clmn.ColumnsCount) return;
|
||||
Mtrlgy2Clmn column = (Mtrlgy2Clmn)e.SubItem;
|
||||
|
||||
/// Unit change is allowed when locked
|
||||
if (column != Mtrlgy2Clmn.TempUnit && (!unlocked || column >= Mtrlgy2Clmn.ColumnsCount))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Mtrlgy2Clmn[] protectedColumns = new Mtrlgy2Clmn[]
|
||||
{
|
||||
Mtrlgy2Clmn.Name,
|
||||
Mtrlgy2Clmn.TempLimLo, Mtrlgy2Clmn.TempLimHi,
|
||||
Mtrlgy2Clmn.Publish, Mtrlgy2Clmn.Evaluate
|
||||
};
|
||||
if (((e.Item.Tag as Test).Profile >= TestProfile.Protected) && protectedColumns.Contains<Mtrlgy2Clmn>((Mtrlgy2Clmn)e.SubItem)) return;
|
||||
@@ -1382,6 +1381,8 @@ namespace TBF.UI.Procedures
|
||||
{
|
||||
item.SubItems[columnNr].Text = value;
|
||||
item.SubItems[columnNr].BackColor = backColor;
|
||||
|
||||
if (columnNr == (int)Mtrlgy2Clmn.TempUnit) UpdateTemperature(item, Units.FromDescription(value));
|
||||
}
|
||||
else if (item == e.Item)
|
||||
{
|
||||
@@ -1394,54 +1395,64 @@ namespace TBF.UI.Procedures
|
||||
|
||||
private void metrology2ListViewEx_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e)
|
||||
{
|
||||
if (e.SubItem == (int)Mtrlgy2Clmn.Name)
|
||||
{
|
||||
if (!Utils.IsGoodFName(e.DisplayText))
|
||||
{
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Test test = e.Item.Tag as Test;
|
||||
Mtrlgy2Clmn column = (Mtrlgy2Clmn)e.SubItem;
|
||||
Unit newUnit;
|
||||
int dummy;
|
||||
if (e.SubItem == (int)Mtrlgy2Clmn.Part)
|
||||
uint udummy;
|
||||
float fdummy;
|
||||
|
||||
switch (column)
|
||||
{
|
||||
if (e.DisplayText.Equals("-")) return; /// OK
|
||||
if (!int.TryParse(e.DisplayText, out dummy) || !Data.IsGoodPartNr(dummy))
|
||||
case Mtrlgy2Clmn.Name:
|
||||
if (Utils.IsGoodFName(e.DisplayText)) return; /// OK
|
||||
break;
|
||||
|
||||
case Mtrlgy2Clmn.Part:
|
||||
{
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
return; /// NOK
|
||||
if (e.DisplayText.Equals("-")) return; /// OK
|
||||
if (int.TryParse(e.DisplayText, out dummy) && Data.IsGoodPartNr(dummy)) return; /// OK
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((e.SubItem == (int)Mtrlgy2Clmn.Repeats) && !int.TryParse(e.DisplayText, out dummy))
|
||||
{
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
case Mtrlgy2Clmn.TempLimLo:
|
||||
if (Utils.TryParseUFloat(e.DisplayText, out fdummy))
|
||||
{
|
||||
if (e.DisplayText != e.Item.SubItems[e.SubItem].Text) test.TempLimLoTextChngd = true;
|
||||
return; /// OK
|
||||
}
|
||||
break;
|
||||
|
||||
int idummy;
|
||||
if ((e.SubItem == (int)Mtrlgy2Clmn.ShortPulses) && (!int.TryParse(e.DisplayText, out idummy) || idummy < 0 || idummy > 1))
|
||||
{
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
case Mtrlgy2Clmn.TempLimHi:
|
||||
if (Utils.TryParseUFloat(e.DisplayText, out fdummy))
|
||||
{
|
||||
if (e.DisplayText != e.Item.SubItems[e.SubItem].Text) test.TempLimHiTextChngd = true;
|
||||
return; /// OK
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
/// Combo boxes
|
||||
if ((e.SubItem == (int)Mtrlgy2Clmn.ControlWaterTemp) || (e.SubItem == (int)Mtrlgy2Clmn.Publish) || (e.SubItem == (int)Mtrlgy2Clmn.Evaluate))
|
||||
{
|
||||
if (!(metrology2Editors[e.SubItem] as ComboBox).Items.Contains(e.DisplayText))
|
||||
{
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
case Mtrlgy2Clmn.TempUnit:
|
||||
newUnit = Units.FromDescription(e.DisplayText);
|
||||
if (!Units.IsTemperature(newUnit)) break;
|
||||
UpdateTemperature(e.Item, newUnit);
|
||||
return;
|
||||
}
|
||||
|
||||
case Mtrlgy2Clmn.ShortPulses:
|
||||
if (uint.TryParse(e.DisplayText, out udummy)) return;
|
||||
break;
|
||||
|
||||
case Mtrlgy2Clmn.ControlWaterTemp:
|
||||
case Mtrlgy2Clmn.Publish:
|
||||
case Mtrlgy2Clmn.Evaluate:
|
||||
/// Combo boxes
|
||||
if ((metrology2Editors[e.SubItem] as ComboBox).Items.Contains(e.DisplayText)) return; /// OK
|
||||
break;
|
||||
}
|
||||
|
||||
/// Display text was not OK, revert to the original one
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -8,12 +8,11 @@ using Oracle.ManagedDataAccess.Client;
|
||||
#else
|
||||
using Oracle.DataAccess.Client;
|
||||
#endif
|
||||
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Resources;
|
||||
using TBF.Rig.Output.DB.SensusOracle;
|
||||
using TBF.Rig.Sequences;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.UI.ResultsMI
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2017 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using Common;
|
||||
|
||||
Reference in New Issue
Block a user