Compare commits
33
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e8d2975f0 | ||
|
|
1fb76a2167 | ||
|
|
34f8bb226f | ||
|
|
bc3fb0f8a0 | ||
|
|
9416b79b38 | ||
|
|
20171e99a6 | ||
|
|
822ef33da8 | ||
|
|
3bfb34a6ea | ||
|
|
c28828fcdd | ||
|
|
889a370f90 | ||
|
|
a369127850 | ||
|
|
82a3574222 | ||
|
|
f3fc3d3ba4 | ||
|
|
a5a139aff6 | ||
|
|
09da203962 | ||
|
|
77ad6a529d | ||
|
|
54658bdd38 | ||
|
|
809897342a | ||
|
|
70767de3fc | ||
|
|
d62c1ff106 | ||
|
|
bf583e3061 | ||
|
|
270a46982d | ||
|
|
659315c519 | ||
|
|
04db3f975e | ||
|
|
c0e18458aa | ||
|
|
d09316a34a | ||
|
|
8c0ebcb871 | ||
|
|
fcdf1ea16b | ||
|
|
d6261e4d80 | ||
|
|
9f5c4e7347 | ||
|
|
90e58266a9 | ||
|
|
5b5f0ac41e | ||
|
|
ddca028eb2 |
@@ -24,6 +24,8 @@ GraphLib/bin
|
||||
GraphLib/obj
|
||||
TracingDB/bin
|
||||
TracingDB/obj
|
||||
ResetBatchNr/bin
|
||||
ResetBatchNr/obj
|
||||
RestClient/bin
|
||||
RestClient/obj
|
||||
Results/bin/
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Config
|
||||
/// <summary>
|
||||
/// Test bench database settings, contains bench name and settings od several databases
|
||||
/// </summary>
|
||||
public class DatabaseSettings : ICloneable
|
||||
public class DatabaseSettings : ICloneable, IComparable
|
||||
{
|
||||
// Public fields
|
||||
public string BenchName;
|
||||
@@ -45,6 +45,12 @@ namespace Config
|
||||
return result;
|
||||
}
|
||||
|
||||
public int CompareTo(object dbs2)
|
||||
{
|
||||
if (!(dbs2 is DatabaseSettings)) return 0;
|
||||
return String.Compare(BenchName, (dbs2 as DatabaseSettings).BenchName);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} config={1} results={2} events={3} users={4}",
|
||||
|
||||
@@ -118,15 +118,15 @@
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>NiO</value>
|
||||
<value>Nicht OK</value>
|
||||
</data>
|
||||
<data name="Passed" xml:space="preserve">
|
||||
<value>iO</value>
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name="Error" xml:space="preserve">
|
||||
<value>Fehler</value>
|
||||
</data>
|
||||
<data name="Cannot_open_DB_Cause_0" xml:space="preserve">
|
||||
<value>Datenbank kann nicht geöffnet.\\r\\nUrsache:\\r\\n{0}</value>
|
||||
<value>Datenbank kann nicht geöffnet werden.\\r\\nUrsache:\\r\\n{0}</value>
|
||||
</data>
|
||||
</root>
|
||||
+158
-126
@@ -17,14 +17,21 @@ namespace Config
|
||||
#else
|
||||
[Description("degree")] degree,
|
||||
#endif
|
||||
[Description("ml")] ml, /// 1 ml = 0.001 l
|
||||
[Description("l")] l, /// * 1 liter
|
||||
[Description("dm3")] dm3, /// 1 dm3 = 1 liter
|
||||
[Description("m3")] m3, /// 1000 l
|
||||
[Description("gal(UK)")] gal_UK, /// 1 gal(UK) = 4.54609 l
|
||||
[Description("gal(US)")] gal_US, /// 1 gal(US) = 3.78541178 l
|
||||
[Description("dm3")] dm3, /// 1 dm3 = 1 l
|
||||
[Description("US gal")] USgal, /// 1 US gallon = 3.78541178 l
|
||||
[Description("imper.gal")] UKgal, /// 1 imperial gallon = 4.54609 l
|
||||
[Description("cf")] cf, /// 1 cubic foot = 28.316846592 l
|
||||
[Description("m3")] m3, /// 1 m3 = 1000 l
|
||||
|
||||
[Description("l/h")] lph, /// 1 liter/h
|
||||
[Description("m3/h")] m3ph, /// * 1 m3/h = 1000 l/h
|
||||
[Description("l/h")] lph, /// 1 l/h = 0.001 m3/h
|
||||
[Description("l/m")] lpm, /// 1 l/m = 60 l/h = 0.06 m3/h
|
||||
[Description("m3/h")] m3ph, /// * 1 m3/h
|
||||
[Description("l/s")] lps, /// 1 liter/s = 3.6 m3/h
|
||||
[Description("US gal/s")] USgalps, /// 1 US gallon per second = 13.627482408 m3/h
|
||||
[Description("m3/m")] m3pm, /// 1 m3/m = 60 m3/h
|
||||
[Description("cf/s")] cfs, /// 1 cubic foot per second = 101.9406477312 m3/h
|
||||
|
||||
[Description("g")] g, /// 0.001 kg
|
||||
[Description("lb")] lb, /// 0.45359237 kg
|
||||
@@ -43,7 +50,7 @@ namespace Config
|
||||
[Description("Pa")] Pa, /// 1 Pa = 0.01 hPa
|
||||
[Description("hPa")] hPa, /// 1 hPa = 100 Pa
|
||||
[Description("mbar")] mbar, /// 1 mbar = 1 hPa = 100 Pa
|
||||
[Description("kPa")] kPa, /// 1 kPa = 10 hPa = 10000 Pa
|
||||
[Description("kPa")] kPa, /// 1 kPa = 10 hPa = 1000 Pa
|
||||
[Description("inHg")] inHg, /// 1 inHg = 33.864 hPa
|
||||
[Description("psi")] psi, /// 1 psi = 0.0689475729 bar
|
||||
[Description("bar")] bar, /// * 1 Bar = 1000 mbar = 0.1 MPa = 100000 Pa
|
||||
@@ -51,13 +58,16 @@ namespace Config
|
||||
|
||||
[Description("R%")] RPct, /// * 1 R%
|
||||
|
||||
[Description("%")] Pct, /// * 1 %
|
||||
[Description("promile")] Promile, /// 1 promile = 0.1 %
|
||||
[Description("%")] Pct, /// * 1 %
|
||||
|
||||
[Description("mm")] mm, /// * 1 millimeter
|
||||
[Description("cm")] cm, /// 1 cm = 10 mm
|
||||
[Description("m")] m, /// 1 m = 1000 mm
|
||||
[Description("in")] inch, /// 1 inch = 25.4 mm
|
||||
[Description("dm")] dm, /// 1 dm = 100 mm
|
||||
[Description("ft")] foot, /// 1 foot = 304.8 mm
|
||||
[Description("yd")] yard, /// 1 yard = 914.4 mm
|
||||
[Description("m")] m, /// 1 m = 1000 mm
|
||||
|
||||
[Description("kg/m3")] kgpm3, /// * 1 kg/m3 = 0.001 kg/l
|
||||
[Description("kg/l")] kgpl, /// 1 kg/l = 1000 kg/m3
|
||||
@@ -70,6 +80,7 @@ namespace Config
|
||||
[Description("MWh")] MWh, /// 1 MWh = 3600000000 J
|
||||
|
||||
[Description("uS/cm")] uSpcm, /// * 1 uS/cm
|
||||
[Description("mS/m")] mSpm, /// 1 mS/m = 10 uS/cm
|
||||
|
||||
#if LANG_PL
|
||||
[Description("imp/l")] ppl, /// * 1 pulse/l
|
||||
@@ -82,17 +93,17 @@ namespace Config
|
||||
[Description("dm3/stopień")] dm3pdeg, /// * 1 dm3/degree
|
||||
#else
|
||||
[Description("pulse/l")] ppl, /// * 1 pulse/l
|
||||
[Description("pulse/dm3")] ppdm3, /// * 1 pulse/dm3
|
||||
[Description("degree/l")] degpl, /// * 1 degree/l
|
||||
[Description("degree/dm3")] degpdm3, /// * 1 degree/dm3
|
||||
[Description("l/pulse")] lpp, /// * 1 l/pulse
|
||||
[Description("dm3/pulse")] dm3pp, /// * 1 dm3/pulse
|
||||
[Description("l/degree")] lpdeg, /// * 1 l/degree
|
||||
[Description("dm3/degree")] dm3pdeg, /// * 1 dm3/degree
|
||||
[Description("pulse/dm3")] ppdm3, /// 1 pulse/dm3
|
||||
[Description("degree/l")] degpl, /// 1 degree/l
|
||||
[Description("degree/dm3")] degpdm3, /// 1 degree/dm3
|
||||
[Description("l/pulse")] lpp, /// 1 l/pulse
|
||||
[Description("dm3/pulse")] dm3pp, /// 1 dm3/pulse
|
||||
[Description("l/degree")] lpdeg, /// 1 l/degree
|
||||
[Description("dm3/degree")] dm3pdeg, /// 1 dm3/degree
|
||||
#endif
|
||||
///
|
||||
[Description("pulse/kWh")] ppkWh, /// * 1 pulse/kWh
|
||||
[Description("kWh/pulse")] kWhpp, /// * 1 kWh/pulse
|
||||
[Description("kWh/pulse")] kWhpp, /// 1 kWh/pulse
|
||||
|
||||
Count
|
||||
}
|
||||
@@ -122,6 +133,7 @@ namespace Config
|
||||
[Description("Text")] String,
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Datum und Uhrzeit")] DateTime,
|
||||
[Description("Aufgezählt")] Enumerated,
|
||||
#elif LANG_PL
|
||||
[Description("Objętość")] Volume,
|
||||
[Description("Przepływ")] Flow,
|
||||
@@ -144,6 +156,7 @@ namespace Config
|
||||
[Description("Tekst")] String,
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Data i czas")] DateTime,
|
||||
[Description("Wyliczone")] Enumerated,
|
||||
#elif LANG_CS
|
||||
[Description("Objem")] Volume,
|
||||
[Description("Průtok")] Flow,
|
||||
@@ -166,6 +179,7 @@ namespace Config
|
||||
[Description("Text")] String,
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Datum a čas")] DateTime,
|
||||
[Description("Vyjmenované")] Enumerated,
|
||||
#elif LANG_IT
|
||||
[Description("Volume")] Volume,
|
||||
[Description("Flusso")] Flow,
|
||||
@@ -188,6 +202,7 @@ namespace Config
|
||||
[Description("Stringa")] String,
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Data e ora")] DateTime,
|
||||
[Description("Enumerato")] Enumerated,
|
||||
#else
|
||||
[Description("Volume")] Volume,
|
||||
[Description("Flow")] Flow,
|
||||
@@ -210,7 +225,7 @@ namespace Config
|
||||
[Description("String")] String,
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Date and time")] DateTime,
|
||||
[Description("Enum")] Enum,
|
||||
[Description("Enumerated")] Enumerated,
|
||||
#endif
|
||||
Count,
|
||||
}
|
||||
@@ -224,8 +239,9 @@ namespace Config
|
||||
|
||||
public static bool IsDefaultUnit(Unit unit)
|
||||
{
|
||||
return unit == Unit.l || unit == Unit.m3ph || unit == Unit.kg || unit == Unit.s || unit == Unit.C || unit == Unit.bar || unit == Unit.RPct ||
|
||||
unit == Unit.Pct || unit == Unit.mm || unit == Unit.kgpm3 || unit == Unit.J || unit == Unit.ppl || unit == Unit.ppkWh || unit == Unit.uSpcm;
|
||||
return unit == Unit.l || unit == Unit.m3ph || unit == Unit.kg || unit == Unit.s || unit == Unit.C ||
|
||||
unit == Unit.bar || unit == Unit.RPct || unit == Unit.Pct || unit == Unit.mm || unit == Unit.kgpm3 ||
|
||||
unit == Unit.J || unit == Unit.uSpcm || unit == Unit.ppl || unit == Unit.ppkWh;
|
||||
}
|
||||
|
||||
public static bool IsQuantity(Unit units, Quantity quantity)
|
||||
@@ -239,35 +255,42 @@ namespace Config
|
||||
{
|
||||
case Unit.pulse:
|
||||
case Unit.degree:
|
||||
return Config.Quantity.Pulses;
|
||||
return Quantity.Pulses;
|
||||
|
||||
case Unit.ml:
|
||||
case Unit.l:
|
||||
case Unit.dm3:
|
||||
case Unit.USgal:
|
||||
case Unit.UKgal:
|
||||
case Unit.cf:
|
||||
case Unit.m3:
|
||||
case Unit.gal_UK:
|
||||
case Unit.gal_US:
|
||||
return Config.Quantity.Volume;
|
||||
return Quantity.Volume;
|
||||
|
||||
case Unit.lph:
|
||||
case Unit.lpm:
|
||||
case Unit.m3ph:
|
||||
return Config.Quantity.Flow;
|
||||
case Unit.lps:
|
||||
case Unit.USgalps:
|
||||
case Unit.m3pm:
|
||||
case Unit.cfs:
|
||||
return Quantity.Flow;
|
||||
|
||||
case Unit.g:
|
||||
case Unit.lb:
|
||||
case Unit.kg:
|
||||
case Unit.t:
|
||||
case Unit.lb:
|
||||
return Config.Quantity.Mass;
|
||||
return Quantity.Mass;
|
||||
|
||||
case Unit.ms:
|
||||
case Unit.s:
|
||||
case Unit.min:
|
||||
case Unit.hour:
|
||||
case Unit.ms:
|
||||
return Config.Quantity.Time;
|
||||
return Quantity.Time;
|
||||
|
||||
case Unit.C:
|
||||
case Unit.F:
|
||||
case Unit.K:
|
||||
return Config.Quantity.Temperature;
|
||||
return Quantity.Temperature;
|
||||
|
||||
case Unit.Pa:
|
||||
case Unit.hPa:
|
||||
@@ -277,24 +300,27 @@ namespace Config
|
||||
case Unit.psi:
|
||||
case Unit.bar:
|
||||
case Unit.MPa:
|
||||
return Config.Quantity.Pressure;
|
||||
return Quantity.Pressure;
|
||||
|
||||
case Unit.RPct:
|
||||
return Config.Quantity.Humidity;
|
||||
return Quantity.Humidity;
|
||||
|
||||
case Unit.Pct:
|
||||
case Unit.Promile:
|
||||
return Config.Quantity.Error;
|
||||
case Unit.Pct:
|
||||
return Quantity.Error;
|
||||
|
||||
case Unit.mm:
|
||||
case Unit.cm:
|
||||
case Unit.m:
|
||||
case Unit.inch:
|
||||
return Config.Quantity.Length;
|
||||
case Unit.dm:
|
||||
case Unit.foot:
|
||||
case Unit.yard:
|
||||
case Unit.m:
|
||||
return Quantity.Length;
|
||||
|
||||
case Unit.kgpm3:
|
||||
case Unit.kgpl:
|
||||
return Config.Quantity.Density;
|
||||
return Quantity.Density;
|
||||
|
||||
case Unit.J:
|
||||
case Unit.kJ:
|
||||
@@ -302,7 +328,11 @@ namespace Config
|
||||
case Unit.Wh:
|
||||
case Unit.kWh:
|
||||
case Unit.MWh:
|
||||
return Config.Quantity.Energy;
|
||||
return Quantity.Energy;
|
||||
|
||||
case Unit.uSpcm:
|
||||
case Unit.mSpm:
|
||||
return Quantity.Conductivity;
|
||||
|
||||
case Unit.ppl:
|
||||
case Unit.ppdm3:
|
||||
@@ -312,17 +342,14 @@ namespace Config
|
||||
case Unit.dm3pp:
|
||||
case Unit.lpdeg:
|
||||
case Unit.dm3pdeg:
|
||||
return Config.Quantity.PulsePerLtr;
|
||||
return Quantity.PulsePerLtr;
|
||||
|
||||
case Unit.ppkWh:
|
||||
case Unit.kWhpp:
|
||||
return Config.Quantity.PulsePerKWh;
|
||||
|
||||
case Unit.uSpcm:
|
||||
return Config.Quantity.Conductivity;
|
||||
return Quantity.PulsePerKWh;
|
||||
|
||||
default:
|
||||
return Config.Quantity.Number;
|
||||
return Quantity.Number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,78 +370,80 @@ namespace Config
|
||||
public static bool IsConductivity(Unit units) { return IsQuantity(units, Config.Quantity.Conductivity); }
|
||||
|
||||
|
||||
|
||||
public static double ConvertTo(Unit units, double v)
|
||||
{
|
||||
switch (units)
|
||||
{
|
||||
/// Volume: internal representation in l
|
||||
case Unit.dm3:
|
||||
case Unit.l: return v; /// 1 liter
|
||||
case Unit.m3: return 0.001 * v; /// 1 m3 = 1000 l
|
||||
case Unit.gal_UK: return 0.21996925 * v; /// 1 gal(UK) = 4.54609 l
|
||||
case Unit.gal_US: return 0.26417205 * v; /// 1 gal(US) = 3.78541178 l
|
||||
case Unit.ml: return 1000 * v; /// 1 ml = 0.001 l
|
||||
case Unit.USgal: return 0.26417205 * v; /// 1 gal(US) = 3.78541178 l
|
||||
case Unit.UKgal: return 0.21996925 * v; /// 1 gal(UK) = 4.54609 l
|
||||
case Unit.cf: return 0.0353146667215 * v; /// 1 cubic foot = 28.316846592 l
|
||||
case Unit.m3: return 0.001 * v; /// 1 m3 = 1000 l
|
||||
|
||||
/// Flow: internal representation in m3/h
|
||||
case Unit.lph: return 1000 * v; /// 1 liter/h
|
||||
case Unit.m3ph: return v; /// 1 m3/h = 1000 l/h
|
||||
case Unit.lph: return 1000 * v; /// 1 l/h
|
||||
case Unit.lpm: return v / 0.06; /// 1 l/m
|
||||
case Unit.lps: return v / 3.6; /// 1 l/s
|
||||
case Unit.USgalps: return 0.0733811257326 * v; /// 1 US gallon per second
|
||||
case Unit.m3pm: return v / 60; /// 1 m3/m
|
||||
case Unit.cfs: return 0.009809629644858 * v; /// 1 cubic foot per second
|
||||
|
||||
/// Mass: internal representation in kg
|
||||
case Unit.g: return 1000 * v; /// 1 g = 0.001 kg
|
||||
case Unit.kg: return v; /// 1 kilogram
|
||||
case Unit.t: return 0.001 * v; /// 1 t = 1000 kg
|
||||
case Unit.lb: return 2.2046226 * v; /// 1 lb = 0.45359237 kg
|
||||
case Unit.g: return 1000 * v; /// 1 g = 0.001 kg
|
||||
case Unit.lb: return 2.2046226 * v; /// 1 lb = 0.45359237 kg
|
||||
case Unit.t: return 0.001 * v; /// 1 t = 1000 kg
|
||||
|
||||
/// Time or duration: internal representation in seconds [s]
|
||||
case Unit.s: return v;
|
||||
case Unit.ms: return 1000 * v;
|
||||
case Unit.min: return v / 60;
|
||||
case Unit.hour: return v / 3600;
|
||||
case Unit.ms: return 1000 * v;
|
||||
|
||||
/// Temperature: internal representation in °C
|
||||
case Unit.C: return v; /// degree Celsius (°C)
|
||||
case Unit.F: return 1.8 * v + 32; /// degree Fahrenheit
|
||||
case Unit.K: return v + 273.15; /// degree Kelvin
|
||||
case Unit.F: return 1.8 * v + 32; /// degree Fahrenheit
|
||||
case Unit.K: return v + 273.15; /// degree Kelvin
|
||||
|
||||
/// Pressure: internal representation in bar = 0.1 MPa
|
||||
case Unit.Pa: return 100000 * v; /// 1 hPa = 100 Pa
|
||||
case Unit.hPa: return 1000 * v; /// 1 hPa = 100 Pa
|
||||
case Unit.mbar: return 1000 * v; /// 1 mbar = 1 hPa = 100 Pa
|
||||
case Unit.kPa: return 100 * v; /// 1 kPa = 10 HPa
|
||||
case Unit.inHg: return 29.53 * v; /// 1 inHg =
|
||||
case Unit.psi: return 14.5037738 * v; /// 1 psi =
|
||||
case Unit.bar: return v; /// 1 bar = 1000 mbar = 100000 Pa
|
||||
case Unit.MPa: return 0.1 * v; /// 1 MPa = 10000 hPa
|
||||
case Unit.Pa: return 100000 * v; /// 1 hPa = 100 Pa
|
||||
case Unit.hPa: return 1000 * v; /// 1 hPa = 100 Pa
|
||||
case Unit.mbar: return 1000 * v; /// 1 mbar = 1 hPa = 100 Pa
|
||||
case Unit.kPa: return 100 * v; /// 1 kPa = 10 HPa
|
||||
case Unit.inHg: return 29.53 * v; /// 1 inHg =
|
||||
case Unit.psi: return 14.5037738 * v; /// 1 psi =
|
||||
case Unit.MPa: return 0.1 * v; /// 1 MPa = 10000 hPa
|
||||
|
||||
/// Error: internal representation in %
|
||||
case Unit.Pct: return v; /// 1 %
|
||||
case Unit.Promile: return 10 * v; /// 1 promile = 0.1 %
|
||||
/// Relative error: internal representation in %
|
||||
case Unit.Promile: return 10 * v; /// 1 promile = 0.1 %
|
||||
|
||||
/// Diameter, length: internal representation in mm
|
||||
case Unit.mm: return v; /// 1 mm
|
||||
case Unit.cm: return 0.1 * v; /// 1 cm = 10 mm
|
||||
case Unit.m: return 0.001 * v; /// 1 m = 1000 mm
|
||||
case Unit.inch: return v / 25.4; /// 1 inch = 25.4 mm
|
||||
|
||||
case Unit.cm: return 0.1 * v; /// 1 cm = 10 mm
|
||||
case Unit.inch: return v / 25.4; /// 1 inch = 25.4 mm
|
||||
case Unit.dm: return 0.01 * v; /// 1 dm = 100 mm
|
||||
case Unit.foot: return v / 304.8; /// 1 foot = 304.8 mm
|
||||
case Unit.yard: return v / 914.4; /// 1 yard = 914,4 mm
|
||||
case Unit.m: return 0.001 * v; /// 1 m = 1000 mm
|
||||
|
||||
/// Density: internal representation in kg/m3
|
||||
case Unit.kgpm3: return v;
|
||||
case Unit.kgpl: return 0.001 * v;
|
||||
|
||||
/// Energy, internal representation in Joul
|
||||
case Unit.J: return v; /// 1 Joul
|
||||
case Unit.kJ: return 0.001 * v; /// 1 kJ = 1000 J
|
||||
case Unit.MJ: return 0.000001 * v; /// 1 kJ = 1000000 J
|
||||
case Unit.Wh: return v / 3600.0; /// 1 Wh = 3600 J
|
||||
case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J
|
||||
case Unit.MWh: return v / 3600000000.0;/// 1 MWh = 3600000000 J
|
||||
case Unit.kJ: return 0.001 * v; /// 1 kJ = 1000 J
|
||||
case Unit.MJ: return 0.000001 * v; /// 1 kJ = 1000000 J
|
||||
case Unit.Wh: return v / 3600.0; /// 1 Wh = 3600 J
|
||||
case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J
|
||||
case Unit.MWh: return v / 3600000000.0; /// 1 MWh = 3600000000 J
|
||||
|
||||
/// Electrical conductivity
|
||||
case Unit.mSpm: return 0.1 * v;
|
||||
|
||||
/// Invert pulses
|
||||
case Unit.kWhpp:
|
||||
case Unit.lpp:
|
||||
case Unit.dm3pp:
|
||||
case Unit.lpdeg:
|
||||
case Unit.dm3pdeg: return ((v <= float.Epsilon) ? 0 : 1 / v);
|
||||
case Unit.dm3pdeg: return (v <= float.Epsilon) ? 0 : 1/v;
|
||||
|
||||
default: return v;
|
||||
default: return v; /// Do not convert
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,72 +452,75 @@ namespace Config
|
||||
switch (units)
|
||||
{
|
||||
/// Volume: internal representation in l
|
||||
case Unit.dm3:
|
||||
case Unit.l: return v; /// 1 liter
|
||||
case Unit.m3: return 1000 * v; /// 1000 l
|
||||
case Unit.gal_UK: return 4.54609 * v; /// 1 gal(UK) = 4.54609 l
|
||||
case Unit.gal_US: return 3.78541178 * v; /// 1 gal(US) = 3.78541178 l
|
||||
case Unit.ml: return 0.001 * v; /// 0.001 l
|
||||
case Unit.USgal: return 3.78541178 * v; /// 1 gal(US) = 3.78541178 l
|
||||
case Unit.UKgal: return 4.54609 * v; /// 1 gal(UK) = 4.54609 l
|
||||
case Unit.cf: return 28.316846592 * v; /// 1 cubic foot = 28.316846592 l
|
||||
case Unit.m3: return 1000 * v; /// 1000 l
|
||||
|
||||
/// Flow: internal representation in m3/h
|
||||
case Unit.lph: return 0.001 * v; /// 1 liter/h
|
||||
case Unit.m3ph: return v; /// 1 m3/h = 1000 l/h
|
||||
case Unit.lph: return 0.001 * v; /// 1 l/h
|
||||
case Unit.lpm: return 0.06 * v; /// 1 l/m
|
||||
case Unit.lps: return 3.6 * v; /// 1 l/s
|
||||
case Unit.USgalps: return 13.627482408 * v; /// 1 US gallon per second
|
||||
case Unit.m3pm: return 60 * v; /// 1 m3/m
|
||||
case Unit.cfs: return 101.9406477312 * v; /// 1 cubic foot per second
|
||||
|
||||
/// Mass: internal representation in kg
|
||||
case Unit.g: return 0.001 * v; /// 1 g = 0.001 kg
|
||||
case Unit.kg: return v; /// 1 kilogram
|
||||
case Unit.t: return 1000 * v; /// 1 t = 1000 kg
|
||||
case Unit.lb: return 0.45359237 * v; /// 1 lb = 0.45359237 kg
|
||||
case Unit.g: return 0.001 * v; /// 1 g = 0.001 kg
|
||||
case Unit.lb: return 0.45359237 * v; /// 1 lb = 0.45359237 kg
|
||||
case Unit.t: return 1000 * v; /// 1 t = 1000 kg
|
||||
|
||||
/// Time or duration: internal representation in seconds [s]
|
||||
case Unit.s: return v;
|
||||
case Unit.ms: return 0.001 * v;
|
||||
case Unit.min: return 60 * v;
|
||||
case Unit.hour: return 3600 * v;
|
||||
case Unit.ms: return v / 1000;
|
||||
|
||||
/// Temperature: internal representation in °C
|
||||
case Unit.C: return v; /// degree Celsius (°C)
|
||||
case Unit.F: return 5 * (v-32) / 9; /// degree Fahrenheit
|
||||
case Unit.K: return v - 273.15; /// degree Kelvin
|
||||
case Unit.F: return 5 * (v - 32) / 9; /// degree Fahrenheit
|
||||
case Unit.K: return v - 273.15; /// degree Kelvin
|
||||
|
||||
/// Pressure: internal representation in bar = 0.1 MPa
|
||||
case Unit.Pa: return 0.00001 * v; /// 1 hPa = 100 Pa
|
||||
case Unit.hPa: return 0.001 * v; /// 1 hPa = 100 Pa
|
||||
case Unit.mbar: return 0.001 * v; /// 1 mbar = 1 hPa = 100 Pa
|
||||
case Unit.kPa: return 0.01 * v; /// 1 kPa = 10 HPa
|
||||
case Unit.inHg: return 0.033864 * v; /// 1 inHg = 33.864 hPa
|
||||
case Unit.psi: return 0.0689475729 * v;/// 1 psi = 0.0689475729 bar
|
||||
case Unit.bar: return v; /// 1 bar = 1000 mbar = 100000 Pa
|
||||
case Unit.MPa: return 10 * v; /// 1 MPa = 10000 hPa
|
||||
case Unit.Pa: return 0.00001 * v; /// 1 hPa = 100 Pa
|
||||
case Unit.hPa: return 0.001 * v; /// 1 hPa = 100 Pa
|
||||
case Unit.mbar: return 0.001 * v; /// 1 mbar = 1 hPa = 100 Pa
|
||||
case Unit.kPa: return 0.01 * v; /// 1 kPa = 10 HPa
|
||||
case Unit.inHg: return 0.033864 * v; /// 1 inHg = 33.864 hPa
|
||||
case Unit.psi: return 0.0689475729 * v; /// 1 psi = 0.0689475729 bar
|
||||
case Unit.MPa: return 10 * v; /// 1 MPa = 10000 hPa
|
||||
|
||||
/// Error: internal representation in %
|
||||
case Unit.Pct: return v; /// 1 %
|
||||
case Unit.Promile: return 0.1 * v; /// 1 promile = 0.1 %
|
||||
/// Relative error: internal representation in %
|
||||
case Unit.Promile: return 0.1 * v; /// 1 promile = 0.1 %
|
||||
|
||||
/// Diameter, length: internal representation in mm
|
||||
case Unit.mm: return v; /// 1 mm
|
||||
case Unit.cm: return 10 * v; /// 1 cm = 10 mm
|
||||
case Unit.m: return 1000 * v; /// 1 m = 1000 mm
|
||||
case Unit.inch: return 25.4 * v; /// 1 inch = 25.4 mm
|
||||
case Unit.cm: return 10 * v; /// 1 cm = 10 mm
|
||||
case Unit.inch: return 25.4 * v; /// 1 inch = 25.4 mm
|
||||
case Unit.dm: return 100 * v; /// 1 dm = 100 mm
|
||||
case Unit.foot: return 304.8 * v; /// 1 foot = 304.8 mm
|
||||
case Unit.yard: return 914.4 * v; /// 1 yard = 914,4 mm
|
||||
case Unit.m: return 1000 * v; /// 1 m = 1000 mm
|
||||
|
||||
/// Density: internal representation in kg/m3
|
||||
case Unit.kgpm3: return v;
|
||||
case Unit.kgpl: return 1000 * v;
|
||||
|
||||
/// Energy, internal representation in Joul
|
||||
case Unit.J: return v; /// 1 Joul
|
||||
case Unit.kJ: return 1000 * v; /// 1 kJ = 1000 J
|
||||
case Unit.MJ: return 1000000 * v; /// 1 kJ = 1000000 J
|
||||
case Unit.Wh: return 3600 * v; /// 1 Wh = 3600 J
|
||||
case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J
|
||||
case Unit.MWh: return 3600000000 * v; /// 1 kWh = 3600000000 J
|
||||
case Unit.kJ: return 1000 * v; /// 1 kJ = 1000 J
|
||||
case Unit.MJ: return 1000000 * v; /// 1 kJ = 1000000 J
|
||||
case Unit.Wh: return 3600 * v; /// 1 Wh = 3600 J
|
||||
case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J
|
||||
case Unit.MWh: return 3600000000 * v; /// 1 kWh = 3600000000 J
|
||||
|
||||
/// Electrical conductivity
|
||||
case Unit.mSpm: return 10 * v;
|
||||
|
||||
/// Invert
|
||||
case Unit.kWhpp:
|
||||
case Unit.lpp:
|
||||
case Unit.dm3pp:
|
||||
case Unit.lpdeg:
|
||||
case Unit.dm3pdeg: return ((v == 0) ? 0 : 1 / v);
|
||||
case Unit.dm3pdeg: return (v <= float.Epsilon) ? 0 : 1/v;
|
||||
|
||||
default: return v;
|
||||
default: return v; /// Do not convert
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+324
-18
@@ -13,22 +13,28 @@ namespace DataStreamInterface
|
||||
degree,
|
||||
|
||||
/// Volume
|
||||
ml, /// 0.001 l
|
||||
l, /// * 1 liter = 1 l
|
||||
ml, /// 1 ml = 0.001 l
|
||||
l, /// * 1 liter
|
||||
dm3, /// 1 dm3 = 1 l
|
||||
m3, /// 1000 l
|
||||
gal_UK, /// 1 gal(UK) = 4.54609 l
|
||||
gal_US, /// 1 gal(US) = 3.78541178 l
|
||||
USgal, /// 1 US gallon = 3.78541178 l
|
||||
UKgal, /// 1 imperial gallon = 4.54609 l
|
||||
cf, /// 1 cubic foot = 28.316846592 l
|
||||
m3, /// 1 m3 = 1000 l
|
||||
|
||||
/// Flow
|
||||
lph, /// 1 liter/h
|
||||
m3ph, /// * 1 m3/h = 1000 l/h
|
||||
lph, /// 1 l/h = 0.001 m3/h
|
||||
lpm, /// 1 l/m = 60 l/h = 0.06 m3/h
|
||||
m3ph, /// * 1 m3/h
|
||||
lps, /// 1 liter/s = 3.6 m3/h
|
||||
USgalps, /// 1 US gallon per second = 13.627482408 m3/h
|
||||
m3pm, /// 1 m3/m = 60 m3/h
|
||||
cfs, /// 1 cubic foot per second = 101.9406477312 m3/h
|
||||
|
||||
/// Mass
|
||||
g, /// 0.001 kg
|
||||
lb, /// 0.45359237 kg
|
||||
kg, /// * 1 kilogram
|
||||
t, /// 1000 kg
|
||||
lb, /// 0.45359237 kg
|
||||
|
||||
/// Time
|
||||
ms, /// 1 ms = 0.001 s
|
||||
@@ -47,6 +53,7 @@ namespace DataStreamInterface
|
||||
mbar, /// 1 mbar = 1 hPa = 100 Pa
|
||||
kPa, /// 1 kPa = 10 HPa
|
||||
inHg, /// 1 inHg = 33.864 hPa
|
||||
psi, /// 1 psi = 0.0689475729 bar
|
||||
bar, /// * 1 Bar = 1000 mbar = 0.1 MPa = 100000 Pa
|
||||
MPa, /// 1 MPa = 10000 hPa
|
||||
|
||||
@@ -61,7 +68,9 @@ namespace DataStreamInterface
|
||||
mm, /// * 1 millimeter
|
||||
cm, /// 1 cm = 10 mm
|
||||
inch, /// 1 inch = 25.4 mm
|
||||
dm, /// 1 dm = 100 mm
|
||||
foot, /// 1 foot = 304.8 mm
|
||||
yard, /// 1 yard = 914.4 mm
|
||||
m, /// 1 m = 1000 mm
|
||||
|
||||
/// Density
|
||||
@@ -76,20 +85,317 @@ namespace DataStreamInterface
|
||||
kWh, /// 1 kWh = 3600000 J
|
||||
MWh, /// 1 MWh = 3600000000 J
|
||||
|
||||
/// Electrical conductivity
|
||||
uSpcm, /// * 1 uS/cm
|
||||
mSpm, /// 1 mS/m = 10 uS/cm
|
||||
|
||||
/// Meter coefficient - volume
|
||||
ppl, /// * 1 pulse/l
|
||||
ppdm3, /// * 1 pulse/dm3
|
||||
degpl, /// * 1 degree/l
|
||||
degpdm3, /// * 1 degree/dm3
|
||||
lpp, /// * 1 l/pulse
|
||||
dm3pp, /// * 1 dm3/pulse
|
||||
lpdeg, /// * 1 l/degree
|
||||
dm3pdeg, /// * 1 dm3/degree
|
||||
ppdm3, /// 1 pulse/dm3
|
||||
degpl, /// 1 degree/l
|
||||
degpdm3, /// 1 degree/dm3
|
||||
lpp, /// 1 l/pulse
|
||||
dm3pp, /// 1 dm3/pulse
|
||||
lpdeg, /// 1 l/degree
|
||||
dm3pdeg, /// 1 dm3/degree
|
||||
|
||||
/// Meter coefficient - energy
|
||||
ppkWh, /// * 1 pulse/kWh
|
||||
kWhpp, /// * 1 kWh/pulse
|
||||
|
||||
Count
|
||||
kWhpp, /// 1 kWh/pulse
|
||||
}
|
||||
|
||||
public enum Quantity
|
||||
{
|
||||
/// Quantities with units and conversions (double -> double)
|
||||
Volume,
|
||||
Flow,
|
||||
Mass,
|
||||
Time,
|
||||
Temperature,
|
||||
Pressure,
|
||||
Humidity,
|
||||
Error,
|
||||
Length,
|
||||
Density,
|
||||
Energy,
|
||||
Pulses,
|
||||
PulsePerLtr,
|
||||
PulsePerKWh,
|
||||
Conductivity,
|
||||
|
||||
/// Quantities without units and conversions
|
||||
Number,
|
||||
String,
|
||||
Boolean,
|
||||
DateTime,
|
||||
Enumerated,
|
||||
}
|
||||
|
||||
public static class Units
|
||||
{
|
||||
public static bool IsDefaultUnit(Unit unit)
|
||||
{
|
||||
return unit == Unit.l || unit == Unit.m3ph || unit == Unit.kg || unit == Unit.s || unit == Unit.C ||
|
||||
unit == Unit.bar || unit == Unit.RPct || unit == Unit.Pct || unit == Unit.mm || unit == Unit.kgpm3 ||
|
||||
unit == Unit.J || unit == Unit.uSpcm || unit == Unit.ppl || unit == Unit.ppkWh;
|
||||
}
|
||||
|
||||
public static Quantity GetQuantity(Unit units)
|
||||
{
|
||||
switch (units)
|
||||
{
|
||||
case Unit.pulse:
|
||||
case Unit.degree:
|
||||
return Quantity.Pulses;
|
||||
|
||||
case Unit.ml:
|
||||
case Unit.l:
|
||||
case Unit.dm3:
|
||||
case Unit.USgal:
|
||||
case Unit.UKgal:
|
||||
case Unit.cf:
|
||||
case Unit.m3:
|
||||
return Quantity.Volume;
|
||||
|
||||
case Unit.lph:
|
||||
case Unit.lpm:
|
||||
case Unit.m3ph:
|
||||
case Unit.lps:
|
||||
case Unit.USgalps:
|
||||
case Unit.m3pm:
|
||||
case Unit.cfs:
|
||||
return Quantity.Flow;
|
||||
|
||||
case Unit.g:
|
||||
case Unit.lb:
|
||||
case Unit.kg:
|
||||
case Unit.t:
|
||||
return Quantity.Mass;
|
||||
|
||||
case Unit.ms:
|
||||
case Unit.s:
|
||||
case Unit.min:
|
||||
case Unit.hour:
|
||||
return Quantity.Time;
|
||||
|
||||
case Unit.C:
|
||||
case Unit.F:
|
||||
case Unit.K:
|
||||
return Quantity.Temperature;
|
||||
|
||||
case Unit.Pa:
|
||||
case Unit.hPa:
|
||||
case Unit.mbar:
|
||||
case Unit.kPa:
|
||||
case Unit.inHg:
|
||||
case Unit.psi:
|
||||
case Unit.bar:
|
||||
case Unit.MPa:
|
||||
return Quantity.Pressure;
|
||||
|
||||
case Unit.RPct:
|
||||
return Quantity.Humidity;
|
||||
|
||||
case Unit.Promile:
|
||||
case Unit.Pct:
|
||||
return Quantity.Error;
|
||||
|
||||
case Unit.mm:
|
||||
case Unit.cm:
|
||||
case Unit.inch:
|
||||
case Unit.dm:
|
||||
case Unit.foot:
|
||||
case Unit.yard:
|
||||
case Unit.m:
|
||||
return Quantity.Length;
|
||||
|
||||
case Unit.kgpm3:
|
||||
case Unit.kgpl:
|
||||
return Quantity.Density;
|
||||
|
||||
case Unit.J:
|
||||
case Unit.kJ:
|
||||
case Unit.MJ:
|
||||
case Unit.Wh:
|
||||
case Unit.kWh:
|
||||
case Unit.MWh:
|
||||
return Quantity.Energy;
|
||||
|
||||
case Unit.uSpcm:
|
||||
case Unit.mSpm:
|
||||
return Quantity.Conductivity;
|
||||
|
||||
case Unit.ppl:
|
||||
case Unit.ppdm3:
|
||||
case Unit.degpl:
|
||||
case Unit.degpdm3:
|
||||
case Unit.lpp:
|
||||
case Unit.dm3pp:
|
||||
case Unit.lpdeg:
|
||||
case Unit.dm3pdeg:
|
||||
return Quantity.PulsePerLtr;
|
||||
|
||||
case Unit.ppkWh:
|
||||
case Unit.kWhpp:
|
||||
return Quantity.PulsePerKWh;
|
||||
|
||||
default:
|
||||
return Quantity.Number;
|
||||
}
|
||||
}
|
||||
|
||||
public static double ConvertTo(Unit units, double v)
|
||||
{
|
||||
switch (units)
|
||||
{
|
||||
/// Volume: internal representation in l
|
||||
case Unit.ml: return 1000 * v; /// 1 l = 1000 ml
|
||||
case Unit.USgal: return 0.26417205 * v; /// 1 gal(US) = 3.78541178 l
|
||||
case Unit.UKgal: return 0.21996925 * v; /// 1 gal(UK) = 4.54609 l
|
||||
case Unit.cf: return 0.0353146667215 * v; /// 1 cubic foot = 28.316846592 l
|
||||
case Unit.m3: return 0.001 * v; /// 1 m3 = 1000 l
|
||||
|
||||
/// Flow: internal representation in m3/h
|
||||
case Unit.lph: return 1000 * v; /// 1 l/h
|
||||
case Unit.lpm: return v / 0.06; /// 1 l/m
|
||||
case Unit.lps: return v / 3.6; /// 1 l/s
|
||||
case Unit.USgalps: return 0.0733811257326 * v; /// 1 US gallon per second
|
||||
case Unit.m3pm: return v / 60; /// 1 m3/m
|
||||
case Unit.cfs: return 0.009809629644858 * v; /// 1 cubic foot per second
|
||||
|
||||
/// Mass: internal representation in kg
|
||||
case Unit.g: return 1000 * v; /// 1 g = 0.001 kg
|
||||
case Unit.lb: return 2.2046226 * v; /// 1 lb = 0.45359237 kg
|
||||
case Unit.t: return 0.001 * v; /// 1 t = 1000 kg
|
||||
|
||||
/// Time or duration: internal representation in seconds [s]
|
||||
case Unit.ms: return 1000 * v;
|
||||
case Unit.min: return v / 60;
|
||||
case Unit.hour: return v / 3600;
|
||||
|
||||
/// Temperature: internal representation in °C
|
||||
case Unit.F: return 1.8 * v + 32; /// degree Fahrenheit
|
||||
case Unit.K: return v + 273.15; /// degree Kelvin
|
||||
|
||||
/// Pressure: internal representation in bar = 0.1 MPa
|
||||
case Unit.Pa: return 100000 * v;
|
||||
case Unit.hPa: return 1000 * v; /// 1 hPa = 100 Pa
|
||||
case Unit.mbar: return 1000 * v; /// 1 mbar = 1 hPa = 100 Pa
|
||||
case Unit.kPa: return 100 * v; /// 1 kPa = 10 HPa
|
||||
case Unit.inHg: return 29.53 * v; /// 1 inHg =
|
||||
case Unit.psi: return 14.5037738 * v; /// 1 psi =
|
||||
case Unit.MPa: return 0.1 * v; /// 1 MPa = 10000 hPa
|
||||
|
||||
/// Relative error: internal representation in %
|
||||
case Unit.Promile: return 10 * v; /// 1 promile = 0.1 %
|
||||
|
||||
/// Diameter, length: internal representation in mm
|
||||
case Unit.cm: return 0.1 * v; /// 1 cm = 10 mm
|
||||
case Unit.inch: return v / 25.4; /// 1 inch = 25.4 mm
|
||||
case Unit.dm: return 0.01 * v; /// 1 dm = 100 mm
|
||||
case Unit.foot: return v / 304.8; /// 1 foot = 304.8 mm
|
||||
case Unit.yard: return v / 914.4; /// 1 yard = 914,4 mm
|
||||
case Unit.m: return 0.001 * v; /// 1 m = 1000 mm
|
||||
|
||||
/// Density: internal representation in kg/m3
|
||||
case Unit.kgpl: return 0.001 * v;
|
||||
|
||||
/// Energy, internal representation in Joul
|
||||
case Unit.kJ: return 0.001 * v; /// 1 kJ = 1000 J
|
||||
case Unit.MJ: return 0.000001 * v; /// 1 kJ = 1000000 J
|
||||
case Unit.Wh: return v / 3600.0; /// 1 Wh = 3600 J
|
||||
case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J
|
||||
case Unit.MWh: return v / 3600000000.0; /// 1 MWh = 3600000000 J
|
||||
|
||||
/// Electrical conductivity
|
||||
case Unit.mSpm: return 0.1 * v;
|
||||
|
||||
/// Invert pulses
|
||||
case Unit.kWhpp:
|
||||
case Unit.lpp:
|
||||
case Unit.dm3pp:
|
||||
case Unit.lpdeg:
|
||||
case Unit.dm3pdeg: return (v <= float.Epsilon) ? 0 : 1/v;
|
||||
|
||||
default: return v; /// Do not convert
|
||||
}
|
||||
}
|
||||
|
||||
public static double ConvertFrom(Unit units, double v)
|
||||
{
|
||||
switch (units)
|
||||
{
|
||||
/// Volume: internal representation in l
|
||||
case Unit.ml: return 0.001 * v; /// 0.001 l
|
||||
case Unit.USgal: return 3.78541178 * v; /// 1 gal(US) = 3.78541178 l
|
||||
case Unit.UKgal: return 4.54609 * v; /// 1 gal(UK) = 4.54609 l
|
||||
case Unit.cf: return 28.316846592 * v; /// 1 cubic foot = 28.316846592 l
|
||||
case Unit.m3: return 1000 * v; /// 1000 l
|
||||
|
||||
/// Flow: internal representation in m3/h
|
||||
case Unit.lph: return 0.001 * v; /// 1 l/h
|
||||
case Unit.lpm: return 0.06 * v; /// 1 l/m
|
||||
case Unit.lps: return 3.6 * v; /// 1 l/s
|
||||
case Unit.USgalps: return 13.627482408 * v; /// 1 US gallon per second
|
||||
case Unit.m3pm: return 60 * v; /// 1 m3/m
|
||||
case Unit.cfs: return 101.9406477312 * v; /// 1 cubic foot per second
|
||||
|
||||
/// Mass: internal representation in kg
|
||||
case Unit.g: return 0.001 * v; /// 1 g = 0.001 kg
|
||||
case Unit.lb: return 0.45359237 * v; /// 1 lb = 0.45359237 kg
|
||||
case Unit.t: return 1000 * v; /// 1 t = 1000 kg
|
||||
|
||||
/// Time or duration: internal representation in seconds [s]
|
||||
case Unit.ms: return 0.001 * v;
|
||||
case Unit.min: return 60 * v;
|
||||
case Unit.hour: return 3600 * v;
|
||||
|
||||
/// Temperature: internal representation in °C
|
||||
case Unit.F: return 5 * (v - 32) / 9; /// degree Fahrenheit
|
||||
case Unit.K: return v - 273.15; /// degree Kelvin
|
||||
|
||||
/// Pressure: internal representation in bar = 0.1 MPa
|
||||
case Unit.Pa: return 0.00001 * v; /// 1 hPa = 100 Pa
|
||||
case Unit.hPa: return 0.001 * v; /// 1 hPa = 100 Pa
|
||||
case Unit.mbar: return 0.001 * v; /// 1 mbar = 1 hPa = 100 Pa
|
||||
case Unit.kPa: return 0.01 * v; /// 1 kPa = 10 HPa
|
||||
case Unit.inHg: return 0.033864 * v; /// 1 inHg = 33.864 hPa
|
||||
case Unit.psi: return 0.0689475729 * v; /// 1 psi = 0.0689475729 bar
|
||||
case Unit.MPa: return 10 * v; /// 1 MPa = 10000 hPa
|
||||
|
||||
/// Relative error: internal representation in %
|
||||
case Unit.Promile: return 0.1 * v; /// 1 promile = 0.1 %
|
||||
|
||||
/// Diameter, length: internal representation in mm
|
||||
case Unit.cm: return 10 * v; /// 1 cm = 10 mm
|
||||
case Unit.inch: return 25.4 * v; /// 1 inch = 25.4 mm
|
||||
case Unit.dm: return 100 * v; /// 1 dm = 100 mm
|
||||
case Unit.foot: return 304.8 * v; /// 1 foot = 304.8 mm
|
||||
case Unit.yard: return 914.4 * v; /// 1 yard = 914,4 mm
|
||||
case Unit.m: return 1000 * v; /// 1 m = 1000 mm
|
||||
|
||||
/// Density: internal representation in kg/m3
|
||||
case Unit.kgpl: return 1000 * v;
|
||||
|
||||
/// Energy, internal representation in Joul
|
||||
case Unit.kJ: return 1000 * v; /// 1 kJ = 1000 J
|
||||
case Unit.MJ: return 1000000 * v; /// 1 kJ = 1000000 J
|
||||
case Unit.Wh: return 3600 * v; /// 1 Wh = 3600 J
|
||||
case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J
|
||||
case Unit.MWh: return 3600000000 * v; /// 1 kWh = 3600000000 J
|
||||
|
||||
/// Electrical conductivity
|
||||
case Unit.mSpm: return 10 * v;
|
||||
|
||||
/// Invert
|
||||
case Unit.kWhpp:
|
||||
case Unit.lpp:
|
||||
case Unit.dm3pp:
|
||||
case Unit.lpdeg:
|
||||
case Unit.dm3pdeg: return (v <= float.Epsilon) ? 0 : 1/v;
|
||||
|
||||
default: return v; /// Do not convert
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using TBF;
|
||||
|
||||
namespace ResetBatchNr
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static LocalSettings ls;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (!Directory.Exists(TBF.Program.ConfigDir)) return;
|
||||
|
||||
Environment.CurrentDirectory = TBF.Program.ConfigDir;
|
||||
ls = LocalSettings.Load(TBF.Program.LocalSettingsFileName);
|
||||
if (ls == null || ls.TestBenches == null)
|
||||
{
|
||||
/// Loading local seetings from regular config file failed. Use the backup
|
||||
ls = LocalSettings.Load(TBF.Program.LocalSettingsBackupName);
|
||||
if (ls == null || ls.TestBenches == null)
|
||||
{
|
||||
/// Neither config.xml, nor config.backup.xml could be loaded
|
||||
Console.WriteLine(string.Format("Could not load file {0}, nor {1}.", TBF.Program.LocalSettingsFileName, TBF.Program.LocalSettingsBackupName));
|
||||
Console.ReadLine();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Loading local seetings from the regular config file was successful. Update the backup
|
||||
File.Copy(TBF.Program.LocalSettingsFileName, TBF.Program.LocalSettingsBackupName, true);
|
||||
}
|
||||
|
||||
///
|
||||
/// Process local settings so that windows are shifted to the 1st monitor
|
||||
///
|
||||
ls.BatchNr = 1;
|
||||
ls.Save();
|
||||
|
||||
Console.WriteLine("BatchNr was reset to 1");
|
||||
Console.ReadLine();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ResetBatchNr")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ResetBatchNr")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("de8130eb-2f43-46a6-9f5b-bf96432a0c7c")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// 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("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{D7F5A111-B2DF-4761-9574-AB730DF573A6}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ResetBatchNr</RootNamespace>
|
||||
<AssemblyName>ResetBatchNr</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Config\Config.csproj">
|
||||
<Project>{743df7db-c7b6-42eb-986d-0f485e5588e4}</Project>
|
||||
<Name>Config</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\TBF\TBF.csproj">
|
||||
<Project>{8648fd92-cda1-4c3a-b5f9-fe547ce1fa48}</Project>
|
||||
<Name>TBF</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Users\Users.csproj">
|
||||
<Project>{6e5cb0e9-e1b6-4e5d-ac6e-b1049e180f2b}</Project>
|
||||
<Name>Users</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
+5
-4
@@ -66,13 +66,13 @@ namespace Results
|
||||
switch (dbType)
|
||||
{
|
||||
default:
|
||||
case Users.Entities.DBType.SQLite:
|
||||
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
|
||||
break;
|
||||
case Users.Entities.DBType.MySql:
|
||||
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
|
||||
break;
|
||||
}
|
||||
case Users.Entities.DBType.SQLite:
|
||||
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
|
||||
break;
|
||||
}
|
||||
|
||||
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Entities.WaterMeterData>());
|
||||
|
||||
@@ -311,6 +311,7 @@ namespace Results
|
||||
batch.TestRslts = session.QueryOver<TestRslt>()
|
||||
.Where(x => (x.Batch.Id == batch.Id))
|
||||
.List();
|
||||
|
||||
batch.WaterMeters = session.QueryOver<WaterMeter>()
|
||||
.Where(x => (x.Batch.Id == batch.Id))
|
||||
.List();
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2020 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using Config.Entities;
|
||||
using GenCode128;
|
||||
using Gma.QrCodeNet.Encoding;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results.Output.Printers.Enhanced
|
||||
{
|
||||
public class EnhancedPrintDocument : PrintDocument
|
||||
{
|
||||
/// Size of the printed area without margins, after taking into account 'pageOrientation'
|
||||
static QrEncoder encoder = new QrEncoder();
|
||||
|
||||
/// Size of the printed area without margins, after taking into account 'pageOrientation'
|
||||
readonly int printHeight;
|
||||
readonly int printWidth;
|
||||
|
||||
@@ -23,12 +28,14 @@ namespace Results.Output.Printers.Enhanced
|
||||
readonly int TitleX;
|
||||
readonly int TitleY; /// Depends on the size of the header
|
||||
|
||||
readonly int SpacingOne;
|
||||
readonly int SpacingOneAndHalf;
|
||||
readonly int SpacingOne4Header;
|
||||
readonly int SpacingOneAndHalf4Header;
|
||||
readonly int spacingOne;
|
||||
readonly int spacingOneAndHalf;
|
||||
readonly int spacingOne4Header;
|
||||
readonly int spacingOneAndHalf4Header;
|
||||
readonly int spacingOne4Footer;
|
||||
|
||||
readonly int SpacingOne4Footer;
|
||||
int spacingAboveTable;
|
||||
int spacingBelowTable;
|
||||
|
||||
int CommonTop; /// = TitleY + 60
|
||||
int BodyTop; /// = HdrTop + 160
|
||||
@@ -124,11 +131,11 @@ namespace Results.Output.Printers.Enhanced
|
||||
}
|
||||
|
||||
/// Document outline preliminary calculations
|
||||
SpacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height;
|
||||
SpacingOneAndHalf = (3 * SpacingOne) / 2;
|
||||
SpacingOne4Header = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", headerFont).Height;
|
||||
SpacingOneAndHalf4Header = (3 * SpacingOne4Header) / 2;
|
||||
SpacingOne4Footer = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", footerFont).Height;
|
||||
spacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height;
|
||||
spacingOneAndHalf = (3 * spacingOne) / 2;
|
||||
spacingOne4Header = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", headerFont).Height;
|
||||
spacingOneAndHalf4Header = (3 * spacingOne4Header) / 2;
|
||||
spacingOne4Footer = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", footerFont).Height;
|
||||
|
||||
TitleX = cfg.LeftMargin;
|
||||
TitleY = cfg.TopMargin;
|
||||
@@ -178,17 +185,27 @@ namespace Results.Output.Printers.Enhanced
|
||||
/// Prepare document outline
|
||||
///----------
|
||||
titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
|
||||
CommonTop = TitleY + titleHeight + SpacingOne4Header;
|
||||
CommonTop = TitleY + titleHeight + spacingOne4Header;
|
||||
|
||||
commonHeight = commonItems.Count * SpacingOne;
|
||||
BodyTop = CommonTop + commonHeight + SpacingOne4Header;
|
||||
commonHeight = commonItems.Count * spacingOne;
|
||||
BodyTop = CommonTop + commonHeight + spacingOne4Header;
|
||||
|
||||
Table table0 = Table.Create_TestsAreRows(batch.WaterMeters[0], testItems, style);
|
||||
SizeF tableSize = table0.Measure(e);
|
||||
int wmSectionHeight = (int)tableSize.Height + SpacingOne4Header * ((tableSize.Height > 0) ? 3 : 2);
|
||||
|
||||
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * SpacingOne) / wmSectionHeight;
|
||||
nrWMsOnNextPage = (printHeight - 2 * SpacingOne) / wmSectionHeight;
|
||||
if (cfg.BarcodeType == BarcodeType.None)
|
||||
{
|
||||
spacingAboveTable = spacingOneAndHalf4Header;
|
||||
}
|
||||
else
|
||||
{
|
||||
spacingAboveTable = Math.Max(spacingOneAndHalf4Header, cfg.BarcodeHeight + spacingOne4Header / 2);
|
||||
}
|
||||
spacingBelowTable = (tableSize.Height > 0) ? spacingOneAndHalf4Header : (spacingOne4Header / 2);
|
||||
|
||||
int wmSectionHeight = (int)tableSize.Height + spacingAboveTable + spacingBelowTable;
|
||||
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * spacingOne) / wmSectionHeight;
|
||||
nrWMsOnNextPage = (printHeight - 2 * spacingOne) / wmSectionHeight;
|
||||
nrWMsOnNextPage = Math.Max(nrWMsOnNextPage, 1); /// Prevent division by zero if there are too many WM tests
|
||||
|
||||
nrPages = 1 + (batch.WaterMeters.Count - nrWMsOnFirstPage + nrWMsOnNextPage - 1) / nrWMsOnNextPage;
|
||||
@@ -221,8 +238,8 @@ namespace Results.Output.Printers.Enhanced
|
||||
/// Write aligned columns
|
||||
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
|
||||
{
|
||||
PrintAt(e, leftMargin, CommonTop + SpacingOne * i, leftColumn[i]);
|
||||
PrintAt(e, 300, CommonTop + SpacingOne * i, rightColumn[i]);
|
||||
PrintAt(e, leftMargin, CommonTop + spacingOne * i, leftColumn[i]);
|
||||
PrintAt(e, 300, CommonTop + spacingOne * i, rightColumn[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +258,7 @@ namespace Results.Output.Printers.Enhanced
|
||||
int wmPosition = true ? batch.WaterMeters[wmNr].WMPosition : (wmNr + 1);
|
||||
if (!cfg.GoodOnly || batch.WaterMeters[wmNr].Passed)
|
||||
{
|
||||
nextWmTop = (int)PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop) + SpacingOneAndHalf4Header;
|
||||
nextWmTop = (int)PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop) + spacingBelowTable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,11 +269,11 @@ namespace Results.Output.Printers.Enhanced
|
||||
/// Footer
|
||||
///----------
|
||||
int footerWidth = (int)e.Graphics.MeasureString(footer, footerFont).Width;
|
||||
PrintFooterAt(e, leftMargin + (printWidth - footerWidth) / 2, topMargin + printHeight - 2 * SpacingOne, footer);
|
||||
PrintFooterAt(e, leftMargin + (printWidth - footerWidth) / 2, topMargin + printHeight - 2 * spacingOne, footer);
|
||||
|
||||
string pageNrText = string.Format("{0} {1}/{2}", Strings.Page, pageNr++, nrPages);
|
||||
int pageNrWidth = (int)e.Graphics.MeasureString(pageNrText, font).Width;
|
||||
PrintAt(e, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - SpacingOne, pageNrText);
|
||||
PrintAt(e, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - spacingOne, pageNrText);
|
||||
}
|
||||
|
||||
|
||||
@@ -270,25 +287,48 @@ namespace Results.Output.Printers.Enhanced
|
||||
float PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
|
||||
Results.Entities.WaterMeter wm, int printedWMNr, int top)
|
||||
{
|
||||
int tableTop = top + spacingAboveTable;
|
||||
|
||||
/// Print the water meter number and the serial number
|
||||
string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
|
||||
PrintHeaderAt(e, leftMargin, top, wmText);
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr))
|
||||
if (string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
PrintHeaderAt(e, leftMargin + (int)e.Graphics.MeasureString(wmText, headerFont).Width, top,
|
||||
string.Format(" {0} = {1}", Strings.sn, wm.SerialNr));
|
||||
string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
|
||||
int wmTextWidth = (int)e.Graphics.MeasureString(wmText, headerFont).Width;
|
||||
PrintHeaderAt(e, leftMargin, tableTop - spacingOneAndHalf4Header, wmText);
|
||||
}
|
||||
else
|
||||
{
|
||||
string wmText = string.Format("{0} {1} {2} = {3}", Strings.Water_Meter, printedWMNr, Strings.sn, wm.SerialNr);
|
||||
int wmTextWidth = (int)e.Graphics.MeasureString(wmText, headerFont).Width;
|
||||
PrintHeaderAt(e, leftMargin, tableTop - spacingOneAndHalf4Header, wmText);
|
||||
|
||||
switch (cfg.BarcodeType)
|
||||
{
|
||||
case BarcodeType.Code_128_Horizontally:
|
||||
{
|
||||
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
|
||||
e.Graphics.DrawImage(img, leftMargin + wmTextWidth + spacingOne4Header, top, cfg.BarcodeWidth, cfg.BarcodeHeight);
|
||||
break;
|
||||
}
|
||||
case BarcodeType.Code_128_Vertically:
|
||||
{
|
||||
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
|
||||
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
|
||||
e.Graphics.DrawImage(img, leftMargin + wmTextWidth + spacingOne4Header, top, cfg.BarcodeWidth, cfg.BarcodeHeight);
|
||||
break;
|
||||
}
|
||||
case BarcodeType.QR_Code:
|
||||
{
|
||||
QrCode qrCode = encoder.Encode(wm.SerialNr);
|
||||
DrawQR(e.Graphics, qrCode, leftMargin + wmTextWidth + spacingOne4Header, top, cfg.BarcodeWidth, cfg.BarcodeHeight);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Table table = Table.Create_TestsAreRows(wm, testItems, style);
|
||||
|
||||
if (table.IsEmpty())
|
||||
{
|
||||
return top;
|
||||
}
|
||||
else
|
||||
{
|
||||
return table.Draw(e, leftMargin, top + SpacingOneAndHalf4Header);
|
||||
}
|
||||
return table.IsEmpty() ? tableTop : table.Draw(e, leftMargin, tableTop);
|
||||
}
|
||||
|
||||
|
||||
@@ -298,7 +338,7 @@ namespace Results.Output.Printers.Enhanced
|
||||
}
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne);
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, spacingOne);
|
||||
e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
|
||||
}
|
||||
|
||||
@@ -309,7 +349,7 @@ namespace Results.Output.Printers.Enhanced
|
||||
}
|
||||
void PrintHeaderAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne4Header);
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, spacingOne4Header);
|
||||
e.Graphics.DrawString(text, this.headerFont, Brushes.Black, printArea);
|
||||
}
|
||||
|
||||
@@ -320,8 +360,33 @@ namespace Results.Output.Printers.Enhanced
|
||||
}
|
||||
void PrintFooterAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne4Footer);
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, spacingOne4Footer);
|
||||
e.Graphics.DrawString(text, this.footerFont, Brushes.Black, printArea);
|
||||
}
|
||||
|
||||
|
||||
public static void DrawQR(Graphics g, QrCode qrCode, float left, float top, float width, float height)
|
||||
{
|
||||
/// Assuming 100 dpi (printer)
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
|
||||
float qrPixWidth = width / qrCode.Matrix.Width;
|
||||
float qrPixHeight = height / qrCode.Matrix.Height;
|
||||
for (int i = 0; i < qrCode.Matrix.Height; i++)
|
||||
{
|
||||
for (int j = 0; j < qrCode.Matrix.Width; j++)
|
||||
{
|
||||
if (qrCode.Matrix[j, i])
|
||||
{
|
||||
g.FillRectangle(Brushes.Black, new RectangleF(left + j * qrPixWidth,
|
||||
top + i * qrPixHeight,
|
||||
qrPixWidth,
|
||||
qrPixHeight));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
|
||||
namespace Results.Output.Printers.Enhanced
|
||||
@@ -30,5 +30,8 @@ namespace Results.Output.Printers.Enhanced
|
||||
public string[] CommonItems;
|
||||
public string[] TestItems;
|
||||
public string Footer;
|
||||
}
|
||||
public BarcodeType BarcodeType; /// s/n is printed as barcode when valid (BarcodeType.None < BarcodeType < BarcodeType.Count)
|
||||
public int BarcodeWidth;
|
||||
public int BarcodeHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
///
|
||||
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using Config.Entities;
|
||||
using GenCode128;
|
||||
using Gma.QrCodeNet.Encoding;
|
||||
using Results.Resources;
|
||||
|
||||
namespace Results.Output.Printers.OnePerMeter
|
||||
@@ -16,7 +19,9 @@ namespace Results.Output.Printers.OnePerMeter
|
||||
const float GapBetweenTableColumns = 10;
|
||||
const float GapBetweenCommonColumns = 10;
|
||||
|
||||
/// Size of the printed area without margins, after taking into account 'pageOrientation'
|
||||
static QrEncoder encoder = new QrEncoder();
|
||||
|
||||
/// Size of the printed area without margins, after taking into account 'pageOrientation'
|
||||
readonly int printHeight;
|
||||
readonly int printWidth;
|
||||
|
||||
@@ -158,6 +163,30 @@ namespace Results.Output.Printers.OnePerMeter
|
||||
WMChart.GetChart(wm, true).Printing.PrintPaint(e.Graphics, pos);
|
||||
}
|
||||
|
||||
if (cfg.BarcodeType != BarcodeType.None && cfg.BarcodeType < BarcodeType.Count && !string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (cfg.BarcodeType == BarcodeType.QR_Code)
|
||||
{
|
||||
QrCode qrCode = encoder.Encode(wm.SerialNr);
|
||||
DrawQR(e.Graphics, qrCode, cfg.BarcodeLeft, cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
|
||||
}
|
||||
else if (cfg.BarcodeType == BarcodeType.Code_128_Horizontally || cfg.BarcodeType == BarcodeType.Code_128_Vertically)
|
||||
{
|
||||
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
|
||||
if (cfg.BarcodeType == BarcodeType.Code_128_Vertically)
|
||||
{
|
||||
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
|
||||
}
|
||||
e.Graphics.DrawImage(img, cfg.BarcodeLeft, cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
float tableTop = cfg.TopMargin;
|
||||
|
||||
if (pageNr == 1)
|
||||
@@ -351,5 +380,30 @@ namespace Results.Output.Printers.OnePerMeter
|
||||
|
||||
pageNr++;
|
||||
}
|
||||
|
||||
|
||||
public static void DrawQR(Graphics g, QrCode qrCode, float left, float top, float width, float height)
|
||||
{
|
||||
/// Assuming 100 dpi (printer)
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
|
||||
float qrPixWidth = width / qrCode.Matrix.Width;
|
||||
float qrPixHeight = height / qrCode.Matrix.Height;
|
||||
for (int i = 0; i < qrCode.Matrix.Height; i++)
|
||||
{
|
||||
for (int j = 0; j < qrCode.Matrix.Width; j++)
|
||||
{
|
||||
if (qrCode.Matrix[j, i])
|
||||
{
|
||||
g.FillRectangle(Brushes.Black, new RectangleF(left + j * qrPixWidth,
|
||||
top + i * qrPixHeight,
|
||||
qrPixWidth,
|
||||
qrPixHeight));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
|
||||
namespace Results.Output.Printers.OnePerMeter
|
||||
@@ -54,5 +54,10 @@ namespace Results.Output.Printers.OnePerMeter
|
||||
public int ImgWid;
|
||||
public int ImgHgh;
|
||||
public string ImgFullPathName;
|
||||
public BarcodeType BarcodeType; /// s/n is printed as barcode when valid (BarcodeType.None < BarcodeType < BarcodeType.Count)
|
||||
public int BarcodeLeft;
|
||||
public int BarcodeTop;
|
||||
public int BarcodeWidth;
|
||||
public int BarcodeHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace Results.Output
|
||||
Suez_EMP_DN32, /// EMP: 12 flow rates
|
||||
Suez_EMP_DN40, /// EMP: 12 flow rates
|
||||
Greece, /// Q3, Q2adj, Q2, Q1
|
||||
S620, /// Q3, Q100, Q2, Q1
|
||||
Count,
|
||||
None,
|
||||
}
|
||||
@@ -414,6 +415,16 @@ namespace Results.Output
|
||||
new SensusTestInfo("Q2", 2, "Q2", 2, "02", 2, "Q2", Range.R100_110),
|
||||
new SensusTestInfo("Q1", 1, "Q1", 1, "01", 1, "Q1", Range.R100_110),
|
||||
};
|
||||
|
||||
case LogType.S620:
|
||||
return new SensusTestInfo[]
|
||||
{
|
||||
/// TBF Oracle DB Opto RAW LU logfiles
|
||||
new SensusTestInfo("Q3", 5, "Q3", 5, "04", 5, "Q3", Range.R90_100),
|
||||
new SensusTestInfo("Q100", 4, "Q100l", 4, "03", 4,"Q100l", Range.R100_110),
|
||||
new SensusTestInfo("Q2", 2, "Q2", 2, "02", 2, "Q2", Range.R100_110),
|
||||
new SensusTestInfo("Q1", 1, "Q1", 1, "01", 1, "Q1", Range.R100_110),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Generated
+1
-1
@@ -19,7 +19,7 @@ namespace Results.Resources {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Strings {
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
<value>Ergebnisse</value>
|
||||
</data>
|
||||
<data name="Batch_nr" xml:space="preserve">
|
||||
<value>Stapel Nr.</value>
|
||||
<value>Los Nr.</value>
|
||||
</data>
|
||||
<data name="Bench" xml:space="preserve">
|
||||
<value>Prüfstand</value>
|
||||
@@ -154,13 +154,13 @@
|
||||
<value>Endzeit</value>
|
||||
</data>
|
||||
<data name="EndState_aux" xml:space="preserve">
|
||||
<value>Eindstand Nebenz.</value>
|
||||
<value>Endstand Nebenzähler</value>
|
||||
</data>
|
||||
<data name="EndState_main" xml:space="preserve">
|
||||
<value>Eindstand Hauptz.</value>
|
||||
<value>Endstand Hauptzähler</value>
|
||||
</data>
|
||||
<data name="End_state" xml:space="preserve">
|
||||
<value>Eindstand</value>
|
||||
<value>Endstand</value>
|
||||
</data>
|
||||
<data name="ErrLimHi" xml:space="preserve">
|
||||
<value>Fehlergrenze hoch</value>
|
||||
@@ -175,10 +175,10 @@
|
||||
<value>Referenzfehler</value>
|
||||
</data>
|
||||
<data name="Err_aux" xml:space="preserve">
|
||||
<value>Fehler Nebenz.</value>
|
||||
<value>Fehler Nebenzähler</value>
|
||||
</data>
|
||||
<data name="Err_main" xml:space="preserve">
|
||||
<value>Fehler Hauptz.</value>
|
||||
<value>Fehler Hauptzähler</value>
|
||||
</data>
|
||||
<data name="Flow" xml:space="preserve">
|
||||
<value>Durchfluss</value>
|
||||
@@ -187,13 +187,13 @@
|
||||
<value>Format</value>
|
||||
</data>
|
||||
<data name="H_amb" xml:space="preserve">
|
||||
<value>H umgebung</value>
|
||||
<value>Luftfeuchte Umgebung</value>
|
||||
</data>
|
||||
<data name="Item" xml:space="preserve">
|
||||
<value>Posten</value>
|
||||
<value>Objekt</value>
|
||||
</data>
|
||||
<data name="MClass" xml:space="preserve">
|
||||
<value>Metr. Klasse</value>
|
||||
<value>Metrologische Klasse</value>
|
||||
</data>
|
||||
<data name="OkBtnText" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
@@ -220,34 +220,34 @@
|
||||
<value>Impulse/l</value>
|
||||
</data>
|
||||
<data name="P_amb" xml:space="preserve">
|
||||
<value>Dr umgebung</value>
|
||||
<value>Druck amb. (Umgebungsdruck)</value>
|
||||
</data>
|
||||
<data name="P_dn_end" xml:space="preserve">
|
||||
<value>Dr aus ende</value>
|
||||
<value>Druck Eingang Prüfungsende</value>
|
||||
</data>
|
||||
<data name="P_dn" xml:space="preserve">
|
||||
<value>Dr aus</value>
|
||||
<value>Druck Eingang</value>
|
||||
</data>
|
||||
<data name="P_dn_start" xml:space="preserve">
|
||||
<value>Dr aus start</value>
|
||||
<value>Druck Eingang Prüfungsbeginn</value>
|
||||
</data>
|
||||
<data name="P_up_end" xml:space="preserve">
|
||||
<value>Dr ein ende</value>
|
||||
<value>Druck Ausgang Prüfungsende</value>
|
||||
</data>
|
||||
<data name="P_up" xml:space="preserve">
|
||||
<value>Dr ein</value>
|
||||
<value>Druck Ausgang</value>
|
||||
</data>
|
||||
<data name="P_up_start" xml:space="preserve">
|
||||
<value>Dr ein start</value>
|
||||
<value>Druck Ausgang Prüfungsanfang</value>
|
||||
</data>
|
||||
<data name="Q_fall" xml:space="preserve">
|
||||
<value>Q fall</value>
|
||||
<value>Q Fall </value>
|
||||
</data>
|
||||
<data name="Q_from" xml:space="preserve">
|
||||
<value>Q von</value>
|
||||
</data>
|
||||
<data name="Q_rise" xml:space="preserve">
|
||||
<value>Q steig</value>
|
||||
<value>Q Steig</value>
|
||||
</data>
|
||||
<data name="Q_to" xml:space="preserve">
|
||||
<value>Q bis</value>
|
||||
@@ -292,13 +292,13 @@
|
||||
<value>Prüfvolumen</value>
|
||||
</data>
|
||||
<data name="T_amb" xml:space="preserve">
|
||||
<value>T umgebung</value>
|
||||
<value>T Umgebung</value>
|
||||
</data>
|
||||
<data name="T_div" xml:space="preserve">
|
||||
<value>T div</value>
|
||||
<value>T Umschaltung</value>
|
||||
</data>
|
||||
<data name="T_end" xml:space="preserve">
|
||||
<value>Endzeit</value>
|
||||
<value>T Ende</value>
|
||||
</data>
|
||||
<data name="T_in" xml:space="preserve">
|
||||
<value>T ein</value>
|
||||
@@ -364,13 +364,13 @@
|
||||
<value>Hersteller</value>
|
||||
</data>
|
||||
<data name="Meter_type" xml:space="preserve">
|
||||
<value>Typ</value>
|
||||
<value>WZ-Typ</value>
|
||||
</data>
|
||||
<data name="Compound" xml:space="preserve">
|
||||
<value>Verbund</value>
|
||||
<value>Verbundzähler</value>
|
||||
</data>
|
||||
<data name="Heat_meter" xml:space="preserve">
|
||||
<value />
|
||||
<value>Wärmezähler</value>
|
||||
</data>
|
||||
<data name="Single" xml:space="preserve">
|
||||
<value>Einzel</value>
|
||||
@@ -382,16 +382,16 @@
|
||||
<value>Größe</value>
|
||||
</data>
|
||||
<data name="Page" xml:space="preserve">
|
||||
<value>Blz.</value>
|
||||
<value>Seite</value>
|
||||
</data>
|
||||
<data name="Water_Meter" xml:space="preserve">
|
||||
<value>Wasserzähler</value>
|
||||
</data>
|
||||
<data name="aux" xml:space="preserve">
|
||||
<value>Nebenz.</value>
|
||||
<value>Nebenzähler</value>
|
||||
</data>
|
||||
<data name="main" xml:space="preserve">
|
||||
<value>Hauptz.</value>
|
||||
<value>Hauptzähler</value>
|
||||
</data>
|
||||
<data name="fall" xml:space="preserve">
|
||||
<value>fall</value>
|
||||
@@ -409,6 +409,420 @@
|
||||
<value>Masse</value>
|
||||
</data>
|
||||
<data name="Density_correction" xml:space="preserve">
|
||||
<value>Dichtekorektur</value>
|
||||
<value>Dichtekorrektur</value>
|
||||
</data>
|
||||
<data name="Energy" xml:space="preserve">
|
||||
<value>Energie</value>
|
||||
</data>
|
||||
<data name="Energy_ref" xml:space="preserve">
|
||||
<value>Energie ref.</value>
|
||||
</data>
|
||||
<data name="P_delta" xml:space="preserve">
|
||||
<value>Druckdifferenz </value>
|
||||
</data>
|
||||
<data name="P_delta_end" xml:space="preserve">
|
||||
<value>Druckdifferenz Ende Prüfung</value>
|
||||
</data>
|
||||
<data name="P_delta_mean" xml:space="preserve">
|
||||
<value>Druckdifferenz Delta Prüfung </value>
|
||||
</data>
|
||||
<data name="P_delta_start" xml:space="preserve">
|
||||
<value>Druckdifferenz Beginn Prüfung</value>
|
||||
</data>
|
||||
<data name="End_volume" xml:space="preserve">
|
||||
<value>Ende Volumen</value>
|
||||
</data>
|
||||
<data name="Start_volume" xml:space="preserve">
|
||||
<value>Start Volumen</value>
|
||||
</data>
|
||||
<data name="End_volume_aux" xml:space="preserve">
|
||||
<value>Ende Volumen Nebenzähler</value>
|
||||
</data>
|
||||
<data name="End_volume_main" xml:space="preserve">
|
||||
<value>Ende Volumen Hauptzähler</value>
|
||||
</data>
|
||||
<data name="Start_volume_aux" xml:space="preserve">
|
||||
<value>Start Volumen Nebenzähler</value>
|
||||
</data>
|
||||
<data name="Start_volume_main" xml:space="preserve">
|
||||
<value>Start Volumen Hauptzähler</value>
|
||||
</data>
|
||||
<data name="Volume_aux" xml:space="preserve">
|
||||
<value>Volumen Nebenzähler</value>
|
||||
</data>
|
||||
<data name="Volume_main" xml:space="preserve">
|
||||
<value>Volumen Hauptzähler</value>
|
||||
</data>
|
||||
<data name="End_mass" xml:space="preserve">
|
||||
<value>End Prüfung</value>
|
||||
</data>
|
||||
<data name="Start_mass" xml:space="preserve">
|
||||
<value>Start Prüfung</value>
|
||||
</data>
|
||||
<data name="VName_Flow" xml:space="preserve">
|
||||
<value>Q</value>
|
||||
</data>
|
||||
<data name="VName_Press" xml:space="preserve">
|
||||
<value>Druck</value>
|
||||
</data>
|
||||
<data name="VName_Temp" xml:space="preserve">
|
||||
<value>Temperatur</value>
|
||||
</data>
|
||||
<data name="VName_Dens" xml:space="preserve">
|
||||
<value>Ro</value>
|
||||
</data>
|
||||
<data name="VName_Humi" xml:space="preserve">
|
||||
<value>Hu</value>
|
||||
</data>
|
||||
<data name="VName_TstTime" xml:space="preserve">
|
||||
<value>Tau</value>
|
||||
</data>
|
||||
<data name="VName_Vol" xml:space="preserve">
|
||||
<value>Vol.</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_de_ac" xml:space="preserve">
|
||||
<value>Druckdifferenz gemessen von Druckgeber aktuell</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_de_avg" xml:space="preserve">
|
||||
<value>Druckdifferenz gemessen von Druckgeber Mittelwert</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_de_en" xml:space="preserve">
|
||||
<value>Druckdifferenz gemessen von Druckgeber am Prüfungsende</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_de_me" xml:space="preserve">
|
||||
<value>Druckdifferenz gemessen von Druckgeber-Durchschnitt </value>
|
||||
</data>
|
||||
<data name="Tooltip_P_de_st" xml:space="preserve">
|
||||
<value>Druckdifferenz gemessen von Druckgeber am Prüfungsbeginn</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_dw_ac" xml:space="preserve">
|
||||
<value>Druck am Prüfstreckenausgang aktuell</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_dw_avg" xml:space="preserve">
|
||||
<value>Druck Mittelwert am Prüfstreckenausgang</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_dw_en" xml:space="preserve">
|
||||
<value>Druck am Prüfstreckenausgang am Ende der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_dw_me" xml:space="preserve">
|
||||
<value>Druck Durchnschnitt am Prüfstreckenausgang</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_dw_st" xml:space="preserve">
|
||||
<value>Hauptdruck am Ausgang bei Prüfbeginn</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_up_ac" xml:space="preserve">
|
||||
<value>Hauptdruck am Eingang aktuell</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_up_avg" xml:space="preserve">
|
||||
<value>Druck Mittelwert am Prüfstreckeneingang</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_up_en" xml:space="preserve">
|
||||
<value>Druck am Prüfstreckeneingang am Ende der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_up_me" xml:space="preserve">
|
||||
<value>Druck Durchnschnitt am Prüfstreckeneingang</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_up_st" xml:space="preserve">
|
||||
<value>Druck am Prüfstreckeneingang bei Prüfbeginn</value>
|
||||
</data>
|
||||
<data name="Tooltip_Q_m_r" xml:space="preserve">
|
||||
<value>Durchfluss berechnet von Masse der Waage und Zeit </value>
|
||||
</data>
|
||||
<data name="Tooltip_Q_riac" xml:space="preserve">
|
||||
<value>Durchfluss angezeigt von NHO/ aktuell</value>
|
||||
</data>
|
||||
<data name="Tooltip_Q_rim" xml:space="preserve">
|
||||
<value>Durchfluss von aktuellem NHO/ Durchnschnitt</value>
|
||||
</data>
|
||||
<data name="Tooltip_Q_v_r" xml:space="preserve">
|
||||
<value>Durchfluss von aktuellem Refferenzzähler</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_di_ac" xml:space="preserve">
|
||||
<value>Temperatur aktuell an der Umschaltung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_di_avg" xml:space="preserve">
|
||||
<value>Temperatur-Mittelwert an der Umschaltung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_di_en" xml:space="preserve">
|
||||
<value>Temperatur Umschaltung am Prüfungsende (4 letzten Messungen)</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_di_me" xml:space="preserve">
|
||||
<value>Temperatur-Durchschnitt an der Umschaltung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_di_st" xml:space="preserve">
|
||||
<value>Temperatur Umschaltung am Prüfungsanfang (4 ersten Messungen)</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_dw_ac" xml:space="preserve">
|
||||
<value>Temperatur aktuell am Prüfstreckenausgang</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_dw_avg" xml:space="preserve">
|
||||
<value>Temperatur-Mittelwert am Prüstreckenausgang</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_dw_en" xml:space="preserve">
|
||||
<value>Temperatur Prüfstreckenausgang am Prüfungsende ( 4 letzten Messungen)</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_dw_me" xml:space="preserve">
|
||||
<value>Temperatur-Durchschnitt am Prüstreckenausgang</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_dw_st" xml:space="preserve">
|
||||
<value>Temperatur Prüfstreckenausgang am Prüfungsanfang( 4 ersten Messungen)</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_ac" xml:space="preserve">
|
||||
<value>Temperatur aktuell am Prüfstreckeneingang</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_avg" xml:space="preserve">
|
||||
<value>Temperatur-Mittelwert am Prüstreckeneingang während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_en" xml:space="preserve">
|
||||
<value>Temperatur Prüfstreckeneingang und -Ausgang am Prüfungsanfang( 4 Messungen bevor Ende)</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_me" xml:space="preserve">
|
||||
<value>Temperatur-Durchschnitt am Prüfstreckeneingang wärend der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_st" xml:space="preserve">
|
||||
<value>Temperatur Prüstreckeneingang am Prüfungsbeginn (4 Messungen nach Beginn)</value>
|
||||
</data>
|
||||
<data name="Tooltip_E_rel" xml:space="preserve">
|
||||
<value>Relative Messabweichung eines WZ</value>
|
||||
</data>
|
||||
<data name="Tooltip_E_rel_ref" xml:space="preserve">
|
||||
<value>Relative Messabweichung des NHO</value>
|
||||
</data>
|
||||
<data name="Tooltip_sn" xml:space="preserve">
|
||||
<value>Serie Nr. des WZ</value>
|
||||
</data>
|
||||
<data name="Tooltip_sn_aux" xml:space="preserve">
|
||||
<value>Serie Nr. des Nebenzählers (Verbundzähler)</value>
|
||||
</data>
|
||||
<data name="Tooltip_sn_main" xml:space="preserve">
|
||||
<value>Serie Nr. des Hauptzählers (Verbundzähler)</value>
|
||||
</data>
|
||||
<data name="Tooltip_Vol_Mt" xml:space="preserve">
|
||||
<value>Volumen gemessen vom geprüften WZ</value>
|
||||
</data>
|
||||
<data name="Tooltip_Vol_rm" xml:space="preserve">
|
||||
<value>Refferenz-Volumen vom geprüften WZ</value>
|
||||
</data>
|
||||
<data name="VName_Error" xml:space="preserve">
|
||||
<value>E</value>
|
||||
</data>
|
||||
<data name="Tooltip_Hu_Amb_M" xml:space="preserve">
|
||||
<value>Umgebungs-Luftfeuchtigkeit während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_Amb_M" xml:space="preserve">
|
||||
<value>Umgebungs-Druck während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_Amb_M" xml:space="preserve">
|
||||
<value>Umgebungs-Temperatur während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Test_done" xml:space="preserve">
|
||||
<value>Prüfung erledigt</value>
|
||||
</data>
|
||||
<data name="Test_passed" xml:space="preserve">
|
||||
<value>Prüfung beendet</value>
|
||||
</data>
|
||||
<data name="No" xml:space="preserve">
|
||||
<value>Nein</value>
|
||||
</data>
|
||||
<data name="Yes" xml:space="preserve">
|
||||
<value>Ja</value>
|
||||
</data>
|
||||
<data name="Error_flags" xml:space="preserve">
|
||||
<value>Fehlerflags</value>
|
||||
</data>
|
||||
<data name="Legalizator" xml:space="preserve">
|
||||
<value>Prüfstellenleiter</value>
|
||||
</data>
|
||||
<data name="User_description" xml:space="preserve">
|
||||
<value>Benutzerbeschreibung</value>
|
||||
</data>
|
||||
<data name="Failed_meters_count" xml:space="preserve">
|
||||
<value>WZ-Prüfung nicht bestanden</value>
|
||||
</data>
|
||||
<data name="Passed_meters_count" xml:space="preserve">
|
||||
<value>WZ-Prüfung bestanden</value>
|
||||
</data>
|
||||
<data name="sensitivity" xml:space="preserve">
|
||||
<value>Empfindlichkeit</value>
|
||||
</data>
|
||||
<data name="Tooltip_Q_end" xml:space="preserve">
|
||||
<value>Durchflusswert vom NHO-am Prüfungsende</value>
|
||||
</data>
|
||||
<data name="Tooltip_Q_max" xml:space="preserve">
|
||||
<value>Durchflusswert vom NHO-max</value>
|
||||
</data>
|
||||
<data name="Tooltip_Q_min" xml:space="preserve">
|
||||
<value>Durchflusswert vom NHO-min</value>
|
||||
</data>
|
||||
<data name="Tooltip_Q_start" xml:space="preserve">
|
||||
<value>Durchflusswert vom NHO-am Prüfungsanfang</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_dw_max" xml:space="preserve">
|
||||
<value>Druck max. am Prüfstandsausgang während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_dw_min" xml:space="preserve">
|
||||
<value>Druck min. am Prüfstandsausgang während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_up_max" xml:space="preserve">
|
||||
<value>Druck max. am Prüfstandseingang während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_up_min" xml:space="preserve">
|
||||
<value>Druck min. am Prüfstandseingang während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_di_max" xml:space="preserve">
|
||||
<value>Temp. max. an der Umschaltung während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_di_min" xml:space="preserve">
|
||||
<value>Temp. min. an der Umschaltung während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_dw_max" xml:space="preserve">
|
||||
<value>Temp. max am Prüfstandsausgang während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_dw_min" xml:space="preserve">
|
||||
<value>Temp. min. am Prüfstandsausgang während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_max" xml:space="preserve">
|
||||
<value>Temp. max am Prüfstandseingang während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_up_min" xml:space="preserve">
|
||||
<value>Temp. min am Prüfstandseingang während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_de_max" xml:space="preserve">
|
||||
<value>Druckdifferenz gemessen von Delta P /WZ max. während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_P_de_min" xml:space="preserve">
|
||||
<value>Druckdifferenz gemessen von Delta P /WZ min. während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_Rho_Wa_calc" xml:space="preserve">
|
||||
<value>Dichte vom Wasser aus Tabelle oder Formel</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_rho_0" xml:space="preserve">
|
||||
<value>Temperatur von der Wasserprobe bei der Dichtekalibrierung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_ac" xml:space="preserve">
|
||||
<value>Temperatur aktuell in der Prüfstrecke</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_avg" xml:space="preserve">
|
||||
<value>Temperatur-Mittelwert in der Prüfstrecke während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_en" xml:space="preserve">
|
||||
<value>Temperatur in der Prüfstrecke am Ende der Prüfung -4 letzten Messungen</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_max" xml:space="preserve">
|
||||
<value>Temperatur max. in der Prüfstrecke während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_me" xml:space="preserve">
|
||||
<value>Temperatur-Durchschnitt in der Prüfstrecke während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_min" xml:space="preserve">
|
||||
<value>Temperatur min. in der Prüfstrecke während der Prüfung</value>
|
||||
</data>
|
||||
<data name="Tooltip_T_ln_st" xml:space="preserve">
|
||||
<value>Temperatur in der Prüfstrecke am Anfang der Prüfung -4 ersten Messungen</value>
|
||||
</data>
|
||||
<data name="Unit" xml:space="preserve">
|
||||
<value>Einheit</value>
|
||||
</data>
|
||||
<data name="Procedure_description" xml:space="preserve">
|
||||
<value>Prüfprozess Beschreibung</value>
|
||||
</data>
|
||||
<data name="Bench_ID" xml:space="preserve">
|
||||
<value>Prüfstand ID</value>
|
||||
</data>
|
||||
<data name="Bench_name" xml:space="preserve">
|
||||
<value>Prüfstamdsname</value>
|
||||
</data>
|
||||
<data name="Address" xml:space="preserve">
|
||||
<value>Adresse</value>
|
||||
</data>
|
||||
<data name="Tooltip_E_rel_last" xml:space="preserve">
|
||||
<value>Relativer Fehler vom WZ in vorheriger Prüfung/ in Produktion</value>
|
||||
</data>
|
||||
<data name="Batch" xml:space="preserve">
|
||||
<value>Zälerlos</value>
|
||||
</data>
|
||||
<data name="repetition" xml:space="preserve">
|
||||
<value>Wiederholung</value>
|
||||
</data>
|
||||
<data name="Invalid_Q2_correction_factors" xml:space="preserve">
|
||||
<value>Fehlerhafter Q2 Korrektur-Faktor</value>
|
||||
</data>
|
||||
<data name="Previous_step_is_missing_or_NOK" xml:space="preserve">
|
||||
<value>Vorgehender Schritt fehlt oder nicht OK</value>
|
||||
</data>
|
||||
<data name="Test_repetition_count_exceeded_upper_limit" xml:space="preserve">
|
||||
<value>Prüfungswiederholung Anzahl überschritten!</value>
|
||||
</data>
|
||||
<data name="Wrong_iPerl_counting_direction" xml:space="preserve">
|
||||
<value>Falsche iPERL Durchflussrichtung</value>
|
||||
</data>
|
||||
<data name="Failed" xml:space="preserve">
|
||||
<value>Nicht OK</value>
|
||||
</data>
|
||||
<data name="Passed" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name="Test_in_progress" xml:space="preserve">
|
||||
<value>Prüfung läuft</value>
|
||||
</data>
|
||||
<data name="Counter_0" xml:space="preserve">
|
||||
<value>Zähler {0}</value>
|
||||
</data>
|
||||
<data name="Date_and_time" xml:space="preserve">
|
||||
<value>Datum und Zeit</value>
|
||||
</data>
|
||||
<data name="Name" xml:space="preserve">
|
||||
<value>Name</value>
|
||||
</data>
|
||||
<data name="Step" xml:space="preserve">
|
||||
<value>Schritt</value>
|
||||
</data>
|
||||
<data name="Workplace" xml:space="preserve">
|
||||
<value>Arbeitsplatz</value>
|
||||
</data>
|
||||
<data name="Workflow" xml:space="preserve">
|
||||
<value>Arbeitsablauf</value>
|
||||
</data>
|
||||
<data name="Production_tracing_results" xml:space="preserve">
|
||||
<value>Produktion Ergebnisse verfolgen</value>
|
||||
</data>
|
||||
<data name="Code" xml:space="preserve">
|
||||
<value>Code</value>
|
||||
</data>
|
||||
<data name="Part" xml:space="preserve">
|
||||
<value>Teil</value>
|
||||
</data>
|
||||
<data name="All_results" xml:space="preserve">
|
||||
<value>Alle Ergebnisse</value>
|
||||
</data>
|
||||
<data name="Graphs" xml:space="preserve">
|
||||
<value>Graphiken</value>
|
||||
</data>
|
||||
<data name="No_water_meter" xml:space="preserve">
|
||||
<value>Kein WZ</value>
|
||||
</data>
|
||||
<data name="Serial_number_is_missing" xml:space="preserve">
|
||||
<value>Serie Nr. fehlt.</value>
|
||||
</data>
|
||||
<data name="Lower_limit" xml:space="preserve">
|
||||
<value>Untere Grenze</value>
|
||||
</data>
|
||||
<data name="Upper_limit" xml:space="preserve">
|
||||
<value>Obere Grenze</value>
|
||||
</data>
|
||||
<data name="Water_meter_results" xml:space="preserve">
|
||||
<value>WZ Ergebnisse</value>
|
||||
</data>
|
||||
<data name="Relative_error" xml:space="preserve">
|
||||
<value>Relativer Fehler</value>
|
||||
</data>
|
||||
<data name="This_position_is_disabled" xml:space="preserve">
|
||||
<value>Position nicht aktiviert.</value>
|
||||
</data>
|
||||
<data name="Available_items" xml:space="preserve">
|
||||
<value>Verfügbare Positionen</value>
|
||||
</data>
|
||||
<data name="Selected_items" xml:space="preserve">
|
||||
<value>Ausgewählte Objekte</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -336,7 +336,7 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result, Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr(f)
|
||||
: ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr(f))));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.ThreeState, "Three state result", Quantity.Enum, ItemCategory.MeterResult, (w, t, u, f, p) => FormatThreeState(f, w.ThreeStateFromTests())));
|
||||
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.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace ResultsBrowser
|
||||
ListOfSerialNumbers,
|
||||
WZTypeIdAndTimePeriod,
|
||||
ProducedWithinTimePeriod,
|
||||
BenchAndBatchNr,
|
||||
Count,
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace ResultsBrowser.Forms
|
||||
//queryTypeComboBox.Items.Add(new CQSelectionItem(CQCriteria.ListOfSerialNumbers, "Všetky vodomery so sériovými číslami podľa zadaného zoznamu"));
|
||||
queryTypeComboBox.Items.Add(new CQSelectionItem(CQCriteria.WZTypeIdAndTimePeriod, "Všetky vodomery so zadaným WZTypeID vyrobené v zadanom časovom období"));
|
||||
queryTypeComboBox.Items.Add(new CQSelectionItem(CQCriteria.ProducedWithinTimePeriod, "Všetky vodomery vyrobené v zadanom časovom období"));
|
||||
queryTypeComboBox.Items.Add(new CQSelectionItem(CQCriteria.BenchAndBatchNr, "Stanica a číslo dávky"));
|
||||
queryTypeComboBox.Text = "Všetky vodomery vyrobené v zadanom časovom období";
|
||||
|
||||
destinationFileTextBox.Text = string.Format("vysledky_hladania_{0:ddMMyyyy_HHmm}.csv", DateTime.Now);
|
||||
@@ -68,7 +69,8 @@ namespace ResultsBrowser.Forms
|
||||
/// Update UI elements visibility
|
||||
inputListGroupBox.Enabled = (CQCriteria == CQCriteria.ListOfOrders) ||
|
||||
(CQCriteria == CQCriteria.ListOfPcbNumbers) ||
|
||||
(CQCriteria == CQCriteria.ListOfSerialNumbers);
|
||||
(CQCriteria == CQCriteria.ListOfSerialNumbers) ||
|
||||
(CQCriteria == CQCriteria.BenchAndBatchNr);
|
||||
|
||||
timePeriodGroupBox.Enabled = (CQCriteria == CQCriteria.WZTypeIdAndTimePeriod) ||
|
||||
(CQCriteria == CQCriteria.ProducedWithinTimePeriod);
|
||||
@@ -78,6 +80,11 @@ namespace ResultsBrowser.Forms
|
||||
parameterGroupBox.Enabled = true;
|
||||
parameterNameLabel.Text = "WZ Type ID";
|
||||
}
|
||||
else if (CQCriteria == CQCriteria.BenchAndBatchNr)
|
||||
{
|
||||
parameterGroupBox.Enabled = true;
|
||||
parameterNameLabel.Text = "Test bench number (e.g. 10 for WR10)";
|
||||
}
|
||||
else
|
||||
{
|
||||
parameterGroupBox.Enabled = false;
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name="Print_query_results" xml:space="preserve">
|
||||
<value>Ergebnise drucken</value>
|
||||
<value>Ergebnisse Abfrage Drucken</value>
|
||||
</data>
|
||||
<data name="Procedure" xml:space="preserve">
|
||||
<value>Prüfvorlage</value>
|
||||
@@ -172,7 +172,7 @@
|
||||
<value>Protokoll</value>
|
||||
</data>
|
||||
<data name="Query_results" xml:space="preserve">
|
||||
<value>Ergebnisse</value>
|
||||
<value>Abfrageergebnisse</value>
|
||||
</data>
|
||||
<data name="Results_Browser" xml:space="preserve">
|
||||
<value>Analyse der Ergebnisse</value>
|
||||
@@ -199,7 +199,7 @@
|
||||
<value>Statistiken</value>
|
||||
</data>
|
||||
<data name="Test" xml:space="preserve">
|
||||
<value>Prüfpunkt</value>
|
||||
<value>Prüfung</value>
|
||||
</data>
|
||||
<data name="Test_bench" xml:space="preserve">
|
||||
<value>Prüfstand</value>
|
||||
@@ -231,4 +231,76 @@
|
||||
<data name="Print" xml:space="preserve">
|
||||
<value>Drucken</value>
|
||||
</data>
|
||||
<data name="Name" xml:space="preserve">
|
||||
<value>Name</value>
|
||||
</data>
|
||||
<data name="ConfigureDatabaseText" xml:space="preserve">
|
||||
<value>Password für Prüfstand configurieren</value>
|
||||
</data>
|
||||
<data name="ExitBtnText" xml:space="preserve">
|
||||
<value>Exit</value>
|
||||
</data>
|
||||
<data name="Component" xml:space="preserve">
|
||||
<value>Komponenten</value>
|
||||
</data>
|
||||
<data name="Configure" xml:space="preserve">
|
||||
<value>Konfigurieren</value>
|
||||
</data>
|
||||
<data name="Printer" xml:space="preserve">
|
||||
<value>Drucker</value>
|
||||
</data>
|
||||
<data name="Question" xml:space="preserve">
|
||||
<value>Fragen</value>
|
||||
</data>
|
||||
<data name="Add" xml:space="preserve">
|
||||
<value>&Hinzufügen</value>
|
||||
</data>
|
||||
<data name="Message" xml:space="preserve">
|
||||
<value>Nachricht</value>
|
||||
</data>
|
||||
<data name="Data" xml:space="preserve">
|
||||
<value>Daten</value>
|
||||
</data>
|
||||
<data name="All_files" xml:space="preserve">
|
||||
<value>Alle Dateien</value>
|
||||
</data>
|
||||
<data name="Query_files" xml:space="preserve">
|
||||
<value>Abfragedateien</value>
|
||||
</data>
|
||||
<data name="No_program_settings_found" xml:space="preserve">
|
||||
<value>Programmeinstellungen nicht gefunden</value>
|
||||
</data>
|
||||
<data name="Using_default_settings" xml:space="preserve">
|
||||
<value>Einstellungen Vorgaben benutzen.</value>
|
||||
</data>
|
||||
<data name="Selected_language_not_supported" xml:space="preserve">
|
||||
<value>Ausgewählte Sprache wird nicht unterstützt.</value>
|
||||
</data>
|
||||
<data name="Using_English" xml:space="preserve">
|
||||
<value>Englische Sprache benutzen!</value>
|
||||
</data>
|
||||
<data name="Warning" xml:space="preserve">
|
||||
<value>Warnung</value>
|
||||
</data>
|
||||
<data name="Format" xml:space="preserve">
|
||||
<value>Formatieren</value>
|
||||
</data>
|
||||
<data name="Configure_printer" xml:space="preserve">
|
||||
<value>Drucker konfigurieren.</value>
|
||||
</data>
|
||||
<data name="No_printer_defined" xml:space="preserve">
|
||||
<value>Kein Drucker ausgewählt.</value>
|
||||
</data>
|
||||
<data name="Printing_failed" xml:space="preserve">
|
||||
<value>Druck fehlgeschlagen</value>
|
||||
</data>
|
||||
<data name="Printing_completed" xml:space="preserve">
|
||||
<value>Druck vollständig</value>
|
||||
</data>
|
||||
<data name="Error_exporting_results" xml:space="preserve">
|
||||
<value>Fehler beim exportieren der Ergebnisse!</value>
|
||||
</data>
|
||||
<data name="Histograms" xml:space="preserve">
|
||||
<value>Histogramm</value>
|
||||
</data>
|
||||
</root>
|
||||
+1
-1
@@ -19,7 +19,7 @@ namespace ResultsBrowser.Resources {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Strings {
|
||||
|
||||
+168
-105
@@ -28,8 +28,8 @@ namespace ResultsBrowser
|
||||
|
||||
IList<WaterMeter> waterMeters;
|
||||
|
||||
DateTime timePeriodStart;
|
||||
DateTime timePeriodEnd;
|
||||
DateTime timePeriodStart;
|
||||
DateTime timePeriodEnd;
|
||||
|
||||
static IList<IComponent> tbfComponents;
|
||||
static IList<IDevice> tbfDevices;
|
||||
@@ -47,9 +47,9 @@ namespace ResultsBrowser
|
||||
tbfComponents = new List<TBF.BenchControl.Generic.IComponent>();
|
||||
tbfDevices = new List<IDevice>();
|
||||
|
||||
timePeriodStart = new DateTime(0);
|
||||
timePeriodEnd = new DateTime(0);
|
||||
}
|
||||
timePeriodStart = new DateTime(0);
|
||||
timePeriodEnd = new DateTime(0);
|
||||
}
|
||||
|
||||
private void ResultsBrowserWnd_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -102,15 +102,15 @@ namespace ResultsBrowser
|
||||
checkBox6.Visible = !string.IsNullOrEmpty(checkBox6.Text);
|
||||
}
|
||||
|
||||
string BenchName()
|
||||
{
|
||||
return checkBox1.Checked ? Program.LocalSettings.Bench1
|
||||
: checkBox2.Checked ? Program.LocalSettings.Bench2
|
||||
: checkBox3.Checked ? Program.LocalSettings.Bench3
|
||||
: checkBox4.Checked ? Program.LocalSettings.Bench4
|
||||
string BenchName()
|
||||
{
|
||||
return checkBox1.Checked ? Program.LocalSettings.Bench1
|
||||
: checkBox2.Checked ? Program.LocalSettings.Bench2
|
||||
: checkBox3.Checked ? Program.LocalSettings.Bench3
|
||||
: checkBox4.Checked ? Program.LocalSettings.Bench4
|
||||
: checkBox5.Checked ? Program.LocalSettings.Bench5
|
||||
: Program.LocalSettings.Bench6;
|
||||
}
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
@@ -118,19 +118,19 @@ namespace ResultsBrowser
|
||||
resultsGroupBox.Text = Strings.Query_results;
|
||||
settingsBtn.Text = Strings.Settings;
|
||||
testBenchesGroupBox.Text = Strings.Test_benches;
|
||||
|
||||
clearFiltersBtn.Text = Strings.Clear_filters;
|
||||
|
||||
clearFiltersBtn.Text = Strings.Clear_filters;
|
||||
addFilterBtn.Text = Strings.Add_filter;
|
||||
formatOfResultsBtn.Text = Strings.Format_of_results;
|
||||
printerConfigBtn.Text = Strings.Configure_printer;
|
||||
loadConfigBtn.Text = Strings.Load_filters;
|
||||
formatOfResultsBtn.Text = Strings.Format_of_results;
|
||||
printerConfigBtn.Text = Strings.Configure_printer;
|
||||
loadConfigBtn.Text = Strings.Load_filters;
|
||||
saveConfigBtn.Text = Strings.Save_filters;
|
||||
|
||||
executeQueryBtn.Text = Strings.Execute_query;
|
||||
|
||||
executeQueryBtn.Text = Strings.Execute_query;
|
||||
exportQueryResultsBtn.Text = Strings.Export_query_results;
|
||||
printQueryResultsBtn.Text = Strings.Print_query_results;
|
||||
|
||||
statisticsBtn.Text = Strings.Statistics;
|
||||
|
||||
statisticsBtn.Text = Strings.Statistics;
|
||||
}
|
||||
|
||||
private void settingsBtn_Click(object sender, EventArgs e)
|
||||
@@ -176,40 +176,40 @@ namespace ResultsBrowser
|
||||
}
|
||||
}
|
||||
|
||||
private void formatOfResultsBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg();
|
||||
dlg.MetersKind = Config.Entities.MetersKind.Single;
|
||||
dlg.SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
|
||||
private void formatOfResultsBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg();
|
||||
dlg.MetersKind = Config.Entities.MetersKind.Single;
|
||||
dlg.SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
filtersConfig.ResultItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
RedrawResults();
|
||||
}
|
||||
}
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
filtersConfig.ResultItems = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
|
||||
RedrawResults();
|
||||
}
|
||||
}
|
||||
|
||||
private void printerConfigBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Forms.PrinterConfigDlg dlg = new Forms.PrinterConfigDlg
|
||||
{
|
||||
PrinterClass = filtersConfig.PrinterClass,
|
||||
PrinterCfg = filtersConfig.PrinterCfg
|
||||
};
|
||||
private void printerConfigBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Forms.PrinterConfigDlg dlg = new Forms.PrinterConfigDlg
|
||||
{
|
||||
PrinterClass = filtersConfig.PrinterClass,
|
||||
PrinterCfg = filtersConfig.PrinterCfg
|
||||
};
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
filtersConfig.PrinterClass = dlg.PrinterClass;
|
||||
filtersConfig.PrinterCfg = dlg.PrinterCfg;
|
||||
}
|
||||
}
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
filtersConfig.PrinterClass = dlg.PrinterClass;
|
||||
filtersConfig.PrinterCfg = dlg.PrinterCfg;
|
||||
}
|
||||
}
|
||||
|
||||
private void loadConfigBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
dlg.Filter = string.Format("{0} (*.qry)|*.qry|{1} (*.*)|*.*", Strings.Query_files, Strings.All_files);
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
dlg.Filter = string.Format("{0} (*.qry)|*.qry|{1} (*.*)|*.*", Strings.Query_files, Strings.All_files);
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadConfigFromFile(dlg.FileName);
|
||||
}
|
||||
}
|
||||
@@ -269,8 +269,8 @@ namespace ResultsBrowser
|
||||
|
||||
private void executeQueryBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
timePeriodStart = new DateTime(0);
|
||||
timePeriodEnd = new DateTime(0);
|
||||
timePeriodStart = new DateTime(0);
|
||||
timePeriodEnd = new DateTime(0);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -291,11 +291,11 @@ namespace ResultsBrowser
|
||||
|
||||
foreach (var filter in filters)
|
||||
{
|
||||
if (filter is DateFilter)
|
||||
{
|
||||
timePeriodStart = (filter as DateFilter).From;
|
||||
timePeriodEnd = (filter as DateFilter).To;
|
||||
}
|
||||
if (filter is DateFilter)
|
||||
{
|
||||
timePeriodStart = (filter as DateFilter).From;
|
||||
timePeriodEnd = (filter as DateFilter).To;
|
||||
}
|
||||
waterMeters2 = filter.ExecuteQuery(sessions, waterMeters);
|
||||
waterMeters = waterMeters2;
|
||||
}
|
||||
@@ -364,10 +364,10 @@ namespace ResultsBrowser
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (TextWriter writer = new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8))
|
||||
{
|
||||
try
|
||||
{
|
||||
using (TextWriter writer = new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8))
|
||||
{
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
writer.Write(items[i].Caption);
|
||||
@@ -397,10 +397,10 @@ namespace ResultsBrowser
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
catch (Exception exc)
|
||||
{
|
||||
MessageBox.Show(exc.Message, Strings.Error_exporting_results, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,11 +448,11 @@ namespace ResultsBrowser
|
||||
IComponent component = printerFactory.GetComponent(printerCfg, tbfComponents);
|
||||
IResultsPrinter printer = component as IResultsPrinter;
|
||||
|
||||
if (printer== null)
|
||||
if (printer == null)
|
||||
{
|
||||
MessageBox.Show(Strings.No_printer_defined);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
tbfComponents.Clear();
|
||||
tbfDevices.Clear();
|
||||
@@ -493,7 +493,7 @@ namespace ResultsBrowser
|
||||
{
|
||||
if (waterMeters == null || waterMeters.Count == 0) return;
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
|
||||
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
|
||||
|
||||
///
|
||||
/// Statistics options
|
||||
@@ -529,24 +529,24 @@ namespace ResultsBrowser
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates component factory
|
||||
/// </summary>
|
||||
/// <param name="className">Component class name</param>
|
||||
/// <param name="factory">Reference to a factory</param>
|
||||
/// <returns>true when factory changed</returns>
|
||||
IComponentFactory GetFactory(string className)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(className))
|
||||
{
|
||||
foreach (var fac in TbfComponents.Factories)
|
||||
{
|
||||
if (fac.ClassName == className) return fac;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Updates component factory
|
||||
/// </summary>
|
||||
/// <param name="className">Component class name</param>
|
||||
/// <param name="factory">Reference to a factory</param>
|
||||
/// <returns>true when factory changed</returns>
|
||||
IComponentFactory GetFactory(string className)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(className))
|
||||
{
|
||||
foreach (var fac in TbfComponents.Factories)
|
||||
{
|
||||
if (fac.ClassName == className) return fac;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void customQueryButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -639,7 +639,6 @@ namespace ResultsBrowser
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/// Add this test bench to the list of test benches if it was still missing
|
||||
if (!testBenches.Contains(testBenchId)) testBenches.Add(testBenchId);
|
||||
}
|
||||
@@ -734,20 +733,11 @@ namespace ResultsBrowser
|
||||
/// SUEZ specific
|
||||
switch (testId)
|
||||
{
|
||||
case -2:
|
||||
oraD.AdjErrA4 = error;
|
||||
break;
|
||||
case -1:
|
||||
oraD.AdjErr = error;
|
||||
break;
|
||||
case 5:
|
||||
oraD.Q3LrErr = error;
|
||||
break;
|
||||
case 10:
|
||||
oraD.Q3RlErr = error;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case -2: oraD.AdjErrA4 = error; break;
|
||||
case -1: oraD.AdjErr = error; break;
|
||||
case 5: oraD.Q3LrErr = error; break;
|
||||
case 10: oraD.Q3RlErr = error; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
dr.Close();
|
||||
@@ -756,6 +746,78 @@ namespace ResultsBrowser
|
||||
|
||||
oracleConnection.Close();
|
||||
}
|
||||
else if (dlg.CQCriteria == CQCriteria.BenchAndBatchNr)
|
||||
{
|
||||
switch (dlg.IntParameter)
|
||||
{
|
||||
case 10: Results.DB.ConnectionString = "SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 11: Results.DB.ConnectionString = "SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 13: Results.DB.ConnectionString = "SERVER=10.42.130.52; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 15: Results.DB.ConnectionString = "SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 14: Results.DB.ConnectionString = "SERVER=10.42.130.72; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 18: Results.DB.ConnectionString = "SERVER=10.42.130.165; DATABASE=st-wr18-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 19: Results.DB.ConnectionString = "SERVER=10.42.128.159; DATABASE=st-wr19-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 20: Results.DB.ConnectionString = "SERVER=10.42.130.76; DATABASE=st-wr20-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 21: Results.DB.ConnectionString = "SERVER=10.42.128.201; DATABASE=st-wr21-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
default: Results.DB.ConnectionString = string.Empty; break;
|
||||
}
|
||||
Results.DB.DbType = Users.Entities.DBType.MySql;
|
||||
|
||||
string[] fields = dlg.InputList.Split(new char[] { ',' });
|
||||
int[] batchNrs = new int[fields.Length];
|
||||
int batchNr;
|
||||
for (int i = 0; i < batchNrs.Length; i++) if (int.TryParse(fields[i], out batchNr)) batchNrs[i] = batchNr;
|
||||
|
||||
IList<WaterMeter> waterMeters = new List<WaterMeter>();
|
||||
if (!string.IsNullOrEmpty(Results.DB.ConnectionString))
|
||||
{
|
||||
ISession session = Results.DB.CreateSession();
|
||||
|
||||
for (int i = 0; i < batchNrs.Length; i++)
|
||||
{
|
||||
var batches = session.QueryOver<Batch>()
|
||||
.Where(x => (x.BatchNr == batchNrs[i]))
|
||||
.List();
|
||||
if (batches.Count == 1)
|
||||
{
|
||||
var wms = session.QueryOver<WaterMeter>()
|
||||
.Where(x => (x.Batch == batches[0]))
|
||||
.List();
|
||||
foreach (var wm in wms) waterMeters.Add(wm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
consoleTextBox.Text += "Collecting water meters\r\n";
|
||||
foreach (var waterMeter in waterMeters)
|
||||
{
|
||||
oracleConnection = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
|
||||
oracleConnection.Open();
|
||||
|
||||
OracleCommand cmd = new OracleCommand("select AUFTRAGSNUMMER, MAX_PRUEFINDEX, PREFIX, ZAEHLERNUMMER from VT_ZAEHLER_PD where VT_FERNUM = :1 AND ANBID = 4 order by ZAEHLERNUMMER", oracleConnection);
|
||||
cmd.Parameters.Add(new OracleParameter { ParameterName = "1", OracleDbType = OracleDbType.Varchar2, Value = waterMeter.SerialNr });
|
||||
|
||||
OracleDataReader dr = cmd.ExecuteReader();
|
||||
while (dr.Read())
|
||||
{
|
||||
int i = 0;
|
||||
string queryResult = dr.GetString(i++);
|
||||
int maxPruefIx = dr.GetInt32(i++);
|
||||
int testBenchId = maxPruefIx / 100;
|
||||
maxPruefIx = maxPruefIx % 100;
|
||||
string prefix = dr.GetString(i++);
|
||||
int sn = dr.GetInt32(i++);
|
||||
|
||||
if (sn == -1) continue;
|
||||
|
||||
/// Create 'OraData' object and add it to 'oraDatas' list
|
||||
oraDatas.Add(new OraData() { PO = queryResult, PcbNr = waterMeter.SerialNr, TestBenchId = testBenchId, MaxPruefIx = maxPruefIx, Prefix = prefix, SN = sn });
|
||||
|
||||
/// Add this test bench to the list of test benches if it was still missing
|
||||
if (!testBenches.Contains(testBenchId)) testBenches.Add(testBenchId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dlg.CQCriteria == CQCriteria.WZTypeIdAndTimePeriod)
|
||||
{
|
||||
}
|
||||
@@ -795,18 +857,19 @@ namespace ResultsBrowser
|
||||
/// Test bench databases
|
||||
switch (testBenchId)
|
||||
{
|
||||
case 5: Results.DB.ConnectionString = "SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 6: Results.DB.ConnectionString = "SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 8: Results.DB.ConnectionString = "SERVER=10.42.128.61; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 9: Results.DB.ConnectionString = "SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 10: Results.DB.ConnectionString = "SERVER=10.42.130.72; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 5: Results.DB.ConnectionString = "SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 6: Results.DB.ConnectionString = "SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 8: Results.DB.ConnectionString = "SERVER=10.42.130.52; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 9: Results.DB.ConnectionString = "SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 10: Results.DB.ConnectionString = "SERVER=10.42.130.72; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 11: Results.DB.ConnectionString = "SERVER=10.42.130.165; DATABASE=st-wr18-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 12: Results.DB.ConnectionString = "SERVER=10.42.128.159; DATABASE=st-wr19-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 13: Results.DB.ConnectionString = "SERVER=10.42.130.76; DATABASE=st-wr20-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 13: Results.DB.ConnectionString = "SERVER=10.42.130.76; DATABASE=st-wr20-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
case 14: Results.DB.ConnectionString = "SERVER=10.42.128.201; DATABASE=st-wr21-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CharSet=utf8;"; break;
|
||||
default: Results.DB.ConnectionString = string.Empty; break;
|
||||
}
|
||||
#endif
|
||||
Results.DB.DbType = Users.Entities.DBType.MySql;
|
||||
|
||||
if (!string.IsNullOrEmpty(Results.DB.ConnectionString))
|
||||
{
|
||||
@@ -854,7 +917,7 @@ namespace ResultsBrowser
|
||||
consoleTextBox.Text += Environment.NewLine;
|
||||
|
||||
if (session != null) session.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
consoleTextBox.Text += "End reading additional data from MySQL\r\n";
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace SchematicDrawing
|
||||
public static class Const
|
||||
{
|
||||
public const int GridSize = 10;
|
||||
public const int SecondaryStart = 10000;
|
||||
public const int Vacuum = 1000000;
|
||||
}
|
||||
|
||||
|
||||
+23
-10
@@ -1,23 +1,35 @@
|
||||
using System;
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SchematicDrawing
|
||||
{
|
||||
public class GNode
|
||||
{
|
||||
/// Graph node properties
|
||||
public IDrawingItem Item;
|
||||
public int NodeId;
|
||||
public readonly IList<GEdge> Edges;
|
||||
|
||||
/// Distance from a start node
|
||||
public int Dist;
|
||||
public bool Visited;
|
||||
|
||||
/// Minimal heap index
|
||||
public int HeapIx;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="item">Item</param>
|
||||
/// <param name="nodeId"Node ID></param>
|
||||
public GNode(IDrawingItem item, int nodeId)
|
||||
{
|
||||
this.Item = item;
|
||||
this.NodeId = nodeId;
|
||||
this.Edges = new List<GEdge>();
|
||||
Reset();
|
||||
Item = item;
|
||||
NodeId = nodeId;
|
||||
Edges = new List<GEdge>();
|
||||
Dist = int.MaxValue;
|
||||
}
|
||||
|
||||
public void AddEdge(GEdge edge)
|
||||
@@ -25,15 +37,16 @@ namespace SchematicDrawing
|
||||
Edges.Add(edge);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
public GNode Reset(int heapIx, int dist = int.MaxValue)
|
||||
{
|
||||
Visited = false;
|
||||
Dist = int.MaxValue;
|
||||
HeapIx = heapIx;
|
||||
Dist = dist;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}/{1} {2} dist={3}", Item.Name, NodeId, Visited ? "V" : "", Dist);
|
||||
return string.Format("{0}/{1} dist={2}", Item.Name, NodeId, Dist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+41
-25
@@ -1,30 +1,60 @@
|
||||
using System;
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SchematicDrawing
|
||||
{
|
||||
public class Graph
|
||||
{
|
||||
public bool Completed;
|
||||
|
||||
IList<GNode> nodes;
|
||||
GNode startNode;
|
||||
int secondaryStartNodesCount;
|
||||
|
||||
MinHeap minHeap;
|
||||
GNode currentNode;
|
||||
|
||||
public Graph()
|
||||
{
|
||||
nodes = new List<GNode>();
|
||||
startNode = null;
|
||||
secondaryStartNodesCount = 0;
|
||||
minHeap = new MinHeap();
|
||||
Completed = false;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
nodes.Clear();
|
||||
startNode = null;
|
||||
secondaryStartNodesCount = 0;
|
||||
Completed = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a node to the list of graph nodes
|
||||
/// </summary>
|
||||
/// <param name="node">Graph node</param>
|
||||
public void AddNode(GNode node)
|
||||
public void AddNode(GNode node, bool isStartNode = false, bool isSecondaryStartNode = false)
|
||||
{
|
||||
nodes.Add(node);
|
||||
if (isStartNode && startNode == null)
|
||||
{
|
||||
startNode = node;
|
||||
nodes.Insert(0, node);
|
||||
}
|
||||
else if (isStartNode || isSecondaryStartNode)
|
||||
{
|
||||
secondaryStartNodesCount++;
|
||||
nodes.Insert(startNode != null ? 1 : 0, node);
|
||||
}
|
||||
else
|
||||
{
|
||||
nodes.Add(node);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -47,44 +77,30 @@ namespace SchematicDrawing
|
||||
/// </summary>
|
||||
/// <param name="startNode">Start node</param>
|
||||
/// <param name="secondaryStartNodes">List of secondary start nodes</param>
|
||||
public void RunDijkstraAlgo(GNode startNode, IList<GNode> secondaryStartNodes = null)
|
||||
public void RunDijkstraAlgo()
|
||||
{
|
||||
if (nodes == null || startNode == null || !nodes.Contains(startNode)) return;
|
||||
if (nodes == null || startNode == null) return;
|
||||
|
||||
/// Reset all nodes
|
||||
foreach (var node in nodes) node.Reset();
|
||||
minHeap.ResetAndBuild(nodes, secondaryStartNodesCount);
|
||||
|
||||
startNode.Dist = 0;
|
||||
if (secondaryStartNodes != null) foreach (var ssn in secondaryStartNodes) ssn.Dist = 10000;
|
||||
currentNode = startNode;
|
||||
|
||||
int minDistance = int.MaxValue;
|
||||
currentNode = minHeap.ExtractMinNode();
|
||||
do
|
||||
{
|
||||
/// Consider all unvisited neighbors of the current node
|
||||
foreach (var e in currentNode.Edges)
|
||||
{
|
||||
int distViaCurrNode = (e.Dist == int.MaxValue) ? int.MaxValue : currentNode.Dist + e.Dist;
|
||||
if (!e.EndNode.Visited && distViaCurrNode < e.EndNode.Dist)
|
||||
if (distViaCurrNode < e.EndNode.Dist)
|
||||
{
|
||||
e.EndNode.Dist = distViaCurrNode;
|
||||
minHeap.SiftUp(e.EndNode.HeapIx);
|
||||
}
|
||||
}
|
||||
currentNode.Visited = true;
|
||||
|
||||
/// Find new current node from all unvisited nodes
|
||||
currentNode = null;
|
||||
minDistance = int.MaxValue;
|
||||
foreach (var n in nodes)
|
||||
{
|
||||
if (!n.Visited && n.Dist < minDistance)
|
||||
{
|
||||
minDistance = n.Dist;
|
||||
currentNode = n;
|
||||
}
|
||||
}
|
||||
currentNode = minHeap.ExtractMinNode();
|
||||
}
|
||||
while (minDistance < int.MaxValue && currentNode != null);
|
||||
while (currentNode.Dist < int.MaxValue && currentNode != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SchematicDrawing
|
||||
{
|
||||
public class MinHeap
|
||||
{
|
||||
GNode[] heap; /// Minimum heap, a binary tree in form of an array
|
||||
int heapSize; /// Heap size (not necessarily a size of the array heap[])
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public MinHeap()
|
||||
{
|
||||
heap = null;
|
||||
heapSize = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset nodes and build the initial minimum heap tree.
|
||||
///
|
||||
/// First node on the list is the start node (mostly the main water tank),
|
||||
/// followed by 'secondaryStartNodesCount' secondary start nodes (typically
|
||||
/// tanks above scales), followed by all remaining nodes of the drawing.
|
||||
/// In this way the heap is heapified from the beginning.
|
||||
/// </summary>
|
||||
/// <param name="nodes">Graph nodes</param>
|
||||
/// <param name="secondaryStartNodesCount">Number of secondary start nodes</param>
|
||||
public void ResetAndBuild(IList<GNode> nodes, int secondaryStartNodesCount)
|
||||
{
|
||||
if (nodes == null || nodes.Count == 0) return;
|
||||
|
||||
if (heapSize != nodes.Count)
|
||||
{
|
||||
heapSize = nodes.Count;
|
||||
heap = new GNode[nodes.Count];
|
||||
}
|
||||
|
||||
heap[0] = nodes[0].Reset(0, 0);
|
||||
for (int i = 1; i <= secondaryStartNodesCount; i++)
|
||||
{
|
||||
heap[i] = nodes[i].Reset(i, Const.SecondaryStart);
|
||||
}
|
||||
for (int i = secondaryStartNodesCount + 1; i < nodes.Count; i++)
|
||||
{
|
||||
heap[i] = nodes[i].Reset(i, int.MaxValue);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the node with minimal distance at the top of the heap binary tree.
|
||||
/// This node is removed from the heap, replaced by the last node and the heap is 'Heapified'.
|
||||
/// </summary>
|
||||
/// <returns>Node with minimal distance</returns>
|
||||
public GNode ExtractMinNode()
|
||||
{
|
||||
GNode minNode = heap[0];
|
||||
if (--heapSize > 0)
|
||||
{
|
||||
heap[0] = heap[heapSize]; /// Swap with the last one
|
||||
heap[0].HeapIx = 0;
|
||||
heap[heapSize] = minNode;
|
||||
SiftDown(0); /// Heapify the heap, sift down the swapped (formerly the last) item
|
||||
}
|
||||
return minNode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sift up the node in the minimum heap binary tree.
|
||||
/// Function is called when distance of a node in the graph is updated.
|
||||
/// As the distance is always decreased, the node sifts up in the tree.
|
||||
/// </summary>
|
||||
/// <param name="heapIx">Index of the node to sift up</param>
|
||||
public void SiftUp(int heapIx)
|
||||
{
|
||||
if (heapIx == 0) return;
|
||||
int parentIx = (heapIx - 1) / 2;
|
||||
if (heap[heapIx].Dist < heap[parentIx].Dist)
|
||||
{
|
||||
SwapNodes(heapIx, parentIx);
|
||||
SiftUp(parentIx);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sift down the node in the minimum heap binary tree.
|
||||
/// Function is called when node at the top of the tree is extracted and replaced
|
||||
/// by the last node. This last node is then sift down according to its distance.
|
||||
/// </summary>
|
||||
/// <param name="heapIx">Index of the node to sift down</param>
|
||||
void SiftDown(int heapIx)
|
||||
{
|
||||
int leftIx = 2 * heapIx + 1;
|
||||
if (leftIx < heapSize)
|
||||
{
|
||||
int minIx = heapIx;
|
||||
if (heap[leftIx].Dist < heap[minIx].Dist)
|
||||
{
|
||||
minIx = leftIx;
|
||||
}
|
||||
|
||||
int rightIx = 2 * heapIx + 2;
|
||||
if (rightIx < heapSize && heap[rightIx].Dist < heap[minIx].Dist)
|
||||
{
|
||||
minIx = rightIx;
|
||||
}
|
||||
|
||||
if (minIx != heapIx)
|
||||
{
|
||||
SwapNodes(heapIx, minIx);
|
||||
SiftDown(minIx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Swap two nodes in the minimum heap binary tree.
|
||||
/// </summary>
|
||||
/// <param name="ix1">Index of the 1st node</param>
|
||||
/// <param name="ix2">Index of the 2nd node</param>
|
||||
void SwapNodes(int ix1, int ix2)
|
||||
{
|
||||
GNode swap = heap[ix1];
|
||||
heap[ix1] = heap[ix2];
|
||||
heap[ix1].HeapIx = ix1;
|
||||
heap[ix2] = swap;
|
||||
heap[ix2].HeapIx = ix2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,11 @@ namespace SchematicDrawing
|
||||
public int EndNodeId;
|
||||
public Sz Sz;
|
||||
|
||||
public bool CoordinatesAreValid;
|
||||
public int x1, y1, x2, y2;
|
||||
public bool HasIntersection;
|
||||
public float P;
|
||||
|
||||
|
||||
public Pipe(IDrawingItem startItem, int startNodeId, IDrawingItem endItem, int endNodeId, Sz sz)
|
||||
{
|
||||
@@ -22,12 +27,16 @@ namespace SchematicDrawing
|
||||
EndItem = endItem;
|
||||
EndNodeId = endNodeId;
|
||||
Sz = sz;
|
||||
CoordinatesAreValid = false;
|
||||
HasIntersection = false;
|
||||
}
|
||||
|
||||
public Pipe(string pipeStr, Sz sz, Dictionary<string, IDrawingItem> name2Item)
|
||||
{
|
||||
String2Items(pipeStr, name2Item, out StartItem, out StartNodeId, out EndItem, out EndNodeId);
|
||||
Sz = sz;
|
||||
CoordinatesAreValid = false;
|
||||
HasIntersection = false;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@@ -44,7 +53,7 @@ namespace SchematicDrawing
|
||||
/// <param name="x2">End point X</param>
|
||||
/// <param name="y2">End point Y</param>
|
||||
/// <returns>true when calculation successful</returns>
|
||||
public bool GetCoordinates(out int x1, out int y1, out int x2, out int y2)
|
||||
public bool GetCoordinates()
|
||||
{
|
||||
DrawingShape startDShape = DrawingShape.GetDrawingShape(StartItem);
|
||||
DrawingShape endDShape = DrawingShape.GetDrawingShape(EndItem);
|
||||
@@ -58,17 +67,16 @@ namespace SchematicDrawing
|
||||
y1 = StartItem.Y + startNode.Y * Const.GridSize;
|
||||
x2 = EndItem.X + endNode.X * Const.GridSize;
|
||||
y2 = EndItem.Y + endNode.Y * Const.GridSize;
|
||||
CoordinatesAreValid = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
x1 = y1 = x2 = y2 = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Converts pipe string to start and end items
|
||||
/// </summary>
|
||||
@@ -101,5 +109,37 @@ namespace SchematicDrawing
|
||||
endNid = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when two pipes have an intersection
|
||||
/// </summary>
|
||||
/// <param name="pipe2">Second pipe</param>
|
||||
/// <returns>true when ipes intersect</returns>
|
||||
public bool CalculateIntersectionWith(Pipe pipe2)
|
||||
{
|
||||
if (!this.CoordinatesAreValid) GetCoordinates();
|
||||
if (!pipe2.CoordinatesAreValid) pipe2.GetCoordinates();
|
||||
|
||||
int D = (x2 - x1) * (pipe2.y2 - pipe2.y1) - (y2 - y1) * (pipe2.x2 - pipe2.x1);
|
||||
float Dp = Convert.ToSingle((pipe2.x1 - x1) * (pipe2.y2 - pipe2.y1) - (pipe2.y1 - y1) * (pipe2.x2 - pipe2.x1));
|
||||
float Dq = Convert.ToSingle((x2 - x1) * (pipe2.y1 - y1) - (y2 - y1) * (pipe2.x1 - x1));
|
||||
|
||||
if (D == 0)
|
||||
{
|
||||
return false; /// Parallel pipes -> no intersection
|
||||
}
|
||||
|
||||
float Df = Convert.ToSingle(D);
|
||||
float p = Dp / Df;
|
||||
float q = -Dq / Df;
|
||||
if (p > 0.01 && p < 0.99 && q > 0.01 && q < 0.99)
|
||||
{
|
||||
this.HasIntersection = true;
|
||||
this.P = p;
|
||||
return true; /// Pipes intersect, pipes touching by their ends are not considered
|
||||
}
|
||||
|
||||
return false; /// Pipes do not intersect
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
<Compile Include="IDrawingItemWithMeasuredVal.cs" />
|
||||
<Compile Include="IRouteBasedDrawingItem.cs" />
|
||||
<Compile Include="IDrawingItemWithSetpoint.cs" />
|
||||
<Compile Include="MinHeap.cs" />
|
||||
<Compile Include="Pipe.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Dirichlet.Numerics;
|
||||
using System.Numerics;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace SchematicDrawing
|
||||
{
|
||||
@@ -18,7 +19,18 @@ namespace SchematicDrawing
|
||||
private bool supressRedraws;
|
||||
public bool SupressRedraws
|
||||
{
|
||||
set { if (supressRedraws != value) { supressRedraws = value; Redraw(); } }
|
||||
set
|
||||
{
|
||||
if (supressRedraws != value)
|
||||
{
|
||||
supressRedraws = value;
|
||||
if (!supressRedraws)
|
||||
{
|
||||
JoinPipeListsEtc();
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
get { return supressRedraws; }
|
||||
}
|
||||
|
||||
@@ -54,7 +66,8 @@ namespace SchematicDrawing
|
||||
Utils.UpdateGraphEdges(route, it as IRouteBasedDrawingItem);
|
||||
}
|
||||
}
|
||||
graph.RunDijkstraAlgo(startNode, secondaryStartNodes);
|
||||
|
||||
graph.RunDijkstraAlgo();
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
@@ -87,12 +100,16 @@ namespace SchematicDrawing
|
||||
Pen[] pensDry;
|
||||
Pen[] pensWater;
|
||||
Pen[] pensVacuum;
|
||||
Pen[] pensDryBackgr;
|
||||
Pen[] pensWaterBackgr;
|
||||
Pen[] pensVacuumBackgr;
|
||||
Pen[] pensHighlighted;
|
||||
|
||||
IList<Pipe> pipesS;
|
||||
IList<Pipe> pipesM;
|
||||
IList<Pipe> pipesL;
|
||||
IList<Pipe> pipesXL;
|
||||
IList<Pipe> allPipes;
|
||||
///
|
||||
public string[] PipesS
|
||||
{
|
||||
@@ -105,24 +122,20 @@ namespace SchematicDrawing
|
||||
pipesS.Clear();
|
||||
if (value != null)
|
||||
{
|
||||
foreach (var p in value)
|
||||
foreach (var pStr in value)
|
||||
{
|
||||
Pipe pi = new Pipe(p, Sz.S, Name2Item);
|
||||
pipesS.Add(pi);
|
||||
|
||||
if (!EditMode && pi.StartItem != null && pi.StartItem.GNodes.Count > pi.StartNodeId &&
|
||||
pi.EndItem != null && pi.EndItem.GNodes.Count > pi.EndNodeId)
|
||||
{
|
||||
int x1, y1, x2, y2;
|
||||
int dist = pi.GetCoordinates(out x1, out y1, out x2, out y2) ? (int)Math.Round(Math.Sqrt((double)((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)))) : 1;
|
||||
graph.AddEdge(pi.StartItem.GNodes[pi.StartNodeId], pi.EndItem.GNodes[pi.EndNodeId], dist);
|
||||
graph.AddEdge(pi.EndItem.GNodes[pi.EndNodeId], pi.StartItem.GNodes[pi.StartNodeId], dist);
|
||||
}
|
||||
pipesS.Add(new Pipe(pStr, Sz.S, Name2Item));
|
||||
}
|
||||
}
|
||||
Redraw();
|
||||
}
|
||||
|
||||
if (!supressRedraws)
|
||||
{
|
||||
JoinPipeListsEtc();
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
///
|
||||
public string[] PipesM
|
||||
{
|
||||
get
|
||||
@@ -136,24 +149,20 @@ namespace SchematicDrawing
|
||||
pipesM.Clear();
|
||||
if (value != null)
|
||||
{
|
||||
foreach (var p in value)
|
||||
foreach (var pStr in value)
|
||||
{
|
||||
Pipe pi = new Pipe(p, Sz.M, Name2Item);
|
||||
pipesM.Add(pi);
|
||||
|
||||
if (!EditMode && pi.StartItem != null && pi.StartItem.GNodes.Count > pi.StartNodeId &&
|
||||
pi.EndItem != null && pi.EndItem.GNodes.Count > pi.EndNodeId)
|
||||
{
|
||||
int x1, y1, x2, y2;
|
||||
int dist = pi.GetCoordinates(out x1, out y1, out x2, out y2) ? (int)Math.Round(Math.Sqrt((double)((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)))) : 1;
|
||||
graph.AddEdge(pi.StartItem.GNodes[pi.StartNodeId], pi.EndItem.GNodes[pi.EndNodeId], dist);
|
||||
graph.AddEdge(pi.EndItem.GNodes[pi.EndNodeId], pi.StartItem.GNodes[pi.StartNodeId], dist);
|
||||
}
|
||||
pipesM.Add(new Pipe(pStr, Sz.M, Name2Item));
|
||||
}
|
||||
}
|
||||
Redraw();
|
||||
|
||||
if (!supressRedraws)
|
||||
{
|
||||
JoinPipeListsEtc();
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
///
|
||||
public string[] PipesL
|
||||
{
|
||||
get {
|
||||
@@ -165,24 +174,20 @@ namespace SchematicDrawing
|
||||
pipesL.Clear();
|
||||
if (value != null)
|
||||
{
|
||||
foreach (var p in value)
|
||||
foreach (var pStr in value)
|
||||
{
|
||||
Pipe pi = new Pipe(p, Sz.L, Name2Item);
|
||||
pipesL.Add(pi);
|
||||
|
||||
if (!EditMode && pi.StartItem != null && pi.StartItem.GNodes.Count > pi.StartNodeId &&
|
||||
pi.EndItem != null && pi.EndItem.GNodes.Count > pi.EndNodeId)
|
||||
{
|
||||
int x1, y1, x2, y2;
|
||||
int dist = pi.GetCoordinates(out x1, out y1, out x2, out y2) ? (int)Math.Round(Math.Sqrt((double)((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)))) : 1;
|
||||
graph.AddEdge(pi.StartItem.GNodes[pi.StartNodeId], pi.EndItem.GNodes[pi.EndNodeId], dist);
|
||||
graph.AddEdge(pi.EndItem.GNodes[pi.EndNodeId], pi.StartItem.GNodes[pi.StartNodeId], dist);
|
||||
}
|
||||
pipesL.Add(new Pipe(pStr, Sz.L, Name2Item));
|
||||
}
|
||||
}
|
||||
Redraw();
|
||||
|
||||
if (!supressRedraws)
|
||||
{
|
||||
JoinPipeListsEtc();
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
///
|
||||
public string[] PipesXL
|
||||
{
|
||||
get {
|
||||
@@ -194,22 +199,58 @@ namespace SchematicDrawing
|
||||
pipesXL.Clear();
|
||||
if (value != null)
|
||||
{
|
||||
foreach (var p in value)
|
||||
foreach (var pStr in value)
|
||||
{
|
||||
Pipe pi = new Pipe(p, Sz.XL, Name2Item);
|
||||
pipesXL.Add(pi);
|
||||
|
||||
if (!EditMode && pi.StartItem != null && pi.StartItem.GNodes.Count > pi.StartNodeId &&
|
||||
pi.EndItem != null && pi.EndItem.GNodes.Count > pi.EndNodeId)
|
||||
{
|
||||
int x1, y1, x2, y2;
|
||||
int dist = pi.GetCoordinates(out x1, out y1, out x2, out y2) ? (int)Math.Round(Math.Sqrt((double)((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)))) : 1;
|
||||
graph.AddEdge(pi.StartItem.GNodes[pi.StartNodeId], pi.EndItem.GNodes[pi.EndNodeId], dist);
|
||||
graph.AddEdge(pi.EndItem.GNodes[pi.EndNodeId], pi.StartItem.GNodes[pi.StartNodeId], dist);
|
||||
}
|
||||
pipesXL.Add(new Pipe(pStr, Sz.XL, Name2Item));
|
||||
}
|
||||
}
|
||||
Redraw();
|
||||
|
||||
if (!supressRedraws)
|
||||
{
|
||||
JoinPipeListsEtc();
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 1. Join 4 pipe lists.
|
||||
/// 2. Add graph edges in case EditMode is off.
|
||||
/// 3. Determine intersections of pipes in case EditMode is off.
|
||||
/// </summary>
|
||||
void JoinPipeListsEtc()
|
||||
{
|
||||
allPipes.Clear();
|
||||
foreach (var p in pipesS) allPipes.Add(p);
|
||||
foreach (var p in pipesM) allPipes.Add(p);
|
||||
foreach (var p in pipesL) allPipes.Add(p);
|
||||
foreach (var p in pipesXL) allPipes.Add(p);
|
||||
|
||||
if ((allPipes.Count > 0) && !EditMode && !graph.Completed)
|
||||
{
|
||||
/// Do the following just once in non edit mode
|
||||
|
||||
for (int i = 0; i < allPipes.Count; i++)
|
||||
{
|
||||
Pipe p = allPipes[i];
|
||||
if (p.StartItem != null && p.StartItem.GNodes.Count > p.StartNodeId &&
|
||||
p.EndItem != null && p.EndItem.GNodes.Count > p.EndNodeId)
|
||||
{
|
||||
int dist = p.GetCoordinates() ? (int)Math.Round(Math.Sqrt((double)((p.x2 - p.x1) * (p.x2 - p.x1) + (p.y2 - p.y1) * (p.y2 - p.y1)))) : 1;
|
||||
graph.AddEdge(p.StartItem.GNodes[p.StartNodeId], p.EndItem.GNodes[p.EndNodeId], dist);
|
||||
graph.AddEdge(p.EndItem.GNodes[p.EndNodeId], p.StartItem.GNodes[p.StartNodeId], dist);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < allPipes.Count; i++)
|
||||
{
|
||||
for (int j = i + 1; j < allPipes.Count; j++)
|
||||
{
|
||||
if (allPipes[i].CalculateIntersectionWith(allPipes[j])) break;
|
||||
}
|
||||
}
|
||||
|
||||
graph.Completed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,8 +272,6 @@ namespace SchematicDrawing
|
||||
IList<IDrawingItem> items;
|
||||
|
||||
Graph graph;
|
||||
GNode startNode;
|
||||
IList<GNode> secondaryStartNodes;
|
||||
|
||||
///
|
||||
/// Rectangles of elements of drawn items
|
||||
@@ -246,6 +285,9 @@ namespace SchematicDrawing
|
||||
Brush brushDry;
|
||||
Brush brushWater;
|
||||
Brush brushVacuum;
|
||||
Brush brushDryBackgr;
|
||||
Brush brushWaterBackgr;
|
||||
Brush brushVacuumBackgr;
|
||||
Brush brushHihglighted;
|
||||
|
||||
///
|
||||
@@ -271,6 +313,7 @@ namespace SchematicDrawing
|
||||
|
||||
public SchematicDrawingCtrl()
|
||||
{
|
||||
SupressRedraws = true;
|
||||
InitializeComponent();
|
||||
|
||||
this.AutoScaleMode = AutoScaleMode.None;
|
||||
@@ -285,10 +328,9 @@ namespace SchematicDrawing
|
||||
pipesM = new List<Pipe>();
|
||||
pipesL = new List<Pipe>();
|
||||
pipesXL = new List<Pipe>();
|
||||
allPipes = new List<Pipe>();
|
||||
|
||||
graph = new Graph();
|
||||
startNode = null;
|
||||
secondaryStartNodes = new List<GNode>();
|
||||
|
||||
ItemElementRectangles = new List<ItemElementRect>();
|
||||
|
||||
@@ -313,7 +355,7 @@ namespace SchematicDrawing
|
||||
{
|
||||
GNode gnode = new GNode(item, nid);
|
||||
item.GNodes.Add(gnode);
|
||||
graph.AddNode(gnode);
|
||||
graph.AddNode(gnode, dshape.Shape == Shape.Tank, dshape.Shape == Shape.Scale);
|
||||
}
|
||||
|
||||
foreach (var edge in dshape.Edges)
|
||||
@@ -324,16 +366,6 @@ namespace SchematicDrawing
|
||||
(item as IRouteBasedDrawingItem).EdgesToSet.Add(gedge);
|
||||
}
|
||||
}
|
||||
|
||||
if (dshape.Shape == Shape.Tank && item.GNodes.Count > 0)
|
||||
{
|
||||
startNode = item.GNodes[0];
|
||||
}
|
||||
|
||||
if (dshape.Shape == Shape.Scale && item.GNodes.Count > 0)
|
||||
{
|
||||
secondaryStartNodes.Add(item.GNodes[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,8 +376,6 @@ namespace SchematicDrawing
|
||||
items.Clear();
|
||||
Name2Item.Clear();
|
||||
graph.Clear();
|
||||
startNode = null;
|
||||
secondaryStartNodes.Clear();
|
||||
Redraw();
|
||||
}
|
||||
public IList<IDrawingItem> GetItems()
|
||||
@@ -388,11 +418,6 @@ namespace SchematicDrawing
|
||||
return tempPipe;
|
||||
}
|
||||
|
||||
public void RunDijkstraAlgo()
|
||||
{
|
||||
graph.RunDijkstraAlgo(startNode, secondaryStartNodes);
|
||||
}
|
||||
|
||||
void PrepareFontsPensBrushesEtc()
|
||||
{
|
||||
/// Font for drawing labels
|
||||
@@ -420,11 +445,17 @@ namespace SchematicDrawing
|
||||
brushDry = new SolidBrush(Color.FromArgb(255, 127, 127, 127));
|
||||
brushWater = new SolidBrush(Color.FromArgb(255, 0, 162, 232));
|
||||
brushVacuum = new SolidBrush(Color.FromArgb(255, 64, 255, 64));
|
||||
brushDryBackgr = new SolidBrush(Color.FromArgb(255, 80, 80, 80));
|
||||
brushWaterBackgr = new SolidBrush(Color.FromArgb(255, 0, 108, 154));
|
||||
brushVacuumBackgr = new SolidBrush(Color.FromArgb(255, 48, 196, 48));
|
||||
brushHihglighted = new SolidBrush(Color.FromArgb(255, 255, 0, 0));
|
||||
///
|
||||
pensDry = new Pen[(int)Sz.XL + 1];
|
||||
pensWater = new Pen[(int)Sz.XL + 1];
|
||||
pensVacuum = new Pen[(int)Sz.XL + 1];
|
||||
pensDryBackgr = new Pen[(int)Sz.XL + 1];
|
||||
pensWaterBackgr = new Pen[(int)Sz.XL + 1];
|
||||
pensVacuumBackgr = new Pen[(int)Sz.XL + 1];
|
||||
pensHighlighted = new Pen[(int)Sz.XL + 1];
|
||||
///
|
||||
for (Sz sz = Sz.S; sz <= Sz.XL; sz++)
|
||||
@@ -432,6 +463,9 @@ namespace SchematicDrawing
|
||||
pensDry[(int)sz] = new Pen(brushDry);
|
||||
pensWater[(int)sz] = new Pen(brushWater);
|
||||
pensVacuum[(int)sz] = new Pen(brushVacuum);
|
||||
pensDryBackgr[(int)sz] = new Pen(brushDryBackgr);
|
||||
pensWaterBackgr[(int)sz] = new Pen(brushWaterBackgr);
|
||||
pensVacuumBackgr[(int)sz] = new Pen(brushVacuumBackgr);
|
||||
pensHighlighted[(int)sz] = new Pen(brushHihglighted);
|
||||
float width;
|
||||
switch (sz)
|
||||
@@ -448,6 +482,12 @@ namespace SchematicDrawing
|
||||
pensWater[(int)sz].LineJoin = System.Drawing.Drawing2D.LineJoin.Bevel;
|
||||
pensVacuum[(int)sz].Width = width;
|
||||
pensVacuum[(int)sz].LineJoin = System.Drawing.Drawing2D.LineJoin.Bevel;
|
||||
pensDryBackgr[(int)sz].Width = width;
|
||||
pensDryBackgr[(int)sz].LineJoin = System.Drawing.Drawing2D.LineJoin.Bevel;
|
||||
pensWaterBackgr[(int)sz].Width = width;
|
||||
pensWaterBackgr[(int)sz].LineJoin = System.Drawing.Drawing2D.LineJoin.Bevel;
|
||||
pensVacuumBackgr[(int)sz].Width = width;
|
||||
pensVacuumBackgr[(int)sz].LineJoin = System.Drawing.Drawing2D.LineJoin.Bevel;
|
||||
pensHighlighted[(int)sz].Width = width;
|
||||
pensHighlighted[(int)sz].LineJoin = System.Drawing.Drawing2D.LineJoin.Bevel;
|
||||
}
|
||||
@@ -474,6 +514,10 @@ namespace SchematicDrawing
|
||||
/// <param name="e">PaintEventArgs</param>
|
||||
void SchematicDrawingCtrl_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
/// Profiling
|
||||
stopwatch.Reset();
|
||||
stopwatch.Start();
|
||||
|
||||
e.Graphics.Clear(Color.White);
|
||||
|
||||
ItemElementRectangles.Clear();
|
||||
@@ -498,19 +542,22 @@ namespace SchematicDrawing
|
||||
///
|
||||
if (EditMode)
|
||||
{
|
||||
/// Draw pipes without water
|
||||
foreach (var pipe in pipesS) DrawPipe(e, pipe, int.MaxValue);
|
||||
foreach (var pipe in pipesM) DrawPipe(e, pipe, int.MaxValue);
|
||||
foreach (var pipe in pipesL) DrawPipe(e, pipe, int.MaxValue);
|
||||
foreach (var pipe in pipesXL) DrawPipe(e, pipe, int.MaxValue);
|
||||
/// Draw an empty pipe. Coordinates are always recalculated
|
||||
for (int j = 0; j < allPipes.Count; j++)
|
||||
{
|
||||
Pipe pipe = allPipes[j];
|
||||
pipe.CoordinatesAreValid = false;
|
||||
DrawPipe(e, pipe, int.MaxValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Draw pipes with a color determined by Dijkstra shortest path algorithm
|
||||
foreach (var pipe in pipesS) DrawPipe(e, pipe, pipe.StartItem.GNodes[pipe.StartNodeId].Dist);
|
||||
foreach (var pipe in pipesM) DrawPipe(e, pipe, pipe.StartItem.GNodes[pipe.StartNodeId].Dist);
|
||||
foreach (var pipe in pipesL) DrawPipe(e, pipe, pipe.StartItem.GNodes[pipe.StartNodeId].Dist);
|
||||
foreach (var pipe in pipesXL) DrawPipe(e, pipe, pipe.StartItem.GNodes[pipe.StartNodeId].Dist);
|
||||
for (int j = 0; j < allPipes.Count; j++)
|
||||
{
|
||||
Pipe pipe = allPipes[j];
|
||||
DrawPipe(e, pipe, pipe.StartItem.GNodes[pipe.StartNodeId].Dist);
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
@@ -519,7 +566,7 @@ namespace SchematicDrawing
|
||||
foreach (var item in items)
|
||||
{
|
||||
DrawingShape dshape = DrawingShape.GetDrawingShape(item);
|
||||
if (dshape != null && dshape.Shape != Shape.Junction && dshape.HasImg && (!Utils.IsHidden(item) || EditMode))
|
||||
if (dshape != null && dshape.Shape != Shape.Junction && dshape.HasImg && (!Utils.IsHidden(item) || (EditMode && item == selectedItem)))
|
||||
{
|
||||
Rectangle rect = DrawItem(e, item, dshape);
|
||||
ItemElementRectangles.Add(new ItemElementRect(item, Element.Body, rect));
|
||||
@@ -669,26 +716,101 @@ namespace SchematicDrawing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw a pipe
|
||||
/// </summary>
|
||||
/// <param name="e">PaintEventArgs</param>
|
||||
/// <param name="pipe">Edge string</param>
|
||||
/// <param name="pipeSize">Edge size</param>
|
||||
/// <param name="isWaterOpen">true = filled, false = empty</param>
|
||||
void DrawPipe(PaintEventArgs e, Pipe pipe, int distance, bool highlighted = false)
|
||||
{
|
||||
int x1, y1, x2, y2;
|
||||
if (pipe.GetCoordinates(out x1, out y1, out x2, out y2) && (pipe.Sz >= Sz.S) && (pipe.Sz <= Sz.XL))
|
||||
/// Profiling
|
||||
stopwatch.Stop();
|
||||
if (firstTime)
|
||||
{
|
||||
int eIx = (int)pipe.Sz;
|
||||
Pen pen = highlighted ? pensHighlighted[eIx] : ((distance == int.MaxValue) ? pensDry[eIx] : (distance < Const.Vacuum) ? pensWater[eIx] : pensVacuum[eIx]);
|
||||
e.Graphics.DrawLine(pen, x1, y1, x2, y2);
|
||||
firstTime = false;
|
||||
}
|
||||
else if (totalTimes < long.MaxValue)
|
||||
{
|
||||
totalMs += stopwatch.ElapsedMilliseconds;
|
||||
totalTicks += stopwatch.ElapsedTicks;
|
||||
totalTimes++;
|
||||
Console.WriteLine("Average Paint duration is {0} ms = {1} ticks", totalMs / totalTimes, totalTicks / totalTimes);
|
||||
}
|
||||
}
|
||||
|
||||
/// Profiling
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
bool firstTime = true;
|
||||
long totalMs = 0;
|
||||
long totalTicks = 0;
|
||||
long totalTimes = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Draw a pipe.
|
||||
/// </summary>
|
||||
/// <param name="e">PaintEventArgs</param>
|
||||
/// <param name="p">Pipe object</param>
|
||||
/// <param name="distance">Distance from source of water for coloring</param>
|
||||
/// <param name="highlighted">true = highlighted (edit mode)</param>
|
||||
void DrawPipe(PaintEventArgs e, Pipe p, int distance, bool highlighted = false)
|
||||
{
|
||||
if (!p.CoordinatesAreValid) p.GetCoordinates();
|
||||
|
||||
int eIx = Math.Max((int)Sz.S, Math.Min((int)Sz.XL, (int)p.Sz));
|
||||
Pen pen = (distance == int.MaxValue) ? pensDry[eIx] : (distance < Const.Vacuum) ? pensWater[eIx] : pensVacuum[eIx];
|
||||
|
||||
if (highlighted)
|
||||
{
|
||||
e.Graphics.DrawLine(pensHighlighted[eIx], p.x1, p.y1, p.x2, p.y2);
|
||||
}
|
||||
else if (!p.HasIntersection)
|
||||
{
|
||||
e.Graphics.DrawLine(pen, p.x1, p.y1, p.x2, p.y2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Pen pen2 = (distance == int.MaxValue) ? pensDryBackgr[eIx] : (distance < Const.Vacuum) ? pensWaterBackgr[eIx] : pensVacuumBackgr[eIx];
|
||||
|
||||
float len = (float)Math.Sqrt(Convert.ToSingle((p.x2 - p.x1) * (p.x2 - p.x1) + (p.y2 - p.y1) * (p.y2 - p.y1)));
|
||||
float PP = 1.0f - p.P;
|
||||
if (p.P * len < 20 && PP * len < 20)
|
||||
{
|
||||
/// Draw a straght line with darker color
|
||||
e.Graphics.DrawLine(pen2, p.x1, p.y1, p.x2, p.y2);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Draw a line having normal color with a bow having darker color
|
||||
|
||||
float vx = 17.0f * (p.x2 - p.x1) / len; /// Fixed size vector in the direction of the line
|
||||
float vy = 17.0f * (p.y2 - p.y1) / len;
|
||||
|
||||
float xm = p.x1 * PP + p.x2 * p.P; /// Intersection point
|
||||
float ym = p.y1 * PP + p.y2 * p.P;
|
||||
int x3 = Convert.ToInt32(Math.Round(xm - vx)); /// Points around the intersection point
|
||||
int y3 = Convert.ToInt32(Math.Round(ym - vy));
|
||||
int x4 = Convert.ToInt32(Math.Round(xm - 2 * vy / 3));
|
||||
int y4 = Convert.ToInt32(Math.Round(ym + 2 * vx / 3));
|
||||
int x5 = Convert.ToInt32(Math.Round(xm + vx));
|
||||
int y5 = Convert.ToInt32(Math.Round(ym + vy));
|
||||
|
||||
/// Joints between straight parts of the line and the bow
|
||||
DrawingShape dsh = DrawingShape.GetDrawingShape(Shape.Junction, p.Sz);
|
||||
Image image = (distance == int.MaxValue) ? dsh.ImgRightOpenDry : (distance < Const.Vacuum) ? dsh.ImgRight : dsh.ImgRightVacuum;
|
||||
e.Graphics.DrawImage(image, x3 - dsh.Wid / 2, y3 - dsh.Hgh / 2);
|
||||
e.Graphics.DrawImage(image, x5 - dsh.Wid / 2, y5 - dsh.Hgh / 2);
|
||||
|
||||
e.Graphics.DrawLine(pen2, x3, y3, x4, y4); /// Bow
|
||||
e.Graphics.DrawLine(pen2, x4, y4, x5, y5);
|
||||
|
||||
e.Graphics.DrawLine(pen, p.x1, p.y1, x3, y3); /// Straight parts of the line
|
||||
e.Graphics.DrawLine(pen, x5, y5, p.x2, p.y2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw an item (body).
|
||||
/// </summary>
|
||||
/// <param name="e">PaintEventArgs</param>
|
||||
/// <param name="item">IDrawingItem object</param>
|
||||
/// <param name="dsh">DrawingShape</param>
|
||||
/// <returns>Rectangle where item body is drawn</returns>
|
||||
Rectangle DrawItem(PaintEventArgs e, IDrawingItem item, DrawingShape dsh)
|
||||
{
|
||||
bool routeBit = false;
|
||||
@@ -810,9 +932,10 @@ namespace SchematicDrawing
|
||||
/// <param name="x">X-coordinate</param>
|
||||
/// <param name="y">Y-coordinate</param>
|
||||
/// <param name="elements">Bitfield of elements to be searched for</param>
|
||||
/// <param name="itemNameOrEdge">Found component or edge or null</param>
|
||||
/// <param name="nodeId">Fount node id or 0</param>
|
||||
/// <returns>Element enum value (Element.None if nothing found)</returns>
|
||||
/// <param name="item">Found item or null (in case of body, node, label, measured value or setpoint)</param>
|
||||
/// <param name="pipe">Found pipe or null (in case of a pipe)</param>
|
||||
/// <param name="nodeId">Found node id or 0 (in case of an item node)</param>
|
||||
/// <returns>Element enum value (Element.None when nothing was found)</returns>
|
||||
public Element FindElement(int x, int y, Element elements, out IDrawingItem item, out Pipe pipe, out int nodeId)
|
||||
{
|
||||
const int NodeTolerance = 5;
|
||||
@@ -848,7 +971,7 @@ namespace SchematicDrawing
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Searches for an item body, label, measured value or setpoint.
|
||||
/// </summary>
|
||||
/// <param name="x">X coordinate</param>
|
||||
/// <param name="y">Y coordinate</param>
|
||||
@@ -921,15 +1044,14 @@ namespace SchematicDrawing
|
||||
/// <returns>Squared distance</returns>
|
||||
float SquaredDistanceFromLine(int x, int y, Pipe pipe)
|
||||
{
|
||||
int xx1, yy1, xx2, yy2;
|
||||
if (!pipe.GetCoordinates(out xx1, out yy1, out xx2, out yy2) || (xx1 == xx2 && yy1 == yy2))
|
||||
if (!pipe.GetCoordinates() || (pipe.x1 == pipe.x2 && pipe.y1 == pipe.y2))
|
||||
{
|
||||
return float.MaxValue;
|
||||
}
|
||||
|
||||
Vector2 X = new Vector2(Convert.ToSingle(x), Convert.ToSingle(y));
|
||||
Vector2 X1 = new Vector2(Convert.ToSingle(xx1), Convert.ToSingle(yy1));
|
||||
Vector2 X2 = new Vector2(Convert.ToSingle(xx2), Convert.ToSingle(yy2));
|
||||
Vector2 X1 = new Vector2(Convert.ToSingle(pipe.x1), Convert.ToSingle(pipe.y1));
|
||||
Vector2 X2 = new Vector2(Convert.ToSingle(pipe.x2), Convert.ToSingle(pipe.y2));
|
||||
Vector2 vX = X - X1; /// |X1 X|
|
||||
Vector2 v12 = X2 - X1; /// |X1 X2|
|
||||
|
||||
|
||||
@@ -250,13 +250,13 @@ namespace Statistics
|
||||
{
|
||||
"SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.128.61; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.72; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.52; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.128.61; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.165; DATABASE=st-wr18-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.128.159; DATABASE=st-wr19-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.76; DATABASE=st-wr20-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.128.201; DATABASE=st-wr21-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.156; DATABASE=st-wr21-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
"SERVER=10.42.130.131; DATABASE=iperlspecial-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
|
||||
};
|
||||
|
||||
|
||||
@@ -88,19 +88,21 @@ namespace Statistics
|
||||
|
||||
for (int i = 0; i < Program.LocalSettings.ConnectionStrings.Length; i++)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Program.LocalSettings.GetConnectionString(i)))
|
||||
string connStr = Program.LocalSettings.GetConnectionString(i);
|
||||
|
||||
if (!string.IsNullOrEmpty(connStr))
|
||||
{
|
||||
sessionFactories[i] = null;
|
||||
try
|
||||
{
|
||||
sessionFactories[i] = Fluently.Configure()
|
||||
.Database(MySQLConfiguration.Standard.ConnectionString(Program.LocalSettings.GetConnectionString(i)))
|
||||
.Database(MySQLConfiguration.Standard.ConnectionString(connStr))
|
||||
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Results.Entities.Batch>())
|
||||
.ExposeConfiguration(BuildSchema)
|
||||
.BuildSessionFactory();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
sessionFactories[i] = null;
|
||||
MessageBox.Show(string.Format("Cannot open one of database of {0}", Program.LocalSettings.GetBenchName(i)), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
using Results.Entities;
|
||||
@@ -10,10 +12,24 @@ using Statistics.Resources;
|
||||
|
||||
namespace Statistics.UserControls
|
||||
{
|
||||
class DataPoint
|
||||
{
|
||||
public DateTime StartTime;
|
||||
public double RefError;
|
||||
|
||||
public DataPoint(DateTime startTime, double refError)
|
||||
{
|
||||
StartTime = startTime;
|
||||
RefError = refError;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public partial class StatisticsCtrl : UserControl
|
||||
{
|
||||
public int Id; /// Index of the tab page
|
||||
public MidOrWaterMetersCtrl MidCtrl; /// Reference to the parent control
|
||||
IList<DataPoint> currentData;
|
||||
|
||||
public StatisticsCtrl()
|
||||
{
|
||||
@@ -21,6 +37,7 @@ namespace Statistics.UserControls
|
||||
chart1.ChartAreas[0].AxisX.LabelStyle.Format = "dd.MM.yy";
|
||||
chart1.ChartAreas[0].AxisX.Interval = 1;
|
||||
chart1.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Days;
|
||||
currentData = new List<DataPoint>();
|
||||
}
|
||||
|
||||
private void updateButton_Click(object sender, EventArgs e)
|
||||
@@ -36,6 +53,8 @@ namespace Statistics.UserControls
|
||||
|
||||
if (results != null)
|
||||
{
|
||||
currentData.Clear();
|
||||
|
||||
foreach (var r in results)
|
||||
{
|
||||
if (r.ErrorMaster != 0)
|
||||
@@ -45,6 +64,7 @@ namespace Statistics.UserControls
|
||||
if (MidCtrl.IsFlowEnabled(i) && (MidCtrl.FlowFrom(i) <= r.FlowMean) && (r.FlowMean <= MidCtrl.FlowTo(i)))
|
||||
{
|
||||
chart1.Series[string.Format("Flow {0}", i)].Points.AddXY(r.StartTime, r.ErrorMaster);
|
||||
currentData.Add(new DataPoint(r.StartTime, r.ErrorMaster));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,7 +76,21 @@ namespace Statistics.UserControls
|
||||
|
||||
private void exportButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveFileDialog dlg = new SaveFileDialog();
|
||||
dlg.Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*";
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
using (TextWriter writer = new StreamWriter(dlg.FileName))
|
||||
{
|
||||
foreach (var d in currentData)
|
||||
{
|
||||
writer.WriteLine("{0:dd.MM.yyyy HH:mm}; {1}", d.StartTime, d.RefError);
|
||||
}
|
||||
}
|
||||
|
||||
MessageBox.Show(string.Format("Data written to file {0}", dlg.FileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TBF", "TBF\TBF.csproj", "{8
|
||||
{C8939821-BA5C-4988-A3D0-BF53B74865C7} = {C8939821-BA5C-4988-A3D0-BF53B74865C7}
|
||||
{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF} = {EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}
|
||||
{0C0A1F4D-1363-4544-A7C5-196C76D26CCA} = {0C0A1F4D-1363-4544-A7C5-196C76D26CCA}
|
||||
{0F79CA69-9DBC-41F3-A6FC-5A2937365343} = {0F79CA69-9DBC-41F3-A6FC-5A2937365343}
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE} = {46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}
|
||||
{5D9B49E3-CDF9-4A27-80B4-58141D0EB0E0} = {5D9B49E3-CDF9-4A27-80B4-58141D0EB0E0}
|
||||
EndProjectSection
|
||||
@@ -71,6 +72,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataStreamInterface", "Data
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchematicDrawing", "SchematicDrawing\SchematicDrawing.csproj", "{0F79CA69-9DBC-41F3-A6FC-5A2937365343}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResetBatchNr", "ResetBatchNr\ResetBatchNr.csproj", "{D7F5A111-B2DF-4761-9574-AB730DF573A6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -315,6 +318,16 @@ Global
|
||||
{0F79CA69-9DBC-41F3-A6FC-5A2937365343}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{0F79CA69-9DBC-41F3-A6FC-5A2937365343}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{0F79CA69-9DBC-41F3-A6FC-5A2937365343}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{D7F5A111-B2DF-4761-9574-AB730DF573A6}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -116,11 +116,11 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
public byte MeretProtocol = 0;
|
||||
|
||||
// Array length is the reference flowmeters count plus one
|
||||
#if DN100 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || SLM_150 || SENTEC || CEVAK_200
|
||||
#if DN100 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || SENTEC || CEVAK_200
|
||||
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 PUCHONG_200 || GENESIS || BERLIN || GELSENWASSER || PETERSBURG_200 || RUM_MOB
|
||||
#elif PUCHONG_200 || GENESIS || BERLIN || GELSENWASSER || PETERSBURG_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];
|
||||
@@ -716,27 +716,27 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FixedStart."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses);
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses, 10);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FixedStartAdvanced."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses);
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses, 10);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FixedStartDefferedEval."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses);
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses, 10);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FixedStartMassCollDeferredEval."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, 2 * totalPulses);
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, 2 * totalPulses, 10);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FixedStartMassCollection."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.FixedStart), test.Qfrom, test.Qto, 2 * totalPulses);
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.FixedStart), test.Qfrom, test.Qto, 2 * totalPulses, 10);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FixedStartTankCollection."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, (totalPulses * 5 / 4));
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, (totalPulses * 5 / 4), 10);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FlyingStart."))
|
||||
{
|
||||
@@ -786,7 +786,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation StartProlongedMeasurementOp(OutputPath outputPath,
|
||||
double requiredFlowLo, double requiredFlowHi,
|
||||
int totalRefPulses, int massRefPulses)
|
||||
int totalRefPulses, int massRefPulses, int delayBeforeFlowRegulation = 0)
|
||||
{
|
||||
if (controlBoardCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
@@ -795,7 +795,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
else
|
||||
{
|
||||
return new StartMeasurementOp(this, outputPath, TestMethods.Diverter | TestMethods.Synchro | TestMethods.MassAndContinue,
|
||||
requiredFlowLo, requiredFlowHi, totalRefPulses, massRefPulses);
|
||||
requiredFlowLo, requiredFlowHi, totalRefPulses, massRefPulses, delayBeforeFlowRegulation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
@@ -22,8 +22,9 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
readonly double maximalFlow;
|
||||
readonly double reqFlowLo;
|
||||
readonly double reqFlowHi;
|
||||
readonly int totalRefPulses; /// Number of reference pulses for a complete test
|
||||
readonly int massRefPulses; /// Number of reference pulses for mass collection
|
||||
readonly int totalRefPulses; /// Number of reference pulses for a complete test
|
||||
readonly int massRefPulses; /// Number of reference pulses for mass collection
|
||||
readonly int delayBeforeFlowRegulation; /// Delay before flow control starts in seconds
|
||||
readonly TestMethods testMethod;
|
||||
readonly int diverterNr;
|
||||
|
||||
@@ -34,13 +35,16 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
{
|
||||
StartingTest,
|
||||
ResendCommand,
|
||||
TestStarted,
|
||||
ValveMoveToFlow,
|
||||
WaitingBeforeValveMove,
|
||||
StartingFlowRegulation,
|
||||
OpCompleted,
|
||||
}
|
||||
OpState opState;
|
||||
|
||||
|
||||
int delayStartTime; /// StateMachine.Time snapshot when delay before flow regulation starts
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Starts the measurement.
|
||||
/// Events: MeasurementStarted
|
||||
@@ -51,8 +55,8 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
/// <param name="totalRefPulses">Test duration in number of reference flowmeter pulses</param>
|
||||
/// <param name="filterConstant">Specifies filter for watermeter pulses</param>
|
||||
public StartMeasurementOp(ControlBoardDev controlBoard, OutputPath outputPath, TestMethods method,
|
||||
double requiredFlowLo, double requiredFlowHi, int refPulses)
|
||||
: this(controlBoard, outputPath, method, requiredFlowLo, requiredFlowHi, refPulses, refPulses)
|
||||
double requiredFlowLo, double requiredFlowHi, int refPulses, int delayBeforeFlowRegulation = 0)
|
||||
: this(controlBoard, outputPath, method, requiredFlowLo, requiredFlowHi, refPulses, refPulses, delayBeforeFlowRegulation)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -66,7 +70,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
/// <param name="refPulses">Test duration in number of reference flowmeter pulses</param>
|
||||
/// <param name="filterConstant">Specifies filter for watermeter pulses</param>
|
||||
public StartMeasurementOp(ControlBoardDev controlBoard, OutputPath outputPath, TestMethods method,
|
||||
double requiredFlowLo, double requiredFlowHi, int totalRefPulses, int massRefPulses)
|
||||
double requiredFlowLo, double requiredFlowHi, int totalRefPulses, int massRefPulses, int delayBeforeFlowRegulation = 0)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("controlBoardDev");
|
||||
this.controlBoard = controlBoard;
|
||||
@@ -100,12 +104,12 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
nominalFlow = outputPath.FlowMeter.NominalFlow;
|
||||
maximalFlow = 1.25 * nominalFlow;
|
||||
|
||||
this.reqFlowLo = requiredFlowLo;
|
||||
this.testMethod = method;
|
||||
this.reqFlowLo = requiredFlowLo;
|
||||
this.reqFlowHi = requiredFlowHi;
|
||||
|
||||
this.totalRefPulses = totalRefPulses;
|
||||
this.massRefPulses = massRefPulses;
|
||||
this.testMethod = method;
|
||||
this.delayBeforeFlowRegulation = delayBeforeFlowRegulation;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
@@ -155,7 +159,15 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
if ((statusP & StatusP.TestInProgress) != 0)
|
||||
{
|
||||
log.Info("Test started");
|
||||
opState = OpState.TestStarted;
|
||||
if (delayBeforeFlowRegulation > 0)
|
||||
{
|
||||
delayStartTime = StateMachine.Time;
|
||||
opState = OpState.WaitingBeforeValveMove;
|
||||
}
|
||||
else
|
||||
{
|
||||
opState = OpState.StartingFlowRegulation;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -170,7 +182,15 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
opState = OpState.StartingTest;
|
||||
return Event.None;
|
||||
}
|
||||
else if (opState == OpState.TestStarted)
|
||||
else if (opState == OpState.WaitingBeforeValveMove)
|
||||
{
|
||||
if (StateMachine.Time - delayStartTime >= delayBeforeFlowRegulation)
|
||||
{
|
||||
opState = OpState.StartingFlowRegulation;
|
||||
}
|
||||
return Event.None;
|
||||
}
|
||||
else if (opState == OpState.StartingFlowRegulation)
|
||||
{
|
||||
///
|
||||
/// Done once, issues an appropriate ValveMove(...) command
|
||||
@@ -185,18 +205,18 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
||||
|
||||
double freqLo = 2000.0 * reqFlowLo / nominalFlow;
|
||||
double freqHi = 2000.0 * reqFlowHi / nominalFlow;
|
||||
if (regulValve.IsCoax)
|
||||
{
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||
if (regulValve.IsCoax)
|
||||
{
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||
new float[2] { (float)((freqLo + freqHi) / 2), (float)((freqLo + freqHi) / 2) },
|
||||
regulValveStableTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||
new float[2] { (float)freqLo, (float)freqHi },
|
||||
regulValveStableTime);
|
||||
}
|
||||
regulValveStableTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||
new float[2] { (float)freqLo, (float)freqHi },
|
||||
regulValveStableTime);
|
||||
}
|
||||
|
||||
opState = OpState.OpCompleted;
|
||||
return Event.None;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegisterReader[] regReaders;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin and the End form
|
||||
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestStartStates;
|
||||
@@ -107,10 +107,10 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
}
|
||||
|
||||
/// <returns>null (not implemented)</returns>
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestEndStates;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
|
||||
/// <summary> Number of water meters </summary>
|
||||
public readonly int WaterMetersCount; /// Main + Aux water meter count as one (combined) water meter
|
||||
readonly IRegisterReader[] regReaders;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
@@ -78,7 +78,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
/// </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, IRegisterReader[] regReaders, bool[] disabled)
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
endStates = false;
|
||||
@@ -105,7 +105,7 @@ namespace TBF.BenchControl.DataEntry.Combined
|
||||
/// <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, IRegisterReader[] regReaders, string[] mainStartStateStr, string[] auxStartStateStr,
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] mainStartStateStr, string[] auxStartStateStr,
|
||||
bool[] disabled, double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegisterReader[] regReaders;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestStartStates;
|
||||
@@ -107,10 +107,10 @@ namespace TBF.BenchControl.DataEntry.Fewa
|
||||
}
|
||||
|
||||
/// <returns>null (not implemented)</returns>
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestEndStates;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int WMsCount;
|
||||
readonly IRegisterReader[] regReaders;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
|
||||
/// </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, IRegisterReader[] regReaders, bool[] disabled)
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
endStates = false;
|
||||
@@ -122,7 +122,7 @@ namespace TBF.BenchControl.DataEntry.Fewa
|
||||
/// <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, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegisterReader[] regReaders;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
@@ -116,7 +116,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestStartStates;
|
||||
@@ -125,10 +125,10 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
}
|
||||
|
||||
/// <returns>null (not implemented)</returns>
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestEndStates;
|
||||
@@ -143,7 +143,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi,
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi,
|
||||
double refEnergy, double energyErrLimLo, double energyErrLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegisterReader[] regReaders;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
@@ -106,7 +106,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
public TestStartEndForm(EntryFormCfg cfg, int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
|
||||
public TestStartEndForm(EntryFormCfg cfg, int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
endStates = false;
|
||||
@@ -135,7 +135,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
|
||||
/// <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(EntryFormCfg cfg, int waterMetersCount, IRegisterReader[] regReaders, string[] wmStartStateStr, string[] energyStartStateStr,
|
||||
public TestStartEndForm(EntryFormCfg cfg, int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, string[] energyStartStateStr,
|
||||
bool[] disabled, double refVolume, double errLimLo, double errLimHi,
|
||||
double refEnergy, double energyErrLimLo, double energyErrLimHi)
|
||||
: this()
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegisterReader[] regReaders;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
@@ -116,7 +116,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestStartStates;
|
||||
@@ -125,10 +125,10 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
}
|
||||
|
||||
/// <returns>null (not implemented)</returns>
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestEndStates;
|
||||
@@ -143,7 +143,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi,
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi,
|
||||
double refEnergy, double energyErrLimLo, double energyErrLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegisterReader[] regReaders;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
public TestStartEndForm(EntryFormCfg cfg, int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
|
||||
public TestStartEndForm(EntryFormCfg cfg, int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
endStates = false;
|
||||
@@ -127,7 +127,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
|
||||
/// <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(EntryFormCfg cfg, int waterMetersCount, IRegisterReader[] regReaders, string[] wmStartStateStr, string[] energyStartStateStr,
|
||||
public TestStartEndForm(EntryFormCfg cfg, int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, string[] energyStartStateStr,
|
||||
bool[] disabled, double refVolume, double errLimLo, double errLimHi,
|
||||
double refEnergy, double energyErrLimLo, double energyErrLimHi)
|
||||
: this()
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegisterReader[] regReaders;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin and the End form
|
||||
@@ -103,7 +103,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestStartStates;
|
||||
@@ -112,10 +112,10 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
}
|
||||
|
||||
/// <returns>null (not implemented)</returns>
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestEndStates;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
|
||||
/// <summary> Number of water meters </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegisterReader[] regReaders;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
@@ -62,7 +62,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
/// Constructor to fill in start states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
endStates = false;
|
||||
@@ -81,7 +81,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
|
||||
/// Constructor to fill in end states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Single
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegisterReader[] regReaders;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Single
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestStartStates;
|
||||
@@ -107,10 +107,10 @@ namespace TBF.BenchControl.DataEntry.Single
|
||||
}
|
||||
|
||||
/// <returns>null (not implemented)</returns>
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestEndStates;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Single
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegisterReader[] regReaders;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
@@ -91,7 +91,7 @@ namespace TBF.BenchControl.DataEntry.Single
|
||||
/// </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, int lineSize, IRegisterReader[] regReaders, bool[] disabled)
|
||||
public TestStartEndForm(int waterMetersCount, int lineSize, IRegReader[] regReaders, bool[] disabled)
|
||||
: this(waterMetersCount, lineSize)
|
||||
{
|
||||
endStates = false;
|
||||
@@ -113,7 +113,7 @@ namespace TBF.BenchControl.DataEntry.Single
|
||||
/// <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, int lineSize, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
public TestStartEndForm(int waterMetersCount, int lineSize, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
: this(waterMetersCount, lineSize)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegisterReader[] regReaders;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestStartStates;
|
||||
@@ -107,10 +107,10 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
}
|
||||
|
||||
/// <returns>null (not implemented)</returns>
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestEndStates;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegisterReader[] regReaders;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
@@ -81,7 +81,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
/// </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, IRegisterReader[] regReaders, bool[] disabled)
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
endStates = false;
|
||||
@@ -105,7 +105,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
|
||||
/// <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, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegisterReader[] regReaders;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
@@ -100,7 +100,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
this.currentOp = CurrentOp.EnterTestStartStates;
|
||||
@@ -110,7 +110,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isConditionOp = false)
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isConditionOp = false)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
this.currentOp = CurrentOp.EnterAdvancedTestStartStates;
|
||||
@@ -121,7 +121,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
this.currentOp = CurrentOp.EnterTestEndStates;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegisterReader[] regReaders;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
@@ -110,7 +110,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
kind = Kind.Start;
|
||||
@@ -130,7 +130,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of water meters</param>
|
||||
/// <param name="disabled">Information from CycleBeginningForm about availability of water meters</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] wmEndStateStr, bool[] disabled)
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmEndStateStr, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
kind = Kind.AdvancedStart;
|
||||
@@ -157,7 +157,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
|
||||
/// <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, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegisterReader[] regReaders;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestStartStates;
|
||||
@@ -107,10 +107,10 @@ namespace TBF.BenchControl.DataEntry.Standard48
|
||||
}
|
||||
|
||||
/// <returns>null (not implemented)</returns>
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestEndStates;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegisterReader[] regReaders;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
@@ -106,7 +106,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
|
||||
/// </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, IRegisterReader[] regReaders, bool[] disabled)
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
endStates = false;
|
||||
@@ -130,7 +130,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
|
||||
/// <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, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegisterReader[] regReaders;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
@@ -94,7 +94,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestStartStates;
|
||||
@@ -103,10 +103,10 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
}
|
||||
|
||||
/// <returns>null (not implemented)</returns>
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestEndStates;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
|
||||
/// <summary> Number of water meters </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegisterReader[] regReaders;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
@@ -43,7 +43,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
/// Constructor to fill in start states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, bool[] disabled)
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
@@ -63,7 +63,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
|
||||
/// Constructor to fill in end states
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
endStates = true;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegisterReader[] regReaders;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
|
||||
public string[] StartImages
|
||||
@@ -148,7 +148,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.TestStartStates;
|
||||
@@ -157,10 +157,10 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
}
|
||||
|
||||
/// <returns>null (not implemented)</returns>
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.TestEndStates;
|
||||
@@ -172,7 +172,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowDeferredTestEvalFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
public IOperation ShowDeferredTestEvalFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.DeferredTestEval;
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
readonly Tst mode; /// Start, End or Deferred
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegisterReader[] regReaders;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
readonly string[] startImages;
|
||||
readonly string[] endImages;
|
||||
@@ -136,7 +136,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
/// </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, IRegisterReader[] regReaders, string[] startImages, bool[] disabled)
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] startImages, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
mode = Tst.Start;
|
||||
@@ -174,7 +174,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
/// <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, IRegisterReader[] regReaders, string[] endImages, double[] wmStartState, string[] wmStartStateStr, bool[] disabled,
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] endImages, double[] wmStartState, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
@@ -210,7 +210,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
WMEndState = new double[waterMetersCount];
|
||||
}
|
||||
|
||||
public TestStartEndForm(int waterMetersCount, IRegisterReader[] regReaders, string[] startImages, string[] endImages,
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] startImages, string[] endImages,
|
||||
bool[] disabled, double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
@@ -297,7 +297,8 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
switch (mode)
|
||||
{
|
||||
case Tst.Start:
|
||||
if (disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1])
|
||||
if ((disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1]) ||
|
||||
(regReaders != null && wmPos <= regReaders.Length && regReaders[wmPos - 1] == null))
|
||||
{
|
||||
startTextBoxes[i].Enabled = false;
|
||||
}
|
||||
@@ -309,8 +310,9 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
break;
|
||||
|
||||
case Tst.End:
|
||||
if (disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1])
|
||||
{
|
||||
if ((disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1]) ||
|
||||
(regReaders != null && wmPos <= regReaders.Length && regReaders[wmPos - 1] == null))
|
||||
{
|
||||
startTextBoxes[i].Enabled = false;
|
||||
endTextBoxes[i].Enabled = false;
|
||||
}
|
||||
@@ -324,8 +326,9 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
break;
|
||||
|
||||
case Tst.Both:
|
||||
if (disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1])
|
||||
{
|
||||
if ((disabled != null && wmPos <= disabled.Length && disabled[wmPos - 1]) ||
|
||||
(regReaders != null && wmPos <= regReaders.Length && regReaders[wmPos - 1] == null))
|
||||
{
|
||||
startTextBoxes[i].Enabled = false;
|
||||
endTextBoxes[i].Enabled = false;
|
||||
}
|
||||
@@ -561,8 +564,29 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
if (enabledTextBoxes[i] == currentFocusOwner)
|
||||
{
|
||||
/// Change focus to the next enabled text box
|
||||
enabledTextBoxes[(i + 1) % enabledTextBoxes.Count].Focus();
|
||||
return;
|
||||
var currentTextBox = enabledTextBoxes[(i + 1) % enabledTextBoxes.Count];
|
||||
currentTextBox.Focus();
|
||||
|
||||
/// Load the respective image
|
||||
for (int j = 0; j < startTextBoxes.Length; j++)
|
||||
{
|
||||
if (startTextBoxes[j] == currentTextBox)
|
||||
{
|
||||
LoadImage(Tst.Start, j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < endTextBoxes.Length; j++)
|
||||
{
|
||||
if (endTextBoxes[j] == currentTextBox)
|
||||
{
|
||||
LoadImage(Tst.End, j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// No image found
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
IRegisterReader[] regReaders;
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Properties set by the Begin, End and WMStates form
|
||||
@@ -98,7 +98,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
}
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestStartFormOp(IRegisterReader[] regReaders)
|
||||
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestStartStates;
|
||||
@@ -107,10 +107,10 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
}
|
||||
|
||||
/// <returns>null (not implemented)</returns>
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp) { return null; }
|
||||
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||
{
|
||||
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||
currentOp = CurrentOp.EnterTestEndStates;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
|
||||
/// <summary> Number of text boxes for serial numbers </summary>
|
||||
public readonly int WaterMetersCount;
|
||||
readonly IRegisterReader[] regReaders;
|
||||
readonly IRegReader[] regReaders;
|
||||
readonly bool[] disabled;
|
||||
|
||||
// To be retrieved after the form closes
|
||||
@@ -89,7 +89,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
/// </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, IRegisterReader[] regReaders, bool[] disabled)
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, bool[] disabled)
|
||||
: this()
|
||||
{
|
||||
endStates = false;
|
||||
@@ -113,7 +113,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
|
||||
/// <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, IRegisterReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
public TestStartEndForm(int waterMetersCount, IRegReader[] regReaders, string[] wmStartStateStr, bool[] disabled,
|
||||
double refVolume, double errLimLo, double errLimHi)
|
||||
: this()
|
||||
{
|
||||
|
||||
@@ -40,9 +40,8 @@ namespace TBF.BenchControl.Dummy.Balance
|
||||
public float BuoyancyPress { get { return 1.013f; } }
|
||||
public float BuoyancyHumi { get { return 50.0f; } }
|
||||
|
||||
public IOperation TaringOp(ref Boxes.DoubleBox tara)
|
||||
public IOperation ZeroOp()
|
||||
{
|
||||
tara.Val = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,80 +75,83 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
controlBoard = TbfComponents.FindComponent(cfg.ParentName, components) as ControlBoardDev;
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
if (diverterCfg.BitNr < 0 || diverterCfg.BitNr >= 64) throw new ArgumentOutOfRangeException("position");
|
||||
this.mask = (((UInt128)1) << diverterCfg.BitNr);
|
||||
|
||||
switchTimeStart = new FloatBox(diverterCfg.DfltSwithTimeStartMs / 1000.0f);
|
||||
switchTimeEnd = new FloatBox(diverterCfg.DfltSwithTimeEndMs / 1000.0f);
|
||||
|
||||
diverterNr0 = nextIdx++;
|
||||
///
|
||||
if (Diverters == null || Diverters.Length < nextIdx)
|
||||
{
|
||||
GenericDevices.IDiverter[] divertersSoFar = Diverters;
|
||||
|
||||
Diverters = new GenericDevices.IDiverter[nextIdx];
|
||||
|
||||
if (divertersSoFar != null)
|
||||
{
|
||||
for (int i = 0; i < divertersSoFar.Length; i++) Diverters[i] = divertersSoFar[i];
|
||||
|
||||
}
|
||||
|
||||
Diverters[nextIdx - 1] = this;
|
||||
}
|
||||
|
||||
/// Prepare arguments of SendCalibData()
|
||||
if (diverterCfg.AdcNr >= 0 && diverterCfg.AdcNr < controlBoard.RegValveCalib.GetLength(0))
|
||||
{
|
||||
controlBoard.RegValveCalib[diverterCfg.AdcNr, 0] = (uint)diverterCfg.AdcValueToSink;
|
||||
controlBoard.RegValveCalib[diverterCfg.AdcNr, 1] = (uint)diverterCfg.AdcValueToTank;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.ErrorFormat("Unable to set {0} ADC levels: RegValveCalib array size={1}, diverter AdcNr={2}",
|
||||
Name, controlBoard.RegValveCalib.GetLength(0), diverterCfg.AdcNr);
|
||||
}
|
||||
|
||||
|
||||
int divNrFromName;
|
||||
if (!int.TryParse(Name.Substring(3), out divNrFromName))
|
||||
if (cfg.DebugLevel != Config.Entities.DebugMode.Off)
|
||||
{
|
||||
divNrFromName = nextIdx;
|
||||
}
|
||||
#if GENESIS || PETERSBURG_50 || PETERSBURG_200 || FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || ROMA_200
|
||||
flowMtrNr4Cmd = divNrFromName + 1;
|
||||
if (diverterCfg.BitNr < 0 || diverterCfg.BitNr >= 64) throw new ArgumentOutOfRangeException("position");
|
||||
this.mask = (((UInt128)1) << diverterCfg.BitNr);
|
||||
|
||||
switchTimeStart = new FloatBox(diverterCfg.DfltSwithTimeStartMs / 1000.0f);
|
||||
switchTimeEnd = new FloatBox(diverterCfg.DfltSwithTimeEndMs / 1000.0f);
|
||||
|
||||
diverterNr0 = nextIdx++;
|
||||
///
|
||||
if (Diverters == null || Diverters.Length < nextIdx)
|
||||
{
|
||||
GenericDevices.IDiverter[] divertersSoFar = Diverters;
|
||||
|
||||
Diverters = new GenericDevices.IDiverter[nextIdx];
|
||||
|
||||
if (divertersSoFar != null)
|
||||
{
|
||||
for (int i = 0; i < divertersSoFar.Length; i++) Diverters[i] = divertersSoFar[i];
|
||||
|
||||
}
|
||||
|
||||
Diverters[nextIdx - 1] = this;
|
||||
}
|
||||
|
||||
/// Prepare arguments of SendCalibData()
|
||||
if (diverterCfg.AdcNr >= 0 && diverterCfg.AdcNr < controlBoard.RegValveCalib.GetLength(0))
|
||||
{
|
||||
controlBoard.RegValveCalib[diverterCfg.AdcNr, 0] = (uint)diverterCfg.AdcValueToSink;
|
||||
controlBoard.RegValveCalib[diverterCfg.AdcNr, 1] = (uint)diverterCfg.AdcValueToTank;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.ErrorFormat("Unable to set {0} ADC levels: RegValveCalib array size={1}, diverter AdcNr={2}",
|
||||
Name, controlBoard.RegValveCalib.GetLength(0), diverterCfg.AdcNr);
|
||||
}
|
||||
|
||||
|
||||
int divNrFromName;
|
||||
if (!int.TryParse(Name.Substring(3), out divNrFromName))
|
||||
{
|
||||
divNrFromName = nextIdx;
|
||||
}
|
||||
#if GENESIS || PETERSBURG_50 || PETERSBURG_200 || FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || ROMA_200 || SLM_150
|
||||
flowMtrNr4Cmd = divNrFromName + 1;
|
||||
#elif BADGER_STREDNA_TRAT
|
||||
flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : ((divNrFromName == 2) ? 9 : 20);
|
||||
flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : ((divNrFromName == 2) ? 9 : 20);
|
||||
#elif BADGER_VELKA_TRAT
|
||||
flowMtrNr4Cmd = ((divNrFromName % 10) == 1) ? 0x11 : (((divNrFromName % 10) == 2) ? 0x22 : 0x33);
|
||||
flowMtrNr4Cmd = ((divNrFromName % 10) == 1) ? 0x11 : (((divNrFromName % 10) == 2) ? 0x22 : 0x33);
|
||||
#elif FUZHOU_100
|
||||
flowMtrNr4Cmd = divNrFromName;
|
||||
flowMtrNr4Cmd = divNrFromName;
|
||||
#elif CEVAK_200
|
||||
flowMtrNr4Cmd = (divNrFromName == 4) ? 5 : divNrFromName;
|
||||
flowMtrNr4Cmd = (divNrFromName == 4) ? 5 : divNrFromName;
|
||||
#elif DEWA_300 || PUCHONG_200
|
||||
flowMtrNr4Cmd = divNrFromName + 2; /// Div1: 1,2,3, Div2: 4, Div3: 5, Div4: 6, Div5: 7
|
||||
flowMtrNr4Cmd = divNrFromName + 2; /// Div1: 1,2,3, Div2: 4, Div3: 5, Div4: 6, Div5: 7
|
||||
#elif TURA_IPERL || TURA_IPERL_NEW
|
||||
flowMtrNr4Cmd = divNrFromName + 16 * divNrFromName;
|
||||
flowMtrNr4Cmd = divNrFromName + 16 * divNrFromName;
|
||||
#elif FILIPINY_50
|
||||
flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : 7;
|
||||
flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : 7;
|
||||
#elif GELSENWASSER
|
||||
switch (divNrFromName)
|
||||
{
|
||||
default:
|
||||
case 1: flowMtrNr4Cmd = 1; break;
|
||||
case 2: flowMtrNr4Cmd = 0x12; break;
|
||||
case 3: flowMtrNr4Cmd = 3; break;
|
||||
case 4: flowMtrNr4Cmd = 5; break;
|
||||
}
|
||||
switch (divNrFromName)
|
||||
{
|
||||
default:
|
||||
case 1: flowMtrNr4Cmd = 1; break;
|
||||
case 2: flowMtrNr4Cmd = 0x12; break;
|
||||
case 3: flowMtrNr4Cmd = 3; break;
|
||||
case 4: flowMtrNr4Cmd = 5; break;
|
||||
}
|
||||
#else
|
||||
flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : 3;
|
||||
flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : 3;
|
||||
#endif
|
||||
diverterToTankOp = new SwitchDiverterOp(controlBoard, true, flowMtrNr4Cmd);
|
||||
diverterToSinkOp = new SwitchDiverterOp(controlBoard, false, flowMtrNr4Cmd);
|
||||
diverterToTankOp = new SwitchDiverterOp(controlBoard, true, flowMtrNr4Cmd);
|
||||
diverterToSinkOp = new SwitchDiverterOp(controlBoard, false, flowMtrNr4Cmd);
|
||||
|
||||
|
||||
log.Debug(this.ToString());
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
@@ -20,6 +20,6 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// Displays form at the end of the test to enter water meter start start.
|
||||
/// </summary>
|
||||
/// <returns>Operation to be used in the sequence</returns>
|
||||
IOperation ShowDeferredTestEvalFormOp(IRegisterReader[] regReaders, double volumeRef, double errLimLo, double errLimHi);
|
||||
IOperation ShowDeferredTestEvalFormOp(IRegReader[] regReaders, double volumeRef, double errLimLo, double errLimHi);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// Displays form at the end of the test to enter water meter start start.
|
||||
/// </summary>
|
||||
/// <returns>Operation to be used in the sequence</returns>
|
||||
IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double refVolume, double errLimLo, double errLimHi,
|
||||
IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi,
|
||||
double refEnergy, double energyErrLimLo, double energyErrLimHi);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,18 +27,18 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// Displays form at the beginning of the test to enter water meter start start.
|
||||
/// </summary>
|
||||
/// <returns>Operation to be used in the sequence</returns>
|
||||
IOperation ShowTestStartFormOp(IRegisterReader[] regReaders);
|
||||
IOperation ShowTestStartFormOp(IRegReader[] regReaders);
|
||||
|
||||
/// <summary>
|
||||
/// Displays form at the beginning of the test to enter water meter start start.
|
||||
/// </summary>
|
||||
/// <returns>Operation to be used in the sequence</returns>
|
||||
IOperation ShowAdvancedTestStartFormOp(IRegisterReader[] regReaders, IList<WaterMeter> waterMeters, bool isCondOp = false);
|
||||
IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<WaterMeter> waterMeters, bool isCondOp = false);
|
||||
|
||||
/// <summary>
|
||||
/// Displays form at the end of the test to enter water meter start start.
|
||||
/// </summary>
|
||||
/// <returns>Operation to be used in the sequence</returns>
|
||||
IOperation ShowTestEndFormOp(IRegisterReader[] regReaders, double volumeRef, double errLimLo, double errLimHi);
|
||||
IOperation ShowTestEndFormOp(IRegReader[] regReaders, double volumeRef, double errLimLo, double errLimHi);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IRegisterReader : IComponent
|
||||
public interface IRegReader : IComponent
|
||||
{
|
||||
Config.Entities.RegisterReaderType RegisterReaderType { get; }
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ using System;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
interface IDatastreamReader : IRegisterReader
|
||||
interface IRegReaderDatastream : IRegReader
|
||||
{
|
||||
bool NoSamples { get; }
|
||||
double VolumeLtrStart { get; }
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IRoi : IComponent, IRoiForFixedStart
|
||||
public interface IRegReaderLiveCamera : IRegReaderStillCamera
|
||||
{
|
||||
bool Detected { get; }
|
||||
string ImageFileNamePrefix { get; } /// Either "detected.jpg" or string.Format("img{0}.jpg", nr) is appended
|
||||
@@ -0,0 +1,16 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
interface IRegReaderPulses : IRegReader
|
||||
{
|
||||
int Position { get; }
|
||||
int Filter { get; }
|
||||
|
||||
double PulsesPerLtr { get; } /// [imp/l] ... water meter or volume measurement part of a heat meter
|
||||
double LtrsPerPulse { get; } /// [l/imp]
|
||||
|
||||
int WMPulses { get; } /// Counted pulses of the water meter
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
public interface IRoiForFixedStart : IComponent, IRegisterReader
|
||||
public interface IRegReaderStillCamera : IRegReader
|
||||
{
|
||||
GenericDevices.ICamera Camera { get; }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using TBF.Boxes;
|
||||
|
||||
@@ -17,9 +17,8 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="result">Reference to a variable for 'tara' in kg</param>
|
||||
/// <returns>TaringOp instance reference casted to IOperaton</returns>
|
||||
IOperation TaringOp(ref DoubleBox tara);
|
||||
/// <returns>ZeroOp instance reference casted to IOperaton</returns>
|
||||
IOperation ZeroOp();
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
|
||||
@@ -10,14 +10,14 @@ namespace TBF.BenchControl
|
||||
{
|
||||
public int ItemNr;
|
||||
public string Name;
|
||||
public IRegisterReader[] RegisterReaders;
|
||||
public IRegReader[] RegisterReaders;
|
||||
|
||||
/// Constructor from name, the rest is empty
|
||||
public MetersPath(string name, int itemNr)
|
||||
{
|
||||
ItemNr = itemNr;
|
||||
Name = name;
|
||||
RegisterReaders = new IRegisterReader[Config.Data.WMsCount];
|
||||
RegisterReaders = new IRegReader[Config.Data.WMsCount];
|
||||
}
|
||||
|
||||
public MetersPath(Config.Entities.MetersPath entity, IList<BenchControl.Generic.IComponent> components)
|
||||
@@ -25,7 +25,7 @@ namespace TBF.BenchControl
|
||||
{
|
||||
for (int i = 0; i < Config.Data.WMsCount; i++)
|
||||
{
|
||||
RegisterReaders[i] = (IRegisterReader)TbfComponents.FindComponent(entity.GetSensor(i), components);
|
||||
RegisterReaders[i] = (IRegReader)TbfComponents.FindComponent(entity.GetSensor(i), components);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.MettlerToledo
|
||||
{
|
||||
public class KeepReadingMassesOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(KeepReadingMassesOp));
|
||||
public override string ToString() { return string.Format("KeepReadingMassesOp()"); }
|
||||
|
||||
bool done;
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="balanceDev">Balance device instance</param>
|
||||
/// <param name="requiredReadingsCount">Required mass readings count (>= 3)</param>
|
||||
/// <param name="result">Reference to the measured mass in kg</param>
|
||||
public KeepReadingMassesOp()
|
||||
{
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
done = false;
|
||||
|
||||
for (int i = 0; i < Standard.BalanceDev.BalancesCount; i++)
|
||||
{
|
||||
Standard.BalanceDev.Balances[i].GetImmediateMassMeasurement();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.None
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (done) return Event.BalanceDone; /// Mass has already been read
|
||||
|
||||
for (int i = 0; i < Standard.BalanceDev.BalancesCount; i++)
|
||||
{
|
||||
if (Standard.BalanceDev.Balances[i].MsrmntState != MsrmntState.Busy)
|
||||
{
|
||||
Standard.BalanceDev.Balances[i].GetImmediateMassMeasurement();
|
||||
}
|
||||
}
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -297,16 +297,26 @@ namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
|
||||
public void StopDevice2() { }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="result">Reference to a variable for 'tara' in kg</param>
|
||||
/// <returns>TaringOp instance reference casted to IOperaton</returns>
|
||||
public IOperation TaringOp(ref DoubleBox tara)
|
||||
/// <returns>ZeroOp reference</returns>
|
||||
public IOperation ZeroOp()
|
||||
{
|
||||
return new TaringOp(this, ref tara);
|
||||
return new ZeroOp(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="result">Reference to a variable for 'tara' in kg</param>
|
||||
/// <returns>TaringOp reference</returns>
|
||||
public IOperation TaringOp(ref DoubleBox tara)
|
||||
{
|
||||
return new TaringOp(this, ref tara);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.MettlerToledo.Multi
|
||||
{
|
||||
public class ZeroOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ZeroOp));
|
||||
public override string ToString() { return string.Format("ZeroOp(.,.)"); }
|
||||
|
||||
bool done;
|
||||
|
||||
/// Set by the constructor
|
||||
BalanceDev balanceDev;
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="balanceDev">Balance device instance</param>
|
||||
public ZeroOp(BalanceDev balanceDev)
|
||||
{
|
||||
if (balanceDev == null) throw new ArgumentNullException("balanceDev");
|
||||
this.balanceDev = balanceDev;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
done = true;
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.None
|
||||
/// Event.BalanceDone
|
||||
/// Event.Error . . . . . Current.Tick == null
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (done) return Event.BalanceDone; /// Zero has been done already
|
||||
|
||||
if (balanceDev.MsrmntState == MsrmntState.Busy) return Event.Busy;
|
||||
|
||||
if (balanceDev.MsrmntState == MsrmntState.Overload)
|
||||
{
|
||||
done = true;
|
||||
return Event.BalanceOverload;
|
||||
}
|
||||
|
||||
if (balanceDev.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
done = true;
|
||||
return Event.BalanceDone; /// Zero completed
|
||||
}
|
||||
|
||||
return Event.Busy;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
@@ -31,7 +31,7 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
|
||||
for (int i = 0; i < Standard.BalanceDev.BalancesCount; i++)
|
||||
{
|
||||
Standard.BalanceDev.Balances[i].GetImmediateMassMeasurement();
|
||||
Standard.BalanceDev.Balances[i].SendImmediateMeasurementCmd();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,13 @@ using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
{
|
||||
public enum Activity
|
||||
{
|
||||
Idle,
|
||||
ImmediateMeasurement,
|
||||
RunningOperation,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mettler Toledo ICS4_5 Weighting terminal connected via serial interface (RS232)
|
||||
/// </summary>
|
||||
@@ -64,7 +71,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
|
||||
|
||||
/// <summary>The state of the mass measurement</summary>
|
||||
public MsrmntState MsrmntState { get { return msrmntState; } }
|
||||
public Activity Activity;
|
||||
public MsrmntState MsrmntState { get { return msrmntState; } set { msrmntState = value; } }
|
||||
protected MsrmntState msrmntState;
|
||||
|
||||
/// <summary>Time since the last serial command in seconds</summary>
|
||||
@@ -121,6 +129,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
throw new Exception(string.Format("{0}: {1}", Name, Strings.Calibration_certificate_validity_expired));
|
||||
}
|
||||
|
||||
Activity = Activity.Idle;
|
||||
msrmntState = MsrmntState.Failed; /// Data not valid yet
|
||||
MsrmntTime = 0;
|
||||
|
||||
@@ -178,7 +187,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
return (mass >= thld);
|
||||
}
|
||||
|
||||
public void ZeroWhenStable()
|
||||
public virtual void SendZeroWhenStableCmd()
|
||||
{
|
||||
if (balanceCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
@@ -188,7 +197,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
return;
|
||||
}
|
||||
|
||||
log.InfoFormat("{0} - ZeroWhenStable()", Name);
|
||||
log.InfoFormat("{0} - SendZeroWhenStableCmd() - \"Z\\r\\n\"", Name);
|
||||
|
||||
msrmntState = MsrmntState.Busy;
|
||||
MsrmntTime = 0;
|
||||
@@ -196,7 +205,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
serialPort.Write("Z\r\n");
|
||||
}
|
||||
|
||||
public virtual void Taring()
|
||||
public virtual void SendTaraCmd()
|
||||
{
|
||||
if (balanceCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
@@ -206,7 +215,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
return;
|
||||
}
|
||||
|
||||
log.InfoFormat("{0} - Taring()", Name);
|
||||
log.InfoFormat("{0} - SendTaraCmd() - - \"T\\r\\n\"", Name);
|
||||
|
||||
msrmntState = MsrmntState.Busy;
|
||||
MsrmntTime = 0;
|
||||
@@ -217,7 +226,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <summary>
|
||||
/// Get a stable mass measurement
|
||||
/// </summary>
|
||||
public void GetStableMassMeasurement()
|
||||
public void SendStableMeasurementCmd()
|
||||
{
|
||||
if (balanceCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
@@ -227,7 +236,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
return;
|
||||
}
|
||||
|
||||
log.InfoFormat("{0} - GetStableMassMeasurement()", Name);
|
||||
log.InfoFormat("{0} - SendStableMeasurementCmd() - \"S\\r\\n\"", Name);
|
||||
|
||||
msrmntState = MsrmntState.Busy;
|
||||
MsrmntTime = 0;
|
||||
@@ -238,7 +247,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <summary>
|
||||
/// Get an immediate mass measurement
|
||||
/// </summary>
|
||||
public void GetImmediateMassMeasurement()
|
||||
public void SendImmediateMeasurementCmd()
|
||||
{
|
||||
if (balanceCfg.DebugLevel == DebugMode.Simulate || serialPort == null) return;
|
||||
|
||||
@@ -248,7 +257,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
return;
|
||||
}
|
||||
|
||||
log.InfoFormat("{0} - GetImmediateMassMeasurement()", Name);
|
||||
log.InfoFormat("{0} - SendImmediateMeasurementCmd() - \"SI\\r\\n\"", Name);
|
||||
|
||||
msrmntState = MsrmntState.Busy;
|
||||
MsrmntTime = 0;
|
||||
@@ -270,7 +279,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// Get the serial number
|
||||
/// </summary>
|
||||
/// <remarks>After a successful SetUnits(kg) mass is still sent in g. MH 15.10.2013</remarks>
|
||||
public void SetUnits(Units unit)
|
||||
public void SendSetUnitsCmd(Units unit)
|
||||
{
|
||||
if (balanceCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
@@ -280,17 +289,30 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
return;
|
||||
}
|
||||
|
||||
log.InfoFormat("{0} - SetUnits({1})", Name, unit);
|
||||
|
||||
msrmntState = MsrmntState.Busy;
|
||||
stringBuilder.Clear();
|
||||
switch (unit)
|
||||
{
|
||||
case Units.g: serialPort.Write("U g\r\n"); break;
|
||||
case Units.kg: serialPort.Write("U kg\r\n"); break;
|
||||
case Units.t: serialPort.Write("U t\r\n"); break;
|
||||
case Units.lb: serialPort.Write("U lb\r\n"); break;
|
||||
case Units.oz: serialPort.Write("U oz\r\n"); break;
|
||||
case Units.g:
|
||||
log.InfoFormat("{0} - SetUnits({1}) - \"U g\\r\\n\"", Name, unit);
|
||||
serialPort.Write("U g\r\n");
|
||||
break;
|
||||
case Units.kg:
|
||||
log.InfoFormat("{0} - SetUnits({1}) - \"U kg\\r\\n\"", Name, unit);
|
||||
serialPort.Write("U kg\r\n");
|
||||
break;
|
||||
case Units.t:
|
||||
log.InfoFormat("{0} - SetUnits({1}) - \"U t\\r\\n\"", Name, unit);
|
||||
serialPort.Write("U t\r\n");
|
||||
break;
|
||||
case Units.lb:
|
||||
log.InfoFormat("{0} - SetUnits({1}) - \"U lb\\r\\n\"", Name, unit);
|
||||
serialPort.Write("U lb\r\n");
|
||||
break;
|
||||
case Units.oz:
|
||||
log.InfoFormat("{0} - SetUnits({1}) - \"U oz\\r\\n\"", Name, unit);
|
||||
serialPort.Write("U oz\r\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,6 +340,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
log.DebugFormat("{0} - RunDeviceBefore()", Name);
|
||||
|
||||
if (msrmntState != MsrmntState.Busy) return; /// No measurement in progress
|
||||
///
|
||||
if (Activity == Activity.ImmediateMeasurement)
|
||||
{
|
||||
Activity = Activity.Idle;
|
||||
}
|
||||
|
||||
string justReceived = serialPort.ReadExisting();
|
||||
if (justReceived != null && justReceived.Length > 0)
|
||||
@@ -501,6 +528,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <summary>Run this device</summary>
|
||||
public void RunDeviceAfter()
|
||||
{
|
||||
if (Activity == Activity.Idle)
|
||||
{
|
||||
SendImmediateMeasurementCmd();
|
||||
Activity = Activity.ImmediateMeasurement;
|
||||
}
|
||||
base.RunAfter();
|
||||
}
|
||||
|
||||
@@ -519,13 +551,22 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="result">Reference to a variable for 'tara' in kg</param>
|
||||
/// <returns>TaringOp instance reference casted to IOperaton</returns>
|
||||
public IOperation TaringOp(ref DoubleBox tara)
|
||||
/// <returns>ZeroOp reference</returns>
|
||||
public IOperation ZeroOp()
|
||||
{
|
||||
return new TaringOp(this, ref tara);
|
||||
return new ZeroOp(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="result">Reference to a variable for 'tara' in kg</param>
|
||||
/// <returns>TaringOp reference</returns>
|
||||
public IOperation TaringOp(ref DoubleBox tara)
|
||||
{
|
||||
return new TaringOp(this, ref tara);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Globalization;
|
||||
@@ -41,21 +41,21 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <summary>
|
||||
/// Get the serial number
|
||||
/// </summary>
|
||||
public void GetSerialNumber()
|
||||
public void SendGetSerialNumberCmd()
|
||||
{
|
||||
if (balanceCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
if (msrmntState == MsrmntState.Busy)
|
||||
{
|
||||
log.WarnFormat("{0} - GetSerialNumber() returns without getting the s/n because measurementState == MeasurementState.Busy", Name);
|
||||
log.WarnFormat("{0} - SendGetSerialNumberCmd() returns without getting the s/n because measurementState == MeasurementState.Busy", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
log.WarnFormat("{0} - GetSerialNumber()", Name);
|
||||
log.WarnFormat("{0} - SendGetSerialNumberCmd() - \"I4\\r\\n\"", Name);
|
||||
|
||||
msrmntState = MsrmntState.Busy;
|
||||
stringBuilder.Clear();
|
||||
serialPort.Write(new byte[] { (byte)'I', (byte)'4', (byte)0x0D, (byte)0x0A }, 0, 4);
|
||||
serialPort.Write("I4\r\n");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -84,6 +84,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
log.DebugFormat("{0} - RunDevice()", Name);
|
||||
|
||||
if (base.msrmntState != MsrmntState.Busy) return; /// No measurement in progress
|
||||
///
|
||||
if (Activity == Activity.ImmediateMeasurement)
|
||||
{
|
||||
Activity = Activity.Idle;
|
||||
}
|
||||
|
||||
string justReceived = serialPort.ReadExisting();
|
||||
if (justReceived != null && justReceived.Length > 0)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -27,9 +27,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(BalanceOld));
|
||||
public override string ToString() { return string.Format("MettlerToledo.Standard.BalanceOld({0})", Cfg.ToString(1)); }
|
||||
|
||||
public BalanceOld()
|
||||
{
|
||||
}
|
||||
public BalanceOld() { }
|
||||
|
||||
public BalanceOld(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
@@ -37,25 +35,13 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public override void Taring()
|
||||
|
||||
public override void SendZeroWhenStableCmd()
|
||||
{
|
||||
if (balanceCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
if (msrmntState == MsrmntState.Busy)
|
||||
{
|
||||
log.WarnFormat("{0} - Taring() returns without starting taring the scale because measurementState == MeasurementState.Busy", Name);
|
||||
return;
|
||||
}
|
||||
|
||||
log.InfoFormat("{0} - Taring()", Name);
|
||||
|
||||
stringBuilder.Clear();
|
||||
serialPort.Write("T\r\n");
|
||||
|
||||
mass = 0;
|
||||
msrmntState = MsrmntState.Valid;
|
||||
base.SendTaraCmd();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Parse characters received from the serial port
|
||||
/// </summary>
|
||||
@@ -78,9 +64,14 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
return;
|
||||
}
|
||||
|
||||
log.DebugFormat("{0} - RunDevice()", Name);
|
||||
log.DebugFormat("{0} - RunDeviceBefore()", Name);
|
||||
|
||||
if (base.msrmntState != MsrmntState.Busy) return; /// No measurement in progress
|
||||
///
|
||||
if (Activity == Activity.ImmediateMeasurement)
|
||||
{
|
||||
Activity = Activity.Idle;
|
||||
}
|
||||
|
||||
string justReceived = serialPort.ReadExisting();
|
||||
if (justReceived != null && justReceived.Length > 0)
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// Set by the constructor
|
||||
BalanceNewDev scale;
|
||||
string serialNumber;
|
||||
bool activityStarted;
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
@@ -24,7 +25,6 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
{
|
||||
if (scale == null) throw new ArgumentNullException("balanceDev");
|
||||
this.scale = scale;
|
||||
|
||||
this.serialNumber = serialNumber;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
@@ -33,9 +33,17 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
log.DebugFormat("{0} - Start()", scale.Name);
|
||||
scale.GetSerialNumber();
|
||||
}
|
||||
if (scale.Activity == Activity.Idle)
|
||||
{
|
||||
scale.SendGetSerialNumberCmd();
|
||||
activityStarted = true;
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
}
|
||||
else
|
||||
{
|
||||
activityStarted = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
@@ -44,27 +52,33 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
log.DebugFormat("{0} - GetSerNumOp.Run() ... MsrmntState = {1}", scale.Name, scale.MsrmntState);
|
||||
if (!activityStarted && scale.Activity == Activity.Idle)
|
||||
{
|
||||
scale.SendGetSerialNumberCmd();
|
||||
activityStarted = true;
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
return Event.Busy;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Valid)
|
||||
if (scale.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
serialNumber = scale.SerialNumber;
|
||||
return Event.BalanceDone; /// S/N read successful
|
||||
return Event.BalanceDone; /// S/N read successful
|
||||
}
|
||||
else if (scale.MsrmntState == MsrmntState.Failed)
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Failed)
|
||||
{
|
||||
return Event.Error; /// S/N read failed
|
||||
}
|
||||
else
|
||||
{
|
||||
return Event.Busy; /// No result yet
|
||||
}
|
||||
|
||||
return Event.Busy; /// No result yet
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
log.DebugFormat("{0} - Stop()", scale.Name);
|
||||
if (scale.MsrmntState == MsrmntState.Busy) scale.MsrmntState = MsrmntState.Failed;
|
||||
scale.Activity = Activity.Idle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
@@ -12,84 +12,42 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ReadMassOp));
|
||||
public override string ToString() { return string.Format("ReadMassOp(.,.)"); }
|
||||
|
||||
bool started;
|
||||
bool done;
|
||||
|
||||
/// Set by the constructor
|
||||
BalanceDev scale;
|
||||
DoubleBox result;
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// Events: BalanceDone (always)
|
||||
/// </summary>
|
||||
/// <param name="scale">Balance device instance</param>
|
||||
/// <param name="requiredReadingsCount">Required mass readings count (>= 3)</param>
|
||||
/// <param name="result">Reference to the measured mass in kg</param>
|
||||
public ReadMassOp(BalanceDev scale, ref DoubleBox result)
|
||||
{
|
||||
if (scale == null) throw new ArgumentNullException("balanceDev");
|
||||
this.scale = scale;
|
||||
|
||||
this.result = result;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
scale.GetImmediateMassMeasurement();
|
||||
started = true;
|
||||
done = false;
|
||||
result.Val = scale.Mass;
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.None
|
||||
/// Event.BalanceDone
|
||||
/// Event.Error . . . . . Current.Tick == null
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
scale.MsrmntTime++;
|
||||
|
||||
if (!started)
|
||||
{
|
||||
scale.GetImmediateMassMeasurement();
|
||||
started = true;
|
||||
done = false;
|
||||
return Event.Busy;
|
||||
}
|
||||
else if (started && scale.MsrmntState == MsrmntState.Busy)
|
||||
{
|
||||
/// Measurement is in progress
|
||||
|
||||
if (scale.MsrmntTime >= 2)
|
||||
{
|
||||
/// Timeout - no response from the scale within 2 seconds - send command again
|
||||
scale.GetImmediateMassMeasurement();
|
||||
started = true;
|
||||
done = false;
|
||||
}
|
||||
|
||||
return Event.Busy;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Measurement completed or failed: (started == true) && (scale.MsrmntState != MsrmntState.Busy)
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Valid) result.Val = scale.Mass;
|
||||
log.InfoFormat("ReadMassOp.Run() ... state={0}, mass={1} ... returning Event.BalanceDone",
|
||||
scale.MsrmntState, scale.Mass);
|
||||
done = true;
|
||||
started = false;
|
||||
return Event.BalanceDone; /// Mass read OK
|
||||
}
|
||||
result.Val = scale.Mass;
|
||||
return Event.BalanceDone;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
double[] sortedMassReadings;
|
||||
int currentReadingsCount;
|
||||
|
||||
bool activityStarted;
|
||||
bool measurementCompleted;
|
||||
int timeout;
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
@@ -45,28 +47,46 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
this.totalReadingsCount = (readingsCount < 4) ? 5 : readingsCount; /// readingsCount is at least 4
|
||||
this.maxSpread = (maxSpread == 0) ? (scale.Capacity / 20000.0) : maxSpread;
|
||||
this.method = method;
|
||||
|
||||
this.result = result;
|
||||
|
||||
massReadings = new double[totalReadingsCount];
|
||||
sortedMassReadings = new double[totalReadingsCount];
|
||||
currentReadingsCount = 0;
|
||||
measurementCompleted = false;
|
||||
activityStarted = false;
|
||||
measurementCompleted = false;
|
||||
timeout = (method == Config.Entities.MassMethod.Scale) ? 60 : 2;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call scale.XYStartMeasurement() function and set measurementStarted flag.
|
||||
/// </summary>
|
||||
void StartMeasurement()
|
||||
{
|
||||
if (method == Config.Entities.MassMethod.Scale)
|
||||
scale.SendStableMeasurementCmd();
|
||||
else
|
||||
scale.SendImmediateMeasurementCmd();
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
currentReadingsCount = 0;
|
||||
measurementCompleted = false;
|
||||
currentReadingsCount = 0;
|
||||
measurementCompleted = false;
|
||||
|
||||
if (method == Config.Entities.MassMethod.Scale)
|
||||
scale.GetStableMassMeasurement();
|
||||
if (scale.Activity == Activity.Idle)
|
||||
{
|
||||
StartMeasurement();
|
||||
activityStarted = true;
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
}
|
||||
else
|
||||
scale.GetImmediateMassMeasurement();
|
||||
}
|
||||
{
|
||||
activityStarted = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
@@ -78,21 +98,23 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
{
|
||||
scale.MsrmntTime++;
|
||||
|
||||
if (measurementCompleted) return Event.BalanceDone;
|
||||
if (!activityStarted && scale.Activity == Activity.Idle)
|
||||
{
|
||||
StartMeasurement();
|
||||
activityStarted = true;
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
if (measurementCompleted)
|
||||
{
|
||||
return Event.BalanceDone;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Busy)
|
||||
{
|
||||
/// Measurement is in progress - resend command if timeout occurs
|
||||
|
||||
if (method == Config.Entities.MassMethod.Scale)
|
||||
{
|
||||
if (scale.MsrmntTime >= 60) scale.GetStableMassMeasurement();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (scale.MsrmntTime >= 2) scale.GetImmediateMassMeasurement();
|
||||
}
|
||||
|
||||
/// Measurement is in progress - resend command if timeout occurs
|
||||
if (scale.MsrmntTime >= timeout) StartMeasurement();
|
||||
return Event.None; /// Wait for a mass measurement
|
||||
}
|
||||
|
||||
@@ -177,14 +199,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
/// Start a new measurement
|
||||
///
|
||||
if (method == Config.Entities.MassMethod.Scale)
|
||||
scale.GetStableMassMeasurement();
|
||||
else
|
||||
scale.GetImmediateMassMeasurement();
|
||||
|
||||
StartMeasurement(); /// Start a new measurement
|
||||
return Event.None;
|
||||
}
|
||||
}
|
||||
@@ -192,6 +207,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
}
|
||||
if (scale.MsrmntState == MsrmntState.Busy) scale.MsrmntState = MsrmntState.Failed;
|
||||
scale.Activity = Activity.Idle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Author: Milan Hanajik
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -16,19 +15,19 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
public override string ToString() { return string.Format("SetUnitsOp({0})", units); }
|
||||
|
||||
/// Set by the constructor
|
||||
BalanceDev balanceDev;
|
||||
BalanceDev scale;
|
||||
BalanceDev.Units units;
|
||||
bool activityStarted;
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="balanceDev">Balance device instance</param>
|
||||
/// <param name="scale">Balance device instance</param>
|
||||
/// <param name="result">Reference to the serialNumber</param>
|
||||
public SetUnitsOp(BalanceDev balanceDev, BalanceDev.Units units)
|
||||
public SetUnitsOp(BalanceDev scale, BalanceDev.Units units)
|
||||
{
|
||||
if (balanceDev == null) throw new ArgumentNullException("balanceDev");
|
||||
this.balanceDev = balanceDev;
|
||||
|
||||
if (scale == null) throw new ArgumentNullException("balanceDev");
|
||||
this.scale = scale;
|
||||
this.units = units;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
@@ -37,9 +36,19 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
log.DebugFormat("{0} - Start()", balanceDev.Name);
|
||||
balanceDev.SetUnits(units);
|
||||
}
|
||||
log.DebugFormat("{0} - SetUnitsOp - Start()", scale.Name);
|
||||
|
||||
if (scale.Activity == Activity.Idle)
|
||||
{
|
||||
scale.SendSetUnitsCmd(units);
|
||||
activityStarted = true;
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
}
|
||||
else
|
||||
{
|
||||
activityStarted = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
@@ -48,15 +57,25 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (balanceDev.MsrmntState == MsrmntState.Valid) return Event.BalanceDone; /// Units set
|
||||
if (balanceDev.MsrmntState == MsrmntState.Failed) return Event.Error; /// Failed
|
||||
if (!activityStarted && scale.Activity == Activity.Idle)
|
||||
{
|
||||
scale.SendSetUnitsCmd(units);
|
||||
activityStarted = true;
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
return Event.None;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Valid) return Event.BalanceDone; /// Units set
|
||||
if (scale.MsrmntState == MsrmntState.Failed) return Event.Error; /// Failed
|
||||
return Event.None; /// No result yet
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
log.DebugFormat("{0} - Stop()", balanceDev.Name);
|
||||
if (scale.MsrmntState == MsrmntState.Busy) scale.MsrmntState = MsrmntState.Failed;
|
||||
scale.Activity = Activity.Idle;
|
||||
log.DebugFormat("{0} - SetUnitsOp - Stop()", scale.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
@@ -15,19 +15,19 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
bool done;
|
||||
|
||||
/// Set by the constructor
|
||||
BalanceDev balanceDev;
|
||||
BalanceDev scale;
|
||||
DoubleBox tara;
|
||||
bool activityStarted;
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="balanceDev">Balance device instance</param>
|
||||
/// <param name="scale">Balance device instance</param>
|
||||
/// <param name="result">Reference to variable for 'tara' in kg</param>
|
||||
public TaringOp(BalanceDev balanceDev, ref DoubleBox tara)
|
||||
public TaringOp(BalanceDev scale, ref DoubleBox tara)
|
||||
{
|
||||
if (balanceDev == null) throw new ArgumentNullException("balanceDev");
|
||||
this.balanceDev = balanceDev;
|
||||
|
||||
if (scale == null) throw new ArgumentNullException("balanceDev");
|
||||
this.scale = scale;
|
||||
this.tara = tara;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
@@ -36,10 +36,20 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
log.DebugFormat("{0} - Start()", balanceDev.Name);
|
||||
log.DebugFormat("{0} - TaringOp - tart()", scale.Name);
|
||||
|
||||
done = false;
|
||||
balanceDev.ZeroWhenStable();
|
||||
}
|
||||
if (scale.Activity == Activity.Idle)
|
||||
{
|
||||
scale.SendTaraCmd();
|
||||
activityStarted = true;
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
}
|
||||
else
|
||||
{
|
||||
activityStarted = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
@@ -49,32 +59,42 @@ namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (done) return Event.BalanceDone; /// Taring has been done already
|
||||
|
||||
if (balanceDev.MsrmntState == MsrmntState.Busy) return Event.Busy;
|
||||
|
||||
if (balanceDev.MsrmntState == MsrmntState.Overload)
|
||||
if (!activityStarted && scale.Activity == Activity.Idle)
|
||||
{
|
||||
tara.Val = balanceDev.Capacity;
|
||||
scale.SendTaraCmd();
|
||||
activityStarted = true;
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
return Event.Busy;
|
||||
}
|
||||
|
||||
if (done) return Event.BalanceDone; /// Taring has been done already
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Busy) return Event.Busy;
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Overload)
|
||||
{
|
||||
tara.Val = scale.Capacity;
|
||||
done = true;
|
||||
return Event.BalanceOverload;
|
||||
}
|
||||
|
||||
if (balanceDev.MsrmntState == MsrmntState.Valid)
|
||||
if (scale.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
tara.Val = balanceDev.Mass;
|
||||
tara.Val = scale.Mass;
|
||||
done = true;
|
||||
return Event.BalanceDone; /// Taring completed
|
||||
}
|
||||
|
||||
balanceDev.ZeroWhenStable(); /// Failed -> repeat taring
|
||||
scale.SendTaraCmd(); /// Failed -> repeat taring
|
||||
return Event.Busy;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
log.DebugFormat("{0} - Stop()", balanceDev.Name);
|
||||
if (scale.MsrmntState == MsrmntState.Busy) scale.MsrmntState = MsrmntState.Failed;
|
||||
scale.Activity = Activity.Idle;
|
||||
log.DebugFormat("{0} - TaringOp - Stop()", scale.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
|
||||
namespace TBF.BenchControl.MettlerToledo.Standard
|
||||
{
|
||||
public class ZeroOp : IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(ZeroOp));
|
||||
public override string ToString() { return string.Format("ZeroOp(.,.)"); }
|
||||
|
||||
bool done;
|
||||
|
||||
/// Set by the constructor
|
||||
BalanceDev scale;
|
||||
bool activityStarted;
|
||||
|
||||
/// <summary>
|
||||
/// Events: BalanceDone, Error
|
||||
/// </summary>
|
||||
/// <param name="scale">Balance device instance</param>
|
||||
/// <param name="result">Reference to variable for 'tara' in kg</param>
|
||||
public ZeroOp(BalanceDev scale)
|
||||
{
|
||||
if (scale == null) throw new ArgumentNullException("balanceDev");
|
||||
this.scale = scale;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
log.DebugFormat("{0} - ZeroOp - Start()", scale.Name);
|
||||
|
||||
done = false;
|
||||
if (scale.Activity == Activity.Idle)
|
||||
{
|
||||
scale.SendZeroWhenStableCmd();
|
||||
activityStarted = true;
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
}
|
||||
else
|
||||
{
|
||||
activityStarted = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>
|
||||
/// Event.None
|
||||
/// Event.BalanceDone
|
||||
/// Event.Error . . . . . Current.Tick == null
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (!activityStarted && scale.Activity == Activity.Idle)
|
||||
{
|
||||
scale.SendZeroWhenStableCmd();
|
||||
activityStarted = true;
|
||||
scale.Activity = Activity.RunningOperation;
|
||||
return Event.Busy;
|
||||
}
|
||||
|
||||
if (done) return Event.BalanceDone; /// Zeroing has been done already
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Busy) return Event.Busy;
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Overload)
|
||||
{
|
||||
done = true;
|
||||
return Event.BalanceOverload;
|
||||
}
|
||||
|
||||
if (scale.MsrmntState == MsrmntState.Valid)
|
||||
{
|
||||
done = true;
|
||||
return Event.BalanceDone; /// Zeroing completed
|
||||
}
|
||||
|
||||
scale.SendZeroWhenStableCmd(); /// Failed -> repeat zeroing
|
||||
return Event.Busy;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (scale.MsrmntState == MsrmntState.Busy) scale.MsrmntState = MsrmntState.Failed;
|
||||
scale.Activity = Activity.Idle;
|
||||
log.DebugFormat("{0} - ZeroOp - Stop()", scale.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,10 +38,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
}
|
||||
|
||||
|
||||
const string ClpUserName = "tbf";
|
||||
string ClpUserName = string.Empty; /// Either "tbf" or "pi" after a successful detection
|
||||
const string ClpPassword = "C1ern4V0d4";
|
||||
|
||||
|
||||
private static Object fileUploadLock = new Object();
|
||||
|
||||
|
||||
@@ -184,6 +183,8 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
{
|
||||
UiBridge.Bridge.OnCameraInfo(this.cameraIdx, string.Format("{0} ver.{1} {2} s/n {3}", Name, sdCardVer, ipAddress, CameraCfg.HardwareAddress));
|
||||
|
||||
ClpUserName = (sdCardVer.Length > 0 && sdCardVer[0] == '1') ? "tbf" : "pi";
|
||||
|
||||
rtpUdpLocalPort = UdpPortBase + 4 * cameraIdx;
|
||||
rtcpUdpLocalPort = UdpPortBase + 4 * cameraIdx + 1;
|
||||
msrmntUdpLocalPort = UdpPortBase + 4 * cameraIdx + 2;
|
||||
@@ -436,49 +437,66 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
{
|
||||
scpClient.Connect();
|
||||
|
||||
///
|
||||
/// Synchronize files in camera /home/tbf/clp directory with the files in "TBF/CameraBinaryFiles" project folder
|
||||
///
|
||||
using (var sshClient = new SshClient(connectionInfo))
|
||||
DirectoryInfo dirInfo = null;
|
||||
if (sdCardVer.Length > 0)
|
||||
{
|
||||
sshClient.Connect();
|
||||
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(Path.Combine(System.Windows.Forms.Application.StartupPath, "CameraBinaryFiles"));
|
||||
SHA1 sha1calculator = SHA1.Create();
|
||||
StringBuilder sha1str = new StringBuilder();
|
||||
|
||||
foreach (FileInfo fi in dirInfo.GetFiles())
|
||||
switch (sdCardVer[0])
|
||||
{
|
||||
lock (fileUploadLock)
|
||||
case '1':
|
||||
dirInfo = new DirectoryInfo(Path.Combine(System.Windows.Forms.Application.StartupPath, "CameraBinaryFiles"));
|
||||
break;
|
||||
case '2':
|
||||
dirInfo = new DirectoryInfo(Path.Combine(System.Windows.Forms.Application.StartupPath, "CameraBinaryFiles2"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dirInfo != null)
|
||||
{
|
||||
///
|
||||
/// Synchronize files in camera /home/tbf/clp directory with the files in "TBF/CameraBinaryFiles" project folder
|
||||
///
|
||||
using (var sshClient = new SshClient(connectionInfo))
|
||||
{
|
||||
sshClient.Connect();
|
||||
|
||||
SHA1 sha1calculator = SHA1.Create();
|
||||
StringBuilder sha1str = new StringBuilder();
|
||||
|
||||
FileInfo[] fileInfos = dirInfo.GetFiles();
|
||||
foreach (FileInfo fi in fileInfos)
|
||||
{
|
||||
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"));
|
||||
|
||||
if (!sha1sumResponse.Contains(string.Format("{0} clp/{1}", sha1str, fi.Name)))
|
||||
lock (fileUploadLock)
|
||||
{
|
||||
/// 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));
|
||||
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"));
|
||||
|
||||
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();
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -718,8 +736,10 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
{
|
||||
int wid = hiRes ? 1280 : 640;
|
||||
int hgh = hiRes ? 960 : 480;
|
||||
string command = string.Format("/opt/vc/bin/raspivid -t 0 -cd MJPEG -w {0} -h {1} -fps 30 -b 8000000 -o - | gst-launch-1.0 fdsrc ! \"image/jpeg,framerate=30/1\" ! jpegparse ! rtpjpegpay ! udpsink host={2} port={3}",
|
||||
wid, hgh, NetAdapter.IPAddress, rtpUdpLocalPort);
|
||||
string command = string.Format("/opt/vc/bin/raspivid -t 0 -cd MJPEG -w {0} -h {1} -fps 30 -b 8000000 -o - | gst-launch-1.0 fdsrc ! \"image/jpeg,framerate=30/1\" ! jpegparse ! rtpjpegpay ! udpsink host={2} port={3}",
|
||||
wid, hgh, NetAdapter.IPAddress, rtpUdpLocalPort);
|
||||
//string command = string.Format("~/userland/build/bin/raspivid -t 0 -cd MJPEG -w {0} -h {1} -fps 30 -b 8000000 -o - | gst-launch-1.0 fdsrc ! \"image/jpeg,framerate=30/1\" ! jpegparse ! rtpjpegpay ! udpsink host={2} port={3}",
|
||||
// wid, hgh, NetAdapter.IPAddress, rtpUdpLocalPort);
|
||||
|
||||
return new LiveStreamOp(this, Telnet, command);
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ namespace TBF.BenchControl.Network.Camera
|
||||
public JpegFrame() : base(26) { }
|
||||
|
||||
/// <summary>
|
||||
/// //Writes the packets to a memory stream and created the default header and quantization tables if necessary.
|
||||
/// Writes packets to a memory stream and created the default header and quantization tables if necessary.
|
||||
/// </summary>
|
||||
void ProcessPackets(System.IO.MemoryStream buffer)
|
||||
{
|
||||
|
||||
@@ -9,10 +9,10 @@ namespace TBF.BenchControl.Network.Camera
|
||||
{
|
||||
public enum STATE
|
||||
{
|
||||
Empty,
|
||||
OK,
|
||||
Error,
|
||||
Complete,
|
||||
Empty, /// Initial state after being constructed
|
||||
OK, /// The frame is not empty, but it's not complete yet. It's without any error
|
||||
Error, /// An error occured
|
||||
Complete, /// The frame is complete, consequent AddPacket() calls will be ignored
|
||||
}
|
||||
|
||||
public readonly int PayloadType;
|
||||
|
||||
@@ -10,7 +10,7 @@ using Config.Entities;
|
||||
|
||||
namespace TBF.BenchControl.Network.Camera.Roi
|
||||
{
|
||||
public class Roi : ComponentBase, GenericDevices.IRoi, IOperation
|
||||
public class Roi : ComponentBase, GenericDevices.IRegReaderLiveCamera, IOperation
|
||||
{
|
||||
/// TODO: Implement support for sharing one camera by multiple ROI-s
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ using Config.Entities;
|
||||
|
||||
namespace TBF.BenchControl.Network.Camera.RoiForFixedStart
|
||||
{
|
||||
public class Roi : ComponentBase, GenericDevices.IRoiForFixedStart, IOperation
|
||||
public class Roi : ComponentBase, GenericDevices.IRegReaderStillCamera, IOperation
|
||||
{
|
||||
/// TODO: Implement support for sharing one camera by multiple ROI-s
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace TBF.BenchControl.Operations
|
||||
/// </summary>
|
||||
/// <param name="register">Register reader reference</param>
|
||||
/// <param name="pulses">Reference to the water meter register state in pulses</param>
|
||||
public ReadMoreRegistersOp(GenericDevices.IRegisterReader[] readers)
|
||||
public ReadMoreRegistersOp(GenericDevices.IRegReader[] readers)
|
||||
{
|
||||
if (readers == null) throw new ArgumentNullException("readers");
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
|
||||
ISession session = sessionFactory.OpenSession();
|
||||
|
||||
#if !DEBUG
|
||||
/// Only release version registers a workplace
|
||||
/// Only a release version registers a workplace
|
||||
TracingDB.DB.RegisterWorkplace(session,
|
||||
workplace,
|
||||
Users.GlobalData.GetCurrentUserName(),
|
||||
@@ -181,7 +181,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
|
||||
|
||||
using (ISession session = sessionFactory.OpenSession())
|
||||
{
|
||||
TracingDB.DB.UnregisterWorkplace(session, workplace);
|
||||
TracingDB.DB.UnregisterWorkplaceObsolete(session, workplace);
|
||||
session.Flush();
|
||||
}
|
||||
}
|
||||
@@ -286,7 +286,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
|
||||
opCompleted = true;
|
||||
if (SaveTracingRecords(batch) != Retv.OK) anyError = true;
|
||||
|
||||
if (anyError)
|
||||
if (anyError && !string.IsNullOrEmpty(Events.DB.ConnectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -302,17 +302,13 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
|
||||
{
|
||||
log.ErrorFormat("Triggering event(s) failed: {0}", exc.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return Event.ErrorProcessingResults;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Event.ResultsWritten;
|
||||
}
|
||||
return anyError ? Event.ErrorProcessingResults : Event.ResultsWritten;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (anyError)
|
||||
if (anyError && !string.IsNullOrEmpty(Events.DB.ConnectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -328,13 +324,9 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
|
||||
{
|
||||
log.ErrorFormat("Triggering event(s) failed: {0}", exc.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return Event.ErrorProcessingResults;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Event.ResultsWritten;
|
||||
}
|
||||
return anyError ? Event.ErrorProcessingResults : Event.ResultsWritten;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using log4net;
|
||||
using Oracle.DataAccess.Client; // ODP.NET Oracle managed provider
|
||||
@@ -21,6 +20,23 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
Error,
|
||||
}
|
||||
|
||||
public enum DBUsed
|
||||
{
|
||||
None,
|
||||
Production,
|
||||
Test,
|
||||
Quality,
|
||||
Count
|
||||
}
|
||||
|
||||
public enum WMKind
|
||||
{
|
||||
Iperl,
|
||||
S620,
|
||||
Count
|
||||
}
|
||||
|
||||
|
||||
public class Database : ComponentBase, IOperation, GenericDevices.IResultsWriter, GenericDevices.IStartInfoReader, Generic.IDevice
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Database));
|
||||
@@ -28,7 +44,15 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
|
||||
const int Anbid_StaraTura = 4;
|
||||
|
||||
public DatabaseCfg dbCfg;
|
||||
DatabaseCfg dbCfg;
|
||||
|
||||
public DBUsed DBUsed { get { return (dbCfg == null || dbCfg.ProcParams == null) ? DBUsed.None : dbCfg.ProcParams.DBUsed; } }
|
||||
public WMKind WMKind { get { return (dbCfg == null || dbCfg.ProcParams == null) ? WMKind.Iperl : dbCfg.ProcParams.WMKind; } }
|
||||
public int WMTypeId { get { return (dbCfg == null || dbCfg.ProcParams == null) ? 0 : dbCfg.ProcParams.WMTypeId; } }
|
||||
public int YearOfManufacture { get { return (dbCfg == null || dbCfg.ProcParams == null) ? DateTime.Now.Year : dbCfg.ProcParams.YearOfManufacture; } }
|
||||
public bool SaveResults { get { return (dbCfg == null || dbCfg.ProcParams == null) ? false : dbCfg.ProcParams.SaveResults; } }
|
||||
public bool ReadStartInfo { get { return (dbCfg == null || dbCfg.ProcParams == null) ? true : dbCfg.ProcParams.ReadStartInfo; } }
|
||||
public bool StartInfoIsRequired { get { return (dbCfg == null || dbCfg.ProcParams == null) ? false : dbCfg.ProcParams.StartInfoIsRequired; } }
|
||||
|
||||
|
||||
enum OpState
|
||||
@@ -39,16 +63,12 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
WriteResultsScheduled,
|
||||
WriteResultsRunning,
|
||||
}
|
||||
|
||||
OpState currentOpState;
|
||||
bool opCompleted;
|
||||
bool anyError;
|
||||
|
||||
|
||||
///
|
||||
/// iPerls to verify
|
||||
///
|
||||
GenericDevices.IRegisterReader[] iperlHeads;
|
||||
|
||||
/// <summary>
|
||||
/// Start info is read into WaterMeter objects referenced by this array
|
||||
/// </summary>
|
||||
@@ -59,7 +79,29 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
/// </summary>
|
||||
Results.Entities.Batch batch;
|
||||
|
||||
OracleConnection connection; /// Oracle database connection
|
||||
OracleConnection productionDB; /// Production Oracle DB connection
|
||||
OracleConnection qualityDB; /// Quality Oracle DB connection
|
||||
OracleConnection testDB; /// Test Oracle DB connection
|
||||
|
||||
OracleConnection selectedDB
|
||||
{
|
||||
get
|
||||
{
|
||||
if (dbCfg == null || dbCfg.ProcParams == null) return null;
|
||||
|
||||
switch (dbCfg.ProcParams.DBUsed)
|
||||
{
|
||||
case DBUsed.Production: return productionDB;
|
||||
case DBUsed.Quality: return qualityDB;
|
||||
case DBUsed.Test: return testDB;
|
||||
|
||||
default:
|
||||
case DBUsed.None:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// The following 3 variables are always updated together
|
||||
@@ -86,38 +128,26 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
///
|
||||
public void Initialize()
|
||||
{
|
||||
switch (dbCfg.DBUsed)
|
||||
{
|
||||
case DBUsed.Production:
|
||||
connection = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
|
||||
break;
|
||||
case DBUsed.Quality:
|
||||
connection = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltaqual;Password=test;");
|
||||
break;
|
||||
case DBUsed.Test:
|
||||
connection = new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;");
|
||||
break;
|
||||
default:
|
||||
connection = null;
|
||||
break;
|
||||
}
|
||||
productionDB = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
|
||||
qualityDB = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltaqual;Password=test;");
|
||||
testDB = new OracleConnection("Data Source=STARA_TEST.WORLD;User Id=deltachef;Password=deltachef;");
|
||||
|
||||
if (dbCfg.DebugLevel == DebugMode.Simulate) return;
|
||||
|
||||
///
|
||||
/// Do something with the database to see if the connection works well
|
||||
///
|
||||
if (connection != null)
|
||||
if (productionDB != null)
|
||||
{
|
||||
connection.Open();
|
||||
productionDB.Open();
|
||||
|
||||
string rslt = "none";
|
||||
OracleCommand cmd = new OracleCommand("select Standort from ANBIETER_SD where ANBID = 4", connection);
|
||||
OracleCommand cmd = new OracleCommand("select Standort from ANBIETER_SD where ANBID = 4", productionDB);
|
||||
OracleDataReader dr = cmd.ExecuteReader();
|
||||
if (dr.Read()) rslt = dr.GetString(0);
|
||||
dr.Close();
|
||||
|
||||
connection.Close();
|
||||
productionDB.Close();
|
||||
}
|
||||
}
|
||||
///
|
||||
@@ -126,9 +156,11 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
///
|
||||
public void StopDevice()
|
||||
{
|
||||
if (connection != null) connection.Dispose();
|
||||
if (testDB != null) testDB.Dispose();
|
||||
if (qualityDB != null) qualityDB.Dispose();
|
||||
if (productionDB != null) productionDB.Dispose();
|
||||
}
|
||||
public void StopDevice2() { }
|
||||
public void StopDevice2() {}
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -221,7 +253,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ReadStartInfoOp(IList<Results.Entities.WaterMeter> waterMeters)
|
||||
{
|
||||
if (!dbCfg.ReadStartInfo)
|
||||
if (!ReadStartInfo)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -244,7 +276,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
/// <returns>Reference to the operation</returns>
|
||||
public IOperation ProcessResultsOp(Results.Entities.Batch batch)
|
||||
{
|
||||
if (!dbCfg.SaveResults)
|
||||
if (!SaveResults)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -287,11 +319,11 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
{
|
||||
if (waterMeters.Count == 0) return Event.ResultsWritten;
|
||||
|
||||
if ((dbCfg.DebugLevel == DebugMode.Normal) && (connection != null))
|
||||
if ((dbCfg.DebugLevel == DebugMode.Normal) && (selectedDB != null))
|
||||
{
|
||||
log.WarnFormat("{0} : Run() : currentOp = {1}", Name, currentOpState);
|
||||
#if ORACLE_DB
|
||||
if (ReadStartInfoFromDB(connection) == Retv.Error) anyError = true;
|
||||
if (ReadStartInfoFromDB(selectedDB) == Retv.Error) anyError = true;
|
||||
#endif
|
||||
}
|
||||
opCompleted = true;
|
||||
@@ -305,17 +337,17 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
{
|
||||
if (batch.WaterMeters.Count == 0) return Event.ResultsWritten;
|
||||
|
||||
if ((dbCfg.DebugLevel == DebugMode.Normal) && (connection != null))
|
||||
if ((dbCfg.DebugLevel == DebugMode.Normal) && (selectedDB != null))
|
||||
{
|
||||
log.WarnFormat("{0} : Run() : currentOp = {1}", Name, currentOpState);
|
||||
#if ORACLE_DB
|
||||
if (WriteResultsToDB(connection, batch, false) == Retv.Error) anyError = true;
|
||||
if (WriteResultsToDB(selectedDB, batch, false) == Retv.Error) anyError = true;
|
||||
#endif
|
||||
}
|
||||
opCompleted = true;
|
||||
}
|
||||
|
||||
if (anyError)
|
||||
if (anyError && !string.IsNullOrEmpty(Events.DB.ConnectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -331,13 +363,9 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
{
|
||||
log.ErrorFormat("Triggering event(s) failed: {0}", exc.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return Event.ErrorProcessingResults;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Event.ResultsWritten;
|
||||
}
|
||||
return anyError ? Event.ErrorProcessingResults : Event.ResultsWritten;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -495,7 +523,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
///
|
||||
log.ErrorFormat("Water meter {0} was not found in ORACLE database.", wm.SerialNr);
|
||||
dr.Close();
|
||||
return dbCfg.StartInfoIsRequired ? Retv.Error : Retv.OK;
|
||||
return StartInfoIsRequired ? Retv.Error : Retv.OK;
|
||||
}
|
||||
dr.Close();
|
||||
|
||||
@@ -651,10 +679,17 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
SaveBatchData(conn, batch);
|
||||
foreach (var wMtr in batch.WaterMeters)
|
||||
{
|
||||
if ((wMtr.ErrorFlags & ((int)ErrorFlagMask.E26 | (int)ErrorFlagMask.E27 | (int)ErrorFlagMask.E28)) == 0)
|
||||
if (WMKind == WMKind.Iperl)
|
||||
{
|
||||
/// No production error => write the result of testing to Oracle DB
|
||||
SaveSingleWM2DB(conn, wMtr, safeMode);
|
||||
if ((wMtr.ErrorFlags & ((int)ErrorFlagMask.E26 | (int)ErrorFlagMask.E27 | (int)ErrorFlagMask.E28)) == 0)
|
||||
{
|
||||
/// No production error => write the result of testing to Oracle DB
|
||||
SaveOneIperlToDB(conn, wMtr, safeMode);
|
||||
}
|
||||
}
|
||||
else if (WMKind == WMKind.S620)
|
||||
{
|
||||
SaveOneS620ToDB(conn, wMtr, safeMode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -672,43 +707,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write one meter results into the database
|
||||
/// </summary>
|
||||
/// <param name="wmNr">0-based water meter number</param>
|
||||
/// <param name="results">Sorted list of results to save</param>
|
||||
void SaveSingleWM2DB(OracleConnection conn, Results.Entities.WaterMeter wm, bool safeMode)
|
||||
{
|
||||
if (safeMode && !wm.Passed) return;
|
||||
|
||||
if (string.IsNullOrEmpty(wm.SerialNr)) return; /// No database activity possible w/o PCB number
|
||||
|
||||
int maxpruefindexLowPart = ReadMaxPruefindex(conn, wm);
|
||||
|
||||
TBF.BenchControl.GenericDevices.IBenchInfo benchInfo = TBF.BenchControl.Sequences.ProcessData.BenchInfo;
|
||||
int testBenchID = (benchInfo != null) ? benchInfo.TestBenchId : 1;
|
||||
int MAX_Pruefindex = 100 * testBenchID + maxpruefindexLowPart + 1;
|
||||
|
||||
int Hydr_Pruefung;
|
||||
if (wm.Passed)
|
||||
{
|
||||
/// Passed
|
||||
if (maxpruefindexLowPart == 0)
|
||||
Hydr_Pruefung = 96;
|
||||
else
|
||||
Hydr_Pruefung = 224;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Failed
|
||||
Hydr_Pruefung = 97; /// Hydr. test failed, Pressure test passed
|
||||
}
|
||||
|
||||
wm.Pruefindex = MAX_Pruefindex;
|
||||
wm.HydrPruefung = Hydr_Pruefung;
|
||||
SaveOrUpdateWM(conn, wm, MAX_Pruefindex, Hydr_Pruefung);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -894,13 +892,13 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
cmd2.ExecuteNonQuery(); /// Returns nr. of updated rows
|
||||
#else
|
||||
OracleCommand cmd2 = new OracleCommand("INSERT INTO VT_PRUEFDURCHFLUSS_PD(" +
|
||||
"ANBID, ID_Pruefstand, ID_WzPruefreihe, PruefungsNr, " +
|
||||
"PVOL, PMasse, MinDurchfluss, MaxDurchfluss, " +
|
||||
"Q_ist, KFaktor, Q_VZ, F_VZ, RegelEinstellZeit, Drehzahl, " +
|
||||
"BeginnDruck_Vorne, BeginnDruck_Hinten, EndDruck_Vorne, EndDruck_Hinten, " +
|
||||
"TVWZ, IVWZ, Verwendeter_VZ, BeginnGewicht, EndGewicht)" +
|
||||
" VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, " +
|
||||
":16, :17, :18, :19, :20, :21, :22, :23)", conn);
|
||||
"ANBID, ID_Pruefstand, ID_WzPruefreihe, PruefungsNr, " +
|
||||
"PVOL, PMasse, MinDurchfluss, MaxDurchfluss, " +
|
||||
"Q_ist, KFaktor, Q_VZ, F_VZ, RegelEinstellZeit, Drehzahl, " +
|
||||
"BeginnDruck_Vorne, BeginnDruck_Hinten, EndDruck_Vorne, EndDruck_Hinten, " +
|
||||
"TVWZ, IVWZ, Verwendeter_VZ, BeginnGewicht, EndGewicht)" +
|
||||
" VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, " +
|
||||
":16, :17, :18, :19, :20, :21, :22, :23)", conn);
|
||||
OracleParameter parm;
|
||||
parm = new OracleParameter("ANBID", OracleDbType.Int32); parm.Value = Anbid_StaraTura; cmd2.Parameters.Add(parm); ///:1
|
||||
parm = new OracleParameter("ID_Pruefstand", OracleDbType.Int32); parm.Value = 18000 + b.TestBenchId; cmd2.Parameters.Add(parm); ///:2
|
||||
@@ -945,7 +943,44 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
}
|
||||
|
||||
|
||||
void SaveOrUpdateWM(OracleConnection conn, Results.Entities.WaterMeter wm, int max_Pruefindex, int hydr_Pruefung)
|
||||
/// <summary>
|
||||
/// Write one meter results into the database
|
||||
/// </summary>
|
||||
/// <param name="wmNr">0-based water meter number</param>
|
||||
/// <param name="results">Sorted list of results to save</param>
|
||||
void SaveOneIperlToDB(OracleConnection conn, Results.Entities.WaterMeter wm, bool safeMode)
|
||||
{
|
||||
if (safeMode && !wm.Passed) return;
|
||||
|
||||
if (string.IsNullOrEmpty(wm.SerialNr)) return; /// No database activity possible w/o PCB number
|
||||
|
||||
int maxpruefindexLowPart = ReadMaxPruefindex(conn, wm);
|
||||
|
||||
TBF.BenchControl.GenericDevices.IBenchInfo benchInfo = TBF.BenchControl.Sequences.ProcessData.BenchInfo;
|
||||
int testBenchID = (benchInfo != null) ? benchInfo.TestBenchId : 1;
|
||||
int MAX_Pruefindex = 100 * testBenchID + maxpruefindexLowPart + 1;
|
||||
|
||||
int Hydr_Pruefung;
|
||||
if (wm.Passed)
|
||||
{
|
||||
/// Passed
|
||||
if (maxpruefindexLowPart == 0)
|
||||
Hydr_Pruefung = 96;
|
||||
else
|
||||
Hydr_Pruefung = 224;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Failed
|
||||
Hydr_Pruefung = 97; /// Hydr. test failed, Pressure test passed
|
||||
}
|
||||
|
||||
wm.Pruefindex = MAX_Pruefindex;
|
||||
wm.HydrPruefung = Hydr_Pruefung;
|
||||
SaveOrUpdateIperl(conn, wm, MAX_Pruefindex, Hydr_Pruefung);
|
||||
}
|
||||
|
||||
void SaveOrUpdateIperl(OracleConnection conn, Results.Entities.WaterMeter wm, int max_Pruefindex, int hydr_Pruefung)
|
||||
{
|
||||
int sekundaere_Adr = wm.Passed ? 1 : 0;
|
||||
int idBenutzer = 6; // = wm.Batch.UserNumber;
|
||||
@@ -967,7 +1002,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = hydr_Pruefung });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = idBenutzer });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_StaraTura });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = dbCfg.Baujahr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = YearOfManufacture });
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
log.InfoFormat("VT_ZAEHLER_PD inserted, PcbNr={0}, pos={1}, maxPruefix={2}", wm.SerialNr, wm.WMPosition, max_Pruefindex);
|
||||
@@ -988,7 +1023,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = max_Pruefindex });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = hydr_Pruefung });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = idBenutzer });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = dbCfg.Baujahr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = YearOfManufacture });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_StaraTura });
|
||||
|
||||
@@ -1105,6 +1140,173 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Write one meter results into the database
|
||||
/// </summary>
|
||||
/// <param name="wmNr">0-based water meter number</param>
|
||||
/// <param name="results">Sorted list of results to save</param>
|
||||
void SaveOneS620ToDB(OracleConnection conn, Results.Entities.WaterMeter wm, bool safeMode)
|
||||
{
|
||||
if (safeMode && !wm.Passed) return;
|
||||
|
||||
if (string.IsNullOrEmpty(wm.SerialNr)) return; /// No database activity possible w/o PCB number
|
||||
|
||||
int maxpruefindexLowPart = ReadMaxPruefindex(conn, wm);
|
||||
|
||||
TBF.BenchControl.GenericDevices.IBenchInfo benchInfo = TBF.BenchControl.Sequences.ProcessData.BenchInfo;
|
||||
int testBenchID = (benchInfo != null) ? benchInfo.TestBenchId : 1;
|
||||
int MAX_Pruefindex = 100 * testBenchID + maxpruefindexLowPart + 1;
|
||||
|
||||
int Hydr_Pruefung;
|
||||
if (wm.Passed)
|
||||
{
|
||||
/// Passed
|
||||
if (maxpruefindexLowPart == 0)
|
||||
Hydr_Pruefung = 96;
|
||||
else
|
||||
Hydr_Pruefung = 224;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Failed
|
||||
Hydr_Pruefung = 97; /// Hydr. test failed, Pressure test passed
|
||||
}
|
||||
|
||||
wm.Pruefindex = MAX_Pruefindex;
|
||||
wm.HydrPruefung = Hydr_Pruefung;
|
||||
SaveOrUpdateS620(conn, wm, MAX_Pruefindex, Hydr_Pruefung);
|
||||
}
|
||||
|
||||
void SaveOrUpdateS620(OracleConnection conn, Results.Entities.WaterMeter wm, int max_Pruefindex, int hydr_Pruefung)
|
||||
{
|
||||
int sekundaere_Adr = wm.Passed ? 1 : 0;
|
||||
int idBenutzer = 6; // = wm.Batch.UserNumber;
|
||||
|
||||
if (max_Pruefindex % 100 == 1)
|
||||
{
|
||||
if (!dbCfg.TestMode)
|
||||
{
|
||||
OracleCommand cmd = new OracleCommand("INSERT INTO VT_ZAEHLER_PD(Auftragsnummer, VT_Identnummer, VT_Fernum, Max_Pruefindex," +
|
||||
" Zaehlernummer, Sekundaere_Adr, Hydr_Pruefung, ID_Benutzer, ANBID, Baujahr)" +
|
||||
" VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10)", conn);
|
||||
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.PurchaseOrder });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = "IPBATMXX" });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = max_Pruefindex });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = -1 });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = sekundaere_Adr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = hydr_Pruefung });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = idBenutzer });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_StaraTura });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = YearOfManufacture });
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
log.InfoFormat("VT_ZAEHLER_PD inserted, PcbNr={0}, pos={1}, maxPruefix={2}", wm.SerialNr, wm.WMPosition, max_Pruefindex);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.WarnFormat("SIM: VT_ZAEHLER_PD inserted, PcbNr={0}, pos={1}, maxPruefix={2}", wm.SerialNr, wm.WMPosition, max_Pruefindex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!dbCfg.TestMode)
|
||||
{
|
||||
OracleCommand cmd = new OracleCommand("UPDATE VT_ZAEHLER_PD SET Auftragsnummer = :1, VT_Identnummer = :2, Max_Pruefindex = :3, Hydr_Pruefung= :4, ID_Benutzer= :5, Baujahr= :6 WHERE VT_Fernum = :7 and ANBID = :8", conn);
|
||||
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.PurchaseOrder });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = "IPBATMXX" });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = max_Pruefindex });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = hydr_Pruefung });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = idBenutzer });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = YearOfManufacture });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_StaraTura });
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
log.InfoFormat("VT_ZAEHLER_PD updated, PcbNr={0}, pos={1}, maxPruefix={2}", wm.SerialNr, wm.WMPosition, max_Pruefindex);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.WarnFormat("SIM: VT_ZAEHLER_PD updated, PcbNr={0}, pos={1}, maxPruefix={2}", wm.SerialNr, wm.WMPosition, max_Pruefindex);
|
||||
}
|
||||
}
|
||||
|
||||
if (!dbCfg.TestMode)
|
||||
{
|
||||
OracleCommand cmd = new OracleCommand("INSERT INTO VT_ZAEHLER_PINDEX_PD(" +
|
||||
"VT_Fernum, Pruefindex, ANBID, ID_Pruefstand, ID_WzPruefreihe, Hydr_Pruefung, " +
|
||||
"ReedKontakt, ReedKontaktOK, ReedKontaktZeit, KorrImprate, FestWertWZ, PtestOK, " +
|
||||
"Zaehlerstand, WT_Platz_NR, WZgut, ID_Benutzer, AnzahlPruefungen)" +
|
||||
" VALUES (:1, :2, :3, :4, :5, :6, 0, 0, 0, :7, 0, :8, 0, :9, :10, :11, :12)", conn); /// ReedKontakt = ReedKontaktOK = ReedKontaktZeit = FestWertWZ = Zaehlerstand = 0
|
||||
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = max_Pruefindex });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_StaraTura });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 18000 + wm.Batch.TestBenchId });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Batch.BatchNr });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = hydr_Pruefung });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = wm.OrigCalibFactor });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 0 }); /// TODO
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.WMPosition });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Passed ? 1 : 0 });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = idBenutzer });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 3 });
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
log.InfoFormat("VT_ZAEHLER_PINDEX_PD inserted, PcbNr={0}, pos={1}, pruefix={2}", wm.SerialNr, wm.WMPosition, max_Pruefindex % 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.WarnFormat("SIM: VT_ZAEHLER_PINDEX_PD inserted, PcbNr={0}, pos={1}, pruefix={2}", wm.SerialNr, wm.WMPosition, max_Pruefindex % 100);
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
Results.Entities.TestData tData = wm.GetTestData(testInfo.TestName);
|
||||
Results.Entities.MeterTestRslt mtr;
|
||||
if (tData == null)
|
||||
{
|
||||
throw new Exception(string.Format("'{0}' test results missing, watermeter {1}", testInfo.TestName, wm.WMPosition));
|
||||
}
|
||||
else if (tData.Repeats == 1)
|
||||
{
|
||||
mtr = wm.GetMeterTestRslt(testInfo.TestName);
|
||||
if (mtr == null) throw new Exception(string.Format("'{0}' test results missing, watermeter {1}", testInfo.TestName, wm.WMPosition));
|
||||
}
|
||||
else
|
||||
{
|
||||
Results.Entities.MeterTestRslt firstMtr = wm.GetMeterTestRslt(Utils.TestTitle(tData, 1));
|
||||
if (firstMtr == null) throw new Exception(string.Format("'{0}' test results missing, watermeter {1}", Utils.TestTitle(tData, 1), wm.WMPosition));
|
||||
|
||||
mtr = new Results.Entities.MeterTestRslt();
|
||||
mtr.CopyContentFrom(firstMtr);
|
||||
mtr.TestRslt = firstMtr.TestRslt;
|
||||
mtr.WaterMeter = firstMtr.WaterMeter;
|
||||
for (int i = 2; i <= tData.Repeats; i++)
|
||||
{
|
||||
Results.Entities.MeterTestRslt nextMtr = wm.GetMeterTestRslt(Utils.TestTitle(tData, i));
|
||||
if (nextMtr == null) throw new Exception(string.Format("'{0}' test results missing, watermeter {1}", Utils.TestTitle(tData, i), wm.WMPosition));
|
||||
|
||||
mtr.TestTime += nextMtr.TestTime;
|
||||
mtr.VolumeMeter += nextMtr.VolumeMeter;
|
||||
mtr.VolumeRef += nextMtr.VolumeRef;
|
||||
mtr.VolumeEnd = nextMtr.VolumeEnd;
|
||||
mtr.Passed = (mtr.Passed && nextMtr.Passed);
|
||||
}
|
||||
mtr.Error = Formulas.ErrorFromVolumes(mtr.VolumeMeter, mtr.VolumeRef);
|
||||
}
|
||||
|
||||
SaveMeterTestResult(conn, mtr, testInfo.PruefungsNrDB, max_Pruefindex, wmTypeRevision);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Saves a water meter result of a single test
|
||||
/// </summary>
|
||||
@@ -1112,7 +1314,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
/// <returns>Nr. of rows updated</returns>
|
||||
int SaveMeterTestResult(OracleConnection conn, Results.Entities.MeterTestRslt mtr, int pruefungsNr, int max_Pruefindex, int wmTypeRevision)
|
||||
{
|
||||
double Q_wm = 3600.0 * mtr.VolumeMeter / mtr.TestTime; /// in [l/hour]
|
||||
double Q_wm = (mtr.TestTime != 0) ? (3600.0 * mtr.VolumeMeter / mtr.TestTime) : 0; /// in [l/hour]
|
||||
double Q_wm_with_upper_bound = Math.Min(2 * 1000 * mtr.TestRslt.FlowVolume, Math.Max(0.0, Q_wm));
|
||||
int retv = 0;
|
||||
|
||||
|
||||
@@ -3,29 +3,11 @@
|
||||
///
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
{
|
||||
public enum DBUsed
|
||||
{
|
||||
None,
|
||||
Production,
|
||||
Test,
|
||||
Quality,
|
||||
Count
|
||||
}
|
||||
|
||||
public enum Separator
|
||||
{
|
||||
None,
|
||||
Space,
|
||||
Tabulator,
|
||||
Comma,
|
||||
Semicolon,
|
||||
Count
|
||||
}
|
||||
|
||||
public class DatabaseCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(DatabaseCfg) })[0];
|
||||
@@ -33,44 +15,33 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new DatabaseCfgCtrl(); }
|
||||
|
||||
|
||||
public DBUsed DBUsed;
|
||||
public int Baujahr; /// Written to the database
|
||||
public bool ReadStartInfo;
|
||||
public bool StartInfoIsRequired;
|
||||
public bool SaveResults;
|
||||
/// <summary> Serialized parameters </summary>
|
||||
public bool TestMode;
|
||||
|
||||
/// <summary> Procedure parameters </summary>
|
||||
[XmlIgnore]
|
||||
public ProcedureParams ProcParams;
|
||||
public override IParamsProvider GetRuntimeProcParamsProvider() { return ProcParams; }
|
||||
public override IParamsProvider CreateProcParamsProvider() { return new ProcedureParams(true); }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
DatabaseCfg()
|
||||
{
|
||||
Name = "Sensus-Oracle-DB";
|
||||
ParentName = string.Empty;
|
||||
DBUsed = DBUsed.Test;
|
||||
Baujahr = 2015;
|
||||
ReadStartInfo = true;
|
||||
SaveResults = true;
|
||||
StartInfoIsRequired = false;
|
||||
TestMode = false;
|
||||
}
|
||||
{
|
||||
ProcParams = new ProcedureParams(true);
|
||||
}
|
||||
|
||||
public DatabaseCfg(IComponentFactory factory)
|
||||
public DatabaseCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
TestMode = false;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, DB={1}, Bjahr={2}, RdStartInfo={3}, SaveRslts={4}, StartInfoRqrd={5}, TestMode={6}",
|
||||
Name,
|
||||
DBUsed,
|
||||
Baujahr,
|
||||
ReadStartInfo,
|
||||
SaveResults,
|
||||
StartInfoIsRequired,
|
||||
TestMode);
|
||||
return string.Format("Name={0} TestMode={1}", Name, TestMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
@@ -30,12 +30,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
|
||||
private void WriterCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < (int)DBUsed.Count; i++)
|
||||
{
|
||||
dbUsedComboBox.Items.Add(((DBUsed)i).ToString());
|
||||
}
|
||||
|
||||
Redraw();
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
@@ -47,49 +42,25 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
dbUsedComboBox.Text = config.DBUsed.ToString();
|
||||
baujahrTextBox.Text = config.Baujahr.ToString();
|
||||
readStartInfoCheckBox.Checked = config.ReadStartInfo;
|
||||
startInfoIsRequiredCheckBox.Checked = config.StartInfoIsRequired;
|
||||
saveResultsCheckBox.Checked = config.SaveResults;
|
||||
testModeCheckBox.Checked = config.TestMode;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
dbUsedComboBox.Enabled = true;
|
||||
baujahrTextBox.Enabled = true;
|
||||
readStartInfoCheckBox.Enabled = true;
|
||||
startInfoIsRequiredCheckBox.Enabled = true;
|
||||
saveResultsCheckBox.Enabled = true;
|
||||
testModeCheckBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
int tmp;
|
||||
if (!int.TryParse(baujahrTextBox.Text, out tmp) || tmp < 2015 || tmp > 2099)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Bujahr'";
|
||||
}
|
||||
|
||||
if (!dbUsedComboBox.Items.Contains(dbUsedComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Database used' item";
|
||||
}
|
||||
return flags;
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None; /// <------------------- !!!
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
if (config.Name != nameTextBox.Text)
|
||||
{
|
||||
@@ -97,34 +68,9 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
flags |= CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
int baujahr = int.Parse(baujahrTextBox.Text);
|
||||
if (config.Baujahr != baujahr)
|
||||
{
|
||||
config.Baujahr = baujahr;
|
||||
flags |= CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int)DBUsed.Count; i++)
|
||||
{
|
||||
if (((DBUsed)i).ToString().Equals(dbUsedComboBox.Text) && (config.DBUsed != (DBUsed)i))
|
||||
{
|
||||
config.DBUsed = (DBUsed)i;
|
||||
flags |= CfgUpdateFlags.RestartRqrd;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
flags |= UpdateDifferent(ref config.ReadStartInfo, readStartInfoCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
||||
flags |= UpdateDifferent(ref config.StartInfoIsRequired, startInfoIsRequiredCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
||||
flags |= UpdateDifferent(ref config.SaveResults, saveResultsCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
||||
flags |= UpdateDifferent(ref config.TestMode, testModeCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
private void logsFolderButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,20 +34,13 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.readStartInfoCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.saveResultsCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.dbUsedComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.dbUsedLabel = new System.Windows.Forms.Label();
|
||||
this.baujahrTextBox = new System.Windows.Forms.TextBox();
|
||||
this.baujahrLabel = new System.Windows.Forms.Label();
|
||||
this.startInfoIsRequiredCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.testModeCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(110, 55);
|
||||
this.nameTextBox.Location = new System.Drawing.Point(123, 59);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
@@ -55,7 +48,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(19, 58);
|
||||
this.nameLabel.Location = new System.Drawing.Point(19, 62);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
@@ -64,85 +57,17 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(107, 27);
|
||||
this.classNameLabel.Location = new System.Drawing.Point(120, 31);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// readStartInfoCheckBox
|
||||
//
|
||||
this.readStartInfoCheckBox.AutoSize = true;
|
||||
this.readStartInfoCheckBox.Enabled = false;
|
||||
this.readStartInfoCheckBox.Location = new System.Drawing.Point(111, 145);
|
||||
this.readStartInfoCheckBox.Name = "readStartInfoCheckBox";
|
||||
this.readStartInfoCheckBox.Size = new System.Drawing.Size(95, 17);
|
||||
this.readStartInfoCheckBox.TabIndex = 9;
|
||||
this.readStartInfoCheckBox.Text = "Read start info";
|
||||
this.readStartInfoCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// saveResultsCheckBox
|
||||
//
|
||||
this.saveResultsCheckBox.AutoSize = true;
|
||||
this.saveResultsCheckBox.Enabled = false;
|
||||
this.saveResultsCheckBox.Location = new System.Drawing.Point(111, 200);
|
||||
this.saveResultsCheckBox.Name = "saveResultsCheckBox";
|
||||
this.saveResultsCheckBox.Size = new System.Drawing.Size(84, 17);
|
||||
this.saveResultsCheckBox.TabIndex = 11;
|
||||
this.saveResultsCheckBox.Text = "Save results";
|
||||
this.saveResultsCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// dbUsedComboBox
|
||||
//
|
||||
this.dbUsedComboBox.Enabled = false;
|
||||
this.dbUsedComboBox.FormattingEnabled = true;
|
||||
this.dbUsedComboBox.Location = new System.Drawing.Point(110, 79);
|
||||
this.dbUsedComboBox.Name = "dbUsedComboBox";
|
||||
this.dbUsedComboBox.Size = new System.Drawing.Size(145, 21);
|
||||
this.dbUsedComboBox.TabIndex = 6;
|
||||
//
|
||||
// dbUsedLabel
|
||||
//
|
||||
this.dbUsedLabel.AutoSize = true;
|
||||
this.dbUsedLabel.Location = new System.Drawing.Point(19, 81);
|
||||
this.dbUsedLabel.Name = "dbUsedLabel";
|
||||
this.dbUsedLabel.Size = new System.Drawing.Size(79, 13);
|
||||
this.dbUsedLabel.TabIndex = 5;
|
||||
this.dbUsedLabel.Text = "Database used";
|
||||
//
|
||||
// baujahrTextBox
|
||||
//
|
||||
this.baujahrTextBox.Enabled = false;
|
||||
this.baujahrTextBox.Location = new System.Drawing.Point(110, 104);
|
||||
this.baujahrTextBox.Name = "baujahrTextBox";
|
||||
this.baujahrTextBox.Size = new System.Drawing.Size(57, 20);
|
||||
this.baujahrTextBox.TabIndex = 8;
|
||||
//
|
||||
// baujahrLabel
|
||||
//
|
||||
this.baujahrLabel.AutoSize = true;
|
||||
this.baujahrLabel.Location = new System.Drawing.Point(19, 107);
|
||||
this.baujahrLabel.Name = "baujahrLabel";
|
||||
this.baujahrLabel.Size = new System.Drawing.Size(43, 13);
|
||||
this.baujahrLabel.TabIndex = 7;
|
||||
this.baujahrLabel.Text = "Baujahr";
|
||||
//
|
||||
// startInfoIsRequiredCheckBox
|
||||
//
|
||||
this.startInfoIsRequiredCheckBox.AutoSize = true;
|
||||
this.startInfoIsRequiredCheckBox.Enabled = false;
|
||||
this.startInfoIsRequiredCheckBox.Location = new System.Drawing.Point(130, 168);
|
||||
this.startInfoIsRequiredCheckBox.Name = "startInfoIsRequiredCheckBox";
|
||||
this.startInfoIsRequiredCheckBox.Size = new System.Drawing.Size(119, 17);
|
||||
this.startInfoIsRequiredCheckBox.TabIndex = 10;
|
||||
this.startInfoIsRequiredCheckBox.Text = "Start info is required";
|
||||
this.startInfoIsRequiredCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// testModeCheckBox
|
||||
//
|
||||
this.testModeCheckBox.AutoSize = true;
|
||||
this.testModeCheckBox.Enabled = false;
|
||||
this.testModeCheckBox.Location = new System.Drawing.Point(130, 223);
|
||||
this.testModeCheckBox.Location = new System.Drawing.Point(123, 113);
|
||||
this.testModeCheckBox.Name = "testModeCheckBox";
|
||||
this.testModeCheckBox.Size = new System.Drawing.Size(155, 17);
|
||||
this.testModeCheckBox.TabIndex = 12;
|
||||
@@ -154,13 +79,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.testModeCheckBox);
|
||||
this.Controls.Add(this.startInfoIsRequiredCheckBox);
|
||||
this.Controls.Add(this.baujahrTextBox);
|
||||
this.Controls.Add(this.baujahrLabel);
|
||||
this.Controls.Add(this.dbUsedComboBox);
|
||||
this.Controls.Add(this.dbUsedLabel);
|
||||
this.Controls.Add(this.saveResultsCheckBox);
|
||||
this.Controls.Add(this.readStartInfoCheckBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
@@ -177,13 +95,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.CheckBox readStartInfoCheckBox;
|
||||
private System.Windows.Forms.CheckBox saveResultsCheckBox;
|
||||
private System.Windows.Forms.ComboBox dbUsedComboBox;
|
||||
private System.Windows.Forms.Label dbUsedLabel;
|
||||
private System.Windows.Forms.TextBox baujahrTextBox;
|
||||
private System.Windows.Forms.Label baujahrLabel;
|
||||
private System.Windows.Forms.CheckBox startInfoIsRequiredCheckBox;
|
||||
private System.Windows.Forms.CheckBox testModeCheckBox;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Database(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new DatabaseCfg(this); }
|
||||
public IComponentCfg DefaultConfig() { return new DatabaseCfg("Sensus-Oracle-DB", this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
{
|
||||
public class ProcedureParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ProcedureParams) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public DBUsed DBUsed; /// 0
|
||||
public WMKind WMKind; /// 1
|
||||
public int WMTypeId; /// 2
|
||||
public int YearOfManufacture; /// 3
|
||||
public bool SaveResults; /// 4
|
||||
public bool ReadStartInfo; /// 5
|
||||
public bool StartInfoIsRequired; /// 6
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
DBUsed = DBUsed.Production; /// 0
|
||||
WMKind = WMKind.Iperl; /// 1
|
||||
WMTypeId = 2; /// 2
|
||||
YearOfManufacture = DateTime.Now.Year; /// 3
|
||||
#if TURA_SPECIAL
|
||||
SaveResults = false; /// 4
|
||||
#else
|
||||
SaveResults = true; /// 4
|
||||
#endif
|
||||
ReadStartInfo = true; /// 5
|
||||
StartInfoIsRequired = false; /// 6
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Database", /// 0
|
||||
"Kind of WMs", /// 1
|
||||
"WM type ID", /// 2
|
||||
"Year of manufacture", /// 3
|
||||
"Save results", /// 4
|
||||
"Read start info", /// 5
|
||||
"Start info is required", /// 6
|
||||
};
|
||||
public override string ParamName(int i) { return paramNames[i]; }
|
||||
public override int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public override IList<string> ParamValues(int i)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
IList<string> retVal = new List<string>();
|
||||
for (DBUsed db = 0; db < DBUsed.Count; db++) retVal.Add(db.ToString());
|
||||
return retVal;
|
||||
}
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
IList<string> retVal = new List<string>();
|
||||
for (WMKind wm = 0; wm < WMKind.Count; wm++) retVal.Add(wm.ToString());
|
||||
return retVal;
|
||||
}
|
||||
|
||||
if (i == 3)
|
||||
{
|
||||
IList<string> retVal = new List<string>();
|
||||
int year = DateTime.Now.Year;
|
||||
retVal.Add(year.ToString());
|
||||
retVal.Add((year + 1).ToString());
|
||||
return retVal;
|
||||
}
|
||||
|
||||
if (i == 4 || i == 5 || i == 6)
|
||||
{
|
||||
IList<string> retVal = new List<string>();
|
||||
retVal.Add(Strings.yes);
|
||||
retVal.Add(Strings.no);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return DBUsed.ToString();
|
||||
case 1: return WMKind.ToString();
|
||||
case 2: return WMTypeId.ToString();
|
||||
case 3: return YearOfManufacture.ToString();
|
||||
case 4: return SaveResults ? Strings.yes : Strings.no;
|
||||
case 5: return ReadStartInfo ? Strings.yes : Strings.no;
|
||||
case 6: return StartInfoIsRequired ? Strings.yes : Strings.no;
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// Retrieves parameters from UI controls
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
for (DBUsed db = 0; db < DBUsed.Count; db++)
|
||||
{
|
||||
if (db.ToString() == strValue)
|
||||
{
|
||||
DBUsed = db;
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
for (WMKind wm = 0; wm < WMKind.Count; wm++)
|
||||
{
|
||||
if (wm.ToString() == strValue)
|
||||
{
|
||||
WMKind = wm;
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: WMTypeId = int.Parse(strValue); break;
|
||||
case 3: YearOfManufacture = int.Parse(strValue); break;
|
||||
case 4: SaveResults = (strValue == Strings.yes); break;
|
||||
case 5: ReadStartInfo = (strValue == Strings.yes); break;
|
||||
case 6: StartInfoIsRequired = (strValue == Strings.yes); break;
|
||||
}
|
||||
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
|
||||
/// Verifies whether strings in UI controls represent valid parameters
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
|
||||
int idummy;
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
for (DBUsed db = 0; db < DBUsed.Count; db++)
|
||||
{
|
||||
if (db.ToString() == strValue) return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
for (WMKind wm = 0; wm < WMKind.Count; wm++)
|
||||
{
|
||||
if (wm.ToString() == strValue) return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (int.TryParse(strValue, out idummy) && idummy >= 0)
|
||||
return true;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (int.TryParse(strValue, out idummy) && idummy >= DateTime.Now.Year && idummy <= DateTime.Now.Year + 1)
|
||||
return true;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
if (strValue == Strings.yes || strValue == Strings.no)
|
||||
return true;
|
||||
break;
|
||||
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(ProcedureParams prms)
|
||||
{
|
||||
prms.DBUsed = this.DBUsed;
|
||||
prms.WMKind = this.WMKind;
|
||||
prms.WMTypeId = this.WMTypeId;
|
||||
prms.YearOfManufacture = this.YearOfManufacture;
|
||||
prms.SaveResults = this.SaveResults;
|
||||
prms.ReadStartInfo = this.ReadStartInfo;
|
||||
prms.StartInfoIsRequired = this.StartInfoIsRequired;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
ProcedureParams pars = new ProcedureParams();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public override void UpdateFromDbEntity(ComponentProcedure dbEntity)
|
||||
{
|
||||
if (dbEntity == null) return;
|
||||
try
|
||||
{
|
||||
ProcedureParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as ProcedureParams;
|
||||
|
||||
procedureParamsEntity = dbEntity;
|
||||
componentName = dbEntity.CmpntName;
|
||||
procedure = dbEntity.Procedure;
|
||||
|
||||
if (tmp != null) tmp.CopyContentTo(this);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ProcedureParams()
|
||||
{
|
||||
}
|
||||
|
||||
public ProcedureParams(bool initialize)
|
||||
{
|
||||
if (initialize) InitializeAll();
|
||||
}
|
||||
|
||||
public ProcedureParams(ComponentProcedure procedureParamsEntity, string componentName, Procedure procedure)
|
||||
{
|
||||
this.procedureParamsEntity = procedureParamsEntity;
|
||||
this.componentName = componentName;
|
||||
this.procedure = procedure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -267,7 +267,7 @@ namespace TBF.BenchControl.Output.EventTriggers.Standard
|
||||
case 26: E10 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 27: E11 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 28: E12 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 29: E12 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 29: E13 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 30: E14 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 31: E15 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 32: E16 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
|
||||
@@ -88,6 +88,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
writerCfg.DayFolders = newCfg.DayFolders;
|
||||
writerCfg.FileNameFormat = newCfg.FileNameFormat;
|
||||
writerCfg.Culture = newCfg.Culture;
|
||||
writerCfg.SubtitleFormat = newCfg.SubtitleFormat;
|
||||
writerCfg.Separator = newCfg.Separator;
|
||||
writerCfg.EliminateSpaces = newCfg.EliminateSpaces;
|
||||
writerCfg.Header = newCfg.Header;
|
||||
@@ -332,31 +333,14 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
|
||||
wr.WriteLine();
|
||||
|
||||
/// Write water meter number and s/n
|
||||
#if BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT
|
||||
wr.Write(string.Format("Water meter {0} s/n: {1}", wm.WMPosition, wm.SerialNr));
|
||||
#if ORACLE_DB
|
||||
wr.WriteLine(writerCfg.SubtitleFormat, wm.WMPosition, wm.SerialNr, wm.SerialNrAux, wm.CompleteSerialNr,
|
||||
Strings.Water_Meter, Strings.SerialNr, Strings.Main_WM_SerialNr, Strings.Aux_WM_SerialNr);
|
||||
#else
|
||||
wr.Write(string.Format("{0} {1}", Strings.Water_Meter, wm.WMPosition));
|
||||
if (!wm.Compound())
|
||||
{
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
wr.Write(string.Format(", {0} {1}", Strings.SerialNr, wm.SerialNr));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
wr.Write(string.Format(", {0} {1}", Strings.Main_WM_SerialNr, wm.SerialNr));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(wm.SerialNrAux))
|
||||
{
|
||||
wr.Write(string.Format(", {0} {1}", Strings.Aux_WM_SerialNr, wm.SerialNrAux));
|
||||
}
|
||||
}
|
||||
wr.WriteLine(writerCfg.SubtitleFormat, wm.WMPosition, wm.SerialNr, wm.SerialNrAux, string.Empty,
|
||||
Strings.Water_Meter, Strings.SerialNr, Strings.Main_WM_SerialNr, Strings.Aux_WM_SerialNr);
|
||||
#endif
|
||||
wr.WriteLine();
|
||||
|
||||
|
||||
/// Determine column widths
|
||||
int[] columnWidths = new int[testItems.Count];
|
||||
int totalWidth = 0;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user