Compare commits

..
Author SHA1 Message Date
Milan Hanajik 9af0833112 Reconfigured for FEWA-50 2021-11-15 15:36:59 +01:00
586 changed files with 13559 additions and 16203 deletions
-2
View File
@@ -40,8 +40,6 @@ Results/bin/
Results/obj/
ResultsBrowser/bin/
ResultsBrowser/obj/
ResultsParser/bin/
ResultsParser/obj/
Statistics/bin/
Statistics/obj/
TBF/bin/
+7 -36
View File
@@ -42,55 +42,26 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BackgroundBeep.cs" />
<Compile Include="DatabaseSettings.cs" />
<Compile Include="DBSettings.cs" />
<Compile Include="Enums.cs" />
<Compile Include="Forms\ListViewEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Forms\ListViewExtensions.cs" />
<Compile Include="Forms\LviDateTimeColumnComparer.cs" />
<Compile Include="Forms\LviIntColumnComparer.cs" />
<Compile Include="Forms\LviNameSurnameColumnComparer.cs" />
<Compile Include="Forms\LviTextColumnComparer.cs" />
<Compile Include="Forms\MessageEventArgs.cs" />
<Compile Include="Forms\ModelessForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\ModelessForm.designer.cs">
<DependentUpon>ModelessForm.cs</DependentUpon>
</Compile>
<Compile Include="IMeasurementCorrection.cs" />
<Compile Include="IOrderInfo.cs" />
<Compile Include="IParamsProvider.cs" />
<Compile Include="IUncertainty.cs" />
<Compile Include="IUser.cs" />
<Compile Include="Printers\PrintersCommon.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="QuitAppException.cs" />
<Compile Include="StatisticalMetrics.cs" />
<Compile Include="Iperl\OptoTelegramRaw.cs" />
<Compile Include="SerializableDictionary.cs" />
<Compile Include="Telegram.cs" />
<Compile Include="UIControls\CoolButtonCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UIControls\CoolButtonCtrl.Designer.cs">
<DependentUpon>CoolButtonCtrl.cs</DependentUpon>
</Compile>
<Compile Include="UIControls\LviDateTimeColumnComparer.cs" />
<Compile Include="UIControls\RoundedRectangle.cs" />
<Compile Include="Units.cs" />
<Compile Include="Utils.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Forms\ListViewEx.resx">
<DependentUpon>ListViewEx.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\ModelessForm.resx">
<DependentUpon>ModelessForm.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="UIControls\ListViewEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UIControls\ListViewExtensions.cs" />
<Compile Include="UIControls\LviIntColumnComparer.cs" />
<Compile Include="UIControls\LviTextColumnComparer.cs" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-121
View File
@@ -1,121 +0,0 @@
///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.Text;
using System.Xml.Serialization;
namespace Common
{
/// <summary>
/// Test bench database settings, contains bench name and settings od several databases
/// </summary>
public class DatabaseSettings : ICloneable, IComparable
{
// Public fields
public string BenchName;
public bool IsRealBench;
public DBSettings ProceduresDBSettings; /// Configuration database settings
public DBSettings WaterMetersDBSettings; /// Results database settings
public DBSettings EventsDBSettings; /// Events database settings
public DBSettings UsersDBSettings; /// Shared configuration database settings
// Constructor
public DatabaseSettings()
{
BenchName = String.Empty; /// Empty string (avoid null)
IsRealBench = false;
ProceduresDBSettings = new DBSettings(DBType.MySql, string.Empty);
WaterMetersDBSettings = new DBSettings(DBType.MySql, string.Empty);
EventsDBSettings = new DBSettings(DBType.MySql, string.Empty);
UsersDBSettings = new DBSettings(DBType.MySql, string.Empty);
}
public object Clone()
{
DatabaseSettings result = new DatabaseSettings();
result.BenchName = BenchName;
result.IsRealBench = IsRealBench;
result.ProceduresDBSettings = (DBSettings)ProceduresDBSettings.Clone();
result.WaterMetersDBSettings = (DBSettings)WaterMetersDBSettings.Clone();
result.EventsDBSettings = (DBSettings)EventsDBSettings.Clone();
result.UsersDBSettings = (DBSettings)UsersDBSettings.Clone();
return result;
}
public int CompareTo(object dbs2)
{
if (!(dbs2 is DatabaseSettings)) return 0;
return String.Compare(BenchName, (dbs2 as DatabaseSettings).BenchName);
}
/// <summary>
/// Extract and return a DB server from a MySQL connection string.
/// </summary>
public static string GetDBServer(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "SERVER=" });
}
/// <summary>
/// Extract and return a DB name from a MySQL connection string.
/// </summary>
public static string GetDBName(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "DATABASE=" });
}
/// <summary>
/// Extract and return a username from a MySQL connection string
/// </summary>
public static string GetDBUser(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "USER=", "UID=" });
}
/// <summary>
/// Extract and return a password from a MySQL connection string
/// </summary>
public static string GetDBPassword(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "PASSWORD=", "PWD=" });
}
/// <summary>
/// Extract and return an element of a MySQL connection string
/// (a host, a database, a user name or a password).
/// Return an empty string on any error.
/// </summary>
public static string GetFromConnectionString(string connectionString, string[] patterns)
{
foreach (var pattern in patterns)
{
int startIx = connectionString.IndexOf(pattern);
if (startIx >= 0)
{
/// pattern found, extract the subsequent element
startIx += pattern.Length;
int endIx = connectionString.IndexOf(';', startIx);
return (endIx > 0) ? connectionString.Substring(startIx, endIx - startIx) : string.Empty;
}
}
/// pattern NOT found
return string.Empty;
}
public override string ToString()
{
return string.Format("{0} config={1} results={2} events={3} users={4}",
BenchName,
ProceduresDBSettings.ConnectionString,
WaterMetersDBSettings.ConnectionString,
EventsDBSettings.ConnectionString,
UsersDBSettings.ConnectionString);
}
}
}
+7 -32
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -70,8 +70,8 @@ namespace Common
[Description("None")] None,
[Description("Local procedures")] FromLocalDB,
[Description("Shared procedures")] FromSharedDB,
[Description("Orders from Oracle DB")] OrderFromOracleDB,
[Description("Orders from Tracing DB")] OrderFromTracingDB,
[Description("Orders from Oracle DB")] OrderNrFromOracleDB,
[Description("Orders from Tracing DB")] OrderNrFromTracingDB,
#endif
Count
}
@@ -103,17 +103,6 @@ namespace Common
}
}
/// <summary>
/// Test designation mode for IperlLogger and IperlHead opto data files
/// </summary>
public enum DesigMode
{
Auto,
Based_on_procedure,
As_specified,
Count
}
public enum LoginMethod
{
UserName, /// = alias, abbreviation
@@ -304,13 +293,11 @@ namespace Common
[Description("V")] V, /// vertical
[Description("STR")] S, /// standrohre
[Description("F")] F, /// fall
[Description("H/V")] HV, /// horizontal / vertical
#else
[Description("H")] H, /// horizontal
[Description("V")] V, /// vertical
[Description("S")] S, /// steig
[Description("F")] F, /// fall
[Description("H/V")] HV, /// horizontal / vertical
[Description("H")] H, /// horizontal
[Description("V")] V, /// vertical
[Description("S")] S, /// steig
[Description("F")] F, /// fall
#endif
Count
}
@@ -342,7 +329,6 @@ namespace Common
[Description("")] NotSpecified,
[Description("U0")] U0, /// ?
[Description("D0")] D0, /// ?
///
Count
}
@@ -391,17 +377,6 @@ namespace Common
Count
}
/// <summary>
/// State of water filled in the test bench.
/// </summary>
public enum FillState
{
Unknown, /// Test bench fill state is unknown
Empty, /// Test bench is empty, no water
Full, /// Test bench is full of water
Count
}
public enum MeretProtocol
{
[Description("<undefined>")] Undefined,
-10
View File
@@ -1,10 +0,0 @@
using System;
namespace Common.Forms
{
public class MessageEventArgs : EventArgs
{
public string Message;
public MessageEventArgs(string message) { Message = message; }
}
}
-63
View File
@@ -1,63 +0,0 @@
namespace Common.Forms
{
partial class ModelessForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(47, 29);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
//
// ModelessForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(191, 56);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "ModelessForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "ModelessForm";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
}
}
-76
View File
@@ -1,76 +0,0 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Common.Forms
{
public partial class ModelessForm : Form
{
/// <summary>
/// Constructor to be used by the application
/// </summary>
/// <param name="title">Window title</param>
/// <param name="message">Displayed message</param>
public ModelessForm(string message, int backArgb = 0, int textArgb = 0, Font textFont = null, string title = null)
{
InitializeComponent();
ControlBox = false;
label1.Text = (message != null) ? message : "Please wait";
BackColor = (backArgb != 0) ? Color.FromArgb(backArgb) : Color.LightGreen;
ForeColor = (textArgb != 0) ? Color.FromArgb(textArgb) : Color.Black;
label1.Font = (textFont != null) ? textFont : new Font("Arial", 14, FontStyle.Regular);
Text = (title != null) ? title : string.Empty;
float textWidth = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(label1.Text, label1.Font).Width;
float textHeight = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(label1.Text, label1.Font).Height;
Width = (int)textWidth + 120; /// Form width calculated from the text width
Height += (int)textHeight; /// Form height calculated from the text height
UpdateMessageHandler += delegate(object sender, MessageEventArgs args)
{
if (InvokeRequired) { Invoke(new EventHandler<MessageEventArgs>(OnUpdateMessage), sender, args); }
else OnUpdateMessage(sender, args);
};
CloseFormHandler += delegate(object sender, EventArgs args)
{
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnCloseForm), sender, args); }
else OnCloseForm(sender, args);
};
}
/// <summary>
/// Called from the state machine when an operation forces a modeless dialog close.
/// </summary>
public void UpdateMessage(MessageEventArgs args)
{
if (UpdateMessageHandler == null) return;
try { UpdateMessageHandler(null, args); }
catch (Exception) { }
}
public event EventHandler<MessageEventArgs> UpdateMessageHandler;
void OnUpdateMessage(object sender, MessageEventArgs args)
{
if (args.Message != null) label1.Text = args.Message;
}
/// <summary>
/// Called from the state machine when an operation forces a modeless dialog close.
/// </summary>
public static void CloseForm()
{
if (CloseFormHandler == null) return;
try { CloseFormHandler(null, null); }
catch (Exception) { }
}
static public event EventHandler<EventArgs> CloseFormHandler;
void OnCloseForm(object sender, EventArgs args)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}
-352
View File
@@ -1,352 +0,0 @@
///
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
namespace Common
{
public static class Formulas
{
private static readonly ILog log = LogManager.GetLogger(typeof(Formulas));
///
/// Wrappers
///
public static double RealDensity() { return GlobalData.SampleDensity; }
public static double AtTemperature() { return GlobalData.SampleTemp; }
public static double Buoyancy() { return GlobalData.Buoyancy; }
/// Private tables with coeficients to calculate specific enthalpy
static readonly int[] Ii;
static readonly int[] Ji;
static readonly double[] ni;
/// Private table with coeficients to calculate temperature of a platinum thermometer
static readonly double[] Di;
/// <summary>
/// Constructor
/// </summary>
static Formulas()
{
///
/// Initialize tables to calculate specific enthalpies
///
Ii = new int[34] { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 8, 8, 21, 23, 29, 30, 31, 32 };
Ji = new int[34] { -2, -1, 0, 1, 2, 3, 4, 5, -9, -7, -1, 0, 1, 3, -3, 0, 1, 3, 17, -4, 0, 6, -5, -2, 10, -8, -11, -6, -29, -31, -38, -39, -40, -41 };
ni = new double[34] {
0.14632971213167, /// 1
-0.84548187169114, /// 2
-0.37563603672040E1, /// 3
0.33855169168385E1, /// 4
-0.95791963387872, /// 5
0.15772038513228, /// 6
-0.16616417199501E-1, /// 7
0.81214629983568E-3, /// 8
0.28319080123804E-3, /// 9
-0.60706301565874E-3, /// 10
-0.18990068218419E-1, /// 11
-0.32529748770505E-1, /// 12
-0.21841717175414E-1, /// 13
-0.52838357969930E-4, /// 14
-0.47184321073267E-3, /// 15
-0.30001780793026E-3, /// 16
0.47661393906987E-4, /// 17
-0.44141845330846E-5, /// 18
-0.72694996297594E-15, /// 19
-0.31679644845054E-4, /// 20
-0.28270797985312E-5, /// 21
-0.85205128120103E-9, /// 22
-0.22425281908000E-5, /// 23
-0.65171222895601E-6, /// 24
-0.14341729937924E-12, /// 25
-0.40516996860117E-6, /// 26
-0.12734301741641E-8, /// 27
-0.17424871230634E-9, /// 28
-0.68762131295531E-18, /// 29
0.14478307828521E-19, /// 30
0.26335781662795E-22, /// 31
-0.11947622640071E-22, /// 32
0.18228094581404E-23, /// 33
-0.93537087292458E-25, /// 34
};
///
/// Initialize a table to calculate temperature of a platinum thermometer from resistance
///
Di = new double[]
{
439.932854,
472.418020,
37.684494,
7.472018,
2.920828,
0.005184,
-0.963864,
-0.188732,
0.191203,
0.049025,
};
}
/// <summary>
/// Calculate density of distilled water from temperature
/// </summary>
/// <param name="t">ITS-90 temperature in [°C]</param>
/// <returns>Density in [kg/m3]</returns>
public static double DistilledWaterDensityFromTemp(double t)
{
if (t <= 40)
{
const double c0 = 999.839564;
const double c1 = 0.067998613;
const double c2 = -0.0091101468;
const double c3 = 0.00010058299;
const double c4 = -0.0000011275659;
const double c5 = 6.5985371e-09;
return ((((c5 * t + c4) * t + c3) * t + c2) * t + c1) * t + c0;
}
else
{
const double a0 = 9.9983952E2;
const double a1 = 1.6952577E1;
const double a2 = -7.9905127E-3;
const double a3 = -4.6241757E-5;
const double a4 = 1.0584601E-7;
const double a5 = -2.8103006E-10;
const double b = 1.6887236E-2;
return (((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t + a0) / (1.0 + b * t);
}
}
/// <summary>
/// Calculate density of distilled water from temperature (obsolete)
/// </summary>
/// <param name="t">IPTS-68 temperature in [°C]</param>
/// <returns>Density in [kg/m3]</returns>
public static double DistilledWaterDensityFromTempIPTS68(double t)
{
const double a0 = 999.842594;
const double a1 = 0.06793952;
const double a2 = -0.009095290;
const double a3 = 0.0001001685;
const double a4 = -0.000001120083;
const double a5 = 6.536332e-09;
return ((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t + a0;
}
/// <summary>
/// Calculate density by comparing calculated data and data from a certificate
/// </summary>
/// <param name="realDensity">Density from a certificate in [kg/m3]</param>
/// <param name="atTemperature">Temperature from a certificate in [°C]</param>
/// <returns>Density correction in [kg/m3]</returns>
public static double DensityCorrection(double realDensity, double atTemperature)
{
/// Calculated data
double calculatedDensity = DistilledWaterDensityFromTemp(atTemperature);
return realDensity - calculatedDensity;
}
/// <summary>
/// Calculate corrected (real) water density from temperature
/// </summary>
/// <param name="t">Temperature in [°C]</param>
/// <returns>Density in [kg/m3]</returns>
public static double WaterDensityFromTemp(double t)
{
return DistilledWaterDensityFromTemp(t) + DensityCorrection(RealDensity(), AtTemperature());
}
/// <summary>
/// Calculate corrected (real) water density from temperature
/// </summary>
/// <param name="t">Temperature in [°C]</param>
/// <returns>Density in [kg/m3]</returns>
public static double WaterDensityFromTempPress(double temp, double pressure)
{
double x0 = 5.08821E-10;
double x1 = 1.2639418;
double x2 = 0.2660269;
double x3 = 0.3734838;
double x4 = 2.0205242;
double theta = temp / 100.0;
double B = x0 * (((x3 * theta + x2) * theta + x1) * theta + 1) / (1 + x4 * theta);
return WaterDensityFromTemp(temp) * (1 + B * Common.Units.ConvertTo(Common.Unit.Pa, pressure));
}
public static float AirDensityFromAmbientVales(float tempC, float pressureBar, float humiPct)
{
double pressurePa = 100000.0 * (double)pressureBar; /// [Pa]
double tempKelvin = 273.15 + (double)tempC;
double coef1 = 1.2811805 / 10000.0 * tempKelvin * tempKelvin
- 1.950987 / 100.0 * tempKelvin
+ 34.04926034
- 6.353631 * 1000.0 / tempKelvin;
double coef3 = humiPct / 100.0 * System.Math.Exp(coef1) / pressurePa;
double airDensityKgm3 = 0.00348353 * pressurePa * (1.0 - 0.378 * coef3) / tempKelvin; /// kg/m3
return (float)airDensityKgm3;
}
/// <summary>
/// Convert 'pulses' to 'volume', prevent division by zero
/// </summary>
public static double VolumeFromPulses(int pulses, double pulsesPerLiter)
{
if (pulsesPerLiter <= double.Epsilon) return 0;
return Convert.ToDouble(pulses) / pulsesPerLiter;
}
/// <summary>
/// Calculate the error in % from 'measured' and 'true' volume, prevent division by zero
/// </summary>
public static double ErrorFromVolumes(double measuredVolume, double trueVolume)
{
if (trueVolume <= float.Epsilon)
{
if (measuredVolume <= float.Epsilon)
{
log.WarnFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, -100.0);
return -100.0;
}
log.WarnFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, 99.0);
return 99.0;
}
double error = 100.0 * (measuredVolume - trueVolume) / trueVolume;
log.InfoFormat("ErrorFromVolumes({0},{1}) returns {2}", measuredVolume, trueVolume, error);
return error;
}
/// <summary>
/// Converts a measurement error to a correction (used when preparing correction tables).
/// </summary>
/// <param name="measuredValue">Measured value (in arbitrary units)</param>
/// <param name="error">Measurement error in %</param>
/// <returns>Correction in the same units as the measured value</returns>
public static double CorrectionFromError(double measuredValue, double error)
{
double trueValue = measuredValue / (1 + error/100);
double correction = trueValue - measuredValue;
return correction;
}
/// <summary>
/// Calculates the heat coefficient for water
/// </summary>
/// <param name="pressure">Pressure [bar]</param>
/// <param name="T_in">Inlet temperature [°C]</param>
/// <param name="T_out">Outlet temperature [°C]</param>
/// <param name="flowMeasuredAtInlet">true = flow measured @inlet, false = flow measured @outlet</param>
/// <returns> Heat coefficient for water [J/(m3 K)]</returns>
public static double HeatCoefficientWater(double pressure, double T_in, double T_out, bool flowMeasuredAtInlet)
{
if (T_in == T_out) return 0;
const double R = 461.526; /// [J kg^-1 K^-1]
const double p_star_Pa = 16.53E6; /// [Pa] (=16.53 MPa)
const double T_star = 1386.0; /// [K]
double T_in_K = Common.Units.ConvertTo(Common.Unit.K, T_in);
double T_out_K = Common.Units.ConvertTo(Common.Unit.K, T_out);
double tau_in = T_star / T_in_K;
double tau_out = T_star / T_out_K;
double pi = Common.Units.ConvertTo(Common.Unit.Pa, pressure) / p_star_Pa;
double h_in = tau_in * GammaTau(pi, tau_in) * R * T_in_K;
double h_out = tau_out * GammaTau(pi, tau_out) * R * T_out_K;
double ni = flowMeasuredAtInlet ? GammaPi(pi, tau_in) * R * T_in_K / p_star_Pa
: GammaPi(pi, tau_out) * R * T_out_K / p_star_Pa;
return (h_in - h_out) / (ni * (T_in - T_out));
}
/// <summary>
/// gamma(pi) see also STN EN 1434-1 Annex A (A.4)
/// </summary>
/// <param name="pi">pi = p / p* where p* = 16.53 MPa</param>
/// <param name="tau">tau = T* / T where T* = 1386 K</param>
/// <returns>gamma(pi)</returns>
static double GammaPi(double pi, double tau)
{
double result = 0;
for (int i = 0; i < 34; i++)
{
result -= ni[i] * Ii[i] * Math.Pow(7.1 - pi, Ii[i] - 1) * Math.Pow(tau - 1.222, Ji[i]);
}
return result;
}
/// <summary>
/// gamma(tau) see also STN EN 1434-1 Annex A (A.7)
/// </summary>
/// <param name="pi">pi = p / p* where p* = 16.53 MPa</param>
/// <param name="tau">tau = T* / T where T* = 1386 K</param>
/// <returns>gamma(tau)</returns>
static double GammaTau(double pi, double tau)
{
double result = 0;
for (int i = 0; i < 34; i++)
{
result += ni[i] * Math.Pow(7.1 - pi, Ii[i]) * Ji[i] * Math.Pow(tau - 1.222, Ji[i] - 1);
}
return result;
}
/// <summary>
/// Conversion of measured resistance of a platinum thermometer to temperature according to ITS-90
/// </summary>
/// <param name="R">Measured resistance in [°C]</param>
/// <param name="R001C">Calibrated resistance in Ohm at 0.01°C</param>
/// <param name="a7">Calibrated ITS-90 coefficient a7</param>
/// <param name="b7">Calibrated ITS-90 coefficient b7</param>
/// <param name="c7">Calibrated ITS-90 coefficient c7</param>
/// <returns>Temperature in [°C]</returns>
public static double PlatinumResistanceTM_ITS90_R2T(double R, double R001C, double a7, double b7, double c7)
{
double w = R / R001C; /// ratio
double r1 = w - 1.0;
double dw = r1 * (a7 + r1 * (b7 + r1 * c7)); /// = a7*r1 + b7*r1^2 + c7*r1^3
double wr = w - dw;
double x = (wr - 2.64) / 1.64;
double sum = 0;
for (int i = Di.Length - 1; i >= 0; i--)
{
sum = sum * x + Di[i];
}
return sum;
}
/// <summary>
/// Conversion of measured resistance of a platinum thermometer to temperature using Callendar-Van Dusen equations
/// </summary>
/// <param name="R">Measured resistance in [°C]</param>
/// <param name="R0">Calibrated resistance in Ohm at 0°C</param>
/// <param name="A">Calibration coefficient a</param>
/// <param name="B">Calibration coefficient b</param>
/// <returns>Temperature in [°C]</returns>
public static double PlatinumResistanceTM_ITS27_R2T(double R, double R0, double A, double B)
{
if (R0 * R0 * A * A - 4 * R0 * B * (R0 - R) <= 0) return 0; /// Out of range
return (-(R0 * A) + Math.Sqrt(R0 * R0 * A * A - 4 * R0 * B * (R0 - R))) / (2 * R0 * B);
}
}
}
-11
View File
@@ -1,11 +0,0 @@
using System;
namespace Common
{
public interface IMeasurementCorrection
{
int RangeIx { get; set; }
double Measurement { get; set; }
double Correction { get; set; }
}
}
-26
View File
@@ -1,26 +0,0 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
namespace Common
{
public interface IOrderInfo
{
string POName { get; }
string VariantCode { get; }
string ModuleParam { get; }
int PiecesCount { get; }
string SNPrefix { get; }
int SNFirst { get; }
int SNDigitsCount { get; }
string SNSuffix { get; }
string RAPrefix { get; }
int RAFirst { get; }
string RASuffix { get; }
string Remark { get; }
int CurrentPcsCount { get; set; }
int CurrentSN { get; set; }
int CurrentRA { get; set; }
}
}
-14
View File
@@ -1,14 +0,0 @@
using System;
namespace Common
{
public interface IUncertainty
{
float Measurement { get; }
float MainUncertainty { get; }
float Resolution { get; }
float DriftPerYr { get; }
float Conditions { get; }
float UncertaintyOfCorrection { get; }
}
}
-22
View File
@@ -1,22 +0,0 @@
using System;
namespace Common
{
public interface IUser
{
string UserName { get; } /// = name, alias, abbreviation
string FullName { get; } /// = description
string Tag { get; }
int Number { get; }
/// Access rights
bool IsMemberOf(GID group);
bool IsMemberOf(GID[] groups);
bool IsCorrectPassword(string password);
/// Password complexity, history, etc.
bool IsPasswordExpired();
bool IsPasswordUsedInPast(string passwordCandidate);
void SetPassword(string password);
}
}
+1 -1
View File
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Common")]
[assembly: AssemblyCopyright("Copyright © 2020-2022")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections;
@@ -9,7 +9,7 @@ using System.Data;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Common.Forms
namespace Common.UIControls
{
/// <summary>
/// Event Handler for SubItem events
@@ -61,9 +61,6 @@ namespace Common.Forms
private const int HDN_ITEMCHANGINGW = (HDN_FIRST-20);
#endregion
public MySortOrder SortOrder = MySortOrder.None;
public int SortColumn = -1;
/// <summary>
/// Required designer variable.
/// </summary>
@@ -427,18 +424,12 @@ namespace Common.Forms
OnSubItemEndEditing(e);
if (_editSubItem >= 0 && _editSubItem < _editItem.SubItems.Count)
{
_editItem.SubItems[_editSubItem].Text = e.DisplayText;
}
_editItem.SubItems[_editSubItem].Text = e.DisplayText;
if (_editingControl != null)
{
_editingControl.Leave -= new EventHandler(_editControl_Leave);
_editingControl.KeyPress -= new KeyPressEventHandler(_editControl_KeyPress);
_editingControl.Leave -= new EventHandler(_editControl_Leave);
_editingControl.KeyPress -= new KeyPressEventHandler(_editControl_KeyPress);
_editingControl.Visible = false;
}
_editingControl.Visible = false;
_editingControl = null;
_editItem = null;
+107
View File
@@ -0,0 +1,107 @@
///
/// Copyright (c) 2019-2020 Sensus Slovensko a.s.
///
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace Common.UIControls
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static class ListViewExtensions
{
[StructLayout(LayoutKind.Sequential)]
public struct HDITEM
{
public Mask mask;
public int cxy;
[MarshalAs(UnmanagedType.LPTStr)]
public string pszText;
public IntPtr hbm;
public int cchTextMax;
public Format fmt;
public IntPtr lParam;
// _WIN32_IE >= 0x0300
public int iImage;
public int iOrder;
// _WIN32_IE >= 0x0500
public uint type;
public IntPtr pvFilter;
// _WIN32_WINNT >= 0x0600
public uint state;
[Flags]
public enum Mask
{
Format = 0x4, // HDI_FORMAT
};
[Flags]
public enum Format
{
SortDown = 0x200, // HDF_SORTDOWN
SortUp = 0x400, // HDF_SORTUP
};
};
public const int LVM_FIRST = 0x1000;
public const int LVM_GETHEADER = LVM_FIRST + 31;
public const int HDM_FIRST = 0x1200;
public const int HDM_GETITEM = HDM_FIRST + 11;
public const int HDM_SETITEM = HDM_FIRST + 12;
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, ref HDITEM lParam);
public static void SetSortIcon(this ListViewEx listViewControl, int columnIndex, SortOrder order)
{
IntPtr columnHeader = SendMessage(listViewControl.Handle, LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero);
for (int columnNumber = 0; columnNumber <= listViewControl.Columns.Count - 1; columnNumber++)
{
var columnPtr = new IntPtr(columnNumber);
var item = new HDITEM
{
mask = HDITEM.Mask.Format
};
if (SendMessage(columnHeader, HDM_GETITEM, columnPtr, ref item) == IntPtr.Zero)
{
throw new Win32Exception();
}
if (order != SortOrder.None && columnNumber == columnIndex)
{
switch (order)
{
case SortOrder.Ascending:
item.fmt &= ~HDITEM.Format.SortDown;
item.fmt |= HDITEM.Format.SortUp;
break;
case SortOrder.Descending:
item.fmt &= ~HDITEM.Format.SortUp;
item.fmt |= HDITEM.Format.SortDown;
break;
default:
break;
}
}
else
{
item.fmt &= ~HDITEM.Format.SortDown & ~HDITEM.Format.SortUp;
}
if (SendMessage(columnHeader, HDM_SETITEM, columnPtr, ref item) == IntPtr.Zero)
{
throw new Win32Exception();
}
}
}
}
}
@@ -1,24 +1,24 @@
///
/// Copyright (c) 2019-2021 Sensus Slovensko a.s.
/// Copyright (c) 2019-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections;
using System.Windows.Forms;
namespace Common.Forms
namespace Common.UIControls
{
public class LviDateTimeColumnComparer : IComparer
{
int column;
MySortOrder order;
SortOrder order;
public LviDateTimeColumnComparer()
{
column = 0;
order = MySortOrder.Ascending;
order = SortOrder.Ascending;
}
public LviDateTimeColumnComparer(int column, MySortOrder order)
public LviDateTimeColumnComparer(int column, SortOrder order)
{
this.column = column;
this.order = order;
@@ -33,13 +33,13 @@ namespace Common.Forms
{
return 0;
}
else if ((order == MySortOrder.Descending || order == MySortOrder.Descending2))
else if (order == SortOrder.Ascending)
{
return (valY > valX) ? 1 : -1;
return (valX > valY) ? 1 : -1;
}
else
{
return (valX > valY) ? 1 : -1;
return (valY > valX) ? 1 : -1;
}
}
}
+34
View File
@@ -0,0 +1,34 @@
///
/// Copyright (c) 2019-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections;
using System.Windows.Forms;
namespace Common.UIControls
{
public class LviIntColumnComparer : IComparer
{
int column;
SortOrder order;
public LviIntColumnComparer()
{
column = 0;
order = SortOrder.Ascending;
}
public LviIntColumnComparer(int column, SortOrder order)
{
this.column = column;
this.order = order;
}
public int Compare(object x, object y)
{
int valX = int.Parse(((ListViewItem)x).SubItems[column].Text);
int valY = int.Parse(((ListViewItem)y).SubItems[column].Text);
return (order == SortOrder.Descending) ? (valY - valX) : (valX - valY);
}
}
}
@@ -0,0 +1,34 @@
///
/// Copyright (c) 2019-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections;
using System.Windows.Forms;
namespace Common.UIControls
{
public class LviTextColumnComparer : IComparer
{
private int column;
SortOrder order;
public LviTextColumnComparer()
{
column = 0;
order = SortOrder.Ascending;
}
public LviTextColumnComparer(int column, SortOrder order)
{
this.column = column;
this.order = order;
}
public int Compare(object x, object y)
{
string txtX = ((ListViewItem)x).SubItems[column].Text;
string txtY = ((ListViewItem)y).SubItems[column].Text;
return (order == SortOrder.Descending) ? String.Compare(txtY, txtX) : String.Compare(txtX, txtY);
}
}
}
+1 -80
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2021-2022 Sensus Slovensko a.s.
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
using System.IO.Ports;
@@ -15,85 +15,6 @@ namespace Common
return string.Format("{0} ({1}/{2})", name, repetitionNr, repeats);
}
public static string ToNiceString(double value, int sigDigits)
{
string format = SignificantDigitsToFmt(value, sigDigits);
return (format == "F0") ? value.ToString("F0") : value.ToString(format).TrimEnd(new char[] { '0' });
}
public static string SignificantDigitsToFmt(double value, int sigDigits)
{
if (sigDigits == 6)
{
if (value >= 99999.5 || value < -99999.5) return "F0";
else if (value >= 9999.95 || value < -9999.95) return "F1";
else if (value >= 999.995 || value < -999.995) return "F2";
else if (value >= 99.9995 || value < -99.9995) return "F3";
else if (value >= 9.99995 || value < -9.99995) return "F4";
else if (value >= 0.999995 || value < -0.999995) return "F5";
else if (value >= 0.0999995 || value < -0.0999995) return "F6";
else if (value >= 0.00999995 || value < -0.00999995) return "F7";
else if (value >= 0.000999995 || value < -0.000999995) return "F8";
else if (value >= 0.0000999995 || value < -0.0000999995) return "F9";
else return "F10";
}
else if (sigDigits == 5)
{
if (value >= 9999.5 || value < -9999.5) return "F0";
else if (value >= 999.95 || value < -999.95) return "F1";
else if (value >= 99.995 || value < -99.995) return "F2";
else if (value >= 9.9995 || value < -9.9995) return "F3";
else if (value >= 0.99995 || value < -0.99995) return "F4";
else if (value >= 0.099995 || value < -0.099995) return "F5";
else if (value >= 0.0099995 || value < -0.0099995) return "F6";
else if (value >= 0.00099995 || value < -0.00099995) return "F7";
else if (value >= 0.000099995 || value < -0.000099995) return "F8";
else return "F9";
}
else if (sigDigits == 4)
{
if (value >= 999.5 || value < -999.5) return "F0";
else if (value >= 99.95 || value < -99.95) return "F1";
else if (value >= 9.995 || value < -9.995) return "F2";
else if (value >= 0.9995 || value < -0.9995) return "F3";
else if (value >= 0.09995 || value < -0.09995) return "F4";
else if (value >= 0.009995 || value < -0.009995) return "F5";
else if (value >= 0.0009995 || value < -0.0009995) return "F6";
else if (value >= 0.00009995 || value < -0.00009995) return "F7";
else return "F8";
}
else if (sigDigits == 3)
{
if (value >= 99.5 || value < -99.5) return "F0";
else if (value >= 9.95 || value < -9.95) return "F1";
else if (value >= 0.995 || value < -0.995) return "F2";
else if (value >= 0.0995 || value < -0.0995) return "F3";
else if (value >= 0.00995 || value < -0.00995) return "F4";
else if (value >= 0.000995 || value < -0.000995) return "F5";
else if (value >= 0.0000995 || value < -0.0000995) return "F6";
else return "F7";
}
else if (sigDigits == 2)
{
if (value >= 9.5 || value < -9.5) return "F0";
else if (value >= 0.95 || value < -0.95) return "F1";
else if (value >= 0.095 || value < -0.095) return "F2";
else if (value >= 0.0095 || value < -0.0095) return "F3";
else if (value >= 0.00095 || value < -0.00095) return "F4";
else if (value >= 0.000095 || value < -0.000095) return "F5";
else return "F6";
}
else /// if (sigDigits == 1)
{
if (value >= 0.95 || value < -0.95) return "F0";
else if (value >= 0.095 || value < -0.095) return "F1";
else if (value >= 0.0095 || value < -0.0095) return "F2";
else if (value >= 0.00095 || value < -0.00095) return "F3";
else if (value >= 0.000095 || value < -0.000095) return "F4";
else return "F5";
}
}
public static Parity GetParity(string str, Parity defaultParity = Parity.None)
{
if (str.Equals(Parity.None.ToString())) return Parity.None;
+5 -2
View File
@@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE;DEBUG;FEWA_50</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -30,7 +30,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE;FEWA_50</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
@@ -69,6 +69,7 @@
<ItemGroup>
<Compile Include="CalendarEvent\ICalendarEvent.cs" />
<Compile Include="Data.cs" />
<Compile Include="DatabaseSettings.cs" />
<Compile Include="Entities\BenchPath.cs" />
<Compile Include="Entities\CustomEvent.cs" />
<Compile Include="Entities\Component.cs" />
@@ -80,6 +81,7 @@
<Compile Include="Entities\IHasItemNr.cs" />
<Compile Include="Entities\IHasName.cs" />
<Compile Include="Entities\IHasValves.cs" />
<Compile Include="Entities\IParamsProvider.cs" />
<Compile Include="Entities\MeasurementCorrection.cs" />
<Compile Include="Entities\MetersPath.cs" />
<Compile Include="Entities\OutputPath.cs" />
@@ -122,6 +124,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
<Compile Include="Units.cs" />
<Compile Include="Utils.cs" />
</ItemGroup>
<ItemGroup>
+3 -3
View File
@@ -2,7 +2,7 @@
namespace Config
{
public class Data : Users.CurrentUser
public class Data : Users.GlobalData
{
public const string AdminUsername = "admin";
public const string AdminPassword = "staratura";
@@ -26,7 +26,7 @@ namespace Config
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
#elif BADGER_MALA_TRAT || BERLIN || FUZHOU_150 || FUZHOU_300 || GELSENWASSER || GENESIS || IZRAEL_200 || PETERSBURG_200 || SENTEC || SLM_150 || TORINO_50
#elif BADGER_MALA_TRAT || BERLIN || FUZHOU_150 || FUZHOU_300 || GELSENWASSER || GENESIS || IZRAEL_200 || PETERSBURG_200 || SENTEC || SLM_150 || TORINO_50 || TURA_SPECIAL
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
@@ -38,7 +38,7 @@ namespace Config
public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif RUM_MOB || TURA_SPECIAL
#elif RUM_MOB
public const int WMsCount = 8;
public const int LineSize = 8;
public const int CompoundWMsCount = 1;
+64
View File
@@ -0,0 +1,64 @@
///
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.Text;
using System.Xml.Serialization;
namespace Config
{
/// <summary>
/// Test bench database settings, contains bench name and settings od several databases
/// </summary>
public class DatabaseSettings : ICloneable, IComparable
{
// Public fields
public string BenchName;
public bool IsRealBench;
public Users.DBSettings ProceduresDBSettings; /// Configuration database settings
public Users.DBSettings WaterMetersDBSettings; /// Results database settings
public Users.DBSettings EventsDBSettings; /// Events database settings
public Users.DBSettings UsersDBSettings; /// Shared configuration database settings
// Constructor
public DatabaseSettings()
{
BenchName = String.Empty; /// Empty string (avoid null)
IsRealBench = false;
ProceduresDBSettings = new Users.DBSettings(Common.DBType.MySql, string.Empty);
WaterMetersDBSettings = new Users.DBSettings(Common.DBType.MySql, string.Empty);
EventsDBSettings = new Users.DBSettings(Common.DBType.MySql, string.Empty);
UsersDBSettings = new Users.DBSettings(Common.DBType.MySql, string.Empty);
}
public object Clone()
{
DatabaseSettings result = new DatabaseSettings();
result.BenchName = BenchName;
result.IsRealBench = IsRealBench;
result.ProceduresDBSettings = (Users.DBSettings)ProceduresDBSettings.Clone();
result.WaterMetersDBSettings = (Users.DBSettings)WaterMetersDBSettings.Clone();
result.EventsDBSettings = (Users.DBSettings)EventsDBSettings.Clone();
result.UsersDBSettings = (Users.DBSettings)UsersDBSettings.Clone();
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}",
BenchName,
ProceduresDBSettings.ConnectionString,
WaterMetersDBSettings.ConnectionString,
EventsDBSettings.ConnectionString,
UsersDBSettings.ConnectionString);
}
}
}
+2 -8
View File
@@ -1,9 +1,8 @@
///
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using Common;
namespace Config.Entities
{
@@ -15,7 +14,6 @@ namespace Config.Entities
public virtual string OriName { get; set; } /// Not mapped to database
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
public virtual float Qto { get; set; } /// Water flow in [m3/h]
public virtual Unit FlowUnit { get; set; } /// Not mapped to database, used in UI
public virtual string Selector { get; set; }
public virtual string TempMtrUp { get; set; }
public virtual string TempMtrDown { get; set; }
@@ -28,16 +26,13 @@ namespace Config.Entities
public virtual string ValvesOpen { get; set; }
public virtual string ValvesClose { get; set; }
public virtual bool QfromTextChngd { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual bool QtoTextChngd { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
/// ------------- Additional stuff not mapped into the database -------------
public BenchPath()
{
ValvesOpen = string.Empty;
ValvesClose = string.Empty;
}
}
public BenchPath(string name, int itemNr)
: this()
@@ -52,7 +47,6 @@ namespace Config.Entities
result.Qfrom = Qfrom;
result.Qto = Qto;
result.FlowUnit = FlowUnit;
result.Selector = Selector;
result.TempMtrUp = TempMtrUp;
result.TempMtrDown = TempMtrDown;
-1
View File
@@ -3,7 +3,6 @@
///
using System;
using System.IO;
using Common;
namespace Config.Entities
{
-1
View File
@@ -3,7 +3,6 @@
///
using System;
using System.IO;
using Common;
namespace Config.Entities
{
+12 -17
View File
@@ -1,21 +1,19 @@
///
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using Common;
namespace Config.Entities
{
public class FeedingPath : IHasName, IHasItemNr, IHasValves
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual string OriName { get; set; } /// Not mapped to database
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
public virtual float Qto { get; set; } /// Water flow in [m3/h]
public virtual Unit FlowUnit { get; set; } /// Not mapped to database, used in UI
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
public virtual float Qto { get; set; } /// Water flow in [m3/h]
public virtual string Selector { get; set; }
public virtual string Pump { get; set; }
public virtual string RegulValvesPct { get; set; } /// Positions of regulation valves in % separated by ';'
@@ -24,9 +22,6 @@ namespace Config.Entities
public virtual string ValvesOpen { get; set; }
public virtual string ValvesClose { get; set; }
public virtual bool QfromTextChngd { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual bool QtoTextChngd { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
/// ------------- Additional stuff not mapped into the database -------------
public FeedingPath()
@@ -46,14 +41,14 @@ namespace Config.Entities
{
FeedingPath result = new FeedingPath(name, itemNr);
result.Qfrom = Qfrom;
result.Qto = Qto;
result.FlowUnit = FlowUnit;
result.Selector = Selector;
result.Pump = Pump;
result.Qfrom = Qfrom;
result.Qto = Qto;
result.Selector = Selector;
result.Pump = Pump;
result.RegulValvesPct = RegulValvesPct;
result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose;
result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose;
return result;
}
@@ -1,11 +1,12 @@
///
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Common;
namespace Common
namespace Config.Entities
{
public interface IParamsProvider
{
+5 -69
View File
@@ -1,17 +1,16 @@
///
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
namespace Config.Entities
{
public class MeasurementCorrection : Common.IMeasurementCorrection, IComparable<MeasurementCorrection>
public class MeasurementCorrection
{
public virtual int Id { get; protected set; }
public virtual int RangeIx { get; set; } /// 0..5
public virtual double Measurement { get; set; }
public virtual double Correction { get; set; }
public virtual float Measurement { get; set; }
public virtual float Correction { get; set; }
public MeasurementCorrection()
{
@@ -22,68 +21,5 @@ namespace Config.Entities
{
RangeIx = rangeIx;
}
public virtual int CompareTo(MeasurementCorrection other)
{
return (Measurement > other.Measurement) ? 1 : ((Measurement == other.Measurement) ? 0 : -1);
}
/// <summary>
/// Calculates corrected value from a list of corrections by interpolation.
/// It is assumed that values in the list 'corrections' are sorted.
/// </summary>
/// <param name="rawMeasurement">Raw uncorrected value</param>
/// <param name="corrections">Sorted (value, correction) pairs</param>
/// <returns>Corrected value</returns>
public static double CorrectedValue(double rawValue, IList<MeasurementCorrection> corrections)
{
return rawValue + GetCorrection(rawValue, corrections);
}
/// <summary>
/// Get a correction from a list of corrections by interpolation.
/// It is assumed that values in the list 'corrections' are sorted.
/// </summary>
/// <param name="rawMeasurement">Raw uncorrected value</param>
/// <param name="corrections">Sorted (value, correction) pairs</param>
/// <returns>Corrected value</returns>
public static double GetCorrection(double rawValue, IList<MeasurementCorrection> corrections)
{
if ((corrections == null) || (corrections.Count == 0)) return 0; /// No correction
if (rawValue < corrections[0].Measurement)
{
/// rawValue is below the lowest value in the correction table
return corrections[0].Correction;
}
for (int i = 1; i < corrections.Count; i++)
{
if (rawValue < corrections[i].Measurement)
{
double d1 = rawValue - corrections[i - 1].Measurement;
double d2 = corrections[i].Measurement - rawValue;
if (d1 + d2 <= float.Epsilon)
{
/// Neigboring values in the corection table are close to each other -> calculate the average
return (corrections[i - 1].Correction + corrections[i].Correction) / 2.0;
}
else
{
/// Interpolate the correction from neigboring values in the corection table
return (corrections[i - 1].Correction * d2 + corrections[i].Correction * d1) / (d1 + d2);
}
}
}
/// rawValue is above the highest value in the correction table
return corrections[corrections.Count - 1].Correction;
}
public override string ToString()
{
return string.Format("{0} {1} ({2})", Measurement, Correction, RangeIx);
}
}
}
}
+20 -26
View File
@@ -1,25 +1,23 @@
///
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using Common;
namespace Config.Entities
{
public class OutputPath : IHasName, IHasItemNr, IHasValves
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual string OriName { get; set; } /// Not mapped to database
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
public virtual float Qto { get; set; } /// Water flow in [m3/h]
public virtual Unit FlowUnit { get; set; } /// Not mapped to database, used in UI
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
public virtual float Qto { get; set; } /// Water flow in [m3/h]
public virtual string Selector { get; set; }
public virtual string RegulValve { get; set; }
public virtual string FlowMeter { get; set; }
public virtual float PidCoef { get; set; } /// PID coefficient for the regulation path
public virtual float PidCoef { get; set; } /// PID coefficient for the regulation path
public virtual string StartValve { get; set; }
public virtual string Diverter { get; set; }
public virtual string TempDiv { get; set; }
@@ -30,16 +28,13 @@ namespace Config.Entities
public virtual string ValvesOpen { get; set; }
public virtual string ValvesClose { get; set; }
public virtual bool QfromTextChngd { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
public virtual bool QtoTextChngd { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab
/// ------------- Additional stuff not mapped into the database -------------
public OutputPath()
{
ValvesOpen = string.Empty;
ValvesClose = string.Empty;
}
}
public OutputPath(string name, int itemNr)
: this()
@@ -52,21 +47,20 @@ namespace Config.Entities
{
OutputPath result = new OutputPath(name, itemNr);
result.Name = Name;
result.Qfrom = Qfrom;
result.Qto = Qto;
result.FlowUnit = FlowUnit;
result.Selector = Selector;
result.RegulValve = RegulValve;
result.FlowMeter = FlowMeter;
result.PidCoef = PidCoef;
result.StartValve = StartValve;
result.Diverter = Diverter;
result.TempDiv = TempDiv;
result.Scale = Scale;
result.Name = Name;
result.Qfrom = Qfrom;
result.Qto = Qto;
result.Selector = Selector;
result.RegulValve = RegulValve;
result.FlowMeter = FlowMeter;
result.PidCoef = PidCoef;
result.StartValve = StartValve;
result.Diverter = Diverter;
result.TempDiv = TempDiv;
result.Scale = Scale;
result.RegulValvesPct = RegulValvesPct;
result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose;
result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose;
return result;
}
+3 -27
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2019-2022 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
@@ -27,7 +27,6 @@ namespace Config.Entities
public virtual double PressLimHi { get; set; } /// [bar] max. water pressure
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
public virtual bool Evaluate { get; set; }
public virtual string Method { get; set; } /// Test method (component name)
public virtual sbyte E1 { get; set; } ///
public virtual sbyte E2 { get; set; } ///
@@ -82,7 +81,6 @@ namespace Config.Entities
PressLimHi = 16.0; /// [bar]
Publish = (sbyte)Common.Publish.Always;
Evaluate = true;
Method = string.Empty;
E1 = (sbyte)ErrorFlagsMode.On;
E2 = (sbyte)ErrorFlagsMode.On;
@@ -142,7 +140,6 @@ namespace Config.Entities
result.PressLimHi = PressLimHi;
result.Publish = Publish;
result.Evaluate = Evaluate;
result.Method = Method;
result.E1 = E1;
result.E2 = E2;
@@ -196,7 +193,6 @@ namespace Config.Entities
output.WriteLine(PressLimHi.ToString(ci));
output.WriteLine(Publish.ToString());
output.WriteLine(Evaluate.ToString());
output.WriteLine(Method);
output.WriteLine(E1.ToString());
output.WriteLine(E2.ToString());
@@ -251,29 +247,10 @@ namespace Config.Entities
tst.ErrLimHi = double.Parse(input.ReadLine(), ci);
tst.TempLimLo = double.Parse(input.ReadLine(), ci);
tst.TempLimHi = double.Parse(input.ReadLine(), ci);
tst.PressLimLo = double.Parse(input.ReadLine(), ci);
tst.PressLimHi = double.Parse(input.ReadLine(), ci);
tst.Publish = sbyte.Parse(input.ReadLine(), ci);
tst.Publish = sbyte.Parse(input.ReadLine());
tst.Evaluate = bool.Parse(input.ReadLine());
tst.Method = input.ReadLine();
tst.E1 = sbyte.Parse(input.ReadLine(), ci);
tst.E2 = sbyte.Parse(input.ReadLine(), ci);
tst.E3 = sbyte.Parse(input.ReadLine(), ci);
tst.E4 = sbyte.Parse(input.ReadLine(), ci);
tst.E5 = sbyte.Parse(input.ReadLine(), ci);
tst.E6 = sbyte.Parse(input.ReadLine(), ci);
tst.E7 = sbyte.Parse(input.ReadLine(), ci);
tst.E8 = sbyte.Parse(input.ReadLine(), ci);
tst.E9 = sbyte.Parse(input.ReadLine(), ci);
tst.E10 = sbyte.Parse(input.ReadLine(), ci);
tst.E11 = sbyte.Parse(input.ReadLine(), ci);
tst.E12 = sbyte.Parse(input.ReadLine(), ci);
tst.E13 = sbyte.Parse(input.ReadLine(), ci);
tst.E14 = sbyte.Parse(input.ReadLine(), ci);
tst.E15 = sbyte.Parse(input.ReadLine(), ci);
tst.E16 = sbyte.Parse(input.ReadLine(), ci);
tst.E21 = sbyte.Parse(input.ReadLine(), ci);
/// TODO (E1 .. E21)
tst.Delta_Q_pct = double.Parse(input.ReadLine(), ci);
tst.Delta_T = double.Parse(input.ReadLine(), ci);
@@ -316,7 +293,6 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != PressLimHi.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_max", PressLimHi.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Publish.ToString()) { diff.AppendFormat(fmt, "Publish", Publish.ToString(), ln); };
ln = inp.ReadLine(); if (ln != Evaluate.ToString()) { diff.AppendFormat(fmt, "Evaluate", Evaluate.ToString(), ln); };
ln = inp.ReadLine(); if (ln != Method) { diff.AppendFormat(fmt, "Method", Method, ln); };
ln = inp.ReadLine(); if (ln != E1.ToString()) { diff.AppendFormat(fmt, "E1", E1.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E2.ToString()) { diff.AppendFormat(fmt, "E2", E2.ToString(), ln); };
+1 -1
View File
@@ -75,7 +75,7 @@ namespace Config.Entities
///
/// Default values
///
CreationUser = Users.CurrentUser.UserName();
CreationUser = (Users.GlobalData.CurrentUser != null) ? Users.GlobalData.CurrentUser.UserName : null;
CreationTime = DateTime.Now;
LastChgUser = CreationUser;
LastChgTime = CreationTime;
+2 -5
View File
@@ -36,7 +36,7 @@ namespace Config.Entities
///
/// Default values
///
CreationUser = Users.CurrentUser.UserName();
CreationUser = (Users.GlobalData.CurrentUser != null) ? Users.GlobalData.CurrentUser.UserName : null;
CreationTime = DateTime.Now;
LastChgUser = CreationUser;
LastChgTime = CreationTime;
@@ -78,8 +78,6 @@ namespace Config.Entities
output.WriteLine(CreationTime.ToString(CultureInfo.InvariantCulture));
output.WriteLine(LastChgUser);
output.WriteLine(LastChgTime.ToString(CultureInfo.InvariantCulture));
output.WriteLine(((sbyte)ProfileType).ToString());
output.WriteLine(((sbyte)ErrorLimitType).ToString());
foreach (var test in Tests) { test.Export(output); }
output.WriteLine();
@@ -98,8 +96,7 @@ namespace Config.Entities
result.CreationTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
result.LastChgUser = input.ReadLine();
result.LastChgTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
result.ProfileType = (ProfileType)sbyte.Parse(input.ReadLine());
result.ErrorLimitType = (ErrorLimitType)sbyte.Parse(input.ReadLine());
string line = input.ReadLine();
while (true)
{
+22 -67
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -34,10 +34,10 @@ namespace Config.Entities
public virtual int Repeats { get; set; }
public virtual bool DoDraining { get; set; }
public virtual bool DoDrainingAfter { get; set; }
public virtual bool DoControlWaterTemp { get; set; }
public virtual float TempLimLo { get; set; } /// Lower limit for the controlled temperature
public virtual float TempLimHi { get; set; } /// Upper limit for the controlled temperature
public virtual string TempControl { get; set; } /// Water temperature controller, null or empty = Do not control water temp
public virtual float PumpPower { get; set; } /// Power of the pump in [%] in the range 0 .. 100.0f, use values 0% and 100% for non-FM pumps
public virtual float PumpPower { get; set; } /// Power of the pump in [%] in the range 0 .. 100.0f, use values 0% and 100% for non-FM pumps
public virtual int MassRepeats { get; set; } /// Number of mass. measurements at the beginning/end of test, 0 = default (=5)
public virtual float MassSpread { get; set; } /// Max spread of mass. measurements at the beginning/end of test, 0 = default
public virtual MassMethod MassMethod { get; set; } /// method of mass. measurement at the beginning/end of test: false=slow (precise), true=using immediate mass measurement and evaluation
@@ -57,14 +57,7 @@ namespace Config.Entities
public virtual string TransBefore { get; set; }
public virtual string TransBetween { get; set; }
public virtual string TransAfter { get; set; }
#if ORACLE_DB
public virtual int OraId { get; set; }
public virtual int OraIdRepetMulti { get; set; }
public virtual string OraDesignation { get; set; }
public virtual int RawDataId { get; set; }
public virtual int RawDataIdRepetMulti { get; set; }
public virtual string RawDataDesignation { get; set; }
#endif
public virtual bool IsOuterLoopStart { get; set; } /// Not mapped to database
public virtual bool IsOuterLoopEnd { get; set; } /// Not mapped to database
@@ -98,36 +91,28 @@ namespace Config.Entities
Profile = TestProfile.UserDefined;
Publish = (sbyte)Common.Publish.Always;
DoEvaluate = true;
ErrLimLo = -2.0f; /// [%] lower error limit
ErrLimHi = 2.0f; /// [%] upper error limit
Uncertainty = 0;
Repeats = 1;
Repeats = 1;
DoDraining = false;
DoDrainingAfter = false;
DoControlWaterTemp = false;
TempLimLo = 15.0f;
TempLimHi = 25.0f;
TempControl = string.Empty;
ErrLimLo = -2.0f; /// [%] lower error limit
ErrLimHi = 2.0f; /// [%] upper error limit
Uncertainty = 0;
PumpPower = 60.0f; /// [%]
MassRepeats = 0; /// default
MassSpread = 0; /// default
MassMethod = MassMethod.Scale; /// default
MassMethod = MassMethod.Scale; /// default
TimeBeforeFlow = 10; /// [s] time before the start of flow control in [s]
TimeFlow2Mass = 5; /// [s] time from the flow stable to the 1st mass measurement in [s]
TimePump2StartV = 1; /// [s] time from the 1st mass measurement to the test start in [s]
TimeStop2Mass = 5; /// [s] between the test end and the final mass measurement
ShortPulses = 0; /// Short pulses parameter (0 or 1)
TransBefore = string.Empty;
ShortPulses = 0; /// = Filter parameter
TransBefore = string.Empty;
TransBetween = string.Empty;
TransAfter = string.Empty;
#if ORACLE_DB
OraId = 0;
OraIdRepetMulti = 0;
OraDesignation = string.Empty;
RawDataId = 0;
RawDataIdRepetMulti = 0;
RawDataDesignation = string.Empty;
#endif
}
}
public Test(string name, int itemNr, Procedure procedure)
: this()
@@ -184,10 +169,10 @@ namespace Config.Entities
result.Repeats = Repeats;
result.DoDraining = DoDraining;
result.DoDrainingAfter = DoDrainingAfter;
result.DoControlWaterTemp = DoControlWaterTemp;
result.TempLimLo = TempLimLo;
result.TempLimHi = TempLimHi;
result.TempControl = TempControl;
result.PumpPower = PumpPower;
result.PumpPower = PumpPower;
result.MassRepeats = MassRepeats;
result.MassSpread = MassSpread;
result.MassMethod = MassMethod;
@@ -207,14 +192,6 @@ namespace Config.Entities
result.TransBefore = TransBefore;
result.TransBetween = TransBetween;
result.TransAfter = TransAfter;
#if ORACLE_DB
result.OraId = OraId;
result.OraIdRepetMulti = OraIdRepetMulti;
result.OraDesignation = OraDesignation;
result.RawDataId = RawDataId;
result.RawDataIdRepetMulti = RawDataIdRepetMulti;
result.RawDataDesignation = RawDataDesignation;
#endif
result.VolumeUnit = VolumeUnit;
result.FlowUnit = FlowUnit;
result.MassUnit = MassUnit;
@@ -246,10 +223,10 @@ namespace Config.Entities
output.WriteLine(Repeats.ToString(ci));
output.WriteLine(DoDraining.ToString());
output.WriteLine(DoDrainingAfter.ToString());
output.WriteLine(DoControlWaterTemp.ToString());
output.WriteLine(TempLimLo.ToString(ci));
output.WriteLine(TempLimHi.ToString(ci));
output.WriteLine((TempControl != null) ? TempControl : string.Empty);
output.WriteLine(PumpPower.ToString(ci));
output.WriteLine(PumpPower.ToString(ci));
output.WriteLine(MassRepeats.ToString(ci));
output.WriteLine(MassSpread.ToString(ci));
output.WriteLine(((byte)MassMethod).ToString(ci));
@@ -265,14 +242,7 @@ namespace Config.Entities
output.WriteLine(TransBetween);
output.WriteLine(Profile);
output.WriteLine(TransAfter);
#if ORACLE_DB
output.WriteLine(OraId);
output.WriteLine(OraIdRepetMulti);
output.WriteLine(OraDesignation);
output.WriteLine(RawDataId);
output.WriteLine(RawDataIdRepetMulti);
output.WriteLine(RawDataDesignation);
#endif
foreach (var prms in MoreParams) { prms.Export(output); }
output.WriteLine();
}
@@ -304,10 +274,10 @@ namespace Config.Entities
tst.Repeats = int.Parse(input.ReadLine(), ci);
tst.DoDraining = bool.Parse(input.ReadLine());
tst.DoDrainingAfter = bool.Parse(input.ReadLine());
tst.DoControlWaterTemp = bool.Parse(input.ReadLine());
tst.TempLimLo = float.Parse(input.ReadLine(), ci);
tst.TempLimHi = float.Parse(input.ReadLine(), ci);
tst.TempControl = input.ReadLine();
tst.PumpPower = float.Parse(input.ReadLine(), ci);
tst.PumpPower = float.Parse(input.ReadLine(), ci);
tst.MassRepeats = int.Parse(input.ReadLine(), ci);
tst.MassSpread = float.Parse(input.ReadLine(), ci);
tst.MassMethod = (MassMethod)byte.Parse(input.ReadLine(), ci);
@@ -326,14 +296,6 @@ namespace Config.Entities
: line.Equals(TestProfile.UserDefinedHeatMeter.ToString()) ? TestProfile.UserDefinedHeatMeter
: line.Equals(TestProfile.Protected.ToString()) ? TestProfile.Protected : TestProfile.UserDefined; /// UserDefined is the default
tst.TransAfter = input.ReadLine();
#if ORACLE_DB
tst.OraId = int.Parse(input.ReadLine(), ci);
tst.OraIdRepetMulti = int.Parse(input.ReadLine(), ci);
tst.OraDesignation = input.ReadLine();
tst.RawDataId = int.Parse(input.ReadLine(), ci);
tst.RawDataIdRepetMulti = int.Parse(input.ReadLine(), ci);
tst.RawDataDesignation = input.ReadLine();
#endif
while (true)
{
@@ -374,9 +336,9 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != Repeats.ToString(ci)) { diff.AppendFormat(fmt, "Repeats", Repeats.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoDraining.ToString(ci)) { diff.AppendFormat(fmt, "Draining", DoDraining.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoDrainingAfter.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoDrainingAfter.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoControlWaterTemp.ToString()) { diff.AppendFormat(fmt, "DoControlWaterTemp", DoControlWaterTemp.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempControl) { diff.AppendFormat(fmt, "TempController", TempControl, ln); };
ln = inp.ReadLine(); if (ln != PumpPower.ToString(ci)) { diff.AppendFormat(fmt, "PumpPower", PumpPower.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != MassRepeats.ToString(ci)) { diff.AppendFormat(fmt, "MassRepeats", MassRepeats.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != MassSpread.ToString(ci)) { diff.AppendFormat(fmt, "MassSpread", MassSpread.ToString(ci), ln); };
@@ -393,14 +355,7 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != TransBetween) { diff.AppendFormat(fmt, "RelTransBetween", TransBetween, ln); };
ln = inp.ReadLine(); if (ln != Profile.ToString()) { diff.AppendFormat(fmt, "RelTransAfter", Profile, ln); };
ln = inp.ReadLine(); if (ln != TransAfter) { diff.AppendFormat(fmt, "TransitionAfter", TransAfter, ln); };
#if ORACLE_DB
ln = inp.ReadLine(); if (ln != OraId.ToString(ci)) { diff.AppendFormat(fmt, "OraId", OraId.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != OraIdRepetMulti.ToString(ci)) { diff.AppendFormat(fmt, "OraIdRepetMulti", OraIdRepetMulti.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != OraDesignation) { diff.AppendFormat(fmt, "OraDesignation", OraDesignation, ln); };
ln = inp.ReadLine(); if (ln != RawDataId.ToString(ci)) { diff.AppendFormat(fmt, "RawDataId", RawDataId.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != RawDataIdRepetMulti.ToString(ci)){ diff.AppendFormat(fmt, "RawDataIdRepetMulti", RawDataIdRepetMulti.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != RawDataDesignation) { diff.AppendFormat(fmt, "RawDataDesignation", RawDataDesignation, ln); };
#endif
return diff.ToString();
}
+2 -2
View File
@@ -1,11 +1,11 @@
///
/// Copyright (c) 2019-2021 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
namespace Config.Entities
{
public class Uncertainty : Common.IUncertainty
public class Uncertainty
{
public virtual int Id { get; protected set; }
public virtual float Measurement { get; set; }
+4 -4
View File
@@ -27,11 +27,11 @@ namespace Config
switch (dbType)
{
default:
case Common.DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
break;
case Common.DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
break;
case Common.DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
break;
}
@@ -127,7 +127,7 @@ namespace Config
case Common.GID.Administrators:
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
case Common.GID.TraceabilityManagement:
#elif KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_50 || WARSAW_END
#elif KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_END
case Common.GID.MetrologicalAuthority:
case Common.GID.WaterMeterAuthority:
#endif
+6 -7
View File
@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using log4net;
using Common;
namespace Config
{
@@ -183,7 +182,7 @@ namespace Config
double theta = temp / 100.0;
double B = x0 * (((x3 * theta + x2) * theta + x1) * theta + 1) / (1 + x4 * theta);
return WaterDensityFromTemp(temp) * (1 + B * Units.ConvertTo(Unit.Pa, pressure));
return WaterDensityFromTemp(temp) * (1 + B * Config.Units.ConvertTo(Config.Unit.Pa, pressure));
}
@@ -239,7 +238,7 @@ namespace Config
/// <param name="rawMeasurement">Raw uncorrected value</param>
/// <param name="corrections">Sorted (value, correction) pairs</param>
/// <returns>Corrected value</returns>
public static double CorrectedValue(double rawValue, IList<IMeasurementCorrection> corrections)
public static double CorrectedValue(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections)
{
return rawValue + GetCorrection(rawValue, corrections);
}
@@ -251,7 +250,7 @@ namespace Config
/// <param name="rawMeasurement">Raw uncorrected value</param>
/// <param name="corrections">Sorted (value, correction) pairs</param>
/// <returns>Corrected value</returns>
public static double GetCorrection(double rawValue, IList<IMeasurementCorrection> corrections)
public static double GetCorrection(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections)
{
if ((corrections == null) || (corrections.Count == 0)) return 0; /// No correction
@@ -317,11 +316,11 @@ namespace Config
const double p_star_Pa = 16.53E6; /// [Pa] (=16.53 MPa)
const double T_star = 1386.0; /// [K]
double T_in_K = Units.ConvertTo(Unit.K, T_in);
double T_out_K = Units.ConvertTo(Unit.K, T_out);
double T_in_K = Config.Units.ConvertTo(Config.Unit.K, T_in);
double T_out_K = Config.Units.ConvertTo(Config.Unit.K, T_out);
double tau_in = T_star / T_in_K;
double tau_out = T_star / T_out_K;
double pi = Units.ConvertTo(Unit.Pa, pressure) / p_star_Pa;
double pi = Config.Units.ConvertTo(Config.Unit.Pa, pressure) / p_star_Pa;
double h_in = tau_in * GammaTau(pi, tau_in) * R * T_in_K;
double h_out = tau_out * GammaTau(pi, tau_out) * R * T_out_K;
+2 -3
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using Config.Entities;
@@ -15,8 +15,7 @@ namespace Config.Mappings
Map(x => x.Name);
Map(x => x.Qfrom);
Map(x => x.Qto);
Map(x => x.Selector);
Map(x => x.TempMtrUp).Column("TempIn");
Map(x => x.TempMtrUp).Column("TempIn");
Map(x => x.TempMtrDown).Column("TempOut");
Map(x => x.PressMtrUp).Column("PressIn");
Map(x => x.PressMtrDown).Column("PressOut");
+2 -3
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using Config.Entities;
@@ -15,8 +15,7 @@ namespace Config.Mappings
Map(x => x.Name);
Map(x => x.Qfrom);
Map(x => x.Qto);
Map(x => x.Selector);
Map(x => x.Pump);
Map(x => x.Pump);
Map(x => x.RegulValvesPct);
Map(x => x.ValvesOpen)
.CustomType("StringClob")
+2 -3
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Config.Entities;
@@ -15,8 +15,7 @@ namespace Config.Mappings
Map(x => x.Name);
Map(x => x.Qfrom);
Map(x => x.Qto);
Map(x => x.Selector);
Map(x => x.RegulValve);
Map(x => x.RegulValve);
Map(x => x.FlowMeter);
Map(x => x.PidCoef);
Map(x => x.StartValve);
-1
View File
@@ -24,7 +24,6 @@ namespace Config.Mappings
Map(x => x.PressLimHi);
Map(x => x.Publish);
Map(x => x.Evaluate);
Map(x => x.Method);
Map(x => x.E1);
Map(x => x.E2);
Map(x => x.E3);
+3 -11
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using Config.Entities;
@@ -29,10 +29,10 @@ namespace Config.Mappings
.Column("Emptying");
Map(x => x.DoDrainingAfter)
.Column("Zeroing");
Map(x => x.DoControlWaterTemp);
Map(x => x.TempLimLo);
Map(x => x.TempLimHi);
Map(x => x.TempControl);
Map(x => x.PumpPower);
Map(x => x.PumpPower);
Map(x => x.MassRepeats);
Map(x => x.MassSpread);
Map(x => x.MassMethod)
@@ -62,14 +62,6 @@ namespace Config.Mappings
.Column("RelTransBetween");
Map(x => x.TransAfter)
.Column("TransitionAfter");
#if ORACLE_DB
Map(x => x.OraId);
Map(x => x.OraIdRepetMulti);
Map(x => x.OraDesignation);
Map(x => x.RawDataId);
Map(x => x.RawDataIdRepetMulti);
Map(x => x.RawDataDesignation);
#endif
HasMany(x => x.MoreParams)
.Cascade.All();
+3 -3
View File
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sensus")]
[assembly: AssemblyProduct("Config")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2022 Sensus Slovensko a.s.")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2018 Sensus Slovensko a.s.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.31.1990.0")]
[assembly: AssemblyFileVersion("2.31.1990.0")]
[assembly: AssemblyVersion("2.26.1519.0")]
[assembly: AssemblyFileVersion("2.26.1519.0")]
+19 -16
View File
@@ -2,8 +2,11 @@
/// Copyright (c) 2016-2021 Sensus Slovensko a.s.
///
using System;
using System.Reflection;
using Common;
using Config.Entities;
namespace Common
namespace Config
{
public enum Unit
{
@@ -357,21 +360,21 @@ namespace Common
}
}
public static bool IsVolume(Unit unit) { return IsQuantity(unit, Quantity.Volume); }
public static bool IsFlow(Unit unit) { return IsQuantity(unit, Quantity.Flow); }
public static bool IsMass(Unit unit) { return IsQuantity(unit, Quantity.Mass); }
public static bool IsTime(Unit unit) { return IsQuantity(unit, Quantity.Time); }
public static bool IsTemperature(Unit unit) { return IsQuantity(unit, Quantity.Temperature); }
public static bool IsPressure(Unit unit) { return IsQuantity(unit, Quantity.Pressure); }
public static bool IsHumidity(Unit unit) { return IsQuantity(unit, Quantity.Humidity); }
public static bool IsError(Unit unit) { return IsQuantity(unit, Quantity.Error); }
public static bool IsLength(Unit unit) { return IsQuantity(unit, Quantity.Length); }
public static bool IsDensity(Unit unit) { return IsQuantity(unit, Quantity.Density); }
public static bool IsEnergy(Unit unit) { return IsQuantity(unit, Quantity.Energy); }
public static bool IsPulses(Unit unit) { return IsQuantity(unit, Quantity.Pulses); }
public static bool IsPulsePerLtr(Unit unit) { return IsQuantity(unit, Quantity.PulsePerLtr); }
public static bool IsPulsePerKWh(Unit unit) { return IsQuantity(unit, Quantity.PulsePerKWh); }
public static bool IsConductivity(Unit unit) { return IsQuantity(unit, Quantity.Conductivity); }
public static bool IsVolume(Unit unit) { return IsQuantity(unit, Config.Quantity.Volume); }
public static bool IsFlow(Unit unit) { return IsQuantity(unit, Config.Quantity.Flow); }
public static bool IsMass(Unit unit) { return IsQuantity(unit, Config.Quantity.Mass); }
public static bool IsTime(Unit unit) { return IsQuantity(unit, Config.Quantity.Time); }
public static bool IsTemperature(Unit unit) { return IsQuantity(unit, Config.Quantity.Temperature); }
public static bool IsPressure(Unit unit) { return IsQuantity(unit, Config.Quantity.Pressure); }
public static bool IsHumidity(Unit unit) { return IsQuantity(unit, Config.Quantity.Humidity); }
public static bool IsError(Unit unit) { return IsQuantity(unit, Config.Quantity.Error); }
public static bool IsLength(Unit unit) { return IsQuantity(unit, Config.Quantity.Length); }
public static bool IsDensity(Unit unit) { return IsQuantity(unit, Config.Quantity.Density); }
public static bool IsEnergy(Unit unit) { return IsQuantity(unit, Config.Quantity.Energy); }
public static bool IsPulses(Unit unit) { return IsQuantity(unit, Config.Quantity.Pulses); }
public static bool IsPulsePerLtr(Unit unit) { return IsQuantity(unit, Config.Quantity.PulsePerLtr); }
public static bool IsPulsePerKWh(Unit unit) { return IsQuantity(unit, Config.Quantity.PulsePerKWh); }
public static bool IsConductivity(Unit unit) { return IsQuantity(unit, Config.Quantity.Conductivity); }
+190 -1
View File
@@ -1,15 +1,90 @@
///
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common;
namespace Config
{
public static class Utils
{
public static string SignificantDigitsToFmt(double value, int sigDigits)
{
if (sigDigits == 6)
{
if (value >= 99999.5 || value < -99999.5) return "F0";
else if (value >= 9999.95 || value < -9999.95) return "F1";
else if (value >= 999.995 || value < -999.995) return "F2";
else if (value >= 99.9995 || value < -99.9995) return "F3";
else if (value >= 9.99995 || value < -9.99995) return "F4";
else if (value >= 0.999995 || value < -0.999995) return "F5";
else if (value >= 0.0999995 || value < -0.0999995) return "F6";
else if (value >= 0.00999995 || value < -0.00999995) return "F7";
else if (value >= 0.000999995 || value < -0.000999995) return "F8";
else if (value >= 0.0000999995 || value < -0.0000999995) return "F9";
else return "F10";
}
else if (sigDigits == 5)
{
if (value >= 9999.5 || value < -9999.5) return "F0";
else if (value >= 999.95 || value < -999.95) return "F1";
else if (value >= 99.995 || value < -99.995) return "F2";
else if (value >= 9.9995 || value < -9.9995) return "F3";
else if (value >= 0.99995 || value < -0.99995) return "F4";
else if (value >= 0.099995 || value < -0.099995) return "F5";
else if (value >= 0.0099995 || value < -0.0099995) return "F6";
else if (value >= 0.00099995 || value < -0.00099995) return "F7";
else if (value >= 0.000099995 || value < -0.000099995) return "F8";
else return "F9";
}
else if (sigDigits == 4)
{
if (value >= 999.5 || value < -999.5) return "F0";
else if (value >= 99.95 || value < -99.95) return "F1";
else if (value >= 9.995 || value < -9.995) return "F2";
else if (value >= 0.9995 || value < -0.9995) return "F3";
else if (value >= 0.09995 || value < -0.09995) return "F4";
else if (value >= 0.009995 || value < -0.009995) return "F5";
else if (value >= 0.0009995 || value < -0.0009995) return "F6";
else if (value >= 0.00009995 || value < -0.00009995) return "F7";
else return "F8";
}
else if (sigDigits == 3)
{
if (value >= 99.5 || value < -99.5) return "F0";
else if (value >= 9.95 || value < -9.95) return "F1";
else if (value >= 0.995 || value < -0.995) return "F2";
else if (value >= 0.0995 || value < -0.0995) return "F3";
else if (value >= 0.00995 || value < -0.00995) return "F4";
else if (value >= 0.000995 || value < -0.000995) return "F5";
else if (value >= 0.0000995 || value < -0.0000995) return "F6";
else return "F7";
}
else if (sigDigits == 2)
{
if (value >= 9.5 || value < -9.5) return "F0";
else if (value >= 0.95 || value < -0.95) return "F1";
else if (value >= 0.095 || value < -0.095) return "F2";
else if (value >= 0.0095 || value < -0.0095) return "F3";
else if (value >= 0.00095 || value < -0.00095) return "F4";
else if (value >= 0.000095 || value < -0.000095) return "F5";
else return "F6";
}
else /// if (sigDigits == 1)
{
if (value >= 0.95 || value < -0.95) return "F0";
else if (value >= 0.095 || value < -0.095) return "F1";
else if (value >= 0.0095 || value < -0.0095) return "F2";
else if (value >= 0.00095 || value < -0.00095) return "F3";
else if (value >= 0.000095 || value < -0.000095) return "F4";
else return "F5";
}
}
/// <summary>
/// Extract and return a DB server from a MySQL connection string.
/// </summary>
@@ -64,5 +139,119 @@ namespace Config
/// pattern NOT found
return string.Empty;
}
/// <summary>
/// Get either Q1 or Qmin flow for a given Qn and metrological class
/// </summary>
/// <param name="Qn">Nominal flow in m3/h</param>
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q1 or Qmin flow in m3/h</returns>
public static double GetQ1Qmin(double Qn, string metroClass, Medium medium = Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
int metroClassRatio;
if ((metroClass[0] == 'R') && int.TryParse(metroClass.Substring(1), out metroClassRatio) && (metroClassRatio > 0))
{
return Qn / (double)metroClassRatio;
}
else
{
if (medium == Medium.HotWater)
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.04 * Qn) : (0.08 * Qn);
case "B": return (Qn < 15) ? (0.02 * Qn) : (0.04 * Qn);
case "C": return (Qn < 15) ? (0.01 * Qn) : (0.02 * Qn);
case "D": return (Qn < 15) ? (0.01 * Qn) : Qdflt;
default: break;
}
}
else
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.04 * Qn) : (0.08 * Qn);
case "B": return (Qn < 15) ? (0.02 * Qn) : (0.03 * Qn);
case "C": return (Qn < 15) ? (0.01 * Qn) : (0.006 * Qn);
default: break;
}
}
}
return Qdflt;
}
/// <summary>
/// Get either Q2 or Qt flow for a given Qn and metrological class
/// </summary>
/// <param name="Qn">Nominal flow in m3/h</param>
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q2 or Qt flow in m3/h</returns>
public static double GetQ2Qt(double Qn, string metroClass, Medium medium = Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
int metroClassRatio;
if ((metroClass[0] == 'R') && int.TryParse(metroClass.Substring(1), out metroClassRatio) && (metroClassRatio > 0))
{
return 1.6 * Qn / (double)metroClassRatio;
}
if (medium == Medium.HotWater)
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.1 * Qn) : (0.2 * Qn);
case "B": return (Qn < 15) ? (0.08 * Qn) : (0.15 * Qn);
case "C": return (Qn < 15) ? (0.06 * Qn) : (0.1 * Qn);
case "D": return (Qn < 15) ? (0.015 * Qn) : Qdflt;
default: break;
}
}
else
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.1 * Qn) : (0.3 * Qn);
case "B": return (Qn < 15) ? (0.08 * Qn) : (0.2 * Qn);
case "C": return (Qn < 15) ? (0.015 * Qn) : (0.015 * Qn);
default: break;
}
}
return Qdflt;
}
/// <summary>
/// Get either Q4 or Qmax flow for a given Qn and metrological class
/// </summary>
/// <param name="Qn">Nominal flow in m3/h</param>
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q4 or Qmax flow in m3/h</returns>
public static double GetQ4Qmax(double Qn, string metroClass, Medium medium = Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
switch (metroClass[0])
{
case 'A':
case 'B':
case 'C':
case 'D':
return 2 * Qn;
case 'R':
return 1.25 * Qn;
default:
return Qdflt;
}
}
}
}
+13 -13
View File
@@ -422,7 +422,7 @@ namespace DeviceTest
{
parentCfg = parentFactory.DefaultConfig();
}
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
cfgForm.CmpntEntities = new List<Config.Entities.Component>();
IComponentCfgCtrl cfgControl = parentCfg.GetControl(cfgForm.CmpntEntities);
@@ -451,7 +451,7 @@ namespace DeviceTest
{
component1Cfg = component1Factory.DefaultConfig();
}
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
///
var compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -485,7 +485,7 @@ namespace DeviceTest
{
component2Cfg = component2Factory.DefaultConfig();
}
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
///
var compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -520,7 +520,7 @@ namespace DeviceTest
{
component3Cfg = component3Factory.DefaultConfig();
}
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
///
var compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -677,10 +677,10 @@ namespace DeviceTest
{
operation1 = (tbfComponent1forOp as TBF.Rig.Network.Camera.Roi.Roi).RoiDetectionOp();
}
else if (tbfComponent1forOp is TBF.Rig.Modbus.TempControl.Easytherm.Easytherm)
else if (tbfComponent1forOp is TBF.Rig.Modbus.Easytherm.Easytherm)
{
operation1 = (tbfComponent1forOp as TBF.Rig.Modbus.TempControl.Easytherm.Easytherm).SetTemperatureOp(10);
operation2 = (tbfComponent1forOp as TBF.Rig.Modbus.TempControl.Easytherm.Easytherm).SetTemperatureOp(20);
operation1 = (tbfComponent1forOp as TBF.Rig.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation2 = (tbfComponent1forOp as TBF.Rig.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
}
else if (tbfComponent1forOp is TBF.Rig.Modbus.UltrasoundLevelMeter.LevelMeter)
{
@@ -716,10 +716,10 @@ namespace DeviceTest
{
operation21 = (tbfComponent2forOp as TBF.Rig.Network.Camera.Roi.Roi).RoiDetectionOp();
}
else if (tbfComponent2forOp is TBF.Rig.Modbus.TempControl.Easytherm.Easytherm)
else if (tbfComponent2forOp is TBF.Rig.Modbus.Easytherm.Easytherm)
{
operation21 = (tbfComponent2forOp as TBF.Rig.Modbus.TempControl.Easytherm.Easytherm).SetTemperatureOp(10);
operation22 = (tbfComponent2forOp as TBF.Rig.Modbus.TempControl.Easytherm.Easytherm).SetTemperatureOp(20);
operation21 = (tbfComponent2forOp as TBF.Rig.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation22 = (tbfComponent2forOp as TBF.Rig.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
}
else if (tbfComponent2forOp is TBF.Rig.Modbus.UltrasoundLevelMeter.LevelMeter)
{
@@ -755,10 +755,10 @@ namespace DeviceTest
{
operation31 = (tbfComponent3forOp as TBF.Rig.Network.Camera.Roi.Roi).RoiDetectionOp();
}
else if (tbfComponent3forOp is TBF.Rig.Modbus.TempControl.Easytherm.Easytherm)
else if (tbfComponent3forOp is TBF.Rig.Modbus.Easytherm.Easytherm)
{
operation31 = (tbfComponent3forOp as TBF.Rig.Modbus.TempControl.Easytherm.Easytherm).SetTemperatureOp(10);
operation32 = (tbfComponent3forOp as TBF.Rig.Modbus.TempControl.Easytherm.Easytherm).SetTemperatureOp(20);
operation31 = (tbfComponent3forOp as TBF.Rig.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation32 = (tbfComponent3forOp as TBF.Rig.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
}
else if (tbfComponent3forOp is TBF.Rig.Modbus.UltrasoundLevelMeter.LevelMeter)
{
+2 -2
View File
@@ -35,7 +35,7 @@
this.unreadEventsRadioButton = new System.Windows.Forms.RadioButton();
this.allEventsRadioButton = new System.Windows.Forms.RadioButton();
this.settingsButton = new System.Windows.Forms.Button();
this.eventsListView = new Common.Forms.ListViewEx();
this.eventsListView = new Common.UIControls.ListViewEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -176,7 +176,7 @@
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Button settingsButton;
private Common.Forms.ListViewEx eventsListView;
private Common.UIControls.ListViewEx eventsListView;
private System.Windows.Forms.GroupBox eventsSelectionGroupBox;
private System.Windows.Forms.RadioButton unreadEventsRadioButton;
private System.Windows.Forms.RadioButton allEventsRadioButton;
+5 -5
View File
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Windows.Forms;
using NHibernate;
using Common;
using Common.Forms;
using Common.UIControls;
using Events;
using Events.Entities;
using EventViewer.Resources;
@@ -33,7 +33,7 @@ namespace EventViewer
ISession session;
IList<Subscriber> subscribers;
IList<Event> events;
MySortOrder sortOrder = MySortOrder.Ascending;
SortOrder sortOrder = SortOrder.Ascending;
int sortColumn = -1; /// 0-based index of column to be used for sorting
EViewerOption eViewerOption;
@@ -222,13 +222,13 @@ namespace EventViewer
{
if (e.Column == sortColumn)
{
sortOrder = (sortOrder == MySortOrder.Ascending) ? MySortOrder.Descending : MySortOrder.Ascending;
sortOrder = (sortOrder == SortOrder.Ascending) ? SortOrder.Descending : SortOrder.Ascending;
}
else
{
/// Clicked on another column header => set sortOrder to SortOrder.Ascending
sortColumn = e.Column;
sortOrder = MySortOrder.Ascending;
sortOrder = SortOrder.Ascending;
}
switch ((Column)sortColumn)
@@ -291,7 +291,7 @@ namespace EventViewer
{
try
{
Users.CurrentUser.RemoteUsersDB = new Common.DBSettings(Common.DBType.MySql, Program.LocalSettings.UsersDBConnString);
Users.GlobalData.RemoteUsersDB = new Users.DBSettings(Common.DBType.MySql, Program.LocalSettings.UsersDBConnString);
Users.Forms.LoginDlg dlg = new Users.Forms.LoginDlg();
if (dlg.ShowDialog() == DialogResult.OK)
{
+4 -4
View File
@@ -64,11 +64,11 @@ namespace Events
switch (dbType)
{
default:
case DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
break;
case DBType.SQLite:
case DBType.SQLite:
cfg = cfg.Database(SQLiteConfiguration.Standard.UsingFile(connectionString));
break;
case DBType.MySql:
cfg = cfg.Database(MySQLConfiguration.Standard.ConnectionString(connectionString));
break;
}
+3 -33
View File
@@ -55,42 +55,12 @@ namespace FeatureVectorCalculator
// cl.ToPosition = Math.Log10(xs[j] / spacer);
// chArea.AxisX.CustomLabels.Add(cl);
// }
chArea.AxisY.Title = captionY;
chArea.AxisY.IsLogarithmic = false;
chArea.AxisY.IsLabelAutoFit = true;
if (!fromZero)
{
/// fromZero = false
chArea.AxisY.IsStartedFromZero = false;
float diff = maxY - minY;
chArea.AxisY.Minimum = minY - 0.05 * diff;
chArea.AxisY.Maximum = maxY + 0.05 * diff;
}
else if (minY >= 0)
{
/// fromZero = true, All points are above zero
chArea.AxisY.IsStartedFromZero = true;
chArea.AxisY.Minimum = 0;
chArea.AxisY.Maximum = 1.05 * maxY;
}
else if (maxY <= 0)
{
/// fromZero = true, All points are below zero
chArea.AxisY.IsStartedFromZero = true;
chArea.AxisY.Minimum = 1.05 * minY;
chArea.AxisY.Maximum = 0;
}
else
{
/// Points are both below and above zero
chArea.AxisY.IsStartedFromZero = false;
float diff = maxY - minY;
chArea.AxisY.Minimum = minY - 0.05 * diff;
chArea.AxisY.Maximum = maxY + 0.05 * diff;
}
chArea.AxisY.IsStartedFromZero = fromZero;
chArea.AxisY.Minimum = chArea.AxisY.IsStartedFromZero ? 0 : minY;
chArea.AxisY.Maximum = 1.1 * maxY;
if (chArea.AxisY.Maximum == chArea.AxisY.Minimum)
{
chArea.AxisY.Maximum = chArea.AxisY.Maximum + 1;
+1 -3
View File
@@ -35,7 +35,7 @@
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<OldToolsVersion>2.0</OldToolsVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
@@ -76,7 +76,6 @@
<WarningLevel>4</WarningLevel>
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
@@ -100,7 +99,6 @@
<WarningLevel>4</WarningLevel>
<DebugType>none</DebugType>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
+3 -3
View File
@@ -48,9 +48,9 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
<Name>Common</Name>
<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>
-1
View File
@@ -105,7 +105,6 @@ namespace Results
foreach (var ti in procedure.GetTestInstances())
{
TestData td = TestData.UpdateList(d.TestDataList, new TestData(ti.Test));
if (!d.Batch.Tests.Contains(td)) d.Batch.Tests.Add(td);
/// Create an empty test result and add it to the list
TestRslt tr = new TestRslt(d.Batch, td, ti.Test.Part, ti.Repetition);
+17 -24
View File
@@ -39,7 +39,6 @@ namespace Results.Entities
public virtual int Counter10 { get; set; }
public virtual DateTime StartTime { get; set; }
public virtual DateTime EndTime { get; set; }
public virtual DateTime SaveTime { get; set; }
public virtual bool Dirty { get; set; }
public virtual bool RsltsSent { get; set; }
public virtual bool RsltsPrinted { get; set; }
@@ -158,7 +157,6 @@ namespace Results.Entities
Counter10 = oriBatch.Counter10;
StartTime = oriBatch.StartTime;
EndTime = oriBatch.EndTime;
SaveTime = oriBatch.SaveTime;
Dirty = oriBatch.Dirty;
RsltsSent = oriBatch.RsltsSent;
RsltsPrinted = oriBatch.RsltsPrinted;
@@ -209,7 +207,7 @@ namespace Results.Entities
foreach (var tr in TestRslts)
{
if (tr.TestDone && tr.AmbTempMean != 0)
if (tr.TestDone)
{
double duration = (tr.EndTime - tr.StartTime).TotalSeconds;
timeSum += duration;
@@ -227,7 +225,7 @@ namespace Results.Entities
foreach (var tr in TestRslts)
{
if (tr.TestDone && tr.AmbPressMean != 0)
if (tr.TestDone)
{
double duration = (tr.EndTime - tr.StartTime).TotalSeconds;
timeSum += duration;
@@ -245,7 +243,7 @@ namespace Results.Entities
foreach (var tr in TestRslts)
{
if (tr.TestDone && tr.AmbHumiMean != 0)
if (tr.TestDone)
{
double duration = (tr.EndTime - tr.StartTime).TotalSeconds;
timeSum += duration;
@@ -260,7 +258,7 @@ namespace Results.Entities
{
for (int i = 0; i < TestRslts.Count; i++)
{
if (TestRslts[i].Publish() == Common.Publish.Always && TestRslts[i].AmbTempStart != 0)
if (TestRslts[i].Publish() == Publish.Always)
return TestRslts[i].AmbTempStart;
}
return 0;
@@ -269,7 +267,7 @@ namespace Results.Entities
{
for (int i = 0; i < TestRslts.Count; i++)
{
if (TestRslts[i].Publish() == Common.Publish.Always && TestRslts[i].AmbPressStart != 0)
if (TestRslts[i].Publish() == Publish.Always)
return TestRslts[i].AmbPressStart;
}
return 0;
@@ -278,7 +276,7 @@ namespace Results.Entities
{
for (int i = 0; i < TestRslts.Count; i++)
{
if (TestRslts[i].Publish() == Common.Publish.Always && TestRslts[i].AmbHumiStart != 0)
if (TestRslts[i].Publish() == Publish.Always)
return TestRslts[i].AmbHumiStart;
}
return 0;
@@ -286,27 +284,27 @@ namespace Results.Entities
public virtual double AmbTempEnd()
{
for (int i = TestRslts.Count - 1; i >= 0; i--)
for (int i = TestRslts.Count - 1; i >= 0; i++)
{
if (TestRslts[i].Publish() == Common.Publish.Always && TestRslts[i].AmbTempEnd != 0)
if (TestRslts[i].Publish() == Publish.Always)
return TestRslts[i].AmbTempEnd;
}
return 0;
}
public virtual double AmbPressEnd()
{
for (int i = TestRslts.Count - 1; i >= 0; i--)
for (int i = TestRslts.Count - 1; i >= 0; i++)
{
if (TestRslts[i].Publish() == Common.Publish.Always && TestRslts[i].AmbPressEnd != 0)
if (TestRslts[i].Publish() == Publish.Always)
return TestRslts[i].AmbPressEnd;
}
return 0;
}
public virtual double AmbHumiEnd()
{
for (int i = TestRslts.Count - 1; i >= 0; i--)
for (int i = TestRslts.Count - 1; i >= 0; i++)
{
if (TestRslts[i].Publish() == Common.Publish.Always && TestRslts[i].AmbHumiEnd != 0)
if (TestRslts[i].Publish() == Publish.Always)
return TestRslts[i].AmbHumiEnd;
}
return 0;
@@ -323,19 +321,16 @@ namespace Results.Entities
public override string ToString()
{
return string.Format("Batch {0} ({1}s) Start {2}, End {3}, Proc={4}",
BatchNr, (EndTime - StartTime).TotalSeconds, StartTime, EndTime, ProcedureName);
return string.Format("Batch #{0}, Start:{1}, End:{2}, Procedure:{3}", BatchNr, StartTime, EndTime, ProcedureName);
}
public virtual string ToString(int i)
{
return string.Format("Batch {0} ({1}s) ver={2} TestBenchId={3} User={4}/{5} Proc={6}{7} Rev={8} Remark={9} RealDensity={10} AtTemperature={11} Buoyancy={12} StartTime={13} EndTime={14} SaveTime={15} RsltsSent={16} RsltsPrinted={17}",
BatchNr,
(EndTime - StartTime).TotalSeconds,
ProgramVersion, TestBenchId, UserName, UserNumber,
return string.Format("Batch: BatchNr={0} ProgramVersion={1} TestBenchId={2} UserName={3} UserNumber={4} ProcedureName={5}{6} ProcRev={7} ProtocolTitle={8} Remark={9} RealDensity={10} AtTemperature={11} Buoyancy={12} StartTime={13} EndTime={14} Dirty={15} RsltsSent={16} RsltsPrinted={17}",
BatchNr, ProgramVersion, TestBenchId, UserName, UserNumber,
ProcedureName, (IsRemoteProcedure ? "(R)" : ""), ProcedureRevision,
Remark, RealDensity, AtTemperature, Buoyancy,
StartTime, EndTime, SaveTime, RsltsSent, RsltsPrinted);
ProtocolTitle, Remark, RealDensity, AtTemperature, Buoyancy,
StartTime, EndTime, Dirty, RsltsSent, RsltsPrinted);
}
public virtual void WriteBinary(BinaryWriter writer)
@@ -369,7 +364,6 @@ namespace Results.Entities
writer.Write(Counter10);
writer.Write(StartTime.ToString());
writer.Write(EndTime.ToString());
writer.Write(SaveTime.ToString());
writer.Write(Dirty);
writer.Write(RsltsSent);
writer.Write(RsltsPrinted);
@@ -437,7 +431,6 @@ namespace Results.Entities
Counter10 = reader.ReadInt32();
StartTime = DateTime.Parse(reader.ReadString());
EndTime = DateTime.Parse(reader.ReadString());
SaveTime = DateTime.Parse(reader.ReadString());
Dirty = reader.ReadBoolean();
RsltsSent = reader.ReadBoolean();
RsltsPrinted = reader.ReadBoolean();
-7
View File
@@ -106,13 +106,6 @@ namespace Results.Entities
public virtual bool IsDataStream() { return (RegReaderType == (int)RegisterReaderType.DataStream); }
public virtual bool IsManual() { return (RegReaderType == (int)RegisterReaderType.Manual); }
public virtual string PassedOrErrorFlagsStr()
{
string eFlags = Utils.ErrorFlagsStr(ErrorIndicators);
var str = string.IsNullOrEmpty(eFlags) ? PassedColorStr(null) : eFlags;
return str;
}
public virtual string PassedColorStr(string yesNoFormatOrEmpty)
{
if (string.IsNullOrEmpty(yesNoFormatOrEmpty))
+47 -96
View File
@@ -1,11 +1,10 @@
///
/// Copyright (c) 2016-2022 Sensus Slovensko a.s.
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using Common;
using Config.Entities;
namespace Results.Entities
@@ -27,19 +26,12 @@ namespace Results.Entities
public virtual double ErrLimLo { get; set; } /// [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
public virtual double ErrLimHi { get; set; } /// [%] usually > 0, in case of heat meters: -Qn in m3/h
public virtual double ErrLimMargin { get; set; } /// [%] makes error limits tighter: 0 <= ErrLimMargin <= abs(ErrLimXx)
public virtual bool DoControlWaterTemp { get; set; }
public virtual float TempLimLo { get; set; }
public virtual float TempLimHi { get; set; }
public virtual string TempControl { get; set; }
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
public virtual bool Evaluate { get; set; }
#if ORACLE_DB
public virtual int OraId { get; set; }
public virtual int OraIdRepetMulti { get; set; }
public virtual string OraDesignation { get; set; }
public virtual int RawDataId { get; set; }
public virtual int RawDataIdRepetMulti { get; set; }
public virtual string RawDataDesignation { get; set; }
#endif
/// <summary>
/// Default constructor, safe values
@@ -53,61 +45,45 @@ namespace Results.Entities
public TestData(Test test)
: this()
{
Name = test.Name;
Repeats = test.Repeats;
Qtg = test.Qtg;
Qfrom = test.Qfrom;
Qto = test.Qto;
TargetVolume = test.Volume;
TargetTime = test.TestTime;
Method = test.Method;
ErrLimLo = test.ErrLimLo;
ErrLimHi = test.ErrLimHi;
ErrLimMargin = test.Uncertainty;
TempLimLo = test.TempLimLo;
TempLimHi = test.TempLimHi;
TempControl = test.TempControl;
Publish = test.Publish;
Evaluate = test.DoEvaluate;
#if ORACLE_DB
OraId = test.OraId;
OraIdRepetMulti = test.OraIdRepetMulti;
OraDesignation = test.OraDesignation;
RawDataId = test.RawDataId;
RawDataIdRepetMulti = test.RawDataIdRepetMulti;
RawDataDesignation = test.RawDataDesignation;
#endif
}
Name = test.Name;
Repeats = test.Repeats;
Qtg = (double)test.Qtg;
Qfrom = (double)test.Qfrom;
Qto = (double)test.Qto;
TargetVolume = (double)test.Volume;
TargetTime = (double)test.TestTime;
Method = test.Method;
ErrLimLo = (double)test.ErrLimLo;
ErrLimHi = (double)test.ErrLimHi;
ErrLimMargin = (double)test.Uncertainty;
DoControlWaterTemp = test.DoControlWaterTemp;
TempLimLo = test.TempLimLo;
TempLimHi = test.TempLimHi;
Publish = test.Publish;
Evaluate = test.DoEvaluate;
}
/// <summary>
/// Copy constructor, copies all except of Id
/// </summary>
public TestData(TestData oriTestData)
{
Name = oriTestData.Name;
Repeats = oriTestData.Repeats;
Qtg = oriTestData.Qtg;
Qfrom = oriTestData.Qfrom;
Qto = oriTestData.Qto;
TargetVolume = oriTestData.TargetVolume;
TargetTime = oriTestData.TargetTime;
Method = oriTestData.Method;
ErrLimLo = oriTestData.ErrLimLo;
ErrLimHi = oriTestData.ErrLimHi;
ErrLimMargin = oriTestData.ErrLimMargin;
TempLimLo = oriTestData.TempLimLo;
TempLimHi = oriTestData.TempLimHi;
TempControl = oriTestData.TempControl;
Publish = oriTestData.Publish;
Evaluate = oriTestData.Evaluate;
#if ORACLE_DB
OraId = oriTestData.OraId;
OraIdRepetMulti = oriTestData.OraIdRepetMulti;
OraDesignation = oriTestData.OraDesignation;
RawDataId = oriTestData.RawDataId;
RawDataIdRepetMulti = oriTestData.RawDataIdRepetMulti;
RawDataDesignation = oriTestData.RawDataDesignation;
#endif
Name = oriTestData.Name;
Repeats = oriTestData.Repeats;
Qtg = oriTestData.Qtg;
Qfrom = oriTestData.Qfrom;
Qto = oriTestData.Qto;
TargetVolume = oriTestData.TargetVolume;
TargetTime = oriTestData.TargetTime;
Method = oriTestData.Method;
ErrLimLo = oriTestData.ErrLimLo;
ErrLimHi = oriTestData.ErrLimHi;
ErrLimMargin = oriTestData.ErrLimMargin;
DoControlWaterTemp = oriTestData.DoControlWaterTemp;
TempLimLo = oriTestData.TempLimLo;
TempLimHi = oriTestData.TempLimHi;
Publish = oriTestData.Publish;
Evaluate = oriTestData.Evaluate;
}
@@ -129,19 +105,15 @@ namespace Results.Entities
if (ErrLimLo != td.ErrLimLo) return false;
if (ErrLimHi != td.ErrLimHi) return false;
if (ErrLimMargin != td.ErrLimMargin) return false;
if (TempLimLo != td.TempLimLo) return false;
if (TempLimHi != td.TempLimHi) return false;
if (TempControl != td.TempControl) return false;
if (Publish != td.Publish) return false;
if (DoControlWaterTemp != td.DoControlWaterTemp) return false;
if (DoControlWaterTemp)
{
if (TempLimLo != td.TempLimLo) return false;
if (TempLimHi != td.TempLimHi) return false;
}
if (Publish != td.Publish) return false;
if (Evaluate != td.Evaluate) return false;
#if ORACLE_DB
if (OraId != td.OraId) return false;
if (OraIdRepetMulti != td.OraIdRepetMulti) return false;
if (OraDesignation != td.OraDesignation) return false;
if (RawDataId != td.RawDataId) return false;
if (RawDataIdRepetMulti != td.RawDataIdRepetMulti) return false;
if (RawDataDesignation != td.RawDataDesignation) return false;
#endif
return true;
}
@@ -178,19 +150,11 @@ namespace Results.Entities
writer.Write(ErrLimLo);
writer.Write(ErrLimHi);
writer.Write(ErrLimMargin);
writer.Write(DoControlWaterTemp);
writer.Write(TempLimLo);
writer.Write(TempLimHi);
writer.Write((TempControl != null) ? TempControl : string.Empty);
writer.Write(Publish);
writer.Write(Evaluate);
#if ORACLE_DB
writer.Write(OraId);
writer.Write(OraIdRepetMulti);
writer.Write((OraDesignation != null) ? OraDesignation : string.Empty);
writer.Write(RawDataId);
writer.Write(RawDataIdRepetMulti);
writer.Write((RawDataDesignation != null) ? RawDataDesignation : string.Empty);
#endif
}
public virtual void ReadBinary(BinaryReader reader)
@@ -207,24 +171,11 @@ namespace Results.Entities
ErrLimLo = reader.ReadDouble();
ErrLimHi = reader.ReadDouble();
ErrLimMargin = reader.ReadDouble();
DoControlWaterTemp = reader.ReadBoolean();
TempLimLo = reader.ReadSingle();
TempLimHi = reader.ReadSingle();
TempControl = reader.ReadString();
Publish = reader.ReadSByte();
Evaluate = reader.ReadBoolean();
#if ORACLE_DB
OraId = reader.ReadInt32();
OraIdRepetMulti = reader.ReadInt32();
OraDesignation = reader.ReadString();
RawDataId = reader.ReadInt32();
RawDataIdRepetMulti = reader.ReadInt32();
RawDataDesignation = reader.ReadString();
#endif
}
public override string ToString()
{
return string.Format("{0} (P.{1},{2})", Name, ((Publish)Publish).ToString(), Evaluate ? "E" : "-");
}
}
}
+1 -11
View File
@@ -147,8 +147,7 @@ namespace Results.Entities
public virtual int Counter5 { get; set; }
/// Wrappers
public virtual string Name() { return Common.Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); }
public virtual string Key() { return string.Format("{0}~{1}~{2}~{3}", TestData.Name, Part, TestData.Repeats, RepetitionNr); } /// Unique key
public virtual string Name() { return Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); }
public virtual int Repeats() { return TestData.Repeats; }
public virtual double Qfrom() { return TestData.Qfrom; }
public virtual double Qto() { return TestData.Qto; }
@@ -165,15 +164,6 @@ namespace Results.Entities
public virtual bool IsDiverter() { return (MethodClass != null) ? ((MethodClass.Contains("FlyingStart") && MethodClass.Contains("MassColl")) || MethodClass.Contains("DiverterTest")) : true; }
public virtual bool IsVolumeMethod() { return (MethodClass != null) ? (MethodClass.Contains("TestMethods.FixedStart.") || MethodClass.Contains("TestMethods.FlyingStart.")) : false; }
#if ORACLE_DB
public virtual int OraId() { return TestData.OraId; }
public virtual int OraIdRepetMulti() { return TestData.OraIdRepetMulti; }
public virtual string OraDesignation() { return TestData.OraDesignation; }
public virtual int RawDataId() { return TestData.RawDataId; }
public virtual int RawDataIdRepetMulti() { return TestData.RawDataIdRepetMulti; }
public virtual string RawDataDesignation() { return TestData.RawDataDesignation; }
#endif
public virtual string MethodElde()
{
if (MethodClass == null) return string.Empty;
+48 -6
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2023 Sensus Slovensko a.s.
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -95,8 +95,10 @@ namespace Results.Entities
public virtual string CompleteSerialNr { get; set; }
public virtual string OriRadioAddress { get; set; } /// Original radio address of a 640 water meter (AlbatrosID)
public virtual int WMTypeRevision { get; set; }
public virtual int Pruefindex { get; set; } /// >=1 ... pruefindex, 0 ... unknown (no reading from DB yet)
public virtual int Pruefindex { get; set; } /// >= 1 ... pruefindex
public virtual int HydrPruefung { get; set; }
public virtual object RawTestInfos { get; set; } /// Not mapped to DB !!! IList<SensusTestInfo> fetched from Oracle at the beginning of the cycle, not mapped to DB !!!
public virtual object CompleteTestInfos { get; set; } /// Not mapped to DB !!! SensusTestInfo[] obtained as a best match at the beginning of the cycle, not mapped to DB !!!
#endif
public virtual int ProcessId { get; set; } /// Not mapped to DB !!! Tracing DB Process ID
public virtual int SessionId { get; set; } /// Not mapped to DB !!! 1 (regular tracing DB session) or 2 (alternative tracing DB session)
@@ -250,9 +252,7 @@ namespace Results.Entities
break;
}
}
#if ORACLE_DB
if (Utils.MaxTestIndex != 0 && (Pruefindex % 100) > Utils.MaxTestIndex) passed = false;
#endif
return passed;
}
@@ -444,8 +444,10 @@ namespace Results.Entities
CompleteSerialNr = string.Empty;
OriRadioAddress = string.Empty;
WMTypeRevision = 0;
Pruefindex = 0;
Pruefindex = 1;
HydrPruefung = 0;
RawTestInfos = null;
CompleteTestInfos = null;
#endif
ProcessId = 0;
SessionId = 0;
@@ -508,6 +510,8 @@ namespace Results.Entities
WMTypeRevision = src.WMTypeRevision;
Pruefindex = src.Pruefindex;
HydrPruefung = src.HydrPruefung;
RawTestInfos = src.RawTestInfos; /// Not mapped to DB
CompleteTestInfos = src.CompleteTestInfos; /// Not mapped to DB
#endif
ProcessId = src.ProcessId; /// Not mapped to DB
SessionId = src.SessionId; /// Not mapped to DB
@@ -688,6 +692,22 @@ namespace Results.Entities
writer.Write(WMTypeRevision);
writer.Write(Pruefindex);
writer.Write(HydrPruefung);
/// Write RawTestInfos
IList<Results.Output.SensusTestInfo> rawTestInfos = RawTestInfos as IList<Results.Output.SensusTestInfo>;
writer.Write((rawTestInfos != null) ? rawTestInfos.Count : 0);
if (rawTestInfos != null)
{
for (int i = 0; i < rawTestInfos.Count; i++) rawTestInfos[i].WriteBinary(writer);
}
/// Write CompleteTestInfos
Results.Output.SensusTestInfo[] completeTestInfos = CompleteTestInfos as Results.Output.SensusTestInfo[];
writer.Write((completeTestInfos != null) ? completeTestInfos.Length : 0);
if (completeTestInfos != null)
{
for (int i = 0; i < completeTestInfos.Length; i++) completeTestInfos[i].WriteBinary(writer);
}
#endif
writer.Write(ProcessId);
writer.Write(SessionId);
@@ -768,6 +788,28 @@ namespace Results.Entities
WMTypeRevision = reader.ReadInt32();
Pruefindex = reader.ReadInt32();
HydrPruefung = reader.ReadInt32();
/// Read RawTestInfos
int rawTestInfosCount = reader.ReadInt32();
IList<Results.Output.SensusTestInfo> rawTestInfos = new List<Results.Output.SensusTestInfo>();
for (int i = 0; i < rawTestInfosCount; i++)
{
Results.Output.SensusTestInfo ti = new Results.Output.SensusTestInfo();
ti.ReadBinary(reader);
rawTestInfos.Add(ti);
}
RawTestInfos = rawTestInfos;
/// Read CompleteTestInfos
int completeTestInfosLen = reader.ReadInt32();
Results.Output.SensusTestInfo[] completeTestInfos = new Results.Output.SensusTestInfo[completeTestInfosLen];
for (int i = 0; i < completeTestInfosLen; i++)
{
Results.Output.SensusTestInfo ti = new Results.Output.SensusTestInfo();
ti.ReadBinary(reader);
completeTestInfos[i] = ti;
}
CompleteTestInfos = completeTestInfos;
#endif
ProcessId = reader.ReadInt32();
SessionId = reader.ReadInt32();
@@ -1,4 +1,4 @@
namespace TBF.UI.ResultsMI
namespace Results.Forms
{
partial class BatchResultsDlg
{
@@ -47,7 +47,6 @@
this.ClientSize = new System.Drawing.Size(1058, 721);
this.Controls.Add(this.flowLayoutPanel);
this.Name = "BatchResultsDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Results";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BatchResultsDlg_FormClosing);
this.Load += new System.EventHandler(this.BatchResultsDlg_Load);
@@ -1,17 +1,13 @@
///
/// Copyright (c) 2016-2023 Sensus Slovensko a.s.
///
using System;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using log4net;
using Common;
using Results.Forms;
using Results.Resources;
using NHibernate;
using TracingDB.Entities;
using TBF.Resources;
namespace TBF.UI.ResultsMI
namespace Results.Forms
{
public partial class BatchResultsDlg : Form
{
@@ -33,7 +29,6 @@ namespace TBF.UI.ResultsMI
public int PopupResultsWidth;
public int PopupResultsHeight;
public int[] RsltsClmnWidths;
public IList<string> SerialNrs;
///
@@ -131,8 +126,7 @@ namespace TBF.UI.ResultsMI
int displayedControlsCount = 0;
for (int i = 0; i < results.Batch.WaterMeters.Count; i++)
{
if ((ShowDisabledPositions || !results.Batch.WaterMeters[i].Disabled) &&
(SerialNrs == null || SerialNrs.Contains(results.Batch.WaterMeters[i].SerialNr)))
if ((!results.Batch.WaterMeters[i].Disabled) || ShowDisabledPositions)
{
displayedControlsCount++;
}
@@ -173,8 +167,7 @@ namespace TBF.UI.ResultsMI
firstEnabledControl = null;
for (int i = 0; i < results.Batch.WaterMeters.Count; i++)
{
if ((ShowDisabledPositions || !results.Batch.WaterMeters[i].Disabled) &&
(SerialNrs == null || SerialNrs.Contains(results.Batch.WaterMeters[i].SerialNr)))
if (!results.Batch.WaterMeters[i].Disabled || ShowDisabledPositions)
{
/// Create one water meter position / control
wmRsltsCtrl[ix] = (TestsArrangement == TestsArrangement.Rows)
@@ -223,8 +216,7 @@ namespace TBF.UI.ResultsMI
int ctrlIx = 0;
for (int wmNr0 = 0; wmNr0 < results.Batch.WaterMeters.Count; wmNr0++)
{
if ((ShowDisabledPositions || !results.Batch.WaterMeters[wmNr0].Disabled) &&
(SerialNrs == null || SerialNrs.Contains(results.Batch.WaterMeters[wmNr0].SerialNr)))
if (!results.Batch.WaterMeters[wmNr0].Disabled || ShowDisabledPositions)
{
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(results.Batch.WaterMeters[wmNr0]);
}
+486
View File
@@ -0,0 +1,486 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
///
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Results.Forms
{
/// <summary>
/// Event Handler for SubItem events
/// </summary>
public delegate void SubItemEventHandler(object sender, SubItemEventArgs e);
/// <summary>
/// Event Handler for SubItemEndEditing events
/// </summary>
public delegate void SubItemEndEditingEventHandler(object sender, SubItemEndEditingEventArgs e);
/// <summary>
/// Inherited ListView to allow in-place editing of subitems
/// </summary>
public class ListViewEx : System.Windows.Forms.ListView
{
#region Interop structs, imports and constants
/// <summary>
/// MessageHeader for WM_NOTIFY
/// </summary>
private struct NMHDR
{
#pragma warning disable
public IntPtr hwndFrom;
public Int32 idFrom;
public Int32 code;
#pragma warning restore
}
[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wPar, IntPtr lPar);
[DllImport("user32.dll", CharSet=CharSet.Ansi)]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int len, ref int [] order);
// ListView messages
private const int LVM_FIRST = 0x1000;
private const int LVM_GETCOLUMNORDERARRAY = (LVM_FIRST + 59);
// Windows Messages that will abort editing
private const int WM_HSCROLL = 0x114;
private const int WM_VSCROLL = 0x115;
private const int WM_SIZE = 0x05;
private const int WM_NOTIFY = 0x4E;
private const int HDN_FIRST = -300;
private const int HDN_BEGINDRAG = (HDN_FIRST-10);
private const int HDN_ITEMCHANGINGA = (HDN_FIRST-0);
private const int HDN_ITEMCHANGINGW = (HDN_FIRST-20);
#endregion
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public event SubItemEventHandler SubItemClicked;
public event SubItemEventHandler SubItemRightClicked;
public event SubItemEventHandler SubItemBeginEditing;
public event SubItemEndEditingEventHandler SubItemEndEditing;
public ListViewEx()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
base.FullRowSelect = true;
base.View = View.Details;
base.AllowColumnReorder = true;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
private bool _doubleClickActivation = false;
/// <summary>
/// Is a double click required to start editing a cell?
/// </summary>
public bool DoubleClickActivation
{
get { return _doubleClickActivation; }
set { _doubleClickActivation = value; }
}
/// <summary>
/// Retrieve the order in which columns appear
/// </summary>
/// <returns>Current display order of column indices</returns>
public int[] GetColumnOrder()
{
IntPtr lPar = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)) * Columns.Count);
IntPtr res = SendMessage(Handle, LVM_GETCOLUMNORDERARRAY, new IntPtr(Columns.Count), lPar);
if (res.ToInt32() == 0) // Something went wrong
{
Marshal.FreeHGlobal(lPar);
return null;
}
int [] order = new int[Columns.Count];
Marshal.Copy(lPar, order, 0, Columns.Count);
Marshal.FreeHGlobal(lPar);
return order;
}
/// <summary>
/// Find ListViewItem and SubItem Index at position (x,y)
/// </summary>
/// <param name="x">relative to ListView</param>
/// <param name="y">relative to ListView</param>
/// <param name="item">Item at position (x,y)</param>
/// <returns>SubItem index</returns>
public int GetSubItemAt(int x, int y, out ListViewItem item)
{
item = this.GetItemAt(x, y);
if (item != null)
{
int[] order = GetColumnOrder();
Rectangle lviBounds;
int subItemX;
lviBounds = item.GetBounds(ItemBoundsPortion.Entire);
subItemX = lviBounds.Left;
for (int i=0; i<order.Length; i++)
{
ColumnHeader h = this.Columns[order[i]];
if (x < subItemX+h.Width)
{
return h.Index;
}
subItemX += h.Width;
}
}
return -1;
}
/// <summary>
/// Get bounds for a SubItem
/// </summary>
/// <param name="Item">Target ListViewItem</param>
/// <param name="SubItem">Target SubItem index</param>
/// <returns>Bounds of SubItem (relative to ListView)</returns>
public Rectangle GetSubItemBounds(ListViewItem Item, int SubItem)
{
int[] order = GetColumnOrder();
Rectangle subItemRect = Rectangle.Empty;
if (SubItem >= order.Length)
throw new IndexOutOfRangeException("SubItem "+SubItem+" out of range");
if (Item == null)
throw new ArgumentNullException("Item");
Rectangle lviBounds = Item.GetBounds(ItemBoundsPortion.Entire);
int subItemX = lviBounds.Left;
ColumnHeader col;
int i;
for (i=0; i<order.Length; i++)
{
col = this.Columns[order[i]];
if (col.Index == SubItem)
break;
subItemX += col.Width;
}
subItemRect = new Rectangle(subItemX, lviBounds.Top, this.Columns[order[i]].Width, lviBounds.Height);
return subItemRect;
}
protected override void WndProc(ref Message msg)
{
switch (msg.Msg)
{
// Look for WM_VSCROLL,WM_HSCROLL or WM_SIZE messages.
case WM_VSCROLL:
case WM_HSCROLL:
case WM_SIZE:
EndEditing(false);
break;
case WM_NOTIFY:
// Look for WM_NOTIFY of events that might also change the
// editor's position/size: Column reordering or resizing
NMHDR h = (NMHDR)Marshal.PtrToStructure(msg.LParam, typeof(NMHDR));
if (h.code == HDN_BEGINDRAG ||
h.code == HDN_ITEMCHANGINGA ||
h.code == HDN_ITEMCHANGINGW)
EndEditing(false);
break;
}
base.WndProc(ref msg);
}
#region Initialize editing depending of DoubleClickActivation property
protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
{
base.OnMouseUp(e);
MouseEventArgs me = (MouseEventArgs)e;
if (me.Button == MouseButtons.Right)
{
/// Right mouse button click function
RightClickFunctionSubitemAt(new Point(e.X, e.Y));
}
else
{
/// Normal function (=edit item)
if (DoubleClickActivation)
{
return;
}
EditSubitemAt(new Point(e.X, e.Y));
}
}
protected override void OnDoubleClick(EventArgs e)
{
base.OnDoubleClick (e);
if (!DoubleClickActivation)
{
return;
}
Point pt = this.PointToClient(Cursor.Position);
EditSubitemAt(pt);
}
///<summary>
/// Fire SubItemClicked
///</summary>
///<param name="p">Point of click/doubleclick</param>
private void EditSubitemAt(Point p)
{
ListViewItem item;
int idx = GetSubItemAt(p.X, p.Y, out item);
if (idx >= 0)
{
OnSubItemClicked(new SubItemEventArgs(item, idx));
}
}
///<summary>
/// Fire SubItemRightClicked
///</summary>
///<param name="p">Point of click/doubleclick</param>
private void RightClickFunctionSubitemAt(Point p)
{
ListViewItem item;
int idx = GetSubItemAt(p.X, p.Y, out item);
if (idx >= 0)
{
OnSubItemRightClicked(new SubItemEventArgs(item, idx));
}
}
#endregion
#region In-place editing functions
// The control performing the actual editing
private Control _editingControl;
// The LVI being edited
private ListViewItem _editItem;
// The SubItem being edited
private int _editSubItem;
protected void OnSubItemBeginEditing(SubItemEventArgs e)
{
if (SubItemBeginEditing != null) SubItemBeginEditing(this, e);
}
protected void OnSubItemEndEditing(SubItemEndEditingEventArgs e)
{
if (SubItemEndEditing != null) SubItemEndEditing(this, e);
}
protected void OnSubItemClicked(SubItemEventArgs e)
{
if (SubItemClicked != null) SubItemClicked(this, e);
}
protected void OnSubItemRightClicked(SubItemEventArgs e)
{
if (SubItemRightClicked != null) SubItemRightClicked(this, e);
}
/// <summary>
/// Begin in-place editing of given cell
/// </summary>
/// <param name="c">Control used as cell editor</param>
/// <param name="Item">ListViewItem to edit</param>
/// <param name="SubItem">SubItem index to edit</param>
public void StartEditing(Control c, ListViewItem Item, int SubItem)
{
OnSubItemBeginEditing(new SubItemEventArgs(Item, SubItem));
Rectangle rcSubItem = GetSubItemBounds(Item, SubItem);
if (rcSubItem.X < 0)
{
// Left edge of SubItem not visible - adjust rectangle position and width
rcSubItem.Width += rcSubItem.X;
rcSubItem.X=0;
}
if (rcSubItem.X+rcSubItem.Width > this.Width)
{
// Right edge of SubItem not visible - adjust rectangle width
rcSubItem.Width = this.Width-rcSubItem.Left;
}
// Subitem bounds are relative to the location of the ListView!
rcSubItem.Offset(Left, Top);
// In case the editing control and the listview are on different parents,
// account for different origins
Point origin = new Point(0,0);
Point lvOrigin = this.Parent.PointToScreen(origin);
Point ctlOrigin = c.Parent.PointToScreen(origin);
rcSubItem.Offset(lvOrigin.X-ctlOrigin.X, lvOrigin.Y-ctlOrigin.Y);
// Position and show editor
c.Bounds = rcSubItem;
c.Text = Item.SubItems[SubItem].Text;
c.Visible = true;
c.BringToFront();
c.Focus();
_editingControl = c;
_editingControl.Leave += new EventHandler(_editControl_Leave);
_editingControl.KeyPress += new KeyPressEventHandler(_editControl_KeyPress);
_editItem = Item;
_editSubItem = SubItem;
}
private void _editControl_Leave(object sender, EventArgs e)
{
// cell editor losing focus
EndEditing(true);
}
private void _editControl_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
switch (e.KeyChar)
{
case (char)(int)Keys.Escape:
{
EndEditing(false);
break;
}
case (char)(int)Keys.Enter:
{
EndEditing(true);
break;
}
}
}
/// <summary>
/// Accept or discard current value of cell editor control
/// </summary>
/// <param name="AcceptChanges">Use the _editingControl's Text as new SubItem text or discard changes?</param>
public void EndEditing(bool AcceptChanges)
{
if (_editingControl == null)
return;
SubItemEndEditingEventArgs e = new SubItemEndEditingEventArgs(
_editItem, // The item being edited
_editSubItem, // The subitem index being edited
AcceptChanges ?
_editingControl.Text : // Use editControl text if changes are accepted
_editItem.SubItems[_editSubItem].Text, // or the original subitem's text, if changes are discarded
!AcceptChanges // Cancel?
);
OnSubItemEndEditing(e);
_editItem.SubItems[_editSubItem].Text = e.DisplayText;
_editingControl.Leave -= new EventHandler(_editControl_Leave);
_editingControl.KeyPress -= new KeyPressEventHandler(_editControl_KeyPress);
_editingControl.Visible = false;
_editingControl = null;
_editItem = null;
_editSubItem = -1;
}
#endregion
}
/// <summary>
/// Event Args for SubItemClicked event
/// </summary>
public class SubItemEventArgs : EventArgs
{
int subItem = -1; /// Sub-item index
ListViewItem item = null;
public int SubItem { get { return subItem; } }
public ListViewItem Item { get { return item; } }
public SubItemEventArgs(ListViewItem item, int subItem)
{
this.subItem = subItem;
this.item = item;
}
}
/// <summary>
/// Event Args for SubItemEndEditingClicked event
/// </summary>
public class SubItemEndEditingEventArgs : SubItemEventArgs
{
string displayText = string.Empty;
bool cancel = true;
public SubItemEndEditingEventArgs(ListViewItem item, int subItem, string displayText, bool cancel) :
base(item, subItem)
{
this.displayText = displayText;
this.cancel = cancel;
}
public string DisplayText
{
get { return displayText; }
set { displayText = value; }
}
public bool Cancel
{
get { return cancel; }
set { cancel = value; }
}
}
}
+42
View File
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="ResMimeType">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="Version">
<value>1.0.0.0</value>
</resheader>
<resheader name="Reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="Writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+104
View File
@@ -0,0 +1,104 @@
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace Results.Forms
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static class ListViewExtensions
{
[StructLayout(LayoutKind.Sequential)]
public struct HDITEM
{
public Mask mask;
public int cxy;
[MarshalAs(UnmanagedType.LPTStr)]
public string pszText;
public IntPtr hbm;
public int cchTextMax;
public Format fmt;
public IntPtr lParam;
// _WIN32_IE >= 0x0300
public int iImage;
public int iOrder;
// _WIN32_IE >= 0x0500
public uint type;
public IntPtr pvFilter;
// _WIN32_WINNT >= 0x0600
public uint state;
[Flags]
public enum Mask
{
Format = 0x4, // HDI_FORMAT
};
[Flags]
public enum Format
{
SortDown = 0x200, // HDF_SORTDOWN
SortUp = 0x400, // HDF_SORTUP
};
};
public const int LVM_FIRST = 0x1000;
public const int LVM_GETHEADER = LVM_FIRST + 31;
public const int HDM_FIRST = 0x1200;
public const int HDM_GETITEM = HDM_FIRST + 11;
public const int HDM_SETITEM = HDM_FIRST + 12;
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, ref HDITEM lParam);
public static void SetSortIcon(this ListViewEx listViewControl, int columnIndex, SortOrder order)
{
IntPtr columnHeader = SendMessage(listViewControl.Handle, LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero);
for (int columnNumber = 0; columnNumber <= listViewControl.Columns.Count - 1; columnNumber++)
{
var columnPtr = new IntPtr(columnNumber);
var item = new HDITEM
{
mask = HDITEM.Mask.Format
};
if (SendMessage(columnHeader, HDM_GETITEM, columnPtr, ref item) == IntPtr.Zero)
{
throw new Win32Exception();
}
if (order != SortOrder.None && columnNumber == columnIndex)
{
switch (order)
{
case SortOrder.Ascending:
item.fmt &= ~HDITEM.Format.SortDown;
item.fmt |= HDITEM.Format.SortUp;
break;
case SortOrder.Descending:
item.fmt &= ~HDITEM.Format.SortUp;
item.fmt |= HDITEM.Format.SortDown;
break;
default:
break;
}
}
else
{
item.fmt &= ~HDITEM.Format.SortDown & ~HDITEM.Format.SortUp;
}
if (SendMessage(columnHeader, HDM_SETITEM, columnPtr, ref item) == IntPtr.Zero)
{
throw new Win32Exception();
}
}
}
}
}
+31
View File
@@ -0,0 +1,31 @@
using System;
using System.Collections;
using System.Windows.Forms;
namespace Results.Forms
{
public class LviIntColumnComparer : IComparer
{
int column;
SortOrder order;
public LviIntColumnComparer()
{
column = 0;
order = SortOrder.Ascending;
}
public LviIntColumnComparer(int column, SortOrder order)
{
this.column = column;
this.order = order;
}
public int Compare(object x, object y)
{
int valX = int.Parse(((ListViewItem)x).SubItems[column].Text);
int valY = int.Parse(((ListViewItem)y).SubItems[column].Text);
return (order == SortOrder.Descending) ? (valY - valX) : (valX - valY);
}
}
}
+31
View File
@@ -0,0 +1,31 @@
using System;
using System.Collections;
using System.Windows.Forms;
namespace Results.Forms
{
public class LviTextColumnComparer : IComparer
{
private int column;
SortOrder order;
public LviTextColumnComparer()
{
column = 0;
order = SortOrder.Ascending;
}
public LviTextColumnComparer(int column, SortOrder order)
{
this.column = column;
this.order = order;
}
public int Compare(object x, object y)
{
string txtX = ((ListViewItem)x).SubItems[column].Text;
string txtY = ((ListViewItem)y).SubItems[column].Text;
return (order == SortOrder.Descending) ? String.Compare(txtY, txtX) : String.Compare(txtX, txtY);
}
}
}
+2 -2
View File
@@ -37,7 +37,7 @@
this.availableAlphabeticTreeView = new System.Windows.Forms.TreeView();
this.downButton = new System.Windows.Forms.Button();
this.upButton = new System.Windows.Forms.Button();
this.selectedResultsListViewEx = new Common.Forms.ListViewEx();
this.selectedResultsListViewEx = new Results.Forms.ListViewEx();
this.removeAllButton = new System.Windows.Forms.Button();
this.removeButton = new System.Windows.Forms.Button();
this.addButton = new System.Windows.Forms.Button();
@@ -247,7 +247,7 @@
private System.Windows.Forms.TreeView availableAlphabeticTreeView;
private System.Windows.Forms.Button downButton;
private System.Windows.Forms.Button upButton;
private Common.Forms.ListViewEx selectedResultsListViewEx;
private ListViewEx selectedResultsListViewEx;
private System.Windows.Forms.Button removeAllButton;
private System.Windows.Forms.Button removeButton;
private System.Windows.Forms.Button addButton;
+8 -9
View File
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Common;
using Common.Forms;
using Config.Entities;
using Results.Resources;
@@ -115,12 +114,12 @@ namespace Results.Forms
{
if (e.SubItem == (int)Column.Units)
{
Quantity quantity = (e.Item.Tag as ManualEntryItemSpec).Quantity;
Config.Quantity quantity = (e.Item.Tag as ManualEntryItemSpec).Quantity;
unitsCB.Items.Clear();
unitsCB.Items.Add(Unit.None.ToDescription()); /// "---"
for (Unit u = (Unit)1; u < Unit.Count; u++)
unitsCB.Items.Add(Config.Unit.None.ToDescription()); /// "---"
for (Config.Unit u = (Config.Unit)1; u < Config.Unit.Count; u++)
{
if (Units.IsQuantity(u, quantity)) unitsCB.Items.Add(u.ToDescription());
if (Config.Units.IsQuantity(u, quantity)) unitsCB.Items.Add(u.ToDescription());
}
selectedResultsListViewEx.StartEditing(unitsCB, e.Item, e.SubItem);
}
@@ -139,7 +138,7 @@ namespace Results.Forms
{
case Column.Caption: item.Caption = e.DisplayText; return;
case Column.Units:
for (Unit u = 0; u < Unit.Count; u++)
for (Config.Unit u = 0; u < Config.Unit.Count; u++)
{
if (u.ToDescription().Equals(unitsCB.Text))
{
@@ -190,10 +189,10 @@ namespace Results.Forms
{
treeView.Nodes.Clear();
IList<Quantity> quantities = new List<Quantity>();
for (Quantity q = 0; q < Quantity.Count; q++) quantities.Add(q);
IList<Config.Quantity> quantities = new List<Config.Quantity>();
for (Config.Quantity q = 0; q < Config.Quantity.Count; q++) quantities.Add(q);
IList<Quantity> sortedQuantities = quantities.OrderBy(x => x.ToDescription()).ToList();
IList<Config.Quantity> sortedQuantities = quantities.OrderBy(x => x.ToDescription()).ToList();
foreach (var q in sortedQuantities)
{
+5 -7
View File
@@ -41,7 +41,6 @@
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
@@ -49,13 +48,12 @@
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.tBox);
this.splitContainer1.Panel1MinSize = 26;
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.lView);
this.splitContainer1.Size = new System.Drawing.Size(352, 318);
this.splitContainer1.SplitterDistance = 26;
this.splitContainer1.SplitterDistance = 25;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 0;
//
@@ -64,7 +62,7 @@
this.tBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.tBox.Location = new System.Drawing.Point(0, 0);
this.tBox.Name = "tBox";
this.tBox.Size = new System.Drawing.Size(352, 26);
this.tBox.Size = new System.Drawing.Size(352, 20);
this.tBox.TabIndex = 0;
this.tBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.tBox_MouseDoubleClick);
//
@@ -75,17 +73,17 @@
this.lView.GridLines = true;
this.lView.Location = new System.Drawing.Point(0, 0);
this.lView.Name = "lView";
this.lView.Size = new System.Drawing.Size(352, 291);
this.lView.Size = new System.Drawing.Size(352, 292);
this.lView.TabIndex = 0;
this.lView.UseCompatibleStateImageBehavior = false;
this.lView.View = System.Windows.Forms.View.Details;
//
// OneWMResultsColumnsCtrl
// OneWMResultsCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "OneWMResultsColumnsCtrl";
this.Name = "OneWMResultsCtrl";
this.Size = new System.Drawing.Size(352, 318);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
+6 -10
View File
@@ -79,18 +79,14 @@ namespace Results.Forms
return;
}
/// Update background color and caption
/// Update background color
string message = string.Empty;
#if ORACLE_DB
bool maxRepeatsExceeded = (Utils.MaxTestIndex != 0 && (wMtr.Pruefindex % 100) > Utils.MaxTestIndex);
UpdateBkColor(wMtr.GetColorOfResults(maxRepeatsExceeded, out message));
tBox.Text = caption = string.Format("{0} ({1}) {2} {3}",
wMtr.WMPosition,
wMtr.Pruefindex == 0 ? "?" : string.Format("{0}x", wMtr.Pruefindex % 100),
(string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr),
message);
#else
UpdateBkColor(wMtr.GetColorOfResults(false, out message));
/// Update caption
#if ORACLE_DB
tBox.Text = caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
#else
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
#endif
+5 -7
View File
@@ -48,23 +48,21 @@
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.tBox);
this.splitContainer1.Panel1MinSize = 26;
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.lView);
this.splitContainer1.Size = new System.Drawing.Size(352, 318);
this.splitContainer1.SplitterDistance = 26;
this.splitContainer1.SplitterDistance = 25;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 0;
//
// tBox
//
this.tBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.tBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.tBox.Location = new System.Drawing.Point(0, 0);
this.tBox.Name = "tBox";
this.tBox.Size = new System.Drawing.Size(352, 26);
this.tBox.Size = new System.Drawing.Size(352, 20);
this.tBox.TabIndex = 0;
this.tBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.tBox_MouseDoubleClick);
//
@@ -75,17 +73,17 @@
this.lView.GridLines = true;
this.lView.Location = new System.Drawing.Point(0, 0);
this.lView.Name = "lView";
this.lView.Size = new System.Drawing.Size(352, 291);
this.lView.Size = new System.Drawing.Size(352, 292);
this.lView.TabIndex = 0;
this.lView.UseCompatibleStateImageBehavior = false;
this.lView.View = System.Windows.Forms.View.Details;
//
// OneWMResultsRowsCtrl
// OneWMResultsCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "OneWMResultsRowsCtrl";
this.Name = "OneWMResultsCtrl";
this.Size = new System.Drawing.Size(352, 318);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
+7 -11
View File
@@ -91,21 +91,17 @@ namespace Results.Forms
return;
}
/// Update background color and caption
/// Update background color
string message = string.Empty;
#if ORACLE_DB
bool maxRepeatsExceeded = (Utils.MaxTestIndex != 0 && (wMtr.Pruefindex % 100) > Utils.MaxTestIndex);
UpdateBkColor(wMtr.GetColorOfResults(maxRepeatsExceeded, out message));
tBox.Text = caption = string.Format("{0} ({1}) {2} {3}",
wMtr.WMPosition,
wMtr.Pruefindex == 0 ? "?" : string.Format("{0}x", wMtr.Pruefindex % 100),
(string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr),
message);
#else
UpdateBkColor(wMtr.GetColorOfResults(false, out message));
/// Update caption
#if ORACLE_DB
tBox.Text = caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
#else
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
#endif
UpdateWMPos(wMtr.WMPosition);
/// Update test results
+2 -2
View File
@@ -37,7 +37,7 @@
this.availableAlphabeticTreeView = new System.Windows.Forms.TreeView();
this.downButton = new System.Windows.Forms.Button();
this.upButton = new System.Windows.Forms.Button();
this.selectedResultsListViewEx = new Common.Forms.ListViewEx();
this.selectedResultsListViewEx = new Results.Forms.ListViewEx();
this.removeAllButton = new System.Windows.Forms.Button();
this.removeButton = new System.Windows.Forms.Button();
this.addButton = new System.Windows.Forms.Button();
@@ -247,7 +247,7 @@
private System.Windows.Forms.TreeView availableAlphabeticTreeView;
private System.Windows.Forms.Button downButton;
private System.Windows.Forms.Button upButton;
private Common.Forms.ListViewEx selectedResultsListViewEx;
private ListViewEx selectedResultsListViewEx;
private System.Windows.Forms.Button removeAllButton;
private System.Windows.Forms.Button removeButton;
private System.Windows.Forms.Button addButton;
+8 -9
View File
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Common;
using Common.Forms;
using Results.Resources;
namespace Results.Forms
@@ -140,12 +139,12 @@ namespace Results.Forms
{
if (e.SubItem == (int)Column.Units)
{
Quantity quantity = (e.Item.Tag as WMeterRsltItemSpec).Quantity;
Config.Quantity quantity = (e.Item.Tag as WMeterRsltItemSpec).Quantity;
unitsCB.Items.Clear();
unitsCB.Items.Add(Unit.None.ToDescription()); /// "---"
for (Unit u = (Unit)1; u < Unit.Count; u++)
unitsCB.Items.Add(Config.Unit.None.ToDescription()); /// "---"
for (Config.Unit u = (Config.Unit)1; u < Config.Unit.Count; u++)
{
if (Units.IsQuantity(u, quantity)) unitsCB.Items.Add(u.ToDescription());
if (Config.Units.IsQuantity(u, quantity)) unitsCB.Items.Add(u.ToDescription());
}
selectedResultsListViewEx.StartEditing(unitsCB, e.Item, e.SubItem);
}
@@ -164,7 +163,7 @@ namespace Results.Forms
{
case Column.Caption: item.Caption = e.DisplayText; return;
case Column.Units:
for (Unit u = 0; u < Unit.Count; u++)
for (Config.Unit u = 0; u < Config.Unit.Count; u++)
{
if (u.ToDescription().Equals(unitsCB.Text))
{
@@ -241,10 +240,10 @@ namespace Results.Forms
{
treeView.Nodes.Clear();
IList<Quantity> quantities = new List<Quantity>();
for (Quantity q = 0; q < Quantity.Count; q++) quantities.Add(q);
IList<Config.Quantity> quantities = new List<Config.Quantity>();
for (Config.Quantity q = 0; q < Config.Quantity.Count; q++) quantities.Add(q);
IList<Quantity> sortedQuantities = quantities.OrderBy(x => x.ToDescription()).ToList();
IList<Config.Quantity> sortedQuantities = quantities.OrderBy(x => x.ToDescription()).ToList();
foreach (var q in sortedQuantities)
{
+2 -2
View File
@@ -22,7 +22,7 @@ namespace Results
public readonly Quantity Quantity; /// Quantity
public readonly ItemCategory Category; ///
public string Caption; /// Specifies item description to be printed as a caption (in the header, etc.)
public Unit Units; /// Specifies units for the output
public Config.Unit Units; /// Specifies units for the output
public ManualEntryItemSpec Clone()
@@ -198,7 +198,7 @@ namespace Results
///
item.Caption = field[1].Replace("\n", "~");
item.Units = 0;
for (Unit u = 0; u < Unit.Count; u++)
for (Config.Unit u = 0; u < Config.Unit.Count; u++)
{
if (u.ToString().Equals(field[2])) { item.Units = u; break; }
}
-1
View File
@@ -35,7 +35,6 @@ namespace Results.Mappings
Map(x => x.StartTime);
Map(x => x.EndTime);
Map(x => x.SaveTime);
Map(x => x.Dirty);
Map(x => x.RsltsSent);
Map(x => x.RsltsPrinted);
+2 -10
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2022 Sensus Slovensko a.s.
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Results.Entities;
@@ -24,14 +24,6 @@ namespace Results.Mappings
Map(x => x.ErrLimMargin).Column("Uncertainty");
Map(x => x.Publish);
Map(x => x.Evaluate);
#if ORACLE_DB
Map(x => x.OraId);
Map(x => x.OraIdRepetMulti);
Map(x => x.OraDesignation);
Map(x => x.RawDataId);
Map(x => x.RawDataIdRepetMulti);
Map(x => x.RawDataDesignation);
#endif
}
}
}
}
@@ -14,7 +14,7 @@ using GenCode128;
namespace Results.Output.Printers.Label
{
public class LabelPrintDocument : Common.Printers.PrintersCommon
public class LabelPrintDocument : PrintersCommon
{
static QrEncoder encoder = new QrEncoder();
@@ -14,7 +14,7 @@ using GenCode128;
namespace Results.Output.Printers.MultiLabel
{
public class MultiLabelPrintDocument : Common.Printers.PrintersCommon
public class MultiLabelPrintDocument : PrintersCommon
{
static QrEncoder encoder = new QrEncoder();
@@ -393,7 +393,7 @@ namespace Results.Output.Printers.Munich
Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux);
table.AddRow(new string[] { mtr.Name(),
Units.ConvertTo(Unit.lph, flow_ctv).ToString("F1"),
Config.Units.ConvertTo(Config.Unit.lph, flow_ctv).ToString("F1"),
mtr.TestRslt.VolumeCTV.ToString("F2"),
mainMtr.VolumeMeter.ToString("F2"),
auxMtr.VolumeMeter.ToString("F2"),
@@ -405,7 +405,7 @@ namespace Results.Output.Printers.Munich
else
{
table.AddRow(new string[] { mtr.Name(),
Units.ConvertTo(Unit.lph, flow_ctv).ToString("F1"),
Config.Units.ConvertTo(Config.Unit.lph, flow_ctv).ToString("F1"),
mtr.TestRslt.VolumeCTV.ToString("F2"),
mtr.VolumeMeter.ToString("F2"),
"-",
@@ -456,12 +456,12 @@ namespace Results.Output.Printers.Munich
double flow_ctv = (mtr.TestRslt.TestTime != 0) ? (3.6 * mtr.TestRslt.VolumeCTV / mtr.TestRslt.TestTime) : 0;
table.AddRow(new string[] { mtr.Name(),
Units.ConvertTo(Unit.lph, flow_ctv).ToString("F1"),
Config.Units.ConvertTo(Config.Unit.lph, flow_ctv).ToString("F1"),
mtr.TestRslt.TempDownMean.ToString("F2"),
mtr.TestRslt.DensityDiv.ToString("F2"),
mtr.TestTime.ToString("F1"),
Units.ConvertTo(Unit.bar, mtr.TestRslt.PressUpMean).ToString("F3"),
Units.ConvertTo(Unit.bar, mtr.TestRslt.PressDownMean).ToString("F3") },
Config.Units.ConvertTo(Config.Unit.bar, mtr.TestRslt.PressUpMean).ToString("F3"),
Config.Units.ConvertTo(Config.Unit.bar, mtr.TestRslt.PressDownMean).ToString("F3") },
horizontalAlignment,
verticalAlignment);
}
@@ -592,7 +592,7 @@ namespace Results.Output.Printers.Munich
iTop += SpacingOne;
PrintAt(e, Tab1, iTop, "Luftdruck");
PrintAt(e, Tab2, iTop, Units.ConvertTo(Unit.mbar, wm.Batch.AmbPressMean()).ToString("F0") + " mbar");
PrintAt(e, Tab2, iTop, Config.Units.ConvertTo(Config.Unit.mbar, wm.Batch.AmbPressMean()).ToString("F0") + " mbar");
iTop += SpacingOne;
@@ -11,7 +11,7 @@ using Results.Resources;
namespace Results.Output.Printers.OnePerBatch
{
public class OnePerBatchPrintDocument : Common.Printers.PrintersCommon
public class OnePerBatchPrintDocument : PrintersCommon
{
const float GapBetweenTableColumns = 10;
const float GapBetweenCommonColumns = 10;
@@ -14,7 +14,7 @@ using Results.Resources;
namespace Results.Output.Printers.OnePerMeter
{
public class OnePerMeterPrintDocument : Common.Printers.PrintersCommon
public class OnePerMeterPrintDocument : PrintersCommon
{
const float GapBetweenTableColumns = 10;
const float GapBetweenCommonColumns = 10;
@@ -2,8 +2,9 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using Common;
namespace Common.Printers
namespace Results.Output.Printers
{
public class PrintersCommon : PrintDocument
{
+7 -23
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2018-2022 Sensus Slovensko a.s.
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -15,7 +15,6 @@ namespace Results.Output
Just_Q3Q2adjQ1_Alt, /// pNrs = -1,5,2,1
JustA0A4_Q3Q2adjQ1, /// pNrs = -2,-1,3,2,1 (Australia 169 MHz, raw data pNrs: -2,-1,4,3,2,1)
JustA0A4_Q3Q2Q1, /// pNrs = -2,-1,3,2,1 (Australia 169 MHz smart, raw data pNrs: -2,-1,3,2,1)
JustA0_Q3Q2Q1, /// pNrs = -1,3,2,1 (Australia 169 MHz smart, raw data pNrs: -1,3,2,1)
DEWA, /// Q4, Q3, Q2adj, Q2, Q1
DEWA_wo_Q2, /// Q4, Q3, Q2adj, Q1
Suez, /// Two directions, with Q2 and Q2ac
@@ -102,8 +101,7 @@ namespace Results.Output
}
/// <summary>
/// Determines whether test infos are compatible with procedure tests:
/// For each 'cti'in candidate SensusTestInfo array there must exist a string 'cti.TestName' in testNames.
/// Determines whether test infos are compatible with procedure tests.
/// </summary>
/// <returns>true when compatible</returns>
public static bool AreCompatible(SensusTestInfo[] completeTestInfo, IList<string> testNames)
@@ -128,15 +126,11 @@ namespace Results.Output
/// <summary>
/// Determines whether Oracle and complete test infos are compatible:
/// For each 'oti' in OracleTestInfo there must exist a compatible ...
/// ... cti.PruefungsNrDB + cti.QBezeichnungDB pair in candidate SensusTestInfo.
/// Determines whether Oracle and complete test infos are compatible.
/// </summary>
/// <returns>true when compatible</returns>
public static bool AreCompatible(IList<SensusTestInfo> oracleTestInfo, SensusTestInfo[] completeTestInfo)
{
if (oracleTestInfo == null) return false;
/// All tests in oracleTestInfo must exist in completeTestInfo
foreach (var oti in oracleTestInfo)
{
@@ -182,7 +176,7 @@ namespace Results.Output
SensusTestInfo[] candidateTinfo = SensusTestInfo.GetTestInfos(lt);
if (AreCompatible(candidateTinfo, testNames) && AreCompatible(oracleTestInfo, candidateTinfo) &&
((bestMatch == null) || (candidateTinfo.Length < bestMatchLen)))
((bestMatch == null) || (candidateTinfo.Length > bestMatchLen)))
{
bestLT = lt;
bestMatch = candidateTinfo;
@@ -296,16 +290,6 @@ 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.JustA0_Q3Q2Q1: /// Australia 169 MHz with default Q2 corrections and conditional update at the end of cycle
return new SensusTestInfo[]
{
/// TBF Oracle DB Opto RAW LU logfiles
new SensusTestInfo("Qjust_A0", -1, "Just", -1, "-1", -1, "Q-1", Range.R95_105),
new SensusTestInfo("Q3", 3, "Q3", 3, "03", 3, "Q3", Range.R90_100),
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.DEWA: /// DEWA (with Q4 and Q2 after correction)
return new SensusTestInfo[]
@@ -463,7 +447,7 @@ namespace Results.Output
return new SensusTestInfo[]
{
/// TBF Oracle DB Opto RAW LU logfiles
new SensusTestInfo("Q3", 3, "Q3", 3, "03", 3, "Q3", Range.R90_100),
new SensusTestInfo("Q3", 3, "Q3", 3, "04", 3, "Q3", Range.R90_100),
new SensusTestInfo("Q2", 2, "Q2", 2, "02", 2, "Q2", Range.R100_110),
new SensusTestInfo("Q1", 1, "Q1", 1, "01", 1, "Q1", Range.R100_110),
};
@@ -472,7 +456,7 @@ namespace Results.Output
return new SensusTestInfo[]
{
/// TBF Oracle DB Opto RAW LU logfiles
new SensusTestInfo("Q3", 5, "Q3", 5, "05", 5, "Q3", Range.R90_100),
new SensusTestInfo("Q3", 5, "Q3", 5, "04", 5, "Q3", Range.R90_100),
new SensusTestInfo("Q2", 2, "Q2", 2, "02", 2, "Q2", Range.R100_110),
new SensusTestInfo("Q1", 1, "Q1", 1, "01", 1, "Q1", Range.R100_110),
};
@@ -481,7 +465,7 @@ namespace Results.Output
return new SensusTestInfo[]
{
/// TBF Oracle DB Opto RAW LU logfiles
new SensusTestInfo("Q4", 5, "Q4", 5, "05", 5, "Q4", Range.R90_100),
new SensusTestInfo("Q4", 5, "Q4", 5, "04", 5, "Q4", Range.R90_100),
new SensusTestInfo("Q2", 2, "Q2", 2, "02", 2, "Q2", Range.R100_110),
new SensusTestInfo("Q1", 1, "Q1", 1, "01", 1, "Q1", Range.R100_110),
};
+3 -3
View File
@@ -96,7 +96,7 @@ namespace Results.Output
else
{
bool isHeader = (colIx < Style.LeftHeadersCount) || (rowIx < Style.TopHeadersCount);
SizeF size = Common.Printers.PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font);
SizeF size = Printers.PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font);
if (size.Width > columnWidth[colIx]) columnWidth[colIx] = size.Width;
if (size.Height > rowHeight[rowIx]) rowHeight[rowIx] = size.Height;
}
@@ -159,7 +159,7 @@ namespace Results.Output
{
/// In not a separator line
bool isHeader = (colIx < Style.LeftHeadersCount) || (rowIx < Style.TopHeadersCount);
SizeF size = Common.Printers.PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font);
SizeF size = Printers.PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font);
if ((Style.ColumnWidths != null) && (Style.ColumnWidths.Length > colIx))
{
size.Width = Style.ColumnWidths[colIx]; /// Override measurement if column width is defined
@@ -246,7 +246,7 @@ namespace Results.Output
for (int colIndex = 0; colIndex < tblColumnsCount; colIndex++)
{
bool isHeader = (colIndex < Style.LeftHeadersCount) || (rowIndex < Style.TopHeadersCount);
Common.Printers.PrintersCommon.PrintAt(e, oneTableRow[colIndex],
Printers.PrintersCommon.PrintAt(e, oneTableRow[colIndex],
isHeader ? Style.HeaderFont : Style.Font,
columnPos[colIndex],
rowPos[rowIndex],
+30 -27
View File
@@ -1,7 +1,4 @@
///
/// Copyright (c) 2019-2022 Sensus Metering Systems
///
using System;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
@@ -16,28 +13,34 @@ namespace Results.Output
{
public static Chart GetChart(WaterMeter wm, bool isPrinter)
{
return GetChart(wm, isPrinter, Unit.lph);
return GetChart(wm, isPrinter, Config.Unit.lph);
}
public static Chart GetChart(WaterMeter wm, bool isPrinter, Unit flowUnit)
public static Chart GetChart(WaterMeter wm, bool isPrinter, Config.Unit flowUnit)
{
double maxFlow = 0;
double maxFlow_m3h = 0;
IList<PointF> unsortedPoints = new List<PointF>();
foreach (var mtr in wm.RegularMeterTestRslts())
{
double flow = mtr.TestRslt.FlowVolume;
var td = mtr.TestRslt.TestData;
if (mtr.IsPilotRslt() && flow > 0 && td.Evaluate &&
(td.Publish == (sbyte)Publish.Always || (!isPrinter && td.Publish == (sbyte)Publish.OnScreen)))
if (mtr.IsPilotRslt() && mtr.TestRslt.TestData.Evaluate && (mtr.TestRslt.TestTime > 0) && (mtr.TestRslt.PulsesMaster > 0))
{
if (flow > maxFlow) maxFlow = flow;
unsortedPoints.Add(new PointF((float)Units.ConvertTo(flowUnit, flow), (float)mtr.Error));
double flow_m3h = (mtr.TestTime != 0)
? (3.6 * mtr.TestRslt.VolumeCTV / mtr.TestTime * mtr.PulsesMaster / mtr.TestRslt.PulsesMaster)
: (3.6 * mtr.TestRslt.VolumeCTV / mtr.TestRslt.TestTime);
if (flow_m3h > maxFlow_m3h) maxFlow_m3h = flow_m3h;
double flow = Config.Units.ConvertTo(flowUnit, flow_m3h); /// Convert to specified units
if (flow > 0)
{
unsortedPoints.Add(new PointF((float)flow, (float)mtr.Error));
}
}
}
IEnumerable<PointF> sortedPoints = unsortedPoints.OrderBy(x => x.X);
bool isQ4 = (maxFlow > 1.1 * wm.WaterMeterData.Q3_Qn);
bool isQ4 = (maxFlow_m3h > 1.1 * wm.WaterMeterData.Q3_Qn);
Chart chart = new Chart
{
@@ -68,8 +71,8 @@ namespace Results.Output
1000000, 2000000, 5000000,
10000000 };
double spacer = 0.8;
double from = Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin);
double to = Units.ConvertTo(flowUnit, isQ4 ? wm.WaterMeterData.Q4_Qmax : wm.WaterMeterData.Q3_Qn);
double from = Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin);
double to = Config.Units.ConvertTo(flowUnit, isQ4 ? wm.WaterMeterData.Q4_Qmax : wm.WaterMeterData.Q3_Qn);
bool inRange = false;
for (int i = 0; i < xs.Count - 3; i += 3)
{
@@ -112,18 +115,18 @@ namespace Results.Output
Legend legend1 = new Legend { Name = "Legend1" };
Series upperLimit = new Series { Name = Strings.Upper_limit, ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.Red };
upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin), 5);
upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), 5);
upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), 2);
upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q3_Qn), 2);
if (isQ4) upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q4_Qmax), 2);
upperLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin), 5);
upperLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), 5);
upperLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), 2);
upperLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q3_Qn), 2);
if (isQ4) upperLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q4_Qmax), 2);
Series lowerLimit = new Series { Name = Strings.Lower_limit, ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.Red };
lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin), -5);
lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), -5);
lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), -2);
lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q3_Qn), -2);
if (isQ4) lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q4_Qmax), -2);
lowerLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin), -5);
lowerLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), -5);
lowerLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), -2);
lowerLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q3_Qn), -2);
if (isQ4) lowerLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q4_Qmax), -2);
Series line = new Series { Name = Strings.Relative_error, ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.DeepSkyBlue };
Series dots = new Series { Name = Strings.Relative_error + " ", ChartArea = "ChartArea1", ChartType = SeriesChartType.Point, Color = Color.RoyalBlue };
+3 -3
View File
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sensus")]
[assembly: AssemblyProduct("Results")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2022 Sensus Slovensko, a.s.")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2019 Sensus Slovensko, a.s.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.31.1990.0")]
[assembly: AssemblyFileVersion("2.31.1990.0")]
[assembly: AssemblyVersion("2.27.1776.0")]
[assembly: AssemblyFileVersion("2.27.1776.0")]
+23 -2
View File
@@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -29,7 +29,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
@@ -75,7 +75,19 @@
<Compile Include="Entities\WaterMeterData.cs" />
<Compile Include="Entities\WaterMeter.cs" />
<Compile Include="DB.cs" />
<Compile Include="Forms\BatchResultsDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\BatchResultsDlg.Designer.cs">
<DependentUpon>BatchResultsDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\IOneWMResultsCtrl.cs" />
<Compile Include="Forms\ListViewEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Forms\ListViewExtensions.cs" />
<Compile Include="Forms\LviIntColumnComparer.cs" />
<Compile Include="Forms\LviTextColumnComparer.cs" />
<Compile Include="Forms\ManualEntryConfigCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -151,6 +163,9 @@
<SubType>Component</SubType>
</Compile>
<Compile Include="Output\Printers\OnePerBatch\OnePerBatchPrinterCfg.cs" />
<Compile Include="Output\Printers\PrintersCommon.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Output\Printers\Munich\MunichPrintDocument.cs">
<SubType>Component</SubType>
</Compile>
@@ -207,6 +222,12 @@
<Folder Include="Output\FileWriters\OneFilePerMeter\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Forms\BatchResultsDlg.resx">
<DependentUpon>BatchResultsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\ListViewEx.resx">
<DependentUpon>ListViewEx.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\ManualEntryConfigCtrl.resx">
<DependentUpon>ManualEntryConfigCtrl.cs</DependentUpon>
</EmbeddedResource>
+6 -3
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2022 Sensus Slovensko a.s.
/// Copyright (c) 2016-2021 Sensus Slovensko a.s.
///
using System;
using System.Text;
@@ -9,9 +9,12 @@ namespace Results
{
public static class Utils
{
public static int MaxTestIndex = 0;
public static string GetTestName(string name, int repeats, int repetitionNr)
{
return Common.Utils.GetTestName(name, repeats, repetitionNr);
}
public static int BenchIdOracle2Asc(int benchIdOracle)
{
switch (benchIdOracle)
+13 -14
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -331,12 +331,11 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.ThreeState, "Three state result", Quantity.Enumerated, ItemCategory.MeterResult, (w, t, u, f, p) => FormatThreeState(f, w.ThreeStateFromTests())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Scale, "Scale", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Scale()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter, "Diverter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Diverter()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.RegValve, "Reg. valve", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RegValve()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult,(w, t, u, f, p) => (w.GetMeterTestRslt(t) != null) ? FormatStr(f, w.GetMeterTestRslt(t).PassedOrErrorFlagsStr())
: FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Scale, "Scale", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Scale()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter, "Diverter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).Diverter()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.RegValve, "Reg. valve", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RegValve()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
///
/// Water meter info
@@ -666,9 +665,9 @@ namespace Results
return FormatDbl(units, format, precisionOrEmpty, dfltPrecision, v, CultureInfo.CurrentCulture);
}
///
public static string FormatDbl(Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v, CultureInfo ci)
public static string FormatDbl(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v, CultureInfo ci)
{
double val = Common.Units.ConvertTo(units, v);
double val = Config.Units.ConvertTo(units, v);
string precision = string.IsNullOrEmpty(precisionOrEmpty) ? dfltPrecision : precisionOrEmpty;
@@ -678,7 +677,7 @@ namespace Results
int significantDigits;
if (int.TryParse(precision.Substring(1), out significantDigits))
{
precision = Common.Utils.SignificantDigitsToFmt(val, significantDigits);
precision = Config.Utils.SignificantDigitsToFmt(val, significantDigits);
}
}
@@ -705,8 +704,8 @@ namespace Results
///
public static string FormatDbl(Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v1, double v2, CultureInfo ci)
{
double val1 = Common.Units.ConvertTo(units, v1);
double val2 = Common.Units.ConvertTo(units, v2);
double val1 = Config.Units.ConvertTo(units, v1);
double val2 = Config.Units.ConvertTo(units, v2);
string precision = string.IsNullOrEmpty(precisionOrEmpty) ? dfltPrecision : precisionOrEmpty;
@@ -716,7 +715,7 @@ namespace Results
int significantDigits;
if (int.TryParse(precision.Substring(1), out significantDigits))
{
precision = Common.Utils.SignificantDigitsToFmt(val1, significantDigits);
precision = Config.Utils.SignificantDigitsToFmt(val1, significantDigits);
}
}
@@ -820,7 +819,7 @@ namespace Results
item.Caption = field[1].Replace("\n", "~");
item.TestID = field[2];
item.Units = 0;
for (Unit u = 0; u < Unit.Count; u++)
for (Config.Unit u = 0; u < Config.Unit.Count; u++)
{
if (u.ToString().Equals(field[3])) { item.Units = u; break; }
}
-1
View File
@@ -107,7 +107,6 @@
this.Controls.Add(this.printerClassComboBox);
this.Name = "PrinterConfigDlg";
this.Text = "Printer configuration";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PrinterConfigDlg_FormClosing);
this.Load += new System.EventHandler(this.PrinterClassDlg_Load);
this.ResumeLayout(false);
this.PerformLayout();
+1 -6
View File
@@ -88,7 +88,7 @@ namespace ResultsBrowser.Forms
printerCfg = printerFactory.CmpntCfgFromCmpntEntity(cmpnt);
}
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
cfgForm.CmpntEntities = new List<Component>();
IComponentCfgCtrl cfgControl = printerCfg.GetControl(cfgForm.CmpntEntities);
@@ -167,10 +167,5 @@ namespace ResultsBrowser.Forms
return null;
}
private void PrinterConfigDlg_FormClosing(object sender, FormClosingEventArgs e)
{
Users.CurrentUser.Restore(this);
}
}
}
+3 -3
View File
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sensus")]
[assembly: AssemblyProduct("ResultsBrowser")]
[assembly: AssemblyCopyright("Copyright © 2015 - 2022 Sensus Slovensko a.s.")]
[assembly: AssemblyCopyright("Copyright © 2015 - 2020 Sensus Slovensko a.s.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.31.1990.0")]
[assembly: AssemblyFileVersion("2.31.1990.0")]
[assembly: AssemblyVersion("2.26.1577.0")]
[assembly: AssemblyFileVersion("2.26.1577.0")]
+2 -2
View File
@@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -32,7 +32,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;TURA_IPERL_NEW;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
-121
View File
@@ -1,121 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Cfg;
using Results;
using Results.Entities;
using System.IO;
namespace ResultsParser
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Bench: [WR15]");
string bench = Console.ReadLine();
if (bench == string.Empty) bench = "WR15";
string connStr = GetConnectionString(bench);
IList<WaterMeter> strangeWMs = new List<WaterMeter>();
try
{
var session = Fluently.Configure()
.Database(MySQLConfiguration.Standard.ConnectionString(connStr))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<WaterMeterData>())
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory()
.OpenSession();
var mtrs1 = session.QueryOver<MeterTestRslt>()
.Where(mtr => mtr.Error < -2)
.And(mtr => mtr.Passed == true)
.List();
var mtrs2 = session.QueryOver<MeterTestRslt>()
.Where(mtr => mtr.Error > 2)
.And(mtr => mtr.Passed == true)
.List();
foreach (var lst in new IList<MeterTestRslt>[] { mtrs1, mtrs2 })
{
foreach (var mtr in lst)
{
if (mtr.TestRslt.Name() == "Q2" &&
mtr.WaterMeter.Passed &&
!string.IsNullOrEmpty(mtr.WaterMeter.SerialNr) &&
mtr.WaterMeter.WaterMeterData.MetrologicalClass == "R800")
{
strangeWMs.Add(mtr.WaterMeter);
}
}
}
using (TextWriter writer = new StreamWriter(string.Format("strangeWMs-{0}.csv", bench)))
{
foreach (var wm in strangeWMs)
{
writer.WriteLine(string.Format("'{0};{1};{2};{3};{4:dd.MM.yyyy HH:mm};{5:dd.MM.yyyy HH:mm};v.{6};{7}",
wm.SerialNr, bench, wm.WMPosition, wm.Batch.BatchNr, wm.Batch.StartTime, wm.Batch.EndTime, wm.Batch.ProgramVersion, wm.Batch.ProcedureName));
}
}
session.Close();
}
catch (Exception exc)
{
Console.WriteLine("Exception occured:");
Console.WriteLine(exc.Message);
if (exc.InnerException != null)
{
Console.WriteLine("Inner exception:");
Console.WriteLine(exc.InnerException.Message);
}
Console.ReadLine();
Console.WriteLine(exc.StackTrace);
}
Console.WriteLine(string.Format("{0} strange water meters found", strangeWMs.Count));
Console.WriteLine("Press ENTER to close");
Console.ReadLine();
}
static string GetConnectionString(string bench = "WR15")
{
Console.WriteLine("Server: [localhost]");
var server = Console.ReadLine();
if (server == string.Empty) server = "localhost";
Console.WriteLine(string.Format("Database: [st-{0}-r]", bench.ToLower()));
var db = Console.ReadLine();
if (db == string.Empty) db = string.Format("st-{0}-r", bench.ToLower());
Console.WriteLine("User: [root]");
var uid = Console.ReadLine();
if (uid == string.Empty) uid = "root";
Console.WriteLine("Password:");
var pw = Console.ReadLine();
var connStr = string.Format("SERVER={0}; DATABASE={1}; UID={2}; PASSWORD={3}; CHARSET=utf8;", server, db, uid, pw);
Console.WriteLine("Connection string is\r\n {0}", connStr);
Console.WriteLine();
return connStr;
}
static void BuildSchema(Configuration config)
{
/// This NHibernate tool takes a configuration with mapping info and exports a database schema
new NHibernate.Tool.hbm2ddl.SchemaExport(config).SetOutputFile("db_schema");
}
}
}
-36
View File
@@ -1,36 +0,0 @@
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("ResultsParser")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ResultsParser")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[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("90a47d44-c3ab-4528-b19b-0440a521b9af")]
// 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")]
-84
View File
@@ -1,84 +0,0 @@
<?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>{2E08C19B-C0A9-4056-8564-E5B74477959D}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ResultsParser</RootNamespace>
<AssemblyName>ResultsParser</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="FluentNHibernate">
<HintPath>..\..\Production-Monitoring\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
</Reference>
<Reference Include="Iesi.Collections">
<HintPath>..\packages\Iesi.Collections.4.0.0.4000\lib\net40\Iesi.Collections.dll</HintPath>
</Reference>
<Reference Include="MySql.Data">
<HintPath>..\packages\MySql.Data.6.6.5\lib\net40\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="NHibernate">
<HintPath>..\packages\NHibernate.4.0.4.4000\lib\net40\NHibernate.dll</HintPath>
</Reference>
<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="..\Common\Common.csproj">
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\Config\Config.csproj">
<Project>{743df7db-c7b6-42eb-986d-0f485e5588e4}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\Results\Results.csproj">
<Project>{9d0dcc88-dc81-47eb-9fdd-4c3907871bfb}</Project>
<Name>Results</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>
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.27.1800.0")]
[assembly: AssemblyFileVersion("2.27.1800.0")]
[assembly: AssemblyVersion("2.25.1427.0")]
[assembly: AssemblyFileVersion("2.25.1427.0")]
+1 -1
View File
@@ -40,7 +40,7 @@ namespace Statistics
MidOrWaterMetersCtrl ctrl = new MidOrWaterMetersCtrl();
ctrl.MidId = midId;
ctrl.ParentDlg = this;
ctrl.Parent = this;
ctrl.Dock = DockStyle.Fill;
tp.Controls.Add(ctrl);

Some files were not shown because too many files have changed in this diff Show More