Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6465997be9 | ||
|
|
58fad28546 | ||
|
|
c783967d87 | ||
|
|
b0c95c0677 | ||
|
|
439f20bc95 | ||
|
|
7576a68651 | ||
|
|
b6380ff896 | ||
|
|
c3fd5b9366 | ||
|
|
aa24558d07 | ||
|
|
40d4c74493 | ||
|
|
bc89faf220 | ||
|
|
0b12e79820 | ||
|
|
7bdb7f99d4 | ||
|
|
afea809b97 | ||
|
|
3122f6dd9a | ||
|
|
a2f0781fb4 | ||
|
|
31a684f03a | ||
|
|
89eddaa3c2 | ||
|
|
b060068a95 | ||
|
|
3ffdf4e2cc | ||
|
|
7d1d95305f | ||
|
|
98fc15a709 | ||
|
|
a8e0a8087d | ||
|
|
f81c30f072 | ||
|
|
05f6c8c75c | ||
|
|
76a08324b4 | ||
|
|
2a98c485ef | ||
|
|
872409870e | ||
|
|
f48a71ce12 | ||
|
|
d2d571945c | ||
|
|
bd9c3aa5e2 | ||
|
|
73ea0ff586 | ||
|
|
78408ed5eb | ||
|
|
f04cdccd20 | ||
|
|
82acf60f2e | ||
|
|
68413867ad | ||
|
|
1fd8881d53 | ||
|
|
cebdd71065 | ||
|
|
668304cb72 | ||
|
|
c28c5a5554 | ||
|
|
450493069c | ||
|
|
d7519aa95a | ||
|
|
e89ab89874 | ||
|
|
025fa81941 | ||
|
|
845c66b511 | ||
|
|
3725e238fc | ||
|
|
ac2ac82187 | ||
|
|
5e6be0c4b4 | ||
|
|
ed66c6a259 | ||
|
|
0db7736247 | ||
|
|
02cebe0966 | ||
|
|
4f2bb6291f | ||
|
|
498c8afbe4 | ||
|
|
0e6dce4750 | ||
|
|
7a74579c8b | ||
|
|
c23630a980 | ||
|
|
205df83c1c |
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;FUZHOU_100</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;SLM_END;HEAT_METERS;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -28,7 +28,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;FUZHOU_100</DefineConstants>
|
||||
<DefineConstants>TRACE;SLM_END;HEAT_METERS;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -12,11 +12,14 @@ namespace Config.Entities
|
||||
public virtual float Measurement { get; set; }
|
||||
public virtual float Correction { get; set; }
|
||||
|
||||
public MeasurementCorrection() { }
|
||||
public MeasurementCorrection()
|
||||
{
|
||||
RangeIx = 0;
|
||||
}
|
||||
|
||||
public MeasurementCorrection(int rangeIx)
|
||||
{
|
||||
RangeIx = rangeIx;
|
||||
RangeIx = rangeIx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+19
-2
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
///
|
||||
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,7 +12,21 @@ namespace Config
|
||||
{
|
||||
public static string SignificantDigitsToFmt(double value, int sigDigits)
|
||||
{
|
||||
if (sigDigits == 5)
|
||||
if (sigDigits == 6)
|
||||
{
|
||||
if (value >= 99999.5 || value < -99999.5) return "F0";
|
||||
else if (value >= 9999.95 || value < -9999.95) return "F1";
|
||||
else if (value >= 999.995 || value < -999.995) return "F2";
|
||||
else if (value >= 99.9995 || value < -99.9995) return "F3";
|
||||
else if (value >= 9.99995 || value < -9.99995) return "F4";
|
||||
else if (value >= 0.999995 || value < -0.999995) return "F5";
|
||||
else if (value >= 0.0999995 || value < -0.0999995) return "F6";
|
||||
else if (value >= 0.00999995 || value < -0.00999995) return "F7";
|
||||
else if (value >= 0.000999995 || value < -0.000999995) return "F8";
|
||||
else if (value >= 0.0000999995 || value < -0.0000999995) return "F9";
|
||||
else return "F10";
|
||||
}
|
||||
else if (sigDigits == 5)
|
||||
{
|
||||
if (value >= 9999.5 || value < -9999.5) return "F0";
|
||||
else if (value >= 999.95 || value < -999.95) return "F1";
|
||||
|
||||
@@ -663,8 +663,7 @@ namespace DeviceTest
|
||||
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
|
||||
{
|
||||
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
|
||||
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadVolumeOp(ref dblBox2);
|
||||
operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
}
|
||||
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
@@ -696,8 +695,7 @@ namespace DeviceTest
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
|
||||
{
|
||||
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
|
||||
operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadVolumeOp(ref dblBox2);
|
||||
operation23 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
}
|
||||
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
@@ -729,8 +727,7 @@ namespace DeviceTest
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
|
||||
{
|
||||
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
|
||||
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadVolumeOp(ref dblBox2);
|
||||
operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
|
||||
}
|
||||
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
|
||||
{
|
||||
|
||||
@@ -28,6 +28,9 @@ namespace Results.Entities
|
||||
public virtual double KorrErrQ { get; set; } /// [%] not mapped to results DB, saved to Oracle DB
|
||||
public virtual bool TestDone { get; set; } /// true = test was completed
|
||||
public virtual bool Passed { get; set; } /// true = test passed, water meter is OK
|
||||
#if ORACLE_DB
|
||||
public virtual double LastError { get; set; } /// [%] Previous test error at this Q in case Pruefindex > 1
|
||||
#endif
|
||||
|
||||
public virtual WaterMeter WaterMeter { get; set; } /// reference to the WaterMeter entity
|
||||
public virtual TestRslt TestRslt { get; set; } /// reference to the TestRslt entity
|
||||
|
||||
@@ -25,7 +25,8 @@ namespace Results.Entities
|
||||
public virtual DateTime EndTime { get; set; } /// Date and time of the test end
|
||||
public virtual int FlowSetTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual double TestTime { get; set; } /// [s] Measurement time in seconds
|
||||
public virtual double PulsesMaster { get; set; }
|
||||
public virtual double PulsesMaster { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the water to the tank
|
||||
public virtual double TotalPulsesMstr { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the complete test (not mapped to DB)
|
||||
public virtual double ConstMasterRaw { get; set; } /// [l/pls] Liters per pulse of the master flow meter uncorrected.
|
||||
public virtual double ConstMasterCorr { get; set; } /// [l/pls] Liters per pulse of the master flow meter corrected by a correction table.
|
||||
public virtual double ConstMaster { get; set; } /// [l/pls] Liters per pulse of the master flow meter calculated from a mass measurement.
|
||||
|
||||
@@ -60,13 +60,13 @@ namespace Results.Entities
|
||||
public virtual int SerialNrEx { get; set; } /// Aux s/n for compound meters, Serial number for iPerl water meter
|
||||
public virtual double OrigCalibFactor { get; set; } /// Original iPerl calibration factor used during the test
|
||||
public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test
|
||||
public virtual double OrigCalibFactorLNA { get; set; } /// Original iPerl LNA calibration factor used during the test
|
||||
public virtual double OrigCalibFactorLNA{ get; set; } /// Original iPerl LNA calibration factor used during the test
|
||||
public virtual double CalibFactorLNA { get; set; } /// iPerl LNA calibration factor used during the test
|
||||
public virtual double Q2ErrWOCorrection { get; set; }
|
||||
public virtual bool Q2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
|
||||
public virtual double Q2Correction { get; set; } /// !!! obsolete
|
||||
public virtual int Q2CorrRFlow { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
|
||||
public virtual int Q2CorrLFlow { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
|
||||
public virtual int Q2CorrRL { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
|
||||
public virtual int Q2CorrLR { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
|
||||
public virtual int Q2CorrFlowRight { get; set; } /// 1 = right to left
|
||||
public virtual double Diff2Hz8Hz { get; set; }
|
||||
public virtual bool Hz2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
|
||||
@@ -352,8 +352,8 @@ namespace Results.Entities
|
||||
Q2ErrWOCorrection = src.Q2ErrWOCorrection;
|
||||
Q2CorrectionDone = src.Q2CorrectionDone;
|
||||
Q2Correction = src.Q2Correction;
|
||||
Q2CorrRFlow = src.Q2CorrRFlow;
|
||||
Q2CorrLFlow = src.Q2CorrLFlow;
|
||||
Q2CorrRL = src.Q2CorrRL;
|
||||
Q2CorrLR = src.Q2CorrLR;
|
||||
Q2CorrFlowRight = src.Q2CorrFlowRight;
|
||||
Diff2Hz8Hz = src.Diff2Hz8Hz;
|
||||
Hz2CorrectionDone = src.Hz2CorrectionDone;
|
||||
|
||||
+9
-1
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
@@ -262,7 +262,15 @@ namespace Results
|
||||
Bench_address5, /// 227 'Address 5' from IBenchInfo
|
||||
|
||||
Max_test_index, /// 228 MaxPruefindex % 100
|
||||
VolumeCTV, /// 229
|
||||
|
||||
/// iPerl
|
||||
LastError, /// 230 For iPerl previous test result (test with Proefindex-1)
|
||||
OrigCalibFactorLNA, /// 231
|
||||
CalibFactorLNA, /// 232
|
||||
|
||||
WM_remark, /// 233
|
||||
|
||||
Count,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,10 @@ namespace Results.Mappings
|
||||
Map(x => x.Error);
|
||||
Map(x => x.TestDone);
|
||||
Map(x => x.Passed);
|
||||
|
||||
References(x => x.WaterMeter);
|
||||
#if ORACLE_DB
|
||||
Map(x => x.LastError);
|
||||
#endif
|
||||
References(x => x.WaterMeter);
|
||||
References(x => x.TestRslt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,24 +31,24 @@ namespace Results.Mappings
|
||||
Map(x => x.SerialNrEx);
|
||||
Map(x => x.OrigCalibFactor);
|
||||
Map(x => x.CalibFactor);
|
||||
#endif
|
||||
#if IPERL2
|
||||
Map(x => x.OrigCalibFactorLNA);
|
||||
Map(x => x.CalibFactorLNA);
|
||||
#endif
|
||||
#if IPERL
|
||||
Map(x => x.Q2ErrWOCorrection);
|
||||
Map(x => x.Q2CorrectionDone);
|
||||
Map(x => x.Q2Correction);
|
||||
Map(x => x.Q2CorrRFlow);
|
||||
Map(x => x.Q2CorrLFlow);
|
||||
Map(x => x.Q2CorrRL).Column("Q2CorrRFlow");
|
||||
Map(x => x.Q2CorrLR).Column("Q2CorrLFlow");
|
||||
Map(x => x.Q2CorrFlowRight);
|
||||
Map(x => x.Diff2Hz8Hz);
|
||||
Map(x => x.Hz2CorrectionDone);
|
||||
Map(x => x.Hz2Correction);
|
||||
Map(x => x.FWVersion);
|
||||
#endif
|
||||
References(x => x.WaterMeterData);
|
||||
#if ORACLE_DB
|
||||
Map(x => x.Pruefindex);
|
||||
Map(x => x.HydrPruefung);
|
||||
#endif
|
||||
References(x => x.WaterMeterData);
|
||||
References(x => x.Batch);
|
||||
HasMany(x => x.MeterTestRslts)
|
||||
.Cascade.All();
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.18.1027.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1027.0")]
|
||||
[assembly: AssemblyVersion("2.18.1076.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1076.0")]
|
||||
|
||||
Generated
+18
@@ -114,6 +114,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Batch.
|
||||
/// </summary>
|
||||
internal static string Batch {
|
||||
get {
|
||||
return ResourceManager.GetString("Batch", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Batch nr..
|
||||
/// </summary>
|
||||
@@ -1059,6 +1068,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Relative error of a meter in previous test/in production.
|
||||
/// </summary>
|
||||
internal static string Tooltip_E_rel_last {
|
||||
get {
|
||||
return ResourceManager.GetString("Tooltip_E_rel_last", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Relative error of the master meter.
|
||||
/// </summary>
|
||||
|
||||
@@ -252,4 +252,7 @@
|
||||
<data name="Address" xml:space="preserve">
|
||||
<value>Adresa</value>
|
||||
</data>
|
||||
<data name="Batch" xml:space="preserve">
|
||||
<value>Dávka</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -735,4 +735,10 @@
|
||||
<data name="Address" xml:space="preserve">
|
||||
<value>Address</value>
|
||||
</data>
|
||||
<data name="Tooltip_E_rel_last" xml:space="preserve">
|
||||
<value>Relative error of a meter in previous test/in production</value>
|
||||
</data>
|
||||
<data name="Batch" xml:space="preserve">
|
||||
<value>Batch</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;FUZHOU_100</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;SLM_END;HEAT_METERS;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -27,7 +27,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;FUZHOU_100</DefineConstants>
|
||||
<DefineConstants>TRACE;SLM_END;HEAT_METERS;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -154,7 +154,8 @@ namespace Results
|
||||
/// Volume
|
||||
///
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_volume, Strings.Test_vol + "()", Quantity.Volume, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).TargetVolume())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume, string.Format("{0} Mt. ()", Strings.VName_Vol), Strings.Tooltip_Vol_Mt, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.VolumeCTV, string.Format("{0} CTV ()", Strings.VName_Vol), Quantity.Volume, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).VolumeCTV)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume, string.Format("{0} Mt. ()", Strings.VName_Vol), Strings.Tooltip_Vol_Mt, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_volume, string.Format("{0} rm ()", Strings.VName_Vol), Strings.Tooltip_Vol_rm, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeRef)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_main, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.main), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_aux, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.aux), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
|
||||
@@ -309,8 +310,9 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Uncertainty, Strings.Uncertainty + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).Uncertainty())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error, string.Format("{0} rel.ref. ()", Strings.VName_Error), Strings.Tooltip_E_rel_ref, Quantity.Error, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrorMaster)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error_corr, string.Format("{0} ref.corr. ()", Strings.VName_Error), "Relative error of the reference flow meter after correction using correction curve", Quantity.Error, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", Config.Formulas.ErrorFromVolumes(w.GetTestRslt(t).ConstMasterCorr, w.GetTestRslt(t).ConstMaster))));
|
||||
#if TURA_IPERL || TURA_SPECIAL
|
||||
#if ORACLE_DB
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.LastError, string.Format("{0} rel. last ()", Strings.VName_Error), Strings.Tooltip_E_rel_last, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).LastError)));
|
||||
#else
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error)));
|
||||
#endif
|
||||
@@ -399,8 +401,9 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed_seals_count, "Seals count of passed meters", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.PassedMetersCount() * int.Parse(w.WaterMeterData.Text5))));
|
||||
|
||||
/// Extra water meter data
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Result_code, Strings.Result_code, Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.ResultCode)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Remark, Strings.Remark, Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatStr(f, w.Batch.Remark)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Result_code, Strings.Result_code, Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.ResultCode)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.WM_remark, string.Format("{0} {1}", Strings.Water_Meter, Strings.Remark), Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.Remark)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Remark, string.Format("{0} {1}", Strings.Batch, Strings.Remark), Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatStr(f, w.Batch.Remark)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Meter_type, Strings.Meter_type, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Compound ? Strings.Compound : (w.WaterMeterData.HeatMeter ? Strings.Heat_meter : Strings.Single))));
|
||||
|
||||
#if HEAT_METERS
|
||||
@@ -409,14 +412,16 @@ namespace Results
|
||||
#endif
|
||||
|
||||
#if IPERL
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactor, "iPerl OrigCalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.OrigCalibFactor)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactor, "iPerl CalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.CalibFactor)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2ErrWOCorrection, "iPerl Q2ErrWOCorrection",Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.Q2ErrWOCorrection)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrectionDone, "iPerl Q2CorrectionDone", Quantity.Boolean,ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrectionDone ? Strings.Yes : Strings.No)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2CorrRFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrRFlow)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2CorrLFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLFlow)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrFlowRight)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.FW_Version, "iPerl FW version", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.FWVersion)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactor, "iPerl OrigCalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.OrigCalibFactor)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactor, "iPerl CalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.CalibFactor)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactorLNA,"iPerl OrigCalibFactorLNA",Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.OrigCalibFactorLNA)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactorLNA, "iPerl CalibFactorLNA", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.CalibFactorLNA)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2ErrWOCorrection, "iPerl Q2ErrWOCorrection", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.Q2ErrWOCorrection)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrectionDone, "iPerl Q2CorrectionDone", Quantity.Boolean,ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrectionDone ? Strings.Yes : Strings.No)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2CorrRFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrRL)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2CorrLFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLR)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrFlowRight)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.FW_Version, "iPerl FW version", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.FWVersion)));
|
||||
#if ORACLE_DB
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Max_test_index, "iPerl test index", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, (w.Pruefindex % 100))));
|
||||
#endif
|
||||
|
||||
@@ -237,4 +237,7 @@
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>Vytisknout</value>
|
||||
</data>
|
||||
<data name="Add_data_from_Oracle" xml:space="preserve">
|
||||
<value>Dohledej údaje z Oracle</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -825,4 +825,7 @@
|
||||
<data name="Error_exporting_results" xml:space="preserve">
|
||||
<value>Error exporting results</value>
|
||||
</data>
|
||||
<data name="Add_data_from_Oracle" xml:space="preserve">
|
||||
<value>Add data from Oracle</value>
|
||||
</data>
|
||||
</root>
|
||||
+9
@@ -105,6 +105,15 @@ namespace ResultsBrowser.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add data from Oracle.
|
||||
/// </summary>
|
||||
internal static string Add_data_from_Oracle {
|
||||
get {
|
||||
return ResourceManager.GetString("Add_data_from_Oracle", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add filter.
|
||||
/// </summary>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;FUZHOU_100</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;SLM_END;HEAT_METERS;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -31,7 +31,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;FUZHOU_100</DefineConstants>
|
||||
<DefineConstants>TRACE;SLM_END;HEAT_METERS;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
+291
-316
@@ -31,328 +31,303 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBeginningForm));
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox2 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox2 = new System.Windows.Forms.CheckBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox3 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox7 = new System.Windows.Forms.CheckBox();
|
||||
this.checkBox3 = new System.Windows.Forms.CheckBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox4 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox4 = new System.Windows.Forms.CheckBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.groupBox5 = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox5 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox5 = new System.Windows.Forms.CheckBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.groupBox6 = new System.Windows.Forms.GroupBox();
|
||||
this.comboBox6 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox6 = new System.Windows.Forms.CheckBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.orderGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.orderComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.clearButton = new System.Windows.Forms.Button();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.groupBox4.SuspendLayout();
|
||||
this.groupBox5.SuspendLayout();
|
||||
this.groupBox6.SuspendLayout();
|
||||
this.orderGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.comboBox1);
|
||||
this.groupBox1.Controls.Add(this.checkBox1);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
resources.ApplyResources(this.groupBox1, "groupBox1");
|
||||
this.groupBox1.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.comboBox1, "comboBox1");
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
|
||||
this.comboBox1.TextChanged += new System.EventHandler(this.comboBox1_TextChanged);
|
||||
this.comboBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox1_KeyPress);
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
resources.ApplyResources(this.checkBox1, "checkBox1");
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
resources.ApplyResources(this.label1, "label1");
|
||||
this.label1.Name = "label1";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.comboBox2);
|
||||
this.groupBox2.Controls.Add(this.checkBox2);
|
||||
this.groupBox2.Controls.Add(this.label2);
|
||||
resources.ApplyResources(this.groupBox2, "groupBox2");
|
||||
this.groupBox2.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.TabStop = false;
|
||||
//
|
||||
// comboBox2
|
||||
//
|
||||
this.comboBox2.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.comboBox2, "comboBox2");
|
||||
this.comboBox2.Name = "comboBox2";
|
||||
this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged);
|
||||
this.comboBox2.TextChanged += new System.EventHandler(this.comboBox2_TextChanged);
|
||||
this.comboBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox2_KeyPress);
|
||||
//
|
||||
// checkBox2
|
||||
//
|
||||
resources.ApplyResources(this.checkBox2, "checkBox2");
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
resources.ApplyResources(this.label2, "label2");
|
||||
this.label2.Name = "label2";
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.comboBox3);
|
||||
this.groupBox3.Controls.Add(this.checkBox7);
|
||||
this.groupBox3.Controls.Add(this.checkBox3);
|
||||
this.groupBox3.Controls.Add(this.label3);
|
||||
resources.ApplyResources(this.groupBox3, "groupBox3");
|
||||
this.groupBox3.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.TabStop = false;
|
||||
//
|
||||
// comboBox3
|
||||
//
|
||||
this.comboBox3.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.comboBox3, "comboBox3");
|
||||
this.comboBox3.Name = "comboBox3";
|
||||
this.comboBox3.SelectedIndexChanged += new System.EventHandler(this.comboBox3_SelectedIndexChanged);
|
||||
this.comboBox3.TextChanged += new System.EventHandler(this.comboBox3_TextChanged);
|
||||
this.comboBox3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox3_KeyPress);
|
||||
//
|
||||
// checkBox7
|
||||
//
|
||||
resources.ApplyResources(this.checkBox7, "checkBox7");
|
||||
this.checkBox7.Name = "checkBox7";
|
||||
this.checkBox7.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBox3
|
||||
//
|
||||
resources.ApplyResources(this.checkBox3, "checkBox3");
|
||||
this.checkBox3.Name = "checkBox3";
|
||||
this.checkBox3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
resources.ApplyResources(this.label3, "label3");
|
||||
this.label3.Name = "label3";
|
||||
//
|
||||
// groupBox4
|
||||
//
|
||||
this.groupBox4.Controls.Add(this.comboBox4);
|
||||
this.groupBox4.Controls.Add(this.checkBox4);
|
||||
this.groupBox4.Controls.Add(this.label4);
|
||||
resources.ApplyResources(this.groupBox4, "groupBox4");
|
||||
this.groupBox4.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox4.Name = "groupBox4";
|
||||
this.groupBox4.TabStop = false;
|
||||
//
|
||||
// comboBox4
|
||||
//
|
||||
this.comboBox4.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.comboBox4, "comboBox4");
|
||||
this.comboBox4.Name = "comboBox4";
|
||||
this.comboBox4.SelectedIndexChanged += new System.EventHandler(this.comboBox4_SelectedIndexChanged);
|
||||
this.comboBox4.TextChanged += new System.EventHandler(this.comboBox4_TextChanged);
|
||||
this.comboBox4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox4_KeyPress);
|
||||
//
|
||||
// checkBox4
|
||||
//
|
||||
resources.ApplyResources(this.checkBox4, "checkBox4");
|
||||
this.checkBox4.Name = "checkBox4";
|
||||
this.checkBox4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
resources.ApplyResources(this.label4, "label4");
|
||||
this.label4.Name = "label4";
|
||||
//
|
||||
// groupBox5
|
||||
//
|
||||
this.groupBox5.Controls.Add(this.comboBox5);
|
||||
this.groupBox5.Controls.Add(this.checkBox5);
|
||||
this.groupBox5.Controls.Add(this.label5);
|
||||
resources.ApplyResources(this.groupBox5, "groupBox5");
|
||||
this.groupBox5.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox5.Name = "groupBox5";
|
||||
this.groupBox5.TabStop = false;
|
||||
//
|
||||
// comboBox5
|
||||
//
|
||||
this.comboBox5.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.comboBox5, "comboBox5");
|
||||
this.comboBox5.Name = "comboBox5";
|
||||
this.comboBox5.SelectedIndexChanged += new System.EventHandler(this.comboBox5_SelectedIndexChanged);
|
||||
this.comboBox5.TextChanged += new System.EventHandler(this.comboBox5_TextChanged);
|
||||
this.comboBox5.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox5_KeyPress);
|
||||
//
|
||||
// checkBox5
|
||||
//
|
||||
resources.ApplyResources(this.checkBox5, "checkBox5");
|
||||
this.checkBox5.Name = "checkBox5";
|
||||
this.checkBox5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
resources.ApplyResources(this.label5, "label5");
|
||||
this.label5.Name = "label5";
|
||||
//
|
||||
// groupBox6
|
||||
//
|
||||
this.groupBox6.Controls.Add(this.comboBox6);
|
||||
this.groupBox6.Controls.Add(this.checkBox6);
|
||||
this.groupBox6.Controls.Add(this.label6);
|
||||
resources.ApplyResources(this.groupBox6, "groupBox6");
|
||||
this.groupBox6.ForeColor = System.Drawing.Color.Black;
|
||||
this.groupBox6.Name = "groupBox6";
|
||||
this.groupBox6.TabStop = false;
|
||||
//
|
||||
// comboBox6
|
||||
//
|
||||
this.comboBox6.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.comboBox6, "comboBox6");
|
||||
this.comboBox6.Name = "comboBox6";
|
||||
this.comboBox6.SelectedIndexChanged += new System.EventHandler(this.comboBox6_SelectedIndexChanged);
|
||||
this.comboBox6.TextChanged += new System.EventHandler(this.comboBox6_TextChanged);
|
||||
this.comboBox6.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox6_KeyPress);
|
||||
//
|
||||
// checkBox6
|
||||
//
|
||||
resources.ApplyResources(this.checkBox6, "checkBox6");
|
||||
this.checkBox6.Name = "checkBox6";
|
||||
this.checkBox6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
resources.ApplyResources(this.label6, "label6");
|
||||
this.label6.Name = "label6";
|
||||
//
|
||||
// orderGroupBox
|
||||
//
|
||||
this.orderGroupBox.Controls.Add(this.orderComboBox);
|
||||
resources.ApplyResources(this.orderGroupBox, "orderGroupBox");
|
||||
this.orderGroupBox.ForeColor = System.Drawing.Color.Black;
|
||||
this.orderGroupBox.Name = "orderGroupBox";
|
||||
this.orderGroupBox.TabStop = false;
|
||||
//
|
||||
// orderComboBox
|
||||
//
|
||||
this.orderComboBox.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.orderComboBox, "orderComboBox");
|
||||
this.orderComboBox.Name = "orderComboBox";
|
||||
//
|
||||
// clearButton
|
||||
//
|
||||
resources.ApplyResources(this.clearButton, "clearButton");
|
||||
this.clearButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.clearButton.Name = "clearButton";
|
||||
this.clearButton.UseVisualStyleBackColor = true;
|
||||
this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
|
||||
//
|
||||
// CycleBeginningForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGoldenrod;
|
||||
this.Controls.Add(this.clearButton);
|
||||
this.Controls.Add(this.orderGroupBox);
|
||||
this.Controls.Add(this.groupBox6);
|
||||
this.Controls.Add(this.groupBox5);
|
||||
this.Controls.Add(this.groupBox4);
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.ForeColor = System.Drawing.Color.Black;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "CycleBeginningForm";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleBeginningForm_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
this.groupBox4.ResumeLayout(false);
|
||||
this.groupBox4.PerformLayout();
|
||||
this.groupBox5.ResumeLayout(false);
|
||||
this.groupBox5.PerformLayout();
|
||||
this.groupBox6.ResumeLayout(false);
|
||||
this.groupBox6.PerformLayout();
|
||||
this.orderGroupBox.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBeginningForm));
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.clearButton = new System.Windows.Forms.Button();
|
||||
this.comboBox2 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox2 = new System.Windows.Forms.CheckBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.comboBox3 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox3 = new System.Windows.Forms.CheckBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.comboBox4 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox4 = new System.Windows.Forms.CheckBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.comboBox5 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox5 = new System.Windows.Forms.CheckBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.comboBox6 = new System.Windows.Forms.ComboBox();
|
||||
this.checkBox6 = new System.Windows.Forms.CheckBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.orderComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.orderLabel = new System.Windows.Forms.Label();
|
||||
this.snLabel = new System.Windows.Forms.Label();
|
||||
this.remarkLabel = new System.Windows.Forms.Label();
|
||||
this.remarkComboBox6 = new System.Windows.Forms.ComboBox();
|
||||
this.remarkComboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.remarkComboBox2 = new System.Windows.Forms.ComboBox();
|
||||
this.remarkComboBox3 = new System.Windows.Forms.ComboBox();
|
||||
this.remarkComboBox4 = new System.Windows.Forms.ComboBox();
|
||||
this.remarkComboBox5 = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
resources.ApplyResources(this.comboBox1, "comboBox1");
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
|
||||
this.comboBox1.TextChanged += new System.EventHandler(this.comboBox1_TextChanged);
|
||||
this.comboBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox1_KeyPress);
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
resources.ApplyResources(this.checkBox1, "checkBox1");
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
resources.ApplyResources(this.label1, "label1");
|
||||
this.label1.Name = "label1";
|
||||
//
|
||||
// clearButton
|
||||
//
|
||||
resources.ApplyResources(this.clearButton, "clearButton");
|
||||
this.clearButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.clearButton.Name = "clearButton";
|
||||
this.clearButton.UseVisualStyleBackColor = true;
|
||||
this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
|
||||
//
|
||||
// comboBox2
|
||||
//
|
||||
resources.ApplyResources(this.comboBox2, "comboBox2");
|
||||
this.comboBox2.FormattingEnabled = true;
|
||||
this.comboBox2.Name = "comboBox2";
|
||||
this.comboBox2.TextChanged += new System.EventHandler(this.comboBox2_TextChanged);
|
||||
this.comboBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox2_KeyPress);
|
||||
//
|
||||
// checkBox2
|
||||
//
|
||||
resources.ApplyResources(this.checkBox2, "checkBox2");
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
resources.ApplyResources(this.label2, "label2");
|
||||
this.label2.Name = "label2";
|
||||
//
|
||||
// comboBox3
|
||||
//
|
||||
resources.ApplyResources(this.comboBox3, "comboBox3");
|
||||
this.comboBox3.FormattingEnabled = true;
|
||||
this.comboBox3.Name = "comboBox3";
|
||||
this.comboBox3.TextChanged += new System.EventHandler(this.comboBox3_TextChanged);
|
||||
this.comboBox3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox3_KeyPress);
|
||||
//
|
||||
// checkBox3
|
||||
//
|
||||
resources.ApplyResources(this.checkBox3, "checkBox3");
|
||||
this.checkBox3.Name = "checkBox3";
|
||||
this.checkBox3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
resources.ApplyResources(this.label3, "label3");
|
||||
this.label3.Name = "label3";
|
||||
//
|
||||
// comboBox4
|
||||
//
|
||||
resources.ApplyResources(this.comboBox4, "comboBox4");
|
||||
this.comboBox4.FormattingEnabled = true;
|
||||
this.comboBox4.Name = "comboBox4";
|
||||
this.comboBox4.TextChanged += new System.EventHandler(this.comboBox4_TextChanged);
|
||||
this.comboBox4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox4_KeyPress);
|
||||
//
|
||||
// checkBox4
|
||||
//
|
||||
resources.ApplyResources(this.checkBox4, "checkBox4");
|
||||
this.checkBox4.Name = "checkBox4";
|
||||
this.checkBox4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
resources.ApplyResources(this.label4, "label4");
|
||||
this.label4.Name = "label4";
|
||||
//
|
||||
// comboBox5
|
||||
//
|
||||
resources.ApplyResources(this.comboBox5, "comboBox5");
|
||||
this.comboBox5.FormattingEnabled = true;
|
||||
this.comboBox5.Name = "comboBox5";
|
||||
this.comboBox5.TextChanged += new System.EventHandler(this.comboBox5_TextChanged);
|
||||
this.comboBox5.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox5_KeyPress);
|
||||
//
|
||||
// checkBox5
|
||||
//
|
||||
resources.ApplyResources(this.checkBox5, "checkBox5");
|
||||
this.checkBox5.Name = "checkBox5";
|
||||
this.checkBox5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
resources.ApplyResources(this.label5, "label5");
|
||||
this.label5.Name = "label5";
|
||||
//
|
||||
// comboBox6
|
||||
//
|
||||
resources.ApplyResources(this.comboBox6, "comboBox6");
|
||||
this.comboBox6.FormattingEnabled = true;
|
||||
this.comboBox6.Name = "comboBox6";
|
||||
this.comboBox6.TextChanged += new System.EventHandler(this.comboBox6_TextChanged);
|
||||
this.comboBox6.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox6_KeyPress);
|
||||
//
|
||||
// checkBox6
|
||||
//
|
||||
resources.ApplyResources(this.checkBox6, "checkBox6");
|
||||
this.checkBox6.Name = "checkBox6";
|
||||
this.checkBox6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
resources.ApplyResources(this.label6, "label6");
|
||||
this.label6.Name = "label6";
|
||||
//
|
||||
// orderComboBox
|
||||
//
|
||||
resources.ApplyResources(this.orderComboBox, "orderComboBox");
|
||||
this.orderComboBox.FormattingEnabled = true;
|
||||
this.orderComboBox.Name = "orderComboBox";
|
||||
//
|
||||
// orderLabel
|
||||
//
|
||||
resources.ApplyResources(this.orderLabel, "orderLabel");
|
||||
this.orderLabel.Name = "orderLabel";
|
||||
//
|
||||
// snLabel
|
||||
//
|
||||
resources.ApplyResources(this.snLabel, "snLabel");
|
||||
this.snLabel.Name = "snLabel";
|
||||
//
|
||||
// remarkLabel
|
||||
//
|
||||
resources.ApplyResources(this.remarkLabel, "remarkLabel");
|
||||
this.remarkLabel.Name = "remarkLabel";
|
||||
//
|
||||
// remarkComboBox6
|
||||
//
|
||||
resources.ApplyResources(this.remarkComboBox6, "remarkComboBox6");
|
||||
this.remarkComboBox6.FormattingEnabled = true;
|
||||
this.remarkComboBox6.Name = "remarkComboBox6";
|
||||
//
|
||||
// remarkComboBox1
|
||||
//
|
||||
resources.ApplyResources(this.remarkComboBox1, "remarkComboBox1");
|
||||
this.remarkComboBox1.FormattingEnabled = true;
|
||||
this.remarkComboBox1.Name = "remarkComboBox1";
|
||||
//
|
||||
// remarkComboBox2
|
||||
//
|
||||
resources.ApplyResources(this.remarkComboBox2, "remarkComboBox2");
|
||||
this.remarkComboBox2.FormattingEnabled = true;
|
||||
this.remarkComboBox2.Name = "remarkComboBox2";
|
||||
//
|
||||
// remarkComboBox3
|
||||
//
|
||||
resources.ApplyResources(this.remarkComboBox3, "remarkComboBox3");
|
||||
this.remarkComboBox3.FormattingEnabled = true;
|
||||
this.remarkComboBox3.Name = "remarkComboBox3";
|
||||
//
|
||||
// remarkComboBox4
|
||||
//
|
||||
resources.ApplyResources(this.remarkComboBox4, "remarkComboBox4");
|
||||
this.remarkComboBox4.FormattingEnabled = true;
|
||||
this.remarkComboBox4.Name = "remarkComboBox4";
|
||||
//
|
||||
// remarkComboBox5
|
||||
//
|
||||
resources.ApplyResources(this.remarkComboBox5, "remarkComboBox5");
|
||||
this.remarkComboBox5.FormattingEnabled = true;
|
||||
this.remarkComboBox5.Name = "remarkComboBox5";
|
||||
//
|
||||
// CycleBeginningForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGoldenrod;
|
||||
this.Controls.Add(this.remarkComboBox5);
|
||||
this.Controls.Add(this.remarkComboBox4);
|
||||
this.Controls.Add(this.remarkComboBox3);
|
||||
this.Controls.Add(this.remarkComboBox2);
|
||||
this.Controls.Add(this.remarkComboBox1);
|
||||
this.Controls.Add(this.remarkComboBox6);
|
||||
this.Controls.Add(this.remarkLabel);
|
||||
this.Controls.Add(this.snLabel);
|
||||
this.Controls.Add(this.orderLabel);
|
||||
this.Controls.Add(this.orderComboBox);
|
||||
this.Controls.Add(this.comboBox6);
|
||||
this.Controls.Add(this.checkBox6);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.comboBox5);
|
||||
this.Controls.Add(this.checkBox5);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.comboBox4);
|
||||
this.Controls.Add(this.checkBox4);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.comboBox3);
|
||||
this.Controls.Add(this.checkBox3);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.comboBox2);
|
||||
this.Controls.Add(this.checkBox2);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.comboBox1);
|
||||
this.Controls.Add(this.clearButton);
|
||||
this.Controls.Add(this.checkBox1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.ForeColor = System.Drawing.Color.Black;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "CycleBeginningForm";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleBeginningForm_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.GroupBox groupBox4;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.GroupBox groupBox5;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.GroupBox groupBox6;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.CheckBox checkBox2;
|
||||
private System.Windows.Forms.CheckBox checkBox7;
|
||||
private System.Windows.Forms.CheckBox checkBox3;
|
||||
private System.Windows.Forms.CheckBox checkBox4;
|
||||
private System.Windows.Forms.CheckBox checkBox5;
|
||||
private System.Windows.Forms.CheckBox checkBox6;
|
||||
private System.Windows.Forms.GroupBox orderGroupBox;
|
||||
private System.Windows.Forms.ComboBox orderComboBox;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.ComboBox comboBox2;
|
||||
private System.Windows.Forms.ComboBox comboBox3;
|
||||
private System.Windows.Forms.ComboBox comboBox4;
|
||||
private System.Windows.Forms.ComboBox comboBox5;
|
||||
private System.Windows.Forms.ComboBox comboBox6;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.Button clearButton;
|
||||
private System.Windows.Forms.ComboBox comboBox2;
|
||||
private System.Windows.Forms.CheckBox checkBox2;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.ComboBox comboBox3;
|
||||
private System.Windows.Forms.CheckBox checkBox3;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.ComboBox comboBox4;
|
||||
private System.Windows.Forms.CheckBox checkBox4;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.ComboBox comboBox5;
|
||||
private System.Windows.Forms.CheckBox checkBox5;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.ComboBox comboBox6;
|
||||
private System.Windows.Forms.CheckBox checkBox6;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.ComboBox orderComboBox;
|
||||
private System.Windows.Forms.Label orderLabel;
|
||||
private System.Windows.Forms.Label snLabel;
|
||||
private System.Windows.Forms.Label remarkLabel;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox6;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox1;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox2;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox3;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox4;
|
||||
private System.Windows.Forms.ComboBox remarkComboBox5;
|
||||
}
|
||||
}
|
||||
@@ -15,11 +15,13 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
public readonly bool RemarksEnabled;
|
||||
|
||||
/// To be retrieved after the form is closed
|
||||
public string PurchaseOrder;
|
||||
public string[] SNText;
|
||||
public bool[] Disabled;
|
||||
public string[] Remark;
|
||||
|
||||
/// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
@@ -27,21 +29,29 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
|
||||
IList<ComboBox> enabledComboBoxes;
|
||||
|
||||
ComboBox[] comboBoxes;
|
||||
CheckBox[] checkBoxes;
|
||||
ComboBox[] remarkBoxes;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public CycleBeginningForm(int waterMetersCount)
|
||||
public CycleBeginningForm(int waterMetersCount, bool remarksEnabled)
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
|
||||
comboBoxes = new ComboBox[] { comboBox1, comboBox2, comboBox3, comboBox4, comboBox5, comboBox6 };
|
||||
checkBoxes = new CheckBox[] { checkBox1, checkBox2, checkBox3, checkBox4, checkBox5, checkBox6 };
|
||||
remarkBoxes = new ComboBox[] { remarkComboBox1, remarkComboBox2, remarkComboBox3, remarkComboBox4, remarkComboBox5, remarkComboBox6 };
|
||||
|
||||
this.WaterMetersCount = waterMetersCount;
|
||||
this.RemarksEnabled = remarksEnabled;
|
||||
SNText = new string[WaterMetersCount];
|
||||
Disabled = new bool[WaterMetersCount];
|
||||
enabledComboBoxes = new List<ComboBox>();
|
||||
|
||||
Height = 147 + WaterMetersCount * 90;
|
||||
Remark = new string[WaterMetersCount];
|
||||
enabledComboBoxes = new List<ComboBox>();
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
@@ -49,15 +59,20 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
|
||||
/// <summary> Parameterless constructor for all watermeters </summary>
|
||||
public CycleBeginningForm()
|
||||
: this(Config.Data.WMsCount)
|
||||
: this(Config.Data.WMsCount, false)
|
||||
{
|
||||
}
|
||||
|
||||
private void CycleBeginningForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
PrepareOrderCombo(orderComboBox);
|
||||
|
||||
PrepareCombo(orderComboBox, Program.LocalSettings.PurchaseOrderHistory);
|
||||
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
PrepareCombo(remarkBoxes[i], Program.LocalSettings.RemarkHistory, true);
|
||||
}
|
||||
|
||||
if (Program.LocalSettings.LastSNTextsCount == WaterMetersCount)
|
||||
{
|
||||
@@ -69,53 +84,65 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
if (WaterMetersCount >= 6) comboBox6.Items.Add((Program.LocalSettings.LastSNTexts[5] == null) ? string.Empty : Program.LocalSettings.LastSNTexts[5]);
|
||||
}
|
||||
|
||||
if (WaterMetersCount < 1) { groupBox1.Visible = false; } else { enabledComboBoxes.Add(comboBox1); }
|
||||
if (WaterMetersCount < 2) { groupBox2.Visible = false; } else { enabledComboBoxes.Add(comboBox2); }
|
||||
if (WaterMetersCount < 3) { groupBox3.Visible = false; } else { enabledComboBoxes.Add(comboBox3); }
|
||||
if (WaterMetersCount < 4) { groupBox4.Visible = false; } else { enabledComboBoxes.Add(comboBox4); }
|
||||
if (WaterMetersCount < 5) { groupBox5.Visible = false; } else { enabledComboBoxes.Add(comboBox5); }
|
||||
if (WaterMetersCount < 6) { groupBox6.Visible = false; } else { enabledComboBoxes.Add(comboBox6); }
|
||||
if (WaterMetersCount >= 1) { enabledComboBoxes.Add(comboBox1); } else { comboBox1.Visible = false; label1.Visible = false; checkBox1.Visible = false; }
|
||||
if (WaterMetersCount >= 2) { enabledComboBoxes.Add(comboBox2); } else { comboBox2.Visible = false; label2.Visible = false; checkBox2.Visible = false; }
|
||||
if (WaterMetersCount >= 3) { enabledComboBoxes.Add(comboBox3); } else { comboBox3.Visible = false; label3.Visible = false; checkBox3.Visible = false; }
|
||||
if (WaterMetersCount >= 4) { enabledComboBoxes.Add(comboBox4); } else { comboBox4.Visible = false; label4.Visible = false; checkBox4.Visible = false; }
|
||||
if (WaterMetersCount >= 5) { enabledComboBoxes.Add(comboBox5); } else { comboBox5.Visible = false; label5.Visible = false; checkBox5.Visible = false; }
|
||||
if (WaterMetersCount >= 6) { enabledComboBoxes.Add(comboBox6); } else { comboBox6.Visible = false; label6.Visible = false; checkBox6.Visible = false; }
|
||||
|
||||
Height = 147 + WaterMetersCount * 90;
|
||||
}
|
||||
if (RemarksEnabled)
|
||||
{
|
||||
if (WaterMetersCount >= 1) { remarkComboBox1.Visible = true; remarkLabel.Visible = true; }
|
||||
if (WaterMetersCount >= 2) { remarkComboBox2.Visible = true; }
|
||||
if (WaterMetersCount >= 3) { remarkComboBox3.Visible = true; }
|
||||
if (WaterMetersCount >= 4) { remarkComboBox4.Visible = true; }
|
||||
if (WaterMetersCount >= 5) { remarkComboBox5.Visible = true; }
|
||||
if (WaterMetersCount >= 6) { remarkComboBox6.Visible = true; }
|
||||
}
|
||||
|
||||
Height = 177 + WaterMetersCount * 46;
|
||||
if (!RemarksEnabled) Width -= remarkComboBox1.Width;
|
||||
//Size = new System.Drawing.Size(RemarksEnabled ? 1045 : 624, 177 + WaterMetersCount * 46);
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Data;
|
||||
orderGroupBox.Text = Strings.Purchase_order;
|
||||
orderLabel.Text = Strings.Purchase_order;
|
||||
snLabel.Text = Strings.Serial_Number;
|
||||
remarkLabel.Text = Strings.Remark;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
clearButton.Text = Strings.ClearBtnText;
|
||||
|
||||
groupBox1.Text = Strings.Water_Meter + " 1";
|
||||
groupBox2.Text = Strings.Water_Meter + " 2";
|
||||
groupBox3.Text = Strings.Water_Meter + " 3";
|
||||
groupBox4.Text = Strings.Water_Meter + " 4";
|
||||
groupBox5.Text = Strings.Water_Meter + " 5";
|
||||
groupBox6.Text = Strings.Water_Meter + " 6";
|
||||
|
||||
label1.Text = Strings.Serial_Number;
|
||||
label2.Text = Strings.Serial_Number;
|
||||
label3.Text = Strings.Serial_Number;
|
||||
label4.Text = Strings.Serial_Number;
|
||||
label5.Text = Strings.Serial_Number;
|
||||
label6.Text = Strings.Serial_Number;
|
||||
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
clearButton.Text = Strings.ClearBtnText;
|
||||
label1.Text = Strings.Water_Meter + " 1";
|
||||
label2.Text = Strings.Water_Meter + " 2";
|
||||
label3.Text = Strings.Water_Meter + " 3";
|
||||
label4.Text = Strings.Water_Meter + " 4";
|
||||
label5.Text = Strings.Water_Meter + " 5";
|
||||
label6.Text = Strings.Water_Meter + " 6";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
|
||||
/// </summary>
|
||||
/// <param name="orderComboBox">Puchase order ComboBox</param>
|
||||
void PrepareOrderCombo(ComboBox orderComboBox)
|
||||
/// <param name="comboBox">Puchase order ComboBox</param>
|
||||
void PrepareCombo(ComboBox comboBox, string[] history, bool emptyOnStart = false)
|
||||
{
|
||||
for (int i = 0; i < Program.LocalSettings.PurchaseOrderHistoryCount; i++)
|
||||
int historyLen = (history != null) ? history.Length : 0;
|
||||
|
||||
if (!emptyOnStart && (historyLen > 0))
|
||||
{
|
||||
orderComboBox.Items.Add(Program.LocalSettings.PurchaseOrderHistory[i]);
|
||||
comboBox.Text = history[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
comboBox.Text = string.Empty;
|
||||
}
|
||||
|
||||
if (orderComboBox.Items.Count > 0)
|
||||
for (int i = 0; i < historyLen; i++)
|
||||
{
|
||||
orderComboBox.Text = orderComboBox.Items[0].ToString();
|
||||
comboBox.Items.Add(history[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,14 +156,15 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
#endif
|
||||
);
|
||||
|
||||
Program.LocalSettings.LastSNTexts = SNText;
|
||||
Program.LocalSettings.LastSNTexts = SNText;
|
||||
|
||||
if (WaterMetersCount >= 1) { SNText[0] = comboBox1.Text; Disabled[0] = !checkBox1.Checked; }
|
||||
if (WaterMetersCount >= 2) { SNText[1] = comboBox2.Text; Disabled[1] = !checkBox2.Checked; }
|
||||
if (WaterMetersCount >= 3) { SNText[2] = comboBox3.Text; Disabled[2] = !checkBox3.Checked; }
|
||||
if (WaterMetersCount >= 4) { SNText[3] = comboBox4.Text; Disabled[3] = !checkBox4.Checked; }
|
||||
if (WaterMetersCount >= 5) { SNText[4] = comboBox5.Text; Disabled[4] = !checkBox5.Checked; }
|
||||
if (WaterMetersCount >= 6) { SNText[5] = comboBox6.Text; Disabled[5] = !checkBox6.Checked; }
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
Program.LocalSettings.UpdateHistory(remarkBoxes[i].Text, ref Program.LocalSettings.RemarkHistory, 20);
|
||||
SNText[i] = comboBoxes[i].Text;
|
||||
Disabled[i] = !checkBoxes[i].Checked;
|
||||
Remark[i] = remarkBoxes[i].Text;
|
||||
}
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
@@ -145,36 +173,11 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
|
||||
private void UpdateAllCombos()
|
||||
{
|
||||
if (WaterMetersCount >= 1)
|
||||
{
|
||||
comboBox1.Text = Program.LocalSettings.LastSNTexts[0];
|
||||
checkBox1.Checked = !string.IsNullOrEmpty(comboBox1.Text);
|
||||
}
|
||||
if (WaterMetersCount >= 2)
|
||||
{
|
||||
comboBox2.Text = Program.LocalSettings.LastSNTexts[1];
|
||||
checkBox2.Checked = !string.IsNullOrEmpty(comboBox2.Text);
|
||||
}
|
||||
if (WaterMetersCount >= 3)
|
||||
{
|
||||
comboBox3.Text = Program.LocalSettings.LastSNTexts[2];
|
||||
checkBox3.Checked = !string.IsNullOrEmpty(comboBox3.Text);
|
||||
}
|
||||
if (WaterMetersCount >= 4)
|
||||
{
|
||||
comboBox4.Text = Program.LocalSettings.LastSNTexts[3];
|
||||
checkBox4.Checked = !string.IsNullOrEmpty(comboBox4.Text);
|
||||
}
|
||||
if (WaterMetersCount >= 5)
|
||||
{
|
||||
comboBox5.Text = Program.LocalSettings.LastSNTexts[4];
|
||||
checkBox5.Checked = !string.IsNullOrEmpty(comboBox5.Text);
|
||||
}
|
||||
if (WaterMetersCount >= 6)
|
||||
{
|
||||
comboBox6.Text = Program.LocalSettings.LastSNTexts[5];
|
||||
checkBox6.Checked = !string.IsNullOrEmpty(comboBox6.Text);
|
||||
}
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
comboBoxes[i].Text = Program.LocalSettings.LastSNTexts[i];
|
||||
checkBoxes[i].Checked = !string.IsNullOrEmpty(comboBoxes[i].Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBox1_TextChanged(object sender, EventArgs e) { checkBox1.Checked = true; }
|
||||
@@ -236,12 +239,11 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
|
||||
private void clearButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WaterMetersCount >= 1) { comboBox1.Text = string.Empty; checkBox1.Checked = false; }
|
||||
if (WaterMetersCount >= 2) { comboBox2.Text = string.Empty; checkBox2.Checked = false; }
|
||||
if (WaterMetersCount >= 3) { comboBox3.Text = string.Empty; checkBox3.Checked = false; }
|
||||
if (WaterMetersCount >= 4) { comboBox4.Text = string.Empty; checkBox4.Checked = false; }
|
||||
if (WaterMetersCount >= 5) { comboBox5.Text = string.Empty; checkBox5.Checked = false; }
|
||||
if (WaterMetersCount >= 6) { comboBox6.Text = string.Empty; checkBox6.Checked = false; }
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
comboBoxes[i].Text = string.Empty;
|
||||
checkBoxes[i].Checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -273,11 +275,13 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
/// <param name="currentFocusOwner">TextBox control which received the event</param>
|
||||
private void ProcKeyPress(object sender, KeyPressEventArgs e, ComboBox currentFocusOwner)
|
||||
{
|
||||
#if !CEVAK_200
|
||||
if (e.KeyChar == '+')
|
||||
{
|
||||
/// Process '+' key ..... Form completed
|
||||
okButton_Click(sender, e);
|
||||
}
|
||||
#endif
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
/// Process <enter> key ..... Next text field
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -123,13 +123,13 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
///
|
||||
void OpenBeginningDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleBeginningForm(myRef.waterMeters.Length);
|
||||
myRef.modelessDlg = new CycleBeginningForm(myRef.waterMeters.Length, (myRef.entryFormCfg.RemarkEnabled && !myRef.entryFormCfg.ShowCycleEndForm));
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenEndDlg(EntryFormNoStartEnd myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleEndForm(myRef.waterMeters.Length, entryFormCfg.RemarkEnabled);
|
||||
myRef.modelessDlg = new CycleEndForm(myRef.waterMeters.Length, myRef.entryFormCfg.RemarkEnabled);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
@@ -201,6 +201,10 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
{
|
||||
waterMeters[i].SerialNr = dlg.SNText[i];
|
||||
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
|
||||
if (dlg.RemarksEnabled)
|
||||
{
|
||||
waterMeters[i].Remark = dlg.Remark[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+54
-43
@@ -31,49 +31,59 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBeginningForm));
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.orderGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.orderComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.orderGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// orderGroupBox
|
||||
//
|
||||
this.orderGroupBox.Controls.Add(this.orderComboBox);
|
||||
resources.ApplyResources(this.orderGroupBox, "orderGroupBox");
|
||||
this.orderGroupBox.ForeColor = System.Drawing.Color.Black;
|
||||
this.orderGroupBox.Name = "orderGroupBox";
|
||||
this.orderGroupBox.TabStop = false;
|
||||
//
|
||||
// orderComboBox
|
||||
//
|
||||
this.orderComboBox.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.orderComboBox, "orderComboBox");
|
||||
this.orderComboBox.Name = "orderComboBox";
|
||||
//
|
||||
// CycleBeginningForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGoldenrod;
|
||||
this.Controls.Add(this.orderGroupBox);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.ForeColor = System.Drawing.Color.Black;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "CycleBeginningForm";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleBeginningForm_Load);
|
||||
this.orderGroupBox.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBeginningForm));
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.orderGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.orderComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.pictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.orderGroupBox.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// orderGroupBox
|
||||
//
|
||||
this.orderGroupBox.Controls.Add(this.orderComboBox);
|
||||
resources.ApplyResources(this.orderGroupBox, "orderGroupBox");
|
||||
this.orderGroupBox.ForeColor = System.Drawing.Color.Black;
|
||||
this.orderGroupBox.Name = "orderGroupBox";
|
||||
this.orderGroupBox.TabStop = false;
|
||||
//
|
||||
// orderComboBox
|
||||
//
|
||||
this.orderComboBox.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.orderComboBox, "orderComboBox");
|
||||
this.orderComboBox.Name = "orderComboBox";
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
resources.ApplyResources(this.pictureBox, "pictureBox");
|
||||
this.pictureBox.Name = "pictureBox";
|
||||
this.pictureBox.TabStop = false;
|
||||
//
|
||||
// CycleBeginningForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGoldenrod;
|
||||
this.Controls.Add(this.pictureBox);
|
||||
this.Controls.Add(this.orderGroupBox);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.ForeColor = System.Drawing.Color.Black;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "CycleBeginningForm";
|
||||
this.TopMost = true;
|
||||
this.Load += new System.EventHandler(this.CycleBeginningForm_Load);
|
||||
this.orderGroupBox.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
@@ -82,5 +92,6 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.GroupBox orderGroupBox;
|
||||
private System.Windows.Forms.ComboBox orderComboBox;
|
||||
private System.Windows.Forms.PictureBox pictureBox;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
using System.Drawing;
|
||||
|
||||
namespace TBF.BenchControl.DataEntry.iPerl
|
||||
{
|
||||
@@ -15,6 +16,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
|
||||
/// <summary> Number of water meters </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
public readonly bool reversedDirection;
|
||||
|
||||
/// To be retrieved after the form is closed
|
||||
public string PurchaseOrder;
|
||||
@@ -41,10 +43,11 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public CycleBeginningForm(int waterMetersCount)
|
||||
public CycleBeginningForm(int waterMetersCount, bool reversedDirection)
|
||||
: this()
|
||||
{
|
||||
this.WaterMetersCount = waterMetersCount;
|
||||
this.reversedDirection = reversedDirection;
|
||||
SNText = null;
|
||||
Disabled = null;
|
||||
}
|
||||
@@ -56,6 +59,14 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
orderGroupBox.Text = Strings.Purchase_order;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
PrepareOrderCombo(orderComboBox);
|
||||
if (reversedDirection)
|
||||
{
|
||||
pictureBox.Image = Image.FromFile(string.Format("{0}\\Pictures\\reversed_dir.jpg", Program.ExecutableDir, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
pictureBox.Image = Image.FromFile(string.Format("{0}\\Pictures\\forward_dir.jpg", Program.ExecutableDir, true));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -144,13 +144,13 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>okButton.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="orderComboBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>90, 31</value>
|
||||
<value>90, 32</value>
|
||||
</data>
|
||||
<data name="orderComboBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>376, 31</value>
|
||||
<value>432, 31</value>
|
||||
</data>
|
||||
<data name="orderComboBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
@@ -174,7 +174,7 @@
|
||||
<value>28, 12</value>
|
||||
</data>
|
||||
<data name="orderGroupBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>537, 82</value>
|
||||
<value>565, 82</value>
|
||||
</data>
|
||||
<data name="orderGroupBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
@@ -192,6 +192,27 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>orderGroupBox.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="pictureBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>28, 118</value>
|
||||
</data>
|
||||
<data name="pictureBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>711, 497</value>
|
||||
</data>
|
||||
<data name="pictureBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name=">>pictureBox.Name" xml:space="preserve">
|
||||
<value>pictureBox</value>
|
||||
</data>
|
||||
<data name=">>pictureBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>pictureBox.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>pictureBox.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
@@ -204,7 +225,7 @@
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>801, 119</value>
|
||||
<value>769, 639</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>Batch data</value>
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
///
|
||||
void OpenBeginningDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount);
|
||||
myRef.modelessDlg = new CycleBeginningForm(Config.Data.WMsCount, myRef.entryFormCfg.ReversedDirection);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -20,6 +20,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
/// Serialized parameters
|
||||
///
|
||||
public bool ShowCycleEndForm;
|
||||
public bool ReversedDirection;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
EntryFormCfg()
|
||||
@@ -27,6 +28,8 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
Name = "DataEntry-iPerl";
|
||||
ParentName = string.Empty;
|
||||
ShowCycleEndForm = false;
|
||||
ReversedDirection = false;
|
||||
|
||||
}
|
||||
|
||||
public EntryFormCfg(IComponentFactory factory)
|
||||
@@ -37,7 +40,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, ShowEndForm={1}", Name, ShowCycleEndForm);
|
||||
return string.Format("Name={0}, ShowEndForm={1}, ReversedDir={2}", Name, ShowCycleEndForm, ReversedDirection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
@@ -50,12 +50,14 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
showCycleEndFormCheckBox.Checked = config.ShowCycleEndForm;
|
||||
reversedIperlDirectionCheckBox.Checked = config.ReversedDirection;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
showCycleEndFormCheckBox.Enabled = true;
|
||||
reversedIperlDirectionCheckBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
@@ -72,6 +74,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.ShowCycleEndForm = showCycleEndFormCheckBox.Checked;
|
||||
config.ReversedDirection = reversedIperlDirectionCheckBox.Checked;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
+70
-56
@@ -31,62 +31,75 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
/// </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.showCycleEndFormCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(131, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(32, 60);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(128, 32);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// showCycleEndFormCheckBox
|
||||
//
|
||||
this.showCycleEndFormCheckBox.AutoSize = true;
|
||||
this.showCycleEndFormCheckBox.Enabled = false;
|
||||
this.showCycleEndFormCheckBox.Location = new System.Drawing.Point(131, 90);
|
||||
this.showCycleEndFormCheckBox.Name = "showCycleEndFormCheckBox";
|
||||
this.showCycleEndFormCheckBox.Size = new System.Drawing.Size(125, 17);
|
||||
this.showCycleEndFormCheckBox.TabIndex = 13;
|
||||
this.showCycleEndFormCheckBox.Text = "Show cycle end form";
|
||||
this.showCycleEndFormCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// EntryFormCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.showCycleEndFormCheckBox);
|
||||
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.showCycleEndFormCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.reversedIperlDirectionCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(131, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(32, 60);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(128, 32);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// showCycleEndFormCheckBox
|
||||
//
|
||||
this.showCycleEndFormCheckBox.AutoSize = true;
|
||||
this.showCycleEndFormCheckBox.Enabled = false;
|
||||
this.showCycleEndFormCheckBox.Location = new System.Drawing.Point(131, 90);
|
||||
this.showCycleEndFormCheckBox.Name = "showCycleEndFormCheckBox";
|
||||
this.showCycleEndFormCheckBox.Size = new System.Drawing.Size(125, 17);
|
||||
this.showCycleEndFormCheckBox.TabIndex = 13;
|
||||
this.showCycleEndFormCheckBox.Text = "Show cycle end form";
|
||||
this.showCycleEndFormCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// reversedIperlDirectionCheckBox
|
||||
//
|
||||
this.reversedIperlDirectionCheckBox.AutoSize = true;
|
||||
this.reversedIperlDirectionCheckBox.Enabled = false;
|
||||
this.reversedIperlDirectionCheckBox.Location = new System.Drawing.Point(131, 113);
|
||||
this.reversedIperlDirectionCheckBox.Name = "reversedIperlDirectionCheckBox";
|
||||
this.reversedIperlDirectionCheckBox.Size = new System.Drawing.Size(158, 17);
|
||||
this.reversedIperlDirectionCheckBox.TabIndex = 14;
|
||||
this.reversedIperlDirectionCheckBox.Text = "Reversed direction of iPerl-s";
|
||||
this.reversedIperlDirectionCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// EntryFormCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.reversedIperlDirectionCheckBox);
|
||||
this.Controls.Add(this.showCycleEndFormCheckBox);
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
@@ -96,5 +109,6 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.CheckBox showCycleEndFormCheckBox;
|
||||
private System.Windows.Forms.CheckBox reversedIperlDirectionCheckBox;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.Dummy.Balance
|
||||
{
|
||||
public class Component : ComponentBase, GenericDevices.IScale, IOperation
|
||||
public class Component : ComponentBase, IScale, IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString()
|
||||
@@ -28,8 +29,9 @@ namespace TBF.BenchControl.Dummy.Balance
|
||||
|
||||
public int ScaleNr { get { return 0; } }
|
||||
public double Capacity { get { return 10000.0; } }
|
||||
public GenericDevices.IValve DrainValve { get { return null; } }
|
||||
public bool IsEmpty(double mass) { return true; }
|
||||
public IValve DrainValve { get { return null; } }
|
||||
public IValve DrainValve2 { get { return null; } }
|
||||
public bool ContainsMoreThen(float thld) { return (thld == 0); }
|
||||
public bool IsEmpty() { return true; }
|
||||
public string Format { get { return "F3"; } }
|
||||
public int EmptyTimeSec { get { return 5; } }
|
||||
|
||||
@@ -221,19 +221,31 @@ namespace TBF.BenchControl.Elde
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void UpdateWeights()
|
||||
{
|
||||
/// Mettler-Toledo scales
|
||||
for (int i = 0; i < MettlerToledo.Standard.BalanceDev.BalancesCount; i++)
|
||||
{
|
||||
controlCom.SetWeight(i, MettlerToledo.Standard.BalanceDev.Masses[i]);
|
||||
}
|
||||
|
||||
/// Mettler-Toledo-multi scales (Badger Brno, ...)
|
||||
for (int i = 0; i < MettlerToledo.Multi.BalanceDev.BalancesCount; i++)
|
||||
{
|
||||
controlCom.SetWeight(i, MettlerToledo.Multi.BalanceDev.Masses[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/// Tanks (CEVAK, ...)
|
||||
int firstTankIx = Math.Max(MettlerToledo.Standard.BalanceDev.BalancesCount, MettlerToledo.Multi.BalanceDev.BalancesCount);
|
||||
|
||||
for (int i = 0; i < Various.TankWithLevelMsrmnt.Tank.TanksCount; i++)
|
||||
{
|
||||
controlCom.SetWeight(firstTankIx + i, Various.TankWithLevelMsrmnt.Tank.Tanks[i].Volume);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetReservoirTemp(int nr, float temp)
|
||||
{
|
||||
controlCom.SetReservoirTemp(nr, temp);
|
||||
@@ -434,6 +446,8 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
if (DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
UpdateWeights();
|
||||
|
||||
uint[] uintFilters = new uint[8];
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@@ -664,15 +678,5 @@ namespace TBF.BenchControl.Elde
|
||||
{
|
||||
return new ExecuteCommandOp(this, commandOnStartOp, commandOnStopOp, testMethod);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the tank drawing and weight value in Elde software component.
|
||||
/// </summary>
|
||||
/// <param name="weight">Current mass in [kg] or approx. volume in [l]</param>
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation UpdateTankWeightOp()
|
||||
{
|
||||
return new UpdateTankWeightOp(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
public int EtPulses(int wmNr1) { return (int)ctrlBrdComponent.etPulses[wmNr1]; }
|
||||
|
||||
#if GENESIS || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
|
||||
public int EtPulsesK { get { return (int)ctrlBrdComponent.etPulsesK; } }
|
||||
#else
|
||||
#if DN100 || MUNICH || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40 || PUCHONG_200 || MALTA_WSD25
|
||||
public int EtPulsesK { get { return 1; } }
|
||||
#else /// all new benches
|
||||
public int EtPulsesK { get { return (int)ctrlBrdComponent.etPulsesK; } }
|
||||
#endif
|
||||
|
||||
public UInt16 WMeterPulses(int wmNr1) { return (UInt16)ctrlBrdComponent.wMeterPuls[wmNr1]; }
|
||||
|
||||
@@ -105,6 +105,8 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
flowMtrNr4Cmd = ((divNrFromName % 10) == 1) ? 0x11 : (((divNrFromName % 10) == 2) ? 0x22 : 0x33);
|
||||
#elif FUZHOU_100
|
||||
flowMtrNr4Cmd = divNrFromName;
|
||||
#elif CEVAK_200
|
||||
flowMtrNr4Cmd = (divNrFromName == 4) ? 5 : divNrFromName;
|
||||
#else
|
||||
flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : 3;
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,7 @@ using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Elde.FlowMeter
|
||||
{
|
||||
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibInfoCfg, IChildComponentCfg
|
||||
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibRangesCfg, IChildComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FlowMeterCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -134,6 +134,7 @@ namespace TBF.BenchControl.Elde.RegisterReader
|
||||
public void Stop()
|
||||
{
|
||||
log.DebugFormat("{0}:Stop()", Name);
|
||||
}
|
||||
ReadPulses();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
readonly IFlowMeter flowMeter;
|
||||
readonly float requiredFlowLo;
|
||||
readonly float requiredFlowHi;
|
||||
readonly float requiredFlowAve;
|
||||
readonly float reqFlowAve;
|
||||
readonly float pidCoef;
|
||||
readonly int timeout;
|
||||
readonly bool leaveMeasurementRunning;
|
||||
@@ -92,9 +92,9 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
|
||||
nominalFlow = flowMeter.NominalFlow;
|
||||
|
||||
this.requiredFlowLo = requiredFlowLo;
|
||||
this.requiredFlowHi = requiredFlowHi;
|
||||
this.requiredFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
|
||||
this.requiredFlowLo = (0.7F * requiredFlowLo) + (0.3F * this.reqFlowAve); /// Move the lower limit 15% of the range up
|
||||
this.requiredFlowHi = (0.7F * requiredFlowHi) + (0.3F * this.reqFlowAve); /// Move the upper limit 15% of the range down
|
||||
this.pidCoef = pidCoef;
|
||||
|
||||
if (flowBox == null) throw new ArgumentNullException("flowBox");
|
||||
@@ -155,7 +155,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
|
||||
void StoreTargetPosition(float avgReqFlow, float actPosition)
|
||||
{
|
||||
if (!regulValve.Dict.ContainsKey(requiredFlowAve))
|
||||
if (!regulValve.Dict.ContainsKey(reqFlowAve))
|
||||
{
|
||||
regulValve.Dict.Add(new KeyValuePair<float, float>(avgReqFlow, actPosition));
|
||||
}
|
||||
@@ -173,13 +173,13 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
if (flow != 0)
|
||||
{
|
||||
flowBox.Val = flow;
|
||||
if (flow >= requiredFlowAve) currentReqFlowHi = requiredFlowAve; /// Decrease upper limit
|
||||
if (flow <= requiredFlowAve) currentReqFlowLo = requiredFlowAve; /// Increase lower limit
|
||||
if (flow >= reqFlowAve) currentReqFlowHi = reqFlowAve; /// Decrease upper limit
|
||||
if (flow <= reqFlowAve) currentReqFlowLo = reqFlowAve; /// Increase lower limit
|
||||
}
|
||||
|
||||
flowWithinBoundsTime = 0;
|
||||
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(requiredFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(reqFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
{
|
||||
log.InfoFormat("SetFlowOp:Start() rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
|
||||
regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
|
||||
@@ -231,7 +231,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
{
|
||||
flowWithinBoundsTime = 0;
|
||||
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(requiredFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(reqFlowAve, out targetPositionLo, out targetPositionHi))
|
||||
{
|
||||
log.InfoFormat("Run(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
|
||||
regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
|
||||
@@ -396,19 +396,19 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
if (regulValve.RegulValveCfg.StoredPositionReuse)
|
||||
{
|
||||
float storedPosition;
|
||||
if (regulValve.Dict.TryGetValue(requiredFlowAve, out storedPosition))
|
||||
if (regulValve.Dict.TryGetValue(reqFlowAve, out storedPosition))
|
||||
{
|
||||
/// update the stored valve position
|
||||
StoreTargetPosition(requiredFlowAve, (rvPosition + storedPosition) / 2.0f);
|
||||
StoreTargetPosition(reqFlowAve, (rvPosition + storedPosition) / 2.0f);
|
||||
log.InfoFormat("Run(): rv#={0} reqFlow={1} pos={2}% stored={3} <--- Updating a stored position",
|
||||
regulValveNr, requiredFlowAve, rvPosition.ToString("F1"), storedPosition);
|
||||
regulValveNr, reqFlowAve, rvPosition.ToString("F1"), storedPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// store the valve position
|
||||
StoreTargetPosition(requiredFlowAve, rvPosition);
|
||||
StoreTargetPosition(reqFlowAve, rvPosition);
|
||||
log.InfoFormat("Run(): rv#={0} reqFlow={1} pos={2}% <--- Storing a new position",
|
||||
regulValveNr, requiredFlowAve, rvPosition.ToString("F1"));
|
||||
regulValveNr, reqFlowAve, rvPosition.ToString("F1"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,9 +102,9 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||
|
||||
nominalFlow = flowMeter.NominalFlow;
|
||||
|
||||
this.finalReqFlowLo = requiredFlowLo;
|
||||
this.finalReqFlowHi = requiredFlowHi;
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2;
|
||||
this.finalReqFlowLo = (0.7F * requiredFlowLo) + (0.3F * this.reqFlowAve); /// Move the lower limit 15% of the range up
|
||||
this.finalReqFlowHi = (0.7F * requiredFlowHi) + (0.3F * this.reqFlowAve); /// Move the upper limit 15% of the range down
|
||||
this.pidCoef = pidCoef;
|
||||
this.measuredFlow = measuredFlow;
|
||||
this.reTryCommands = reTryCmds;
|
||||
|
||||
@@ -108,10 +108,10 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
|
||||
nominalFlow = flowMeter.NominalFlow;
|
||||
|
||||
this.finalReqFlowLo = requiredFlowLo;
|
||||
this.finalReqFlowHi = requiredFlowHi;
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
|
||||
this.pidCoef = pidCoef;
|
||||
this.finalReqFlowLo = (0.7F * requiredFlowLo) + (0.3F * this.reqFlowAve); /// Move the lower limit 15% of the range up
|
||||
this.finalReqFlowHi = (0.7F * requiredFlowHi) + (0.3F * this.reqFlowAve); /// Move the upper limit 15% of the range down
|
||||
this.pidCoef = pidCoef;
|
||||
this.measuredFlow = measuredFlow;
|
||||
|
||||
this.timeout = timeout;
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.Elde
|
||||
{
|
||||
public class UpdateTankWeightOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(UpdateTankWeightOp));
|
||||
public override string ToString() { return string.Format("UpdateTankWeightOp(.)"); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
|
||||
/// <summary>
|
||||
/// Stop the previous control board operation (diverter, gate, etc.)
|
||||
/// Events: None or PreviousStopped
|
||||
/// </summary>
|
||||
/// <param name="controlBoardDev">Control board component reference</param>
|
||||
public UpdateTankWeightOp(ControlBoardDev controlBoardDev)
|
||||
{
|
||||
if (controlBoardDev == null) throw new ArgumentNullException("controlBoardDev");
|
||||
this.controlBoard = controlBoardDev;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
controlBoard.UpdateWeights();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.None or Event.PreviousStopped
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
controlBoard.UpdateWeights();
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,18 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface ICalibInfoCfg : IComponentCfg
|
||||
{
|
||||
public interface ICalibInfoCfg : IComponentCfg
|
||||
{
|
||||
///
|
||||
/// Access to parameters displayed in Metrology tab page
|
||||
/// Parameters displayed in Metrology tab page
|
||||
///
|
||||
|
||||
bool RangeEnabled(int rangeIx1);
|
||||
|
||||
double GetTempLo(int rangeIx1);
|
||||
double GetTempHi(int rangeIx1);
|
||||
double GetPressLo(int rangeIx1);
|
||||
double GetPressHi(int rangeIx1);
|
||||
|
||||
string GetCalibCertificate(int rangeIx1); /// Get calibration certificate number
|
||||
DateTime GetCalibDate(int rangeIx1); /// Get the date of calibration
|
||||
DateTime GetCalibValidDate(int rangeIx1); /// Get calibration valid until (date)
|
||||
|
||||
void SetCalibCertificate(int rangeIx1, string certificate); /// Set calibration certificate number
|
||||
void SetCalibDate(int rangeIx1, DateTime date); /// Get the date of calibration
|
||||
void SetCalibValidDate(int rangeIx1, DateTime date); /// Get calibration valid until (date)
|
||||
string CalibCertificateNr { get; set; } /// calibration certificate number
|
||||
DateTime CalibDate { get; set; } /// date of calibration
|
||||
DateTime CalibValidDate { get; set; } /// calibration valid until (date)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface ICalibRangesCfg : IComponentCfg
|
||||
{
|
||||
///
|
||||
/// Access to parameters displayed in Metrology tab page
|
||||
///
|
||||
|
||||
bool RangeEnabled(int rangeIx1);
|
||||
|
||||
double GetTempLo(int rangeIx1);
|
||||
double GetTempHi(int rangeIx1);
|
||||
double GetPressLo(int rangeIx1);
|
||||
double GetPressHi(int rangeIx1);
|
||||
|
||||
string GetCalibCertificate(int rangeIx1); /// Get calibration certificate number
|
||||
DateTime GetCalibDate(int rangeIx1); /// Get the date of calibration
|
||||
DateTime GetCalibValidDate(int rangeIx1); /// Get calibration valid until (date)
|
||||
|
||||
void SetCalibCertificate(int rangeIx1, string certificate); /// Set calibration certificate number
|
||||
void SetCalibDate(int rangeIx1, DateTime date); /// Get the date of calibration
|
||||
void SetCalibValidDate(int rangeIx1, DateTime date); /// Get calibration valid until (date)
|
||||
}
|
||||
}
|
||||
@@ -15,16 +15,7 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// They are calculated inside this function as required by Modbus specification.
|
||||
/// </summary>
|
||||
/// <param name="message">Message incl CRC fields, CRC bytes dont have to be set</param>
|
||||
void SendMessage(byte[] message);
|
||||
|
||||
/// <summary>
|
||||
/// Send a structured modbus message.
|
||||
/// </summary>
|
||||
/// <param name="modbusAddress">Device address (1..255) or 0 = broadcast</param>
|
||||
/// <param name="function">Function (0..127)</param>
|
||||
/// <param name="dataAddress">Address of data to be transferred (0..65535)</param>
|
||||
/// <param name="dataCount">Count of data bytes to be transferred (0..65535)</param>
|
||||
void SendMessage(byte modbusAddress, byte function, ushort dataAddress, ushort dataCount);
|
||||
void SendMessage(int preambLen, byte[] message);
|
||||
|
||||
Queue<byte[]>[] ReceivedTelegrams { get; }
|
||||
}
|
||||
|
||||
@@ -20,18 +20,22 @@ namespace TBF.BenchControl.GenericDevices
|
||||
IList<MeasurementCorrection> Corrections { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: LevelDone, Error
|
||||
/// Continuosly measured level in mm (last measured level in case of ManualLevelMsrmnt)
|
||||
/// </summary>
|
||||
double Level { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: Busy, LevelDone, Error
|
||||
/// </summary>
|
||||
/// <param name="level">Reference to a variable for the measured level in mm</param>
|
||||
/// <returns>ReadLevelOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadLevelOp(ref DoubleBox level);
|
||||
|
||||
/// <summary>
|
||||
/// Events: levelDone, Error
|
||||
/// Events: Busy, LevelDone, Error
|
||||
/// </summary>
|
||||
/// <param name="level">Reference to a variable for the measured level in mm</param>
|
||||
/// <param name="levelDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadLevelOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadLevelOp(ref DoubleBox level, Event levelDone);
|
||||
IOperation ReadStableLevelOp(ref DoubleBox level, double sdev);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,61 +1,19 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
/// <summary>
|
||||
/// Basic balance functions
|
||||
/// Scale with a water tank functions
|
||||
/// </summary>
|
||||
public interface IScale : IComponent
|
||||
public interface IScale : IScaleOrTank
|
||||
{
|
||||
/// <summary>
|
||||
/// Balance number: 0-based index required for communication with the Elde component
|
||||
/// </summary>
|
||||
int ScaleNr { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Balance water tank capacity in kg or ltr
|
||||
/// </summary>
|
||||
double Capacity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Water tank drain valve or 'null'
|
||||
/// </summary>
|
||||
IValve DrainValve { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if tank s empty, mass is less then some threshold
|
||||
/// </summary>
|
||||
bool IsEmpty(double mass);
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if tank s empty, the last measured mass is less then some threshold
|
||||
/// </summary>
|
||||
bool IsEmpty();
|
||||
|
||||
/// <summary>
|
||||
/// Format string to be used as ToString() argument (e.g. "F3" to obtain resolution 1g)
|
||||
/// </summary>
|
||||
string Format { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time in seconds to empty the tank completely when it is full
|
||||
/// </summary>
|
||||
int EmptyTimeSec { get; }
|
||||
|
||||
float BuoyancyTemp { get; } ///
|
||||
float BuoyancyPress { get; } /// Displayed in Metrology tab page
|
||||
float BuoyancyHumi { get; } ///
|
||||
|
||||
/// <summary>
|
||||
/// Measurement correction table
|
||||
/// </summary>
|
||||
IList<Config.Entities.MeasurementCorrection> Corrections { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
|
||||
@@ -6,7 +6,7 @@ using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IScaleCfg : IComponentCfg
|
||||
public interface IScaleCfg : ICalibInfoCfg
|
||||
{
|
||||
///
|
||||
/// Parameters displayed in Metrology tab page
|
||||
@@ -14,11 +14,7 @@ namespace TBF.BenchControl.GenericDevices
|
||||
float BuoyancyTemp { get; set; } /// ambient temperature in [degree C]
|
||||
float BuoyancyPress { get; set; } /// ambient pressure in [100000 Pa]
|
||||
float BuoyancyHumi { get; set; } /// ambient relative humidity in [%]
|
||||
float WeightStandardDensity { get; set; } /// density of the weight standard used to calibrate the scale [kg/m3]
|
||||
|
||||
string CalibCertificateNr { get; set; } /// calibration certificate number
|
||||
DateTime CalibDate { get; set; } /// date of calibration
|
||||
DateTime CalibValidDate { get; set; } /// calibration valid until (date)
|
||||
float WeightStandardDensity { get; set; } /// density of the weight standard used to calibrate the scale [kg/m3]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
/// <summary>
|
||||
/// Water tank functions (either on a scale or with height/volume measurement)
|
||||
/// </summary>
|
||||
public interface IScaleOrTank : IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Balance number: 0-based index required for communication with the Elde component
|
||||
/// </summary>
|
||||
int ScaleNr { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Balance water tank capacity in kg or ltr
|
||||
/// </summary>
|
||||
double Capacity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Water tank drain valve or 'null'. DrainValve2 is open in the 2nd half of drain time period
|
||||
/// </summary>
|
||||
IValve DrainValve { get; }
|
||||
IValve DrainValve2 { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if tank is empty, the last measured mass is less then some threshold
|
||||
/// </summary>
|
||||
bool IsEmpty();
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if tank contains more then 'thld' kg or l of water
|
||||
/// </summary>
|
||||
bool ContainsMoreThen(float thld);
|
||||
|
||||
/// <summary>
|
||||
/// Format string to be used as ToString() argument (e.g. "F3" to obtain resolution 1g)
|
||||
/// </summary>
|
||||
string Format { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Time in seconds to empty the tank completely when it is full
|
||||
/// </summary>
|
||||
int EmptyTimeSec { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Measurement correction table
|
||||
/// </summary>
|
||||
IList<Config.Entities.MeasurementCorrection> Corrections { get; }
|
||||
}
|
||||
}
|
||||
@@ -12,5 +12,6 @@ namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
IValve DrainValve { get; }
|
||||
bool IsEmpty();
|
||||
bool ContainsMoreThen(float thld);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,11 +24,17 @@ namespace TBF.BenchControl.GenericDevices
|
||||
IOperation ReadVolumeOp(ref DoubleBox volume);
|
||||
|
||||
/// <summary>
|
||||
/// Events: volumeDone, Error
|
||||
/// Events: VolumeDone, Error
|
||||
/// </summary>
|
||||
/// <param name="volume">Reference to a variable for the measured volume in l</param>
|
||||
/// <param name="volumeDone">Event returned when measurement done</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
IOperation ReadVolumeOp(ref DoubleBox volume, Event volumeDone);
|
||||
IOperation ReadStableVolumeOp(ref DoubleBox volume, double sdev);
|
||||
|
||||
/// <summary>
|
||||
/// Events: VolumeDone, Error
|
||||
/// </summary>
|
||||
/// <param name="volume">Reference to a variable for the measured volume in l</param>
|
||||
/// <returns>ReadPressureOp instance reference casted to IOperaton</returns>
|
||||
IOperation ManualReadVolumeOp(ref DoubleBox volume);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.Hart.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// HART start bytes
|
||||
/// </summary>
|
||||
public enum Mark : byte
|
||||
{
|
||||
ShortFrameMaster2Slave = 0x02,
|
||||
ShortFrameSlave2Master = 0x06,
|
||||
LongFrameMaster2Slave = 0x82,
|
||||
LongFrameSlave2Master = 0x86,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HART master addresses
|
||||
/// </summary>
|
||||
public enum Master : byte
|
||||
{
|
||||
Secondary = 0,
|
||||
Primary = 0x80,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HART commands
|
||||
/// </summary>
|
||||
public enum Cmd : byte
|
||||
{
|
||||
ReadUniqueID = 0,
|
||||
ReadPrimaryVar = 1,
|
||||
}
|
||||
}
|
||||
@@ -16,39 +16,49 @@ using TBF.Boxes;
|
||||
namespace TBF.BenchControl.Hart.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Root component for Modbus communication via serial port (RS485)
|
||||
/// Root component for HART communication via a modem connected to a serial port (RS232)
|
||||
/// </summary>
|
||||
public class Hart : ComponentBase, IDevice, GenericDevices.IModbus
|
||||
public class Hart : ComponentBase, IDevice, GenericDevices.IHart
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Hart));
|
||||
public override string ToString() { return string.Format("Modbus({0})", Cfg.ToString(1)); }
|
||||
|
||||
private readonly HartCfg modbusCommonCfg;
|
||||
private readonly HartCfg hartCfg;
|
||||
|
||||
/// Private fields
|
||||
SerialPort serialPort;
|
||||
DateTime lastSerialPortWrite;
|
||||
|
||||
/// <summary>
|
||||
/// An array of Queue-s of received telegrams fetched by HART components (as Nivotrack).
|
||||
/// There is one queue for each device (each slave address).
|
||||
/// </summary>
|
||||
public Queue<byte[]>[] ReceivedTelegrams
|
||||
{
|
||||
get { return receivedTelegrams; }
|
||||
}
|
||||
Queue<byte[]>[] receivedTelegrams;
|
||||
|
||||
/// <summary>
|
||||
/// A Queue of telegrams to send. System prevents sending more then one telegram per 500ms.
|
||||
/// Function SendMessage( ) either send the telegram immediately using SendMessageNow( ) or
|
||||
/// inserts the telegram into telegramsToSend queue. The queue is emptied in RunDeviceAfter( ).
|
||||
/// </summary>
|
||||
Queue<byte[]> telegramsToSend;
|
||||
|
||||
|
||||
public Hart()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
|
||||
/// Connection settings: 19200 Bd 8-bits No-parity 1-stop-bit Flow control: none or hardware.
|
||||
/// HART modem connected via serial interface (RS232).
|
||||
/// Connection settings: 1200 Bd 8-bits odd-parity 1-stop-bit Flow control: none or hardware.
|
||||
/// </summary>
|
||||
public Hart(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
receivedTelegrams = new Queue<byte[]>[256];
|
||||
receivedTelegrams = new Queue<byte[]>[16]; /// Max. 16 slaves with adresses 0..15
|
||||
for (int i = 0; i < receivedTelegrams.Length; i++)
|
||||
{
|
||||
receivedTelegrams[i] = new Queue<byte[]>();
|
||||
@@ -56,7 +66,7 @@ namespace TBF.BenchControl.Hart.Common
|
||||
telegramsToSend = new Queue<byte[]>();
|
||||
|
||||
serialPort = null;
|
||||
modbusCommonCfg = cfg as HartCfg;
|
||||
hartCfg = cfg as HartCfg;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
@@ -64,27 +74,62 @@ namespace TBF.BenchControl.Hart.Common
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
if (modbusCommonCfg.DebugLevel == DebugMode.Simulate)
|
||||
if (hartCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
serialPort = null;
|
||||
log.FatalFormat("{0} - Device simulated", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
string comPortName = "COM" + modbusCommonCfg.ComPortNr.ToString();
|
||||
serialPort = new SerialPort(comPortName, modbusCommonCfg.BaudRate, modbusCommonCfg.Parity, modbusCommonCfg.DataBits, modbusCommonCfg.StopBits);
|
||||
serialPort.Handshake = modbusCommonCfg.Handshake;
|
||||
string comPortName = "COM" + hartCfg.ComPortNr.ToString();
|
||||
serialPort = new SerialPort(comPortName, hartCfg.BaudRate, hartCfg.Parity, hartCfg.DataBits, hartCfg.StopBits);
|
||||
serialPort.Handshake = hartCfg.Handshake;
|
||||
serialPort.Open();
|
||||
|
||||
//stopWorkerThread = false;
|
||||
//workerThread = new Thread(Worker);
|
||||
//workerThread.Start();
|
||||
|
||||
log.FatalFormat("{0} - Device successfully initialized", Name);
|
||||
}
|
||||
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (serialPort != null)
|
||||
{
|
||||
ParseReceivedData();
|
||||
}
|
||||
}
|
||||
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if ((serialPort != null) && (telegramsToSend.Count > 0) && (DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 500))
|
||||
{
|
||||
SendMessageNow(telegramsToSend.Dequeue());
|
||||
}
|
||||
}
|
||||
|
||||
public void StopDevice()
|
||||
{
|
||||
if (serialPort != null)
|
||||
{
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void StopDevice2() { }
|
||||
|
||||
|
||||
|
||||
public void SendMessageNow(byte[] message)
|
||||
{
|
||||
serialPort.Write(message, 0, message.Length);
|
||||
lastSerialPortWrite = DateTime.Now;
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Sending message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send an arbitrary modbus message.
|
||||
@@ -92,21 +137,25 @@ namespace TBF.BenchControl.Hart.Common
|
||||
/// The last two message bytes (CRC) may be uninitialized or zero.
|
||||
/// They are calculated inside this function as required by Modbus specification.
|
||||
/// </summary>
|
||||
/// <param name="message">Message incl CRC fields, CRC bytes dont have to be set</param>
|
||||
public void SendMessage(byte[] message)
|
||||
/// <param name="message">Message incl. a reserved checksum byte, checksum does not have to be set</param>
|
||||
public void SendMessage(int preambLen, byte[] message)
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
Telegram.UpdateTelegramCRC(message);
|
||||
Telegram.UpdateTelegramChecksum(message);
|
||||
byte[] preambAndMessage = new byte[message.Length + preambLen];
|
||||
|
||||
if ((DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 100))
|
||||
for (int i = 0; i < preambLen; i++) preambAndMessage[i] = (byte)0xFF;
|
||||
for (int i = preambLen; i < preambLen + message.Length; i++) preambAndMessage[i] = message[i - preambLen];
|
||||
|
||||
if ((DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 500))
|
||||
{
|
||||
/// More then 100 ms since last 'send' --> do not enqueue the message
|
||||
SendMessageNow(message);
|
||||
SendMessageNow(preambAndMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
telegramsToSend.Enqueue(message);
|
||||
telegramsToSend.Enqueue(preambAndMessage);
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Enqueueing message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
@@ -114,98 +163,61 @@ namespace TBF.BenchControl.Hart.Common
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send a structured modbus message.
|
||||
/// </summary>
|
||||
/// <param name="modbusAddress">Device address (1..255) or 0 = broadcast</param>
|
||||
/// <param name="function">Function (0..127)</param>
|
||||
/// <param name="dataAddress">Address of data to be transferred (0..65535)</param>
|
||||
/// <param name="dataCount">Count of data bytes to be transferred (0..65535)</param>
|
||||
public void SendMessage(byte modbusAddress, byte function, ushort dataAddress, ushort dataCount)
|
||||
void ParseReceivedData()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
byte[] message = new byte[8]
|
||||
{
|
||||
modbusAddress,
|
||||
function,
|
||||
(byte)(dataAddress / 256),
|
||||
(byte)(dataAddress % 256),
|
||||
(byte)(dataCount / 256),
|
||||
(byte)(dataCount % 256),
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
public void SendMessageNow(byte[] message)
|
||||
{
|
||||
serialPort.Write(message, 0, message.Length);
|
||||
lastSerialPortWrite = DateTime.Now;
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Sending message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
int nrBytes = serialPort.BytesToRead;
|
||||
if (nrBytes > 0)
|
||||
{
|
||||
byte[] buffer = new byte[nrBytes];
|
||||
serialPort.Read(buffer, 0, nrBytes);
|
||||
/// Read available data
|
||||
byte[] buf = new byte[nrBytes];
|
||||
serialPort.Read(buf, 0, nrBytes);
|
||||
|
||||
int deviceAddress = (nrBytes >= 1) ? buffer[0] : 0;
|
||||
int function = (nrBytes >= 2) ? buffer[1] : 0;
|
||||
|
||||
if ((nrBytes >= 4) && Telegram.VerifyTelegramCRC(buffer))
|
||||
/// Determine count of leading FF-s
|
||||
int preambLen = 0;
|
||||
for (int i = 0; i < nrBytes; i++)
|
||||
{
|
||||
receivedTelegrams[deviceAddress].Enqueue(buffer);
|
||||
if (buf[i] != (byte)0xFF) break;
|
||||
preambLen++;
|
||||
}
|
||||
|
||||
string s = string.Format("{0} - {1} address={2} count={3}", Name, Telegram.LogTelegram("Telegram received: ", buffer), deviceAddress, receivedTelegrams[deviceAddress].Count);
|
||||
int telegramLen = nrBytes - preambLen;
|
||||
|
||||
/// Check a telegram length, a checksum, a start byte (S -> M) and a master address (primary)
|
||||
if (preambLen < 3 ||
|
||||
telegramLen < 4 ||
|
||||
!Telegram.VerifyTelegramChecksum(preambLen, buf) ||
|
||||
((buf[preambLen] != (byte)Mark.ShortFrameSlave2Master) && (buf[preambLen] != (byte)Mark.LongFrameSlave2Master)) ||
|
||||
((buf[preambLen + 1] & 0x80) != (byte)Master.Primary))
|
||||
{
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Invalid data received ", Name), buf);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
return;
|
||||
}
|
||||
|
||||
/// Strip the preamble
|
||||
byte[] data = new byte[telegramLen];
|
||||
for (int i = preambLen; i < nrBytes; i++) data[i - preambLen] = buf[i];
|
||||
|
||||
bool isShortFrame = (data[0] == 0x06);
|
||||
|
||||
if (isShortFrame)
|
||||
{
|
||||
int address = data[1] & 0x0F;
|
||||
receivedTelegrams[address].Enqueue(data);
|
||||
|
||||
string s = string.Format("{0} - {1} address={2} preambLen={3} count={4}", Name, Telegram.LogTelegram("Valid telegram received: ", data), address, preambLen, receivedTelegrams[address].Count);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Invalid data received ", Name), buffer);
|
||||
/// TODO
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Telegram with long address received ", Name), buf);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
if (telegramsToSend.Count > 0 && (DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 500))
|
||||
{
|
||||
SendMessageNow(telegramsToSend.Dequeue());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (serialPort != null)
|
||||
{
|
||||
//stopWorkerThread = true;
|
||||
//workerThread.Join(2000);
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void StopDevice2() { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,9 +56,9 @@ namespace TBF.BenchControl.Hart.Common
|
||||
public void InitializeAll()
|
||||
{
|
||||
ComPortNr = 3;
|
||||
BaudRate = 9600;
|
||||
BaudRate = 1200;
|
||||
DataBits = 8;
|
||||
Parity = System.IO.Ports.Parity.None;
|
||||
Parity = System.IO.Ports.Parity.Odd;
|
||||
StopBits = System.IO.Ports.StopBits.One;
|
||||
Handshake = System.IO.Ports.Handshake.None;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
|
||||
public IComponent DummyComponent() { return new Nivotrack(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Nivotrack(cfg); }
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Nivotrack(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new NivotrackCfg(this.GetType().Namespace.Substring(17), this); }
|
||||
|
||||
|
||||
@@ -3,39 +3,51 @@
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO.Ports;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Config.Entities;
|
||||
using log4net;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
using TBF.BenchControl.Hart.Common;
|
||||
|
||||
namespace TBF.BenchControl.Hart.Nivotrack
|
||||
{
|
||||
/// <summary>
|
||||
/// Root component for Modbus communication via serial port (RS485)
|
||||
/// </summary>
|
||||
public class Nivotrack : ComponentBase, IDevice, GenericDevices.IHart
|
||||
public class Nivotrack : ComponentBase, IDevice, ILevelMeter, IOperation
|
||||
{
|
||||
const int StableReadingsCount = 9;
|
||||
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Nivotrack));
|
||||
public override string ToString() { return string.Format("Modbus({0})", Cfg.ToString(1)); }
|
||||
public override string ToString() { return string.Format("{0}({1})", Cfg.Name, Cfg.ToString(-1)); }
|
||||
|
||||
private readonly NivotrackCfg modbusCommonCfg;
|
||||
readonly NivotrackCfg nivotrackCfg;
|
||||
readonly IHart hart;
|
||||
|
||||
/// Private fields
|
||||
SerialPort serialPort;
|
||||
DateTime lastSerialPortWrite;
|
||||
public double Level { get { return ReadLevel(); } }
|
||||
|
||||
public Queue<byte[]>[] ReceivedTelegrams
|
||||
double rawLevel_mm;
|
||||
bool isRawLevelValid;
|
||||
|
||||
/// For stable measurement calculation
|
||||
double maxSDev;
|
||||
double[] levelReadings;
|
||||
double[] sortedLevelReadings;
|
||||
int currentReadingsCount;
|
||||
|
||||
bool measurementCompleted; /// stableMeasurementCompleted
|
||||
|
||||
DoubleBox levelBox;
|
||||
///
|
||||
enum CurrentOp
|
||||
{
|
||||
get { return receivedTelegrams; }
|
||||
}
|
||||
Queue<byte[]>[] receivedTelegrams;
|
||||
None,
|
||||
ReadLevel,
|
||||
ReadStableLevel,
|
||||
}
|
||||
CurrentOp currentOp;
|
||||
|
||||
Queue<byte[]> telegramsToSend;
|
||||
|
||||
public Nivotrack()
|
||||
{
|
||||
@@ -45,167 +57,242 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
|
||||
/// Connection settings: 19200 Bd 8-bits No-parity 1-stop-bit Flow control: none or hardware.
|
||||
/// </summary>
|
||||
public Nivotrack(Generic.IComponentCfg cfg)
|
||||
public Nivotrack(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
receivedTelegrams = new Queue<byte[]>[256];
|
||||
for (int i = 0; i < receivedTelegrams.Length; i++)
|
||||
{
|
||||
receivedTelegrams[i] = new Queue<byte[]>();
|
||||
}
|
||||
telegramsToSend = new Queue<byte[]>();
|
||||
nivotrackCfg = cfg as NivotrackCfg;
|
||||
|
||||
hart = (IHart)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (hart == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
levelReadings = new double[StableReadingsCount];
|
||||
sortedLevelReadings = new double[StableReadingsCount];
|
||||
|
||||
serialPort = null;
|
||||
modbusCommonCfg = cfg as NivotrackCfg;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
~Nivotrack()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
if (modbusCommonCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
serialPort = null;
|
||||
log.FatalFormat("{0} - Device simulated", Name);
|
||||
return;
|
||||
}
|
||||
if (nivotrackCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
string comPortName = "COM" + modbusCommonCfg.ComPortNr.ToString();
|
||||
serialPort = new SerialPort(comPortName, modbusCommonCfg.BaudRate, modbusCommonCfg.Parity, modbusCommonCfg.DataBits, modbusCommonCfg.StopBits);
|
||||
serialPort.Handshake = modbusCommonCfg.Handshake;
|
||||
serialPort.Open();
|
||||
|
||||
//stopWorkerThread = false;
|
||||
//workerThread = new Thread(Worker);
|
||||
//workerThread.Start();
|
||||
|
||||
log.FatalFormat("{0} - Device successfully initialized", Name);
|
||||
rawLevel_mm = 0;
|
||||
isRawLevelValid = false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send an arbitrary modbus message.
|
||||
/// When the message length is N, however only bytes 1..N-2 have to be set.
|
||||
/// The last two message bytes (CRC) may be uninitialized or zero.
|
||||
/// They are calculated inside this function as required by Modbus specification.
|
||||
/// </summary>
|
||||
/// <param name="message">Message incl CRC fields, CRC bytes dont have to be set</param>
|
||||
public void SendMessage(byte[] message)
|
||||
void Detect()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
byte bcnt = (byte)0; /// block count
|
||||
|
||||
Telegram.UpdateTelegramCRC(message);
|
||||
byte[] data = new byte[5];
|
||||
data[0] = (byte)Mark.ShortFrameMaster2Slave;
|
||||
data[1] = (byte)((int)Master.Primary + (byte)nivotrackCfg.Address);
|
||||
data[2] = (byte)Cmd.ReadUniqueID;
|
||||
data[3] = bcnt;
|
||||
data[4] = 0; /// reserved for chehcksum
|
||||
|
||||
if ((DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 100))
|
||||
{
|
||||
/// More then 100 ms since last 'send' --> do not enqueue the message
|
||||
SendMessageNow(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
telegramsToSend.Enqueue(message);
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Enqueueing message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
}
|
||||
hart.SendMessage(5, data);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Send a structured modbus message.
|
||||
/// </summary>
|
||||
/// <param name="modbusAddress">Device address (1..255) or 0 = broadcast</param>
|
||||
/// <param name="function">Function (0..127)</param>
|
||||
/// <param name="dataAddress">Address of data to be transferred (0..65535)</param>
|
||||
/// <param name="dataCount">Count of data bytes to be transferred (0..65535)</param>
|
||||
public void SendMessage(byte modbusAddress, byte function, ushort dataAddress, ushort dataCount)
|
||||
void RequestProcessValue()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
byte bcnt = (byte)0; /// block count
|
||||
|
||||
byte[] message = new byte[8]
|
||||
byte[] data = new byte[5];
|
||||
data[0] = (byte)Mark.ShortFrameMaster2Slave;
|
||||
data[1] = (byte)((int)Master.Primary + (byte)nivotrackCfg.Address);
|
||||
data[2] = (byte)Cmd.ReadPrimaryVar;
|
||||
data[3] = bcnt;
|
||||
data[4] = 0; /// reserved for chehcksum
|
||||
|
||||
hart.SendMessage(5, data);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (nivotrackCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
if (hart.ReceivedTelegrams[nivotrackCfg.Address].Count > 0)
|
||||
{
|
||||
modbusAddress,
|
||||
function,
|
||||
(byte)(dataAddress / 256),
|
||||
(byte)(dataAddress % 256),
|
||||
(byte)(dataCount / 256),
|
||||
(byte)(dataCount % 256),
|
||||
0,
|
||||
0,
|
||||
};
|
||||
byte[] data = hart.ReceivedTelegrams[nivotrackCfg.Address].Dequeue();
|
||||
|
||||
SendMessage(message);
|
||||
}
|
||||
|
||||
public void SendMessageNow(byte[] message)
|
||||
{
|
||||
serialPort.Write(message, 0, message.Length);
|
||||
lastSerialPortWrite = DateTime.Now;
|
||||
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Sending message ", Name), message);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
|
||||
int nrBytes = serialPort.BytesToRead;
|
||||
if (nrBytes > 0)
|
||||
{
|
||||
byte[] buffer = new byte[nrBytes];
|
||||
serialPort.Read(buffer, 0, nrBytes);
|
||||
|
||||
int deviceAddress = (nrBytes >= 1) ? buffer[0] : 0;
|
||||
int function = (nrBytes >= 2) ? buffer[1] : 0;
|
||||
|
||||
if ((nrBytes >= 4) && Telegram.VerifyTelegramCRC(buffer))
|
||||
if ((data.Length == 12) && (data[0] == (byte)Mark.ShortFrameSlave2Master)
|
||||
&& (data[2] == (byte)Cmd.ReadPrimaryVar)
|
||||
&& (data[3] == 7))
|
||||
{
|
||||
receivedTelegrams[deviceAddress].Enqueue(buffer);
|
||||
|
||||
string s = string.Format("{0} - {1} address={2} count={3}", Name, Telegram.LogTelegram("Telegram received: ", buffer), deviceAddress, receivedTelegrams[deviceAddress].Count);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
///
|
||||
/// A frame with a status and a primary variable
|
||||
///
|
||||
ushort state = (ushort)(256 * data[4] + data[5]);
|
||||
byte unitsID = data[6];
|
||||
byte[] floatData = new byte[] { data[10], data[9], data[8], data[7] };
|
||||
rawLevel_mm = System.BitConverter.ToSingle(floatData, 0);
|
||||
isRawLevelValid = true;
|
||||
log.InfoFormat("{0} : Received water level = {1} mm, State = {2}", Name, rawLevel_mm, state.ToString("X4"));
|
||||
}
|
||||
else
|
||||
else if ((data.Length == 7) && (data[0] == (byte)Mark.ShortFrameSlave2Master)
|
||||
&& (data[2] == (byte)Cmd.ReadPrimaryVar)
|
||||
&& (data[3] == 2))
|
||||
{
|
||||
string s = Telegram.LogTelegram(string.Format("{0} - Invalid data received ", Name), buffer);
|
||||
Debug.WriteLine(s);
|
||||
log.Debug(s);
|
||||
///
|
||||
/// A frame with a status only
|
||||
///
|
||||
ushort state = (ushort)(256 * data[4] + data[5]);
|
||||
isRawLevelValid = false;
|
||||
log.InfoFormat("{0} : State = {1}", Name, state.ToString("X4"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (serialPort == null) return;
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (nivotrackCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
if (telegramsToSend.Count > 0 && (DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 500))
|
||||
{
|
||||
SendMessageNow(telegramsToSend.Dequeue());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (serialPort != null)
|
||||
if ((StateMachine.Time % 2) == (nivotrackCfg.Address % 2))
|
||||
{
|
||||
//stopWorkerThread = true;
|
||||
//workerThread.Join(2000);
|
||||
serialPort.Close();
|
||||
serialPort = null;
|
||||
RequestProcessValue();
|
||||
}
|
||||
}
|
||||
|
||||
public void StopDevice() { }
|
||||
public void StopDevice2() { }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the most recent raw level measurement and applies correction table
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public double ReadLevel()
|
||||
{
|
||||
return Config.Formulas.CorrectedValue(rawLevel_mm, Corrections);
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ReadLevelOp(ref DoubleBox levelBox)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
this.levelBox = levelBox;
|
||||
currentOp = CurrentOp.ReadLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ReadStableLevelOp(ref DoubleBox levelBox, double maxSDev)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
this.levelBox = levelBox;
|
||||
this.maxSDev = maxSDev;
|
||||
currentOp = CurrentOp.ReadStableLevel;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
if (currentOp == CurrentOp.ReadLevel)
|
||||
{
|
||||
if (isRawLevelValid && (levelBox != null)) levelBox.Val = ReadLevel();
|
||||
}
|
||||
else if (currentOp == CurrentOp.ReadStableLevel)
|
||||
{
|
||||
currentReadingsCount = 0;
|
||||
measurementCompleted = false;
|
||||
if (isRawLevelValid)
|
||||
{
|
||||
levelReadings[currentReadingsCount++] = ReadLevel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsPrinted</returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (measurementCompleted)
|
||||
{
|
||||
if ((currentOp == CurrentOp.ReadLevel) && (levelBox != null)) levelBox.Val = ReadLevel();
|
||||
return Event.LevelDone;
|
||||
}
|
||||
|
||||
if ((currentOp == CurrentOp.ReadLevel) && isRawLevelValid)
|
||||
{
|
||||
if (levelBox != null) levelBox.Val = ReadLevel();
|
||||
measurementCompleted = true;
|
||||
return Event.LevelDone;
|
||||
}
|
||||
else if ((currentOp == CurrentOp.ReadStableLevel) && isRawLevelValid)
|
||||
{
|
||||
///
|
||||
/// Read new level and put it into a FIFO buffer
|
||||
///
|
||||
if (currentReadingsCount < StableReadingsCount)
|
||||
{
|
||||
levelReadings[currentReadingsCount++] = ReadLevel();
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Shift data in the (already full) buffer, save the mass into the last buffer item
|
||||
for (int i = 1; i < StableReadingsCount; i++)
|
||||
{
|
||||
levelReadings[i - 1] = levelReadings[i];
|
||||
}
|
||||
levelReadings[StableReadingsCount - 1] = ReadLevel();
|
||||
}
|
||||
|
||||
///
|
||||
/// Evaluate reading stability
|
||||
///
|
||||
if (currentReadingsCount >= StableReadingsCount)
|
||||
{
|
||||
Array.Copy(levelReadings, sortedLevelReadings, StableReadingsCount);
|
||||
Array.Sort(sortedLevelReadings);
|
||||
|
||||
if (true)
|
||||
{
|
||||
/// Spread of values (except of the largest and the smalles value) must be <= maxSDev
|
||||
|
||||
if ((sortedLevelReadings[StableReadingsCount - 2] - sortedLevelReadings[1]) <= maxSDev)
|
||||
{
|
||||
double massSum = 0;
|
||||
for (int i = 1; i < StableReadingsCount - 1; i++) massSum += sortedLevelReadings[i];
|
||||
double ave = massSum / (StableReadingsCount - 2);
|
||||
if (levelBox != null) levelBox.Val = ave;
|
||||
measurementCompleted = true;
|
||||
log.InfoFormat("ReadStableLevelOp.Run() ... valid level={0} ... returning LevelDone", ave);
|
||||
return Event.LevelDone;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Standard deviation (except of the largest and the smalles value) must be <= maxSDev
|
||||
double massSum = 0;
|
||||
for (int i = 1; i < StableReadingsCount - 1; i++) massSum += sortedLevelReadings[i];
|
||||
double ave = massSum / (StableReadingsCount - 2);
|
||||
double sdev = 0;
|
||||
for (int i = 1; i < StableReadingsCount - 1; i++) sdev += ((sortedLevelReadings[i] - ave) * (sortedLevelReadings[i] - ave));
|
||||
|
||||
if (Math.Sqrt(sdev / (StableReadingsCount - 2)) <= maxSDev)
|
||||
{
|
||||
if (levelBox != null) levelBox.Val = ave;
|
||||
measurementCompleted = true;
|
||||
log.InfoFormat("ReadStableMassOp.Run() ... valid mass={0} ... returning Event.BalanceDone", ave);
|
||||
return Event.LevelDone;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Event.Busy;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
currentOp = CurrentOp.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
@@ -10,44 +11,61 @@ using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Hart.Nivotrack
|
||||
{
|
||||
public class NivotrackCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider
|
||||
public class NivotrackCfg : ComponentCfgBase, Generic.IChildComponentCfg, Config.Entities.IParamsProvider, GenericDevices.ICalibInfoCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(NivotrackCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
static readonly int[] AllBaudRates = new int[] { 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 };
|
||||
static readonly Parity[] AllParities = new Parity[] { Parity.None, Parity.Even, Parity.Odd };
|
||||
static readonly int[] AllDataBits = new int[] { 7, 8 };
|
||||
static readonly StopBits[] AllStopBits = new StopBits[] { StopBits.None, StopBits.One, StopBits.OnePointFive, StopBits.Two };
|
||||
static readonly Handshake[] AllHandshakes = new Handshake[] { Handshake.None, Handshake.XOnXOff, Handshake.RequestToSend, Handshake.RequestToSendXOnXOff };
|
||||
static readonly int[] Par1Values = new int[] { 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 };
|
||||
static readonly int[] Par2Values = new int[] { 7, 8 };
|
||||
|
||||
|
||||
public IComponentCfgCtrl GetControl()
|
||||
{
|
||||
return new Configs.ParamsProvider.ComponentCfgCtrl(this, null);
|
||||
IList<string> parents = new List<string>();
|
||||
parents.Add("Hart");
|
||||
|
||||
return new Configs.ParamsProvider.ComponentCfgCtrl(this, parents);
|
||||
}
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int ComPortNr;
|
||||
public int BaudRate;
|
||||
public int DataBits;
|
||||
public Parity Parity;
|
||||
public StopBits StopBits;
|
||||
public Handshake Handshake;
|
||||
public int Address;
|
||||
public int Par1;
|
||||
public int Par2;
|
||||
|
||||
|
||||
/// 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; }
|
||||
}
|
||||
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
NivotrackCfg()
|
||||
{
|
||||
}
|
||||
NivotrackCfg() { }
|
||||
|
||||
public NivotrackCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
ParentName = "Hart";
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
@@ -55,21 +73,15 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
ComPortNr = 3;
|
||||
BaudRate = 9600;
|
||||
DataBits = 8;
|
||||
Parity = System.IO.Ports.Parity.None;
|
||||
StopBits = System.IO.Ports.StopBits.One;
|
||||
Handshake = System.IO.Ports.Handshake.None;
|
||||
Address = 3;
|
||||
Par1 = 9600;
|
||||
Par2 = 8;
|
||||
}
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Com port number",
|
||||
"Baud rate",
|
||||
"Data bits",
|
||||
"Parity",
|
||||
"Stop bits",
|
||||
"Handshake"
|
||||
"HART address",
|
||||
"Parameter 1",
|
||||
"Parameter 2",
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
@@ -79,11 +91,8 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
IList<string> list = new List<string>();
|
||||
switch (i)
|
||||
{
|
||||
case 1: foreach (var v in AllBaudRates) list.Add(v.ToString()); break;
|
||||
case 2: foreach (var v in AllDataBits) list.Add(v.ToString()); break;
|
||||
case 3: foreach (var v in AllParities) list.Add(v.ToString()); break;
|
||||
case 4: foreach (var v in AllStopBits) list.Add(v.ToString()); break;
|
||||
case 5: foreach (var v in AllHandshakes) list.Add(v.ToString()); break;
|
||||
case 1: foreach (var v in Par1Values) list.Add(v.ToString()); break;
|
||||
case 2: foreach (var v in Par2Values) list.Add(v.ToString()); break;
|
||||
default: return null;
|
||||
}
|
||||
return list;
|
||||
@@ -93,18 +102,14 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
return string.Format("Com{0}, {1}Bd, {2}-bits, parity={3}, stopBits={4}, {5}",
|
||||
ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
|
||||
return string.Format("Address={0}", Address);
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0: return ComPortNr.ToString();
|
||||
case 1: return BaudRate.ToString();
|
||||
case 2: return DataBits.ToString();
|
||||
case 3: return Parity.ToString();
|
||||
case 4: return StopBits.ToString();
|
||||
case 5: return Handshake.ToString();
|
||||
case 0: return Address.ToString();
|
||||
case 1: return Par1.ToString();
|
||||
case 2: return Par2.ToString();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -115,9 +120,9 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (ComPortNr != int.Parse(strValue))
|
||||
if (Address != int.Parse(strValue))
|
||||
{
|
||||
ComPortNr = int.Parse(strValue);
|
||||
Address = int.Parse(strValue);
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
else
|
||||
@@ -126,55 +131,22 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
}
|
||||
|
||||
case 1:
|
||||
foreach (var v in AllBaudRates)
|
||||
foreach (var v in Par1Values)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (BaudRate != v))
|
||||
if ((strValue == v.ToString()) && (Par1 != v))
|
||||
{
|
||||
BaudRate = v;
|
||||
Par1 = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
|
||||
case 2:
|
||||
foreach (var v in AllDataBits)
|
||||
foreach (var v in Par2Values)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (DataBits != v))
|
||||
if ((strValue == v.ToString()) && (Par2 != v))
|
||||
{
|
||||
DataBits = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
|
||||
case 3:
|
||||
foreach (var v in AllParities)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (Parity != v))
|
||||
{
|
||||
Parity = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
|
||||
case 4:
|
||||
foreach (var v in AllStopBits)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (StopBits != v))
|
||||
{
|
||||
StopBits = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.None;
|
||||
|
||||
case 5:
|
||||
foreach (var v in AllHandshakes)
|
||||
{
|
||||
if ((strValue == v.ToString()) && (Handshake != v))
|
||||
{
|
||||
Handshake = v;
|
||||
Par2 = v;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
}
|
||||
@@ -193,24 +165,15 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
int comPortNr;
|
||||
if (int.TryParse(strValue, out comPortNr) && comPortNr > 0 && comPortNr <= 999) return true;
|
||||
int address;
|
||||
if (int.TryParse(strValue, out address) && address >= 0 && address <= 15) return true;
|
||||
break;
|
||||
case 1:
|
||||
foreach (var v in AllBaudRates) if (strValue == v.ToString()) return true;
|
||||
foreach (var v in Par1Values) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
case 2:
|
||||
foreach (var v in AllDataBits) if (strValue == v.ToString()) return true;
|
||||
foreach (var v in Par2Values) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
case 3:
|
||||
foreach (var v in AllParities) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
case 4:
|
||||
foreach (var v in AllStopBits) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
case 5:
|
||||
foreach (var v in AllHandshakes) if (strValue == v.ToString()) return true;
|
||||
break;
|
||||
|
||||
default:
|
||||
message = "Invalid index";
|
||||
@@ -224,12 +187,9 @@ namespace TBF.BenchControl.Hart.Nivotrack
|
||||
void CopyContentTo(NivotrackCfg prms)
|
||||
{
|
||||
prms.ParentName = this.ParentName;
|
||||
prms.ComPortNr = this.ComPortNr;
|
||||
prms.BaudRate = this.BaudRate;
|
||||
prms.DataBits = this.DataBits;
|
||||
prms.Parity = this.Parity;
|
||||
prms.StopBits = this.StopBits;
|
||||
prms.Handshake = this.Handshake;
|
||||
prms.Address = this.Address;
|
||||
prms.Par1 = this.Par1;
|
||||
prms.Par2 = this.Par2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.IO.Ports;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
@@ -48,16 +49,17 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
protected static SerialPort serialPort;
|
||||
protected static StringBuilder stringBuilder;
|
||||
|
||||
public int ScaleNr { get { return balanceNr; } }
|
||||
public int IdNr { get { return balanceCfg.IdNr; } }
|
||||
public double Capacity { get { return balanceCfg.Capacity; } }
|
||||
public double Resolution { get { return balanceCfg.Resolution; } }
|
||||
public int EmptyTimeSec { get { return balanceCfg.DrainTimeSec; } }
|
||||
public int ScaleNr { get { return balanceNr; } }
|
||||
public int IdNr { get { return balanceCfg.IdNr; } }
|
||||
public double Capacity { get { return balanceCfg.Capacity; } }
|
||||
public double Resolution { get { return balanceCfg.Resolution; } }
|
||||
public int EmptyTimeSec { get { return balanceCfg.DrainTimeSec; } }
|
||||
public IValve DrainValve2 { get { return null; } }
|
||||
|
||||
/// Buoyancy
|
||||
public float BuoyancyTemp { get { return balanceCfg.BuoyancyTemp; } }
|
||||
public float BuoyancyTemp { get { return balanceCfg.BuoyancyTemp; } }
|
||||
public float BuoyancyPress { get { return balanceCfg.BuoyancyPress; } }
|
||||
public float BuoyancyHumi { get { return balanceCfg.BuoyancyHumi; } }
|
||||
public float BuoyancyHumi { get { return balanceCfg.BuoyancyHumi; } }
|
||||
public double WeightStandardDensity { get { return balanceCfg.WeightStandardDensity; } }
|
||||
|
||||
|
||||
@@ -122,14 +124,14 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
log.FatalFormat("Successfully initialized device {0}", ToString());
|
||||
}
|
||||
|
||||
public bool IsEmpty()
|
||||
public override bool IsEmpty()
|
||||
{
|
||||
return (Mass <= balanceCfg.Empty);
|
||||
}
|
||||
|
||||
public bool IsEmpty(double mass)
|
||||
public override bool ContainsMoreThen(float thld)
|
||||
{
|
||||
return (mass <= balanceCfg.Empty);
|
||||
return (Mass >= thld);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.IO.Ports;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
@@ -50,6 +51,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
public int ScaleNr { get { return balanceNr; } }
|
||||
public double Capacity { get { return balanceCfg.Capacity; } }
|
||||
public int EmptyTimeSec { get { return balanceCfg.DrainTimeSec; } }
|
||||
public IValve DrainValve2 { get { return null; } }
|
||||
|
||||
/// Buoyancy
|
||||
public float BuoyancyTemp { get { return balanceCfg.BuoyancyTemp; } }
|
||||
@@ -126,9 +128,9 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
return DrainValve.State ? (mass <= balanceCfg.Empty) : (mass <= balanceCfg.EmptyUp);
|
||||
}
|
||||
|
||||
public bool IsEmpty(double mass)
|
||||
public override bool ContainsMoreThen(float thld)
|
||||
{
|
||||
return DrainValve.State ? (mass <= balanceCfg.Empty) : (mass <= balanceCfg.EmptyUp);
|
||||
return (mass >= thld);
|
||||
}
|
||||
|
||||
public void ZeroWhenStable()
|
||||
|
||||
@@ -23,7 +23,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
DoubleBox result;
|
||||
|
||||
/// Operation specific
|
||||
double[] massReadings;
|
||||
double[] massReadings;
|
||||
double[] sortedMassReadings;
|
||||
int currentReadingsCount;
|
||||
|
||||
bool measurementCompleted;
|
||||
@@ -48,7 +49,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
this.result = result;
|
||||
|
||||
massReadings = new double[totalReadingsCount];
|
||||
currentReadingsCount = 0;
|
||||
sortedMassReadings = new double[totalReadingsCount];
|
||||
currentReadingsCount = 0;
|
||||
measurementCompleted = false;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
@@ -114,17 +116,18 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
|
||||
if (currentReadingsCount >= totalReadingsCount)
|
||||
{
|
||||
Array.Sort(massReadings);
|
||||
Array.Copy(massReadings, sortedMassReadings, totalReadingsCount);
|
||||
Array.Sort(sortedMassReadings);
|
||||
|
||||
#if STABLE_MASS_EXTRAS
|
||||
if (method == Config.Entities.MassMethod.Spread)
|
||||
{
|
||||
/// Immediate mass measurement, end condition calculated below
|
||||
|
||||
if ((massReadings[totalReadingsCount - 2] - massReadings[1]) <= maxSpread)
|
||||
if ((sortedMassReadings[totalReadingsCount - 2] - sortedMassReadings[1]) <= maxSpread)
|
||||
{
|
||||
double massSum = 0;
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) massSum += massReadings[i];
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) massSum += sortedMassReadings[i];
|
||||
result.Val = (massSum / (totalReadingsCount - 2));
|
||||
log.InfoFormat("ReadStableMassOp.Run() ... valid mass={0} ... returning Event.BalanceDone", result.Val);
|
||||
|
||||
@@ -137,10 +140,10 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// Immediate mass measurement, end condition calculated below
|
||||
|
||||
double massSum = 0;
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) massSum += massReadings[i];
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) massSum += sortedMassReadings[i];
|
||||
double ave = (massSum / (totalReadingsCount - 2));
|
||||
double sdev = 0;
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) sdev += ((massReadings[i] - ave) * (massReadings[i] - ave));
|
||||
for (int i = 1; i < totalReadingsCount - 1; i++) sdev += ((sortedMassReadings[i] - ave) * (sortedMassReadings[i] - ave));
|
||||
|
||||
if (Math.Sqrt(sdev / (totalReadingsCount - 2)) <= maxSpread)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2018 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -29,13 +29,18 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
|
||||
readonly GenericDevices.ITankDrainingCfg tankDrainingCfg;
|
||||
|
||||
private IValve drainValve;
|
||||
bool hasDrainValve { get { return !string.IsNullOrEmpty(tankDrainingCfg.DrainValve); } } /// Available in UI (unlike 'drainValve')
|
||||
|
||||
IValve drainValve;
|
||||
public GenericDevices.IValve DrainValve { get { return drainValve; } }
|
||||
|
||||
private IOperation openTheDrainValveOp;
|
||||
private IOperation closeTheDrainValveOp;
|
||||
private IOperation waitTankEmptyOp;
|
||||
|
||||
IOperation openTheDrainValveOp;
|
||||
IOperation closeTheDrainValveOp;
|
||||
IOperation waitTankIsEmptyOp;
|
||||
IOperation waitTankContainsMoreThenThld1Op;
|
||||
IOperation waitTankContainsMoreThenThld2Op;
|
||||
IOperation waitTankContainsMoreThenThld3Op;
|
||||
IOperation waitTankContainsMoreThenThld4Op;
|
||||
|
||||
DrainState drainState;
|
||||
|
||||
@@ -45,8 +50,12 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
{
|
||||
openTheDrainValveOp = null;
|
||||
closeTheDrainValveOp = null;
|
||||
waitTankEmptyOp = null;
|
||||
}
|
||||
waitTankIsEmptyOp = null;
|
||||
waitTankContainsMoreThenThld1Op = null;
|
||||
waitTankContainsMoreThenThld2Op = null;
|
||||
waitTankContainsMoreThenThld3Op = null;
|
||||
waitTankContainsMoreThenThld4Op = null;
|
||||
}
|
||||
|
||||
public TankDraining(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
@@ -56,8 +65,12 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
|
||||
openTheDrainValveOp = null;
|
||||
closeTheDrainValveOp = null;
|
||||
waitTankEmptyOp = null;
|
||||
}
|
||||
waitTankIsEmptyOp = null;
|
||||
waitTankContainsMoreThenThld1Op = null;
|
||||
waitTankContainsMoreThenThld2Op = null;
|
||||
waitTankContainsMoreThenThld3Op = null;
|
||||
waitTankContainsMoreThenThld4Op = null;
|
||||
}
|
||||
|
||||
protected void Initalize()
|
||||
{
|
||||
@@ -65,8 +78,17 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
|
||||
openTheDrainValveOp = new Elde.SetValvesOp(StateMachine.ControlBoard, drainValve, null);
|
||||
closeTheDrainValveOp = new Elde.SetValvesOp(StateMachine.ControlBoard, null, drainValve);
|
||||
waitTankEmptyOp = new WaitTankEmptyOp(this);
|
||||
}
|
||||
waitTankIsEmptyOp = new WaitTankEmptyOp(this);
|
||||
|
||||
Various.TankWithLevelMsrmnt.TankCfg tankCfg = tankDrainingCfg as Various.TankWithLevelMsrmnt.TankCfg;
|
||||
if (tankCfg != null)
|
||||
{
|
||||
waitTankContainsMoreThenThld1Op = new WaitTankContainsMoreThenOp(this, tankCfg.ThldLevel1);
|
||||
waitTankContainsMoreThenThld2Op = new WaitTankContainsMoreThenOp(this, tankCfg.ThldLevel2);
|
||||
waitTankContainsMoreThenThld3Op = new WaitTankContainsMoreThenOp(this, tankCfg.ThldLevel3);
|
||||
waitTankContainsMoreThenThld4Op = new WaitTankContainsMoreThenOp(this, tankCfg.ThldLevel4);
|
||||
}
|
||||
}
|
||||
|
||||
protected void RunBefore()
|
||||
{
|
||||
@@ -112,33 +134,65 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
|
||||
public virtual string GetName() { return string.Empty; }
|
||||
public virtual bool IsEmpty() { return false; }
|
||||
public virtual bool ContainsMoreThen(float thld) { return thld == 0; }
|
||||
|
||||
|
||||
|
||||
public int ConditionsCount { get { return 3; } }
|
||||
public int ConditionsCount
|
||||
{
|
||||
get { return hasDrainValve ? 3 : ((tankDrainingCfg is Various.TankWithLevelMsrmnt.TankCfg) ? 4 : 0); }
|
||||
}
|
||||
|
||||
/// Strings are added to the combo-box for transition sequence condition selection
|
||||
public string ConditionName(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return string.Format(Strings._0_open_the_drain_valve, Name);
|
||||
case 1: return string.Format(Strings._0_close_the_drain_valve, Name);
|
||||
case 2: return string.Format(Strings._0_wait_until_the_tank_is_empty, Name);
|
||||
default: return string.Empty;
|
||||
}
|
||||
if (hasDrainValve)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return string.Format(Strings._0_open_the_drain_valve, Name);
|
||||
case 1: return string.Format(Strings._0_close_the_drain_valve, Name);
|
||||
case 2: return string.Format(Strings._0_wait_until_the_tank_is_empty, Name);
|
||||
}
|
||||
}
|
||||
else if (tankDrainingCfg is Various.TankWithLevelMsrmnt.TankCfg)
|
||||
{
|
||||
var tankCfg = tankDrainingCfg as Various.TankWithLevelMsrmnt.TankCfg;
|
||||
switch (i)
|
||||
{
|
||||
case 0: return string.Format(Strings._0_wait_until_tank_contains_more_then_1_l, Name, tankCfg.ThldLevel1);
|
||||
case 1: return string.Format(Strings._0_wait_until_tank_contains_more_then_1_l, Name, tankCfg.ThldLevel2);
|
||||
case 2: return string.Format(Strings._0_wait_until_tank_contains_more_then_1_l, Name, tankCfg.ThldLevel3);
|
||||
case 3: return string.Format(Strings._0_wait_until_tank_contains_more_then_1_l, Name, tankCfg.ThldLevel4);
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty; // Default
|
||||
}
|
||||
|
||||
/// Operation to be executed as a part of a transition sequence
|
||||
public IOperation ConditionOp(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return openTheDrainValveOp;
|
||||
case 1: return closeTheDrainValveOp;
|
||||
case 2: return waitTankEmptyOp;
|
||||
default: return null;
|
||||
}
|
||||
if (hasDrainValve)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return openTheDrainValveOp;
|
||||
case 1: return closeTheDrainValveOp;
|
||||
case 2: return waitTankIsEmptyOp;
|
||||
}
|
||||
}
|
||||
else if (tankDrainingCfg is Various.TankWithLevelMsrmnt.TankCfg)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return waitTankContainsMoreThenThld1Op;
|
||||
case 1: return waitTankContainsMoreThenThld2Op;
|
||||
case 2: return waitTankContainsMoreThenThld3Op;
|
||||
case 3: return waitTankContainsMoreThenThld4Op;
|
||||
}
|
||||
}
|
||||
|
||||
return null; /// Default
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Metering Systems
|
||||
///
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.MettlerToledo
|
||||
{
|
||||
public class WaitTankContainsMoreThenOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(WaitTankContainsMoreThenOp));
|
||||
public override string ToString() { return string.Format("WaitTankFullOp()"); }
|
||||
|
||||
readonly GenericDevices.ITankDraining tankDraining;
|
||||
float threshodLevel;
|
||||
bool conditionMet;
|
||||
|
||||
/// <summary>
|
||||
/// Events: ConditionMet, ConditionNotMet
|
||||
/// </summary>
|
||||
/// <param name="tankDraining">Tank draining (Balance device) instance</param>
|
||||
public WaitTankContainsMoreThenOp(GenericDevices.ITankDraining tankDraining, float thresholdLevel)
|
||||
{
|
||||
this.tankDraining = tankDraining;
|
||||
this.threshodLevel = thresholdLevel;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
conditionMet = tankDraining.ContainsMoreThen(threshodLevel);
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.ConditionMet . . . tank is empty
|
||||
/// Event.ConditionNotMet . tank is not empty
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
conditionMet = conditionMet || tankDraining.ContainsMoreThen(threshodLevel);
|
||||
|
||||
return conditionMet ? Event.ConditionMet : Event.ConditionNotMet;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,18 +98,8 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (easythermCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
}
|
||||
|
||||
/// <summary>Stop this device</summary>
|
||||
public void StopDevice()
|
||||
{
|
||||
if (easythermCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
}
|
||||
|
||||
public void RunDeviceAfter() { }
|
||||
public void StopDevice() { }
|
||||
public void StopDevice2() { }
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ using System.Diagnostics;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
{
|
||||
public class LevelMeter : ComponentBase, GenericDevices.ILevelMeter, GenericDevices.IVolumeMeter, GenericDevices.ITempMeter, IDevice
|
||||
public class LevelMeter : ComponentBase, GenericDevices.ILevelMeter, GenericDevices.ITempMeter, IDevice
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(LevelMeter));
|
||||
public override string ToString() { return string.Format("LevelMeter({0})", Cfg.ToString(1)); }
|
||||
@@ -28,10 +28,11 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
double distance; /// [mm]
|
||||
double level; /// [mm]
|
||||
double percentage; /// [%]
|
||||
double volume; /// [l]
|
||||
double temperature; /// [°C]
|
||||
ushort state;
|
||||
|
||||
public double Level { get { return level; } }
|
||||
|
||||
/// <summary>Measurement time stamp when MsrmntState == MsrmntState.Valid</summary>
|
||||
int msrmntTimeStamp;
|
||||
|
||||
@@ -62,7 +63,6 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
distance = 200.0;
|
||||
level = 0;
|
||||
percentage = 0;
|
||||
volume = 0;
|
||||
temperature = 20.0;
|
||||
state = 0;
|
||||
|
||||
@@ -78,15 +78,12 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
|
||||
|
||||
public double ReadLevel() { return level; } /// Returns water level in mm
|
||||
public double ReadVolume() { return volume; } /// Returns volume in l
|
||||
public double ReadTemperature() { return temperature; } /// Returns temperature in °C
|
||||
|
||||
public IOperation ReadLevelOp(ref DoubleBox level) { return new ReadLevelOp(this, ref level); }
|
||||
public IOperation ReadVolumeOp(ref DoubleBox volume) { return new ReadVolumeOp(this, ref volume); }
|
||||
public IOperation ReadStableLevelOp(ref DoubleBox level, double sdev) { return new ReadStableLevelOp(this, ref level, sdev); }
|
||||
public IOperation ManualReadLevelOp(ref DoubleBox level) { return null; }
|
||||
public IOperation ReadTempOp(ref DoubleBox temperature) { return new ReadTempOp(this, ref temperature); }
|
||||
|
||||
public IOperation ReadLevelOp(ref DoubleBox level, Event eventDone) { return new ReadLevelOp(this, ref level, eventDone); }
|
||||
public IOperation ReadVolumeOp(ref DoubleBox volume, Event eventDone) { return new ReadVolumeOp(this, ref volume, eventDone); }
|
||||
public IOperation ReadTempOp(ref DoubleBox temperature, Event eventDone) { return new ReadTempOp(this, ref temperature, eventDone); }
|
||||
|
||||
|
||||
@@ -106,15 +103,23 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
|
||||
if (telegram.Length == 15 && telegram[1] == 3 && telegram[2] == 10)
|
||||
{
|
||||
distance = (double)(256 * telegram[3] + telegram[4]);
|
||||
level = (double)(256 * telegram[5] + telegram[6]);
|
||||
percentage = (double)(256 * telegram[7] + telegram[8]);
|
||||
temperature = (double)256 * telegram[9] + telegram[10];
|
||||
state = (ushort)(256 * telegram[11] + telegram[12]);
|
||||
volume = 0; /// TODO
|
||||
double _distance = (double)(256 * telegram[3] + telegram[4]); /// [mm]
|
||||
double _level = (double)(256 * telegram[5] + telegram[6]); /// [mm]
|
||||
double _percentage = (double)(256 * telegram[7] + telegram[8]); /// [%]
|
||||
double _temperature = (double)(256 * telegram[9] + telegram[10]); /// [°C]
|
||||
ushort _state = (ushort)(256 * telegram[11] + telegram[12]);
|
||||
|
||||
string line = string.Format("dist={0} mm level={1} mm, %={2} %, temp={3} °C, state={4}",
|
||||
_distance, _level, _percentage, _temperature, _state);
|
||||
if (_distance > 0)
|
||||
{
|
||||
distance = _distance;
|
||||
level = _level;
|
||||
percentage = _percentage;
|
||||
temperature = _temperature;
|
||||
state = _state;
|
||||
}
|
||||
|
||||
string line = string.Format("dist={0} mm level={1} mm, %={2} %, temp={3} °C, volume={4} l, state={5}",
|
||||
distance, level, percentage, temperature, volume, state);
|
||||
log.Debug(line);
|
||||
Debug.WriteLine(line);
|
||||
}
|
||||
|
||||
@@ -10,11 +10,10 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
public class ReadLevelOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadLevelOp));
|
||||
public override string ToString() { return string.Format("ReadLevelOp(.,{0},.)", eventDone); }
|
||||
public override string ToString() { return string.Format("ReadLevelOp(.,.)"); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly LevelMeter levelMeter;
|
||||
readonly Event eventDone;
|
||||
|
||||
/// Measured value
|
||||
DoubleBox level;
|
||||
@@ -25,19 +24,14 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
/// <param name="levelMeter">Water level meter reference</param>
|
||||
/// <param name="level">Reference to the measured level variable, value is in mm</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadLevelOp(LevelMeter levelMeter, ref DoubleBox level, Event eventDone)
|
||||
public ReadLevelOp(LevelMeter levelMeter, ref DoubleBox level)
|
||||
{
|
||||
if (levelMeter == null) throw new ArgumentNullException("levelMeter");
|
||||
this.levelMeter = levelMeter;
|
||||
this.level = level;
|
||||
this.eventDone = eventDone;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadLevelOp(LevelMeter levelMeter, ref DoubleBox level)
|
||||
: this(levelMeter, ref level, Event.LevelDone)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
@@ -53,7 +47,7 @@ namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
public Event Run()
|
||||
{
|
||||
level.Val = levelMeter.ReadLevel();
|
||||
return eventDone;
|
||||
return Event.LevelDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
|
||||
+15
-21
@@ -7,53 +7,47 @@ using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Modbus.UltrasoundLevelMeter
|
||||
{
|
||||
public class ReadVolumeOp : IOperation
|
||||
public class ReadStableLevelOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadVolumeOp));
|
||||
public override string ToString() { return string.Format("ReadVolumeOp(.,{0},.)", eventDone); }
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadLevelOp));
|
||||
public override string ToString() { return string.Format("ReadLevelOp(.,.)"); }
|
||||
|
||||
/// Set by the constructor
|
||||
readonly LevelMeter levelMeter;
|
||||
readonly Event eventDone;
|
||||
|
||||
/// Measured value
|
||||
DoubleBox volume;
|
||||
readonly DoubleBox level;
|
||||
readonly double sdev;
|
||||
|
||||
/// <summary>
|
||||
/// Events: VolumeDone or Error
|
||||
/// Events: LevelDone or Error
|
||||
/// </summary>
|
||||
/// <param name="levelMeter">Water volume meter reference</param>
|
||||
/// <param name="volume">Reference to the measured volume variable, value is in l</param>
|
||||
/// <param name="levelMeter">Water level meter reference</param>
|
||||
/// <param name="level">Reference to the measured level variable, value is in mm</param>
|
||||
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
||||
public ReadVolumeOp(LevelMeter levelMeter, ref DoubleBox volume, Event eventDone)
|
||||
public ReadStableLevelOp(LevelMeter levelMeter, ref DoubleBox level, double sdev)
|
||||
{
|
||||
if (levelMeter == null) throw new ArgumentNullException("levelMeter");
|
||||
this.levelMeter = levelMeter;
|
||||
this.volume = volume;
|
||||
this.eventDone = eventDone;
|
||||
this.level = level;
|
||||
this.sdev = sdev;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
public ReadVolumeOp(LevelMeter levelMeter, ref DoubleBox volume)
|
||||
: this(levelMeter, ref volume, Event.VolumeDone)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
volume.Val = levelMeter.ReadVolume();
|
||||
level.Val = levelMeter.ReadLevel();
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.VolumeDone
|
||||
/// Event.LevelDone
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
volume.Val = levelMeter.ReadVolume();
|
||||
return eventDone;
|
||||
level.Val = levelMeter.ReadLevel();
|
||||
return Event.LevelDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
@@ -144,7 +144,7 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
|
||||
session.SaveOrUpdate(mc);
|
||||
}
|
||||
|
||||
ICalibInfoCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(cmpnt) as ICalibInfoCfg;
|
||||
ICalibRangesCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(cmpnt) as ICalibRangesCfg;
|
||||
if (cfg != null)
|
||||
{
|
||||
cfg.SetCalibDate(rangeIx, DateTime.Now);
|
||||
|
||||
@@ -629,8 +629,8 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
parm = new OracleParameter("WITHQ2CORRECTION", OracleDbType.Int32); parm.Value = wm.Q2CorrectionDone ? 1 : 0; cmd.Parameters.Add(parm); ///:7
|
||||
parm = new OracleParameter("ERRQ2", OracleDbType.Double); parm.Value = q2ErrWOCorrection; cmd.Parameters.Add(parm); ///:8
|
||||
parm = new OracleParameter("Q2CORRECTIONFLOWRIGHT", OracleDbType.Int32);parm.Value = wm.Q2CorrFlowRight;/*1=right to left*/ cmd.Parameters.Add(parm); ///:9
|
||||
parm = new OracleParameter("Q2CORRECTIONLEFT", OracleDbType.Int32); parm.Value = wm.Q2CorrLFlow; cmd.Parameters.Add(parm); ///:10
|
||||
parm = new OracleParameter("Q2CORRECTIONRIGHT", OracleDbType.Int32); parm.Value = wm.Q2CorrRFlow; cmd.Parameters.Add(parm); ///:11
|
||||
parm = new OracleParameter("Q2CORRECTIONLEFT", OracleDbType.Int32); parm.Value = wm.Q2CorrLR; cmd.Parameters.Add(parm); ///:10
|
||||
parm = new OracleParameter("Q2CORRECTIONRIGHT", OracleDbType.Int32); parm.Value = wm.Q2CorrRL; cmd.Parameters.Add(parm); ///:11
|
||||
|
||||
int rowsUpdated = cmd.ExecuteNonQuery();
|
||||
log.InfoFormat("VT_IP_ZAEHLER_PINDEX_PD inserted, PcbNr={0}, pruefix={1}", wm.SerialNr, max_Pruefindex);
|
||||
|
||||
@@ -187,10 +187,12 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
|
||||
|
||||
Results.Entities.MeterTestRslt[] wm0trs = new Results.Entities.MeterTestRslt[testInfos.Length];
|
||||
double totalTestTime = 0;
|
||||
int maxPruefungsNr = 0;
|
||||
for (int j = 0; j < testInfos.Length; j++)
|
||||
{
|
||||
wm0trs[j] = wm0.GetMeterTestRslt(testInfos[j].TestName);
|
||||
if (Math.Abs(testInfos[j].PruefungsNr) > maxPruefungsNr) maxPruefungsNr = Math.Abs(testInfos[j].PruefungsNr);
|
||||
|
||||
wm0trs[j] = wm0.GetMeterTestRslt(testInfos[j].TestName);
|
||||
if (wm0trs[j] != null)
|
||||
{
|
||||
totalTestTime += wm0trs[j].TargetTime();
|
||||
@@ -204,7 +206,7 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
|
||||
try
|
||||
{
|
||||
logger.WriteLine("[Wasserzähler-Daten]");
|
||||
logger.WriteLine(string.Format("PruefPunkte={0}", 3));
|
||||
logger.WriteLine(string.Format("PruefPunkte={0}", (maxPruefungsNr > 15) ? 20 : ((maxPruefungsNr > 10) ? 15 : ((maxPruefungsNr > 5) ? 10 : 5))));
|
||||
logger.WriteLine(string.Format("Typ={0}", batch.ProcedureName)); /// iP 020 Q3_4 R160 A XXXX
|
||||
logger.WriteLine(string.Format("MetroKlasse={0}", wmData.MetrologicalClass));
|
||||
logger.WriteLine(string.Format("Zulassungszeichen={0}", wmData.ApprovalInfo));
|
||||
@@ -351,8 +353,8 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
|
||||
logger.WriteLine(string.Format("JustierWert=0,2")); /// 0,2
|
||||
logger.WriteLine(string.Format("Corrected2Hz={0}", wMtr.Hz2CorrectionDone ? 1 : 0));
|
||||
logger.WriteLine(string.Format("Q2Corrected={0}", wMtr.Q2CorrectionDone ? 1 : 0));
|
||||
logger.WriteLine(string.Format("Q2CorrectionRight={0}", wMtr.Q2CorrRFlow));
|
||||
logger.WriteLine(string.Format("Q2CorrectionLeft={0}", wMtr.Q2CorrLFlow));
|
||||
logger.WriteLine(string.Format("Q2CorrectionRight={0}", wMtr.Q2CorrRL));
|
||||
logger.WriteLine(string.Format("Q2CorrectionLeft={0}", wMtr.Q2CorrLR));
|
||||
logger.WriteLine(string.Format("Q2CorrectionFlowRight={0}", wMtr.Q2CorrFlowRight));
|
||||
logger.WriteLine(string.Format("FlowDirectionRight={0}", wMtr.Q2CorrFlowRight));
|
||||
logger.WriteLine(string.Format("Position={0}", wMtr.WMPosition));
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace TBF.BenchControl
|
||||
public float PidCoef;
|
||||
public IDiverter Diverter;
|
||||
public ITempMeter TempDiv;
|
||||
public IScale Scale;
|
||||
public IScaleOrTank Scale;
|
||||
public IValve StartValve1;
|
||||
public bool InvertSV1;
|
||||
public IValve StartValve2;
|
||||
@@ -39,19 +39,19 @@ namespace TBF.BenchControl
|
||||
}
|
||||
|
||||
/// Constructor from data entity
|
||||
public OutputPath(Config.Entities.OutputPath entity, IList<BenchControl.Generic.IComponent> components)
|
||||
: this(entity.Name, entity.ItemNr)
|
||||
public OutputPath(Config.Entities.OutputPath outputPathEntity, IList<BenchControl.Generic.IComponent> components)
|
||||
: this(outputPathEntity.Name, outputPathEntity.ItemNr)
|
||||
{
|
||||
Qfrom = entity.Qfrom;
|
||||
Qto = entity.Qto;
|
||||
FlowMeter = (IFlowMeter)TbfComponents.FindComponent(entity.FlowMeter, components);
|
||||
RegulValve = (IRegulValve)TbfComponents.FindComponent(entity.RegulValve, components);
|
||||
PidCoef = entity.PidCoef;
|
||||
Diverter = (IDiverter)TbfComponents.FindComponent(entity.Diverter, components);
|
||||
TempDiv = (ITempMeter)TbfComponents.FindComponent(entity.TempDiv, components);
|
||||
Scale = (IScale)TbfComponents.FindComponent(entity.Scale, components);
|
||||
Qfrom = outputPathEntity.Qfrom;
|
||||
Qto = outputPathEntity.Qto;
|
||||
FlowMeter = (IFlowMeter)TbfComponents.FindComponent(outputPathEntity.FlowMeter, components);
|
||||
RegulValve = (IRegulValve)TbfComponents.FindComponent(outputPathEntity.RegulValve, components);
|
||||
PidCoef = outputPathEntity.PidCoef;
|
||||
Diverter = (IDiverter)TbfComponents.FindComponent(outputPathEntity.Diverter, components);
|
||||
TempDiv = (ITempMeter)TbfComponents.FindComponent(outputPathEntity.TempDiv, components);
|
||||
Scale = (IScaleOrTank)TbfComponents.FindComponent(outputPathEntity.Scale, components);
|
||||
|
||||
string[] svs = entity.StartValve != null ? entity.StartValve.Split(new char[] { '~' }) : new string[0];
|
||||
string[] svs = outputPathEntity.StartValve != null ? outputPathEntity.StartValve.Split(new char[] { '~' }) : new string[0];
|
||||
int iTmp;
|
||||
///
|
||||
StartValve1 = (IValve)TbfComponents.FindComponent(((svs.Length > 0) ? svs[0] : string.Empty), components);
|
||||
@@ -63,11 +63,11 @@ namespace TBF.BenchControl
|
||||
InvertSV3 = (svs.Length > 6) ? svs[6].Equals("i") : false;
|
||||
LagSV3 = (svs.Length > 7 && int.TryParse(svs[7], out iTmp)) ? iTmp : 0;
|
||||
|
||||
string[] vOpen = entity.ValvesOpen.Split(new char[] { ';' });
|
||||
string[] vOpen = outputPathEntity.ValvesOpen.Split(new char[] { ';' });
|
||||
ValvesOpen = new List<IValve>();
|
||||
foreach (var vName in vOpen) ValvesOpen.Add((IValve)TbfComponents.FindComponent(vName, components));
|
||||
|
||||
string[] vClose = entity.ValvesClose.Split(new char[] { ';' });
|
||||
string[] vClose = outputPathEntity.ValvesClose.Split(new char[] { ';' });
|
||||
ValvesClose = new List<IValve>();
|
||||
foreach (var vName in vClose) ValvesClose.Add((IValve)TbfComponents.FindComponent(vName, components));
|
||||
}
|
||||
|
||||
@@ -126,12 +126,13 @@ namespace TBF.BenchControl.Sequences
|
||||
///
|
||||
/// Read S/N-s from scales (cannot be stopped, but is limitted to Scales count x 3s (=timeout)
|
||||
///
|
||||
IScale[] scales = new IScale[] { StateMachine.Scale1, StateMachine.Scale2, StateMachine.Scale3 };
|
||||
IScaleOrTank[] tanks = new IScaleOrTank[] { StateMachine.Tank1, StateMachine.Tank2, StateMachine.Tank3 };
|
||||
|
||||
foreach (var scale in scales)
|
||||
foreach (var tank in tanks)
|
||||
{
|
||||
if (scale != null)
|
||||
if (tank is IScale)
|
||||
{
|
||||
IScale scale = tank as IScale;
|
||||
string sn = string.Empty;
|
||||
IOperation getSNOp = scale.GetSerNumOp(ref sn);
|
||||
|
||||
@@ -194,72 +195,104 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Drain tanks for the first time, use defined drain times
|
||||
/// Enable stop draining buttons
|
||||
///
|
||||
Bridge.Bench2UI(((StateMachine.DrainValve1 != null) ? ButtonsEtc.DrainTankBtn1Hi : 0) |
|
||||
((StateMachine.DrainValve2 != null) ? ButtonsEtc.DrainTankBtn2Hi : 0) |
|
||||
((StateMachine.DrainValve3 != null) ? ButtonsEtc.DrainTankBtn3Hi : 0));
|
||||
|
||||
IntBox remainingTime = new IntBox();
|
||||
State startNew = State.Create("MainSeq : Drain tanks")
|
||||
.AddOperation(checkUiOp);
|
||||
|
||||
///
|
||||
/// Determine lists of drain valves and drain times (max. of all tank drain times)
|
||||
///
|
||||
IList<IValve> fullDrainValves = new List<IValve>();
|
||||
IList<IValve> secondHalfDrainValves = new List<IValve>();
|
||||
IList<IValve> allDrainValves = new List<IValve>();
|
||||
if (StateMachine.DrainValve1 != null) allDrainValves.Add(StateMachine.DrainValve1);
|
||||
if (StateMachine.DrainValve2 != null) allDrainValves.Add(StateMachine.DrainValve2);
|
||||
if (StateMachine.DrainValve3 != null) allDrainValves.Add(StateMachine.DrainValve3);
|
||||
|
||||
// Determine the tank emptying time (the maximum for all balances)
|
||||
int scaleDrainTime = 0;
|
||||
if (StateMachine.Scale1 != null && StateMachine.Scale1.EmptyTimeSec > scaleDrainTime)
|
||||
int totalDrainTime = 0;
|
||||
int maxDrainTimeFor2VlvTanks = 0;
|
||||
bool areTwoDrainPhases = false;
|
||||
foreach (IScaleOrTank tank in new IScaleOrTank[] { StateMachine.Tank1, StateMachine.Tank2, StateMachine.Tank3 })
|
||||
{
|
||||
scaleDrainTime = StateMachine.Scale1.EmptyTimeSec;
|
||||
}
|
||||
if (StateMachine.Scale2 != null && StateMachine.Scale2.EmptyTimeSec > scaleDrainTime)
|
||||
{
|
||||
scaleDrainTime = StateMachine.Scale2.EmptyTimeSec;
|
||||
}
|
||||
if (StateMachine.Scale3 != null && StateMachine.Scale3.EmptyTimeSec > scaleDrainTime)
|
||||
{
|
||||
scaleDrainTime = StateMachine.Scale3.EmptyTimeSec;
|
||||
}
|
||||
if (scaleDrainTime > 0)
|
||||
{
|
||||
startNew.AddOperation(new TimerOp(scaleDrainTime, remainingTime))
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(allDrainValves, null));
|
||||
}
|
||||
|
||||
startNew.EnterState();
|
||||
do
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Emptying_tank, remainingTime.Val / 60, "min", remainingTime.Val % 60, Strings.sec));
|
||||
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
bool stopDrainingCmd = e.Contains(Event.UiCmdStopDrainingTank1) || e.Contains(Event.UiCmdStopDrainingTank2) || e.Contains(Event.UiCmdStopDrainingTank3);
|
||||
if (stopDrainingCmd && !e.Contains(Event.ValvesBusy) && !e.Contains(Event.CameraBusy))
|
||||
if (tank != null && tank.DrainValve != null)
|
||||
{
|
||||
goto stop_draining;
|
||||
if (tank.EmptyTimeSec > totalDrainTime) totalDrainTime = tank.EmptyTimeSec;
|
||||
if (tank.DrainValve2 != null)
|
||||
{
|
||||
areTwoDrainPhases = true;
|
||||
if (tank.EmptyTimeSec > maxDrainTimeFor2VlvTanks) maxDrainTimeFor2VlvTanks = tank.EmptyTimeSec;
|
||||
|
||||
if (!secondHalfDrainValves.Contains(tank.DrainValve)) secondHalfDrainValves.Add(tank.DrainValve);
|
||||
if (!fullDrainValves.Contains(tank.DrainValve2)) fullDrainValves.Add(tank.DrainValve2);
|
||||
if (!allDrainValves.Contains(tank.DrainValve)) allDrainValves.Add(tank.DrainValve);
|
||||
if (!allDrainValves.Contains(tank.DrainValve2)) allDrainValves.Add(tank.DrainValve2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!fullDrainValves.Contains(tank.DrainValve)) fullDrainValves.Add(tank.DrainValve);
|
||||
if (!allDrainValves.Contains(tank.DrainValve)) allDrainValves.Add(tank.DrainValve);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (e.Contains(Event.TimerBusy) ||
|
||||
e.Contains(Event.CameraBusy) ||
|
||||
e.Contains(Event.ValvesBusy));
|
||||
|
||||
Bridge.OnActivity(this, Strings.Emptying_tank);
|
||||
|
||||
stop_draining:
|
||||
|
||||
State stopDraining = State.Create("MainSeq : Stop draining water tanks")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, allDrainValves))
|
||||
.EnterState();
|
||||
do
|
||||
///
|
||||
/// Drain the tanks, two phases if necessary
|
||||
///
|
||||
if (totalDrainTime > 0)
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
IntBox timerTime = new IntBox(); /// Contains remaining time in each phase
|
||||
int firstPhaseTime = maxDrainTimeFor2VlvTanks / 2;
|
||||
|
||||
State.Create(areTwoDrainPhases ? "MainSeq : Drain tanks - phase 1" : "MainSeq : Drain tanks")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new TimerOp(areTwoDrainPhases ? firstPhaseTime : totalDrainTime, timerTime))
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(fullDrainValves, null))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
int remTime = areTwoDrainPhases ? (timerTime.Val + totalDrainTime - firstPhaseTime) : timerTime.Val;
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Emptying_tank, remTime / 60, "min", remTime % 60, Strings.sec));
|
||||
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
bool stopDrainingCmd = e.Contains(Event.UiCmdStopDrainingTank1) || e.Contains(Event.UiCmdStopDrainingTank2) || e.Contains(Event.UiCmdStopDrainingTank3);
|
||||
if (stopDrainingCmd && !e.Contains(Event.ValvesBusy) && !e.Contains(Event.CameraBusy)) break;
|
||||
}
|
||||
while (e.Contains(Event.TimerBusy) || e.Contains(Event.CameraBusy) || e.Contains(Event.ValvesBusy));
|
||||
|
||||
if (areTwoDrainPhases)
|
||||
{
|
||||
State.Create("MainSeq : Drain tanks - phase 2")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new TimerOp(totalDrainTime - firstPhaseTime, timerTime))
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(secondHalfDrainValves, null))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
int remTime = timerTime.Val;
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Emptying_tank, remTime / 60, "min", remTime % 60, Strings.sec));
|
||||
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
bool stopDrainingCmd = e.Contains(Event.UiCmdStopDrainingTank1) || e.Contains(Event.UiCmdStopDrainingTank2) || e.Contains(Event.UiCmdStopDrainingTank3);
|
||||
if (stopDrainingCmd && !e.Contains(Event.ValvesBusy) && !e.Contains(Event.CameraBusy)) break;
|
||||
}
|
||||
while (e.Contains(Event.TimerBusy) || e.Contains(Event.CameraBusy) || e.Contains(Event.ValvesBusy));
|
||||
}
|
||||
|
||||
Bridge.OnActivity(this, Strings.Emptying_tank);
|
||||
|
||||
State stopDraining = State.Create("MainSeq : Stop draining water tanks")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, allDrainValves))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
|
||||
//--------------------------------------------------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Resetting_scales);
|
||||
@@ -270,9 +303,9 @@ namespace TBF.BenchControl.Sequences
|
||||
DoubleBox tara2 = new DoubleBox(0);
|
||||
DoubleBox tara3 = new DoubleBox(0);
|
||||
State.Create("MainSeq : Reset scales").AddOperation(checkUiOp)
|
||||
.AddOperation((StateMachine.Scale1 != null) ? StateMachine.Scale1.TaringOp(ref tara1) : null)
|
||||
.AddOperation((StateMachine.Scale2 != null) ? StateMachine.Scale2.TaringOp(ref tara2) : null)
|
||||
.AddOperation((StateMachine.Scale3 != null) ? StateMachine.Scale3.TaringOp(ref tara3) : null)
|
||||
.AddOperation((StateMachine.Tank1 is IScale) ? (StateMachine.Tank1 as IScale).TaringOp(ref tara1) : null)
|
||||
.AddOperation((StateMachine.Tank2 is IScale) ? (StateMachine.Tank2 as IScale).TaringOp(ref tara2) : null)
|
||||
.AddOperation((StateMachine.Tank3 is IScale) ? (StateMachine.Tank3 as IScale).TaringOp(ref tara3) : null)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -667,7 +700,7 @@ namespace TBF.BenchControl.Sequences
|
||||
!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
|
||||
out inPath, out benchPath, out outPath, out sensPath,
|
||||
out heatMetersPath,
|
||||
out transitionBefore, out transitionAfter,
|
||||
out transitionBefore, out transitionBetween, out transitionAfter,
|
||||
out errorMsg))
|
||||
{
|
||||
UiBridge.Bridge.OnError(this, errorMsg);
|
||||
@@ -694,7 +727,7 @@ namespace TBF.BenchControl.Sequences
|
||||
!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
|
||||
out inPath, out benchPath, out outPath, out sensPath,
|
||||
out heatMetersPath,
|
||||
out transitionBefore, out transitionAfter,
|
||||
out transitionBefore, out transitionBetween, out transitionAfter,
|
||||
out errorMsg))
|
||||
{
|
||||
UiBridge.Bridge.OnError(this, errorMsg);
|
||||
@@ -731,58 +764,70 @@ namespace TBF.BenchControl.Sequences
|
||||
/// e = testMethod.Execute(test, outerLoopMode, (outerLoopMode ? outerLoopCounter: repetNr));
|
||||
///
|
||||
Event rsltTransBefore = Event.Done;
|
||||
Event rsltTransBetween = Event.Done;
|
||||
Event rsltTransAfter = Event.Done;
|
||||
{
|
||||
int timeEstTransBefore = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionBefore) : 1;
|
||||
int timeEstTransBetween = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionBetween) : 1;
|
||||
int timeEstTransAfter = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionAfter) : 1;
|
||||
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, timeEstTransBefore, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, timeEstTransAfter, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetNr, Config.Entities.Progress.JustStarted));
|
||||
|
||||
if (testMethod.DoTransitions())
|
||||
{
|
||||
rsltTransBefore = Transition(transitionBefore, TransitionContext.BeforeTest); /// Transition or SetRoute - start of test
|
||||
log.InfoFormat("Test {0}: Transition({1}, BeforeTest) returned {2}", test.Name, (transitionBefore == null ? "null" : transitionBefore.Name), rsltTransBefore);
|
||||
}
|
||||
|
||||
bool currentTestFinished = true;
|
||||
if (rsltTransBefore == Event.Done)
|
||||
bool doOneMoreRepetition = false;
|
||||
do
|
||||
{
|
||||
do
|
||||
if (testMethod.DoTransitions())
|
||||
{
|
||||
log.InfoFormat("Test {0}: Execute(., {1}, {2})", test.Name, repetNr, isOuterLoopMode || repetNr == test.Repeats);
|
||||
e = testMethod.Execute(test, repetNr, isOuterLoopMode || repetNr == test.Repeats);
|
||||
|
||||
if (e.Contains(Event.MakeSecondPass) && testMethod is ITestMethodWith2ndPass)
|
||||
{
|
||||
deferredData.Add(new DeferredTestEvaluationData(test, repetNr, (testMethod as ITestMethodWith2ndPass).IntermediateData));
|
||||
}
|
||||
|
||||
currentTestFinished = (rsltTransBefore == Event.Done && !e.Contains(Event.Error)
|
||||
&& !e.Contains(Event.ConfigurationError)
|
||||
&& !e.Contains(Event.OpArgumentError)
|
||||
&& !e.Contains(Event.UiCmdStop));
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetNr, currentTestFinished ? Config.Entities.Progress.Completed
|
||||
: Config.Entities.Progress.Aborted));
|
||||
|
||||
if (e.Contains(Event.OuterLoopStart)) break; /// Do not repeat OuterLoopStart test in this loop
|
||||
if (currentTestFinished && !isOuterLoopMode) repetNr++;
|
||||
/// Make a transition before a test and before each test repetition
|
||||
rsltTransBefore = Transition(transitionBefore, TransitionContext.BeforeTest); /// Transition or SetRoute - start of test
|
||||
log.InfoFormat("Test {0}: Transition({1}, BeforeTest) returned {2}", test.Name, (transitionBefore == null ? "null" : transitionBefore.Name), rsltTransBefore);
|
||||
}
|
||||
while (currentTestFinished && !isOuterLoopMode && repetNr <= test.Repeats);
|
||||
if (rsltTransBefore != Event.Done) break;
|
||||
|
||||
if (currentTestFinished && !isOuterLoopMode && repetNr > test.Repeats) repetNr = 1; /// Reset repetNr
|
||||
log.InfoFormat("Test {0}: Execute(., {1}, {2})", test.Name, repetNr, isOuterLoopMode || repetNr == test.Repeats);
|
||||
e = testMethod.Execute(test, repetNr, isOuterLoopMode || repetNr == test.Repeats);
|
||||
|
||||
if (e.Contains(Event.MakeSecondPass) && testMethod is ITestMethodWith2ndPass)
|
||||
{
|
||||
deferredData.Add(new DeferredTestEvaluationData(test, repetNr, (testMethod as ITestMethodWith2ndPass).IntermediateData));
|
||||
}
|
||||
|
||||
currentTestFinished = (rsltTransBefore == Event.Done && !e.Contains(Event.Error)
|
||||
&& !e.Contains(Event.ConfigurationError)
|
||||
&& !e.Contains(Event.OpArgumentError)
|
||||
&& !e.Contains(Event.UiCmdStop));
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetNr, currentTestFinished ? Config.Entities.Progress.Completed
|
||||
: Config.Entities.Progress.Aborted));
|
||||
|
||||
if (e.Contains(Event.OuterLoopStart)) break; /// Do not repeat OuterLoopStart test in this loop
|
||||
if (currentTestFinished && !isOuterLoopMode) repetNr++;
|
||||
|
||||
doOneMoreRepetition = currentTestFinished && !isOuterLoopMode && (repetNr <= test.Repeats);
|
||||
|
||||
if (testMethod.DoTransitions() && doOneMoreRepetition)
|
||||
{
|
||||
/// Make a transition between two test repetitions
|
||||
rsltTransBetween = Transition(transitionBetween, TransitionContext.BetweenTests); /// Transition or SetRoute - start of test
|
||||
log.InfoFormat("Test {0}: Transition({1}, BetweenTests) returned {2}", test.Name, (transitionBetween == null ? "null" : transitionBetween.Name), rsltTransBetween);
|
||||
}
|
||||
}
|
||||
while ((rsltTransBetween == Event.Done) && doOneMoreRepetition);
|
||||
|
||||
if (currentTestFinished && !isOuterLoopMode && repetNr > test.Repeats) repetNr = 1; /// Reset repetNr
|
||||
|
||||
if (testMethod.DoTransitions())
|
||||
{
|
||||
/// Make a transition after the last test repetition
|
||||
TransitionContext endContext = currentTestFinished ? TransitionContext.AfterTest : TransitionContext.Stop;
|
||||
rsltTransAfter = Transition(transitionAfter, endContext); /// Transition or SetRoute - end of test
|
||||
log.InfoFormat("Test {0}: Transition({1}, {2}) returned {3}", test.Name, (transitionAfter == null ? "null" : transitionAfter.Name), endContext, rsltTransAfter);
|
||||
}
|
||||
}
|
||||
|
||||
if (rsltTransBefore == Event.Error || e.Contains(Event.Error))
|
||||
if (rsltTransBefore == Event.Error || rsltTransBetween == Event.Error|| e.Contains(Event.Error))
|
||||
{
|
||||
isOuterLoopMode = false;
|
||||
goto error;
|
||||
@@ -849,8 +894,8 @@ namespace TBF.BenchControl.Sequences
|
||||
StateMachine.GetPaths(dfrrdData.Test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
|
||||
out inPath, out benchPath, out outPath, out sensPath,
|
||||
out heatMetersPath,
|
||||
out transitionBefore, out transitionAfter,
|
||||
out errorMsg);
|
||||
out transitionBefore, out transitionBetween, out transitionAfter,
|
||||
out errorMsg);
|
||||
|
||||
ITestMethodWith2ndPass testMethod = TbfComponents.FindComponent(dfrrdData.Test.Method) as ITestMethodWith2ndPass;
|
||||
|
||||
@@ -896,7 +941,7 @@ namespace TBF.BenchControl.Sequences
|
||||
!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
|
||||
out inPath, out benchPath, out outPath, out sensPath,
|
||||
out heatMetersPath,
|
||||
out transitionBefore, out transitionAfter,
|
||||
out transitionBefore, out transitionBetween, out transitionAfter,
|
||||
out errorMsg))
|
||||
{
|
||||
UiBridge.Bridge.OnError(this, errorMsg);
|
||||
@@ -926,6 +971,7 @@ namespace TBF.BenchControl.Sequences
|
||||
Event rsltTransAfter = Event.Done;
|
||||
{
|
||||
int timeEstTransBefore = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionBefore) : 1;
|
||||
int timeEstTransBetween = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionBetween) : 1;
|
||||
int timeEstTransAfter = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionAfter) : 1;
|
||||
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, timeEstTransBefore, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, timeEstTransAfter, 0 });
|
||||
@@ -1265,10 +1311,9 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
State.Create("MainSeq : Select an activity")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((StateMachine.Scale1 != null) ? StateMachine.Scale1.ReadMassOp(ref mass1) : null)
|
||||
.AddOperation((StateMachine.Scale2 != null) ? StateMachine.Scale2.ReadMassOp(ref mass2) : null)
|
||||
.AddOperation((StateMachine.Scale3 != null) ? StateMachine.Scale3.ReadMassOp(ref mass3) : null)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation((StateMachine.Tank1 is IScale) ? (StateMachine.Tank1 as IScale).ReadMassOp(ref mass1) : null)
|
||||
.AddOperation((StateMachine.Tank2 is IScale) ? (StateMachine.Tank2 as IScale).ReadMassOp(ref mass2) : null)
|
||||
.AddOperation((StateMachine.Tank3 is IScale) ? (StateMachine.Tank3 as IScale).ReadMassOp(ref mass3) : null)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -1282,9 +1327,9 @@ namespace TBF.BenchControl.Sequences
|
||||
if (draining1 && e.Contains(Event.UiCmdStopDrainingTank1)) break;
|
||||
if (draining2 && e.Contains(Event.UiCmdStopDrainingTank2)) break;
|
||||
if (draining3 && e.Contains(Event.UiCmdStopDrainingTank3)) break;
|
||||
if (draining1 && StateMachine.Scale1.IsEmpty(mass1.Val)) break;
|
||||
if (draining2 && StateMachine.Scale2.IsEmpty(mass2.Val)) break;
|
||||
if (draining3 && StateMachine.Scale3.IsEmpty(mass3.Val)) break;
|
||||
if (draining1 && StateMachine.Tank1.IsEmpty()) break;
|
||||
if (draining2 && StateMachine.Tank2.IsEmpty()) break;
|
||||
if (draining3 && StateMachine.Tank3.IsEmpty()) break;
|
||||
|
||||
/// Quit the selection loop and leave MakeSelection()
|
||||
if (e.Contains(Event.UiCmdBreak) && context == MKSelContext.InsideProcedure) return Selection.Break;
|
||||
@@ -1317,19 +1362,19 @@ namespace TBF.BenchControl.Sequences
|
||||
IList<IValve> openValves = new List<IValve>();
|
||||
IList<IValve> closeValves = new List<IValve>();
|
||||
|
||||
if (draining1 && (StateMachine.Scale1.IsEmpty(mass1.Val) || e.Contains(Event.UiCmdStopDrainingTank1)))
|
||||
if (draining1 && (StateMachine.Tank1.IsEmpty() || e.Contains(Event.UiCmdStopDrainingTank1)))
|
||||
{
|
||||
draining1 = false;
|
||||
closeValves.Add(StateMachine.DrainValve1);
|
||||
stateText = stateText + "close tank 1, ";
|
||||
}
|
||||
else if (draining2 && (StateMachine.Scale2.IsEmpty(mass2.Val) || e.Contains(Event.UiCmdStopDrainingTank2)))
|
||||
else if (draining2 && (StateMachine.Tank2.IsEmpty() || e.Contains(Event.UiCmdStopDrainingTank2)))
|
||||
{
|
||||
draining2 = false;
|
||||
closeValves.Add(StateMachine.DrainValve2);
|
||||
stateText = stateText + "close tank 2, ";
|
||||
}
|
||||
else if (draining3 && (StateMachine.Scale3.IsEmpty(mass3.Val) || e.Contains(Event.UiCmdStopDrainingTank3)))
|
||||
else if (draining3 && (StateMachine.Tank3.IsEmpty() || e.Contains(Event.UiCmdStopDrainingTank3)))
|
||||
{
|
||||
draining3 = false;
|
||||
closeValves.Add(StateMachine.DrainValve3);
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace TBF.BenchControl.Sequences
|
||||
protected static BenchControl.HeatMetersPath heatMetersPath;
|
||||
|
||||
protected static TransitionSequence transitionBefore;
|
||||
protected static TransitionSequence transitionBetween;
|
||||
protected static TransitionSequence transitionAfter;
|
||||
|
||||
|
||||
@@ -181,107 +182,239 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
|
||||
|
||||
protected Event DrainTheTank(IValve drainValve, IScale scale)
|
||||
protected Event DrainTheTank(IScaleOrTank tank)
|
||||
{
|
||||
return DrainTheTank(drainValve, scale, new List<IOperation>());
|
||||
return DrainTheTank(tank, new List<IOperation>());
|
||||
}
|
||||
|
||||
protected Event DrainTheTank(IValve drainValve, IScale scale, IOperation extraOperation)
|
||||
protected Event DrainTheTank(IScaleOrTank tank, IOperation extraOperation)
|
||||
{
|
||||
IList<IOperation> extraOperations = new List<IOperation>();
|
||||
extraOperations.Add(extraOperation);
|
||||
return DrainTheTank(drainValve, scale, extraOperations);
|
||||
return DrainTheTank(tank, extraOperations);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Empties the tank: opens the emptying valve and measures the weight.
|
||||
/// </summary>
|
||||
/// <param name="drainValve">Valve to empty the tank</param>
|
||||
/// <param name="scale">Scale underneath the tank</param>
|
||||
/// <param name="tank">Scale underneath the tank</param>
|
||||
/// <returns>Event.Done or Event.Error</returns>
|
||||
protected Event DrainTheTank(IValve drainValve, IScale scale, IList<IOperation> extraOperations)
|
||||
protected Event DrainTheTank(IScaleOrTank tank, IList<IOperation> extraOperations)
|
||||
{
|
||||
bool stopped = false;
|
||||
IList<Event> e;
|
||||
bool stopped = false;
|
||||
Bridge.Bench2UI(ButtonsEtc.StopBtnEn);
|
||||
IntBox remainingTimeSec = new IntBox();
|
||||
|
||||
//------------------------------------------------------------
|
||||
Bridge.OnActivity(this, TBF.Resources.Strings.Emptying_tank);
|
||||
//------------------------------------------------------------
|
||||
|
||||
IList<Event> e;
|
||||
Bridge.Bench2UI(ButtonsEtc.StopBtnEn);
|
||||
if (tank.DrainValve2 == null)
|
||||
{
|
||||
///
|
||||
/// Draining with 1 valve 'DrainValve'
|
||||
///
|
||||
State.Create("SequenceBase : Open the drain valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(tank.DrainValve, null))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
IOperation timer = new TimerOp(tank.EmptyTimeSec, remainingTimeSec);
|
||||
do
|
||||
{
|
||||
State.Create("SequenceBase : Draining the tank")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(timer)
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e))
|
||||
{
|
||||
stopped = true;
|
||||
break;
|
||||
}
|
||||
if (e.Contains(Event.BalanceOverload)) { }; /// Tank should be emptying now
|
||||
///
|
||||
if (!(tank is IScale))
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}",
|
||||
Strings.Emptying_tank,
|
||||
remainingTimeSec.Val / 60, "min",
|
||||
remainingTimeSec.Val % 60, Strings.sec));
|
||||
}
|
||||
}
|
||||
while ((tank is IScale) && !e.Contains(Event.BalanceDone));
|
||||
|
||||
if (stopped) break;
|
||||
}
|
||||
while (!tank.IsEmpty() && !e.Contains(Event.TimerExpired));
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
/// Draining with 2 valves: 'DrainValve' is open in the 2nd half of time, 'DrainValve2' is open all the time
|
||||
///
|
||||
State.Create("SequenceBase : Open the drain valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(tank.DrainValve2, null))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
///
|
||||
/// 1st half
|
||||
///
|
||||
IOperation timer1 = new TimerOp(tank.EmptyTimeSec / 2, remainingTimeSec);
|
||||
do
|
||||
{
|
||||
State.Create("SequenceBase : Draining the tank")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(timer1)
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e))
|
||||
{
|
||||
stopped = true;
|
||||
break;
|
||||
}
|
||||
if (e.Contains(Event.BalanceOverload)) { }; /// Tank should be emptying now
|
||||
///
|
||||
if (!(tank is IScale))
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}",
|
||||
Strings.Emptying_tank,
|
||||
(remainingTimeSec.Val + tank.EmptyTimeSec / 2) / 60, "min",
|
||||
(remainingTimeSec.Val + tank.EmptyTimeSec / 2) % 60, Strings.sec));
|
||||
}
|
||||
}
|
||||
while ((tank is IScale) && !e.Contains(Event.BalanceDone));
|
||||
|
||||
State.Create("SequenceBase : Drain valve opened")
|
||||
if (stopped) break;
|
||||
}
|
||||
while (!tank.IsEmpty() && !e.Contains(Event.TimerExpired));
|
||||
|
||||
///
|
||||
/// 2nd half
|
||||
///
|
||||
if (!tank.IsEmpty())
|
||||
{
|
||||
State.Create("SequenceBase : Open the 2nd drain valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(tank.DrainValve, null))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
IOperation timer2 = new TimerOp(tank.EmptyTimeSec / 2, remainingTimeSec);
|
||||
do
|
||||
{
|
||||
State.Create("SequenceBase : Draining the tank")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(timer2)
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e))
|
||||
{
|
||||
stopped = true;
|
||||
break;
|
||||
}
|
||||
if (e.Contains(Event.BalanceOverload)) { }; /// Tank should be emptying now
|
||||
///
|
||||
if (!(tank is IScale))
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}",
|
||||
Strings.Emptying_tank,
|
||||
remainingTimeSec.Val / 60, "min",
|
||||
remainingTimeSec.Val % 60, Strings.sec));
|
||||
}
|
||||
|
||||
}
|
||||
while ((tank is IScale) && !e.Contains(Event.BalanceDone));
|
||||
|
||||
if (stopped) break;
|
||||
}
|
||||
while (!tank.IsEmpty() && !e.Contains(Event.TimerExpired));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Quit emptying, close the drain valve
|
||||
//
|
||||
State.Create("SequenceBase : Closing the drain valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(drainValve, null))
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, tank.DrainValve))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
while (!e.Contains(Event.ValvesSet) || ((tank is IScale) && !e.Contains(Event.BalanceDone)));
|
||||
|
||||
do
|
||||
if (tank.DrainValve2 != null)
|
||||
{
|
||||
State.Create("SequenceBase : Draining the tank")
|
||||
State.Create("SequenceBase : Closing the 2nd drain valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
.AddOperation((tank is IScale) ? (tank as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, tank.DrainValve2))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e))
|
||||
{
|
||||
stopped = true;
|
||||
break;
|
||||
}
|
||||
if (e.Contains(Event.BalanceOverload)) { }; /// Tank should be emptying now
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
|
||||
|
||||
if (stopped) break;
|
||||
while (!e.Contains(Event.ValvesSet) || ((tank is IScale) && !e.Contains(Event.BalanceDone)));
|
||||
}
|
||||
while (!scale.IsEmpty(Mass.Val));
|
||||
|
||||
//
|
||||
// Quit emptying
|
||||
//
|
||||
State.Create("SequenceBase : Closing the drain valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, drainValve))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
if (tank is IScale)
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
State.Create("SequenceBase : Updating the mass")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((tank as IScale).ReadMassOp(ref Mass))
|
||||
.AddOperation(new Operations.TimerOp(5))
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone) || !e.Contains(Event.TimerExpired));
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet) || !e.Contains(Event.BalanceDone));
|
||||
|
||||
|
||||
State.Create("SequenceBase : Updating the mass")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(new Operations.TimerOp(5))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperations(extraOperations)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone) || !e.Contains(Event.TimerExpired));
|
||||
|
||||
|
||||
if (stopped)
|
||||
return Event.UiCmdStop;
|
||||
@@ -297,6 +430,7 @@ namespace TBF.BenchControl.Sequences
|
||||
{
|
||||
PurgeBegin,
|
||||
BeforeTest,
|
||||
BetweenTests,
|
||||
AfterTest,
|
||||
PurgeEnd,
|
||||
Stop,
|
||||
@@ -335,12 +469,13 @@ namespace TBF.BenchControl.Sequences
|
||||
///
|
||||
switch (context)
|
||||
{
|
||||
case TransitionContext.PurgeBegin: message = Strings.Purging_i_n; break;
|
||||
case TransitionContext.BeforeTest: message = Strings.Test_start_sequence_i_n; break;
|
||||
case TransitionContext.AfterTest: message = Strings.Test_stop_sequence_i_n; break;
|
||||
case TransitionContext.PurgeEnd: message = Strings.Emptying_i_n; break;
|
||||
case TransitionContext.Stop: message = Strings.Test_stop_sequence_i_n; break;
|
||||
default: message = "Transition"; break;
|
||||
case TransitionContext.PurgeBegin: message = Strings.Purging_i_n; break;
|
||||
case TransitionContext.BeforeTest: message = Strings.Test_start_sequence_i_n; break;
|
||||
case TransitionContext.BetweenTests: message = Strings.Between_tests_sequence_i_n; break;
|
||||
case TransitionContext.AfterTest: message = Strings.Test_stop_sequence_i_n; break;
|
||||
case TransitionContext.PurgeEnd: message = Strings.Emptying_i_n; break;
|
||||
case TransitionContext.Stop: message = Strings.Test_stop_sequence_i_n; break;
|
||||
default: message = "Transition"; break;
|
||||
}
|
||||
|
||||
if (transitionSequence == null)
|
||||
@@ -357,7 +492,6 @@ namespace TBF.BenchControl.Sequences
|
||||
State.Create("SequenceBase : Transition : TestEnd - Default action")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen,
|
||||
StateMachine.DefaultValvesClose))
|
||||
.EnterState();
|
||||
@@ -472,7 +606,6 @@ namespace TBF.BenchControl.Sequences
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(conditionOperation)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(Utils.ValvesOpen(step), Utils.ValvesClose(step)));
|
||||
for (int j = 0; j <= i; j++)
|
||||
{
|
||||
@@ -495,7 +628,6 @@ namespace TBF.BenchControl.Sequences
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(conditionOperation)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(Utils.ValvesOpen(step), Utils.ValvesClose(step)))
|
||||
.AddOperation(new TimerOp(delay));
|
||||
for (int j = 0; j <= lastStartedRV; j++)
|
||||
@@ -542,7 +674,6 @@ namespace TBF.BenchControl.Sequences
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(conditionOperation)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(Utils.ValvesOpen(step), Utils.ValvesClose(step)));
|
||||
for (int j = first; j <= lastStartedRV; j++)
|
||||
{
|
||||
@@ -577,7 +708,6 @@ namespace TBF.BenchControl.Sequences
|
||||
///
|
||||
State.Create("SequenceBase.Transition() : Test stopped -> Stopping the pump")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, inPath.Pump))
|
||||
.EnterState();
|
||||
do
|
||||
@@ -595,7 +725,6 @@ namespace TBF.BenchControl.Sequences
|
||||
State.Create("SequenceBase : Transition : TestStart - Default action")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard
|
||||
.SetValvesOp(GenericDevices.ValveBase.Merge(inPath.ValvesOpen, benchPath.ValvesOpen, outPath.ValvesOpen),
|
||||
GenericDevices.ValveBase.Merge(inPath.ValvesClose, benchPath.ValvesClose, outPath.ValvesClose)))
|
||||
@@ -740,18 +869,17 @@ namespace TBF.BenchControl.Sequences
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
|
||||
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
|
||||
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
|
||||
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
|
||||
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(realTest ? outPath.Scale.ReadMassOp(ref Mass) : null)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
|
||||
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
|
||||
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
|
||||
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
|
||||
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation((realTest && (outPath.Scale is IScale)) ? (outPath.Scale as IScale).ReadMassOp(ref Mass) : null)
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
|
||||
: null)
|
||||
@@ -766,7 +894,7 @@ namespace TBF.BenchControl.Sequences
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
if (e.Contains(Event.MeasurementCompleted) || e.Contains(Event.Next)) return Event.MeasurementCompleted;
|
||||
}
|
||||
while ( (realTest && !e.Contains(Event.BalanceDone)) ||
|
||||
while ( (realTest && (outPath.Scale is IScale) && !e.Contains(Event.BalanceDone)) ||
|
||||
!e.Contains(Event.ReadAllRegistersDone));
|
||||
|
||||
return Event.Done;
|
||||
@@ -929,7 +1057,7 @@ namespace TBF.BenchControl.Sequences
|
||||
sb.Append(";"); sb.Append(tstRslt.FlowMin); /// BG Qm [kg/h]
|
||||
sb.Append(";"); sb.Append(tstRslt.FlowVolume); /// BH Qv [l/h]
|
||||
sb.Append(";"); sb.Append(tstRslt.VolumeCTV); /// BI Vet . . . komercne prava hodnota - podla vahy
|
||||
sb.Append(";"); sb.Append(tstRslt.VolumeMaster); /// BJ Velm . . . . objem podla etalonu
|
||||
sb.Append(";"); sb.Append(tstRslt.VolumeMaster); /// BJ Velm . . . . objem podla etalonu (Prolonged: objem do vahy podla impulzov do vahy)
|
||||
sb.Append(";"); sb.Append(" "); /// BK Vmass . . . objem podla druheho etalonu / prietokomeru pred tratou (teraz vynechavame)
|
||||
sb.Append(";"); sb.Append(tstRslt.TestTime); /// BL t
|
||||
sb.Append(";"); sb.Append(tstRslt.ErrorMaster); /// BM Eelm . . . chyba etalonu voci komercne pravej hodnote
|
||||
@@ -946,13 +1074,13 @@ namespace TBF.BenchControl.Sequences
|
||||
sb.Append(";"); sb.Append(tstRslt.TempDownMax); /// BV [°C]
|
||||
sb.Append(";"); sb.Append(tstRslt.TempUpMin); /// BW [°C]
|
||||
sb.Append(";"); sb.Append(tstRslt.TempDownMin); /// BX [°C]
|
||||
sb.Append(";"); sb.Append(isPMaxTest ? tstRslt.TestTime : 0); /// BY [s] Duration of the pressure test
|
||||
sb.Append(";"); sb.Append(isPMaxTest ? tstRslt.TestTime : 0); /// BY [s] Duration of the pressure test
|
||||
sb.Append(";"); sb.AppendFormat("{0:F1}", Units.ConvertTo(Unit.C, tstRslt.AmbTempEnd)); /// BZ [°C]
|
||||
sb.Append(";"); sb.AppendFormat("{0:F0}", Units.ConvertTo(Unit.mbar, tstRslt.AmbPressEnd)); /// CA [mbar]
|
||||
sb.Append(";"); sb.AppendFormat("{0:F1}", Units.ConvertTo(Unit.RPct, tstRslt.AmbHumiEnd)); /// CB [R%]
|
||||
|
||||
sb.Append(";"); sb.Append(tstRslt.PulsesMaster); /// CC Celkovy pocet et. pulzov skusky
|
||||
sb.Append(";"); sb.Append(" "); /// CD - '' - pre druhy
|
||||
sb.Append(";"); sb.Append(tstRslt.PulsesMaster); /// CC Celkovy pocet et. pulzov skusky (Prolonged : do vahy)
|
||||
sb.Append(";"); sb.Append((tstRslt.TotalPulsesMstr != 0) ? tstRslt.TotalPulsesMstr.ToString() : " "); /// CD - '' - pre druhy (Prolonged : celkovy pocet)
|
||||
for (int i = 0; i < ProcessData.BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
if (ProcessData.BatchRslts.WaterMeters[i] != null)
|
||||
@@ -989,8 +1117,10 @@ namespace TBF.BenchControl.Sequences
|
||||
#endif
|
||||
sb.Append(";"); sb.Append(isCamera ? mtrRslt.VolumeStart * mtrRslt.PulsesPerLiter : 0); /// CQ WM Phi_start - pri hodnotach z kamery
|
||||
sb.Append(";"); sb.Append(isCamera ? mtrRslt.VolumeEnd * mtrRslt.PulsesPerLiter : 0); /// CR WM Phi_end - ' ' -
|
||||
sb.Append(";"); sb.Append(isCamera ? mtrRslt.TimestampStart : 0); /// CS WM Time_start - ' ' -
|
||||
sb.Append(";"); sb.Append(isCamera ? mtrRslt.TimestampEnd : 0); /// CT WM Time_end - ' ' -
|
||||
|
||||
sb.Append(";"); sb.Append(mtrRslt.TimestampStart); /// CS WM Time_start - ' ' -
|
||||
sb.Append(";"); sb.Append(mtrRslt.TimestampEnd); /// CT WM Time_end - ' ' -
|
||||
|
||||
sb.Append(";"); sb.Append(isCamera ? mtrRslt.PulsesPerLiter : 0); /// CU WM Degree per liter
|
||||
|
||||
sb.Append(";"); sb.Append(0); /// CV Analog out 1 (max mA)
|
||||
|
||||
@@ -156,10 +156,10 @@ namespace TBF.BenchControl.Sequences
|
||||
sum += filteredValue;
|
||||
if (count == 0) first = filteredValue;
|
||||
last = filteredValue;
|
||||
if (value < min) min = filteredValue;
|
||||
if (value > max) max = filteredValue;
|
||||
if (filteredValue < min) min = filteredValue;
|
||||
if (filteredValue > max) max = filteredValue;
|
||||
|
||||
plotter.UpdateGraph(graphId, (float)(count + skippedSamplesCount + FilterSize / 2), (float)value);
|
||||
plotter.UpdateGraph(graphId, (float)(count + skippedSamplesCount + FilterSize / 2), (float)filteredValue);
|
||||
|
||||
count++;
|
||||
}
|
||||
@@ -183,15 +183,15 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
|
||||
/// Shift values in FIFO buffer, calculate the sum
|
||||
double sum = 0;
|
||||
double sum1 = 0;
|
||||
for (int i = FilterSize - 1; i > 0; i--)
|
||||
{
|
||||
fifo[i] = fifo[i - 1];
|
||||
sum += fifo[i];
|
||||
sum1 += fifo[i];
|
||||
}
|
||||
/// Insert the current value into FIFO, add it to the sum
|
||||
fifo[0] = value;
|
||||
sum += value;
|
||||
sum1 += value;
|
||||
|
||||
|
||||
fifoCount++;
|
||||
@@ -220,7 +220,7 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
else
|
||||
{
|
||||
filteredValue = sum / FilterSize;
|
||||
filteredValue = sum1 / FilterSize;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -45,9 +45,9 @@ namespace TBF.BenchControl
|
||||
/// Public components
|
||||
public static Elde.ControlBoardDev ControlBoard;
|
||||
public static GenericDevices.IAmbient Ambient;
|
||||
public static GenericDevices.IScale Scale1;
|
||||
public static GenericDevices.IScale Scale2;
|
||||
public static GenericDevices.IScale Scale3;
|
||||
public static GenericDevices.IScaleOrTank Tank1;
|
||||
public static GenericDevices.IScaleOrTank Tank2;
|
||||
public static GenericDevices.IScaleOrTank Tank3;
|
||||
public static GenericDevices.IValve DrainValve1;
|
||||
public static GenericDevices.IValve DrainValve2;
|
||||
public static GenericDevices.IValve DrainValve3;
|
||||
@@ -213,7 +213,7 @@ namespace TBF.BenchControl
|
||||
|
||||
/// Find all balances (to initialize tank capacities in the control board)
|
||||
/// Find the control board
|
||||
IList<IScale> balances = new List<IScale>();
|
||||
IList<IScaleOrTank> tanks = new List<IScaleOrTank>();
|
||||
SequenceBase.FlowMeters = new List<IFlowMeter>();
|
||||
SequenceBase.RegulValves = new List<IRegulValve>();
|
||||
SequenceBase.PumpsWithFM = new List<IPumpFM>();
|
||||
@@ -241,14 +241,14 @@ namespace TBF.BenchControl
|
||||
if (cmpnt is IWaterMeter) SequenceBase.WaterMeters.Add(cmpnt as IWaterMeter);
|
||||
if (cmpnt is ICamera) SequenceBase.Cameras.Add(cmpnt as ICamera);
|
||||
if (cmpnt is GenericDevices.IAmbient) Ambient = cmpnt as GenericDevices.IAmbient;
|
||||
if (cmpnt is IScale)
|
||||
if (cmpnt is IScaleOrTank)
|
||||
{
|
||||
IScale scale = cmpnt as IScale;
|
||||
balances.Add(scale);
|
||||
IScaleOrTank tank = cmpnt as IScaleOrTank;
|
||||
tanks.Add(tank);
|
||||
|
||||
if (scale.ScaleNr == 0) Scale1 = scale;
|
||||
else if (scale.ScaleNr == 1) Scale2 = scale;
|
||||
else if (scale.ScaleNr == 2) Scale3 = scale;
|
||||
if (tank.ScaleNr == 0) Tank1 = tank;
|
||||
else if (tank.ScaleNr == 1) Tank2 = tank;
|
||||
else if (tank.ScaleNr == 2) Tank3 = tank;
|
||||
}
|
||||
|
||||
Elde.Valve.Valve eldeValve = (cmpnt as Elde.Valve.Valve);
|
||||
@@ -258,8 +258,8 @@ namespace TBF.BenchControl
|
||||
}
|
||||
|
||||
/// Create an array with tank capacities
|
||||
double[] tankCapacities = new double[balances.Count];
|
||||
for (int i = 0; i < tankCapacities.Length; i++) tankCapacities[i] = balances[i].Capacity;
|
||||
double[] tankCapacities = new double[tanks.Count];
|
||||
for (int i = 0; i < tankCapacities.Length; i++) tankCapacities[i] = tanks[i].Capacity;
|
||||
|
||||
/// Pre-initialize the control board (= buffer the arguments ctrlBrdComponent, tankCapacities)
|
||||
if (ControlBoard != null)
|
||||
@@ -319,27 +319,27 @@ namespace TBF.BenchControl
|
||||
}
|
||||
}
|
||||
|
||||
if (cmpnt is IScale)
|
||||
if (cmpnt is IScaleOrTank)
|
||||
{
|
||||
IScale scale = cmpnt as IScale;
|
||||
IScaleOrTank tank = cmpnt as IScaleOrTank;
|
||||
|
||||
if (scale.ScaleNr == 0)
|
||||
if (tank.ScaleNr == 0)
|
||||
{
|
||||
DrainValve1 = scale.DrainValve;
|
||||
DrainValve1 = tank.DrainValve;
|
||||
log.WarnFormat("InitializeBoardEtc() ... Scale1={0} Draining valve1={1}",
|
||||
scale.Name, (DrainValve1 != null) ? DrainValve1.Name : "---");
|
||||
tank.Name, (DrainValve1 != null) ? DrainValve1.Name : "---");
|
||||
}
|
||||
else if (scale.ScaleNr == 1)
|
||||
else if (tank.ScaleNr == 1)
|
||||
{
|
||||
DrainValve2 = scale.DrainValve;
|
||||
DrainValve2 = tank.DrainValve;
|
||||
log.WarnFormat("InitializeBoardEtc() ... Scale2={0} Draining valve2={1}",
|
||||
scale.Name, (DrainValve2 != null) ? DrainValve2.Name : "---");
|
||||
tank.Name, (DrainValve2 != null) ? DrainValve2.Name : "---");
|
||||
}
|
||||
else if (scale.ScaleNr == 2)
|
||||
else if (tank.ScaleNr == 2)
|
||||
{
|
||||
DrainValve3 = scale.DrainValve;
|
||||
DrainValve3 = tank.DrainValve;
|
||||
log.WarnFormat("InitializeBoardEtc() ... Scale3={0} Draining valve3={1}",
|
||||
scale.Name, (DrainValve3 != null) ? DrainValve3.Name : "---");
|
||||
tank.Name, (DrainValve3 != null) ? DrainValve3.Name : "---");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -602,6 +602,7 @@ namespace TBF.BenchControl
|
||||
out MetersPath pmtrs,
|
||||
out HeatMetersPath phmtrs,
|
||||
out TransitionSequence transitionBefore,
|
||||
out TransitionSequence transitionBetween,
|
||||
out TransitionSequence transitionAfter,
|
||||
out string errorMsg)
|
||||
{
|
||||
@@ -610,7 +611,8 @@ namespace TBF.BenchControl
|
||||
pout = null;
|
||||
phmtrs = null;
|
||||
transitionBefore = null;
|
||||
transitionAfter = null;
|
||||
transitionBetween = null;
|
||||
transitionAfter = null;
|
||||
|
||||
foreach (var path in feedingPaths)
|
||||
{
|
||||
@@ -654,7 +656,8 @@ namespace TBF.BenchControl
|
||||
foreach (var tr in TransitionSequences)
|
||||
{
|
||||
if (tr.Name == test.RelTransBefore) transitionBefore = tr;
|
||||
if (tr.Name == test.TransitionAfter) transitionAfter = tr;
|
||||
if (tr.Name == test.RelTransBetween) transitionBetween = tr;
|
||||
if (tr.Name == test.TransitionAfter) transitionAfter = tr;
|
||||
}
|
||||
|
||||
if (pout.Scale == null)
|
||||
|
||||
@@ -57,19 +57,26 @@ namespace TBF.BenchControl
|
||||
Factories.Add(new TestMethods.FixedStartMassCollection.Single.Factory());
|
||||
Factories.Add(new TestMethods.FixedStartMassCollection.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FixedStartMassCollection.HeatMeters.Factory());
|
||||
Factories.Add(new TestMethods.FixedStartTankCollection.Single.Factory());
|
||||
Factories.Add(new TestMethods.FixedStartTankCollection.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStart.Single.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStart.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStart.HeatMeters.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollection.Single.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollection.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollection.HeatMeters.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollComparative.Single.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollComparative.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollComparative.HeatMeters.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollProlonged.Single.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollProlonged.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartMassCollProlonged.HeatMeters.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartFirstRepetWithMassColl.Single.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartFirstRepetWithMassColl.Compound.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartFirstRepetWithMassColl.HeatMeters.Factory());
|
||||
Factories.Add(new TestMethods.GrabImage.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartTankCollection.Single.Factory());
|
||||
Factories.Add(new TestMethods.FlyingStartTankCollection.Compound.Factory());
|
||||
Factories.Add(new TestMethods.GrabImage.Factory());
|
||||
Factories.Add(new TestMethods.LeakTest.TestMethodFactory());
|
||||
Factories.Add(new TestMethods.LiveStream.Factory());
|
||||
Factories.Add(new TestMethods.OuterLoop.Start.Factory());
|
||||
@@ -85,7 +92,7 @@ namespace TBF.BenchControl
|
||||
Factories.Add(new Ambient.Greco.Factory());
|
||||
Factories.Add(new Hart.Common.Factory());
|
||||
Factories.Add(new Hart.Nivotrack.Factory());
|
||||
Factories.Add(new Keithley.Multimeter_2010_RS232.Factory()); /// Keithley.Multimeter_2010_RS232
|
||||
Factories.Add(new Keithley.Multimeter_2010_RS232.Factory()); /// Keithley.Multimeter_2010_RS232
|
||||
Factories.Add(new Keithley.TempMeter.Factory()); /// Keithley.TempMeter
|
||||
Factories.Add(new MettlerToledo.Standard.BalanceFactory()); /// MettlerToledo Balance
|
||||
Factories.Add(new MettlerToledo.Standard.BalanceOldFactory()); /// MettlerToledoBalanceOld
|
||||
@@ -151,8 +158,9 @@ namespace TBF.BenchControl
|
||||
Factories.Add(new Elde.TempMeterMeret.Factory()); /// Meret temp. meter connected to control board Modbus
|
||||
Factories.Add(new Elde.Valve.ValveFactory());
|
||||
Factories.Add(new Elde.ValveEx.ValveFactory());
|
||||
Factories.Add(new Various.ErrorFlags.Factory());
|
||||
Factories.Add(new WaterMeters.Munich.WaterMeterFactory()); /// 'WaterMeters.Munich'
|
||||
Factories.Add(new Various.ErrorFlags.Factory());
|
||||
Factories.Add(new Various.TankWithLevelMsrmnt.Factory());
|
||||
Factories.Add(new WaterMeters.Munich.WaterMeterFactory()); /// 'WaterMeters.Munich'
|
||||
Factories.Add(new WaterMeters.WaterMeter.WaterMeterFactory()); /// 'WaterMeter'
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
///
|
||||
State.Create("Adjustment : Starting the pump")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
|
||||
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
|
||||
.EnterState();
|
||||
@@ -132,7 +131,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -151,7 +149,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -168,7 +165,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ using log4net;
|
||||
using TBF.BenchControl;
|
||||
using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
{
|
||||
@@ -22,57 +23,35 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
CombinedWithDetTestParams testParams,
|
||||
Config.Entities.DebugMode debugLevel)
|
||||
{
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
if (debugLevel == Config.Entities.DebugMode.Simulate)
|
||||
{
|
||||
return Simulate(test, repetitionNr, isLastRepetition, testParams);
|
||||
}
|
||||
|
||||
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
|
||||
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
|
||||
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
|
||||
IScale scale = outPath.Scale as IScale;
|
||||
if (scale == null)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Missing_a_scale);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
|
||||
if (test.Part < 1 || test.Part > Config.Data.CompoundWMsCount)
|
||||
{
|
||||
UiBridge.Bridge.OnError(this, string.Format("Test 'Part' should be 1 .. {0}", Config.Data.CompoundWMsCount));
|
||||
IList<Event> retv = new List<Event>(1);
|
||||
retv.Add(Event.ConfigurationError);
|
||||
return retv;
|
||||
}
|
||||
|
||||
if (debugLevel == Config.Entities.DebugMode.Simulate)
|
||||
{
|
||||
///
|
||||
/// Test method simulation
|
||||
///
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (test.Name.ToLower().Contains("rise") || test.Name.ToLower().Contains("steig"))
|
||||
{
|
||||
MakeSimulatedCompound(test, 1, 0, 0.7f, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeSimulatedCompound(test, 1, 0, 0.7f, 0.9f);
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, 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, string.Format("Simulating {0}", test.Name));
|
||||
//------------------------------------------------
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Simulating {1}", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retListSim = new List<Event>(1);
|
||||
retListSim.Add(TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done);
|
||||
return retListSim;
|
||||
e.Add(Event.ConfigurationError);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
|
||||
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
|
||||
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
|
||||
|
||||
/// Specific for combined meters
|
||||
int[] lastWMPulses = new int[2 * Config.Data.CompoundWMsCount];
|
||||
@@ -140,7 +119,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
//--------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Mesuring mass of water in the tank", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -151,14 +130,14 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
|
||||
double estimatedEndMass = Mass.Val + test.Volume;
|
||||
if (estimatedEndMass < outPath.Scale.Capacity * Constants.TankFullFactor)
|
||||
if (estimatedEndMass < scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
goto switching_flow_detection; /// Enough room in the tank -> skip emptying
|
||||
}
|
||||
}
|
||||
|
||||
/// Empty the water tank
|
||||
switch (DrainTheTank(outPath.Scale.DrainValve, outPath.Scale))
|
||||
switch (DrainTheTank(scale))
|
||||
{
|
||||
case Event.Error: goto error;
|
||||
case Event.UiCmdStop: goto stopTest;
|
||||
@@ -485,7 +464,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
State.Create(Strings.Measure_the_mass)
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(outPath.Scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -574,7 +553,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
//------------------------------------------------
|
||||
State.Create(Strings.Measure_the_mass)
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.Scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -597,7 +576,6 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
|
||||
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -639,19 +617,18 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
|
||||
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.MassStartRaw = StartMass.Val;
|
||||
tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections);
|
||||
tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, scale.Corrections);
|
||||
tstRslt.MassEndRaw = EndMass.Val;
|
||||
tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections);
|
||||
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h]
|
||||
tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, scale.Corrections);
|
||||
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h]
|
||||
tstRslt.Buoyancy = Config.Formulas.Buoyancy();
|
||||
double density = Config.Formulas.WaterDensityFromTemp((tstRslt.TempUpMean + tstRslt.TempDownMean) / 2.0, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature);
|
||||
tstRslt.VolumeCTV = 1000.0 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / density; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
|
||||
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
|
||||
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
|
||||
tstRslt.VolumeCTV = 1000 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine; /// [l] commercially true volume
|
||||
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
|
||||
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
|
||||
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
|
||||
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
|
||||
/// Calculated master pulses per liter
|
||||
/// Calculated master pulses per liter
|
||||
tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
|
||||
|
||||
tstRslt.FlowMean = (float)RefFlowStat.Average;
|
||||
@@ -728,7 +705,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
@@ -815,5 +792,42 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
||||
retval3.Add(Event.Error);
|
||||
return retval3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IList<Event> Simulate(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
|
||||
CombinedWithDetTestParams testParams)
|
||||
{
|
||||
///
|
||||
/// Test method simulation
|
||||
///
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (test.Name.ToLower().Contains("rise") || test.Name.ToLower().Contains("steig"))
|
||||
{
|
||||
MakeSimulatedCompound(test, 1, 0, 0.7f, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeSimulatedCompound(test, 1, 0, 0.7f, 0.9f);
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, 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, string.Format("Simulating {0}", test.Name));
|
||||
//------------------------------------------------
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Simulating {1}", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
IList<Event> e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retListSim = new List<Event>(1);
|
||||
retListSim.Add(TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done);
|
||||
return retListSim;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,6 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
|
||||
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
|
||||
.EnterState();
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.IO;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
{
|
||||
@@ -30,13 +31,43 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
HeatMeters.TestParams heatMetersTestParams,
|
||||
Config.Entities.DebugMode debugLevel)
|
||||
{
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
Event retVal = Event.Done;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
|
||||
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
IScale scale = outPath.Scale as IScale;
|
||||
if (scale == null)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Missing_a_scale);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
|
||||
rangeIx = -1; /// Indicates invalid range
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
|
||||
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
|
||||
{
|
||||
rangeIx = r;
|
||||
}
|
||||
}
|
||||
|
||||
if (rangeIx == -1)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
Event retVal = Event.Done;
|
||||
|
||||
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
|
||||
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
|
||||
@@ -50,28 +81,6 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
|
||||
rangeIx = -1; /// Indicates invalid range
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
|
||||
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
|
||||
{
|
||||
rangeIx = r;
|
||||
}
|
||||
}
|
||||
|
||||
if (rangeIx == -1)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTestWOStoppingDivGateEtc;
|
||||
}
|
||||
}
|
||||
|
||||
//====================================
|
||||
loop:
|
||||
/// Start the test, initialize test results
|
||||
@@ -98,7 +107,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -114,12 +123,12 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
///
|
||||
/// Skip draining in case there is enough room in the tank
|
||||
///
|
||||
if (test.DoDraining || (Mass.Val + test.Volume >= outPath.Scale.Capacity * Constants.TankFullFactor))
|
||||
if (test.DoDraining || (Mass.Val + test.Volume >= scale.Capacity * Constants.TankFullFactor))
|
||||
{
|
||||
///
|
||||
/// Drain the water tank
|
||||
///
|
||||
switch (DrainTheTank(outPath.Scale.DrainValve, outPath.Scale, heatMetersPromptOp))
|
||||
switch (DrainTheTank(scale, heatMetersPromptOp))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -130,10 +139,9 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.Scale.DrainValve))
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -158,7 +166,6 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
|
||||
@@ -181,7 +188,6 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -201,7 +207,6 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -219,7 +224,6 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -389,8 +393,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -415,7 +418,6 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
|
||||
.EnterState();
|
||||
do
|
||||
@@ -585,7 +587,6 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -697,7 +698,6 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -723,8 +723,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
@@ -1083,7 +1082,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using TBF.BenchControl;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
{
|
||||
@@ -28,11 +29,42 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
/// </returns>
|
||||
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition)
|
||||
{
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
Event retVal = Event.Done;
|
||||
IScale scale = outPath.Scale as IScale;
|
||||
if (scale == null)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Missing_a_scale);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
|
||||
rangeIx = -1; /// Indicates invalid range
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
|
||||
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
|
||||
{
|
||||
rangeIx = r;
|
||||
}
|
||||
}
|
||||
|
||||
if (rangeIx == -1)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
Event retVal = Event.Done;
|
||||
|
||||
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
|
||||
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
|
||||
@@ -45,28 +77,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
|
||||
rangeIx = -1; /// Indicates invalid range
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
|
||||
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
|
||||
{
|
||||
rangeIx = r;
|
||||
}
|
||||
}
|
||||
|
||||
if (rangeIx == -1)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTest;
|
||||
}
|
||||
}
|
||||
|
||||
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
//====================================
|
||||
@@ -84,7 +94,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
///
|
||||
State.Create("FixedStartAdvanced : Measuring mass of water in the tank")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -100,12 +110,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
///
|
||||
/// Skip draining in case there is enough room in the tank
|
||||
///
|
||||
if (test.DoDraining || (Mass.Val + test.Volume >= outPath.Scale.Capacity * Constants.TankFullFactor))
|
||||
if (test.DoDraining || (Mass.Val + test.Volume >= scale.Capacity * Constants.TankFullFactor))
|
||||
{
|
||||
///
|
||||
/// Drain the water tank
|
||||
///
|
||||
switch (DrainTheTank(outPath.Scale.DrainValve, outPath.Scale))
|
||||
switch (DrainTheTank(scale))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -204,8 +214,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
State.Create("FixedStartAdvanced : Closing the start/stop valve before the fixed start test")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -303,8 +312,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(outPath.Scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -339,8 +347,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
State.Create("FixedStartAdvanced : Opening the start/stop valve at the beginning of the fixed start test")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -402,8 +409,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
State.Create("FixedStartAdvanced : Closing the start/stop valve at the end of the fixed start test")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -422,8 +428,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
@@ -449,8 +454,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(outPath.Scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -476,9 +480,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
while (!e.Contains(Event.PreviousStopped));
|
||||
|
||||
|
||||
double massStart = Config.Formulas.CorrectedValue(StartMass.Val, outPath.Scale.Corrections);
|
||||
double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, outPath.Scale.Corrections);
|
||||
double densityOut = Config.Formulas.WaterDensityFromTemp(TempDownStat.Average, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature);
|
||||
double massStart = Config.Formulas.CorrectedValue(StartMass.Val, scale.Corrections);
|
||||
double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, scale.Corrections);
|
||||
double densityOut = Config.Formulas.WaterDensityFromTempPress((TempUpStat.Average + TempDownStat.Average) / 2,
|
||||
(PressUpStat.Average + PressDownStat.Average) / 2,
|
||||
Program.LocalSettings.RealDensity,
|
||||
Program.LocalSettings.AtTemperature); /// [kg/m3] ///
|
||||
double buoyancy = Config.Formulas.Buoyancy();
|
||||
double volumeCTV = 1000.0 * buoyancy * (massEnd - massStart) / densityOut;
|
||||
|
||||
@@ -595,7 +602,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
|
||||
+62
-63
@@ -10,6 +10,7 @@ using TBF.BenchControl;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
{
|
||||
@@ -34,13 +35,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
Config.Entities.DebugMode debugLevel,
|
||||
out IntermediateData intermediateData)
|
||||
{
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
Event retVal = Event.Done;
|
||||
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
|
||||
intermediateData = new IntermediateData
|
||||
{
|
||||
Compound = compound,
|
||||
@@ -48,6 +42,39 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
TestPart = test.Part,
|
||||
};
|
||||
|
||||
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
|
||||
IScale scale = outPath.Scale as IScale;
|
||||
if (scale == null)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Missing_a_scale);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
|
||||
rangeIx = -1; /// Indicates invalid range
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
|
||||
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
|
||||
{
|
||||
rangeIx = r;
|
||||
}
|
||||
}
|
||||
|
||||
if (rangeIx == -1)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
GenericDevices.IHasWMStatesForm dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
|
||||
if (!(dataEntryCmpnt is GenericDevices.IDataEntryForCamera))
|
||||
{
|
||||
@@ -56,6 +83,18 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
return e;
|
||||
}
|
||||
|
||||
if (test.Volume >= scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
|
||||
e.Add(Event.UiCmdStop);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
Event retVal = Event.Done;
|
||||
|
||||
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
|
||||
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
|
||||
@@ -68,37 +107,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
|
||||
rangeIx = -1; /// Indicates invalid range
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
|
||||
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
|
||||
{
|
||||
rangeIx = r;
|
||||
}
|
||||
}
|
||||
|
||||
if (rangeIx == -1)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTestWOTransitionAfter;
|
||||
}
|
||||
}
|
||||
|
||||
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
|
||||
if (test.Volume >= outPath.Scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
|
||||
e.Add(Event.ConfigurationError);
|
||||
return e;
|
||||
}
|
||||
|
||||
//====================================
|
||||
loop:
|
||||
@@ -127,7 +135,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -143,12 +151,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
///
|
||||
/// Skip draining in case there is enough room in the tank
|
||||
///
|
||||
if (test.DoDraining || (Mass.Val + test.Volume >= outPath.Scale.Capacity * Constants.TankFullFactor))
|
||||
if (test.DoDraining || (Mass.Val + test.Volume >= scale.Capacity * Constants.TankFullFactor))
|
||||
{
|
||||
///
|
||||
/// Drain the water tank
|
||||
///
|
||||
switch (DrainTheTank(outPath.Scale.DrainValve, outPath.Scale, heatMetersPromptOp))
|
||||
switch (DrainTheTank(scale, heatMetersPromptOp))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -159,10 +167,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.Scale.DrainValve))
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -187,7 +194,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
|
||||
@@ -210,7 +216,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -230,7 +235,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -248,7 +252,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -418,8 +421,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -444,7 +446,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
|
||||
.EnterState();
|
||||
do
|
||||
@@ -477,8 +478,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(outPath.Scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -644,7 +644,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -756,7 +755,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -782,8 +780,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
@@ -816,8 +813,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(outPath.Scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -843,9 +839,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
while (!e.Contains(Event.PreviousStopped));
|
||||
|
||||
|
||||
double massStart = Config.Formulas.CorrectedValue(StartMass.Val, outPath.Scale.Corrections);
|
||||
double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, outPath.Scale.Corrections);
|
||||
double densityOut = Config.Formulas.WaterDensityFromTemp(TempDownStat.Average, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature); /// [kg/m3]
|
||||
double massStart = Config.Formulas.CorrectedValue(StartMass.Val, scale.Corrections);
|
||||
double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, scale.Corrections);
|
||||
double densityOut = Config.Formulas.WaterDensityFromTempPress((TempUpStat.Average + TempDownStat.Average) / 2,
|
||||
(PressUpStat.Average + PressDownStat.Average) / 2,
|
||||
Program.LocalSettings.RealDensity,
|
||||
Program.LocalSettings.AtTemperature); /// [kg/m3] ///
|
||||
double buoyancy = Config.Formulas.Buoyancy();
|
||||
|
||||
double volumeCTV = 1000.0 * buoyancy * (massEnd - massStart) / densityOut;
|
||||
@@ -991,7 +990,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
tstRslt.TestDone = false;
|
||||
|
||||
+60
-61
@@ -7,6 +7,7 @@ using System.IO;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
{
|
||||
@@ -30,11 +31,50 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
HeatMeters.TestParams heatMetersTestParams,
|
||||
Config.Entities.DebugMode debugLevel)
|
||||
{
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
Event retVal = Event.Done;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
IScale scale = outPath.Scale as IScale;
|
||||
if (scale == null)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Missing_a_scale);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
|
||||
rangeIx = -1; /// Indicates invalid range
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
|
||||
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
|
||||
{
|
||||
rangeIx = r;
|
||||
}
|
||||
}
|
||||
|
||||
if (rangeIx == -1)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
if (test.Volume >= scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
|
||||
e.Add(Event.UiCmdStop);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
Event retVal = Event.Done;
|
||||
|
||||
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
|
||||
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
|
||||
@@ -47,37 +87,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
|
||||
rangeIx = -1; /// Indicates invalid range
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
|
||||
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
|
||||
{
|
||||
rangeIx = r;
|
||||
}
|
||||
}
|
||||
|
||||
if (rangeIx == -1)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTestWOTransitionAfter;
|
||||
}
|
||||
}
|
||||
|
||||
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
|
||||
if (test.Volume >= outPath.Scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTestWOTransitionAfter;
|
||||
}
|
||||
|
||||
//====================================
|
||||
loop:
|
||||
@@ -106,7 +115,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -122,12 +131,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
///
|
||||
/// Skip draining in case there is enough room in the tank
|
||||
///
|
||||
if (test.DoDraining || (Mass.Val + test.Volume >= outPath.Scale.Capacity * Constants.TankFullFactor))
|
||||
if (test.DoDraining || (Mass.Val + test.Volume >= scale.Capacity * Constants.TankFullFactor))
|
||||
{
|
||||
///
|
||||
/// Drain the water tank
|
||||
///
|
||||
switch (DrainTheTank(outPath.Scale.DrainValve, outPath.Scale, heatMetersPromptOp))
|
||||
switch (DrainTheTank(scale, heatMetersPromptOp))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -138,10 +147,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.Scale.DrainValve))
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -166,7 +174,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
|
||||
@@ -189,7 +196,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -209,7 +215,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -227,7 +232,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -397,8 +401,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -423,7 +426,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
|
||||
.EnterState();
|
||||
do
|
||||
@@ -456,8 +458,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(outPath.Scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -631,7 +632,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -743,7 +743,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -769,8 +768,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
@@ -803,8 +801,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(outPath.Scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -830,11 +827,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
while (!e.Contains(Event.PreviousStopped));
|
||||
|
||||
|
||||
double massStart = Config.Formulas.CorrectedValue(StartMass.Val, outPath.Scale.Corrections);
|
||||
double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, outPath.Scale.Corrections);
|
||||
double densityOut = Config.Formulas.WaterDensityFromTemp(TempDownStat.Average, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature); /// [kg/m3]
|
||||
double massStart = Config.Formulas.CorrectedValue(StartMass.Val, scale.Corrections);
|
||||
double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, scale.Corrections);
|
||||
double densityOut = Config.Formulas.WaterDensityFromTempPress((TempUpStat.Average + TempDownStat.Average) / 2,
|
||||
(PressUpStat.Average + PressDownStat.Average) / 2,
|
||||
Program.LocalSettings.RealDensity,
|
||||
Program.LocalSettings.AtTemperature); /// [kg/m3] ///
|
||||
double buoyancy = Config.Formulas.Buoyancy();
|
||||
|
||||
double volumeCTV = 1000.0 * buoyancy * (massEnd - massStart) / densityOut;
|
||||
if (debugLevel == Config.Entities.DebugMode.Simulate) volumeCTV = test.Volume;
|
||||
|
||||
@@ -1172,7 +1171,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartTankCollection.Compound
|
||||
{
|
||||
public class Component : ComponentBase, GenericDevices.ITestMethod
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
|
||||
}
|
||||
|
||||
public bool CanTest(MetersKind meters) { return meters == MetersKind.Combined; }
|
||||
public bool DoTransitions() { return true; }
|
||||
|
||||
readonly TestMethodCfg testMethodCfg;
|
||||
|
||||
public Component()
|
||||
{
|
||||
}
|
||||
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
testMethodCfg = cfg as TestMethodCfg;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
|
||||
{
|
||||
return (new FixedStartTankCollectionSeq()).Execute(test, repetNr, isLastRepetition, null, testMethodCfg.TestParams, DebugLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartTankCollection.Compound
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
|
||||
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(29), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartTankCollection.Compound
|
||||
{
|
||||
public class TestMethodCfg : ComponentCfgBase, IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
|
||||
|
||||
/// <summary> Test parameters </summary>
|
||||
[XmlIgnore]
|
||||
public TestParams TestParams;
|
||||
public override IParamsProvider GetRuntimeTestParamsProvider() { return TestParams; }
|
||||
public override IParamsProvider CreateTestParamsProvider() { return new TestParams(true); }
|
||||
public override IParamsProvider GetUITestParamsProvider(Test test)
|
||||
{
|
||||
return (test.Method == Name) ? base.GetUITestParamsProvider(test) : null;
|
||||
}
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
TestMethodCfg()
|
||||
{
|
||||
TestParams = new TestParams(true);
|
||||
}
|
||||
|
||||
public TestMethodCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartTankCollection.Compound
|
||||
{
|
||||
public partial class TestMethodCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
TestMethodCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as TestMethodCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public TestMethodCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+86
@@ -0,0 +1,86 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartTankCollection.Compound
|
||||
{
|
||||
partial class TestMethodCfgCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(137, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(27, 60);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// BasicPrinterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "BasicPrinterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
}
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,118 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartTankCollection.Compound
|
||||
{
|
||||
public class TestParams : TestParamsBase, IParamsProvider, ITestParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestParams) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public bool ManualLevelMsrmnt; /// true = manual level measurement/entry
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
ManualLevelMsrmnt = false;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
Strings.Manual_level_measurement,
|
||||
};
|
||||
public override string ParamName(int i) { return paramNames[i]; }
|
||||
public override int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public override string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return (ManualLevelMsrmnt ? Strings.yes : Strings.no);
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: ManualLevelMsrmnt = strValue.Equals(Strings.yes); return CfgUpdateFlags.None;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(TestParams prms)
|
||||
{
|
||||
prms.ManualLevelMsrmnt = this.ManualLevelMsrmnt;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
TestParams pars = new TestParams();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public override void UpdateFromDbEntity(ComponentTest dbEntity)
|
||||
{
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
{
|
||||
TestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as TestParams;
|
||||
|
||||
testParamsEntity = dbEntity;
|
||||
componentName = dbEntity.CmpntName;
|
||||
test = dbEntity.Test;
|
||||
|
||||
if (tmp != null) tmp.CopyContentTo(this);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor initializes the parameters
|
||||
/// </summary>
|
||||
public TestParams()
|
||||
{
|
||||
}
|
||||
|
||||
public TestParams(bool initialize)
|
||||
{
|
||||
if (initialize) InitializeAll();
|
||||
}
|
||||
|
||||
public TestParams(ComponentTest testParamsEntity, string componentName, Test test)
|
||||
{
|
||||
this.testParamsEntity = testParamsEntity;
|
||||
this.componentName = componentName;
|
||||
this.test = test;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,887 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
|
||||
{
|
||||
public class FixedStartTankCollectionSeq : Sequences.SequenceBase
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(FixedStartTankCollectionSeq));
|
||||
|
||||
/// <summary>
|
||||
/// Fixed start mass collection method sequence
|
||||
/// </summary>
|
||||
/// <param name="test">Test entity</param>
|
||||
/// <returns>
|
||||
/// Event.Done . . . . . . . OK
|
||||
/// Event.MakeSecondPass . . OK, 2nd pass (=evaluation) required
|
||||
/// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
|
||||
/// Event.OpArgumentError . Target flow is out of range
|
||||
/// Event.Error . . . . . . Unspecified error
|
||||
/// </returns>
|
||||
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
|
||||
Single.TestParams singleTestParams,
|
||||
Compound.TestParams compoundTestParams,
|
||||
Config.Entities.DebugMode debugLevel)
|
||||
{
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
|
||||
if ((outPath.Scale == null) || !(outPath.Scale is IVolumeMeter))
|
||||
{
|
||||
Bridge.OnError(this, Strings.Missing_a_tank_with_volume_measurement);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
IVolumeMeter tank = outPath.Scale as IVolumeMeter;
|
||||
|
||||
bool manualLevelMsrmnt = (singleTestParams != null) ? singleTestParams.ManualLevelMsrmnt : compoundTestParams.ManualLevelMsrmnt;
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
|
||||
rangeIx = -1; /// Indicates invalid range
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
|
||||
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
|
||||
{
|
||||
rangeIx = r;
|
||||
}
|
||||
}
|
||||
|
||||
if (rangeIx == -1)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
if (test.Volume >= outPath.Scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
|
||||
e.Add(Event.UiCmdStop);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
Event retVal = Event.Done;
|
||||
|
||||
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
|
||||
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
|
||||
|
||||
/// Notes:
|
||||
/// float timeHr = volumeLtr / (1000.0f * targetFlow);
|
||||
/// float timeSec = 3600.0f * timeHr;
|
||||
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
DoubleBox volumeBox = new DoubleBox();
|
||||
|
||||
//====================================
|
||||
loop:
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
|
||||
|
||||
///
|
||||
/// Optionally drain the water tank
|
||||
///
|
||||
if (test.DoDraining)
|
||||
{
|
||||
switch (DrainTheTank(outPath.Scale))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Starting_the_pump);
|
||||
//------------------------------------------------
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
|
||||
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
|
||||
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy) /* || !e.Contains(Event.AllPositionsReached)*/);
|
||||
|
||||
|
||||
if (test.TimePump2StartV > 0)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
}
|
||||
|
||||
|
||||
if (benchPath.StopBFValve != null)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
}
|
||||
|
||||
|
||||
if (test.TimeBeforeFlow > 0)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
}
|
||||
|
||||
|
||||
setting_flow:
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Setting_the_flow);
|
||||
//------------------------------------------------
|
||||
if (inPath.Pump is GenericDevices.IPumpFM)
|
||||
{
|
||||
(inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
|
||||
}
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
|
||||
|
||||
//--------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, 600)) /// timeout = 10 min.
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.RegulValveTimeOut))
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_adjustment_failed);
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTest;
|
||||
}
|
||||
if (e.Contains(Event.Next)) goto flow_set;
|
||||
}
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
|
||||
flow_set:
|
||||
|
||||
int flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
|
||||
if (test.DoControlWaterTemp && benchPath.TempMtrUp != null && benchPath.TempMtrDown != null)
|
||||
{
|
||||
//---------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Setting_temperature);
|
||||
//---------------------------------------------------
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
|
||||
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.Next)) goto temperature_set;
|
||||
|
||||
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
|
||||
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
|
||||
{
|
||||
goto temperature_set;
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
|
||||
temperature_set:
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start);
|
||||
//-----------------------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
|
||||
int time = StateMachine.Time;
|
||||
double currentFlow = RefFlow.Val;
|
||||
|
||||
|
||||
///
|
||||
/// Enter watermeter begin states here
|
||||
///
|
||||
GenericDevices.IHasWMStatesForm dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
|
||||
|
||||
if (dataEntryCmpnt != null)
|
||||
{
|
||||
string fileName = string.Format("{0}-start.bmp", test.Name);
|
||||
|
||||
if (dataEntryCmpnt is GenericDevices.IDataEntryForCamera)
|
||||
{
|
||||
string[] startImages = new string[sensPath.RegisterReaders.Length];
|
||||
|
||||
State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp);
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
{
|
||||
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
|
||||
if (roi != null)
|
||||
{
|
||||
string directory = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
|
||||
Directory.CreateDirectory(directory);
|
||||
startImages[i] = Path.Combine(directory, fileName);
|
||||
state2.AddOperation(roi.GrabImageOp(startImages[i]));
|
||||
}
|
||||
}
|
||||
state2.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; break; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; break; }
|
||||
}
|
||||
while (e.Contains(Event.CameraBusy));
|
||||
|
||||
(dataEntryCmpnt as GenericDevices.IDataEntryForCamera).StartImages = startImages;
|
||||
}
|
||||
|
||||
Bridge.OnActivity(this, Strings.Enter_water_meter_data);
|
||||
State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name))
|
||||
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ModelessFormClosed));
|
||||
|
||||
for (int i = 0; i < Config.Data.WMsCount; i++)
|
||||
{
|
||||
GenericDevices.IRegisterReader rr = sensPath.RegisterReaders[i];
|
||||
|
||||
if (rr is BenchControl.Elde.FixedStartRegisterReader.RegisterReader)
|
||||
(rr as BenchControl.Elde.FixedStartRegisterReader.RegisterReader).BeginWMState = dataEntryCmpnt.WMStartState(i);
|
||||
|
||||
if (rr is BenchControl.Network.Camera.RoiForFixedStart.Roi)
|
||||
(rr as BenchControl.Network.Camera.RoiForFixedStart.Roi).BeginWMState = dataEntryCmpnt.WMStartState(i);
|
||||
}
|
||||
|
||||
if (dataEntryCmpnt is GenericDevices.IDataEntryForCamera && (dataEntryCmpnt as GenericDevices.IDataEntryForCamera).SaveImages)
|
||||
{
|
||||
/// SaveImages==true ... copy images to the directory that will be archived at the end of the cycle
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
{
|
||||
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
|
||||
if (roi != null)
|
||||
{
|
||||
string srcDir = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
|
||||
string destDir = Path.Combine(Program.ImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
|
||||
try
|
||||
{
|
||||
if (File.Exists(Path.Combine(srcDir, fileName)))
|
||||
{
|
||||
Directory.CreateDirectory(destDir);
|
||||
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, fileName), true);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Failed to copy image {0} to {1}: {2}", fileName, destDir, exc.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TestStartTime = DateTime.Now;
|
||||
LogProcessDataTestInfo(processDataLogger, test.Procedure.Name, test.Name);
|
||||
LogProcessDataHeader(processDataLogger, "Measurement");
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
|
||||
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
|
||||
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
|
||||
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
|
||||
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro,
|
||||
test.Qfrom, test.Qto, (totalPulses * 5 / 4), new int[] { (int)test.TolerRed, }))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
|
||||
StartTime = (double)StateMachine.Time;
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Opening the start/stop valve at the beginning of the fixed start test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
|
||||
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
|
||||
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
|
||||
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
|
||||
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
|
||||
switchTimeStart = 0.001f * cBrd.ValveOpenCloseTime;
|
||||
log.WarnFormat("Start valve switch time on test start = {0} ms", cBrd.ValveOpenCloseTime);
|
||||
|
||||
/// Measurement loop - preparation
|
||||
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
|
||||
queryEnd1 = cBrd.QueryMeasurementEndOp();
|
||||
queryEnd2 = cBrd.QueryMeasurementEndOp();
|
||||
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, Math.Max((int)(test.TstTime / 10), 5));
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TstTime;
|
||||
|
||||
/// Measurement loop - begin
|
||||
do
|
||||
{
|
||||
//--------------------------------
|
||||
switch (ReadRegistersTempPressAmbient(null, true))
|
||||
{
|
||||
case Event.Error:
|
||||
retVal = Event.Error;
|
||||
goto stopTest;
|
||||
|
||||
case Event.UiCmdStop:
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTest;
|
||||
|
||||
case Event.MeasurementCompleted:
|
||||
goto test_completed;
|
||||
}
|
||||
|
||||
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
|
||||
if (remainingTime > 60)
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
||||
}
|
||||
else
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
||||
}
|
||||
|
||||
RefFreq.Val = cBrd.ReferenceFreq;
|
||||
RefFlow.Val = cBrd.ReferenceFlow;
|
||||
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
if (compoundTestParams != null)
|
||||
{
|
||||
/// TODO: Reimplement for combined meters
|
||||
//for (int i = 0; i < Config.Data.CompoundWMsCount; i++)
|
||||
//{
|
||||
// data.TestResult.CombinedMeters[i].VolumeMeter = data.TestResult.Meters[2 * i].VolumeMeter
|
||||
// + data.TestResult.Meters[2 * i + 1].VolumeMeter;
|
||||
// if (data.Volume.Valid)
|
||||
// {
|
||||
// data.TestResult.CombinedMeters[i].VolumeErrorPct =
|
||||
// Formulas.ErrorFromVolumes(data.TestResult.CombinedMeters[i].VolumeMeter, data.Volume.Val);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (cBrd.EtPulses(0) < totalPulses);
|
||||
/// Measurement loop - end
|
||||
|
||||
test_completed:
|
||||
|
||||
StopRecordingStatistics();
|
||||
|
||||
EndTime = (double)StateMachine.Time;
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
|
||||
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
|
||||
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
|
||||
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
|
||||
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
}
|
||||
while (e.Contains(Event.ValvesBusy));
|
||||
|
||||
switchTimeEnd = 0.001f * cBrd.ValveOpenCloseTime;
|
||||
log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime);
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Waiting before 2nd mass measurement", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
|
||||
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
|
||||
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
|
||||
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
|
||||
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
|
||||
|
||||
LogProcessDataHeader(processDataLogger, "Water level measurement");
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Measuring_the_weight);
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Water level measurement", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
|
||||
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
|
||||
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
|
||||
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
|
||||
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
|
||||
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(manualLevelMsrmnt ? tank.ManualReadVolumeOp(ref volumeBox) : tank.ReadStableVolumeOp(ref volumeBox, test.MassSpread))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.VolumeDone));
|
||||
///
|
||||
log.WarnFormat("Volumes = {0}l", volumeBox.Val);
|
||||
TestEndTime = DateTime.Now;
|
||||
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.StopPreviousOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.PreviousStopped));
|
||||
|
||||
double volumeCTV = volumeBox.Val;
|
||||
double refEnergy = Energy.Sum * volumeCTV / VolumeForEnergy.Sum; /// [J]=[J]*[l]/[l]
|
||||
|
||||
///
|
||||
/// Enter watermeter end states here
|
||||
///
|
||||
if (dataEntryCmpnt != null)
|
||||
{
|
||||
string fileName = string.Format("{0}-end.bmp", test.Name);
|
||||
|
||||
if (dataEntryCmpnt is GenericDevices.IDataEntryForCamera)
|
||||
{
|
||||
string[] endImages = new string[sensPath.RegisterReaders.Length];
|
||||
|
||||
State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp);
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
{
|
||||
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
|
||||
if (roi != null)
|
||||
{
|
||||
string directory = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
|
||||
Directory.CreateDirectory(directory);
|
||||
endImages[i] = Path.Combine(directory, fileName);
|
||||
state2.AddOperation(roi.GrabImageOp(endImages[i]));
|
||||
}
|
||||
}
|
||||
state2.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; break; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; break; }
|
||||
}
|
||||
while (e.Contains(Event.CameraBusy));
|
||||
|
||||
(dataEntryCmpnt as GenericDevices.IDataEntryForCamera).EndImages = endImages;
|
||||
}
|
||||
|
||||
Bridge.OnActivity(this, Strings.Enter_water_meter_data);
|
||||
State.Create(string.Format("{0}({1}) : Entering the end-state", test.Method, test.Name))
|
||||
.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders,
|
||||
volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty))
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ModelessFormClosed));
|
||||
|
||||
|
||||
for (int i = 0; i < Config.Data.WMsCount; i++)
|
||||
{
|
||||
GenericDevices.IRegisterReader rr = sensPath.RegisterReaders[i];
|
||||
|
||||
if (rr is BenchControl.Elde.FixedStartRegisterReader.RegisterReader)
|
||||
(rr as BenchControl.Elde.FixedStartRegisterReader.RegisterReader).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
|
||||
if (rr is BenchControl.Network.Camera.RoiForFixedStart.Roi)
|
||||
(rr as BenchControl.Network.Camera.RoiForFixedStart.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
|
||||
}
|
||||
|
||||
if (dataEntryCmpnt is GenericDevices.IDataEntryForCamera && (dataEntryCmpnt as GenericDevices.IDataEntryForCamera).SaveImages)
|
||||
{
|
||||
/// SaveImages==true ... copy images to the directory that will be archived at the end of the cycle
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
{
|
||||
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
|
||||
if (roi != null)
|
||||
{
|
||||
string srcDir = Path.Combine(Program.TempImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
|
||||
string destDir = Path.Combine(Program.ImagesDir, BatchRslts.Batch.BatchNr.ToString(), (i + 1).ToString());
|
||||
try
|
||||
{
|
||||
if (File.Exists(Path.Combine(srcDir, fileName)))
|
||||
{
|
||||
Directory.CreateDirectory(destDir);
|
||||
File.Copy(Path.Combine(srcDir, fileName), Path.Combine(destDir, fileName), true);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Failed to copy image {0} to {1}: {2}", fileName, destDir, exc.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_completed);
|
||||
//------------------------------------------------
|
||||
|
||||
/// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
|
||||
if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest;
|
||||
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
|
||||
|
||||
if (tstRslt != null)
|
||||
{
|
||||
UpdateTempPressDensAmb(tstRslt);
|
||||
|
||||
/// Main results
|
||||
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
|
||||
tstRslt.StartTime = TestStartTime;
|
||||
tstRslt.EndTime = TestEndTime;
|
||||
tstRslt.FlowSetTime = flowSetTime;
|
||||
|
||||
tstRslt.TestTime = Math.Max(1.0, EndTime - StartTime); /// [s] measurement time, at least 1 to prevent division by zero
|
||||
|
||||
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
|
||||
tstRslt.MassStartRaw = 0;
|
||||
tstRslt.MassStart = 0;
|
||||
tstRslt.MassEndRaw = 0;
|
||||
tstRslt.MassEnd = 0;
|
||||
tstRslt.FlowMass = 0; /// [kg/h]
|
||||
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
|
||||
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
|
||||
tstRslt.Buoyancy = 0;
|
||||
tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
|
||||
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
|
||||
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
|
||||
/// Calculated master pulses per liter
|
||||
tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
|
||||
|
||||
tstRslt.FlowMean = (float)RefFlowStat.Average;
|
||||
tstRslt.FlowStart = (float)RefFlowStat.First;
|
||||
tstRslt.FlowEnd = (float)RefFlowStat.Last;
|
||||
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
||||
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart;
|
||||
tstRslt.DiverterEnd = switchTimeEnd;
|
||||
tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0;
|
||||
tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, true, switchTimeStart, switchTimeEnd) : 0;
|
||||
|
||||
if (compoundTestParams != null)
|
||||
{
|
||||
///
|
||||
/// Compound meters
|
||||
///
|
||||
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
|
||||
|
||||
Results.Entities.MeterTestRslt mainMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundMain);
|
||||
Results.Entities.MeterTestRslt auxMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundAux);
|
||||
|
||||
for (int isAux = 0; isAux <= 1; isAux++) /// 0=main, 1=aux
|
||||
{
|
||||
Results.Entities.MeterTestRslt meterRslt = (isAux == 0) ? mainMeterRslt : auxMeterRslt;
|
||||
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[2 * i + isAux];
|
||||
|
||||
if (meterRslt != null && regReader != null)
|
||||
{
|
||||
meterRslt.RegReaderType = (int)regReader.RegisterReaderType;
|
||||
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
|
||||
meterRslt.VolumeStart = regReader.BeginWMState; /// [l]
|
||||
meterRslt.VolumeEnd = regReader.EndWMState; /// [l]
|
||||
meterRslt.VolumeMeter = meterRslt.VolumeEnd - meterRslt.VolumeStart; /// [l]
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV; /// [l]
|
||||
meterRslt.PulsesMeter = meterRslt.VolumeMeter;
|
||||
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
|
||||
meterRslt.TestTime = tstRslt.TestTime;
|
||||
meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); /// Not used for evaluation
|
||||
}
|
||||
}
|
||||
|
||||
Results.Entities.MeterTestRslt compoundMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Compound);
|
||||
|
||||
if (compoundMeterRslt != null && mainMeterRslt != null && auxMeterRslt != null)
|
||||
{
|
||||
compoundMeterRslt.VolumeRef = tstRslt.VolumeCTV; /// [l] must be calculated before main & aux. meter error
|
||||
compoundMeterRslt.VolumeMeter = mainMeterRslt.VolumeMeter + auxMeterRslt.VolumeMeter;
|
||||
compoundMeterRslt.PulsesMaster = tstRslt.PulsesMaster;
|
||||
compoundMeterRslt.TestTime = tstRslt.TestTime;
|
||||
compoundMeterRslt.Error = Config.Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef);
|
||||
compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty)
|
||||
&& (compoundMeterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty)
|
||||
&& (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On);
|
||||
mainMeterRslt.Passed = auxMeterRslt.Passed = compoundMeterRslt.Passed;
|
||||
mainMeterRslt.TestDone = auxMeterRslt.TestDone = compoundMeterRslt.TestDone = true;
|
||||
tstRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
/// Single meters
|
||||
///
|
||||
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
|
||||
|
||||
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
|
||||
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[i];
|
||||
|
||||
if (meterRslt != null && regReader != null)
|
||||
{
|
||||
meterRslt.RegReaderType = (int)regReader.RegisterReaderType;
|
||||
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
|
||||
meterRslt.VolumeStart = regReader.BeginWMState;
|
||||
meterRslt.VolumeEnd = regReader.EndWMState;
|
||||
meterRslt.VolumeMeter = meterRslt.VolumeEnd - meterRslt.VolumeStart;
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV; /// liter
|
||||
meterRslt.PulsesMeter = meterRslt.VolumeMeter;
|
||||
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
|
||||
meterRslt.TestTime = tstRslt.TestTime;
|
||||
meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
|
||||
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty)
|
||||
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty)
|
||||
&& (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On);
|
||||
meterRslt.TestDone = true;
|
||||
tstRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
/// Update water meter error flags
|
||||
if (ErrorFlagsComp != null)
|
||||
{
|
||||
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
if (BatchRslts.WaterMeters[i] != null)
|
||||
{
|
||||
BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Update results
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt));
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
|
||||
|
||||
/// Append the results to the CSV-file
|
||||
allResults.Info(TestResult2CsvLine(testName, test.Part));
|
||||
|
||||
|
||||
stopTest:
|
||||
|
||||
StopRecordingStatistics();
|
||||
|
||||
///
|
||||
/// Quit this sequence
|
||||
///
|
||||
if (isLastRepetition || retVal == Event.UiCmdStop || retVal == Event.OpArgumentError
|
||||
|| retVal == Event.Error || retVal == Event.ConfigurationError)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.StopPreviousOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.PreviousStopped));
|
||||
}
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retList = new List<Event>(1);
|
||||
retList.Add(retVal);
|
||||
return retList;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartTankCollection.Single
|
||||
{
|
||||
public class Component : ComponentBase, GenericDevices.ITestMethod
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
|
||||
}
|
||||
|
||||
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
|
||||
public bool DoTransitions() { return true; }
|
||||
|
||||
readonly TestMethodCfg testMethodCfg;
|
||||
|
||||
public Component()
|
||||
{
|
||||
}
|
||||
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
testMethodCfg = cfg as TestMethodCfg;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
|
||||
{
|
||||
return (new FixedStartTankCollectionSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, null, DebugLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartTankCollection.Single
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
|
||||
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(29), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartTankCollection.Single
|
||||
{
|
||||
public class TestMethodCfg : ComponentCfgBase, IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestMethodCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); }
|
||||
|
||||
/// <summary> Test parameters </summary>
|
||||
[XmlIgnore]
|
||||
public TestParams TestParams;
|
||||
public override IParamsProvider GetRuntimeTestParamsProvider() { return TestParams; }
|
||||
public override IParamsProvider CreateTestParamsProvider() { return new TestParams(true); }
|
||||
public override IParamsProvider GetUITestParamsProvider(Test test)
|
||||
{
|
||||
return (test.Method == Name) ? base.GetUITestParamsProvider(test) : null;
|
||||
}
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
TestMethodCfg()
|
||||
{
|
||||
TestParams = new TestParams(true);
|
||||
}
|
||||
|
||||
public TestMethodCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}", Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartTankCollection.Single
|
||||
{
|
||||
public partial class TestMethodCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
TestMethodCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as TestMethodCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public TestMethodCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
return flags;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+86
@@ -0,0 +1,86 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartTankCollection.Single
|
||||
{
|
||||
partial class TestMethodCfgCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(137, 57);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 5;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(27, 60);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 4;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(134, 33);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 3;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// BasicPrinterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "BasicPrinterCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,118 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FixedStartTankCollection.Single
|
||||
{
|
||||
public class TestParams : TestParamsBase, IParamsProvider, ITestParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TestParams) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public bool ManualLevelMsrmnt; /// true = manual level measurement/entry
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
ManualLevelMsrmnt = false;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
Strings.Manual_level_measurement,
|
||||
};
|
||||
public override string ParamName(int i) { return paramNames[i]; }
|
||||
public override int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public override string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return (ManualLevelMsrmnt ? Strings.yes : Strings.no);
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: ManualLevelMsrmnt = strValue.Equals(Strings.yes); return CfgUpdateFlags.None;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(TestParams prms)
|
||||
{
|
||||
prms.ManualLevelMsrmnt = this.ManualLevelMsrmnt;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
TestParams pars = new TestParams();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public override void UpdateFromDbEntity(ComponentTest dbEntity)
|
||||
{
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
{
|
||||
TestParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as TestParams;
|
||||
|
||||
testParamsEntity = dbEntity;
|
||||
componentName = dbEntity.CmpntName;
|
||||
test = dbEntity.Test;
|
||||
|
||||
if (tmp != null) tmp.CopyContentTo(this);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor initializes the parameters
|
||||
/// </summary>
|
||||
public TestParams()
|
||||
{
|
||||
}
|
||||
|
||||
public TestParams(bool initialize)
|
||||
{
|
||||
if (initialize) InitializeAll();
|
||||
}
|
||||
|
||||
public TestParams(ComponentTest testParamsEntity, string componentName, Test test)
|
||||
{
|
||||
this.testParamsEntity = testParamsEntity;
|
||||
this.componentName = componentName;
|
||||
this.test = test;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
|
||||
@@ -159,7 +158,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -179,7 +177,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -197,7 +194,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -640,7 +636,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
meterRslt.RegReaderType = (int)regReader.RegisterReaderType;
|
||||
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
|
||||
meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses);
|
||||
meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses);
|
||||
|
||||
if (dstrReader != null)
|
||||
{
|
||||
@@ -651,6 +646,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
meterRslt.VolumeEnd = dstrReader.VolumeLtrEnd; /// liter
|
||||
meterRslt.VolumeMeter = Math.Abs(dstrReader.VolumeLtrEnd - dstrReader.VolumeLtrStart);
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV * meterRslt.TestTime / tstRslt.TestTime;
|
||||
meterRslt.PulsesMaster = tstRslt.PulsesMaster * meterRslt.TestTime / tstRslt.TestTime;
|
||||
|
||||
if (iPerl != null)
|
||||
{
|
||||
@@ -659,10 +655,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
meterRslt.WaterMeter.ResultCode |= iPerl.ResultCode;
|
||||
}
|
||||
#if IPERL
|
||||
meterRslt.WaterMeter.CalibFactor = (iPerl.CalibrationStruct != null) ? iPerl.CalibrationStruct.Calibration : 0;
|
||||
meterRslt.WaterMeter.Q2Correction = iPerl.Q2Correction;
|
||||
meterRslt.WaterMeter.Q2CorrRFlow = iPerl.Q2CorrRFlow;
|
||||
meterRslt.WaterMeter.Q2CorrLFlow = iPerl.Q2CorrLFlow;
|
||||
meterRslt.WaterMeter.CalibFactor = iPerl.CalibFactor;
|
||||
#endif
|
||||
iPerl.LastTestResult2 = iPerl.LastTestResult; /// Save shift previous test result
|
||||
iPerl.LastTestResult = meterRslt; /// Save this test result
|
||||
@@ -682,21 +675,24 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
/// Normal measurement with camera
|
||||
meterRslt.TestTime = cameraRoi.TimestampEnd - cameraRoi.TimestampStart; /// second
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV * meterRslt.TestTime / tstRslt.TestTime;
|
||||
meterRslt.PulsesMaster = tstRslt.PulsesMaster * meterRslt.TestTime / tstRslt.TestTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// None or one pulse from the water meter using camera
|
||||
meterRslt.TestTime = tstRslt.TestTime;
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV;
|
||||
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
meterRslt.VolumeStart = 0;
|
||||
meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses);
|
||||
meterRslt.VolumeStart = 0;
|
||||
meterRslt.VolumeEnd = 0;
|
||||
meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse; /// liter
|
||||
///
|
||||
if (regReader.WMPulses > 1)
|
||||
meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse; /// liter
|
||||
///
|
||||
if (regReader.WMPulses >= 1)
|
||||
{
|
||||
/// Normal measurement
|
||||
meterRslt.TestTime = cBrd.ImpulseTime(i + 1);
|
||||
@@ -752,7 +748,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
|
||||
+120
-118
@@ -9,6 +9,7 @@ using TBF.BenchControl;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
{
|
||||
@@ -32,95 +33,63 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
HeatMeters.TestParams heatMetersTestParams,
|
||||
Config.Entities.DebugMode debugLevel)
|
||||
{
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
Event retVal = Event.Done;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
|
||||
float nextTestVolume = (singleTestParams != null) ? singleTestParams.NextTestVolume
|
||||
: ((compoundTestParams != null) ? compoundTestParams.NextTestVolume
|
||||
: heatMetersTestParams.NextTestVolume);
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
if (debugLevel == Config.Entities.DebugMode.Simulate)
|
||||
{
|
||||
///
|
||||
/// Test method simulation
|
||||
///
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
return Simulate(test, repetitionNr, isLastRepetition, singleTestParams, compoundTestParams, heatMetersTestParams);
|
||||
}
|
||||
|
||||
if (compoundTestParams != null)
|
||||
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
|
||||
IScale scale = outPath.Scale as IScale;
|
||||
if (scale == null)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Missing_a_scale);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
|
||||
rangeIx = -1; /// Indicates invalid range
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
if (test.Name.ToLower().Contains("nok")) MakeSimulatedCompound(test, 1, 0, 4.7f, 0.9f);
|
||||
else MakeSimulatedCompound(test, 1, 0, 0.7f, 1.0f);
|
||||
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
|
||||
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
|
||||
{
|
||||
rangeIx = r;
|
||||
}
|
||||
}
|
||||
else if (heatMetersTestParams != null)
|
||||
{
|
||||
MakeSimulatedHeatMeters(test, 1, 0, 1.5f, 1000000, heatMetersTestParams.ErrorLimitLo, heatMetersTestParams.ErrorLimitHi, heatMetersTestParams.EvaluateVolume);
|
||||
}
|
||||
else
|
||||
{
|
||||
float errorPctBase = -1.0f;
|
||||
if (test.Name.ToLower().Contains("q3")) errorPctBase = -0.5f;
|
||||
else if (test.Name.ToLower().Contains("q2")) errorPctBase = 0.5f;
|
||||
else if (test.Name.ToLower().Contains("q1")) errorPctBase = -5.1f;
|
||||
|
||||
MakeSimulated(test, repetitionNr, 0, errorPctBase + repetitionNr * 0.1f);
|
||||
}
|
||||
if (rangeIx == -1)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
|
||||
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, 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, string.Format("{0} Simulation", test.Name));
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Simulation", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
if (TestAndLogUiCmdStop(test, e)) retVal = Event.UiCmdStop;
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retListSim = new List<Event>(1);
|
||||
retListSim.Add(retVal);
|
||||
return retListSim;
|
||||
if (test.Volume > scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
|
||||
e.Add(Event.UiCmdStop);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
||||
checkUiOp = new Operations.CheckUIOp(true);
|
||||
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
Event retVal = Event.Done;
|
||||
|
||||
if (test.Volume > outPath.Scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTestWOStoppingDivGateEtc;
|
||||
}
|
||||
float nextTestVolume = (singleTestParams != null) ? singleTestParams.NextTestVolume
|
||||
: ((compoundTestParams != null) ? compoundTestParams.NextTestVolume
|
||||
: heatMetersTestParams.NextTestVolume);
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
|
||||
rangeIx = -1; /// Indicates invalid range
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
|
||||
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
|
||||
{
|
||||
rangeIx = r;
|
||||
}
|
||||
}
|
||||
|
||||
if (rangeIx == -1)
|
||||
{
|
||||
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTestWOStoppingDivGateEtc;
|
||||
}
|
||||
}
|
||||
|
||||
//====================================
|
||||
loop:
|
||||
@@ -148,7 +117,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -159,7 +128,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
|
||||
double estimatedEndMass = Mass.Val + test.Volume;
|
||||
if (estimatedEndMass >= outPath.Scale.Capacity * Constants.TankFullFactor)
|
||||
if (estimatedEndMass >= scale.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
drainTheTank = true;
|
||||
}
|
||||
@@ -168,7 +137,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
if (drainTheTank)
|
||||
{
|
||||
#if BERLIN
|
||||
switch (DrainTheTank(outPath.Scale.DrainValve, outPath.Scale))
|
||||
switch (DrainTheTank(scale.DrainValve, scale))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -178,7 +147,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
#else
|
||||
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(outPath.Scale.DrainValve, null))
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -215,7 +184,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
|
||||
@@ -237,7 +205,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -257,7 +224,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -275,7 +241,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -297,7 +262,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, 990)) /// timeout = 16.5 min.
|
||||
.AddOperation(heatMetersPromptOp)
|
||||
.EnterState();
|
||||
@@ -460,7 +424,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
extraOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
|
||||
extraOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
|
||||
}
|
||||
switch (DrainTheTank(outPath.Scale.DrainValve, outPath.Scale, extraOps))
|
||||
switch (DrainTheTank(scale, extraOps))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
@@ -473,7 +437,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
/// Close the drain valve anyway
|
||||
State.Create(string.Format("{0}({1}) : Close the drain valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, outPath.Scale.DrainValve))
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
@@ -496,7 +460,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
|
||||
.EnterState();
|
||||
do
|
||||
@@ -528,8 +491,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(outPath.Scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -566,7 +528,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(cBrd.StartMeasurementOp(outPath, (repetitionNr == 1) ? Elde.TestMethods.Diverter | Elde.TestMethods.Synchro : Elde.TestMethods.Synchro,
|
||||
test.Qfrom, test.Qto, totalPulses, filters))
|
||||
@@ -614,8 +575,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation((repetitionNr == 1) ? outPath.Scale.ReadMassOp(ref Mass) : null)
|
||||
.AddOperation((repetitionNr == 1) ? StateMachine.ControlBoard.UpdateTankWeightOp() : null)
|
||||
.AddOperation((repetitionNr == 1) ? scale.ReadMassOp(ref Mass) : null)
|
||||
.AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
|
||||
@@ -691,7 +651,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
State.Create("SequenceBase : Transition : TestEnd - Default action")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen,
|
||||
StateMachine.DefaultValvesClose))
|
||||
.EnterState();
|
||||
@@ -721,9 +680,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
@@ -753,8 +711,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||
.AddOperation(outPath.Scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -802,17 +759,16 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
if (repetitionNr == 1)
|
||||
{
|
||||
tstRslt.MassStartRaw = StartMass.Val;
|
||||
tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections);
|
||||
tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, scale.Corrections);
|
||||
tstRslt.MassEndRaw = EndMass.Val;
|
||||
tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections);
|
||||
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h]
|
||||
double density = Config.Formulas.WaterDensityFromTemp((tstRslt.TempUpMean + tstRslt.TempDownMean) / 2.0, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature);
|
||||
tstRslt.VolumeCTV = 1000.0 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / density; /// [l] 1000.0f is because density is in [kg/m3]
|
||||
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
|
||||
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
|
||||
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
|
||||
tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, scale.Corrections);
|
||||
tstRslt.FlowMass = 3600 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h]
|
||||
tstRslt.VolumeCTV = 1000 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine; /// [l] commercially true volume
|
||||
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
|
||||
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
|
||||
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
|
||||
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
|
||||
/// Calculated master pulses per liter
|
||||
/// Calculated master pulses per liter
|
||||
tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart.Val;
|
||||
@@ -1016,7 +972,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
meterRslt.RegReaderType = (int)regReader.RegisterReaderType;
|
||||
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
|
||||
meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses);
|
||||
meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses);
|
||||
|
||||
if (dstrReader != null)
|
||||
{
|
||||
@@ -1027,6 +982,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
meterRslt.VolumeEnd = dstrReader.VolumeLtrEnd; /// liter
|
||||
meterRslt.VolumeMeter = Math.Abs(dstrReader.VolumeLtrEnd - dstrReader.VolumeLtrStart);
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV * meterRslt.TestTime / tstRslt.TestTime;
|
||||
meterRslt.PulsesMaster = tstRslt.PulsesMaster * meterRslt.TestTime / tstRslt.TestTime;
|
||||
|
||||
if (iPerl != null)
|
||||
{
|
||||
@@ -1035,10 +991,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
meterRslt.WaterMeter.ResultCode |= iPerl.ResultCode;
|
||||
}
|
||||
#if IPERL
|
||||
meterRslt.WaterMeter.CalibFactor = (iPerl.CalibrationStruct != null) ? iPerl.CalibrationStruct.Calibration : 0;
|
||||
meterRslt.WaterMeter.Q2Correction = iPerl.Q2Correction;
|
||||
meterRslt.WaterMeter.Q2CorrRFlow = iPerl.Q2CorrRFlow;
|
||||
meterRslt.WaterMeter.Q2CorrLFlow = iPerl.Q2CorrLFlow;
|
||||
meterRslt.WaterMeter.CalibFactor = iPerl.CalibFactor;
|
||||
#endif
|
||||
iPerl.LastTestResult2 = iPerl.LastTestResult; /// Save shift previous test result
|
||||
iPerl.LastTestResult = meterRslt; /// Save this test result
|
||||
@@ -1055,11 +1008,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
meterRslt.VolumeMeter = cameraRoi.VolumeEnd - cameraRoi.VolumeStart; /// liter
|
||||
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV * meterRslt.TestTime / tstRslt.TestTime;
|
||||
}
|
||||
meterRslt.PulsesMaster = tstRslt.PulsesMaster * meterRslt.TestTime / tstRslt.TestTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
meterRslt.TestTime = cBrd.ImpulseTime(i + 1);
|
||||
meterRslt.VolumeStart = 0;
|
||||
meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses);
|
||||
meterRslt.VolumeStart = 0;
|
||||
meterRslt.VolumeEnd = 0;
|
||||
meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse; /// liter
|
||||
meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter
|
||||
@@ -1081,7 +1036,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
|
||||
scale != null ? scale.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
|
||||
@@ -1129,12 +1084,59 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
while (!e.Contains(Event.PreviousStopped));
|
||||
}
|
||||
|
||||
stopTestWOStoppingDivGateEtc:
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retList = new List<Event>(1);
|
||||
retList.Add(retVal);
|
||||
return retList;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IList<Event> Simulate(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
|
||||
Single.TestParams singleTestParams,
|
||||
Compound.TestParams compoundTestParams,
|
||||
HeatMeters.TestParams heatMetersTestParams)
|
||||
{
|
||||
///
|
||||
/// Test method simulation
|
||||
///
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (compoundTestParams != null)
|
||||
{
|
||||
if (test.Name.ToLower().Contains("nok")) MakeSimulatedCompound(test, 1, 0, 4.7f, 0.9f);
|
||||
else MakeSimulatedCompound(test, 1, 0, 0.7f, 1.0f);
|
||||
}
|
||||
else if (heatMetersTestParams != null)
|
||||
{
|
||||
MakeSimulatedHeatMeters(test, 1, 0, 1.5f, 1000000, heatMetersTestParams.ErrorLimitLo, heatMetersTestParams.ErrorLimitHi, heatMetersTestParams.EvaluateVolume);
|
||||
}
|
||||
else
|
||||
{
|
||||
float errorPctBase = -1.0f;
|
||||
if (test.Name.ToLower().Contains("q3")) errorPctBase = -0.5f;
|
||||
else if (test.Name.ToLower().Contains("q2")) errorPctBase = 0.5f;
|
||||
else if (test.Name.ToLower().Contains("q1")) errorPctBase = -5.1f;
|
||||
|
||||
MakeSimulated(test, repetitionNr, 0, errorPctBase + repetitionNr * 0.1f);
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, 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, string.Format("{0} Simulation", test.Name));
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Simulation", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.EnterState();
|
||||
IList<Event> e = StateMachine.WaitRunDevsRunOps();
|
||||
|
||||
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
||||
IList<Event> retListSim = new List<Event>(1);
|
||||
retListSim.Add(TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done);
|
||||
return retListSim;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.TestMethods.FlyingStartMassCollComparative;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative.Compound
|
||||
{
|
||||
public class Component : ComponentBase, GenericDevices.ITestMethod
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
|
||||
}
|
||||
|
||||
public bool CanTest(MetersKind meters) { return meters == MetersKind.Combined; }
|
||||
public bool DoTransitions() { return true; }
|
||||
|
||||
readonly TestMethodCfg testMethodCfg;
|
||||
|
||||
public Component()
|
||||
{
|
||||
}
|
||||
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
testMethodCfg = cfg as TestMethodCfg;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
|
||||
{
|
||||
return (new FlyingStartMassCollComparativeSeq()).Execute(test, repetNr, isLastRepetition, null, testMethodCfg.TestParams, null, DebugLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative.Compound
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
|
||||
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(29), this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user