Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58481fc92b | ||
|
|
5d2008a6dd | ||
|
|
c315c8a42b | ||
|
|
aaa78d60db | ||
|
|
4b42b5ba7a | ||
|
|
6e04933eeb | ||
|
|
f47e7670a3 | ||
|
|
78575e4f6f | ||
|
|
b38ee92fe4 | ||
|
|
4ac72c6bbf | ||
|
|
c0e7eab3b2 | ||
|
|
5081969fdc | ||
|
|
df386a14f8 | ||
|
|
2b0ee55901 | ||
|
|
5b893d69b4 | ||
|
|
a50c867b7e | ||
|
|
ebcbd47f91 | ||
|
|
310ed6158a | ||
|
|
c64e8e773f | ||
|
|
56275063f7 | ||
|
|
d7401cfec4 | ||
|
|
0849467857 | ||
|
|
d83762ddec | ||
|
|
4640018e78 | ||
|
|
67ebe0718a | ||
|
|
b1bebbff50 | ||
|
|
26126d380b | ||
|
|
c6a2965faf | ||
|
|
77c713425a | ||
|
|
604120e2b8 | ||
|
|
d29d8be81a | ||
|
|
6a374c5af0 | ||
|
|
a14e21eb57 | ||
|
|
100a357fc1 | ||
|
|
75fcffc9c3 | ||
|
|
8d6d0c011b | ||
|
|
be8f6814c8 | ||
|
|
75766938be | ||
|
|
08b3ab45ba | ||
|
|
0539844d85 | ||
|
|
da7ac83c75 | ||
|
|
01f0c03f62 | ||
|
|
9ac1b0b6fa | ||
|
|
685d57db8b | ||
|
|
7de5551c24 | ||
|
|
36c52e5d7e | ||
|
|
9f6bfc6410 | ||
|
|
81498a6db4 | ||
|
|
a595b6cd8d | ||
|
|
668d68a80c | ||
|
|
61ea3ef86b | ||
|
|
a7118935ca | ||
|
|
b044b00571 | ||
|
|
0e77a31a0f | ||
|
|
2183d1c452 | ||
|
|
be97777159 | ||
|
|
4781acf3e2 | ||
|
|
207d4be3d6 | ||
|
|
92b2f55871 | ||
|
|
0fd0c44c18 | ||
|
|
5629b94e47 | ||
|
|
3bff80f64b | ||
|
|
b3df3307a0 | ||
|
|
1f12464218 | ||
|
|
b17282f826 | ||
|
|
ae348d13fd | ||
|
|
e7ab26669e |
+19
-5
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -103,6 +103,17 @@ namespace Common
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test designation mode for IperlLogger and IperlHead opto data files
|
||||
/// </summary>
|
||||
public enum DesigMode
|
||||
{
|
||||
Auto,
|
||||
Based_on_procedure,
|
||||
As_specified,
|
||||
Count
|
||||
}
|
||||
|
||||
public enum LoginMethod
|
||||
{
|
||||
UserName, /// = alias, abbreviation
|
||||
@@ -293,11 +304,13 @@ namespace Common
|
||||
[Description("V")] V, /// vertical
|
||||
[Description("STR")] S, /// standrohre
|
||||
[Description("F")] F, /// fall
|
||||
[Description("H/V")] HV, /// horizontal / vertical
|
||||
#else
|
||||
[Description("H")] H, /// horizontal
|
||||
[Description("V")] V, /// vertical
|
||||
[Description("S")] S, /// steig
|
||||
[Description("F")] F, /// fall
|
||||
[Description("H")] H, /// horizontal
|
||||
[Description("V")] V, /// vertical
|
||||
[Description("S")] S, /// steig
|
||||
[Description("F")] F, /// fall
|
||||
[Description("H/V")] HV, /// horizontal / vertical
|
||||
#endif
|
||||
Count
|
||||
}
|
||||
@@ -329,6 +342,7 @@ namespace Common
|
||||
[Description("")] NotSpecified,
|
||||
[Description("U0")] U0, /// ?
|
||||
[Description("D0")] D0, /// ?
|
||||
///
|
||||
Count
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Common
|
||||
public interface IMeasurementCorrection
|
||||
{
|
||||
int RangeIx { get; set; }
|
||||
float Measurement { get; set; }
|
||||
float Correction { get; set; }
|
||||
double Measurement { get; set; }
|
||||
double Correction { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Common")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020-2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
||||
+80
-1
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2021-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO.Ports;
|
||||
@@ -15,6 +15,85 @@ namespace Common
|
||||
return string.Format("{0} ({1}/{2})", name, repetitionNr, repeats);
|
||||
}
|
||||
|
||||
public static string ToNiceString(double value, int sigDigits)
|
||||
{
|
||||
string format = SignificantDigitsToFmt(value, sigDigits);
|
||||
return (format == "F0") ? value.ToString("F0") : value.ToString(format).TrimEnd(new char[] { '0' });
|
||||
}
|
||||
|
||||
public static string SignificantDigitsToFmt(double value, int sigDigits)
|
||||
{
|
||||
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";
|
||||
else if (value >= 99.995 || value < -99.995) return "F2";
|
||||
else if (value >= 9.9995 || value < -9.9995) return "F3";
|
||||
else if (value >= 0.99995 || value < -0.99995) return "F4";
|
||||
else if (value >= 0.099995 || value < -0.099995) return "F5";
|
||||
else if (value >= 0.0099995 || value < -0.0099995) return "F6";
|
||||
else if (value >= 0.00099995 || value < -0.00099995) return "F7";
|
||||
else if (value >= 0.000099995 || value < -0.000099995) return "F8";
|
||||
else return "F9";
|
||||
}
|
||||
else if (sigDigits == 4)
|
||||
{
|
||||
if (value >= 999.5 || value < -999.5) return "F0";
|
||||
else if (value >= 99.95 || value < -99.95) return "F1";
|
||||
else if (value >= 9.995 || value < -9.995) return "F2";
|
||||
else if (value >= 0.9995 || value < -0.9995) return "F3";
|
||||
else if (value >= 0.09995 || value < -0.09995) return "F4";
|
||||
else if (value >= 0.009995 || value < -0.009995) return "F5";
|
||||
else if (value >= 0.0009995 || value < -0.0009995) return "F6";
|
||||
else if (value >= 0.00009995 || value < -0.00009995) return "F7";
|
||||
else return "F8";
|
||||
}
|
||||
else if (sigDigits == 3)
|
||||
{
|
||||
if (value >= 99.5 || value < -99.5) return "F0";
|
||||
else if (value >= 9.95 || value < -9.95) return "F1";
|
||||
else if (value >= 0.995 || value < -0.995) return "F2";
|
||||
else if (value >= 0.0995 || value < -0.0995) return "F3";
|
||||
else if (value >= 0.00995 || value < -0.00995) return "F4";
|
||||
else if (value >= 0.000995 || value < -0.000995) return "F5";
|
||||
else if (value >= 0.0000995 || value < -0.0000995) return "F6";
|
||||
else return "F7";
|
||||
}
|
||||
else if (sigDigits == 2)
|
||||
{
|
||||
if (value >= 9.5 || value < -9.5) return "F0";
|
||||
else if (value >= 0.95 || value < -0.95) return "F1";
|
||||
else if (value >= 0.095 || value < -0.095) return "F2";
|
||||
else if (value >= 0.0095 || value < -0.0095) return "F3";
|
||||
else if (value >= 0.00095 || value < -0.00095) return "F4";
|
||||
else if (value >= 0.000095 || value < -0.000095) return "F5";
|
||||
else return "F6";
|
||||
}
|
||||
else /// if (sigDigits == 1)
|
||||
{
|
||||
if (value >= 0.95 || value < -0.95) return "F0";
|
||||
else if (value >= 0.095 || value < -0.095) return "F1";
|
||||
else if (value >= 0.0095 || value < -0.0095) return "F2";
|
||||
else if (value >= 0.00095 || value < -0.00095) return "F3";
|
||||
else if (value >= 0.000095 || value < -0.000095) return "F4";
|
||||
else return "F5";
|
||||
}
|
||||
}
|
||||
|
||||
public static Parity GetParity(string str, Parity defaultParity = Parity.None)
|
||||
{
|
||||
if (str.Equals(Parity.None.ToString())) return Parity.None;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -30,7 +30,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<DefineConstants>TRACE;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ namespace Config
|
||||
public const int CompoundWMsCount = 0;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 1;
|
||||
#elif BADGER_MALA_TRAT || BERLIN || FUZHOU_150 || FUZHOU_300 || GELSENWASSER || GENESIS || IZRAEL_200 || PETERSBURG_200 || SENTEC || SLM_150 || TORINO_50 || TURA_SPECIAL
|
||||
#elif BADGER_MALA_TRAT || BERLIN || FUZHOU_150 || FUZHOU_300 || GELSENWASSER || GENESIS || IZRAEL_200 || PETERSBURG_200 || SENTEC || SLM_150 || TORINO_50
|
||||
public const int WMsCount = 6;
|
||||
public const int LineSize = 6;
|
||||
public const int CompoundWMsCount = 1;
|
||||
@@ -38,7 +38,7 @@ namespace Config
|
||||
public const int CompoundWMsCount = 3;
|
||||
public const int HeatMetersCount = 0;
|
||||
public const int MaxPartNr = 3;
|
||||
#elif RUM_MOB
|
||||
#elif RUM_MOB || TURA_SPECIAL
|
||||
public const int WMsCount = 8;
|
||||
public const int LineSize = 8;
|
||||
public const int CompoundWMsCount = 1;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class MeasurementCorrection : Common.IMeasurementCorrection
|
||||
public class MeasurementCorrection : Common.IMeasurementCorrection, IComparable<MeasurementCorrection>
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int RangeIx { get; set; } /// 0..5
|
||||
public virtual float Measurement { get; set; }
|
||||
public virtual float Correction { get; set; }
|
||||
public virtual double Measurement { get; set; }
|
||||
public virtual double Correction { get; set; }
|
||||
|
||||
public MeasurementCorrection()
|
||||
{
|
||||
@@ -23,6 +23,10 @@ namespace Config.Entities
|
||||
RangeIx = rangeIx;
|
||||
}
|
||||
|
||||
public virtual int CompareTo(MeasurementCorrection other)
|
||||
{
|
||||
return (Measurement > other.Measurement) ? 1 : ((Measurement == other.Measurement) ? 0 : -1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates corrected value from a list of corrections by interpolation.
|
||||
@@ -76,5 +80,10 @@ namespace Config.Entities
|
||||
/// rawValue is above the highest value in the correction table
|
||||
return corrections[corrections.Count - 1].Correction;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} {1} ({2})", Measurement, Correction, RangeIx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2019-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Globalization;
|
||||
@@ -27,6 +27,7 @@ namespace Config.Entities
|
||||
public virtual double PressLimHi { get; set; } /// [bar] max. water pressure
|
||||
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
|
||||
public virtual bool Evaluate { get; set; }
|
||||
public virtual string Method { get; set; } /// Test method (component name)
|
||||
|
||||
public virtual sbyte E1 { get; set; } ///
|
||||
public virtual sbyte E2 { get; set; } ///
|
||||
@@ -81,6 +82,7 @@ namespace Config.Entities
|
||||
PressLimHi = 16.0; /// [bar]
|
||||
Publish = (sbyte)Common.Publish.Always;
|
||||
Evaluate = true;
|
||||
Method = string.Empty;
|
||||
|
||||
E1 = (sbyte)ErrorFlagsMode.On;
|
||||
E2 = (sbyte)ErrorFlagsMode.On;
|
||||
@@ -140,6 +142,7 @@ namespace Config.Entities
|
||||
result.PressLimHi = PressLimHi;
|
||||
result.Publish = Publish;
|
||||
result.Evaluate = Evaluate;
|
||||
result.Method = Method;
|
||||
|
||||
result.E1 = E1;
|
||||
result.E2 = E2;
|
||||
@@ -193,6 +196,7 @@ namespace Config.Entities
|
||||
output.WriteLine(PressLimHi.ToString(ci));
|
||||
output.WriteLine(Publish.ToString());
|
||||
output.WriteLine(Evaluate.ToString());
|
||||
output.WriteLine(Method);
|
||||
|
||||
output.WriteLine(E1.ToString());
|
||||
output.WriteLine(E2.ToString());
|
||||
@@ -247,10 +251,29 @@ namespace Config.Entities
|
||||
tst.ErrLimHi = double.Parse(input.ReadLine(), ci);
|
||||
tst.TempLimLo = double.Parse(input.ReadLine(), ci);
|
||||
tst.TempLimHi = double.Parse(input.ReadLine(), ci);
|
||||
tst.Publish = sbyte.Parse(input.ReadLine());
|
||||
tst.PressLimLo = double.Parse(input.ReadLine(), ci);
|
||||
tst.PressLimHi = double.Parse(input.ReadLine(), ci);
|
||||
tst.Publish = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.Evaluate = bool.Parse(input.ReadLine());
|
||||
tst.Method = input.ReadLine();
|
||||
|
||||
/// TODO (E1 .. E21)
|
||||
tst.E1 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E2 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E3 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E4 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E5 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E6 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E7 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E8 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E9 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E10 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E11 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E12 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E13 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E14 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E15 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E16 = sbyte.Parse(input.ReadLine(), ci);
|
||||
tst.E21 = sbyte.Parse(input.ReadLine(), ci);
|
||||
|
||||
tst.Delta_Q_pct = double.Parse(input.ReadLine(), ci);
|
||||
tst.Delta_T = double.Parse(input.ReadLine(), ci);
|
||||
@@ -293,6 +316,7 @@ namespace Config.Entities
|
||||
ln = inp.ReadLine(); if (ln != PressLimHi.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_max", PressLimHi.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Publish.ToString()) { diff.AppendFormat(fmt, "Publish", Publish.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Evaluate.ToString()) { diff.AppendFormat(fmt, "Evaluate", Evaluate.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Method) { diff.AppendFormat(fmt, "Method", Method, ln); };
|
||||
|
||||
ln = inp.ReadLine(); if (ln != E1.ToString()) { diff.AppendFormat(fmt, "E1", E1.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E2.ToString()) { diff.AppendFormat(fmt, "E2", E2.ToString(), ln); };
|
||||
|
||||
@@ -78,6 +78,8 @@ namespace Config.Entities
|
||||
output.WriteLine(CreationTime.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(LastChgUser);
|
||||
output.WriteLine(LastChgTime.ToString(CultureInfo.InvariantCulture));
|
||||
output.WriteLine(((sbyte)ProfileType).ToString());
|
||||
output.WriteLine(((sbyte)ErrorLimitType).ToString());
|
||||
|
||||
foreach (var test in Tests) { test.Export(output); }
|
||||
output.WriteLine();
|
||||
@@ -96,7 +98,8 @@ namespace Config.Entities
|
||||
result.CreationTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
result.LastChgUser = input.ReadLine();
|
||||
result.LastChgTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
|
||||
string line = input.ReadLine();
|
||||
result.ProfileType = (ProfileType)sbyte.Parse(input.ReadLine());
|
||||
result.ErrorLimitType = (ErrorLimitType)sbyte.Parse(input.ReadLine());
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
||||
+50
-5
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -57,7 +57,14 @@ namespace Config.Entities
|
||||
public virtual string TransBefore { get; set; }
|
||||
public virtual string TransBetween { get; set; }
|
||||
public virtual string TransAfter { get; set; }
|
||||
|
||||
#if ORACLE_DB
|
||||
public virtual int OraId { get; set; }
|
||||
public virtual int OraIdRepetMulti { get; set; }
|
||||
public virtual string OraDesignation { get; set; }
|
||||
public virtual int RawDataId { get; set; }
|
||||
public virtual int RawDataIdRepetMulti { get; set; }
|
||||
public virtual string RawDataDesignation { get; set; }
|
||||
#endif
|
||||
public virtual bool IsOuterLoopStart { get; set; } /// Not mapped to database
|
||||
public virtual bool IsOuterLoopEnd { get; set; } /// Not mapped to database
|
||||
|
||||
@@ -112,7 +119,15 @@ namespace Config.Entities
|
||||
TransBefore = string.Empty;
|
||||
TransBetween = string.Empty;
|
||||
TransAfter = string.Empty;
|
||||
}
|
||||
#if ORACLE_DB
|
||||
OraId = 0;
|
||||
OraIdRepetMulti = 0;
|
||||
OraDesignation = string.Empty;
|
||||
RawDataId = 0;
|
||||
RawDataIdRepetMulti = 0;
|
||||
RawDataDesignation = string.Empty;
|
||||
#endif
|
||||
}
|
||||
|
||||
public Test(string name, int itemNr, Procedure procedure)
|
||||
: this()
|
||||
@@ -192,6 +207,14 @@ namespace Config.Entities
|
||||
result.TransBefore = TransBefore;
|
||||
result.TransBetween = TransBetween;
|
||||
result.TransAfter = TransAfter;
|
||||
#if ORACLE_DB
|
||||
result.OraId = OraId;
|
||||
result.OraIdRepetMulti = OraIdRepetMulti;
|
||||
result.OraDesignation = OraDesignation;
|
||||
result.RawDataId = RawDataId;
|
||||
result.RawDataIdRepetMulti = RawDataIdRepetMulti;
|
||||
result.RawDataDesignation = RawDataDesignation;
|
||||
#endif
|
||||
result.VolumeUnit = VolumeUnit;
|
||||
result.FlowUnit = FlowUnit;
|
||||
result.MassUnit = MassUnit;
|
||||
@@ -242,7 +265,14 @@ namespace Config.Entities
|
||||
output.WriteLine(TransBetween);
|
||||
output.WriteLine(Profile);
|
||||
output.WriteLine(TransAfter);
|
||||
|
||||
#if ORACLE_DB
|
||||
output.WriteLine(OraId);
|
||||
output.WriteLine(OraIdRepetMulti);
|
||||
output.WriteLine(OraDesignation);
|
||||
output.WriteLine(RawDataId);
|
||||
output.WriteLine(RawDataIdRepetMulti);
|
||||
output.WriteLine(RawDataDesignation);
|
||||
#endif
|
||||
foreach (var prms in MoreParams) { prms.Export(output); }
|
||||
output.WriteLine();
|
||||
}
|
||||
@@ -296,6 +326,14 @@ namespace Config.Entities
|
||||
: line.Equals(TestProfile.UserDefinedHeatMeter.ToString()) ? TestProfile.UserDefinedHeatMeter
|
||||
: line.Equals(TestProfile.Protected.ToString()) ? TestProfile.Protected : TestProfile.UserDefined; /// UserDefined is the default
|
||||
tst.TransAfter = input.ReadLine();
|
||||
#if ORACLE_DB
|
||||
tst.OraId = int.Parse(input.ReadLine(), ci);
|
||||
tst.OraIdRepetMulti = int.Parse(input.ReadLine(), ci);
|
||||
tst.OraDesignation = input.ReadLine();
|
||||
tst.RawDataId = int.Parse(input.ReadLine(), ci);
|
||||
tst.RawDataIdRepetMulti = int.Parse(input.ReadLine(), ci);
|
||||
tst.RawDataDesignation = input.ReadLine();
|
||||
#endif
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -355,7 +393,14 @@ namespace Config.Entities
|
||||
ln = inp.ReadLine(); if (ln != TransBetween) { diff.AppendFormat(fmt, "RelTransBetween", TransBetween, ln); };
|
||||
ln = inp.ReadLine(); if (ln != Profile.ToString()) { diff.AppendFormat(fmt, "RelTransAfter", Profile, ln); };
|
||||
ln = inp.ReadLine(); if (ln != TransAfter) { diff.AppendFormat(fmt, "TransitionAfter", TransAfter, ln); };
|
||||
|
||||
#if ORACLE_DB
|
||||
ln = inp.ReadLine(); if (ln != OraId.ToString(ci)) { diff.AppendFormat(fmt, "OraId", OraId.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != OraIdRepetMulti.ToString(ci)) { diff.AppendFormat(fmt, "OraIdRepetMulti", OraIdRepetMulti.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != OraDesignation) { diff.AppendFormat(fmt, "OraDesignation", OraDesignation, ln); };
|
||||
ln = inp.ReadLine(); if (ln != RawDataId.ToString(ci)) { diff.AppendFormat(fmt, "RawDataId", RawDataId.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != RawDataIdRepetMulti.ToString(ci)){ diff.AppendFormat(fmt, "RawDataIdRepetMulti", RawDataIdRepetMulti.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != RawDataDesignation) { diff.AppendFormat(fmt, "RawDataDesignation", RawDataDesignation, ln); };
|
||||
#endif
|
||||
return diff.ToString();
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace Config
|
||||
case Common.GID.Administrators:
|
||||
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
|
||||
case Common.GID.TraceabilityManagement:
|
||||
#elif KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_END
|
||||
#elif KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_50 || WARSAW_END
|
||||
case Common.GID.MetrologicalAuthority:
|
||||
case Common.GID.WaterMeterAuthority:
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
@@ -15,7 +15,8 @@ namespace Config.Mappings
|
||||
Map(x => x.Name);
|
||||
Map(x => x.Qfrom);
|
||||
Map(x => x.Qto);
|
||||
Map(x => x.TempMtrUp).Column("TempIn");
|
||||
Map(x => x.Selector);
|
||||
Map(x => x.TempMtrUp).Column("TempIn");
|
||||
Map(x => x.TempMtrDown).Column("TempOut");
|
||||
Map(x => x.PressMtrUp).Column("PressIn");
|
||||
Map(x => x.PressMtrDown).Column("PressOut");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
@@ -15,7 +15,8 @@ namespace Config.Mappings
|
||||
Map(x => x.Name);
|
||||
Map(x => x.Qfrom);
|
||||
Map(x => x.Qto);
|
||||
Map(x => x.Pump);
|
||||
Map(x => x.Selector);
|
||||
Map(x => x.Pump);
|
||||
Map(x => x.RegulValvesPct);
|
||||
Map(x => x.ValvesOpen)
|
||||
.CustomType("StringClob")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
@@ -15,7 +15,8 @@ namespace Config.Mappings
|
||||
Map(x => x.Name);
|
||||
Map(x => x.Qfrom);
|
||||
Map(x => x.Qto);
|
||||
Map(x => x.RegulValve);
|
||||
Map(x => x.Selector);
|
||||
Map(x => x.RegulValve);
|
||||
Map(x => x.FlowMeter);
|
||||
Map(x => x.PidCoef);
|
||||
Map(x => x.StartValve);
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Config.Mappings
|
||||
Map(x => x.PressLimHi);
|
||||
Map(x => x.Publish);
|
||||
Map(x => x.Evaluate);
|
||||
Map(x => x.Method);
|
||||
Map(x => x.E1);
|
||||
Map(x => x.E2);
|
||||
Map(x => x.E3);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
@@ -62,6 +62,14 @@ namespace Config.Mappings
|
||||
.Column("RelTransBetween");
|
||||
Map(x => x.TransAfter)
|
||||
.Column("TransitionAfter");
|
||||
#if ORACLE_DB
|
||||
Map(x => x.OraId);
|
||||
Map(x => x.OraIdRepetMulti);
|
||||
Map(x => x.OraDesignation);
|
||||
Map(x => x.RawDataId);
|
||||
Map(x => x.RawDataIdRepetMulti);
|
||||
Map(x => x.RawDataDesignation);
|
||||
#endif
|
||||
|
||||
HasMany(x => x.MoreParams)
|
||||
.Cascade.All();
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Sensus")]
|
||||
[assembly: AssemblyProduct("Config")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2018 Sensus Slovensko a.s.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2022 Sensus Slovensko a.s.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -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.26.1519.0")]
|
||||
[assembly: AssemblyFileVersion("2.26.1519.0")]
|
||||
[assembly: AssemblyVersion("2.31.1990.0")]
|
||||
[assembly: AssemblyFileVersion("2.31.1990.0")]
|
||||
|
||||
+1
-190
@@ -1,90 +1,15 @@
|
||||
///
|
||||
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Common;
|
||||
|
||||
namespace Config
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
public static string SignificantDigitsToFmt(double value, int sigDigits)
|
||||
{
|
||||
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";
|
||||
else if (value >= 99.995 || value < -99.995) return "F2";
|
||||
else if (value >= 9.9995 || value < -9.9995) return "F3";
|
||||
else if (value >= 0.99995 || value < -0.99995) return "F4";
|
||||
else if (value >= 0.099995 || value < -0.099995) return "F5";
|
||||
else if (value >= 0.0099995 || value < -0.0099995) return "F6";
|
||||
else if (value >= 0.00099995 || value < -0.00099995) return "F7";
|
||||
else if (value >= 0.000099995 || value < -0.000099995) return "F8";
|
||||
else return "F9";
|
||||
}
|
||||
else if (sigDigits == 4)
|
||||
{
|
||||
if (value >= 999.5 || value < -999.5) return "F0";
|
||||
else if (value >= 99.95 || value < -99.95) return "F1";
|
||||
else if (value >= 9.995 || value < -9.995) return "F2";
|
||||
else if (value >= 0.9995 || value < -0.9995) return "F3";
|
||||
else if (value >= 0.09995 || value < -0.09995) return "F4";
|
||||
else if (value >= 0.009995 || value < -0.009995) return "F5";
|
||||
else if (value >= 0.0009995 || value < -0.0009995) return "F6";
|
||||
else if (value >= 0.00009995 || value < -0.00009995) return "F7";
|
||||
else return "F8";
|
||||
}
|
||||
else if (sigDigits == 3)
|
||||
{
|
||||
if (value >= 99.5 || value < -99.5) return "F0";
|
||||
else if (value >= 9.95 || value < -9.95) return "F1";
|
||||
else if (value >= 0.995 || value < -0.995) return "F2";
|
||||
else if (value >= 0.0995 || value < -0.0995) return "F3";
|
||||
else if (value >= 0.00995 || value < -0.00995) return "F4";
|
||||
else if (value >= 0.000995 || value < -0.000995) return "F5";
|
||||
else if (value >= 0.0000995 || value < -0.0000995) return "F6";
|
||||
else return "F7";
|
||||
}
|
||||
else if (sigDigits == 2)
|
||||
{
|
||||
if (value >= 9.5 || value < -9.5) return "F0";
|
||||
else if (value >= 0.95 || value < -0.95) return "F1";
|
||||
else if (value >= 0.095 || value < -0.095) return "F2";
|
||||
else if (value >= 0.0095 || value < -0.0095) return "F3";
|
||||
else if (value >= 0.00095 || value < -0.00095) return "F4";
|
||||
else if (value >= 0.000095 || value < -0.000095) return "F5";
|
||||
else return "F6";
|
||||
}
|
||||
else /// if (sigDigits == 1)
|
||||
{
|
||||
if (value >= 0.95 || value < -0.95) return "F0";
|
||||
else if (value >= 0.095 || value < -0.095) return "F1";
|
||||
else if (value >= 0.0095 || value < -0.0095) return "F2";
|
||||
else if (value >= 0.00095 || value < -0.00095) return "F3";
|
||||
else if (value >= 0.000095 || value < -0.000095) return "F4";
|
||||
else return "F5";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Extract and return a DB server from a MySQL connection string.
|
||||
/// </summary>
|
||||
@@ -139,119 +64,5 @@ namespace Config
|
||||
/// pattern NOT found
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get either Q1 or Qmin flow for a given Qn and metrological class
|
||||
/// </summary>
|
||||
/// <param name="Qn">Nominal flow in m3/h</param>
|
||||
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
|
||||
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
|
||||
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
|
||||
/// <returns>Q1 or Qmin flow in m3/h</returns>
|
||||
public static double GetQ1Qmin(double Qn, string metroClass, Medium medium = Medium.ColdWater, double Qdflt = 0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
|
||||
|
||||
int metroClassRatio;
|
||||
if ((metroClass[0] == 'R') && int.TryParse(metroClass.Substring(1), out metroClassRatio) && (metroClassRatio > 0))
|
||||
{
|
||||
return Qn / (double)metroClassRatio;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (medium == Medium.HotWater)
|
||||
{
|
||||
switch (metroClass)
|
||||
{
|
||||
case "A": return (Qn < 15) ? (0.04 * Qn) : (0.08 * Qn);
|
||||
case "B": return (Qn < 15) ? (0.02 * Qn) : (0.04 * Qn);
|
||||
case "C": return (Qn < 15) ? (0.01 * Qn) : (0.02 * Qn);
|
||||
case "D": return (Qn < 15) ? (0.01 * Qn) : Qdflt;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (metroClass)
|
||||
{
|
||||
case "A": return (Qn < 15) ? (0.04 * Qn) : (0.08 * Qn);
|
||||
case "B": return (Qn < 15) ? (0.02 * Qn) : (0.03 * Qn);
|
||||
case "C": return (Qn < 15) ? (0.01 * Qn) : (0.006 * Qn);
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Qdflt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get either Q2 or Qt flow for a given Qn and metrological class
|
||||
/// </summary>
|
||||
/// <param name="Qn">Nominal flow in m3/h</param>
|
||||
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
|
||||
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
|
||||
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
|
||||
/// <returns>Q2 or Qt flow in m3/h</returns>
|
||||
public static double GetQ2Qt(double Qn, string metroClass, Medium medium = Medium.ColdWater, double Qdflt = 0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
|
||||
|
||||
int metroClassRatio;
|
||||
if ((metroClass[0] == 'R') && int.TryParse(metroClass.Substring(1), out metroClassRatio) && (metroClassRatio > 0))
|
||||
{
|
||||
return 1.6 * Qn / (double)metroClassRatio;
|
||||
}
|
||||
|
||||
if (medium == Medium.HotWater)
|
||||
{
|
||||
switch (metroClass)
|
||||
{
|
||||
case "A": return (Qn < 15) ? (0.1 * Qn) : (0.2 * Qn);
|
||||
case "B": return (Qn < 15) ? (0.08 * Qn) : (0.15 * Qn);
|
||||
case "C": return (Qn < 15) ? (0.06 * Qn) : (0.1 * Qn);
|
||||
case "D": return (Qn < 15) ? (0.015 * Qn) : Qdflt;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (metroClass)
|
||||
{
|
||||
case "A": return (Qn < 15) ? (0.1 * Qn) : (0.3 * Qn);
|
||||
case "B": return (Qn < 15) ? (0.08 * Qn) : (0.2 * Qn);
|
||||
case "C": return (Qn < 15) ? (0.015 * Qn) : (0.015 * Qn);
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
return Qdflt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get either Q4 or Qmax flow for a given Qn and metrological class
|
||||
/// </summary>
|
||||
/// <param name="Qn">Nominal flow in m3/h</param>
|
||||
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
|
||||
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
|
||||
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
|
||||
/// <returns>Q4 or Qmax flow in m3/h</returns>
|
||||
public static double GetQ4Qmax(double Qn, string metroClass, Medium medium = Medium.ColdWater, double Qdflt = 0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
|
||||
|
||||
switch (metroClass[0])
|
||||
{
|
||||
case 'A':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
return 2 * Qn;
|
||||
case 'R':
|
||||
return 1.25 * Qn;
|
||||
default:
|
||||
return Qdflt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
@@ -76,6 +76,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>full</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
@@ -99,6 +100,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>none</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System">
|
||||
|
||||
@@ -105,6 +105,7 @@ namespace Results
|
||||
foreach (var ti in procedure.GetTestInstances())
|
||||
{
|
||||
TestData td = TestData.UpdateList(d.TestDataList, new TestData(ti.Test));
|
||||
if (!d.Batch.Tests.Contains(td)) d.Batch.Tests.Add(td);
|
||||
|
||||
/// Create an empty test result and add it to the list
|
||||
TestRslt tr = new TestRslt(d.Batch, td, ti.Test.Part, ti.Repetition);
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace Results.Entities
|
||||
public virtual int Counter10 { get; set; }
|
||||
public virtual DateTime StartTime { get; set; }
|
||||
public virtual DateTime EndTime { get; set; }
|
||||
public virtual DateTime SaveTime { get; set; }
|
||||
public virtual bool Dirty { get; set; }
|
||||
public virtual bool RsltsSent { get; set; }
|
||||
public virtual bool RsltsPrinted { get; set; }
|
||||
@@ -157,6 +158,7 @@ namespace Results.Entities
|
||||
Counter10 = oriBatch.Counter10;
|
||||
StartTime = oriBatch.StartTime;
|
||||
EndTime = oriBatch.EndTime;
|
||||
SaveTime = oriBatch.SaveTime;
|
||||
Dirty = oriBatch.Dirty;
|
||||
RsltsSent = oriBatch.RsltsSent;
|
||||
RsltsPrinted = oriBatch.RsltsPrinted;
|
||||
@@ -321,16 +323,19 @@ namespace Results.Entities
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("Batch #{0}, Start:{1}, End:{2}, Procedure:{3}", BatchNr, StartTime, EndTime, ProcedureName);
|
||||
return string.Format("Batch {0} ({1}s) Start {2}, End {3}, Proc={4}",
|
||||
BatchNr, (EndTime - StartTime).TotalSeconds, StartTime, EndTime, ProcedureName);
|
||||
}
|
||||
|
||||
public virtual string ToString(int i)
|
||||
{
|
||||
return string.Format("Batch: BatchNr={0} ProgramVersion={1} TestBenchId={2} UserName={3} UserNumber={4} ProcedureName={5}{6} ProcRev={7} ProtocolTitle={8} Remark={9} RealDensity={10} AtTemperature={11} Buoyancy={12} StartTime={13} EndTime={14} Dirty={15} RsltsSent={16} RsltsPrinted={17}",
|
||||
BatchNr, ProgramVersion, TestBenchId, UserName, UserNumber,
|
||||
return string.Format("Batch {0} ({1}s) ver={2} TestBenchId={3} User={4}/{5} Proc={6}{7} Rev={8} Remark={9} RealDensity={10} AtTemperature={11} Buoyancy={12} StartTime={13} EndTime={14} SaveTime={15} RsltsSent={16} RsltsPrinted={17}",
|
||||
BatchNr,
|
||||
(EndTime - StartTime).TotalSeconds,
|
||||
ProgramVersion, TestBenchId, UserName, UserNumber,
|
||||
ProcedureName, (IsRemoteProcedure ? "(R)" : ""), ProcedureRevision,
|
||||
ProtocolTitle, Remark, RealDensity, AtTemperature, Buoyancy,
|
||||
StartTime, EndTime, Dirty, RsltsSent, RsltsPrinted);
|
||||
Remark, RealDensity, AtTemperature, Buoyancy,
|
||||
StartTime, EndTime, SaveTime, RsltsSent, RsltsPrinted);
|
||||
}
|
||||
|
||||
public virtual void WriteBinary(BinaryWriter writer)
|
||||
@@ -364,6 +369,7 @@ namespace Results.Entities
|
||||
writer.Write(Counter10);
|
||||
writer.Write(StartTime.ToString());
|
||||
writer.Write(EndTime.ToString());
|
||||
writer.Write(SaveTime.ToString());
|
||||
writer.Write(Dirty);
|
||||
writer.Write(RsltsSent);
|
||||
writer.Write(RsltsPrinted);
|
||||
@@ -431,6 +437,7 @@ namespace Results.Entities
|
||||
Counter10 = reader.ReadInt32();
|
||||
StartTime = DateTime.Parse(reader.ReadString());
|
||||
EndTime = DateTime.Parse(reader.ReadString());
|
||||
SaveTime = DateTime.Parse(reader.ReadString());
|
||||
Dirty = reader.ReadBoolean();
|
||||
RsltsSent = reader.ReadBoolean();
|
||||
RsltsPrinted = reader.ReadBoolean();
|
||||
|
||||
@@ -106,6 +106,13 @@ namespace Results.Entities
|
||||
public virtual bool IsDataStream() { return (RegReaderType == (int)RegisterReaderType.DataStream); }
|
||||
public virtual bool IsManual() { return (RegReaderType == (int)RegisterReaderType.Manual); }
|
||||
|
||||
public virtual string PassedOrErrorFlagsStr()
|
||||
{
|
||||
string eFlags = Utils.ErrorFlagsStr(ErrorIndicators);
|
||||
var str = string.IsNullOrEmpty(eFlags) ? PassedColorStr(null) : eFlags;
|
||||
return str;
|
||||
}
|
||||
|
||||
public virtual string PassedColorStr(string yesNoFormatOrEmpty)
|
||||
{
|
||||
if (string.IsNullOrEmpty(yesNoFormatOrEmpty))
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Results.Entities
|
||||
@@ -31,7 +32,14 @@ namespace Results.Entities
|
||||
public virtual string TempControl { get; set; }
|
||||
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
|
||||
public virtual bool Evaluate { get; set; }
|
||||
|
||||
#if ORACLE_DB
|
||||
public virtual int OraId { get; set; }
|
||||
public virtual int OraIdRepetMulti { get; set; }
|
||||
public virtual string OraDesignation { get; set; }
|
||||
public virtual int RawDataId { get; set; }
|
||||
public virtual int RawDataIdRepetMulti { get; set; }
|
||||
public virtual string RawDataDesignation { get; set; }
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor, safe values
|
||||
@@ -61,7 +69,15 @@ namespace Results.Entities
|
||||
TempControl = test.TempControl;
|
||||
Publish = test.Publish;
|
||||
Evaluate = test.DoEvaluate;
|
||||
}
|
||||
#if ORACLE_DB
|
||||
OraId = test.OraId;
|
||||
OraIdRepetMulti = test.OraIdRepetMulti;
|
||||
OraDesignation = test.OraDesignation;
|
||||
RawDataId = test.RawDataId;
|
||||
RawDataIdRepetMulti = test.RawDataIdRepetMulti;
|
||||
RawDataDesignation = test.RawDataDesignation;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copy constructor, copies all except of Id
|
||||
@@ -84,6 +100,14 @@ namespace Results.Entities
|
||||
TempControl = oriTestData.TempControl;
|
||||
Publish = oriTestData.Publish;
|
||||
Evaluate = oriTestData.Evaluate;
|
||||
#if ORACLE_DB
|
||||
OraId = oriTestData.OraId;
|
||||
OraIdRepetMulti = oriTestData.OraIdRepetMulti;
|
||||
OraDesignation = oriTestData.OraDesignation;
|
||||
RawDataId = oriTestData.RawDataId;
|
||||
RawDataIdRepetMulti = oriTestData.RawDataIdRepetMulti;
|
||||
RawDataDesignation = oriTestData.RawDataDesignation;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +134,14 @@ namespace Results.Entities
|
||||
if (TempControl != td.TempControl) return false;
|
||||
if (Publish != td.Publish) return false;
|
||||
if (Evaluate != td.Evaluate) return false;
|
||||
|
||||
#if ORACLE_DB
|
||||
if (OraId != td.OraId) return false;
|
||||
if (OraIdRepetMulti != td.OraIdRepetMulti) return false;
|
||||
if (OraDesignation != td.OraDesignation) return false;
|
||||
if (RawDataId != td.RawDataId) return false;
|
||||
if (RawDataIdRepetMulti != td.RawDataIdRepetMulti) return false;
|
||||
if (RawDataDesignation != td.RawDataDesignation) return false;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -152,6 +183,14 @@ namespace Results.Entities
|
||||
writer.Write((TempControl != null) ? TempControl : string.Empty);
|
||||
writer.Write(Publish);
|
||||
writer.Write(Evaluate);
|
||||
#if ORACLE_DB
|
||||
writer.Write(OraId);
|
||||
writer.Write(OraIdRepetMulti);
|
||||
writer.Write((OraDesignation != null) ? OraDesignation : string.Empty);
|
||||
writer.Write(RawDataId);
|
||||
writer.Write(RawDataIdRepetMulti);
|
||||
writer.Write((RawDataDesignation != null) ? RawDataDesignation : string.Empty);
|
||||
#endif
|
||||
}
|
||||
|
||||
public virtual void ReadBinary(BinaryReader reader)
|
||||
@@ -173,6 +212,19 @@ namespace Results.Entities
|
||||
TempControl = reader.ReadString();
|
||||
Publish = reader.ReadSByte();
|
||||
Evaluate = reader.ReadBoolean();
|
||||
#if ORACLE_DB
|
||||
OraId = reader.ReadInt32();
|
||||
OraIdRepetMulti = reader.ReadInt32();
|
||||
OraDesignation = reader.ReadString();
|
||||
RawDataId = reader.ReadInt32();
|
||||
RawDataIdRepetMulti = reader.ReadInt32();
|
||||
RawDataDesignation = reader.ReadString();
|
||||
#endif
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} (P.{1},{2})", Name, ((Publish)Publish).ToString(), Evaluate ? "E" : "-");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,8 @@ namespace Results.Entities
|
||||
public virtual int Counter5 { get; set; }
|
||||
|
||||
/// Wrappers
|
||||
public virtual string Name() { return Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); }
|
||||
public virtual string Name() { return Common.Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); }
|
||||
public virtual string Key() { return string.Format("{0}~{1}~{2}~{3}", TestData.Name, Part, TestData.Repeats, RepetitionNr); } /// Unique key
|
||||
public virtual int Repeats() { return TestData.Repeats; }
|
||||
public virtual double Qfrom() { return TestData.Qfrom; }
|
||||
public virtual double Qto() { return TestData.Qto; }
|
||||
@@ -164,6 +165,15 @@ namespace Results.Entities
|
||||
public virtual bool IsDiverter() { return (MethodClass != null) ? ((MethodClass.Contains("FlyingStart") && MethodClass.Contains("MassColl")) || MethodClass.Contains("DiverterTest")) : true; }
|
||||
public virtual bool IsVolumeMethod() { return (MethodClass != null) ? (MethodClass.Contains("TestMethods.FixedStart.") || MethodClass.Contains("TestMethods.FlyingStart.")) : false; }
|
||||
|
||||
#if ORACLE_DB
|
||||
public virtual int OraId() { return TestData.OraId; }
|
||||
public virtual int OraIdRepetMulti() { return TestData.OraIdRepetMulti; }
|
||||
public virtual string OraDesignation() { return TestData.OraDesignation; }
|
||||
public virtual int RawDataId() { return TestData.RawDataId; }
|
||||
public virtual int RawDataIdRepetMulti() { return TestData.RawDataIdRepetMulti; }
|
||||
public virtual string RawDataDesignation() { return TestData.RawDataDesignation; }
|
||||
#endif
|
||||
|
||||
public virtual string MethodElde()
|
||||
{
|
||||
if (MethodClass == null) return string.Empty;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -97,8 +97,6 @@ namespace Results.Entities
|
||||
public virtual int WMTypeRevision { get; set; }
|
||||
public virtual int Pruefindex { get; set; } /// >=1 ... pruefindex, 0 ... unknown (no reading from DB yet)
|
||||
public virtual int HydrPruefung { get; set; }
|
||||
public virtual object RawTestInfos { get; set; } /// Not mapped to DB !!! IList<SensusTestInfo> fetched from Oracle at the beginning of the cycle, not mapped to DB !!!
|
||||
public virtual object CompleteTestInfos { get; set; } /// Not mapped to DB !!! SensusTestInfo[] obtained as a best match at the beginning of the cycle, not mapped to DB !!!
|
||||
#endif
|
||||
public virtual int ProcessId { get; set; } /// Not mapped to DB !!! Tracing DB Process ID
|
||||
public virtual int SessionId { get; set; } /// Not mapped to DB !!! 1 (regular tracing DB session) or 2 (alternative tracing DB session)
|
||||
@@ -252,7 +250,9 @@ namespace Results.Entities
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if ORACLE_DB
|
||||
if (Utils.MaxTestIndex != 0 && (Pruefindex % 100) > Utils.MaxTestIndex) passed = false;
|
||||
#endif
|
||||
return passed;
|
||||
}
|
||||
|
||||
@@ -446,8 +446,6 @@ namespace Results.Entities
|
||||
WMTypeRevision = 0;
|
||||
Pruefindex = 0;
|
||||
HydrPruefung = 0;
|
||||
RawTestInfos = null;
|
||||
CompleteTestInfos = null;
|
||||
#endif
|
||||
ProcessId = 0;
|
||||
SessionId = 0;
|
||||
@@ -510,8 +508,6 @@ namespace Results.Entities
|
||||
WMTypeRevision = src.WMTypeRevision;
|
||||
Pruefindex = src.Pruefindex;
|
||||
HydrPruefung = src.HydrPruefung;
|
||||
RawTestInfos = src.RawTestInfos; /// Not mapped to DB
|
||||
CompleteTestInfos = src.CompleteTestInfos; /// Not mapped to DB
|
||||
#endif
|
||||
ProcessId = src.ProcessId; /// Not mapped to DB
|
||||
SessionId = src.SessionId; /// Not mapped to DB
|
||||
@@ -692,22 +688,6 @@ namespace Results.Entities
|
||||
writer.Write(WMTypeRevision);
|
||||
writer.Write(Pruefindex);
|
||||
writer.Write(HydrPruefung);
|
||||
|
||||
/// Write RawTestInfos
|
||||
IList<Results.Output.SensusTestInfo> rawTestInfos = RawTestInfos as IList<Results.Output.SensusTestInfo>;
|
||||
writer.Write((rawTestInfos != null) ? rawTestInfos.Count : 0);
|
||||
if (rawTestInfos != null)
|
||||
{
|
||||
for (int i = 0; i < rawTestInfos.Count; i++) rawTestInfos[i].WriteBinary(writer);
|
||||
}
|
||||
|
||||
/// Write CompleteTestInfos
|
||||
Results.Output.SensusTestInfo[] completeTestInfos = CompleteTestInfos as Results.Output.SensusTestInfo[];
|
||||
writer.Write((completeTestInfos != null) ? completeTestInfos.Length : 0);
|
||||
if (completeTestInfos != null)
|
||||
{
|
||||
for (int i = 0; i < completeTestInfos.Length; i++) completeTestInfos[i].WriteBinary(writer);
|
||||
}
|
||||
#endif
|
||||
writer.Write(ProcessId);
|
||||
writer.Write(SessionId);
|
||||
@@ -788,28 +768,6 @@ namespace Results.Entities
|
||||
WMTypeRevision = reader.ReadInt32();
|
||||
Pruefindex = reader.ReadInt32();
|
||||
HydrPruefung = reader.ReadInt32();
|
||||
|
||||
/// Read RawTestInfos
|
||||
int rawTestInfosCount = reader.ReadInt32();
|
||||
IList<Results.Output.SensusTestInfo> rawTestInfos = new List<Results.Output.SensusTestInfo>();
|
||||
for (int i = 0; i < rawTestInfosCount; i++)
|
||||
{
|
||||
Results.Output.SensusTestInfo ti = new Results.Output.SensusTestInfo();
|
||||
ti.ReadBinary(reader);
|
||||
rawTestInfos.Add(ti);
|
||||
}
|
||||
RawTestInfos = rawTestInfos;
|
||||
|
||||
/// Read CompleteTestInfos
|
||||
int completeTestInfosLen = reader.ReadInt32();
|
||||
Results.Output.SensusTestInfo[] completeTestInfos = new Results.Output.SensusTestInfo[completeTestInfosLen];
|
||||
for (int i = 0; i < completeTestInfosLen; i++)
|
||||
{
|
||||
Results.Output.SensusTestInfo ti = new Results.Output.SensusTestInfo();
|
||||
ti.ReadBinary(reader);
|
||||
completeTestInfos[i] = ti;
|
||||
}
|
||||
CompleteTestInfos = completeTestInfos;
|
||||
#endif
|
||||
ProcessId = reader.ReadInt32();
|
||||
SessionId = reader.ReadInt32();
|
||||
|
||||
@@ -79,18 +79,18 @@ namespace Results.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
/// Update background color
|
||||
/// Update background color and caption
|
||||
string message = string.Empty;
|
||||
UpdateBkColor(wMtr.GetColorOfResults(false, out message));
|
||||
|
||||
/// Update caption
|
||||
#if ORACLE_DB
|
||||
bool maxRepeatsExceeded = (Utils.MaxTestIndex != 0 && (wMtr.Pruefindex % 100) > Utils.MaxTestIndex);
|
||||
UpdateBkColor(wMtr.GetColorOfResults(maxRepeatsExceeded, out message));
|
||||
tBox.Text = caption = string.Format("{0} ({1}) {2} {3}",
|
||||
wMtr.WMPosition,
|
||||
wMtr.Pruefindex == 0 ? "?" : string.Format("{0}x", wMtr.Pruefindex % 100),
|
||||
(string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr),
|
||||
message);
|
||||
#else
|
||||
UpdateBkColor(wMtr.GetColorOfResults(false, out message));
|
||||
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -91,21 +91,21 @@ namespace Results.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
/// Update background color
|
||||
/// Update background color and caption
|
||||
string message = string.Empty;
|
||||
UpdateBkColor(wMtr.GetColorOfResults(false, out message));
|
||||
|
||||
/// Update caption
|
||||
#if ORACLE_DB
|
||||
bool maxRepeatsExceeded = (Utils.MaxTestIndex != 0 && (wMtr.Pruefindex % 100) > Utils.MaxTestIndex);
|
||||
UpdateBkColor(wMtr.GetColorOfResults(maxRepeatsExceeded, out message));
|
||||
tBox.Text = caption = string.Format("{0} ({1}) {2} {3}",
|
||||
wMtr.WMPosition,
|
||||
wMtr.Pruefindex == 0 ? "?" : string.Format("{0}x", wMtr.Pruefindex % 100),
|
||||
(string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr),
|
||||
message);
|
||||
#else
|
||||
UpdateBkColor(wMtr.GetColorOfResults(false, out message));
|
||||
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
|
||||
UpdateWMPos(wMtr.WMPosition);
|
||||
|
||||
/// Update test results
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Results.Mappings
|
||||
|
||||
Map(x => x.StartTime);
|
||||
Map(x => x.EndTime);
|
||||
Map(x => x.SaveTime);
|
||||
Map(x => x.Dirty);
|
||||
Map(x => x.RsltsSent);
|
||||
Map(x => x.RsltsPrinted);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
@@ -24,6 +24,14 @@ namespace Results.Mappings
|
||||
Map(x => x.ErrLimMargin).Column("Uncertainty");
|
||||
Map(x => x.Publish);
|
||||
Map(x => x.Evaluate);
|
||||
}
|
||||
#if ORACLE_DB
|
||||
Map(x => x.OraId);
|
||||
Map(x => x.OraIdRepetMulti);
|
||||
Map(x => x.OraDesignation);
|
||||
Map(x => x.RawDataId);
|
||||
Map(x => x.RawDataIdRepetMulti);
|
||||
Map(x => x.RawDataDesignation);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Sensus")]
|
||||
[assembly: AssemblyProduct("Results")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2019 Sensus Slovensko, a.s.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2022 Sensus Slovensko, a.s.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -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.27.1844.0")]
|
||||
[assembly: AssemblyFileVersion("2.27.1844.0")]
|
||||
[assembly: AssemblyVersion("2.31.1990.0")]
|
||||
[assembly: AssemblyFileVersion("2.31.1990.0")]
|
||||
|
||||
+2
-11
@@ -19,7 +19,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -29,7 +29,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DefineConstants>TRACE;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
@@ -75,12 +75,6 @@
|
||||
<Compile Include="Entities\WaterMeterData.cs" />
|
||||
<Compile Include="Entities\WaterMeter.cs" />
|
||||
<Compile Include="DB.cs" />
|
||||
<Compile Include="Forms\BatchResultsDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\BatchResultsDlg.Designer.cs">
|
||||
<DependentUpon>BatchResultsDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\IOneWMResultsCtrl.cs" />
|
||||
<Compile Include="Forms\ManualEntryConfigCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
@@ -213,9 +207,6 @@
|
||||
<Folder Include="Output\FileWriters\OneFilePerMeter\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Forms\BatchResultsDlg.resx">
|
||||
<DependentUpon>BatchResultsDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\ManualEntryConfigCtrl.resx">
|
||||
<DependentUpon>ManualEntryConfigCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
+3
-6
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Text;
|
||||
@@ -9,12 +9,9 @@ namespace Results
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
public static string GetTestName(string name, int repeats, int repetitionNr)
|
||||
{
|
||||
return Common.Utils.GetTestName(name, repeats, repetitionNr);
|
||||
}
|
||||
public static int MaxTestIndex = 0;
|
||||
|
||||
|
||||
|
||||
public static int BenchIdOracle2Asc(int benchIdOracle)
|
||||
{
|
||||
switch (benchIdOracle)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -331,11 +331,12 @@ namespace Results
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ThreeState, "Three state result", Quantity.Enumerated, ItemCategory.MeterResult, (w, t, u, f, p) => FormatThreeState(f, w.ThreeStateFromTests())));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Scale, "Scale", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Scale()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter, "Diverter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Diverter()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.RegValve, "Reg. valve", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RegValve()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Scale, "Scale", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Scale()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter, "Diverter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Diverter()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.RegValve, "Reg. valve", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RegValve()) : string.Empty));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult,(w, t, u, f, p) => (w.GetMeterTestRslt(t) != null) ? FormatStr(f, w.GetMeterTestRslt(t).PassedOrErrorFlagsStr())
|
||||
: FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
|
||||
|
||||
///
|
||||
/// Water meter info
|
||||
@@ -677,7 +678,7 @@ namespace Results
|
||||
int significantDigits;
|
||||
if (int.TryParse(precision.Substring(1), out significantDigits))
|
||||
{
|
||||
precision = Config.Utils.SignificantDigitsToFmt(val, significantDigits);
|
||||
precision = Common.Utils.SignificantDigitsToFmt(val, significantDigits);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -715,7 +716,7 @@ namespace Results
|
||||
int significantDigits;
|
||||
if (int.TryParse(precision.Substring(1), out significantDigits))
|
||||
{
|
||||
precision = Config.Utils.SignificantDigitsToFmt(val1, significantDigits);
|
||||
precision = Common.Utils.SignificantDigitsToFmt(val1, significantDigits);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Sensus")]
|
||||
[assembly: AssemblyProduct("ResultsBrowser")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015 - 2020 Sensus Slovensko a.s.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015 - 2022 Sensus Slovensko a.s.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -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.26.1577.0")]
|
||||
[assembly: AssemblyFileVersion("2.26.1577.0")]
|
||||
[assembly: AssemblyVersion("2.31.1990.0")]
|
||||
[assembly: AssemblyFileVersion("2.31.1990.0")]
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -32,7 +32,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DefineConstants>TRACE;TURA_IPERL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
|
||||
@@ -15,8 +15,6 @@ namespace ResultsParser
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static ISessionFactory sessionFactory;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Bench: [WR15]");
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Statistics
|
||||
|
||||
MidOrWaterMetersCtrl ctrl = new MidOrWaterMetersCtrl();
|
||||
ctrl.MidId = midId;
|
||||
ctrl.Parent = this;
|
||||
ctrl.ParentDlg = this;
|
||||
ctrl.Dock = DockStyle.Fill;
|
||||
|
||||
tp.Controls.Add(ctrl);
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Statistics.UserControls
|
||||
public partial class MidOrWaterMetersCtrl : UserControl
|
||||
{
|
||||
public int MidId; /// 1-based MID Id.
|
||||
public StatisticsDlg Parent;
|
||||
public StatisticsDlg ParentDlg;
|
||||
|
||||
|
||||
public bool IsFlowEnabled(int i)
|
||||
@@ -82,7 +82,7 @@ namespace Statistics.UserControls
|
||||
|
||||
public IList<TestRslt> UpdateRequest(int benchId)
|
||||
{
|
||||
return Parent.UpdateRequest(benchId, MidId);
|
||||
return ParentDlg.UpdateRequest(benchId, MidId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,11 +8,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TBF", "TBF\TBF.csproj", "{8
|
||||
{0C0A1F4D-1363-4544-A7C5-196C76D26CCA} = {0C0A1F4D-1363-4544-A7C5-196C76D26CCA}
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE} = {46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}
|
||||
{5D9B49E3-CDF9-4A27-80B4-58141D0EB0E0} = {5D9B49E3-CDF9-4A27-80B4-58141D0EB0E0}
|
||||
{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B} = {6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Results", "Results\Results.csproj", "{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B} = {6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Config", "Config\Config.csproj", "{743DF7DB-C7B6-42EB-986D-0F485E5588E4}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B} = {6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResultsBrowser", "ResultsBrowser\ResultsBrowser.csproj", "{07BA543A-54CA-4A59-9AD9-DDE7038E1BF9}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
|
||||
+1
-1
@@ -144,7 +144,7 @@ namespace TBF
|
||||
IEnumerable<string> files = Directory.EnumerateFiles(TempImagesDir); /// TODO: Implement recursive directory delete
|
||||
foreach (var file in files) File.Delete(file);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show("Error creating a local application data directory and preparing an initial configuration", "Fatal error");
|
||||
return; /// Fatal error
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Sensus")]
|
||||
[assembly: AssemblyProduct("TestBenchFramework")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2022 Sensus Slovensko, a.s.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013 - 2023 Sensus Slovensko, a.s.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.28.1925.0")]
|
||||
[assembly: AssemblyFileVersion("2.28.1925.0")]
|
||||
[assembly: AssemblyVersion("2.32.2022.0")]
|
||||
[assembly: AssemblyFileVersion("2.32.2022.0")]
|
||||
|
||||
Generated
+28
-1
@@ -357,6 +357,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to any profile.
|
||||
/// </summary>
|
||||
internal static string any_profile {
|
||||
get {
|
||||
return ResourceManager.GetString("any_profile", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Approval.
|
||||
/// </summary>
|
||||
@@ -664,7 +673,7 @@ namespace TBF.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Calibration Specialist.
|
||||
/// Looks up a localized string similar to Legalizator.
|
||||
/// </summary>
|
||||
internal static string Calibration_Specialist {
|
||||
get {
|
||||
@@ -3264,6 +3273,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to no profile.
|
||||
/// </summary>
|
||||
internal static string no_profile {
|
||||
get {
|
||||
return ResourceManager.GetString("no_profile", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to No results to print.
|
||||
/// </summary>
|
||||
@@ -5739,6 +5757,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Test {0} config. error : {1} is missing.
|
||||
/// </summary>
|
||||
internal static string Test_0_config_error_1_is_missing {
|
||||
get {
|
||||
return ResourceManager.GetString("Test_0_config_error_1_is_missing", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Test bench.
|
||||
/// </summary>
|
||||
|
||||
@@ -673,10 +673,10 @@
|
||||
<value>Tiskárna</value>
|
||||
</data>
|
||||
<data name="Procedure" xml:space="preserve">
|
||||
<value>Postup</value>
|
||||
<value>Prodedura</value>
|
||||
</data>
|
||||
<data name="Procedures" xml:space="preserve">
|
||||
<value>Postupy</value>
|
||||
<value>Procedury</value>
|
||||
</data>
|
||||
<data name="Producer" xml:space="preserve">
|
||||
<value>Výrobce</value>
|
||||
@@ -688,7 +688,7 @@
|
||||
<value>Restart programu vyžaduje použít některá nastavení</value>
|
||||
</data>
|
||||
<data name="Progress" xml:space="preserve">
|
||||
<value>V činnosti</value>
|
||||
<value>Postup</value>
|
||||
</data>
|
||||
<data name="Properties" xml:space="preserve">
|
||||
<value>Vlastnosti</value>
|
||||
@@ -1680,4 +1680,7 @@
|
||||
<data name="Delay" xml:space="preserve">
|
||||
<value>Zpoždění</value>
|
||||
</data>
|
||||
<data name="Test_0_config_error_1_is_missing" xml:space="preserve">
|
||||
<value>Konfigurace testu {0} : chybí {1}</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -199,7 +199,8 @@
|
||||
<value>Parametry stanowiska</value>
|
||||
</data>
|
||||
<data name="Calibration_Specialist" xml:space="preserve">
|
||||
<value>Specjalistyczna kalibracja</value>
|
||||
<value>Legalizator</value>
|
||||
<comment>Specjalistyczna kalibracja</comment>
|
||||
</data>
|
||||
<data name="Camera_error" xml:space="preserve">
|
||||
<value>Błąd kamery</value>
|
||||
|
||||
@@ -424,7 +424,7 @@
|
||||
<value>Administrator</value>
|
||||
</data>
|
||||
<data name="Calibration_Specialist" xml:space="preserve">
|
||||
<value>Calibration Specialist</value>
|
||||
<value>Legalizator</value>
|
||||
</data>
|
||||
<data name="Head_of_Lab" xml:space="preserve">
|
||||
<value>Head of Lab</value>
|
||||
@@ -2311,4 +2311,13 @@
|
||||
<data name="Delay" xml:space="preserve">
|
||||
<value>Delay</value>
|
||||
</data>
|
||||
<data name="Test_0_config_error_1_is_missing" xml:space="preserve">
|
||||
<value>Test {0} config. error : {1} is missing</value>
|
||||
</data>
|
||||
<data name="any_profile" xml:space="preserve">
|
||||
<value>any profile</value>
|
||||
</data>
|
||||
<data name="no_profile" xml:space="preserve">
|
||||
<value>no profile</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -134,7 +134,7 @@ namespace TBF.Rig
|
||||
{
|
||||
if (GetRuntimeProcParamsProvider() == null)
|
||||
{
|
||||
/// Component has no test parametes
|
||||
/// Component has no procedure parameters
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace TBF.Rig
|
||||
{
|
||||
if (GetRuntimeTestParamsProvider() == null)
|
||||
{
|
||||
/// Component has no test parametes
|
||||
/// Component has no test parameters
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -488,6 +488,13 @@ namespace TBF.Rig.DataEntry.S620
|
||||
/// <param name="currentFocusOwner">TextBox control which received the event</param>
|
||||
private void ProcKeyPress(object sender, KeyPressEventArgs e, ComboBox currentFocusOwner)
|
||||
{
|
||||
if (e.KeyChar == 'ľ' || e.KeyChar == 'š' || e.KeyChar == 'č' || e.KeyChar == 'ť' || e.KeyChar == 'ž' || e.KeyChar == 'ý' || e.KeyChar == 'á' || e.KeyChar == 'í' || e.KeyChar == 'é')
|
||||
{
|
||||
MessageBox.Show("Zlá klávesnica !!!");
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.KeyChar == '+')
|
||||
{
|
||||
/// Process '+' key ..... Form completed
|
||||
|
||||
@@ -859,6 +859,13 @@ namespace TBF.Rig.DataEntry.S620
|
||||
/// <param name="currentFocusOwner">TextBox control which received the event</param>
|
||||
private void BodyNoTextBoxKeyPress(object sender, KeyPressEventArgs e, int wmNr0)
|
||||
{
|
||||
if (e.KeyChar == 'ľ' || e.KeyChar == 'š' || e.KeyChar == 'č' || e.KeyChar == 'ť' || e.KeyChar == 'ž' || e.KeyChar == 'ý' || e.KeyChar == 'á' || e.KeyChar == 'í' || e.KeyChar == 'é')
|
||||
{
|
||||
MessageBox.Show("Zlá klávesnica !!!");
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (closeButton != '\0' && e.KeyChar == closeButton)
|
||||
{
|
||||
/// Process '+' key ..... Form completed
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -16,8 +16,24 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(EntryForm));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
const string DfltOcrWorkspaceFolder = "C:\\TBF\\OCR\\";
|
||||
const string DfltOcrWorkspaceExt = ".vrws";
|
||||
|
||||
static Dictionary<string, OcrVidi> ocrDictionary = new Dictionary<string, OcrVidi>();
|
||||
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
|
||||
public string OcrWorkspace
|
||||
{
|
||||
get { return (entryFormCfg != null && entryFormCfg.ProcParams != null) ? entryFormCfg.ProcParams.OcrWorkspace : string.Empty; }
|
||||
}
|
||||
|
||||
public string OcrStream
|
||||
{
|
||||
get { return (entryFormCfg != null && entryFormCfg.ProcParams != null) ? entryFormCfg.ProcParams.OcrStream : string.Empty; }
|
||||
}
|
||||
|
||||
IRegReader[] regReaders;
|
||||
|
||||
|
||||
@@ -28,26 +44,13 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
if (entryFormCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
startImages = new string[] { "C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg" };
|
||||
startImages = new string[] { "C:\\TBF\\Images\\Test\\Image1.jpg", "C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg", "C:\\TBF\\Images\\Test\\Image4.jpg", "C:\\TBF\\Images\\Test\\Image5.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image1.jpg", "C:\\TBF\\Images\\Test\\Image2.jpg", "C:\\TBF\\Images\\Test\\Image3.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image4.jpg", "C:\\TBF\\Images\\Test\\Image5.jpg", "C:\\TBF\\Images\\Test\\Image1.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image2.jpg", "C:\\TBF\\Images\\Test\\Image3.jpg", "C:\\TBF\\Images\\Test\\Image4.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image5.jpg", "C:\\TBF\\Images\\Test\\Image1.jpg", "C:\\TBF\\Images\\Test\\Image2.jpg",
|
||||
"C:\\TBF\\Images\\Test\\Image3.jpg", "C:\\TBF\\Images\\Test\\Image4.jpg", "C:\\TBF\\Images\\Test\\Image5.jpg" };
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -110,7 +113,6 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
CurrentOp currentOp;
|
||||
|
||||
|
||||
public EntryForm() { }
|
||||
|
||||
public EntryForm(Generic.IComponentCfg cfg)
|
||||
@@ -213,21 +215,75 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
///
|
||||
void OpenTestStartStatesDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, startImages, disabled);
|
||||
string ocrMessage;
|
||||
var ocr = GetOcr(myRef.OcrWorkspace, out ocrMessage);
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, ocr, ocrMessage, myRef.OcrStream,
|
||||
startImages, disabled);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenTestEndStatesDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, endImages, wmStartState, wmStartStateStr, disabled, refVolume, errLimLo, errLimHi);
|
||||
string ocrMessage;
|
||||
var ocr = GetOcr(myRef.OcrWorkspace, out ocrMessage);
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, ocr, ocrMessage, myRef.OcrStream,
|
||||
startImages, wmStartState, wmStartStateStr, endImages, disabled,
|
||||
refVolume, errLimLo, errLimHi);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenDeferredTestEvalDlg(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, startImages, endImages, disabled, refVolume, errLimLo, errLimHi);
|
||||
string ocrMessage;
|
||||
var ocr = GetOcr(myRef.OcrWorkspace, out ocrMessage);
|
||||
myRef.modelessDlg = new TestStartEndForm(TBF.Data.WMsCount, myRef.regReaders, ocr, ocrMessage, myRef.OcrStream,
|
||||
startImages, endImages, disabled,
|
||||
refVolume, errLimLo, errLimHi);
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
OcrVidi GetOcr(string ocrWorkspace, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
if (string.IsNullOrEmpty(ocrWorkspace)) return null; /// No OCR was configured
|
||||
|
||||
string fullPath = (ocrWorkspace.Contains("\\") || ocrWorkspace.Contains("/"))
|
||||
? ocrWorkspace.Replace('/', '\\')
|
||||
: System.IO.Path.Combine(DfltOcrWorkspaceFolder, ocrWorkspace);
|
||||
if (!fullPath.Contains(".")) fullPath = fullPath + DfltOcrWorkspaceExt;
|
||||
|
||||
OcrVidi ocrVidi;
|
||||
if (ocrDictionary.TryGetValue(fullPath, out ocrVidi))
|
||||
{
|
||||
log.InfoFormat("existing OcrVidi({0}) was retrieved from dictionary", fullPath);
|
||||
return ocrVidi;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ocrVidi = new OcrVidi(fullPath);
|
||||
ocrDictionary.Add(fullPath, ocrVidi);
|
||||
log.WarnFormat("new OcrVidi({0}) was added to dictionary", fullPath);
|
||||
return ocrVidi;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e.InnerException != null)
|
||||
{
|
||||
log.ErrorFormat("new OcrVidi({0}) thrown {1}: {2} / {3}",
|
||||
fullPath, e.GetType().ToString(), e.Message,e.InnerException.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.ErrorFormat("new OcrVidi({0}) thrown {1}: {2}",
|
||||
fullPath, e.GetType().ToString(), e.Message);
|
||||
}
|
||||
log.ErrorFormat("Stack trace:\r\n{0}", e.StackTrace);
|
||||
|
||||
message = string.Format("Cannot load OCR workspace:\r\n{0}\r\nOCR workspace file is {1}", e.Message, fullPath);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
@@ -349,7 +405,9 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
for (int i = 0; i < dlg.WaterMetersCount; i++)
|
||||
{
|
||||
wmEndState[i] = dlg.WMEndState[i];
|
||||
wmStartState[i] = dlg.WMStartState[i];
|
||||
wmStartStateStr[i] = dlg.WMStartStateStr[i];
|
||||
wmEndState[i] = dlg.WMEndState[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.StandardCamera
|
||||
@@ -27,9 +28,18 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
public string ProtocolTitle3;
|
||||
public string ProtocolTitle4;
|
||||
|
||||
|
||||
/// <summary> Procedure parameters </summary>
|
||||
[XmlIgnore]
|
||||
public ProcParams ProcParams;
|
||||
public override IParamsProvider GetRuntimeProcParamsProvider() { return ProcParams; }
|
||||
public override IParamsProvider CreateProcParamsProvider() { return new ProcParams(true); }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
EntryFormCfg()
|
||||
{
|
||||
ProcParams = new ProcParams(true);
|
||||
|
||||
Name = "DataEntry-for-Camera";
|
||||
ParentName = string.Empty;
|
||||
HideOrder = false;
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
using System.Collections.Generic;
|
||||
#if OCR
|
||||
using ViDi2;
|
||||
#endif
|
||||
|
||||
namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
public class OcrVidi
|
||||
{
|
||||
#if OCR
|
||||
/// Static variable: OCR ViDi control can only have one instance
|
||||
static ViDi2.Runtime.IControl control;
|
||||
readonly IWorkspace workspace;
|
||||
#endif
|
||||
readonly string ocrWorkspaceFile;
|
||||
|
||||
/// <summary>
|
||||
/// Create OcrVidi wrapper class
|
||||
/// </summary>
|
||||
/// <param name="ocrWorkspaceFile">Cognex runtime workspace file (vrws)</param>
|
||||
public OcrVidi(string ocrWorkspaceFile)
|
||||
{
|
||||
this.ocrWorkspaceFile = ocrWorkspaceFile;
|
||||
#if OCR
|
||||
if (control == null)
|
||||
{
|
||||
/// Create and initialize the main control
|
||||
control = new ViDi2.Runtime.Local.Control(GpuMode.NoSupport);
|
||||
control.InitializeComputeDevices(GpuMode.NoSupport, new List<int>() { }); /// Initializes all CUDA devices
|
||||
}
|
||||
|
||||
/// Open a runtime workspace from file
|
||||
workspace = control.Workspaces.Add(string.Format("ws{0}", control.Workspaces.Count + 1), ocrWorkspaceFile);
|
||||
#endif
|
||||
}
|
||||
|
||||
public string Recognize(string streamName, string imagePath, double denominator = 1000, string format = "F3")
|
||||
{
|
||||
#if OCR
|
||||
IStream stream;
|
||||
try { stream = workspace.Streams[streamName]; }
|
||||
catch (Exception) { return string.Empty; }
|
||||
if (stream == null) return string.Empty;
|
||||
|
||||
string findedText = string.Empty; /// Hladane cislo - stav vodomera - string
|
||||
double findedValue = 0; /// Hladane cislo - stav vodomera
|
||||
bool finded = false; /// Ci sme nasli hodnotu
|
||||
|
||||
// load an image from file
|
||||
using (IImage image = new ViDi2.Local.LibraryImage(imagePath)) //disposing the image when we do not need it anymore
|
||||
{
|
||||
// allocates a sample with the image
|
||||
using (ISample sample = stream.CreateSample(image))
|
||||
{
|
||||
ITool tool = stream.Tools["Read"];
|
||||
|
||||
// process image with the blue read tool
|
||||
sample.Process(tool);
|
||||
|
||||
IBlueMarking blueReadMarking = sample.Markings[tool.Name] as IBlueMarking;
|
||||
|
||||
foreach (IBlueView view in blueReadMarking.Views)
|
||||
{
|
||||
foreach (IMatch match in view.Matches)
|
||||
{
|
||||
//System.Console.WriteLine($"This model says \" {(match as IReadModelMatch).FeatureString} \" with a score of {match.Score}");
|
||||
string word = (match as IReadModelMatch).FeatureString;
|
||||
if (word.Length >= 7 && word.Length <= 8 // hladane cislo ma od 7 do 8 znakov
|
||||
&& double.TryParse(word,out findedValue)) // a ak najdeny text je cislo
|
||||
{
|
||||
findedValue /= denominator; // Convert to m3, red digits are fractions of m3
|
||||
finded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (finded) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (finded)
|
||||
{
|
||||
findedText = findedValue.ToString(format);
|
||||
}
|
||||
|
||||
return findedText;
|
||||
#else
|
||||
return null;
|
||||
#endif
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return ocrWorkspaceFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
///
|
||||
/// Copyright (c) 2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
public class ProcParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ProcParams) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public string OcrWorkspace; /// Path to a Cognex workspace file
|
||||
public string OcrStream; /// Cognex workspace stream name
|
||||
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
OcrWorkspace = string.Empty;
|
||||
OcrStream = "default";
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"OCR workspace file",
|
||||
"OCR stream",
|
||||
};
|
||||
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 OcrWorkspace;
|
||||
case 1: return OcrStream;
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string str)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: OcrWorkspace = str; return CfgUpdateFlags.None;
|
||||
case 1: OcrStream = str; return CfgUpdateFlags.None;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifiy the string representation of the parameter
|
||||
/// </summary>
|
||||
/// <param name="i">Parameter ID</param>
|
||||
/// <param name="str">String representation of the parameter</param>
|
||||
/// <param name="message">In case false is returned this is the error messsage to be displayed</param>
|
||||
/// <returns>true = parameter OK, false = parameter NOK</returns>
|
||||
public bool ValidateParam(int i, string str, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return true;
|
||||
case 1:
|
||||
if (!string.IsNullOrEmpty(str)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(ProcParams prms)
|
||||
{
|
||||
prms.OcrWorkspace = OcrWorkspace;
|
||||
prms.OcrStream = OcrStream;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
ProcParams pars = new ProcParams();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public override void UpdateFromDbEntity(ComponentProcedure dbEntity)
|
||||
{
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
{
|
||||
ProcParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as ProcParams;
|
||||
|
||||
procedureParamsEntity = dbEntity;
|
||||
componentName = dbEntity.CmpntName;
|
||||
procedure = dbEntity.Procedure;
|
||||
|
||||
if (tmp != null) tmp.CopyContentTo(this);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameterless constructor initializes the parameters
|
||||
/// </summary>
|
||||
public ProcParams()
|
||||
{
|
||||
}
|
||||
|
||||
public ProcParams(bool initialize)
|
||||
{
|
||||
if (initialize) InitializeAll();
|
||||
}
|
||||
|
||||
public ProcParams(ComponentProcedure procParamsEntity, string componentName, Procedure procedure)
|
||||
{
|
||||
this.procedureParamsEntity = procParamsEntity;
|
||||
this.componentName = componentName;
|
||||
this.procedure = procedure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
using System.IO;
|
||||
|
||||
namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
@@ -33,22 +35,30 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TestStartEndForm));
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
const Unit unit = Unit.m3;
|
||||
|
||||
// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
readonly Tst mode; /// Start, End or Deferred
|
||||
readonly Tst mode; /// Start, End or Deferred
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
readonly string[] startImages;
|
||||
readonly string[] endImages;
|
||||
readonly double refVolume;
|
||||
readonly double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
readonly double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
readonly double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||
readonly double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||
readonly OcrVidi ocrVidi;
|
||||
readonly string ocrMessage;
|
||||
readonly string streamName;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
double denominator; /// derived from PulsesPerLtr, passed to OcrVidi
|
||||
string format; /// derived from PulsesPerLtr, passed to OcrVidi
|
||||
|
||||
// To be retrieved after the form closes
|
||||
public double[] WMStartState;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
@@ -57,23 +67,26 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
// To be retrieved after the form closes
|
||||
public double[] WMEndState;
|
||||
|
||||
|
||||
const int TextBoxesCount = 24;
|
||||
|
||||
|
||||
string lastImageName;
|
||||
Bitmap lastImage; /// non-zoomed image
|
||||
int lastWmNr1;
|
||||
Bitmap lastImage; /// non-zoomed image
|
||||
Bitmap zoomedImage;
|
||||
|
||||
Thread imageProcessingThread; /// Thread to process images
|
||||
public delegate void OcrTextObtainedDelegate(int ix, bool isEnd, string text);
|
||||
OcrTextObtainedDelegate ocrTextObtained;
|
||||
|
||||
static int wmNr0b;
|
||||
static Rotation[] imageRotation;
|
||||
static Rotation imageRotation;
|
||||
static bool[] isZoomed;
|
||||
static Point[] zoomCenterLoc;
|
||||
///
|
||||
static TestStartEndForm()
|
||||
{
|
||||
wmNr0b = 0;
|
||||
imageRotation = new Rotation[TextBoxesCount];
|
||||
//imageRotation = new Rotation[TextBoxesCount];
|
||||
isZoomed = new bool[TextBoxesCount];
|
||||
zoomCenterLoc = new Point[TextBoxesCount];
|
||||
}
|
||||
@@ -127,6 +140,8 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
enabledTextBoxes = new List<TextBox>();
|
||||
|
||||
imageProcessingThread = null;
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
@@ -135,115 +150,141 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
/// Constructor to fill in start states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] startImages, bool[] disabled)
|
||||
/// <param name="regReaders">Array with register reader components</param>
|
||||
/// <param name="ocrVidi">Cognex wrapper object performing OCR or null</param>
|
||||
/// <param name="startImages">Array with paths to start images</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, OcrVidi ocrVidi, string ocrMessage, string streamName,
|
||||
string[] startImages, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
mode = Tst.Start;
|
||||
|
||||
this.regReaders = regReaders;
|
||||
this.WaterMetersCount = Math.Min(waterMetersCount, regReaders.Length);
|
||||
|
||||
this.regReaders = regReaders;
|
||||
this.WaterMetersCount = Math.Min(waterMetersCount, regReaders.Length);
|
||||
this.ocrVidi = ocrVidi;
|
||||
this.ocrMessage = ocrMessage;
|
||||
this.streamName = streamName;
|
||||
this.startImages = startImages;
|
||||
this.disabled = disabled;
|
||||
|
||||
if (startImages == null || startImages.Length != waterMetersCount)
|
||||
if (startImages == null || startImages.Length != WaterMetersCount)
|
||||
{
|
||||
throw (new Exception("Invalid 'startImages' argument"));
|
||||
throw new Exception("Invalid 'startImages' argument");
|
||||
}
|
||||
|
||||
this.endImages = new string[waterMetersCount];
|
||||
this.endImages = new string[WaterMetersCount];
|
||||
WMStartState = new double[WaterMetersCount];
|
||||
WMStartStateStr = new string[WaterMetersCount];
|
||||
|
||||
/// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters)
|
||||
int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize;
|
||||
|
||||
DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys);
|
||||
|
||||
Height = 555 + 30 * WaterMetersCount;
|
||||
|
||||
WMStartState = new double[waterMetersCount];
|
||||
WMStartStateStr = new string[waterMetersCount];
|
||||
}
|
||||
ConstructorCommon(regReaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to fill in end states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="wmStartStateStr">Information entered on test start</param>
|
||||
/// <param name="regReaders">Array with register reader components</param>
|
||||
/// <param name="ocrVidi">Cognex wrapper object performing OCR or null</param>
|
||||
/// <param name="endImages">Array with paths to end images</param>
|
||||
/// <param name="wmStartState">Array with start states in default volume units (liters)</param>
|
||||
/// <param name="wmStartStateStr">Information entered on test start</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] endImages, double[] wmStartState, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, OcrVidi ocrVidi, string ocrMessage, string streamName,
|
||||
string[] startImages, double[] wmStartState, string[] wmStartStateStr, string[] endImages,
|
||||
bool[] disabled, double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
mode = Tst.End;
|
||||
|
||||
this.regReaders = regReaders;
|
||||
this.WaterMetersCount = Math.Min(waterMetersCount, regReaders.Length);
|
||||
|
||||
if (endImages == null || endImages.Length != waterMetersCount ||
|
||||
wmStartState == null || wmStartState.Length != waterMetersCount ||
|
||||
wmStartStateStr == null || wmStartStateStr.Length != waterMetersCount)
|
||||
{
|
||||
throw (new Exception("Invalid argument(s)"));
|
||||
}
|
||||
|
||||
this.endImages = endImages;
|
||||
this.WMStartState = wmStartState;
|
||||
this.WMStartStateStr = wmStartStateStr;
|
||||
this.disabled = disabled;
|
||||
this.ocrVidi = ocrVidi;
|
||||
this.ocrMessage = ocrMessage;
|
||||
this.streamName = streamName;
|
||||
this.startImages = startImages;
|
||||
this.WMStartState = wmStartState;
|
||||
this.WMStartStateStr = wmStartStateStr;
|
||||
this.endImages = endImages;
|
||||
this.disabled = disabled;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
|
||||
this.startImages = new string[waterMetersCount];
|
||||
if (startImages == null || startImages.Length != WaterMetersCount ||
|
||||
wmStartState == null || wmStartState.Length != WaterMetersCount ||
|
||||
wmStartStateStr == null || wmStartStateStr.Length != WaterMetersCount ||
|
||||
endImages == null || endImages.Length != WaterMetersCount)
|
||||
{
|
||||
throw new Exception("Invalid argument(s)");
|
||||
}
|
||||
|
||||
/// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters)
|
||||
int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize;
|
||||
WMEndState = new double[WaterMetersCount];
|
||||
|
||||
DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys);
|
||||
ConstructorCommon(regReaders);
|
||||
}
|
||||
|
||||
Height = 555 + 30 * WaterMetersCount;
|
||||
|
||||
WMEndState = new double[waterMetersCount];
|
||||
}
|
||||
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] startImages, string[] endImages,
|
||||
bool[] disabled, double refVolume, double errLimLo, double errLimHi)
|
||||
/// <summary>
|
||||
/// Constructor for deferred evaluation, to fill in both start- and end-states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="regReaders">Array with register reader components</param>
|
||||
/// <param name="ocrVidi">Cognex wrapper object performing OCR or null</param>
|
||||
/// <param name="startImages">Array with paths to start images</param>
|
||||
/// <param name="endImages">Array with paths to end images</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, OcrVidi ocrVidi, string ocrMessage, string streamName,
|
||||
string[] startImages, string[] endImages, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
mode = Tst.Both;
|
||||
|
||||
this.regReaders = regReaders;
|
||||
this.WaterMetersCount = Math.Min(waterMetersCount, regReaders.Length);
|
||||
this.ocrVidi = ocrVidi;
|
||||
this.ocrMessage = ocrMessage;
|
||||
this.streamName = streamName;
|
||||
this.startImages = startImages;
|
||||
this.endImages = endImages;
|
||||
this.disabled = disabled;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
|
||||
if (startImages == null || startImages.Length != waterMetersCount ||
|
||||
endImages == null || endImages.Length != waterMetersCount)
|
||||
{
|
||||
throw (new Exception("Invalid argument(s)"));
|
||||
throw new Exception("Invalid argument(s)");
|
||||
}
|
||||
|
||||
this.startImages = startImages;
|
||||
this.endImages = endImages;
|
||||
this.disabled = disabled;
|
||||
this.refVolume = refVolume;
|
||||
this.warningLimLo = 2 * errLimLo;
|
||||
this.warningLimHi = 2 * errLimHi;
|
||||
WMStartState = new double[waterMetersCount];
|
||||
WMStartStateStr = new string[waterMetersCount];
|
||||
WMEndState = new double[waterMetersCount];
|
||||
|
||||
/// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters)
|
||||
int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize;
|
||||
|
||||
DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys);
|
||||
|
||||
Height = 555 + 30 * WaterMetersCount;
|
||||
|
||||
WMStartState = new double[waterMetersCount];
|
||||
WMStartStateStr = new string[waterMetersCount];
|
||||
WMEndState = new double[waterMetersCount];
|
||||
ConstructorCommon(regReaders);
|
||||
}
|
||||
|
||||
void ConstructorCommon(IRegReader[] regReaders)
|
||||
{
|
||||
/// For large benches with WaterMetersCount LE 6 is TBF.Data.LineSize==1 (compound meters)
|
||||
int lineSize = (WaterMetersCount <= 6) ? WaterMetersCount : TBF.Data.LineSize;
|
||||
|
||||
DeterminePhysPosWMPos(TextBoxesCount, WaterMetersCount, lineSize, out phys2wm, out wm2phys);
|
||||
|
||||
int nrLines = (TBF.Data.WMsCount - 1) / TBF.Data.LineSize + 1;
|
||||
if (nrLines == 1)
|
||||
{
|
||||
Width = 1040;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure the layout of labels/text boxes on the screen
|
||||
/// corresponds to the layout of watermeters of the test bench.
|
||||
@@ -292,7 +333,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
if (wmPos > 0)
|
||||
{
|
||||
labels[i].Text = string.Format("{0} {1}", Strings.Water_Meter, wmPos);
|
||||
labels[i].Text = wmPos.ToString();
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
@@ -318,10 +359,11 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
else
|
||||
{
|
||||
endTextBoxes[i].Enabled = true;
|
||||
enabledTextBoxes.Add(endTextBoxes[i]);
|
||||
startTextBoxes[i].Enabled = false;
|
||||
startTextBoxes[i].Text = WMStartStateStr[wmPos - 1];
|
||||
startTextBoxes[i].Enabled = true;
|
||||
startTextBoxes[i].Text = WMStartStateStr[wmPos - 1];
|
||||
endTextBoxes[i].Enabled = true;
|
||||
enabledTextBoxes.Add(startTextBoxes[i]);
|
||||
enabledTextBoxes.Add(endTextBoxes[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -343,16 +385,176 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(ocrMessage))
|
||||
{
|
||||
MessageBox.Show(ocrMessage, Strings.Warning, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
|
||||
int imagesCount = ImagesToProcessCount();
|
||||
log.WarnFormat("Images to process count = {0}", imagesCount);
|
||||
///
|
||||
if (imagesCount > 0 && ocrVidi != null)
|
||||
{
|
||||
log.WarnFormat("Starting image processing thread with OcrVidi={0} and OcrStream={1}", ocrVidi, streamName);
|
||||
|
||||
/// Delegate for a thread->form communication
|
||||
ocrTextObtained = new OcrTextObtainedDelegate(OnOcrTextObtained);
|
||||
|
||||
/// Show and initalize the progress bar
|
||||
imageProcessingProgressLabel.Visible = true;
|
||||
imageProcessingProgressBar.Visible = true;
|
||||
imageProcessingProgressBar.Minimum = 0;
|
||||
imageProcessingProgressBar.Value = 0;
|
||||
imageProcessingProgressBar.Maximum = imagesCount;
|
||||
|
||||
/// Start the image processing thread
|
||||
imageProcessingThread = new Thread(new ThreadStart(ImageProcessingThread));
|
||||
imageProcessingThread.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void TestStartEndForm_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
if (imageProcessingThread != null && imageProcessingThread.IsAlive)
|
||||
{
|
||||
imageProcessingThread.Join(2000);
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Water_Meter_States;
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
Text = (ocrVidi != null)
|
||||
? string.Format("{0} ({1} / {2})", Strings.Water_Meter_States, ocrVidi, streamName)
|
||||
: Strings.Water_Meter_States;
|
||||
|
||||
startLabel.Text = startLabel2.Text = string.Format("{0} [{1}]", Strings.Start, unit.ToDescription());
|
||||
endLabel.Text = endLabel2.Text = string.Format("{0} [{1}]", Strings.End, unit.ToDescription());
|
||||
okButton.Text = Strings.OkBtnText;
|
||||
}
|
||||
|
||||
int ImagesToProcessCount()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
/// Count the images
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
if ((mode == Tst.Start || mode == Tst.Both) && startTextBoxes[wm2phys[i + 1]].Enabled &&
|
||||
startImages != null && startImages.Length > i && !string.IsNullOrEmpty(startImages[i]))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
||||
if ((mode == Tst.End || mode == Tst.Both) && endTextBoxes[wm2phys[i + 1]].Enabled &&
|
||||
endImages != null && endImages.Length > i && !string.IsNullOrEmpty(endImages[i]))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
void ImageProcessingThread()
|
||||
{
|
||||
Thread.Sleep(2000);
|
||||
|
||||
bool[] startImgProcessed = new bool[WaterMetersCount];
|
||||
bool[] endImgProcessed = new bool[WaterMetersCount];
|
||||
|
||||
for (int attempt = 1; attempt <= 3; attempt++)
|
||||
{
|
||||
for (int i = 0; i < WaterMetersCount; i++)
|
||||
{
|
||||
double pulsesPerLtr = (regReaders != null && regReaders.Length > i && regReaders[i] != null) ? regReaders[i].PulsesPerLtr : 1;
|
||||
GetOcrParameters(pulsesPerLtr, out denominator, out format);
|
||||
|
||||
if ((mode == Tst.Start || mode == Tst.Both) && startTextBoxes[wm2phys[i + 1]].Enabled &&
|
||||
startImages != null && startImages.Length > i && !string.IsNullOrEmpty(startImages[i]))
|
||||
{
|
||||
if (!startImgProcessed[i])
|
||||
{
|
||||
try
|
||||
{
|
||||
/// Process a start image
|
||||
var text = ocrVidi.Recognize(streamName, startImages[i], denominator, format); /// OCR
|
||||
this.Invoke(ocrTextObtained, new object[] { wm2phys[i + 1], false, text });
|
||||
startImgProcessed[i] = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((mode == Tst.End || mode == Tst.Both) && endTextBoxes[wm2phys[i + 1]].Enabled &&
|
||||
endImages != null && endImages.Length > i && !string.IsNullOrEmpty(endImages[i]))
|
||||
{
|
||||
if (!endImgProcessed[i])
|
||||
{
|
||||
try
|
||||
{
|
||||
/// Process an end image
|
||||
var text = ocrVidi.Recognize(streamName, endImages[i], denominator, format); /// OCR
|
||||
this.Invoke(ocrTextObtained, new object[] { wm2phys[i + 1], true, text });
|
||||
endImgProcessed[i] = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GetOcrParameters(double pulsesPerLtr, out double denominator, out string format)
|
||||
{
|
||||
if (pulsesPerLtr == 0.1)
|
||||
{
|
||||
denominator = 100;
|
||||
format = "F2";
|
||||
}
|
||||
else if (pulsesPerLtr == 0.01)
|
||||
{
|
||||
denominator = 10;
|
||||
format = "F1";
|
||||
}
|
||||
else if (pulsesPerLtr == 10)
|
||||
{
|
||||
denominator = 10000;
|
||||
format = "F4";
|
||||
}
|
||||
else // if (pulsesPerLtr == 1)
|
||||
{
|
||||
denominator = 1000;
|
||||
format = "F3";
|
||||
}
|
||||
}
|
||||
|
||||
public void OnOcrTextObtained(int ix, bool isEnd, string text)
|
||||
{
|
||||
if (isEnd)
|
||||
{
|
||||
if (ix < endTextBoxes.Length && endTextBoxes[ix].Enabled)
|
||||
{
|
||||
endTextBoxes[ix].Text = text;
|
||||
LoadImage(null, Tst.End, ix);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ix < startTextBoxes.Length && startTextBoxes[ix].Enabled)
|
||||
{
|
||||
startTextBoxes[ix].Text = text;
|
||||
LoadImage(null, Tst.Start, ix);
|
||||
}
|
||||
}
|
||||
|
||||
imageProcessingProgressBar.Value++;
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs eArgs)
|
||||
{
|
||||
try
|
||||
@@ -363,20 +565,28 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
if (wmPos > 0)
|
||||
{
|
||||
if (startTextBoxes[i].Enabled)
|
||||
if (startTextBoxes[i].Enabled && startTextBoxes[i].Text != WMStartStateStr[wmPos - 1])
|
||||
{
|
||||
WMStartStateStr[wmPos - 1] = startTextBoxes[i].Text;
|
||||
WMStartState[wmPos - 1] = Utils.ParseUDouble(startTextBoxes[i].Text) * regReaders[wmPos - 1].LtrsPerPulse;
|
||||
}
|
||||
double val;
|
||||
if (Utils.TryParseUDouble(startTextBoxes[i].Text, out val))
|
||||
{
|
||||
WMStartState[wmPos - 1] = Units.ConvertFrom(unit, val); /// Convert to liters
|
||||
WMStartStateStr[wmPos - 1] = startTextBoxes[i].Text;
|
||||
}
|
||||
}
|
||||
|
||||
if (endTextBoxes[i].Enabled)
|
||||
{
|
||||
WMEndState[wmPos - 1] = Utils.ParseUDouble(endTextBoxes[i].Text) * regReaders[wmPos - 1].LtrsPerPulse;
|
||||
double val;
|
||||
if (Utils.TryParseUDouble(endTextBoxes[i].Text, out val))
|
||||
{
|
||||
WMEndState[wmPos - 1] = Units.ConvertFrom(unit, val); /// Convert to liters
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
log.ErrorFormat("Exception: {0}", e.Message);
|
||||
return;
|
||||
@@ -478,9 +688,17 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
try
|
||||
{
|
||||
double startVolumeLtr = Utils.ParseUDouble(startTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
|
||||
double endVolumeLtr = Utils.ParseUDouble(endTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
|
||||
double err = 100.0 * (endVolumeLtr - startVolumeLtr - refVolume) / refVolume;
|
||||
double startV = Utils.ParseUDouble(startTextBoxes[uiCtrlPos].Text);
|
||||
double startVolumeL = (unit == Unit.pulse)
|
||||
? startV * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse
|
||||
: Units.ConvertFrom(unit, startV);
|
||||
|
||||
double endV = Utils.ParseUDouble(endTextBoxes[uiCtrlPos].Text);
|
||||
double endVolumeL = (unit == Unit.pulse)
|
||||
? endV * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse
|
||||
: Units.ConvertFrom(unit, endV);
|
||||
|
||||
double err = 100.0 * (endVolumeL - startVolumeL - refVolume) / refVolume;
|
||||
exclamations[uiCtrlPos].Visible = (err < warningLimLo) || (warningLimHi < err);
|
||||
}
|
||||
catch
|
||||
@@ -572,7 +790,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
if (startTextBoxes[j] == currentTextBox)
|
||||
{
|
||||
LoadImage(Tst.Start, j);
|
||||
LoadImage(currentTextBox, Tst.Start, j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -580,7 +798,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
if (endTextBoxes[j] == currentTextBox)
|
||||
{
|
||||
LoadImage(Tst.End, j);
|
||||
LoadImage(currentTextBox, Tst.End, j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -593,103 +811,103 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
|
||||
|
||||
private void startTextBox1_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 0); }
|
||||
private void startTextBox2_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 1); }
|
||||
private void startTextBox3_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 2); }
|
||||
private void startTextBox4_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 3); }
|
||||
private void startTextBox5_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 4); }
|
||||
private void startTextBox6_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 5); }
|
||||
private void startTextBox7_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 6); }
|
||||
private void startTextBox8_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 7); }
|
||||
private void startTextBox9_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 8); }
|
||||
private void startTextBox10_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 9); }
|
||||
private void startTextBox11_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 10); }
|
||||
private void startTextBox12_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 11); }
|
||||
private void startTextBox13_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 12); }
|
||||
private void startTextBox14_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 13); }
|
||||
private void startTextBox15_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 14); }
|
||||
private void startTextBox16_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 15); }
|
||||
private void startTextBox17_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 16); }
|
||||
private void startTextBox18_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 17); }
|
||||
private void startTextBox19_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 18); }
|
||||
private void startTextBox20_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 19); }
|
||||
private void startTextBox21_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 20); }
|
||||
private void startTextBox22_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 21); }
|
||||
private void startTextBox23_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 22); }
|
||||
private void startTextBox24_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.Start, 23); }
|
||||
private void startTextBox1_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 0); }
|
||||
private void startTextBox2_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 1); }
|
||||
private void startTextBox3_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 2); }
|
||||
private void startTextBox4_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 3); }
|
||||
private void startTextBox5_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 4); }
|
||||
private void startTextBox6_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 5); }
|
||||
private void startTextBox7_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 6); }
|
||||
private void startTextBox8_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 7); }
|
||||
private void startTextBox9_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 8); }
|
||||
private void startTextBox10_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 9); }
|
||||
private void startTextBox11_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 10); }
|
||||
private void startTextBox12_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 11); }
|
||||
private void startTextBox13_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 12); }
|
||||
private void startTextBox14_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 13); }
|
||||
private void startTextBox15_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 14); }
|
||||
private void startTextBox16_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 15); }
|
||||
private void startTextBox17_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 16); }
|
||||
private void startTextBox18_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 17); }
|
||||
private void startTextBox19_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 18); }
|
||||
private void startTextBox20_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 19); }
|
||||
private void startTextBox21_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 20); }
|
||||
private void startTextBox22_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 21); }
|
||||
private void startTextBox23_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 22); }
|
||||
private void startTextBox24_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.Start, 23); }
|
||||
private void startTextBox1_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 0); }
|
||||
private void startTextBox2_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 1); }
|
||||
private void startTextBox3_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 2); }
|
||||
private void startTextBox4_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 3); }
|
||||
private void startTextBox5_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 4); }
|
||||
private void startTextBox6_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 5); }
|
||||
private void startTextBox7_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 6); }
|
||||
private void startTextBox8_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 7); }
|
||||
private void startTextBox9_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 8); }
|
||||
private void startTextBox10_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 9); }
|
||||
private void startTextBox11_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 10); }
|
||||
private void startTextBox12_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 11); }
|
||||
private void startTextBox13_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 12); }
|
||||
private void startTextBox14_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 13); }
|
||||
private void startTextBox15_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 14); }
|
||||
private void startTextBox16_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 15); }
|
||||
private void startTextBox17_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 16); }
|
||||
private void startTextBox18_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 17); }
|
||||
private void startTextBox19_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 18); }
|
||||
private void startTextBox20_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 19); }
|
||||
private void startTextBox21_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 20); }
|
||||
private void startTextBox22_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 21); }
|
||||
private void startTextBox23_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 22); }
|
||||
private void startTextBox24_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.Start, 23); }
|
||||
private void startTextBox1_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 0); }
|
||||
private void startTextBox2_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 1); }
|
||||
private void startTextBox3_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 2); }
|
||||
private void startTextBox4_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 3); }
|
||||
private void startTextBox5_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 4); }
|
||||
private void startTextBox6_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 5); }
|
||||
private void startTextBox7_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 6); }
|
||||
private void startTextBox8_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 7); }
|
||||
private void startTextBox9_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 8); }
|
||||
private void startTextBox10_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 9); }
|
||||
private void startTextBox11_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 10); }
|
||||
private void startTextBox12_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 11); }
|
||||
private void startTextBox13_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 12); }
|
||||
private void startTextBox14_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 13); }
|
||||
private void startTextBox15_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 14); }
|
||||
private void startTextBox16_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 15); }
|
||||
private void startTextBox17_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 16); }
|
||||
private void startTextBox18_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 17); }
|
||||
private void startTextBox19_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 18); }
|
||||
private void startTextBox20_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 19); }
|
||||
private void startTextBox21_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 20); }
|
||||
private void startTextBox22_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 21); }
|
||||
private void startTextBox23_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 22); }
|
||||
private void startTextBox24_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.Start, 23); }
|
||||
|
||||
private void endTextBox1_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 0); }
|
||||
private void endTextBox2_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 1); }
|
||||
private void endTextBox3_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 2); }
|
||||
private void endTextBox4_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 3); }
|
||||
private void endTextBox5_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 4); }
|
||||
private void endTextBox6_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 5); }
|
||||
private void endTextBox7_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 6); }
|
||||
private void endTextBox8_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 7); }
|
||||
private void endTextBox9_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 8); }
|
||||
private void endTextBox10_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 9); }
|
||||
private void endTextBox11_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 10); }
|
||||
private void endTextBox12_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 11); }
|
||||
private void endTextBox13_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 12); }
|
||||
private void endTextBox14_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 13); }
|
||||
private void endTextBox15_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 14); }
|
||||
private void endTextBox16_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 15); }
|
||||
private void endTextBox17_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 16); }
|
||||
private void endTextBox18_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 17); }
|
||||
private void endTextBox19_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 18); }
|
||||
private void endTextBox20_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 19); }
|
||||
private void endTextBox21_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 20); }
|
||||
private void endTextBox22_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 21); }
|
||||
private void endTextBox24_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 22); }
|
||||
private void endTextBox23_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(Tst.End, 23); }
|
||||
private void endTextBox1_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 0); }
|
||||
private void endTextBox2_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 1); }
|
||||
private void endTextBox3_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 2); }
|
||||
private void endTextBox4_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 3); }
|
||||
private void endTextBox5_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 4); }
|
||||
private void endTextBox6_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 5); }
|
||||
private void endTextBox7_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 6); }
|
||||
private void endTextBox8_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 7); }
|
||||
private void endTextBox9_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 8); }
|
||||
private void endTextBox10_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 9); }
|
||||
private void endTextBox11_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 10); }
|
||||
private void endTextBox12_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 11); }
|
||||
private void endTextBox13_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 12); }
|
||||
private void endTextBox14_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 13); }
|
||||
private void endTextBox15_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 14); }
|
||||
private void endTextBox16_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 15); }
|
||||
private void endTextBox17_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 16); }
|
||||
private void endTextBox18_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 17); }
|
||||
private void endTextBox19_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 18); }
|
||||
private void endTextBox20_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 19); }
|
||||
private void endTextBox21_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 20); }
|
||||
private void endTextBox22_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 21); }
|
||||
private void endTextBox23_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 22); }
|
||||
private void endTextBox24_MouseDown(object sender, MouseEventArgs e) { LoadImage(Tst.End, 23); }
|
||||
private void endTextBox1_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 0); }
|
||||
private void endTextBox2_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 1); }
|
||||
private void endTextBox3_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 2); }
|
||||
private void endTextBox4_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 3); }
|
||||
private void endTextBox5_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 4); }
|
||||
private void endTextBox6_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 5); }
|
||||
private void endTextBox7_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 6); }
|
||||
private void endTextBox8_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 7); }
|
||||
private void endTextBox9_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 8); }
|
||||
private void endTextBox10_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 9); }
|
||||
private void endTextBox11_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 10); }
|
||||
private void endTextBox12_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 11); }
|
||||
private void endTextBox13_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 12); }
|
||||
private void endTextBox14_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 13); }
|
||||
private void endTextBox15_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 14); }
|
||||
private void endTextBox16_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 15); }
|
||||
private void endTextBox17_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 16); }
|
||||
private void endTextBox18_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 17); }
|
||||
private void endTextBox19_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 18); }
|
||||
private void endTextBox20_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 19); }
|
||||
private void endTextBox21_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 20); }
|
||||
private void endTextBox22_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 21); }
|
||||
private void endTextBox24_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 22); }
|
||||
private void endTextBox23_AcceptsTabChanged(object sender, EventArgs e) { LoadImage(sender, Tst.End, 23); }
|
||||
private void endTextBox1_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 0); }
|
||||
private void endTextBox2_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 1); }
|
||||
private void endTextBox3_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 2); }
|
||||
private void endTextBox4_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 3); }
|
||||
private void endTextBox5_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 4); }
|
||||
private void endTextBox6_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 5); }
|
||||
private void endTextBox7_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 6); }
|
||||
private void endTextBox8_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 7); }
|
||||
private void endTextBox9_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 8); }
|
||||
private void endTextBox10_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 9); }
|
||||
private void endTextBox11_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 10); }
|
||||
private void endTextBox12_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 11); }
|
||||
private void endTextBox13_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 12); }
|
||||
private void endTextBox14_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 13); }
|
||||
private void endTextBox15_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 14); }
|
||||
private void endTextBox16_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 15); }
|
||||
private void endTextBox17_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 16); }
|
||||
private void endTextBox18_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 17); }
|
||||
private void endTextBox19_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 18); }
|
||||
private void endTextBox20_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 19); }
|
||||
private void endTextBox21_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 20); }
|
||||
private void endTextBox22_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 21); }
|
||||
private void endTextBox23_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 22); }
|
||||
private void endTextBox24_MouseDown(object sender, MouseEventArgs e) { LoadImage(sender, Tst.End, 23); }
|
||||
|
||||
/// <summary>
|
||||
/// Loads appropriate image into pictureBox1.Image
|
||||
@@ -697,17 +915,17 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
/// </summary>
|
||||
/// <param name="startOrEnd">Tst.Start or Tst.End</param>
|
||||
/// <param name="physPos">0..23</param>
|
||||
void LoadImage(Tst startOrEnd, int physPos)
|
||||
void LoadImage(object sender, Tst startOrEnd, int physPos)
|
||||
{
|
||||
ShowUnits(startOrEnd, physPos);
|
||||
|
||||
int wmNr1b = phys2wm[physPos]; /// 0 means no WM
|
||||
wmNr0b = Math.Max(0, wmNr1b - 1);
|
||||
if (wmNr1b <= 0) return;
|
||||
|
||||
wmNr0b = wmNr1b - 1;
|
||||
|
||||
string imageFileName;
|
||||
if ((startOrEnd == Tst.Start) && (wmNr1b > 0) && (startImages[wmNr0b] != null))
|
||||
if (startOrEnd == Tst.Start && startImages[wmNr0b] != null)
|
||||
imageFileName = startImages[wmNr0b];
|
||||
else if ((startOrEnd == Tst.End) && (wmNr1b > 0) && (endImages[wmNr0b] != null))
|
||||
else if (startOrEnd == Tst.End && endImages[wmNr0b] != null)
|
||||
imageFileName = endImages[wmNr0b];
|
||||
else
|
||||
imageFileName = string.Empty;
|
||||
@@ -718,6 +936,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
|
||||
lastImageName = imageFileName;
|
||||
lastWmNr1 = wmNr1b;
|
||||
|
||||
if (string.IsNullOrEmpty(imageFileName) || !File.Exists(imageFileName))
|
||||
{
|
||||
@@ -725,16 +944,31 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Bitmap tempBmp = Image.FromFile(imageFileName) as Bitmap)
|
||||
{
|
||||
int hght = tempBmp.Height;
|
||||
int leftMargin = (tempBmp.Width - hght) / 2;
|
||||
lastImage = new Bitmap(tempBmp.Clone(new Rectangle(leftMargin, 0, hght, hght), tempBmp.PixelFormat));
|
||||
if (isZoomed[wmNr0b])
|
||||
{
|
||||
zoomedImage = MakeZoomedImage(lastImage, zoomCenterLoc[wmNr0b]);
|
||||
}
|
||||
}
|
||||
using (Bitmap tempBmp = Image.FromFile(imageFileName) as Bitmap)
|
||||
{
|
||||
Rectangle rect;
|
||||
if (tempBmp.Height < tempBmp.Width)
|
||||
{
|
||||
int hght = tempBmp.Height;
|
||||
int leftMargin = (tempBmp.Width - hght) / 2;
|
||||
rect = new Rectangle(leftMargin, 0, hght, hght);
|
||||
}
|
||||
else
|
||||
{
|
||||
int hght = tempBmp.Height;
|
||||
int wdth = tempBmp.Width;
|
||||
int margin = (hght - wdth) / 2;
|
||||
rect = new Rectangle(0, margin, wdth, wdth);
|
||||
}
|
||||
//int hght = tempBmp.Height;
|
||||
//int leftMargin = (tempBmp.Width - hght) / 2;
|
||||
//lastImage = new Bitmap(tempBmp.Clone(new Rectangle(leftMargin, 0, hght, hght), tempBmp.PixelFormat));
|
||||
lastImage = new Bitmap(tempBmp.Clone(rect, tempBmp.PixelFormat));
|
||||
if (isZoomed[wmNr0b])
|
||||
{
|
||||
zoomedImage = MakeZoomedImage(lastImage, zoomCenterLoc[wmNr0b]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ShowImage();
|
||||
@@ -752,7 +986,7 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
|
||||
if (me.Button == MouseButtons.Left && !isZoomed[wmNr0b])
|
||||
{
|
||||
switch (imageRotation[wmNr0b])
|
||||
switch (imageRotation)
|
||||
{
|
||||
case Rotation.R0:
|
||||
zoomCenterLoc[wmNr0b] = me.Location;
|
||||
@@ -786,9 +1020,9 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
{
|
||||
if (lastImage == null) return;
|
||||
|
||||
if (++imageRotation[wmNr0b] == Rotation.Count)
|
||||
if (++imageRotation == Rotation.Count)
|
||||
{
|
||||
imageRotation[wmNr0b] = Rotation.R0;
|
||||
imageRotation = Rotation.R0;
|
||||
}
|
||||
ShowImage();
|
||||
}
|
||||
@@ -807,9 +1041,17 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
return lastImage.Clone(newRect, oriImage.PixelFormat);
|
||||
}
|
||||
|
||||
///
|
||||
/// Used by ShowImage()
|
||||
///
|
||||
Brush lightBrush = new SolidBrush(Color.LightGreen);
|
||||
Brush darkBrush = new SolidBrush(Color.Green);
|
||||
Font largeFont = new Font("arial", 24.0F, FontStyle.Bold); /// normal image
|
||||
Font smallFont = new Font("arial", 12.0F, FontStyle.Bold); /// zoomed image
|
||||
|
||||
/// <summary>
|
||||
/// Show selected image in the picture box.
|
||||
/// lastImage, zoomedImage, isZoomed and imageRotation are used.
|
||||
/// lastWmNr1, lastImage, zoomedImage, isZoomed and imageRotation are used.
|
||||
/// </summary>
|
||||
void ShowImage()
|
||||
{
|
||||
@@ -823,96 +1065,37 @@ namespace TBF.Rig.DataEntry.StandardCamera
|
||||
? new Bitmap(zoomedImage.Clone(new Rectangle(0, 0, zoomedImage.Width, zoomedImage.Height), zoomedImage.PixelFormat))
|
||||
: new Bitmap(lastImage.Clone(new Rectangle(0, 0, lastImage.Width, lastImage.Height), lastImage.PixelFormat));
|
||||
|
||||
switch (imageRotation[wmNr0b])
|
||||
switch (imageRotation)
|
||||
{
|
||||
case Rotation.R90: tempBmp.RotateFlip(RotateFlipType.Rotate270FlipNone); break;
|
||||
case Rotation.R180: tempBmp.RotateFlip(RotateFlipType.Rotate180FlipNone); break;
|
||||
case Rotation.R270: tempBmp.RotateFlip(RotateFlipType.Rotate90FlipNone); break;
|
||||
}
|
||||
|
||||
/// Write water meter number to the bitmap
|
||||
using (var grph = Graphics.FromImage(tempBmp))
|
||||
{
|
||||
Font font = isZoomed[wmNr0b] ? smallFont : largeFont;
|
||||
int margin = isZoomed[wmNr0b] ? 1 : 2;
|
||||
|
||||
int pixelsCount = 0;
|
||||
int brightness = 0;
|
||||
for (int x = margin; x <= 8 * margin; x += margin)
|
||||
{
|
||||
for (int y = margin; y <= 8 * margin; y += margin)
|
||||
{
|
||||
brightness += (int)tempBmp.GetPixel(x, y).G;
|
||||
pixelsCount++;
|
||||
}
|
||||
}
|
||||
brightness /= pixelsCount;
|
||||
|
||||
Brush brush = (brightness > 160) ? darkBrush : lightBrush;
|
||||
|
||||
grph.DrawString(lastWmNr1.ToString(), font, brush, margin, margin);
|
||||
}
|
||||
|
||||
pictureBox1.Image = tempBmp;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates startLabel.Text, startLabel2.Text, endLabel.Text, endLabel2.Text
|
||||
/// Appends appropriate units of volume.
|
||||
/// Handles mouse clicks and Tab-changes inside text boxes.
|
||||
/// </summary>
|
||||
/// <param name="startEnd">Tst.Start or Tst.End</param>
|
||||
/// <param name="physPos">0..24</param>
|
||||
void ShowUnits(Tst startEnd, int physPos)
|
||||
{
|
||||
int wmNr = phys2wm[physPos];
|
||||
|
||||
if (wmNr > 0 && startEnd == Tst.Start)
|
||||
{
|
||||
if (regReaders[wmNr - 1] != null)
|
||||
{
|
||||
if (physPos < 12)
|
||||
{
|
||||
startLabel.Text = string.Format("{0} [{1}]", Strings.Start, GetUnitStr(regReaders[wmNr - 1].PulsesPerLtr));
|
||||
startLabel2.Text = Strings.Start;
|
||||
}
|
||||
else
|
||||
{
|
||||
startLabel.Text = Strings.Start;
|
||||
startLabel2.Text = string.Format("{0} [{1}]", Strings.Start, GetUnitStr(regReaders[wmNr - 1].PulsesPerLtr));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
}
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
}
|
||||
else if (wmNr > 0 && startEnd == Tst.End)
|
||||
{
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
|
||||
if (regReaders[wmNr - 1] != null)
|
||||
{
|
||||
if (physPos < 12)
|
||||
{
|
||||
endLabel.Text = string.Format("{0} [{1}]", Strings.End, GetUnitStr(regReaders[wmNr - 1].PulsesPerLtr));
|
||||
endLabel2.Text = Strings.End;
|
||||
}
|
||||
else
|
||||
{
|
||||
endLabel.Text = Strings.End;
|
||||
endLabel2.Text = string.Format("{0} [{1}]", Strings.End, GetUnitStr(regReaders[wmNr - 1].PulsesPerLtr));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
startLabel.Text = startLabel2.Text = Strings.Start;
|
||||
endLabel.Text = endLabel2.Text = Strings.End;
|
||||
}
|
||||
}
|
||||
///
|
||||
string GetUnitStr(double pulsesPerLtr)
|
||||
{
|
||||
if (pulsesPerLtr == 1 || pulsesPerLtr <= float.Epsilon)
|
||||
{
|
||||
return "l";
|
||||
}
|
||||
else if (pulsesPerLtr == 0.001)
|
||||
{
|
||||
return "m3";
|
||||
}
|
||||
else if (pulsesPerLtr == 1000)
|
||||
{
|
||||
return "ml";
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Format("{0} l", 1 / pulsesPerLtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1549
-1522
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -193,7 +193,7 @@ namespace TBF.Rig.DataEntry.iPerl
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (orderComboBox.Text.Length > 8 ||
|
||||
if (orderComboBox.Text.Length > 10 ||
|
||||
(cfg.Orders != Orders.Arbitrary && !orderComboBox.Items.Contains(orderComboBox.Text)))
|
||||
{
|
||||
MessageBox.Show(Strings.Invalid_order_number, Strings.Error, MessageBoxButtons.OK,
|
||||
|
||||
@@ -12,8 +12,6 @@ namespace TBF.Rig.Dummy.RegulValve
|
||||
{
|
||||
public partial class RegulValveCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
ComponentParametersDlg parent;
|
||||
|
||||
public bool ShowMore { get { return true; } }
|
||||
|
||||
RegulValveCfg config;
|
||||
|
||||
@@ -120,11 +120,11 @@ namespace TBF.Rig.Elde
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
#endif
|
||||
public float[] EtCalib = new float[5] { 1, 1, 1, 1, 1 };
|
||||
#elif CEVAK_200 || DN100 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || SENTEC
|
||||
#elif CEVAK_200 || DN100 || FUZHOU_150 || IZRAEL_200 || SENTEC
|
||||
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
public float[] EtCalib = new float[6] { 1, 1, 1, 1, 1, 1 };
|
||||
#elif BERLIN || GELSENWASSER || GENESIS || PETERSBURG_200 || PUCHONG_200 || RUM_MOB || SLM_150
|
||||
#elif BERLIN || FUZHOU_300 || GELSENWASSER || GENESIS || PETERSBURG_200 || PUCHONG_200 || RUM_MOB || SLM_150
|
||||
public uint[,] RegValveCalib = new uint[16, 2] { {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500},
|
||||
{100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500} };
|
||||
public byte[] MeretRS485Address = new byte[4];
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace TBF.Rig.Elde
|
||||
public UInt128 RRoute { get { return ctrlBrdComponent.rRoute; } }
|
||||
#endif
|
||||
|
||||
#if ALZIR_25 || BADGER_STREDNA_TRAT || BAHRAIN_50 || CEVAK_200 || DEWA_300 || FEWA_50 || FUZHOU_100 || FILIPINY_50 || GELSENWASSER || GENESIS || HONGKONG_50 || IZRAEL_25 || IZRAEL_50 || JUZNA_AFRIKA_50 || KEMPNO_50 || KRAKOW_50 || LUXEMBURG_40 || MILWAUKEE || PUCHONG_200 || ROMA_200 || SENTEC || TURA_IPERL_NEW || WARSAW_50 || ZAMBIA || ZODINO
|
||||
#if ALZIR_25 || BADGER_STREDNA_TRAT || BAHRAIN_50 || CEVAK_200 || DEWA_300 || FEWA_50 || FUZHOU_100 || FUZHOU_300 || FILIPINY_50 || GELSENWASSER || GENESIS || HONGKONG_50 || IZRAEL_25 || IZRAEL_50 || JUZNA_AFRIKA_50 || KEMPNO_50 || KRAKOW_50 || LUXEMBURG_40 || MILWAUKEE || PUCHONG_200 || ROMA_200 || SENTEC || TURA_IPERL_NEW || WARSAW_50 || ZAMBIA || ZODINO
|
||||
public uint DivTime(int id) { return ctrlBrdComponent.divTime[id]; }
|
||||
public void SetDivLimit(int divNo, uint limLoPct, uint limHiPct)
|
||||
{
|
||||
@@ -115,7 +115,7 @@ namespace TBF.Rig.Elde
|
||||
}
|
||||
public float DivSamples(int time, int divIx0)
|
||||
{
|
||||
#if FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || MUNICH
|
||||
#if FUZHOU_50 || FUZHOU_150 || IZRAEL_200 || MUNICH
|
||||
return ctrlBrdComponent.DIVSamples[time, 0];
|
||||
#else
|
||||
return ctrlBrdComponent.DIVSamples[time, divIx0];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -91,8 +91,10 @@ namespace TBF.Rig.Elde.Diverter
|
||||
}
|
||||
else
|
||||
{
|
||||
log.ErrorFormat("Unable to set {0} ADC levels: RegValveCalib array size={1}, diverter AdcNr={2}",
|
||||
Name, controlBoard.RegValveCalib.GetLength(0), diverterCfg.AdcNr);
|
||||
string message = string.Format("Cannot save calibration: RegValveCalib[] size={1}, ADC#={2}",
|
||||
Name, controlBoard.RegValveCalib.GetLength(0), diverterCfg.AdcNr);
|
||||
log.Error(message);
|
||||
throw new Exception(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-18
@@ -14,8 +14,7 @@ namespace TBF.Rig
|
||||
public float Qto;
|
||||
public string Selector;
|
||||
public IValve Pump; /// pump to use with this path or null
|
||||
public IList<IRegValve> RegulValves;
|
||||
public IList<float> RegulValvesPct;
|
||||
public IList<RegValvePosition> RegVPositions;
|
||||
public IList<IValve> ValvesOpen; /// a list of valves to open or null
|
||||
public IList<IValve> ValvesClose; /// a list of valves to close or null
|
||||
|
||||
@@ -24,10 +23,9 @@ namespace TBF.Rig
|
||||
{
|
||||
ItemNr = itemNr;
|
||||
Name = name;
|
||||
RegVPositions = new List<RegValvePosition>();
|
||||
ValvesOpen = new List<IValve>();
|
||||
ValvesClose = new List<IValve>();
|
||||
RegulValves = new List<IRegValve>();
|
||||
RegulValvesPct = new List<float>();
|
||||
}
|
||||
|
||||
/// Constructor from data entity
|
||||
@@ -40,29 +38,22 @@ namespace TBF.Rig
|
||||
Pump = TbfComponents.FindComponent(entity.Pump, components) as IValve;
|
||||
|
||||
///
|
||||
/// Feeding regulation valve components
|
||||
/// Feeding regulation valves and their positions
|
||||
///
|
||||
RegVPositions.Clear();
|
||||
foreach (var cmpnt in components)
|
||||
{
|
||||
IRegValve regValve = cmpnt as IRegValve;
|
||||
if (regValve != null && regValve.Category == TBF.Rig.ValveCategory.Feeding)
|
||||
IRegValve rv = cmpnt as IRegValve;
|
||||
if (rv != null && rv.Category == TBF.Rig.ValveCategory.Feeding && !(rv is TBF.Rig.Elde.RegulValveTandem.RegulValveTandem))
|
||||
{
|
||||
RegulValves.Add(regValve);
|
||||
RegVPositions.Add(new RegValvePosition(rv));
|
||||
}
|
||||
}
|
||||
TBF.Utils.UpdateRegVPositionsFromStr(ref RegVPositions, entity.RegulValvesPct);
|
||||
|
||||
///
|
||||
/// Feeding regulation valve precentages
|
||||
/// Regular valves to open
|
||||
///
|
||||
string[] rvPosStr = (entity.RegulValvesPct != null) ? entity.RegulValvesPct.Split(new char[] { ';' }) : new string[0];
|
||||
for (int i = 0; i < RegulValves.Count; i++)
|
||||
{
|
||||
string str = (i < rvPosStr.Length) ? rvPosStr[i] : "---";
|
||||
float pct;
|
||||
if (!Utils.TryParseUFloat(str, out pct) || pct > 100.0f || str == "---") pct = 0;
|
||||
RegulValvesPct.Add(pct);
|
||||
}
|
||||
|
||||
string[] vOpen = entity.ValvesOpen.Split(new char[] { ';' });
|
||||
ValvesOpen = new List<IValve>();
|
||||
foreach (var vName in vOpen)
|
||||
@@ -71,6 +62,9 @@ namespace TBF.Rig
|
||||
if (cmpnt is IValve) ValvesOpen.Add(cmpnt as IValve);
|
||||
}
|
||||
|
||||
///
|
||||
/// Regular valves to close
|
||||
///
|
||||
string[] vClose = entity.ValvesClose.Split(new char[] { ';' });
|
||||
ValvesClose = new List<IValve>();
|
||||
foreach (var vName in vClose)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using Common;
|
||||
|
||||
@@ -13,6 +13,10 @@ namespace TBF.Rig.GenericDevices
|
||||
|
||||
int GetResult(int roiHandle, out long timeMs); /// returns result for a registered ROI and camera time in ms
|
||||
|
||||
bool ShowOverlayRect { set; }
|
||||
System.Drawing.Rectangle OverlayRect { set; }
|
||||
int OverlayThickness { set; }
|
||||
|
||||
/// <summary>
|
||||
/// Display live image.
|
||||
/// </summary>
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace TBF.Rig.GenericDevices
|
||||
/// <summary>
|
||||
/// Called when a new session is started
|
||||
/// </summary>
|
||||
/// <param name="dataStreamFileName">File name for the log file</param>
|
||||
void StartSession();
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2015 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace TBF.Rig
|
||||
{
|
||||
|
||||
@@ -214,7 +214,7 @@ namespace TBF.Rig.MettlerToledo.Standard
|
||||
|
||||
config.ComPortNr = int.Parse(comPortNrTextBox.Text);
|
||||
config.BaudRate = int.Parse(baudRateTextBox.Text);
|
||||
config.Parity = Common.Utils.GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.Parity = Common.Utils.GetParity(parityComboBox.SelectedItem.ToString());
|
||||
config.DataBits = int.Parse(dataBitsTextBox.Text);
|
||||
config.StopBits = Common.Utils.GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
config.Handshake = Common.Utils.GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
|
||||
@@ -5,7 +5,6 @@ using System;
|
||||
using System.Windows.Forms;
|
||||
using System.IO.Ports;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
@@ -69,6 +70,15 @@ namespace TBF.Rig.Network.Camera.CLP1611
|
||||
public bool Running { get { return running; } }
|
||||
bool running;
|
||||
|
||||
public bool ShowOverlayRect { set { showOverlayRect = value; } }
|
||||
bool showOverlayRect = false;
|
||||
|
||||
public Rectangle OverlayRect { set { overlayRect = value; } }
|
||||
Rectangle overlayRect;
|
||||
|
||||
public int OverlayThickness { set { overlayThickness = value; } }
|
||||
int overlayThickness;
|
||||
|
||||
public int CameraIdx { get { return cameraIdx; } }
|
||||
int cameraIdx;
|
||||
///
|
||||
@@ -210,12 +220,12 @@ namespace TBF.Rig.Network.Camera.CLP1611
|
||||
Telnet.Enqueue(new Telnet.Command(Network.Telnet.CmdAction.CLEAR_RESPONSE));
|
||||
Telnet.Enqueue(new Telnet.Command(Network.Telnet.CmdAction.SEND_COMMAND, "sha1sum clp/*"));
|
||||
|
||||
log.FatalFormat("'{0}' with address {1} detected, IP = {2}, SD = {3}", Name, CameraCfg.HardwareAddress, ipAddress, sdCardVer);
|
||||
log.FatalFormat("'{0}' detected: Id={1} addr={2} IP={3} SD={4}", Name, CameraIdx, CameraCfg.HardwareAddress, ipAddress, sdCardVer);
|
||||
}
|
||||
else
|
||||
{
|
||||
UiBridge.Bridge.OnCameraInfo(this.cameraIdx, string.Format("{0} s/n {1} was not detected", Name, CameraCfg.HardwareAddress));
|
||||
log.FatalFormat("'{0}' with address {1} not detected", Name, CameraCfg.HardwareAddress);
|
||||
log.FatalFormat("'{0}' NOT detected: Id={1} addr={2}", Name, CameraIdx, CameraCfg.HardwareAddress);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +251,7 @@ namespace TBF.Rig.Network.Camera.CLP1611
|
||||
{
|
||||
if ((CameraCfg.DebugLevel != DebugMode.Simulate) && (CameraCfg.DebugLevel != DebugMode.DetectedOff))
|
||||
{
|
||||
if (scpThread != null) scpThread.Join(50);
|
||||
if (scpThread != null && scpThread.IsAlive) scpThread.Join(50);
|
||||
if (rtpListenerThread != null) rtpListenerThread.Join(50);
|
||||
if (msrmntListenerThread != null) msrmntListenerThread.Join(50);
|
||||
|
||||
@@ -464,37 +474,37 @@ namespace TBF.Rig.Network.Camera.CLP1611
|
||||
FileInfo[] fileInfos = dirInfo.GetFiles();
|
||||
foreach (FileInfo fi in fileInfos)
|
||||
{
|
||||
lock (fileUploadLock)
|
||||
{
|
||||
FileStream fs = fi.Open(FileMode.Open);
|
||||
fs.Position = 0;
|
||||
byte[] sha1 = sha1calculator.ComputeHash(fs);
|
||||
fs.Close();
|
||||
//lock (fileUploadLock)
|
||||
//{
|
||||
// FileStream fs = fi.Open(FileMode.Open);
|
||||
// fs.Position = 0;
|
||||
// byte[] sha1 = sha1calculator.ComputeHash(fs);
|
||||
// fs.Close();
|
||||
|
||||
sha1str.Clear();
|
||||
foreach (var b in sha1) sha1str.Append(b.ToString("x2"));
|
||||
// sha1str.Clear();
|
||||
// foreach (var b in sha1) sha1str.Append(b.ToString("x2"));
|
||||
|
||||
if (!sha1sumResponse.Contains(string.Format("{0} clp/{1}", sha1str, fi.Name)))
|
||||
{
|
||||
/// Copy a file to the camera if SHA1 sum is different of the file is missing
|
||||
log.InfoFormat("{0}, IP={1}, Uploading file {2}", Name, IPAddress, fi.Name);
|
||||
scpClient.Upload(fi, string.Format("~/clp/{0}", fi.Name));
|
||||
}
|
||||
}
|
||||
// if (!sha1sumResponse.Contains(string.Format("{0} clp/{1}", sha1str, fi.Name)))
|
||||
// {
|
||||
// /// Copy a file to the camera if SHA1 sum is different of the file is missing
|
||||
// log.InfoFormat("{0}, IP={1}, Uploading file {2}", Name, IPAddress, fi.Name);
|
||||
// scpClient.Upload(fi, string.Format("~/clp/{0}", fi.Name));
|
||||
// }
|
||||
//}
|
||||
|
||||
if (!sha1sumResponse.Contains(fi.Name))
|
||||
{
|
||||
/// Change file properties if it was a new file
|
||||
string command = string.Format("chmod 755 ~/clp/{0}", fi.Name);
|
||||
log.InfoFormat("{0}, IP={1}, Executing command '{2}'", Name, IPAddress, command);
|
||||
sshClient.CreateCommand(command).Execute();
|
||||
//if (!sha1sumResponse.Contains(fi.Name))
|
||||
//{
|
||||
// /// Change file properties if it was a new file
|
||||
// string command = string.Format("chmod 755 ~/clp/{0}", fi.Name);
|
||||
// log.InfoFormat("{0}, IP={1}, Executing command '{2}'", Name, IPAddress, command);
|
||||
// sshClient.CreateCommand(command).Execute();
|
||||
|
||||
//if (fi.Name.Equals("runmeonce"))
|
||||
//{
|
||||
// log.InfoFormat("{0}, IP={1}, Executing command 'sudo clp/runmeonce'", Name, IPAddress);
|
||||
// sshClient.CreateCommand("sudo clp/runmeonce").Execute();
|
||||
//}
|
||||
}
|
||||
// //if (fi.Name.Equals("runmeonce"))
|
||||
// //{
|
||||
// // log.InfoFormat("{0}, IP={1}, Executing command 'sudo clp/runmeonce'", Name, IPAddress);
|
||||
// // sshClient.CreateCommand("sudo clp/runmeonce").Execute();
|
||||
// //}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -588,6 +598,8 @@ namespace TBF.Rig.Network.Camera.CLP1611
|
||||
{
|
||||
JpegFrame jpegFrame = new JpegFrame();
|
||||
bool synced = false;
|
||||
int penWidth = 1;
|
||||
Pen pen = new Pen(Color.Green, penWidth);
|
||||
|
||||
while (!stopRtpListenerFlag)
|
||||
{
|
||||
@@ -606,7 +618,20 @@ namespace TBF.Rig.Network.Camera.CLP1611
|
||||
switch (jpegFrame.AddPacket(newPacket))
|
||||
{
|
||||
case RtpFrame.STATE.Complete:
|
||||
UiBridge.Bridge.OnImage(this.cameraIdx, jpegFrame.ToImage());
|
||||
Image image = jpegFrame.ToImage();
|
||||
if (showOverlayRect && overlayRect != null && overlayThickness > 0)
|
||||
{
|
||||
using (var grph = Graphics.FromImage(image))
|
||||
{
|
||||
if (penWidth != overlayThickness)
|
||||
{
|
||||
penWidth = overlayThickness;
|
||||
pen = new Pen(Color.Green, penWidth);
|
||||
}
|
||||
grph.DrawRectangle(pen, overlayRect);
|
||||
}
|
||||
}
|
||||
UiBridge.Bridge.OnImage(this.cameraIdx, image);
|
||||
jpegFrame.Clear();
|
||||
break;
|
||||
case RtpFrame.STATE.Error:
|
||||
|
||||
@@ -71,20 +71,12 @@ namespace TBF.Rig.Network.Camera.CLP1611
|
||||
grabImageCommandSent = false;
|
||||
transferringGrabbedImage = false;
|
||||
|
||||
if ((imgFileNames != null) && (imgFileNames.Length > 0) && File.Exists(imgFileNames[0]))
|
||||
if (camera.CameraCfg.DebugLevel != DebugMode.Simulate &&
|
||||
camera.CameraCfg.DebugLevel != DebugMode.DetectedOff &&
|
||||
imgFileNames != null && imgFileNames.Length > 0 && File.Exists(imgFileNames[0]))
|
||||
{
|
||||
///
|
||||
/// An image specified, (1) delete previous image, (2) check if this is a simulation
|
||||
///
|
||||
/// This is not a simulation => delete previous image
|
||||
File.Delete(imgFileNames[0]);
|
||||
|
||||
if (camera.CameraCfg.DebugLevel == DebugMode.Simulate || camera.CameraCfg.DebugLevel == DebugMode.DetectedOff)
|
||||
{
|
||||
///
|
||||
/// Camera is in simulation mode => create a simulated image
|
||||
///
|
||||
File.Copy(string.Format("{0}\\Pictures\\sample.jpg", Program.ExecutableDir), imgFileNames[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2022 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -41,17 +41,6 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
Count
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test/Q designation mode for IperlLogger and IperlHead opto data files
|
||||
/// </summary>
|
||||
public enum DesigMode
|
||||
{
|
||||
Auto,
|
||||
Based_on_procedure,
|
||||
As_specified,
|
||||
Count
|
||||
}
|
||||
|
||||
|
||||
public class Database : ComponentBase, IOperation, GenericDevices.IResultsWriter, GenericDevices.IStartInfoReader, Generic.IDevice
|
||||
{
|
||||
@@ -68,8 +57,6 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
public bool SaveResults { get { return (dbCfg == null || dbCfg.ProcParams == null) ? false : dbCfg.ProcParams.SaveResults; } }
|
||||
public bool ReadStartInfo { get { return (dbCfg == null || dbCfg.ProcParams == null) ? true : dbCfg.ProcParams.ReadStartInfo; } }
|
||||
public bool StartInfoIsRequired { get { return (dbCfg == null || dbCfg.ProcParams == null) ? false : dbCfg.ProcParams.StartInfoIsRequired; } }
|
||||
public DesigMode DesigMode { get { return (dbCfg == null || dbCfg.ProcParams == null) ? DesigMode.Auto : dbCfg.ProcParams.DesigMode; } }
|
||||
public LogType DesigType { get { return (dbCfg == null || dbCfg.ProcParams == null) ? LogType.Just_Q3Q2Q1 : dbCfg.ProcParams.DesigType; } }
|
||||
|
||||
enum OpState
|
||||
{
|
||||
@@ -124,7 +111,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
int wmTypeRevision;
|
||||
string procedureSignature;
|
||||
IList<SensusTestInfo> oracleTestInfo; /// Raw incomplete test info from Oracle DB (or null)
|
||||
SensusTestInfo[] completeTestInfo; /// Complete TBF test info obtained as the best match (never null when oracleTestInfo != null)
|
||||
LUTestData[] completeTestInfo; /// Complete test info obtained from the procedure
|
||||
|
||||
|
||||
public Database() {}
|
||||
@@ -192,7 +179,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
/// <param name="wmTypeId">Water meter type Id</param>
|
||||
/// <param name="wmTypeRevision">Water meter type revision</param>
|
||||
/// <returns>SensusTestInfos array</returns>
|
||||
public IList<SensusTestInfo> GetOracleTestInfo(OracleConnection conn, int wmTypeId, out int wmTypeRevision, out string wzTyp, out string metrolKlasse, out string zulasszeichen, out string materialNr, out double q3, out DateTime timeStamp, out string remark)
|
||||
public IList<SensusTestInfo> GetOracleTestInfo(OracleConnection conn, int wmTypeId, out int wmTypeRevision, out string wzTyp, out string metrolKlasse, out string zulasszeichen, out string materialNr, out double q3, out DateTime timeStamp)
|
||||
{
|
||||
///
|
||||
/// Read 'incomplete' TestInfo from Oracle database containing only flowId-s ad qBezeichnung-s
|
||||
@@ -209,9 +196,8 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
materialNr = string.Empty;
|
||||
q3 = 0;
|
||||
timeStamp = DateTime.MinValue;
|
||||
remark = string.Empty;
|
||||
|
||||
OracleCommand cmd = new OracleCommand("SELECT rev_wztyp, wztyp, metrolklasse, zulasszeichen, materialnr, qmax, aenderungsdatum, bemerkung " +
|
||||
OracleCommand cmd = new OracleCommand("SELECT rev_wztyp, wztyp, metrolklasse, zulasszeichen, materialnr, qmax, aenderungsdatum " +
|
||||
"FROM vt_wztyp_sd " +
|
||||
"WHERE anbid=:1 AND id_wztyp=:2 AND aktiv=:3", conn);
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_Producer });
|
||||
@@ -228,7 +214,6 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
materialNr = dr.GetString(4);
|
||||
q3 = dr.GetDouble(5);
|
||||
timeStamp = dr.GetDateTime(6);
|
||||
remark = dr.GetString(7);
|
||||
}
|
||||
dr.Close();
|
||||
|
||||
@@ -351,15 +336,6 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
#endif
|
||||
}
|
||||
|
||||
if (DesigMode == DesigMode.Based_on_procedure && StateMachine.Procedure != null)
|
||||
{
|
||||
Sequences.ProcessData.CompleteTestInfos = Results.Output.SensusTestInfo.CreateFromProcedure(StateMachine.Procedure);
|
||||
}
|
||||
else if (DesigMode == DesigMode.As_specified && DesigType >= 0 && DesigType < LogType.Count)
|
||||
{
|
||||
Sequences.ProcessData.CompleteTestInfos = SensusTestInfo.GetTestInfos(DesigType);
|
||||
}
|
||||
|
||||
opCompleted = true;
|
||||
}
|
||||
|
||||
@@ -429,7 +405,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Reading from ORACLE DB failed, batch={0}, error={1}", batch.BatchNr, exc.Message);
|
||||
log.ErrorFormat("Reading StartInfo from ORACLE DB failed, error={é}", exc.Message);
|
||||
|
||||
conn.Close();
|
||||
return Retv.Error;
|
||||
@@ -451,67 +427,6 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
|
||||
try
|
||||
{
|
||||
/// Prepare a procedure signature to distinguish between different procedures with the same wmTypeId
|
||||
IList<string> wmTestNames = new List<string>();
|
||||
StringBuilder procedureSignatureSB = new StringBuilder();
|
||||
foreach (var mtr in wm.RegularMeterTestRslts())
|
||||
{
|
||||
if (mtr.Evaluate())
|
||||
{
|
||||
wmTestNames.Add(mtr.Name());
|
||||
procedureSignatureSB.Append(mtr.Name());
|
||||
procedureSignatureSB.Append("~");
|
||||
}
|
||||
}
|
||||
|
||||
if (oracleTestInfo == null || (wmTypeId == 0) || (wmTypeId != wm.WaterMeterData.WMTypeId) || (procedureSignature != procedureSignatureSB.ToString()))
|
||||
{
|
||||
///
|
||||
/// Currnet test info. is not walid => Get a new one from Oracle and SensusTestInfo table
|
||||
///
|
||||
int wmTR;
|
||||
string wzTypStr;
|
||||
string metroKlasse;
|
||||
string zulasszeichen;
|
||||
string materialNr;
|
||||
double q3 = 0;
|
||||
DateTime timeStamp;
|
||||
string remark;
|
||||
IList<SensusTestInfo> rti = GetOracleTestInfo(conn, wm.WaterMeterData.WMTypeId, out wmTR, out wzTypStr, out metroKlasse, out zulasszeichen, out materialNr, out q3, out timeStamp, out remark);
|
||||
|
||||
if (rti != null)
|
||||
{
|
||||
/// All 5 updated together
|
||||
wmTypeId = wm.WaterMeterData.WMTypeId;
|
||||
wmTypeRevision = wmTR;
|
||||
procedureSignature = procedureSignatureSB.ToString();
|
||||
oracleTestInfo = rti;
|
||||
string tInfoName;
|
||||
completeTestInfo = SensusTestInfo.GetBestMatch(rti, wmTestNames, out tInfoName);
|
||||
///
|
||||
log.WarnFormat("Selected test info : {0}", tInfoName);
|
||||
foreach (var cti in completeTestInfo)
|
||||
{
|
||||
log.WarnFormat("Selected test info : ID={0} Rev={1} Test={2} PrfNrDB={3} QBzDB={4} PrfNrOpto={5} QBzOpto={6} PrfNrLog={7} QBzLog={8} Range={9}", wmTypeId, wmTypeRevision,
|
||||
cti.TestName, cti.PruefungsNrDB, cti.QBezeichnungDB, cti.PruefungsNrOpto, cti.QBezeichnungOpto, cti.PruefungsNrLog, cti.QBezeichnungLog, cti.Range);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Retv.Error;
|
||||
}
|
||||
}
|
||||
|
||||
/// Write the test info. to WaterMeter entity
|
||||
wm.RawTestInfos = oracleTestInfo;
|
||||
wm.CompleteTestInfos = completeTestInfo;
|
||||
wm.WMTypeRevision = wmTypeRevision;
|
||||
|
||||
/// Write the test info. to ProcessData
|
||||
Sequences.ProcessData.RawTestInfos = oracleTestInfo;
|
||||
Sequences.ProcessData.CompleteTestInfos = completeTestInfo;
|
||||
|
||||
|
||||
OracleCommand cmd;
|
||||
OracleDataReader dr;
|
||||
|
||||
@@ -613,6 +528,9 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
}
|
||||
dr.Close();
|
||||
|
||||
#if TURA_SPECIAL
|
||||
/// TODO: Check after modifications in completeTestInfo due to OraId, OraDesignation, etc.
|
||||
|
||||
///
|
||||
/// Read data from VT_PRUEFREIHE_IST_PD
|
||||
///
|
||||
@@ -636,7 +554,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
string baseTestName = null;
|
||||
foreach (var ti in completeTestInfo)
|
||||
{
|
||||
if (ti.PruefungsNrDB == testId)
|
||||
if (ti.Id == testId)
|
||||
{
|
||||
int ix = ti.TestName.LastIndexOf(" (");
|
||||
baseTestName = (ix < 0) ? ti.TestName : ti.TestName.Substring(0, ix);
|
||||
@@ -659,6 +577,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
}
|
||||
}
|
||||
dr.Close();
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Copy acquired data to WaterMeter object
|
||||
@@ -705,9 +624,10 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
}
|
||||
|
||||
|
||||
public Retv WriteResultsToDB(OracleConnection conn, Results.Entities.Batch batch, WMKind wmKind, bool safeMode)
|
||||
public Retv WriteResultsToDB(OracleConnection conn, Results.Entities.Batch bat, WMKind wmKind, bool safeMode)
|
||||
{
|
||||
OracleTransaction transaction;
|
||||
bool savedOK = false;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -716,16 +636,15 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Results of batch {0} not written to ORACLE DB (phase 1): {1}",
|
||||
batch.BatchNr, exc.Message);
|
||||
log.ErrorFormat("Results of batch {0} not written to ORACLE DB (phase 1): {1}", bat.BatchNr, exc.Message);
|
||||
conn.Close();
|
||||
return Retv.Error;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
SaveBatchData(conn, batch);
|
||||
foreach (var wMtr in batch.WaterMeters)
|
||||
SaveBatchData(conn, bat);
|
||||
foreach (var wMtr in bat.WaterMeters)
|
||||
{
|
||||
if (wmKind == WMKind.iPERL)
|
||||
{
|
||||
@@ -742,18 +661,34 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
savedOK = true;
|
||||
conn.Close();
|
||||
log.ErrorFormat("Results of batch {0} correctly written to ORACLE DB", batch.BatchNr);
|
||||
log.ErrorFormat("Results of batch {0} correctly written to ORACLE DB", bat.BatchNr);
|
||||
return Retv.OK;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
transaction.Rollback();
|
||||
conn.Close();
|
||||
log.ErrorFormat("Results of batch {0} not written to ORACLE DB: {1}", batch.BatchNr, exc.Message);
|
||||
return Retv.Error;
|
||||
savedOK = false;
|
||||
log.ErrorFormat("Results of batch {0} not written to ORACLE DB: {1}", bat.BatchNr, exc.Message);
|
||||
}
|
||||
}
|
||||
|
||||
if (!savedOK)
|
||||
{
|
||||
try
|
||||
{
|
||||
transaction.Rollback();
|
||||
conn.Close();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Even transaction.Rollback() failed: {0}", exc.Message);
|
||||
}
|
||||
|
||||
return Retv.Error;
|
||||
}
|
||||
|
||||
return Retv.OK;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -807,22 +742,20 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
/// <summary>
|
||||
/// Save common batch data
|
||||
/// </summary>
|
||||
/// <param name="b">Batch</param>
|
||||
void SaveBatchData(OracleConnection conn, Results.Entities.Batch b)
|
||||
/// <param name="bat">Batch</param>
|
||||
void SaveBatchData(OracleConnection conn, Results.Entities.Batch bat)
|
||||
{
|
||||
IList<string> wmTestNames = new List<string>();
|
||||
StringBuilder procedureSignatureSB = new StringBuilder();
|
||||
foreach (var tr in b.RegularTestRslts())
|
||||
foreach (var tr in bat.RegularTestRslts())
|
||||
{
|
||||
if (tr.Evaluate())
|
||||
{
|
||||
wmTestNames.Add(tr.Name());
|
||||
procedureSignatureSB.Append(tr.Name());
|
||||
procedureSignatureSB.Append("~");
|
||||
}
|
||||
}
|
||||
|
||||
if ((oracleTestInfo == null) || (wmTypeId != b.WaterMeters[0].WaterMeterData.WMTypeId) || (wmTypeRevision == 0) || (procedureSignature != procedureSignatureSB.ToString()))
|
||||
if ((oracleTestInfo == null) || (wmTypeId != bat.WaterMeters[0].WaterMeterData.WMTypeId) || (wmTypeRevision == 0) || (procedureSignature != procedureSignatureSB.ToString()))
|
||||
{
|
||||
int wmTR = 0;
|
||||
string wzTypStr;
|
||||
@@ -831,33 +764,54 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
string materialNr;
|
||||
double q3 = 0;
|
||||
DateTime timeStamp;
|
||||
string remark;
|
||||
IList<SensusTestInfo> ti = GetOracleTestInfo(conn, b.WaterMeters[0].WaterMeterData.WMTypeId, out wmTR, out wzTypStr, out metroKlasse, out zulasszeichen, out materialNr, out q3, out timeStamp, out remark);
|
||||
IList<SensusTestInfo> ti = GetOracleTestInfo(conn, bat.WaterMeters[0].WaterMeterData.WMTypeId, out wmTR, out wzTypStr, out metroKlasse, out zulasszeichen, out materialNr, out q3, out timeStamp);
|
||||
|
||||
if (ti != null)
|
||||
{
|
||||
/// All 5 updated together
|
||||
wmTypeId = b.WaterMeters[0].WaterMeterData.WMTypeId;
|
||||
wmTypeId = bat.WaterMeters[0].WaterMeterData.WMTypeId;
|
||||
wmTypeRevision = wmTR;
|
||||
procedureSignature = procedureSignatureSB.ToString();
|
||||
oracleTestInfo = ti;
|
||||
completeTestInfo = SensusTestInfo.GetBestMatch(oracleTestInfo, wmTestNames);
|
||||
|
||||
foreach (var cti in completeTestInfo)
|
||||
{
|
||||
log.WarnFormat("Selected test info : ID={0} Rev={1} Test={2} PrfNrDB={3} QBzDB={4} PrfNrOpto={5} QBzOpto={6} PrfNrLog={7} QBzLog={8} Range={9}", wmTypeId, wmTypeRevision,
|
||||
cti.TestName, cti.PruefungsNrDB, cti.QBezeichnungDB, cti.PruefungsNrOpto, cti.QBezeichnungOpto, cti.PruefungsNrLog, cti.QBezeichnungLog, cti.Range);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("No matching test infos found");
|
||||
throw new Exception(string.Format("Cannot save batch {0} to Oracle, missing entry in VT_WZTYP_SD", bat.BatchNr));
|
||||
}
|
||||
}
|
||||
|
||||
if (oracleTestInfo == null || completeTestInfo == null || wmTypeId == 0 || wmTypeRevision == 0)
|
||||
if (oracleTestInfo == null || wmTypeId == 0 || wmTypeRevision == 0)
|
||||
{
|
||||
throw new Exception("No matching test infos found");
|
||||
throw new Exception(string.Format("Cannot save batch {0} to Oracle, missing entry in VT_WZTYP_SD", bat.BatchNr));
|
||||
}
|
||||
|
||||
///
|
||||
/// Select or create appropriate test infos
|
||||
///
|
||||
IList<LUTestData> testsToSave = new List<LUTestData>();
|
||||
int maxPruefungsNr = 0;
|
||||
double totalTestTime = 0;
|
||||
foreach (var td in bat.Tests)
|
||||
{
|
||||
for (int repNr = 1; repNr <= td.Repeats; repNr++)
|
||||
{
|
||||
int testId = td.OraId + (td.Repeats - repNr) * td.OraIdRepetMulti;
|
||||
if (testId != 0)
|
||||
{
|
||||
testsToSave.Add(new LUTestData(td, repNr));
|
||||
if (Math.Abs(testId) > maxPruefungsNr) maxPruefungsNr = Math.Abs(testId);
|
||||
totalTestTime += td.TargetTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
LUTestData[] testsToSaveArr = testsToSave.ToArray();
|
||||
Array.Sort(testsToSaveArr, new LUTestDataComparer());
|
||||
completeTestInfo = testsToSaveArr;
|
||||
|
||||
foreach (var cti in completeTestInfo)
|
||||
{
|
||||
log.WarnFormat("Selected test info : ID={0} Rev={1} Test={2} PrfNrDB={3} QBzDB={4}",
|
||||
wmTypeId, wmTypeRevision, cti.TestName, cti.Id, cti.Designation);
|
||||
}
|
||||
|
||||
|
||||
@@ -870,13 +824,13 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
"VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17)", conn);
|
||||
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_Producer });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = dbCfg.TestBenchGroupId + b.TestBenchId });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = b.BatchNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = b.WaterMeters[0].WaterMeterData.WMTypeId });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = dbCfg.TestBenchGroupId + bat.TestBenchId });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = bat.BatchNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = bat.WaterMeters[0].WaterMeterData.WMTypeId });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wmTypeRevision });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 1 });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.TimeStamp, Value = b.StartTime });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.TimeStamp, Value = b.EndTime });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.TimeStamp, Value = bat.StartTime });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.TimeStamp, Value = bat.EndTime });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = string.Empty });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = 0 });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = 0 });
|
||||
@@ -885,23 +839,23 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = 0 }); /// TODO: DruckBeiAbpressen
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = 0 });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = 0 }); /// TODO: SpuelDurchflussIst
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = string.Format("TBF v.{0}", b.ProgramVersion) });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = string.Format("TBF v.{0}", bat.ProgramVersion) });
|
||||
|
||||
cmd.ExecuteNonQuery(); /// Returns nr. of updated rows
|
||||
log.InfoFormat("VT_PRUEFREIHE_PD inserted, BatchNr={0}, TypeId={1}, TypeRev={2}, Start={3}", b.BatchNr, b.WaterMeters[0].WaterMeterData.WMTypeId, wmTypeRevision, b.StartTime);
|
||||
log.InfoFormat("VT_PRUEFREIHE_PD inserted, BatchNr={0}, TypeId={1}, TypeRev={2}, Start={3}", bat.BatchNr, bat.WaterMeters[0].WaterMeterData.WMTypeId, wmTypeRevision, bat.StartTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.WarnFormat("SIM: VT_PRUEFREIHE_PD inserted, BatchNr={0}, TypeId={1}, TypeRev={2}, Start={3}", b.BatchNr, b.WaterMeters[0].WaterMeterData.WMTypeId, wmTypeRevision, b.StartTime);
|
||||
log.WarnFormat("SIM: VT_PRUEFREIHE_PD inserted, BatchNr={0}, TypeId={1}, TypeRev={2}, Start={3}", bat.BatchNr, bat.WaterMeters[0].WaterMeterData.WMTypeId, wmTypeRevision, bat.StartTime);
|
||||
}
|
||||
|
||||
foreach (var testInfo in completeTestInfo)
|
||||
{
|
||||
if ((testInfo.PruefungsNrDB != 0) && (-20 <= testInfo.PruefungsNrDB) && (testInfo.PruefungsNrDB <= 20)) /// LU PruefungsNr-s are between -20 and 20
|
||||
if ((testInfo.Id != 0) && (-20 <= testInfo.Id) && (testInfo.Id <= 20)) /// LU PruefungsNr-s are between -20 and 20
|
||||
{
|
||||
Results.Entities.TestRslt tr = b.GetTestRslt(testInfo.TestName, 0);
|
||||
Results.Entities.TestRslt tr = bat.GetTestRslt(testInfo.TestName, 0);
|
||||
|
||||
if (tr == null) tr = b.GetTestRslt(testInfo.TestName, 1); /// TODO: Remove this workaround for large watermeters with multiple parts at Q3
|
||||
if (tr == null) tr = bat.GetTestRslt(testInfo.TestName, 1); /// TODO: Remove this workaround for large watermeters with multiple parts at Q3
|
||||
if (tr == null) continue;
|
||||
|
||||
double Q_ist = (tr.VolumeMaster != 0) ? (tr.FlowVolume * tr.VolumeCTV / tr.VolumeMaster) : (double)tr.FlowVolume;
|
||||
@@ -947,9 +901,9 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
"VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20, :21, :22, :23)", conn);
|
||||
OracleParameter parm;
|
||||
parm = new OracleParameter("ANBID", OracleDbType.Int32); parm.Value = Anbid_Producer; cmd2.Parameters.Add(parm); ///:1
|
||||
parm = new OracleParameter("ID_Pruefstand", OracleDbType.Int32); parm.Value = dbCfg.TestBenchGroupId + b.TestBenchId; cmd2.Parameters.Add(parm); ///:2
|
||||
parm = new OracleParameter("ID_WzPruefreihe", OracleDbType.Int32); parm.Value = b.BatchNr; cmd2.Parameters.Add(parm); ///:3
|
||||
parm = new OracleParameter("PruefungsNr", OracleDbType.Int32); parm.Value = testInfo.PruefungsNrDB; cmd2.Parameters.Add(parm); ///:4
|
||||
parm = new OracleParameter("ID_Pruefstand", OracleDbType.Int32); parm.Value = dbCfg.TestBenchGroupId + bat.TestBenchId; cmd2.Parameters.Add(parm); ///:2
|
||||
parm = new OracleParameter("ID_WzPruefreihe", OracleDbType.Int32); parm.Value = bat.BatchNr; cmd2.Parameters.Add(parm); ///:3
|
||||
parm = new OracleParameter("PruefungsNr", OracleDbType.Int32); parm.Value = testInfo.Id; cmd2.Parameters.Add(parm); ///:4
|
||||
///
|
||||
parm = new OracleParameter("PVOL", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.l, tr.VolumeCTV); cmd2.Parameters.Add(parm); ///:5
|
||||
parm = new OracleParameter("PMasse", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.kg, tr.MassEnd - tr.MassStart); cmd2.Parameters.Add(parm); ///:6
|
||||
@@ -975,17 +929,17 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
parm = new OracleParameter("EndGewicht", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.kg, tr.MassEnd); cmd2.Parameters.Add(parm); ///:23
|
||||
///
|
||||
cmd2.ExecuteNonQuery(); /// Returns nr. of updated rows
|
||||
log.InfoFormat("VT_PRUEFDURCHFLUSS_PD inserted ({0}, {1}, {2}, {3}, {4} ...)", Anbid_Producer, dbCfg.TestBenchGroupId + b.TestBenchId, b.BatchNr, testInfo.PruefungsNrDB, Q_ist);
|
||||
log.InfoFormat("VT_PRUEFDURCHFLUSS_PD inserted ({0}, {1}, {2}, {3}, {4} ...)", Anbid_Producer, dbCfg.TestBenchGroupId + bat.TestBenchId, bat.BatchNr, testInfo.Id, Q_ist);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
log.WarnFormat("SIM: VT_PRUEFDURCHFLUSS_PD inserted ({0}, {1}, {2}, {3}, {4} ...)", Anbid_Producer, dbCfg.TestBenchGroupId + b.TestBenchId, b.BatchNr, testInfo.PruefungsNrDB, Q_ist);
|
||||
log.WarnFormat("SIM: VT_PRUEFDURCHFLUSS_PD inserted ({0}, {1}, {2}, {3}, {4} ...)", Anbid_Producer, dbCfg.TestBenchGroupId + bat.TestBenchId, bat.BatchNr, testInfo.Id, Q_ist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.InfoFormat("Batch data saved, batchNr={0}", b.BatchNr);
|
||||
log.InfoFormat("Batch data saved, batchNr={0}", bat.BatchNr);
|
||||
}
|
||||
|
||||
|
||||
@@ -1120,7 +1074,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
|
||||
foreach (var testInfo in completeTestInfo)
|
||||
{
|
||||
if ((testInfo.PruefungsNrDB != 0) && (-20 <= testInfo.PruefungsNrDB) && (testInfo.PruefungsNrDB <= 20)) /// LU PruefungsNr-s are nonzero and between -20 and 20
|
||||
if ((testInfo.Id != 0) && (-20 <= testInfo.Id) && (testInfo.Id <= 20)) /// LU PruefungsNr-s are nonzero and between -20 and 20
|
||||
{
|
||||
Results.Entities.TestData tData = wm.GetTestData(testInfo.TestName);
|
||||
Results.Entities.MeterTestRslt mtr;
|
||||
@@ -1156,7 +1110,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
mtr.Error = Formulas.ErrorFromVolumes(mtr.VolumeMeter, mtr.VolumeRef);
|
||||
}
|
||||
|
||||
SaveMeterTestResult(conn, mtr, testInfo.PruefungsNrDB, max_Pruefindex, wmTypeRevision);
|
||||
SaveMeterTestResult(conn, mtr, testInfo.Id, max_Pruefindex, wmTypeRevision);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1353,7 +1307,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
|
||||
foreach (var testInfo in completeTestInfo)
|
||||
{
|
||||
if ((testInfo.PruefungsNrDB != 0) && (-20 <= testInfo.PruefungsNrDB) && (testInfo.PruefungsNrDB <= 20)) /// LU PruefungsNr-s are nonzero and between -20 and 20
|
||||
if ((testInfo.Id != 0) && (-20 <= testInfo.Id) && (testInfo.Id <= 20)) /// LU PruefungsNr-s are nonzero and between -20 and 20
|
||||
{
|
||||
Results.Entities.TestData tData = wm.GetTestData(testInfo.TestName);
|
||||
Results.Entities.MeterTestRslt mtr;
|
||||
@@ -1389,7 +1343,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
mtr.Error = Formulas.ErrorFromVolumes(mtr.VolumeMeter, mtr.VolumeRef);
|
||||
}
|
||||
|
||||
SaveMeterTestResult(conn, mtr, testInfo.PruefungsNrDB, max_Pruefindex, wmTypeRevision);
|
||||
SaveMeterTestResult(conn, mtr, testInfo.Id, max_Pruefindex, wmTypeRevision);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2020-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -29,8 +29,6 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
public bool SaveResults; /// 4
|
||||
public bool ReadStartInfo; /// 5
|
||||
public bool StartInfoIsRequired; /// 6
|
||||
public DesigMode DesigMode; /// 7
|
||||
public Results.Output.LogType DesigType; /// 8
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
@@ -45,8 +43,6 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
#endif
|
||||
ReadStartInfo = true; /// 5
|
||||
StartInfoIsRequired = false; /// 6
|
||||
DesigMode = DesigMode.Auto; /// 7
|
||||
DesigType = Results.Output.LogType.Just_Q3Q2Q1; /// 8
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
@@ -58,8 +54,6 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
"Save results", /// 4
|
||||
"Read start info", /// 5
|
||||
"Start info is required", /// 6
|
||||
"Designation Mode", /// 7
|
||||
"Designation when mode is 'As_specified'", /// 8
|
||||
};
|
||||
public override string ParamName(int i) { return paramNames[i]; }
|
||||
public override int ParamsCount() { return paramNames.Length; }
|
||||
@@ -89,13 +83,6 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
case 5:
|
||||
case 6:
|
||||
return new string[] { Strings.yes, Strings.no };
|
||||
case 7:
|
||||
for (DesigMode md = 0; md < DesigMode.Count; md++) retVal.Add(md.ToString());
|
||||
return retVal;
|
||||
|
||||
case 8:
|
||||
for (Results.Output.LogType wm = 0; wm < Results.Output.LogType.Count; wm++) retVal.Add(wm.ToString());
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,8 +97,6 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
case 4: return SaveResults ? Strings.yes : Strings.no;
|
||||
case 5: return ReadStartInfo ? Strings.yes : Strings.no;
|
||||
case 6: return StartInfoIsRequired ? Strings.yes : Strings.no;
|
||||
case 7: return DesigMode.ToString();
|
||||
case 8: return DesigType.ToString();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -148,28 +133,6 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
case 4: SaveResults = (strValue == Strings.yes); return CfgUpdateFlags.None;
|
||||
case 5: ReadStartInfo = (strValue == Strings.yes); return CfgUpdateFlags.None;
|
||||
case 6: StartInfoIsRequired = (strValue == Strings.yes); return CfgUpdateFlags.None;
|
||||
|
||||
case 7:
|
||||
for (DesigMode db = 0; db < DesigMode.Count; db++)
|
||||
{
|
||||
if (db.ToString() == strValue)
|
||||
{
|
||||
DesigMode = db;
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
for (Results.Output.LogType wm = 0; wm < Results.Output.LogType.Count; wm++)
|
||||
{
|
||||
if (wm.ToString() == strValue)
|
||||
{
|
||||
DesigType = wm;
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return CfgUpdateFlags.None;
|
||||
@@ -214,20 +177,6 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
return true;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
for (DesigMode db = 0; db < DesigMode.Count; db++)
|
||||
{
|
||||
if (db.ToString() == strValue) return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
for (Results.Output.LogType wm = 0; wm < Results.Output.LogType.Count; wm++)
|
||||
{
|
||||
if (wm.ToString() == strValue) return true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
@@ -246,8 +195,6 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
prms.SaveResults = this.SaveResults;
|
||||
prms.ReadStartInfo = this.ReadStartInfo;
|
||||
prms.StartInfoIsRequired = this.StartInfoIsRequired;
|
||||
prms.DesigMode = this.DesigMode;
|
||||
prms.DesigType = this.DesigType;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2018-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2018-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -197,116 +197,94 @@ namespace TBF.Rig.Output.FileWriters.IperlLogger
|
||||
|
||||
public Retv WriteLogsToDisk(TextWriter logger, Batch batch)
|
||||
{
|
||||
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
|
||||
#if ORACLE_DB
|
||||
|
||||
///
|
||||
/// Obtain one representative water meter
|
||||
/// Obtain data of one water meter
|
||||
///
|
||||
WaterMeter wm0 = batch.WaterMeters.FirstOrDefault<WaterMeter>(x => (x != null && !x.Disabled && x.WaterMeterData != null));
|
||||
if (wm0 == null)
|
||||
WaterMeter firstWM = batch.WaterMeters.FirstOrDefault<WaterMeter>(x => (x != null && !x.Disabled && x.WaterMeterData != null));
|
||||
if (firstWM == null)
|
||||
{
|
||||
log.Error("Not a single watermeter in the batch");
|
||||
return Retv.Error; /// Not a single watermeter in the batch
|
||||
}
|
||||
WaterMeterData wmData = wm0.WaterMeterData;
|
||||
WaterMeterData wmData = firstWM.WaterMeterData;
|
||||
|
||||
///
|
||||
/// Select or create appropriate test infos
|
||||
///
|
||||
Results.Output.SensusTestInfo[] testInfos = Sequences.ProcessData.CompleteTestInfos;
|
||||
///
|
||||
if ((ProcessData.OracleDB != null && ProcessData.OracleDB.DesigMode == Output.DB.SensusOracle.DesigMode.Based_on_procedure) ||
|
||||
(testInfos == null && StateMachine.Procedure != null))
|
||||
{
|
||||
testInfos = Results.Output.SensusTestInfo.CreateFromProcedure(StateMachine.Procedure);
|
||||
}
|
||||
if (testInfos == null)
|
||||
{
|
||||
log.Error("CompleteTestInfos is null");
|
||||
return Retv.Error; /// No test infos
|
||||
}
|
||||
log.Warn("Using CompleteTestInfos:");
|
||||
foreach (var cti in testInfos)
|
||||
{
|
||||
log.WarnFormat(" Test={0} PrfNrDB={1} QBzDB={2} PrfNrOpto={3} QBzOpto={4} PrfNrLog={5} QBzLog={6} Range={7}",
|
||||
cti.TestName, cti.PruefungsNrDB, cti.QBezeichnungDB, cti.PruefungsNrOpto,
|
||||
cti.QBezeichnungOpto, cti.PruefungsNrLog, cti.QBezeichnungLog, cti.Range);
|
||||
}
|
||||
|
||||
///
|
||||
/// Select water meter test results
|
||||
///
|
||||
MeterTestRslt[] wm0trs = new MeterTestRslt[testInfos.Length];
|
||||
double totalTestTime = 0;
|
||||
IList<LUTestData> testsToSave = new List<LUTestData>();
|
||||
int maxPruefungsNr = 0;
|
||||
for (int j = 0; j < testInfos.Length; j++)
|
||||
double totalTestTime = 0;
|
||||
foreach (var td in batch.Tests)
|
||||
{
|
||||
if (testInfos[j].PruefungsNrLog != 0)
|
||||
for (int repNr = 1; repNr <= td.Repeats; repNr++)
|
||||
{
|
||||
if (Math.Abs(testInfos[j].PruefungsNrLog) > maxPruefungsNr) maxPruefungsNr = Math.Abs(testInfos[j].PruefungsNrLog);
|
||||
|
||||
wm0trs[j] = wm0.GetMeterTestRslt(testInfos[j].TestName);
|
||||
|
||||
if (wm0trs[j] != null)
|
||||
int testId = td.OraId + (td.Repeats - repNr) * td.OraIdRepetMulti;
|
||||
if (testId != 0)
|
||||
{
|
||||
totalTestTime += wm0trs[j].TargetTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
log.ErrorFormat("Missing test result for test {0}", testInfos[j].TestName);
|
||||
return Retv.Error; /// Missing test result for one of specified tests
|
||||
testsToSave.Add(new LUTestData(td, repNr));
|
||||
if (Math.Abs(testId) > maxPruefungsNr) maxPruefungsNr = Math.Abs(testId);
|
||||
totalTestTime += td.TargetTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
LUTestData[] testsToSaveArr = testsToSave.ToArray();
|
||||
Array.Sort(testsToSaveArr, new LUTestDataComparer());
|
||||
|
||||
/// Make a log
|
||||
foreach (var ltd in testsToSaveArr)
|
||||
{
|
||||
log.WarnFormat(" Test={0} Repetition={1} Id={2} Designation={3}", ltd.TData.Name, ltd.RepNr, ltd.Id, ltd.Designation);
|
||||
}
|
||||
|
||||
///
|
||||
/// Check whether the test results are complete, quit on error
|
||||
///
|
||||
MeterTestRslt[] firstWMTestRslts = new MeterTestRslt[testsToSaveArr.Length];
|
||||
foreach (var ltd in testsToSaveArr)
|
||||
{
|
||||
if (firstWM.GetMeterTestRslt(ltd.TestName) == null)
|
||||
{
|
||||
log.ErrorFormat("Missing test result for test {0}", ltd.TestName);
|
||||
return Retv.Error; /// Missing test result for one of specified tests
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Save the log file
|
||||
///
|
||||
logger.WriteLine("[Wasserzähler-Daten]");
|
||||
logger.WriteLine(string.Format("PruefPunkte={0}", (maxPruefungsNr > 15) ? 20 : ((maxPruefungsNr > 10) ? 15 : ((maxPruefungsNr > 5) ? 10 : 5))));
|
||||
logger.WriteLine(string.Format("PruefPunkte={0}", (maxPruefungsNr > 20) ? 99 : (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));
|
||||
logger.WriteLine(string.Format("Qn={0}", wmData.Q3_Qn.ToString("F1", Program.AltCulture)));
|
||||
logger.WriteLine(string.Format("Impulsrate=1"));
|
||||
logger.WriteLine(string.Format("WZid={0}", wmData.WMTypeId));
|
||||
logger.WriteLine(string.Format("RevWzTyp={0}", wm0.WMTypeRevision));
|
||||
logger.WriteLine(string.Format("RevWzTyp={0}", firstWM.WMTypeRevision));
|
||||
logger.WriteLine(string.Format("RevPruefstandWzTyp=2"));
|
||||
|
||||
for (int j = 0; j < testInfos.Length; j++)
|
||||
foreach (var ltd in testsToSaveArr)
|
||||
{
|
||||
if (testInfos[j].PruefungsNrLog != 0)
|
||||
{
|
||||
string fId = testInfos[j].PruefungsNrLog.ToString((testInfos[j].PruefungsNrLog > 0) ? "D2" : "D1");
|
||||
string qBz = testInfos[j].QBezeichnungLog;
|
||||
Results.Entities.MeterTestRslt wm0r = wm0trs[j];
|
||||
bool pb_100_110 = (testInfos[j].Range == Range.R100_110);
|
||||
string fId = ltd.Id.ToString((ltd.Id > 0) ? "D2" : "D1");
|
||||
string qBz = ltd.Designation;
|
||||
var td = ltd.TData;
|
||||
bool pb_100_110 = (Math.Abs(td.Qtg - td.Qfrom) < Math.Abs(td.Qto - td.Qtg));
|
||||
|
||||
if (wm0r != null)
|
||||
{
|
||||
/// An existing test
|
||||
logger.WriteLine(string.Format("Durchfluss{0}={1}", fId, Units.ConvertTo(Unit.lph, (wm0r.Qfrom() + wm0r.Qto()) / 2).ToString("F1", Program.AltCulture)));
|
||||
logger.WriteLine(string.Format("Prüfzeit{0}={1}", fId, wm0r.TargetTime().ToString("F0")));
|
||||
logger.WriteLine(string.Format("Prüfbereich100_110{0}={1}", fId, (pb_100_110 ? 1 : 0)));
|
||||
logger.WriteLine(string.Format("PrüfbereichMin{0}={1}", fId, (pb_100_110 ? 100 : 90)));
|
||||
logger.WriteLine(string.Format("PrüfbereichMax{0}={1}", fId, (pb_100_110 ? 110 : 100)));
|
||||
logger.WriteLine(string.Format("QBezeichnung{0}={1}", fId, qBz));
|
||||
if (testInfos[j].PruefungsNrLog > 0)
|
||||
{
|
||||
/// Test is not an adjustment
|
||||
logger.WriteLine(string.Format("PosFehlergrenze{0}={1}", fId, (wm0r.ErrLimHi() - wm0r.Uncertainty()).ToString("F1", Program.AltCulture)));
|
||||
logger.WriteLine(string.Format("NegFehlergrenze{0}={1}", fId, (wm0r.ErrLimLo() + wm0r.Uncertainty()).ToString("F1", Program.AltCulture)));
|
||||
logger.WriteLine(string.Format("PosFehlergrenzeWarm{0}=0,0", fId));
|
||||
logger.WriteLine(string.Format("NegFehlergrenzeWarm{0}=0,0", fId));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.WriteLine(string.Format("Durchfluss{0}=0,0", fId));
|
||||
logger.WriteLine(string.Format("Prüfzeit{0}=0", fId));
|
||||
logger.WriteLine(string.Format("Prüfbereich100_110{0}=0", fId));
|
||||
logger.WriteLine(string.Format("PrüfbereichMin{0}=0", fId));
|
||||
logger.WriteLine(string.Format("PrüfbereichMax{0}=0", fId));
|
||||
logger.WriteLine(string.Format("QBezeichnung{0}=", fId));
|
||||
}
|
||||
logger.WriteLine(string.Format("Durchfluss{0}={1}", fId, Units.ConvertTo(Unit.lph, (td.Qfrom + td.Qto) / 2).ToString("F1", Program.AltCulture)));
|
||||
logger.WriteLine(string.Format("Prüfzeit{0}={1}", fId, td.TargetTime.ToString("F0")));
|
||||
logger.WriteLine(string.Format("Prüfbereich100_110{0}={1}", fId, (pb_100_110 ? 1 : 0)));
|
||||
logger.WriteLine(string.Format("PrüfbereichMin{0}={1}", fId, (pb_100_110 ? 100 : 90)));
|
||||
logger.WriteLine(string.Format("PrüfbereichMax{0}={1}", fId, (pb_100_110 ? 110 : 100)));
|
||||
logger.WriteLine(string.Format("QBezeichnung{0}={1}", fId, qBz));
|
||||
if (ltd.Id > 0)
|
||||
{
|
||||
/// Test is not an adjustment
|
||||
logger.WriteLine(string.Format("PosFehlergrenze{0}={1}", fId, (td.ErrLimHi - td.ErrLimMargin).ToString("F1", Program.AltCulture)));
|
||||
logger.WriteLine(string.Format("NegFehlergrenze{0}={1}", fId, (td.ErrLimLo + td.ErrLimMargin).ToString("F1", Program.AltCulture)));
|
||||
logger.WriteLine(string.Format("PosFehlergrenzeWarm{0}=0,0", fId));
|
||||
logger.WriteLine(string.Format("NegFehlergrenzeWarm{0}=0,0", fId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,14 +325,11 @@ namespace TBF.Rig.Output.FileWriters.IperlLogger
|
||||
else
|
||||
{
|
||||
bool testRsltIsMissing = false;
|
||||
Results.Entities.MeterTestRslt[] wmtrs = new Results.Entities.MeterTestRslt[testInfos.Length];
|
||||
for (int j = 0; j < testInfos.Length; j++)
|
||||
Results.Entities.MeterTestRslt[] wmtrs = new Results.Entities.MeterTestRslt[testsToSaveArr.Length];
|
||||
for (int j = 0; j < testsToSaveArr.Length; j++)
|
||||
{
|
||||
if (testInfos[j].PruefungsNrLog != 0)
|
||||
{
|
||||
wmtrs[j] = wMtr.GetMeterTestRslt(testInfos[j].TestName);
|
||||
if (wmtrs[j] == null) testRsltIsMissing = true; /// Missing test result for one of specified tests
|
||||
}
|
||||
wmtrs[j] = wMtr.GetMeterTestRslt(testsToSaveArr[j].TestName);
|
||||
if (wmtrs[j] == null) testRsltIsMissing = true; /// Missing test result for one of specified tests
|
||||
}
|
||||
|
||||
logger.WriteLine();
|
||||
@@ -376,12 +351,12 @@ namespace TBF.Rig.Output.FileWriters.IperlLogger
|
||||
logger.WriteLine(string.Format("PrüfIndex={0}", wMtr.Pruefindex)); /// 7301
|
||||
logger.WriteLine(string.Format("GeprüftIndex=1")); /// 1
|
||||
|
||||
for (int j = 0; j < testInfos.Length; j++)
|
||||
for (int j = 0; j < testsToSaveArr.Length; j++)
|
||||
{
|
||||
if (testInfos[j].PruefungsNrLog != 0)
|
||||
if (testsToSaveArr[j].Id != 0)
|
||||
{
|
||||
Results.Entities.MeterTestRslt mtr = wmtrs[j];
|
||||
string flID = testInfos[j].PruefungsNrLog.ToString((testInfos[j].PruefungsNrLog > 0) ? "D2" : "D1");
|
||||
string flID = testsToSaveArr[j].Id.ToString((testsToSaveArr[j].Id > 0) ? "D2" : "D1");
|
||||
|
||||
if (mtr != null)
|
||||
{
|
||||
@@ -450,22 +425,19 @@ namespace TBF.Rig.Output.FileWriters.IperlLogger
|
||||
logger.WriteLine(string.Format("Dichtprüfung={0}", 0)); /// 1
|
||||
|
||||
|
||||
foreach (var cti in testInfos)
|
||||
foreach (var ltd in testsToSaveArr)
|
||||
{
|
||||
if (cti.PruefungsNrLog != 0)
|
||||
{
|
||||
string pNrStr = cti.PruefungsNrLog.ToString((cti.PruefungsNrLog > 0) ? "D2" : "D1");
|
||||
Results.Entities.TestRslt tr = wm0.GetTestRslt(cti.TestName);
|
||||
string pNrStr = ltd.Id.ToString((ltd.Id > 0) ? "D2" : "D1");
|
||||
Results.Entities.TestRslt tr = firstWM.GetTestRslt(ltd.TestName);
|
||||
|
||||
if (tr != null)
|
||||
{
|
||||
logger.WriteLine(string.Format("Q{0}_geprüft=1", pNrStr));
|
||||
WriteOneToDisk(logger, pNrStr, tr);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.WriteLine(string.Format("Q{0}_geprüft=0", pNrStr));
|
||||
}
|
||||
if (tr != null)
|
||||
{
|
||||
logger.WriteLine(string.Format("Q{0}_geprüft=1", pNrStr));
|
||||
WriteOneToDisk(logger, pNrStr, tr);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.WriteLine(string.Format("Q{0}_geprüft=0", pNrStr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2018-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,7 +11,7 @@ using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.Output.FileWriters.IperlLogger
|
||||
{
|
||||
public class WriterCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider
|
||||
public class WriterCfg : ComponentCfgBase, IComponentCfg, IParamsProvider
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(WriterCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
@@ -23,11 +23,8 @@ namespace TBF.Rig.Output.FileWriters.IperlLogger
|
||||
public bool MonthFolders;
|
||||
public bool DayFolders;
|
||||
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
WriterCfg()
|
||||
{
|
||||
}
|
||||
WriterCfg() { }
|
||||
|
||||
public WriterCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
///
|
||||
/// Copyright (c) 2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using Results.Entities;
|
||||
|
||||
namespace TBF.Rig.Output
|
||||
{
|
||||
public class LUTestData
|
||||
{
|
||||
public TestData TData;
|
||||
public int RepNr;
|
||||
public string TestName; /// Expanded TBF test name
|
||||
public int Id; /// PruefungsNr
|
||||
public string Designation; /// QBezeichnung
|
||||
|
||||
public LUTestData(TestData tData, int repNr)
|
||||
{
|
||||
TData = tData;
|
||||
RepNr = repNr;
|
||||
TestName = Common.Utils.GetTestName(tData.Name, tData.Repeats, repNr);
|
||||
#if ORACLE_DB
|
||||
Id = tData.OraId + (tData.Repeats - repNr) * tData.OraIdRepetMulti;
|
||||
if (string.IsNullOrEmpty(tData.OraDesignation))
|
||||
{
|
||||
Designation = Common.Utils.GetTestName(tData.Name, tData.Repeats, repNr);
|
||||
}
|
||||
else
|
||||
{
|
||||
var designations = tData.OraDesignation.Split(new char[] { '~' });
|
||||
Designation = (designations.Length > repNr - 1)
|
||||
? designations[repNr - 1] /// Name is from 'OraDesignation' parameter
|
||||
: Common.Utils.GetTestName(tData.Name, tData.Repeats, repNr); /// Name is from test name and repetition nr.
|
||||
}
|
||||
#else
|
||||
Id = 0;
|
||||
Designation = Common.Utils.GetTestName(tData.Name, tData.Repeats, repNr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
///
|
||||
/// Copyright (c) 2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TBF.Rig.Output
|
||||
{
|
||||
public class LUTestDataComparer : IComparer
|
||||
{
|
||||
SortOrder order;
|
||||
|
||||
public LUTestDataComparer()
|
||||
{
|
||||
order = SortOrder.Ascending;
|
||||
}
|
||||
|
||||
public LUTestDataComparer(SortOrder order)
|
||||
{
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
// test.RawDataId + repetitionNr * test.RawDataIdRepetMulti
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
#if ORACLE_DB
|
||||
var trX = x as LUTestData;
|
||||
var trY = y as LUTestData;
|
||||
if (trX == null || trY == null) return 0;
|
||||
|
||||
int idX = trX.TData.OraId + (trX.TData.Repeats - trX.RepNr) * trX.TData.OraIdRepetMulti;
|
||||
int idY = trY.TData.OraId + (trY.TData.Repeats - trY.RepNr) * trY.TData.OraIdRepetMulti;
|
||||
int valX = (idX > 0) ? int.MaxValue - idX : idX;
|
||||
int valY = (idY > 0) ? int.MaxValue - idY : idY;
|
||||
return order == SortOrder.Descending ? (valY - valX) : (valX - valY);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using Common;
|
||||
@@ -9,13 +9,14 @@ namespace TBF.Rig.Output.Printers.Enhanced
|
||||
{
|
||||
public class FactoryCompound : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(8) + ".Compound"; } }
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8) + ".Compound"; } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new Printer(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Printer(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new PrinterCfg("Printer.Enhanced.Compound", this, MetersKind.Combined); }
|
||||
public IComponentCfg DefaultConfig() { return new PrinterCfg(this, "Printer.Enhanced.Compound", MetersKind.Combined); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using Common;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Output.Printers.Enhanced
|
||||
@@ -9,12 +10,13 @@ namespace TBF.Rig.Output.Printers.Enhanced
|
||||
public class FactoryHeatMeters : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8) + ".HeatMeters"; } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new Printer(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Printer(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new PrinterCfg("Printer.Enhanced.HeatMeters", this, Common.MetersKind.HeatMeter); }
|
||||
public IComponentCfg DefaultConfig() { return new PrinterCfg(this, "Printer.Enhanced.HeatMeters", MetersKind.HeatMeter); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using Common;
|
||||
@@ -9,13 +9,14 @@ namespace TBF.Rig.Output.Printers.Enhanced
|
||||
{
|
||||
public class FactorySingle : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(8) + ".Single"; } }
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8) + ".Single"; } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public IComponent DummyComponent() { return new Printer(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Printer(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new PrinterCfg("Printer.Enhanced.Single", this, MetersKind.Single); }
|
||||
public IComponentCfg DefaultConfig() { return new PrinterCfg(this, "Printer.Enhanced.Single", MetersKind.Single); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
|
||||
@@ -8,12 +8,15 @@ using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Output.Printers.Enhanced
|
||||
{
|
||||
public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
public class PrinterCfg : ComponentCfgBase, IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PrinterCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new PrinterCfgCtrl(); }
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities)
|
||||
{
|
||||
return new PrinterCfgCtrl();
|
||||
}
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
@@ -57,14 +60,21 @@ namespace TBF.Rig.Output.Printers.Enhanced
|
||||
{
|
||||
}
|
||||
|
||||
public PrinterCfg(string name, IComponentFactory factory, MetersKind metersKind)
|
||||
public PrinterCfg(IComponentFactory factory, string name, MetersKind metersKind)
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
MetersKind = metersKind;
|
||||
|
||||
Factory = factory;
|
||||
Name = name;
|
||||
ParentName = string.Empty;
|
||||
MetersKind = metersKind;
|
||||
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
Template = string.Empty;
|
||||
PageOrientation = PageOrientation.Portrait;
|
||||
TopMargin = 100;
|
||||
@@ -98,8 +108,7 @@ namespace TBF.Rig.Output.Printers.Enhanced
|
||||
TopMargin,
|
||||
BottomMargin,
|
||||
LeftMargin,
|
||||
SupressPrinting ? "yes" : "no"
|
||||
);
|
||||
SupressPrinting ? "yes" : "no" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-9
@@ -27,7 +27,7 @@ namespace TBF.Rig
|
||||
public IValve StartValve3;
|
||||
public bool InvertSV3;
|
||||
public int LagSV3;
|
||||
public float[] RegulValvesPct;
|
||||
public IList<RegValvePosition> RegVPositions;
|
||||
public IList<IValve> ValvesOpen;
|
||||
public IList<IValve> ValvesClose;
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace TBF.Rig
|
||||
{
|
||||
ItemNr = itemNr;
|
||||
Name = name;
|
||||
RegVPositions = new List<RegValvePosition>();
|
||||
ValvesOpen = new List<IValve>();
|
||||
ValvesClose = new List<IValve>();
|
||||
}
|
||||
@@ -54,13 +55,6 @@ namespace TBF.Rig
|
||||
TempDiv = TbfComponents.FindComponent(entity.TempDiv, components) as ITempMeter;
|
||||
Scale = TbfComponents.FindComponent(entity.Scale, components) as IScaleOrTank;
|
||||
|
||||
int regvCount = 0;
|
||||
foreach (var cmpnt in components)
|
||||
{
|
||||
if ((cmpnt is IRegValve) && !(cmpnt is Rig.Elde.RegulValveTandem.RegulValveTandem)) regvCount++;
|
||||
}
|
||||
RegulValvesPct = string.IsNullOrEmpty(entity.RegulValvesPct) ? new float[0] : Utils.GetRegulValvesPositions(entity.RegulValvesPct, regvCount);
|
||||
|
||||
string[] svs = entity.StartValve != null ? entity.StartValve.Split(new char[] { '~' }) : new string[0];
|
||||
int iTmp;
|
||||
///
|
||||
@@ -73,6 +67,23 @@ namespace TBF.Rig
|
||||
InvertSV3 = (svs.Length > 6) ? svs[6].Equals("i") : false;
|
||||
LagSV3 = (svs.Length > 7 && int.TryParse(svs[7], out iTmp)) ? iTmp : 0;
|
||||
|
||||
///
|
||||
/// Output regulation valves and their positions
|
||||
///
|
||||
RegVPositions.Clear();
|
||||
foreach (var cmpnt in components)
|
||||
{
|
||||
IRegValve rv = cmpnt as IRegValve;
|
||||
if (rv != null && rv.Category == TBF.Rig.ValveCategory.Output && !(rv is TBF.Rig.Elde.RegulValveTandem.RegulValveTandem))
|
||||
{
|
||||
RegVPositions.Add(new RegValvePosition(rv));
|
||||
}
|
||||
}
|
||||
TBF.Utils.UpdateRegVPositionsFromStr(ref RegVPositions, entity.RegulValvesPct);
|
||||
|
||||
///
|
||||
/// Regular valves to open
|
||||
///
|
||||
string[] vOpen = entity.ValvesOpen.Split(new char[] { ';' });
|
||||
ValvesOpen = new List<IValve>();
|
||||
foreach (var vName in vOpen)
|
||||
@@ -81,7 +92,10 @@ namespace TBF.Rig
|
||||
if (cmpnt is IValve) ValvesOpen.Add(cmpnt as IValve);
|
||||
}
|
||||
|
||||
string[] vClose = entity.ValvesClose.Split(new char[] { ';' });
|
||||
///
|
||||
/// Regular valves to close
|
||||
///
|
||||
string[] vClose = entity.ValvesClose.Split(new char[] { ';' });
|
||||
ValvesClose = new List<IValve>();
|
||||
foreach (var vName in vClose)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
///
|
||||
/// Copyright (c) 2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using TBF.Rig.GenericDevices;
|
||||
|
||||
namespace TBF.Rig
|
||||
{
|
||||
public class RegValvePosition
|
||||
{
|
||||
public IRegValve RegValve;
|
||||
public float Position; /// 0 .. 100.0f is position in %, <0 (default -1.0f) means no change
|
||||
|
||||
public RegValvePosition(IRegValve regValve, float position)
|
||||
{
|
||||
RegValve = regValve;
|
||||
Position = position;
|
||||
}
|
||||
|
||||
/// Constructor with reg. valve and no position change
|
||||
public RegValvePosition(IRegValve regValve)
|
||||
{
|
||||
RegValve = regValve;
|
||||
Position = -1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,12 +117,12 @@ namespace TBF.Rig.RegisterReaders.S640Stream
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: Position = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: ComPortNr = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: BaudRate = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 0: Position = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: ComPortNr = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: BaudRate = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: Parity = Common.Utils.GetParity(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: DataBits = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: StopBits = Common.Utils.GetStopBits(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: DataBits = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: StopBits = Common.Utils.GetStopBits(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 6: Handshake = Common.Utils.GetHandshake(str); return CfgUpdateFlags.RestartRqrd;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
|
||||
@@ -121,11 +121,11 @@ namespace TBF.Rig.RegisterReaders.SerialStream
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: ComPortNr = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: BaudRate = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 0: ComPortNr = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: BaudRate = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: Parity = Common.Utils.GetParity(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: DataBits = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: StopBits = Common.Utils.GetStopBits(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: DataBits = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: StopBits = Common.Utils.GetStopBits(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: Handshake = Common.Utils.GetHandshake(str); return CfgUpdateFlags.RestartRqrd;
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
|
||||
+174
-48
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -23,29 +23,32 @@ namespace TBF.Rig.Sequences
|
||||
|
||||
public override string ToString() { return "Sequences.MainSeq"; }
|
||||
|
||||
bool isApprovedByLegalizator = false;
|
||||
string legalizatorName = string.Empty;
|
||||
DateTime lastApprovalByLegalizatorTime;
|
||||
|
||||
int simultWithPurgingCount;
|
||||
Generic.IComponentCfg simultWithPurgingCfg;
|
||||
Generic.IComponent simultWithPurging;
|
||||
Generic.IProcedureParams simultWithPurgingProcParams;
|
||||
IList<Config.Entities.Test> simultWithPurgingTests;
|
||||
IList<Generic.ITestParams> simultWithPurgingTestParams;
|
||||
|
||||
int simultWithEvacuationCount;
|
||||
Generic.IComponentCfg simultWithEvacuationCfg;
|
||||
Generic.IComponent simultWithEvacuation;
|
||||
Generic.IProcedureParams simultWithEvacuationProcParams;
|
||||
IList<Config.Entities.Test> simultWithEvacuationTests;
|
||||
IList<Generic.ITestParams> simultWithEvacuationTestParams;
|
||||
|
||||
System.Windows.Forms.Form modelessDlg;
|
||||
///
|
||||
delegate void CommunicationFormDlgt(MainSeq myRef, Generic.IComponentCfg cfg, Generic.IProcedureParams procParams, IList<Test> tests, IList<Generic.ITestParams> multiTestParams);
|
||||
delegate void CommunicationFormDlgt(MainSeq myRef, Generic.IComponent comp, Generic.IProcedureParams procParams, IList<Test> tests, IList<Generic.ITestParams> multiTestParams);
|
||||
///
|
||||
void OpenIPerlCommForm(MainSeq myRef, Generic.IComponentCfg cfg, Generic.IProcedureParams procParams, IList<Test> tests, IList<Generic.ITestParams> multiTestParams)
|
||||
void OpenIPerlCommForm(MainSeq myRef, Generic.IComponent testMethod, Generic.IProcedureParams procParams, IList<Test> tests, IList<Generic.ITestParams> multiTestParams)
|
||||
{
|
||||
try
|
||||
{
|
||||
/// 1nd argument
|
||||
TestMethods.iPerlCommunication.TestMethodCfg iPerlCfg = cfg as TestMethods.iPerlCommunication.TestMethodCfg;
|
||||
TestMethods.iPerlCommunication.TestMethodCfg iPerlCfg = testMethod.Cfg as TestMethods.iPerlCommunication.TestMethodCfg;
|
||||
|
||||
/// 2rd argument: as is
|
||||
|
||||
@@ -53,7 +56,8 @@ namespace TBF.Rig.Sequences
|
||||
IList<TestMethods.iPerlCommunication.iPerlCommunicationParams> iPerlCommParams = new List<TestMethods.iPerlCommunication.iPerlCommunicationParams>();
|
||||
foreach (var tp in multiTestParams) iPerlCommParams.Add(tp as TestMethods.iPerlCommunication.iPerlCommunicationParams);
|
||||
|
||||
myRef.modelessDlg = new TestMethods.iPerlCommunication.iPerlCommunicationForm(iPerlCfg, tests, iPerlCommParams);
|
||||
myRef.modelessDlg = new TestMethods.iPerlCommunication.iPerlCommunicationForm(
|
||||
testMethod as TBF.Rig.TestMethods.iPerlCommunication.TestMethod, tests, iPerlCommParams);
|
||||
myRef.modelessDlg.Show();
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -69,21 +73,21 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
}
|
||||
///
|
||||
void OpenS640CommForm(MainSeq myRef, Generic.IComponentCfg cfg, Generic.IProcedureParams procParams, IList<Test> tests, IList<Generic.ITestParams> multiTestParams)
|
||||
void OpenS640CommForm(MainSeq myRef, Generic.IComponent testMethod, Generic.IProcedureParams procParams, IList<Test> tests, IList<Generic.ITestParams> multiTestParams)
|
||||
{
|
||||
try
|
||||
{
|
||||
TestMethods.S640Communication.S640Activity activity; /// 1st argument
|
||||
TBF.Rig.TestMethods.S640Communication.I640Cfg config; /// 2nd argument
|
||||
if (cfg is TestMethods.S640Communication.S640StartCfg)
|
||||
if (testMethod.Cfg is TestMethods.S640Communication.S640StartCfg)
|
||||
{
|
||||
activity = TestMethods.S640Communication.S640Activity.Start;
|
||||
config = (cfg as TestMethods.S640Communication.S640StartCfg);
|
||||
config = (testMethod.Cfg as TestMethods.S640Communication.S640StartCfg);
|
||||
}
|
||||
else if (cfg is TestMethods.S640Communication.S640EndCfg)
|
||||
else if (testMethod.Cfg is TestMethods.S640Communication.S640EndCfg)
|
||||
{
|
||||
activity = TestMethods.S640Communication.S640Activity.End;
|
||||
config = (cfg as TestMethods.S640Communication.S640EndCfg);
|
||||
config = (testMethod.Cfg as TestMethods.S640Communication.S640EndCfg);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -131,13 +135,13 @@ namespace TBF.Rig.Sequences
|
||||
FillState = FillState.Unknown;
|
||||
|
||||
simultWithPurgingCount = 0;
|
||||
simultWithPurgingCfg = null;
|
||||
simultWithPurging = null;
|
||||
simultWithPurgingProcParams = null;
|
||||
simultWithPurgingTests = new List<Config.Entities.Test>();
|
||||
simultWithPurgingTestParams = new List<Generic.ITestParams>();
|
||||
|
||||
simultWithEvacuationCount = 0;
|
||||
simultWithEvacuationCfg = null;
|
||||
simultWithEvacuation = null;
|
||||
simultWithEvacuationProcParams = null;
|
||||
simultWithEvacuationTests = new List<Config.Entities.Test>();
|
||||
simultWithEvacuationTestParams = new List<Generic.ITestParams>();
|
||||
@@ -400,6 +404,16 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
while (StateMachine.Procedure == null); /// Make sure a valid procedure is selected
|
||||
|
||||
#if KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_50 || WARSAW_END
|
||||
///
|
||||
/// Approval of a legalizator
|
||||
///
|
||||
if (!string.IsNullOrEmpty(StateMachine.Procedure.AltProcName) && !IsApprovedByLegalizator())
|
||||
{
|
||||
goto select_procedure; /// Loop back to procedure selection if not approved by a legalizator
|
||||
}
|
||||
#endif
|
||||
|
||||
Debug.WriteLine(string.Empty);
|
||||
Debug.WriteLine(string.Format("TransitionSequences {0}", NHibernateUtil.IsInitialized(StateMachine.TransitionSequences) ? "initialized" : "NOT initialized"));
|
||||
Debug.WriteLine(string.Format("TransitionSteps {0}", NHibernateUtil.IsInitialized(StateMachine.TransitionSteps) ? "initialized" : "NOT initialized"));
|
||||
@@ -413,7 +427,6 @@ namespace TBF.Rig.Sequences
|
||||
|
||||
UiBridge.Bridge.OnError(this, string.Empty); /// Clear an error message (if any)
|
||||
|
||||
|
||||
if (selection == Selection.RestoreInterruptedSession)
|
||||
{
|
||||
if (!LoadProcessData())
|
||||
@@ -427,6 +440,7 @@ namespace TBF.Rig.Sequences
|
||||
{
|
||||
/// Clear session data in case this is not an interrupted/restored session
|
||||
ClearSessionData();
|
||||
SampleRemainingTimeSec.Clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -491,6 +505,60 @@ namespace TBF.Rig.Sequences
|
||||
{
|
||||
/// This is a regular session => initialize BatchRslts
|
||||
BatchRslts = CreateNewBatchResults(newBatchNr, StateMachine.Procedure);
|
||||
Batch b = BatchRslts.Batch;
|
||||
b.EndTime = DateTime.MinValue; /// Disable the batch end time estimate
|
||||
|
||||
Batch sampleBatch = null;
|
||||
using (ISession rsltsDB = Results.DB.CreateSession())
|
||||
{
|
||||
var bts = rsltsDB.QueryOver<Batch>()
|
||||
.OrderBy(x => x.BatchNr).Desc
|
||||
.Where(x => x.ProcedureName == StateMachine.Procedure.Name)
|
||||
//.And(x => x.ProcedureRevision == StateMachine.Procedure.Revision)
|
||||
.List();
|
||||
///
|
||||
/// Take the median batch of the last 7, 5, 3 or 1 batches
|
||||
///
|
||||
if (bts.Count >= 7)
|
||||
{
|
||||
var batches7 = new List<Batch>() { bts[0], bts[1], bts[2], bts[3], bts[4], bts[5], bts[6] };
|
||||
sampleBatch = batches7.OrderBy(x => (x.EndTime - x.StartTime)).Skip(3).Take(1).Single();
|
||||
}
|
||||
else if (bts.Count >= 5)
|
||||
{
|
||||
var batches5 = new List<Batch>() { bts[0], bts[1], bts[2], bts[3], bts[4] };
|
||||
sampleBatch = batches5.OrderBy(x => (x.EndTime - x.StartTime)).Skip(2).Take(1).Single();
|
||||
}
|
||||
else if (bts.Count >= 3)
|
||||
{
|
||||
var batches3 = new List<Batch>() { bts[0], bts[1], bts[2] };
|
||||
sampleBatch = batches3.OrderBy(x => (x.EndTime - x.StartTime)).Skip(1).Take(1).Single();
|
||||
}
|
||||
else if (bts.Count >= 1)
|
||||
{
|
||||
sampleBatch = bts[0];
|
||||
}
|
||||
|
||||
if (sampleBatch != null)
|
||||
{
|
||||
/// Update the batch end time estimate according to a sample batch
|
||||
b.EndTime = b.StartTime + (sampleBatch.EndTime - sampleBatch.StartTime);
|
||||
|
||||
/// Prepare the dictionary of remaining times for each completed test according to the sample batch
|
||||
SampleRemainingTimeSec.Clear();
|
||||
foreach (TestRslt tr in sampleBatch.TestRslts)
|
||||
{
|
||||
if (TBF.Utils.IsHydroTest(tr.TestData.Method))
|
||||
{
|
||||
string key = tr.Key();
|
||||
if (!SampleRemainingTimeSec.ContainsKey(key))
|
||||
{
|
||||
SampleRemainingTimeSec.Add(key, sampleBatch.EndTime - tr.EndTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -588,11 +656,11 @@ namespace TBF.Rig.Sequences
|
||||
var firstRR = ProcessData.RegisterReaders.FirstOrDefault<IRegReader>(x => x != null);
|
||||
if (firstRR is TBF.Rig.TestMethods.iPerlCommunication.iPerlHead.IperlHead)
|
||||
{
|
||||
Program.MainWnd.Invoke(new CommunicationFormDlgt(OpenIPerlCommForm), new object[] { this, simultWithPurgingCfg, simultWithPurgingProcParams, simultWithPurgingTests, simultWithPurgingTestParams });
|
||||
Program.MainWnd.Invoke(new CommunicationFormDlgt(OpenIPerlCommForm), new object[] { this, simultWithPurging, simultWithPurgingProcParams, simultWithPurgingTests, simultWithPurgingTestParams });
|
||||
}
|
||||
else if (firstRR is TBF.Rig.RegisterReaders.S640Stream.S640Stream)
|
||||
{
|
||||
Program.MainWnd.Invoke(new CommunicationFormDlgt(OpenS640CommForm), new object[] { this, simultWithPurgingCfg, simultWithPurgingProcParams, simultWithPurgingTests, simultWithPurgingTestParams });
|
||||
Program.MainWnd.Invoke(new CommunicationFormDlgt(OpenS640CommForm), new object[] { this, simultWithPurging, simultWithPurgingProcParams, simultWithPurgingTests, simultWithPurgingTestParams });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -882,14 +950,10 @@ namespace TBF.Rig.Sequences
|
||||
for (int i = currentTestIx + 1; i < StateMachine.TestInstances.Length - simultWithEvacuationCount; i++)
|
||||
{
|
||||
Test tst = StateMachine.TestInstances[i].Test;
|
||||
if (tst != null)
|
||||
if (tst != null && TBF.Utils.IsHydroTest(tst.Method))
|
||||
{
|
||||
ITestMethod tm = TbfComponents.FindComponent(tst.Method) as ITestMethod;
|
||||
if (tm != null && tm.DoTransitions())
|
||||
{
|
||||
nextHydroTest = tst;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -978,7 +1042,6 @@ namespace TBF.Rig.Sequences
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(testInst.Test, testInst.Repetition, Progress.JustStarted));
|
||||
|
||||
bool currentTestFinished = true;
|
||||
bool doOneMoreRepetition = false;
|
||||
|
||||
bool doExecuteTransitionBefore = (currentTestIx == simultWithPurgingCount) || (testInst.Test != StateMachine.TestInstances[currentTestIx - 1].Test) || veryFirstTestInTheRestOfCycle;
|
||||
bool isLastRepetition = (currentTestIx == StateMachine.TestInstances.Length - simultWithEvacuationCount - 1) || (testInst.Test != StateMachine.TestInstances[currentTestIx + 1].Test);
|
||||
@@ -1248,7 +1311,18 @@ namespace TBF.Rig.Sequences
|
||||
///
|
||||
/// Update batch results, determine whether watermeters passed all required tests
|
||||
///
|
||||
BatchRslts.Batch.EndTime = DateTime.Now; /// Set cycle end time
|
||||
|
||||
/// Determine the end of the last test and save it as the batch end time
|
||||
DateTime lastTestEndTime = DateTime.MinValue;
|
||||
if (BatchRslts.Batch.TestRslts != null)
|
||||
{
|
||||
foreach (var tr in BatchRslts.Batch.TestRslts)
|
||||
{
|
||||
if (tr.EndTime > lastTestEndTime) lastTestEndTime = tr.EndTime;
|
||||
}
|
||||
}
|
||||
BatchRslts.Batch.EndTime = lastTestEndTime;
|
||||
|
||||
Results.Utils.GetCounterStates(BatchRslts.Batch, Program.LocalSettings.Counters); /// Update counters
|
||||
/// Remove results of internal tests
|
||||
for (int i = BatchRslts.Batch.TestRslts.Count - 1; i >= 0; i--)
|
||||
@@ -1293,6 +1367,10 @@ namespace TBF.Rig.Sequences
|
||||
Bridge.OnActivity(this, Strings.Saving_and_printing_results);
|
||||
//------------------------------------------------------
|
||||
|
||||
/// Save results to 'Results' MySQL DB with RsltsSent = 0 before saving and printing elswhere
|
||||
ProcessData.BatchRslts.Batch.RsltsSent = false;
|
||||
Results.DB.SaveNewBatch(ProcessData.BatchRslts.Batch);
|
||||
|
||||
string[] writers = (StateMachine.Procedure.ResultsWriter != null) ? StateMachine.Procedure.ResultsWriter.Split(new char[] { '~' }) : new string[0];
|
||||
string[] printers = (StateMachine.Procedure.ResultsPrinter != null) ? StateMachine.Procedure.ResultsPrinter.Split(new char[] { '~' }) : new string[0];
|
||||
string[] eventTriggers = (StateMachine.Procedure.EventTriggers != null) ? StateMachine.Procedure.EventTriggers.Split(new char[] { '~' }) : new string[0];
|
||||
@@ -1302,36 +1380,63 @@ namespace TBF.Rig.Sequences
|
||||
printers.CopyTo(rsltProcessors, writers.Length);
|
||||
eventTriggers.CopyTo(rsltProcessors, writers.Length + printers.Length);
|
||||
///
|
||||
State savingAndPrintingRslts = State.Create("MainSeq : Saving and printing results");
|
||||
foreach (var rpName in rsltProcessors)
|
||||
int rpix = 0; /// Component index in AddOperation() loop, afterwards rsltProcessors.Length
|
||||
try
|
||||
{
|
||||
IResultsProcessor rsltProcessor = TbfComponents.FindComponent(rpName) as IResultsProcessor;
|
||||
if (rsltProcessor != null)
|
||||
State st = State.Create("MainSeq : Saving and printing results");
|
||||
for (rpix = 0; rpix < rsltProcessors.Length; rpix++ )
|
||||
{
|
||||
try
|
||||
var rp = TbfComponents.FindComponent(rsltProcessors[rpix]) as IResultsProcessor;
|
||||
if (rp != null) st.AddOperation(rp.ProcessResultsOp(ProcessData.BatchRslts.Batch));
|
||||
}
|
||||
st.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) break;
|
||||
}
|
||||
while (e.Contains(Event.Busy));
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string rpName = (rpix < rsltProcessors.Length) ? rsltProcessors[rpix] : "???";
|
||||
Bridge.OnError(this, string.Format(Strings.Component_0_crashed_Results_not_saved, rpName));
|
||||
log.FatalFormat("FileWriter {0} crashed: {1}", rpName, exc.Message);
|
||||
goto error;
|
||||
}
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
///
|
||||
if (!e.Contains(Event.ErrorProcessingResults))
|
||||
{
|
||||
/// Results successfully saved and printed => update Batch record in Results DB in MySQL
|
||||
MySql.Data.MySqlClient.MySqlConnection dbConn = null;
|
||||
try
|
||||
{
|
||||
dbConn = new MySql.Data.MySqlClient.MySqlConnection(Results.DB.ConnectionString);
|
||||
dbConn.Open();
|
||||
var cmd = dbConn.CreateCommand();
|
||||
cmd.CommandText = string.Format("UPDATE `batch` SET `RsltsSent` = '1' WHERE `batch`.`BatchNr` = {0};", ProcessData.BatchRslts.Batch.BatchNr);
|
||||
int rowsUpdated = cmd.ExecuteNonQuery();
|
||||
cmd.Dispose();
|
||||
dbConn.Close();
|
||||
if (rowsUpdated != 1)
|
||||
{
|
||||
savingAndPrintingRslts.AddOperation(rsltProcessor.ProcessResultsOp(ProcessData.BatchRslts.Batch));
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Bridge.OnError(this, string.Format(Strings.Component_0_crashed_Results_not_saved, rpName));
|
||||
log.FatalFormat("FileWriter {0} crashed: {1}", rpName, exc.Message);
|
||||
string msg = string.Format("Unable to update Batch.RsltsSent in local MySQL DB, BatchNr = {0}",
|
||||
ProcessData.BatchRslts.Batch.BatchNr);
|
||||
Bridge.OnError(this, msg);
|
||||
log.Fatal(msg);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
if (dbConn != null) dbConn.Close();
|
||||
string msg = string.Format("Unable to update Batch.RsltsSent in local MySQL DB, BatchNr = {0}",
|
||||
ProcessData.BatchRslts.Batch.BatchNr);
|
||||
Bridge.OnError(this, msg);
|
||||
log.FatalFormat("{0}: {1}", msg, exc.Message);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
savingAndPrintingRslts.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
}
|
||||
while (e.Contains(Event.Busy));
|
||||
///
|
||||
ProcessData.BatchRslts.Batch.RsltsSent = !e.Contains(Event.ErrorProcessingResults);
|
||||
|
||||
///
|
||||
/// Save results to 'Results' MySQL database
|
||||
///
|
||||
Results.DB.SaveNewBatch(ProcessData.BatchRslts.Batch);
|
||||
|
||||
///
|
||||
/// Save results to 'summary results' logger
|
||||
@@ -1465,6 +1570,27 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
|
||||
|
||||
bool IsApprovedByLegalizator()
|
||||
{
|
||||
if (isApprovedByLegalizator && DateTime.Now < lastApprovalByLegalizatorTime.Date.AddDays(1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var loginDlg = new Users.Forms.PlainLoginDlg(new GID[] { GID.CalibrationSpecialists }, "Approval by legalizator");
|
||||
if (loginDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
isApprovedByLegalizator = true;
|
||||
legalizatorName = loginDlg.FullName;
|
||||
lastApprovalByLegalizatorTime = DateTime.Now;
|
||||
return true;
|
||||
}
|
||||
|
||||
legalizatorName = string.Empty;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// MakeSelection() call context
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2020-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2020-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -276,8 +276,6 @@ namespace TBF.Rig.Sequences
|
||||
IsQ2PreCorrectionCalculated = false;
|
||||
CalculatedQ2PreCorrectionLR = 0;
|
||||
CalculatedQ2PreCorrectionRL = 0;
|
||||
RawTestInfos = null;
|
||||
CompleteTestInfos = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -629,7 +627,11 @@ namespace TBF.Rig.Sequences
|
||||
(BenchInfo != null) ? BenchInfo.Address3 : string.Empty,
|
||||
(BenchInfo != null) ? BenchInfo.Address4 : string.Empty,
|
||||
(BenchInfo != null) ? BenchInfo.Address5 : string.Empty,
|
||||
#if BAHRAIN_50
|
||||
(Users.CurrentUser.User() != null) ? Users.CurrentUser.User().ToEncodedStr() : "none",
|
||||
#else
|
||||
(Users.CurrentUser.User() != null) ? Users.CurrentUser.User().ToEncodedStr(legalizatorName) : "none",
|
||||
#endif
|
||||
Users.CurrentUser.Number(),
|
||||
Program.Version,
|
||||
StateMachine.Procedure,
|
||||
@@ -696,7 +698,7 @@ namespace TBF.Rig.Sequences
|
||||
/// Collect steps (e.g. iPerl communication) to be done simultaneously with purging
|
||||
///
|
||||
simultWithPurgingCount = 0;
|
||||
simultWithPurgingCfg = null;
|
||||
simultWithPurging = null;
|
||||
simultWithPurgingProcParams = null;
|
||||
simultWithPurgingTests.Clear();
|
||||
simultWithPurgingTestParams.Clear();
|
||||
@@ -715,10 +717,10 @@ namespace TBF.Rig.Sequences
|
||||
|
||||
if (simultWithPurgingCount == 0)
|
||||
{
|
||||
simultWithPurgingCfg = simultTest.Cfg;
|
||||
simultWithPurgingProcParams = simultWithPurgingCfg.GetRuntimeProcParamsProvider() as Generic.IProcedureParams;
|
||||
simultWithPurging = simultTest;
|
||||
simultWithPurgingProcParams = simultWithPurging.Cfg.GetRuntimeProcParamsProvider() as Generic.IProcedureParams;
|
||||
}
|
||||
else if (simultTest.Cfg != simultWithPurgingCfg)
|
||||
else if (simultTest != simultWithPurging)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -739,7 +741,7 @@ namespace TBF.Rig.Sequences
|
||||
/// Collect steps (e.g. iPerl communication) to be done simultaneously with evacuation
|
||||
///
|
||||
simultWithEvacuationCount = 0;
|
||||
simultWithEvacuationCfg = null;
|
||||
simultWithEvacuation = null;
|
||||
simultWithEvacuationProcParams = null;
|
||||
simultWithEvacuationTests.Clear();
|
||||
simultWithEvacuationTestParams.Clear();
|
||||
@@ -760,10 +762,10 @@ namespace TBF.Rig.Sequences
|
||||
|
||||
if (simultWithEvacuationCount == 0)
|
||||
{
|
||||
simultWithEvacuationCfg = simultTest.Cfg;
|
||||
simultWithEvacuationProcParams = simultWithEvacuationCfg.GetRuntimeProcParamsProvider() as Generic.IProcedureParams;
|
||||
simultWithEvacuation = simultTest;
|
||||
simultWithEvacuationProcParams = simultWithEvacuation.Cfg.GetRuntimeProcParamsProvider() as Generic.IProcedureParams;
|
||||
}
|
||||
else if (simultTest.Cfg != simultWithEvacuationCfg)
|
||||
else if (simultTest != simultWithEvacuation)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -801,12 +803,12 @@ namespace TBF.Rig.Sequences
|
||||
if (firstRR is TBF.Rig.TestMethods.iPerlCommunication.iPerlHead.IperlHead)
|
||||
{
|
||||
Program.MainWnd.Invoke(new CommunicationFormDlgt(OpenIPerlCommForm),
|
||||
new object[] { this, simultWithEvacuationCfg, simultWithEvacuationProcParams, simultWithEvacuationTests, simultWithEvacuationTestParams });
|
||||
new object[] { this, simultWithEvacuation, simultWithEvacuationProcParams, simultWithEvacuationTests, simultWithEvacuationTestParams });
|
||||
}
|
||||
else if (firstRR is TBF.Rig.RegisterReaders.S640Stream.S640Stream)
|
||||
{
|
||||
Program.MainWnd.Invoke(new CommunicationFormDlgt(OpenS640CommForm),
|
||||
new object[] { this, simultWithEvacuationCfg, simultWithEvacuationProcParams, simultWithEvacuationTests, simultWithEvacuationTestParams });
|
||||
new object[] { this, simultWithEvacuation, simultWithEvacuationProcParams, simultWithEvacuationTests, simultWithEvacuationTestParams });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
///
|
||||
/// Copyright (c) 2015-2023 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using log4net;
|
||||
@@ -44,19 +47,19 @@ namespace TBF.Rig.Sequences
|
||||
// public static TBF.UI.ProcedureInfo SelectedProcedure;
|
||||
public static Common.IOrderInfo OrderInfo;
|
||||
// public static SharedDatabase.WorkflowSummary WorkflowSummary; /// Selected production tracing workflow
|
||||
public static IDictionary<string, TimeSpan> SampleRemainingTimeSec = new Dictionary<string, TimeSpan>();
|
||||
|
||||
///
|
||||
/// State variables to be saved after each completed test
|
||||
///
|
||||
public static Results.BatchResults BatchRslts;
|
||||
public static int BatchNr { get { return (BatchRslts != null && BatchRslts.Batch != null) ? BatchRslts.Batch.BatchNr : 0; } }
|
||||
///
|
||||
/// iPERL related state variables to be saved after each completed test
|
||||
public static IList<TestMethods.iPerlCommunication.iPerlHead.IperlHead> IperlHeads;
|
||||
public static bool IsQ2PreCorrectionCalculated;
|
||||
public static int CalculatedQ2PreCorrectionLR;
|
||||
public static int CalculatedQ2PreCorrectionRL;
|
||||
public static IList<Results.Output.SensusTestInfo> RawTestInfos; /// Incomplete raw test infos from Oracle DB
|
||||
public static Results.Output.SensusTestInfo[] CompleteTestInfos; /// Complete TBF test infos obtained as a best mathch
|
||||
|
||||
/// <summary>
|
||||
/// State of water filled in the test bench.
|
||||
@@ -96,21 +99,7 @@ namespace TBF.Rig.Sequences
|
||||
writer.Write(IsQ2PreCorrectionCalculated);
|
||||
writer.Write(CalculatedQ2PreCorrectionLR);
|
||||
writer.Write(CalculatedQ2PreCorrectionRL);
|
||||
#if ORACLE_DB
|
||||
/// Write RawTestInfos
|
||||
writer.Write((RawTestInfos != null) ? RawTestInfos.Count : 0);
|
||||
if (RawTestInfos != null)
|
||||
{
|
||||
for (int i = 0; i < RawTestInfos.Count; i++) RawTestInfos[i].WriteBinary(writer);
|
||||
}
|
||||
|
||||
/// Write CompleteTestInfos
|
||||
writer.Write((CompleteTestInfos != null) ? CompleteTestInfos.Length : 0);
|
||||
if (CompleteTestInfos != null)
|
||||
{
|
||||
for (int i = 0; i < CompleteTestInfos.Length; i++) CompleteTestInfos[i].WriteBinary(writer);
|
||||
}
|
||||
#endif
|
||||
log.WarnFormat("Process data succesfully saved to file {0}", PDataFileName);
|
||||
}
|
||||
}
|
||||
|
||||
+178
-169
@@ -38,13 +38,11 @@ namespace TBF.Rig.Sequences
|
||||
///------------------------------------------------------------
|
||||
/// Global static variables set only once.
|
||||
///------------------------------------------------------------
|
||||
public static IList<IFlowMeter> FlowMeters; /// list of reference flowmeters
|
||||
public static IList<IRegValve> RegulValves; /// list of regulation valves
|
||||
public static IList<IRegValve> FeedingRegulValves; /// list of feeding regulation valves
|
||||
public static IList<IRegValve> OutputRegulValves; /// list of output regulation valves
|
||||
public static IList<IPumpFM> PumpsWithFM; /// list of FM controlled pumps
|
||||
public static IList<IWaterMeter> WaterMeters; /// list of water meters
|
||||
public static IList<ICamera> Cameras; /// list of cameras
|
||||
public static IList<IFlowMeter> FlowMeters; /// list of reference flowmeters
|
||||
public static IList<RegValvePosition> RegVPositions; /// list of regulation valves
|
||||
public static IList<IPumpFM> PumpsWithFM; /// list of FM controlled pumps
|
||||
public static IList<IWaterMeter> WaterMeters; /// list of water meters
|
||||
public static IList<ICamera> Cameras; /// list of cameras
|
||||
|
||||
///------------------------------------------------------------
|
||||
/// Procedure related (static) variables.
|
||||
@@ -494,27 +492,28 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
|
||||
|
||||
/// return SetRegValvePositionOp operations for RV-s with changed positions
|
||||
IList<IOperation> GetRegValvePositioningOps(IList<IRegValve> regValves, float[] regValvePositions)
|
||||
/// <summary>
|
||||
/// Returns a list of reg.valve positioning operations
|
||||
/// </summary>
|
||||
/// <param name="regVPositions">List of reg.valve/position pairs, position is in %, position LT 0 ... no operation</param>
|
||||
/// <returns>List of reg.valve positioning operations</returns>
|
||||
List<IOperation> GetRegVPositioningOps(IList<RegValvePosition> regVPositions)
|
||||
{
|
||||
IList<IOperation> rvPosOps = new List<IOperation>();
|
||||
List<IOperation> rvPosOps = new List<IOperation>();
|
||||
|
||||
if (regValves != null && regValvePositions != null)
|
||||
if (regVPositions == null) return rvPosOps;
|
||||
|
||||
foreach (var rvp in regVPositions)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(regValves.Count, regValvePositions.Length); i++)
|
||||
if (rvp.Position >= 0) /// Negative value means no position change
|
||||
{
|
||||
if (regValvePositions[i] >= 0) /// Negative value means no position change
|
||||
if (rvp.RegValve.IsCoax)
|
||||
{
|
||||
if (RegulValves[i].IsCoax)
|
||||
{
|
||||
rvPosOps.Add(regValves[i].SetRegulValvePositionOp(regValvePositions[i], regValvePositions[i], 60));
|
||||
}
|
||||
else
|
||||
{
|
||||
float lo = Math.Max(0, regValvePositions[i] - 3.0f);
|
||||
float hi = Math.Min(100.0f, regValvePositions[i] + 3.0f);
|
||||
rvPosOps.Add(regValves[i].SetRegulValvePositionOp(lo, hi, 60));
|
||||
}
|
||||
rvPosOps.Add(rvp.RegValve.SetRegulValvePositionOp(rvp.Position, -1, 60));
|
||||
}
|
||||
else
|
||||
{
|
||||
rvPosOps.Add(rvp.RegValve.SetRegulValvePositionOp(rvp.Position - 3.0f, rvp.Position + 3.0f, 60));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -608,7 +607,7 @@ namespace TBF.Rig.Sequences
|
||||
string activity = string.Format(message, transitionSequence.Name, step.ItemNr + 1, stepsCount);
|
||||
Bridge.OnActivity(this, activity);
|
||||
Bridge.OnMessage(this, step.Message);
|
||||
log.Info(activity + " " +step.Message);
|
||||
log.InfoFormat("{0} {1}", activity, step.Message);
|
||||
//------------------------------------------------
|
||||
|
||||
/// Prepare operation to switch valves
|
||||
@@ -646,8 +645,9 @@ namespace TBF.Rig.Sequences
|
||||
}
|
||||
}
|
||||
|
||||
/// Get regulation valve positioning operations
|
||||
IList<IOperation> rvPosOps = GetRegValvePositioningOps(RegulValves, Utils.GetRegulValvesPositions(step.RegulValvesPct, RegulValves.Count));
|
||||
|
||||
Utils.UpdateRegVPositionsFromStr(ref RegVPositions, step.RegulValvesPct);
|
||||
IList<IOperation> rvPosOps = GetRegVPositioningOps(RegVPositions);
|
||||
|
||||
/// Max. one SetRegulValvePositionOp can be started or stopped in one sub-step.
|
||||
/// Therefore SetRegulValvePositionOp operations are added and removed to subsequent states one by one.
|
||||
@@ -780,9 +780,11 @@ namespace TBF.Rig.Sequences
|
||||
///
|
||||
/// Always set route at the beginning of this test
|
||||
///
|
||||
List<IOperation> regVPosOps = GetRegVPositioningOps(inPath.RegVPositions);
|
||||
regVPosOps.AddRange(GetRegVPositioningOps(outPath.RegVPositions));
|
||||
Event evnt = PerformSteps(GenericDevices.ValveBase.Merge(inPath.ValvesOpen, benchPath.ValvesOpen, outPath.ValvesOpen),
|
||||
GenericDevices.ValveBase.Merge(inPath.ValvesClose, benchPath.ValvesClose, outPath.ValvesClose),
|
||||
GetRegValvePositioningOps(OutputRegulValves, outPath.RegulValvesPct),
|
||||
regVPosOps,
|
||||
"SequenceBase : Transition : TestStart - Default action");
|
||||
|
||||
if (evnt == Event.Error || evnt == Event.UiCmdStop) return evnt;
|
||||
@@ -794,11 +796,15 @@ namespace TBF.Rig.Sequences
|
||||
///
|
||||
/// Set route for the next test
|
||||
///
|
||||
List<IOperation> regVPosOps = GetRegVPositioningOps(nextInPath.RegVPositions);
|
||||
regVPosOps.AddRange(GetRegVPositioningOps(nextOutPath.RegVPositions));
|
||||
Event evnt = PerformSteps(GenericDevices.ValveBase.Merge(nextInPath.ValvesOpen, nextBenchPath.ValvesOpen, nextOutPath.ValvesOpen),
|
||||
GenericDevices.ValveBase.Merge(nextInPath.ValvesClose, nextBenchPath.ValvesClose, nextOutPath.ValvesClose),
|
||||
GetRegValvePositioningOps(OutputRegulValves, outPath.RegulValvesPct),
|
||||
regVPosOps,
|
||||
"SequenceBase : AfterTestWithOverlap : Default action");
|
||||
|
||||
if (evnt == Event.Error || evnt == Event.UiCmdStop) return evnt;
|
||||
|
||||
/// Set PID coefficient, etc.
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
StateMachine.ControlBoard.SetFiltersPidShortPulses(filters, nextPidCoef, (nextTolerRed == 0) ? 0 : 1);
|
||||
@@ -1533,7 +1539,7 @@ namespace TBF.Rig.Sequences
|
||||
/// <returns>Test result</returns>
|
||||
public void MakeSimulatedTrivial(Config.Entities.Test test, int repetitionNr, int part)
|
||||
{
|
||||
string fullTestName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
string fullTestName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
|
||||
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(fullTestName, part);
|
||||
Results.Utils.GetCounterStates(tstRslt, Program.LocalSettings.Counters);
|
||||
@@ -1580,20 +1586,22 @@ namespace TBF.Rig.Sequences
|
||||
tstRslt.EndTime = DateTime.Now + new TimeSpan(0, 0, 1);
|
||||
tstRslt.FlowSetTime = 10;
|
||||
tstRslt.TestTime = tstRslt.TargetTime();
|
||||
tstRslt.PulsesMaster = (outPath.FlowMeter.LtrPerPulse > 1E-6) ? (1.0075 * tstRslt.TargetVolume() / outPath.FlowMeter.LtrPerPulse) : 1;
|
||||
tstRslt.MassStartRaw = 0;
|
||||
tstRslt.MassStart = Config.Entities.MeasurementCorrection.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections);
|
||||
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Config.Formulas.RealDensity() / 1000.0f;
|
||||
tstRslt.MassEnd = Config.Entities.MeasurementCorrection.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections);
|
||||
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime;
|
||||
tstRslt.FlowVolume = 3.6 * outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster / tstRslt.TestTime;
|
||||
tstRslt.MassOfEvapWater = 0;
|
||||
tstRslt.VolumeCTV = 1000 * tstRslt.Batch.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine; /// [l] commercially true volume
|
||||
tstRslt.VolumeMaster = outPath.FlowMeter.LtrPerPulse * 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, 0); /// Corrected master pulses per liter
|
||||
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (outPath.FlowMeter.LtrPerPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
|
||||
|
||||
if (outPath != null)
|
||||
{
|
||||
tstRslt.PulsesMaster = (outPath.FlowMeter.LtrPerPulse > 1E-6) ? (1.0075 * tstRslt.TargetVolume() / outPath.FlowMeter.LtrPerPulse) : 1;
|
||||
tstRslt.MassStartRaw = 0;
|
||||
tstRslt.MassStart = Config.Entities.MeasurementCorrection.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections);
|
||||
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Config.Formulas.RealDensity() / 1000.0f;
|
||||
tstRslt.MassEnd = Config.Entities.MeasurementCorrection.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections);
|
||||
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime;
|
||||
tstRslt.FlowVolume = 3.6 * outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster / tstRslt.TestTime;
|
||||
tstRslt.MassOfEvapWater = 0;
|
||||
tstRslt.VolumeCTV = 1000 * tstRslt.Batch.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine; /// [l] commercially true volume
|
||||
tstRslt.VolumeMaster = outPath.FlowMeter.LtrPerPulse * 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, 0); /// Corrected master pulses per liter
|
||||
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (outPath.FlowMeter.LtrPerPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
|
||||
}
|
||||
tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
|
||||
|
||||
tstRslt.FlowMean = (float)RefFlowStat.Average;
|
||||
@@ -1633,11 +1641,11 @@ namespace TBF.Rig.Sequences
|
||||
.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));
|
||||
(inPath != null && inPath.Pump != null) ? inPath.Pump.Name : string.Empty,
|
||||
(outPath != null && outPath.FlowMeter != null) ? outPath.FlowMeter.Name : string.Empty,
|
||||
(outPath != null && outPath.Scale != null) ? outPath.Scale.Name : string.Empty,
|
||||
(outPath != null && outPath.RegulValve != null) ? outPath.RegulValve.Name : string.Empty,
|
||||
(outPath != null && outPath.Diverter != null) ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
|
||||
|
||||
@@ -1648,7 +1656,7 @@ namespace TBF.Rig.Sequences
|
||||
/// <returns>Test result</returns>
|
||||
public void MakeSimulated(Config.Entities.Test test, int repetitionNr, int part, float errorPctBase)
|
||||
{
|
||||
string fullTestName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
string fullTestName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
|
||||
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(fullTestName, part);
|
||||
Results.Utils.GetCounterStates(tstRslt, Program.LocalSettings.Counters);
|
||||
@@ -1747,13 +1755,13 @@ namespace TBF.Rig.Sequences
|
||||
|
||||
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));
|
||||
new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
(inPath != null && inPath.Pump != null) ? inPath.Pump.Name : string.Empty,
|
||||
(outPath != null && outPath.FlowMeter != null) ? outPath.FlowMeter.Name : string.Empty,
|
||||
(outPath != null && outPath.Scale != null) ? outPath.Scale.Name : string.Empty,
|
||||
(outPath != null && outPath.RegulValve != null) ? outPath.RegulValve.Name : string.Empty,
|
||||
(outPath != null && outPath.Diverter != null) ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
|
||||
|
||||
@@ -1764,129 +1772,128 @@ namespace TBF.Rig.Sequences
|
||||
/// <returns>Test result</returns>
|
||||
protected void MakeSimulatedCompound(Config.Entities.Test test, int repetitionNr, int part, float errorPct, float mainPart)
|
||||
{
|
||||
string fullTestName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
string fullTestName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
|
||||
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(fullTestName, part);
|
||||
|
||||
if (tstRslt != null)
|
||||
{
|
||||
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
|
||||
tstRslt.StartTime = DateTime.Now;
|
||||
tstRslt.EndTime = DateTime.Now + new TimeSpan(0, 0, 1);
|
||||
tstRslt.FlowSetTime = 10;
|
||||
tstRslt.TestTime = tstRslt.TargetTime();
|
||||
/// TODO: Verify whether 'ltrPerRefPulse' is up to date
|
||||
tstRslt.PulsesMaster = (LtrPerRefPulse > 1E-6) ? (tstRslt.TargetVolume() / LtrPerRefPulse) : 1;
|
||||
tstRslt.ConstMasterRaw = LtrPerRefPulse;
|
||||
tstRslt.ConstMaster = LtrPerRefPulse;
|
||||
tstRslt.MassStartRaw = 0;
|
||||
tstRslt.MassStart = 0;
|
||||
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Config.Formulas.RealDensity() / 1000.0f;
|
||||
tstRslt.MassEnd = tstRslt.MassEndRaw;
|
||||
tstRslt.DensityIn = tstRslt.Batch.RealDensity;
|
||||
tstRslt.DensityLine = tstRslt.Batch.RealDensity;
|
||||
tstRslt.DensityDiv = tstRslt.Batch.RealDensity;
|
||||
tstRslt.MassOfEvapWater = 0;
|
||||
tstRslt.FlowMass = tstRslt.MassEnd / tstRslt.TargetTime();
|
||||
tstRslt.FlowVolume = tstRslt.TargetVolume() / tstRslt.TargetTime();
|
||||
tstRslt.VolumeCTV = tstRslt.TargetVolume();
|
||||
tstRslt.VolumeMaster = tstRslt.TargetVolume();
|
||||
tstRslt.ErrorMaster = 0;
|
||||
if (tstRslt == null) return; /// Prevent program crash in certain cases
|
||||
|
||||
tstRslt.AmbTempMean = 20.0f;
|
||||
tstRslt.AmbPressMean = 1.0f;
|
||||
tstRslt.AmbHumiMean = 50.0f;
|
||||
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
|
||||
tstRslt.StartTime = DateTime.Now;
|
||||
tstRslt.EndTime = DateTime.Now + new TimeSpan(0, 0, 1);
|
||||
tstRslt.FlowSetTime = 10;
|
||||
tstRslt.TestTime = tstRslt.TargetTime();
|
||||
/// TODO: Verify whether 'ltrPerRefPulse' is up to date
|
||||
tstRslt.PulsesMaster = (LtrPerRefPulse > 1E-6) ? (tstRslt.TargetVolume() / LtrPerRefPulse) : 1;
|
||||
tstRslt.ConstMasterRaw = LtrPerRefPulse;
|
||||
tstRslt.ConstMaster = LtrPerRefPulse;
|
||||
tstRslt.MassStartRaw = 0;
|
||||
tstRslt.MassStart = 0;
|
||||
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Config.Formulas.RealDensity() / 1000.0f;
|
||||
tstRslt.MassEnd = tstRslt.MassEndRaw;
|
||||
tstRslt.DensityIn = tstRslt.Batch.RealDensity;
|
||||
tstRslt.DensityLine = tstRslt.Batch.RealDensity;
|
||||
tstRslt.DensityDiv = tstRslt.Batch.RealDensity;
|
||||
tstRslt.MassOfEvapWater = 0;
|
||||
tstRslt.FlowMass = tstRslt.MassEnd / tstRslt.TargetTime();
|
||||
tstRslt.FlowVolume = tstRslt.TargetVolume() / tstRslt.TargetTime();
|
||||
tstRslt.VolumeCTV = tstRslt.TargetVolume();
|
||||
tstRslt.VolumeMaster = tstRslt.TargetVolume();
|
||||
tstRslt.ErrorMaster = 0;
|
||||
|
||||
tstRslt.PressUpStart = 1.0f;
|
||||
tstRslt.PressDownStart = 1.0f;
|
||||
tstRslt.TempUpStart = 20.0f;
|
||||
tstRslt.TempDownStart = 20.0f;
|
||||
tstRslt.TempDivStart = 20.0f;
|
||||
tstRslt.PressUpEnd = 1.0f;
|
||||
tstRslt.PressDownEnd = 1.0f;
|
||||
tstRslt.TempUpEnd = 20.0f;
|
||||
tstRslt.TempDownEnd = 20.0f;
|
||||
tstRslt.TempDivEnd = 20.0f;
|
||||
tstRslt.PressUpMean = 1.0f;
|
||||
tstRslt.PressDownMean = 1.0f;
|
||||
tstRslt.TempUpMean = 20.0f;
|
||||
tstRslt.TempDownMean = 20.0f;
|
||||
tstRslt.TempDivMean = 20.0f;
|
||||
tstRslt.PressUpMin = 1.0f;
|
||||
tstRslt.PressDownMin = 1.0f;
|
||||
tstRslt.TempUpMin = 20.0f;
|
||||
tstRslt.TempDownMin = 20.0f;
|
||||
tstRslt.TempDivMin = 20.0f;
|
||||
tstRslt.PressUpMax = 1.0f;
|
||||
tstRslt.PressDownMax = 1.0f;
|
||||
tstRslt.TempUpMax = 20.0f;
|
||||
tstRslt.TempDownMax = 20.0f;
|
||||
tstRslt.TempDivMax = 20.0f;
|
||||
tstRslt.ConductMin = Conductivity.Val;
|
||||
tstRslt.ConductMax = Conductivity.Val;
|
||||
tstRslt.AmbTempMean = 20.0f;
|
||||
tstRslt.AmbPressMean = 1.0f;
|
||||
tstRslt.AmbHumiMean = 50.0f;
|
||||
|
||||
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.PressUpStart = 1.0f;
|
||||
tstRslt.PressDownStart = 1.0f;
|
||||
tstRslt.TempUpStart = 20.0f;
|
||||
tstRslt.TempDownStart = 20.0f;
|
||||
tstRslt.TempDivStart = 20.0f;
|
||||
tstRslt.PressUpEnd = 1.0f;
|
||||
tstRslt.PressDownEnd = 1.0f;
|
||||
tstRslt.TempUpEnd = 20.0f;
|
||||
tstRslt.TempDownEnd = 20.0f;
|
||||
tstRslt.TempDivEnd = 20.0f;
|
||||
tstRslt.PressUpMean = 1.0f;
|
||||
tstRslt.PressDownMean = 1.0f;
|
||||
tstRslt.TempUpMean = 20.0f;
|
||||
tstRslt.TempDownMean = 20.0f;
|
||||
tstRslt.TempDivMean = 20.0f;
|
||||
tstRslt.PressUpMin = 1.0f;
|
||||
tstRslt.PressDownMin = 1.0f;
|
||||
tstRslt.TempUpMin = 20.0f;
|
||||
tstRslt.TempDownMin = 20.0f;
|
||||
tstRslt.TempDivMin = 20.0f;
|
||||
tstRslt.PressUpMax = 1.0f;
|
||||
tstRslt.PressDownMax = 1.0f;
|
||||
tstRslt.TempUpMax = 20.0f;
|
||||
tstRslt.TempDownMax = 20.0f;
|
||||
tstRslt.TempDivMax = 20.0f;
|
||||
tstRslt.ConductMin = Conductivity.Val;
|
||||
tstRslt.ConductMax = Conductivity.Val;
|
||||
|
||||
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
Results.Entities.MeterTestRslt compoundRslt = ProcessData.BatchRslts.GetMeterTestRslt(fullTestName, i, CompoundMeterId.Compound);
|
||||
Results.Entities.MeterTestRslt mainRslt = ProcessData.BatchRslts.GetMeterTestRslt(fullTestName, i, CompoundMeterId.CompoundMain);
|
||||
Results.Entities.MeterTestRslt auxRslt = ProcessData.BatchRslts.GetMeterTestRslt(fullTestName, i, CompoundMeterId.CompoundAux);
|
||||
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;
|
||||
|
||||
double compoundVolume = tstRslt.TargetVolume() * (1.0 + 0.01 * errorPct);
|
||||
double mainVolume = compoundVolume * mainPart;
|
||||
double auxVolume = compoundVolume * (1.0 - mainPart);
|
||||
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
Results.Entities.MeterTestRslt compoundRslt = ProcessData.BatchRslts.GetMeterTestRslt(fullTestName, i, CompoundMeterId.Compound);
|
||||
Results.Entities.MeterTestRslt mainRslt = ProcessData.BatchRslts.GetMeterTestRslt(fullTestName, i, CompoundMeterId.CompoundMain);
|
||||
Results.Entities.MeterTestRslt auxRslt = ProcessData.BatchRslts.GetMeterTestRslt(fullTestName, i, CompoundMeterId.CompoundAux);
|
||||
|
||||
for (int isAux = 0; isAux <= 1; isAux++) /// 0=main, 1=aux
|
||||
{
|
||||
GenericDevices.IRegReader regReader = sensPath.RegisterReaders[2 * i + isAux];
|
||||
Results.Entities.MeterTestRslt meterRslt = (isAux == 0) ? mainRslt : auxRslt;
|
||||
double compoundVolume = tstRslt.TargetVolume() * (1.0 + 0.01 * errorPct);
|
||||
double mainVolume = compoundVolume * mainPart;
|
||||
double auxVolume = compoundVolume * (1.0 - mainPart);
|
||||
|
||||
if (meterRslt != null && regReader != null)
|
||||
{
|
||||
meterRslt.VolumeMeter = (isAux == 0) ? mainVolume : auxVolume;
|
||||
for (int isAux = 0; isAux <= 1; isAux++) /// 0=main, 1=aux
|
||||
{
|
||||
GenericDevices.IRegReader regReader = sensPath.RegisterReaders[2 * i + isAux];
|
||||
Results.Entities.MeterTestRslt meterRslt = (isAux == 0) ? mainRslt : auxRslt;
|
||||
|
||||
meterRslt.PulsesMeter = regReader.PulsesPerLtr * meterRslt.VolumeMeter;
|
||||
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
|
||||
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
|
||||
meterRslt.VolumeStart = 0;
|
||||
meterRslt.VolumeEnd = meterRslt.VolumeMeter;
|
||||
meterRslt.VolumeRef = tstRslt.TargetVolume();
|
||||
meterRslt.TimestampStart = 0;
|
||||
meterRslt.TimestampEnd = tstRslt.TargetTime();
|
||||
meterRslt.TestTime = tstRslt.TargetTime();
|
||||
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV);
|
||||
meterRslt.Passed = (errorPct >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin())
|
||||
&& (errorPct <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin());
|
||||
meterRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
if (meterRslt != null && regReader != null)
|
||||
{
|
||||
meterRslt.VolumeMeter = (isAux == 0) ? mainVolume : auxVolume;
|
||||
|
||||
compoundRslt.VolumeRef = tstRslt.VolumeCTV; /// [l] must be calculated before main & aux. meter error
|
||||
compoundRslt.VolumeMeter = mainRslt.VolumeMeter + auxRslt.VolumeMeter;
|
||||
meterRslt.PulsesMeter = regReader.PulsesPerLtr * meterRslt.VolumeMeter;
|
||||
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
|
||||
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
|
||||
meterRslt.VolumeStart = 0;
|
||||
meterRslt.VolumeEnd = meterRslt.VolumeMeter;
|
||||
meterRslt.VolumeRef = tstRslt.TargetVolume();
|
||||
meterRslt.TimestampStart = 0;
|
||||
meterRslt.TimestampEnd = tstRslt.TargetTime();
|
||||
meterRslt.TestTime = tstRslt.TargetTime();
|
||||
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV);
|
||||
meterRslt.Passed = (errorPct >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin())
|
||||
&& (errorPct <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin());
|
||||
meterRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
compoundRslt.PulsesMaster = tstRslt.PulsesMaster;
|
||||
compoundRslt.TestTime = tstRslt.TargetTime();
|
||||
compoundRslt.Error = Formulas.ErrorFromVolumes(compoundRslt.VolumeMeter, tstRslt.VolumeCTV);
|
||||
compoundRslt.Passed = (compoundRslt.Error >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin())
|
||||
&& (compoundRslt.Error <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin());
|
||||
compoundRslt.TestDone = true;
|
||||
tstRslt.TestDone = true;
|
||||
}
|
||||
compoundRslt.VolumeRef = tstRslt.VolumeCTV; /// [l] must be calculated before main & aux. meter error
|
||||
compoundRslt.VolumeMeter = mainRslt.VolumeMeter + auxRslt.VolumeMeter;
|
||||
|
||||
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));
|
||||
compoundRslt.PulsesMaster = tstRslt.PulsesMaster;
|
||||
compoundRslt.TestTime = tstRslt.TargetTime();
|
||||
compoundRslt.Error = Formulas.ErrorFromVolumes(compoundRslt.VolumeMeter, tstRslt.VolumeCTV);
|
||||
compoundRslt.Passed = (compoundRslt.Error >= tstRslt.ErrLimLo() + tstRslt.ErrLimMargin())
|
||||
&& (compoundRslt.Error <= tstRslt.ErrLimHi() - tstRslt.ErrLimMargin());
|
||||
compoundRslt.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 != null && inPath.Pump != null) ? inPath.Pump.Name : string.Empty,
|
||||
(outPath != null && outPath.FlowMeter != null) ? outPath.FlowMeter.Name : string.Empty,
|
||||
(outPath != null && outPath.Scale != null) ? outPath.Scale.Name : string.Empty,
|
||||
(outPath != null && outPath.RegulValve != null) ? outPath.RegulValve.Name : string.Empty,
|
||||
(outPath != null && outPath.Diverter != null) ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
|
||||
|
||||
@@ -1901,6 +1908,8 @@ namespace TBF.Rig.Sequences
|
||||
|
||||
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(fullTestName, part);
|
||||
|
||||
if (tstRslt == null) return; /// Prevent program crash in certain cases
|
||||
|
||||
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
|
||||
tstRslt.StartTime = DateTime.Now;
|
||||
tstRslt.EndTime = DateTime.Now + new TimeSpan(0, 0, 1);
|
||||
@@ -2015,11 +2024,11 @@ namespace TBF.Rig.Sequences
|
||||
.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));
|
||||
(inPath != null && inPath.Pump != null) ? inPath.Pump.Name : string.Empty,
|
||||
(outPath != null && outPath.FlowMeter != null) ? outPath.FlowMeter.Name : string.Empty,
|
||||
(outPath != null && outPath.Scale != null) ? outPath.Scale.Name : string.Empty,
|
||||
(outPath != null && outPath.RegulValve != null) ? outPath.RegulValve.Name : string.Empty,
|
||||
(outPath != null && outPath.Diverter != null) ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
|
||||
protected bool TestAndLogUiCmdStop(IList<Event> e)
|
||||
|
||||
+24
-16
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Text;
|
||||
@@ -225,9 +225,7 @@ namespace TBF.Rig
|
||||
IList<IScaleOrTank> tanks = new List<IScaleOrTank>();
|
||||
ProcessData.IperlHeads = new List<TestMethods.iPerlCommunication.iPerlHead.IperlHead>();
|
||||
SequenceBase.FlowMeters = new List<IFlowMeter>();
|
||||
SequenceBase.RegulValves = new List<IRegValve>();
|
||||
SequenceBase.FeedingRegulValves = new List<IRegValve>();
|
||||
SequenceBase.OutputRegulValves = new List<IRegValve>();
|
||||
SequenceBase.RegVPositions = new List<RegValvePosition>();
|
||||
SequenceBase.PumpsWithFM = new List<IPumpFM>();
|
||||
SequenceBase.WaterMeters = new List<IWaterMeter>();
|
||||
SequenceBase.Cameras = new List<ICamera>();
|
||||
@@ -237,8 +235,17 @@ namespace TBF.Rig
|
||||
foreach (var cmpnt in components)
|
||||
{
|
||||
if (cmpnt is Elde.ControlBoardDev) ControlBoard = cmpnt as Elde.ControlBoardDev;
|
||||
if (cmpnt is IBenchInfo) ProcessData.BenchInfo = cmpnt as IBenchInfo;
|
||||
if (cmpnt is IErrorFlags) ProcessData.ErrorFlagsComp = cmpnt as IErrorFlags;
|
||||
|
||||
if (cmpnt is IBenchInfo)
|
||||
{
|
||||
ProcessData.BenchInfo = cmpnt as IBenchInfo;
|
||||
if (cmpnt is TBF.Rig.DataContainers.BenchInfo.iPerl.Component)
|
||||
{
|
||||
Results.Utils.MaxTestIndex = (cmpnt as TBF.Rig.DataContainers.BenchInfo.iPerl.Component).MaxTestIndex;
|
||||
}
|
||||
}
|
||||
|
||||
if (cmpnt is IErrorFlags) ProcessData.ErrorFlagsComp = cmpnt as IErrorFlags;
|
||||
if (cmpnt is IStatisticsMonitoring) ProcessData.StatisticsMonitoringComp = cmpnt as IStatisticsMonitoring;
|
||||
|
||||
if ((cmpnt is Output.DB.SensusOracle.Database) && (ProcessData.OracleDB == null))
|
||||
@@ -259,10 +266,7 @@ namespace TBF.Rig
|
||||
if (cmpnt is IFlowMeter) SequenceBase.FlowMeters.Add(cmpnt as IFlowMeter);
|
||||
if ((cmpnt is IRegValve) && !(cmpnt is Rig.Elde.RegulValveTandem.RegulValveTandem))
|
||||
{
|
||||
IRegValve rv = cmpnt as IRegValve;
|
||||
SequenceBase.RegulValves.Add(rv);
|
||||
if (rv.Category == ValveCategory.Feeding) SequenceBase.FeedingRegulValves.Add(rv);
|
||||
if (rv.Category == ValveCategory.Output) SequenceBase.OutputRegulValves.Add(rv);
|
||||
SequenceBase.RegVPositions.Add(new RegValvePosition(cmpnt as IRegValve));
|
||||
}
|
||||
if (cmpnt is IPumpFM && !(cmpnt is Elde.PumpTandem.Pump))
|
||||
{
|
||||
@@ -438,9 +442,12 @@ namespace TBF.Rig
|
||||
remoteMetersPaths = remoteSession.QueryOver<Config.Entities.MetersPath>().List();
|
||||
remoteTransitions = remoteSession.QueryOver<Config.Entities.TransitionSequence>().List();
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception exc)
|
||||
{
|
||||
message = "Cannot open remote database";
|
||||
|
||||
message = (exc.InnerException != null)
|
||||
? string.Format("\r\nException:\r\n{0}\r\nInner exception:\r\n{1}", exc.Message, exc.InnerException.Message)
|
||||
: string.Format("\r\nException:\r\n{0}", exc.Message);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -658,11 +665,12 @@ namespace TBF.Rig
|
||||
|
||||
pmtrs = GetMetersPath(test);
|
||||
|
||||
if (isHydroTest && (pfeed == null)) errorMsg = Strings.Cannot_load_feeding_path;
|
||||
else if (isHydroTest && (pben == null)) errorMsg = Strings.Cannot_load_bench_path;
|
||||
else if (isHydroTest && (pout == null)) errorMsg = Strings.Cannot_load_output_path;
|
||||
else if (pmtrs == null) errorMsg = Strings.Cannot_load_sensor_path;
|
||||
if (isHydroTest && (pfeed == null)) errorMsg = string.Format(Strings.Test_0_config_error_1_is_missing, test.Name, Strings.Feeding_chdr);
|
||||
else if (isHydroTest && (pben == null)) errorMsg = string.Format(Strings.Test_0_config_error_1_is_missing, test.Name, Strings.Bench_chdr);
|
||||
else if (isHydroTest && (pout == null)) errorMsg = string.Format(Strings.Test_0_config_error_1_is_missing, test.Name, Strings.Output_chdr);
|
||||
else if (pmtrs == null) errorMsg = string.Format(Strings.Test_0_config_error_1_is_missing, test.Name, Strings.Sensors_chdr);
|
||||
else errorMsg = string.Empty;
|
||||
|
||||
if ((isHydroTest && (pfeed == null || pben == null || pout == null)) || (pmtrs == null))
|
||||
{
|
||||
log.ErrorFormat("GetPaths({0},...) returns false, wrong configuration", test.Name);
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace TBF.Rig
|
||||
Factories.Add(new TestMethods.LeakTest.Factory());
|
||||
Factories.Add(new TestMethods.LiveStream.Factory());
|
||||
Factories.Add(new TestMethods.ManualEntry.Factory());
|
||||
Factories.Add(new TestMethods.Message.Factory());
|
||||
Factories.Add(new TestMethods.OuterLoop.Start.Factory());
|
||||
Factories.Add(new TestMethods.OuterLoop.End.Factory());
|
||||
Factories.Add(new TestMethods.PMaxTest.Factory());
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace TBF.Rig.TestMethods.Adjustment
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
string testName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
|
||||
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
|
||||
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace TBF.Rig.TestMethods.ChangeFlowDirection
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, 0));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
string testName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
string testName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.FlowSetting));
|
||||
|
||||
@@ -880,7 +880,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.Completed));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, BatchRslts.GetTestRslt(Results.Utils.GetTestName(test.Name, 1, 1), 0)));
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, BatchRslts.GetTestRslt(Common.Utils.GetTestName(test.Name, 1, 1), 0)));
|
||||
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
|
||||
|
||||
//------------------------------------------------
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace TBF.Rig.TestMethods.Counter
|
||||
TBF.UiBridge.Bridge.OnSaveSettings(this, null);
|
||||
|
||||
/// Update results
|
||||
var testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
var testName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
var testResults = BatchRslts.GetTestRslt(testName, test.Part);
|
||||
global::Results.Utils.GetCounterStates(testResults, Program.LocalSettings.Counters);
|
||||
if (testResults != null)
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace TBF.Rig.TestMethods.DiverterTest
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, null, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
string testName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace TBF.Rig.TestMethods.Dummy
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, 0));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
string testName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
///
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace TBF.Rig.TestMethods.Endurance
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
string testName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace TBF.Rig.TestMethods.Evacuation
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
string testName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
|
||||
|
||||
if (tstRslt != null)
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace TBF.Rig.TestMethods.FixedStart
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
string testName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
|
||||
///
|
||||
/// Optionally display prompt to emerge temperature meters to appropriate baths for heat meters test
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace TBF.Rig.TestMethods.FixedStartAdvanced
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
string testName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace TBF.Rig.TestMethods.FixedStartDeferredEval
|
||||
intermediateData = new IntermediateData
|
||||
{
|
||||
Compound = compound,
|
||||
TestName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr),
|
||||
TestName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr),
|
||||
TestPart = test.Part,
|
||||
};
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace TBF.Rig.TestMethods.FixedStartDeferredEval
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
string testName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
|
||||
///
|
||||
/// Optionally display prompt to emerge temperature meters to appropriate baths for heat meters test
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollDeferredEval
|
||||
intermediateData = new IntermediateData
|
||||
{
|
||||
Compound = compound,
|
||||
TestName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr),
|
||||
TestName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr),
|
||||
TestPart = test.Part,
|
||||
};
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollDeferredEval
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
string testName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
|
||||
///
|
||||
/// Optionally display prompt to emerge temperature meters to appropriate baths for heat meters test
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user