Some shared classes and interfaces moved to project Common, re-factorization.

This commit is contained in:
Milan Hanajik 2022-01-23 19:56:15 +01:00
parent a4a583c41a
commit 947d0198c1
163 changed files with 1102 additions and 511 deletions

View File

@ -42,6 +42,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="BackgroundBeep.cs" /> <Compile Include="BackgroundBeep.cs" />
<Compile Include="DatabaseSettings.cs" />
<Compile Include="DBSettings.cs" />
<Compile Include="Enums.cs" /> <Compile Include="Enums.cs" />
<Compile Include="Forms\ListViewEx.cs"> <Compile Include="Forms\ListViewEx.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
@ -58,9 +60,20 @@
<Compile Include="Forms\ModelessForm.designer.cs"> <Compile Include="Forms\ModelessForm.designer.cs">
<DependentUpon>ModelessForm.cs</DependentUpon> <DependentUpon>ModelessForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="GlobalData.cs" />
<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="StatisticalMetrics.cs" />
<Compile Include="Iperl\OptoTelegramRaw.cs" /> <Compile Include="Iperl\OptoTelegramRaw.cs" />
<Compile Include="SerializableDictionary.cs" /> <Compile Include="SerializableDictionary.cs" />
<Compile Include="Telegram.cs" />
<Compile Include="UIControls\CoolButtonCtrl.cs"> <Compile Include="UIControls\CoolButtonCtrl.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
@ -68,6 +81,7 @@
<DependentUpon>CoolButtonCtrl.cs</DependentUpon> <DependentUpon>CoolButtonCtrl.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="UIControls\RoundedRectangle.cs" /> <Compile Include="UIControls\RoundedRectangle.cs" />
<Compile Include="Units.cs" />
<Compile Include="Utils.cs" /> <Compile Include="Utils.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
@ -79,6 +93,7 @@
<DependentUpon>ModelessForm.cs</DependentUpon> <DependentUpon>ModelessForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -1,10 +1,9 @@
/// ///
/// Copyright (c) 2013-2021 Sensus Slovensko a.s. /// Copyright (c) 2021 Sensus Slovensko a.s.
/// ///
using System; using System;
using Common;
namespace Users namespace Common
{ {
/// <summary> /// <summary>
/// Database settings required to make a connection /// Database settings required to make a connection

121
Common/DatabaseSettings.cs Normal file
View File

@ -0,0 +1,121 @@
///
/// 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);
}
}
}

View File

@ -70,8 +70,8 @@ namespace Common
[Description("None")] None, [Description("None")] None,
[Description("Local procedures")] FromLocalDB, [Description("Local procedures")] FromLocalDB,
[Description("Shared procedures")] FromSharedDB, [Description("Shared procedures")] FromSharedDB,
[Description("Orders from Oracle DB")] OrderNrFromOracleDB, [Description("Orders from Oracle DB")] OrderFromOracleDB,
[Description("Orders from Tracing DB")] OrderNrFromTracingDB, [Description("Orders from Tracing DB")] OrderFromTracingDB,
#endif #endif
Count Count
} }

352
Common/Formulas.cs Normal file
View File

@ -0,0 +1,352 @@
///
/// 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);
}
}
}

42
Common/GlobalData.cs Normal file
View File

@ -0,0 +1,42 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
namespace Common
{
public class GlobalData
{
public static double SampleDensity = 0; /// sample water density measured in an accredited labo [kg/m3]
public static double SampleTemp = 0; /// sample temperature when density measured in an accredited labo [°C]
public static double Buoyancy = 0;
public const string AdminUsername = "admin";
public const string AdminPassword = "staratura";
public static DBSettings RemoteUsersDB = null;
public static DBSettings LocalUsersDB = null;
public static IUser CurrentUser;
public static IUser CurrentUser2;
public static IUser CurrentUser3;
public static Common.AuthorizedAs AuthorizedAs;
public static DateTime LastAuthorization = DateTime.Now;
public static int MinPasswdLength = 0;
public static int PasswdExpirationPeriodDays = 0;
public static string GetCurrentUserName()
{
if (CurrentUser == null || CurrentUser.UserName == null)
return string.Empty;
else if (CurrentUser2 == null || CurrentUser2.UserName == null)
return CurrentUser.UserName;
else if (CurrentUser3 == null || CurrentUser3.UserName == null)
return string.Format("{0},{1}", CurrentUser.UserName, CurrentUser2.UserName);
else
return string.Format("{0},{1},{2}", CurrentUser.UserName, CurrentUser2.UserName, CurrentUser3.UserName);
}
}
}

View File

@ -0,0 +1,11 @@
using System;
namespace Common
{
public interface IMeasurementCorrection
{
int RangeIx { get; set; }
float Measurement { get; set; }
float Correction { get; set; }
}
}

26
Common/IOrderInfo.cs Normal file
View File

@ -0,0 +1,26 @@
///
/// 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; }
}
}

View File

@ -1,12 +1,11 @@
/// ///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s. /// Copyright (c) 2013-2021 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml.Serialization; using System.Xml.Serialization;
using Common;
namespace Config.Entities namespace Common
{ {
public interface IParamsProvider public interface IParamsProvider
{ {

14
Common/IUncertainty.cs Normal file
View File

@ -0,0 +1,14 @@
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
Common/IUser.cs Normal file
View File

@ -0,0 +1,22 @@
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);
}
}

View File

@ -2,9 +2,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Printing; using System.Drawing.Printing;
using Common;
namespace Results.Output.Printers namespace Common.Printers
{ {
public class PrintersCommon : PrintDocument public class PrintersCommon : PrintDocument
{ {

View File

@ -1,6 +1,6 @@
using System; using System;
namespace TracingDB namespace Common
{ {
public class QuitAppException : Exception public class QuitAppException : Exception
{ {

View File

@ -1,12 +1,12 @@
/// ///
/// Copyright (c) 2013-2019 Sensus Metering Systems /// Copyright (c) 2013-2021 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace TBF.Rig namespace Common
{ {
public class Telegram public static class Telegram
{ {
const UInt16 crcSeed = 0xFFFF; // Initial crc value const UInt16 crcSeed = 0xFFFF; // Initial crc value
const UInt16 crcGP = 0xA001; // Generating polynomial const UInt16 crcGP = 0xA001; // Generating polynomial
@ -39,13 +39,29 @@ namespace TBF.Rig
/// </summary> /// </summary>
/// <param name="data">Data telegram</param> /// <param name="data">Data telegram</param>
/// <returns>Calculated CRC</returns> /// <returns>Calculated CRC</returns>
public static UInt16 ClaculateTelegramCRC(byte[] data) public static UInt16 CalculateTelegramCRC(byte[] data, int enforcedLen = 0)
{ {
int len = (enforcedLen != 0) ? Math.Min(enforcedLen, data.Length) : data.Length;
UInt16 crc = crcSeed; UInt16 crc = crcSeed;
for (int i = 0; i < data.Length - 2; i++) UpdateCRC(data[i], ref crc); for (int i = 0; i < len - 2; i++) UpdateCRC(data[i], ref crc);
return crc; return crc;
} }
/// <summary>
/// Calculates the CRC from a data telegram (an array of bytes).
/// A complete telegram including two bytes reserved for the CRC
/// must be supplied as an argument.
/// </summary>
/// <param name="data">Data telegram</param>
/// <returns>Calculated CRC</returns>
public static UInt16 CalculateTelegramCRC(int offset, byte[] data, int enforcedLen = 0)
{
int len = (enforcedLen != 0) ? Math.Min(enforcedLen, data.Length - offset) : data.Length - offset;
UInt16 crc = crcSeed;
for (int i = 0; i < len - 2; i++) UpdateCRC(data[offset + i], ref crc);
return crc;
}
/// <summary> /// <summary>
/// This function modifies the last 2 bytes in the message buffer /// This function modifies the last 2 bytes in the message buffer
/// by the CRC calculated from the remaining first (Lenght - 2) bytes. /// by the CRC calculated from the remaining first (Lenght - 2) bytes.
@ -58,7 +74,7 @@ namespace TBF.Rig
int len = data.Length; int len = data.Length;
if (len < 2) return; if (len < 2) return;
UInt16 crc = ClaculateTelegramCRC(data); UInt16 crc = CalculateTelegramCRC(data);
data[len - 2] = (byte)(crc & 0xFF); data[len - 2] = (byte)(crc & 0xFF);
data[len - 1] = (byte)(crc >> 8); data[len - 1] = (byte)(crc >> 8);
@ -72,16 +88,38 @@ namespace TBF.Rig
/// </summary> /// </summary>
/// <param name="data">Data telegram</param> /// <param name="data">Data telegram</param>
/// <returns>true if the CRC in the telegram is correct</returns> /// <returns>true if the CRC in the telegram is correct</returns>
public static bool VerifyTelegramCRC(byte[] data) public static bool VerifyTelegramCRC(byte[] data, int enforcedLen = 0)
{ {
int len = data.Length; if (data == null || data.Length == 0 || enforcedLen > data.Length) return false;
int len = (enforcedLen != 0) ? enforcedLen : data.Length;
if (len < 2) return false; if (len < 2) return false;
UInt16 crc = ClaculateTelegramCRC(data); UInt16 crc = CalculateTelegramCRC(data, len);
return (data[len - 2] == (byte)(crc & 0xFF)) && (data[len - 1] == (byte)(crc >> 8)); return (data[len - 2] == (byte)(crc & 0xFF)) && (data[len - 1] == (byte)(crc >> 8));
} }
/// <summary>
/// This function compares the last 2 bytes in the message buffer
/// with the CRC calculated from the remaining first (Lenght - 2) bytes.
/// A complete telegram including two bytes reserved for the CRC
/// must be supplied as an argument.
/// </summary>
/// <param name="data">Data telegram</param>
/// <returns>true if the CRC in the telegram is correct</returns>
public static bool VerifyTelegramCRC(int offset, byte[] data, int enforcedLen = 0)
{
if (data == null || data.Length == 0 || enforcedLen > data.Length - offset) return false;
int len = (enforcedLen != 0) ? enforcedLen : data.Length - offset;
if (len < 2) return false;
UInt16 crc = CalculateTelegramCRC(offset, data, len);
return (data[offset + len - 2] == (byte)(crc & 0xFF)) && (data[offset + len - 1] == (byte)(crc >> 8));
}
/// <summary> /// <summary>
@ -91,7 +129,7 @@ namespace TBF.Rig
/// </summary> /// </summary>
/// <param name="data">Data telegram</param> /// <param name="data">Data telegram</param>
/// <returns>Calculated checksum</returns> /// <returns>Calculated checksum</returns>
public static byte ClaculateTelegramChecksum(byte[] data) public static byte CalculateTelegramChecksum(byte[] data)
{ {
byte checksum = 0; byte checksum = 0;
for (int i = 0; i < data.Length - 1; i++) checksum = (byte)(checksum ^ data[i]); for (int i = 0; i < data.Length - 1; i++) checksum = (byte)(checksum ^ data[i]);
@ -106,7 +144,7 @@ namespace TBF.Rig
/// <param name="hartPreambLen">Length of HART telegram preamble (FF bytes)</param> /// <param name="hartPreambLen">Length of HART telegram preamble (FF bytes)</param>
/// <param name="data">Data telegram</param> /// <param name="data">Data telegram</param>
/// <returns>Calculated checksum</returns> /// <returns>Calculated checksum</returns>
public static byte ClaculateTelegramChecksum(int hartPreambLen, byte[] data) public static byte CalculateTelegramChecksum(int hartPreambLen, byte[] data)
{ {
byte checksum = 0; byte checksum = 0;
for (int i = hartPreambLen; i < data.Length - 1; i++) checksum = (byte)(checksum ^ data[i]); for (int i = hartPreambLen; i < data.Length - 1; i++) checksum = (byte)(checksum ^ data[i]);
@ -124,7 +162,7 @@ namespace TBF.Rig
{ {
int len = data.Length; int len = data.Length;
if (len < 1) return; if (len < 1) return;
data[len - 1] = ClaculateTelegramChecksum(data); data[len - 1] = CalculateTelegramChecksum(data);
} }
/// <summary> /// <summary>
@ -139,7 +177,7 @@ namespace TBF.Rig
public static void UpdateTelegramChecksum(int hartPreambLen, byte[] data) public static void UpdateTelegramChecksum(int hartPreambLen, byte[] data)
{ {
if (data.Length - hartPreambLen < 1) return; if (data.Length - hartPreambLen < 1) return;
data[data.Length - 1] = ClaculateTelegramChecksum(hartPreambLen, data); data[data.Length - 1] = CalculateTelegramChecksum(hartPreambLen, data);
} }
/// <summary> /// <summary>
@ -154,7 +192,7 @@ namespace TBF.Rig
{ {
int len = data.Length; int len = data.Length;
if (len < 1) return false; if (len < 1) return false;
return (data[len - 1] == ClaculateTelegramChecksum(data)); return (data[len - 1] == CalculateTelegramChecksum(data));
} }
/// <summary> /// <summary>
@ -169,11 +207,10 @@ namespace TBF.Rig
public static bool VerifyTelegramChecksum(int hartPreambLen, byte[] data) public static bool VerifyTelegramChecksum(int hartPreambLen, byte[] data)
{ {
if (data.Length - hartPreambLen < 1) return false; if (data.Length - hartPreambLen < 1) return false;
return (data[data.Length - 1] == ClaculateTelegramChecksum(hartPreambLen, data)); return (data[data.Length - 1] == CalculateTelegramChecksum(hartPreambLen, data));
} }
public static string LogTelegram(string intro, byte[] data, int from = 0, int len = -1) public static string LogTelegram(string intro, byte[] data, int from = 0, int len = -1)
{ {
System.Text.StringBuilder sb = new System.Text.StringBuilder(256); System.Text.StringBuilder sb = new System.Text.StringBuilder(256);
@ -194,6 +231,7 @@ namespace TBF.Rig
return sb.ToString(); return sb.ToString();
} }
public static string LogTelegram(string intro, IList<byte> data, int from = 0, int len = -1) public static string LogTelegram(string intro, IList<byte> data, int from = 0, int len = -1)
{ {
System.Text.StringBuilder sb = new System.Text.StringBuilder(256); System.Text.StringBuilder sb = new System.Text.StringBuilder(256);
@ -215,7 +253,6 @@ namespace TBF.Rig
} }
public static string LogTelegram(string intro, string data) public static string LogTelegram(string intro, string data)
{ {
System.Text.StringBuilder sb = new System.Text.StringBuilder(80); System.Text.StringBuilder sb = new System.Text.StringBuilder(80);

View File

@ -2,11 +2,8 @@
/// Copyright (c) 2016-2021 Sensus Slovensko a.s. /// Copyright (c) 2016-2021 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Reflection;
using Common;
using Config.Entities;
namespace Config namespace Common
{ {
public enum Unit public enum Unit
{ {
@ -360,21 +357,21 @@ namespace Config
} }
} }
public static bool IsVolume(Unit unit) { return IsQuantity(unit, Config.Quantity.Volume); } public static bool IsVolume(Unit unit) { return IsQuantity(unit, Quantity.Volume); }
public static bool IsFlow(Unit unit) { return IsQuantity(unit, Config.Quantity.Flow); } public static bool IsFlow(Unit unit) { return IsQuantity(unit, Quantity.Flow); }
public static bool IsMass(Unit unit) { return IsQuantity(unit, Config.Quantity.Mass); } public static bool IsMass(Unit unit) { return IsQuantity(unit, Quantity.Mass); }
public static bool IsTime(Unit unit) { return IsQuantity(unit, Config.Quantity.Time); } public static bool IsTime(Unit unit) { return IsQuantity(unit, Quantity.Time); }
public static bool IsTemperature(Unit unit) { return IsQuantity(unit, Config.Quantity.Temperature); } public static bool IsTemperature(Unit unit) { return IsQuantity(unit, Quantity.Temperature); }
public static bool IsPressure(Unit unit) { return IsQuantity(unit, Config.Quantity.Pressure); } public static bool IsPressure(Unit unit) { return IsQuantity(unit, Quantity.Pressure); }
public static bool IsHumidity(Unit unit) { return IsQuantity(unit, Config.Quantity.Humidity); } public static bool IsHumidity(Unit unit) { return IsQuantity(unit, Quantity.Humidity); }
public static bool IsError(Unit unit) { return IsQuantity(unit, Config.Quantity.Error); } public static bool IsError(Unit unit) { return IsQuantity(unit, Quantity.Error); }
public static bool IsLength(Unit unit) { return IsQuantity(unit, Config.Quantity.Length); } public static bool IsLength(Unit unit) { return IsQuantity(unit, Quantity.Length); }
public static bool IsDensity(Unit unit) { return IsQuantity(unit, Config.Quantity.Density); } public static bool IsDensity(Unit unit) { return IsQuantity(unit, Quantity.Density); }
public static bool IsEnergy(Unit unit) { return IsQuantity(unit, Config.Quantity.Energy); } public static bool IsEnergy(Unit unit) { return IsQuantity(unit, Quantity.Energy); }
public static bool IsPulses(Unit unit) { return IsQuantity(unit, Config.Quantity.Pulses); } public static bool IsPulses(Unit unit) { return IsQuantity(unit, Quantity.Pulses); }
public static bool IsPulsePerLtr(Unit unit) { return IsQuantity(unit, Config.Quantity.PulsePerLtr); } public static bool IsPulsePerLtr(Unit unit) { return IsQuantity(unit, Quantity.PulsePerLtr); }
public static bool IsPulsePerKWh(Unit unit) { return IsQuantity(unit, Config.Quantity.PulsePerKWh); } public static bool IsPulsePerKWh(Unit unit) { return IsQuantity(unit, Quantity.PulsePerKWh); }
public static bool IsConductivity(Unit unit) { return IsQuantity(unit, Config.Quantity.Conductivity); } public static bool IsConductivity(Unit unit) { return IsQuantity(unit, Quantity.Conductivity); }

View File

@ -69,7 +69,6 @@
<ItemGroup> <ItemGroup>
<Compile Include="CalendarEvent\ICalendarEvent.cs" /> <Compile Include="CalendarEvent\ICalendarEvent.cs" />
<Compile Include="Data.cs" /> <Compile Include="Data.cs" />
<Compile Include="DatabaseSettings.cs" />
<Compile Include="Entities\BenchPath.cs" /> <Compile Include="Entities\BenchPath.cs" />
<Compile Include="Entities\CustomEvent.cs" /> <Compile Include="Entities\CustomEvent.cs" />
<Compile Include="Entities\Component.cs" /> <Compile Include="Entities\Component.cs" />
@ -81,7 +80,6 @@
<Compile Include="Entities\IHasItemNr.cs" /> <Compile Include="Entities\IHasItemNr.cs" />
<Compile Include="Entities\IHasName.cs" /> <Compile Include="Entities\IHasName.cs" />
<Compile Include="Entities\IHasValves.cs" /> <Compile Include="Entities\IHasValves.cs" />
<Compile Include="Entities\IParamsProvider.cs" />
<Compile Include="Entities\MeasurementCorrection.cs" /> <Compile Include="Entities\MeasurementCorrection.cs" />
<Compile Include="Entities\MetersPath.cs" /> <Compile Include="Entities\MetersPath.cs" />
<Compile Include="Entities\OutputPath.cs" /> <Compile Include="Entities\OutputPath.cs" />
@ -124,7 +122,6 @@
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<DependentUpon>Strings.resx</DependentUpon> <DependentUpon>Strings.resx</DependentUpon>
</Compile> </Compile>
<Compile Include="Units.cs" />
<Compile Include="Utils.cs" /> <Compile Include="Utils.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,64 +0,0 @@
///
/// 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);
}
}
}

View File

@ -3,6 +3,7 @@
/// ///
using System; using System;
using System.IO; using System.IO;
using Common;
namespace Config.Entities namespace Config.Entities
{ {

View File

@ -3,6 +3,7 @@
/// ///
using System; using System;
using System.IO; using System.IO;
using Common;
namespace Config.Entities namespace Config.Entities
{ {

View File

@ -1,11 +1,12 @@
/// ///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s. /// Copyright (c) 2013-2021 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Collections.Generic;
namespace Config.Entities namespace Config.Entities
{ {
public class MeasurementCorrection public class MeasurementCorrection : Common.IMeasurementCorrection
{ {
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
public virtual int RangeIx { get; set; } /// 0..5 public virtual int RangeIx { get; set; } /// 0..5
@ -21,5 +22,59 @@ namespace Config.Entities
{ {
RangeIx = rangeIx; RangeIx = rangeIx;
} }
}
/// <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;
}
}
} }

View File

@ -1,11 +1,11 @@
/// ///
/// Copyright (c) 2019 Sensus Slovensko a.s. /// Copyright (c) 2019-2021 Sensus Slovensko a.s.
/// ///
using System; using System;
namespace Config.Entities namespace Config.Entities
{ {
public class Uncertainty public class Uncertainty : Common.IUncertainty
{ {
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
public virtual float Measurement { get; set; } public virtual float Measurement { get; set; }

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using log4net; using log4net;
using Common;
namespace Config namespace Config
{ {
@ -182,7 +183,7 @@ namespace Config
double theta = temp / 100.0; double theta = temp / 100.0;
double B = x0 * (((x3 * theta + x2) * theta + x1) * theta + 1) / (1 + x4 * theta); double B = x0 * (((x3 * theta + x2) * theta + x1) * theta + 1) / (1 + x4 * theta);
return WaterDensityFromTemp(temp) * (1 + B * Config.Units.ConvertTo(Config.Unit.Pa, pressure)); return WaterDensityFromTemp(temp) * (1 + B * Units.ConvertTo(Unit.Pa, pressure));
} }
@ -238,7 +239,7 @@ namespace Config
/// <param name="rawMeasurement">Raw uncorrected value</param> /// <param name="rawMeasurement">Raw uncorrected value</param>
/// <param name="corrections">Sorted (value, correction) pairs</param> /// <param name="corrections">Sorted (value, correction) pairs</param>
/// <returns>Corrected value</returns> /// <returns>Corrected value</returns>
public static double CorrectedValue(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections) public static double CorrectedValue(double rawValue, IList<IMeasurementCorrection> corrections)
{ {
return rawValue + GetCorrection(rawValue, corrections); return rawValue + GetCorrection(rawValue, corrections);
} }
@ -250,7 +251,7 @@ namespace Config
/// <param name="rawMeasurement">Raw uncorrected value</param> /// <param name="rawMeasurement">Raw uncorrected value</param>
/// <param name="corrections">Sorted (value, correction) pairs</param> /// <param name="corrections">Sorted (value, correction) pairs</param>
/// <returns>Corrected value</returns> /// <returns>Corrected value</returns>
public static double GetCorrection(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections) public static double GetCorrection(double rawValue, IList<IMeasurementCorrection> corrections)
{ {
if ((corrections == null) || (corrections.Count == 0)) return 0; /// No correction if ((corrections == null) || (corrections.Count == 0)) return 0; /// No correction
@ -316,11 +317,11 @@ namespace Config
const double p_star_Pa = 16.53E6; /// [Pa] (=16.53 MPa) const double p_star_Pa = 16.53E6; /// [Pa] (=16.53 MPa)
const double T_star = 1386.0; /// [K] const double T_star = 1386.0; /// [K]
double T_in_K = Config.Units.ConvertTo(Config.Unit.K, T_in); double T_in_K = Units.ConvertTo(Unit.K, T_in);
double T_out_K = Config.Units.ConvertTo(Config.Unit.K, T_out); double T_out_K = Units.ConvertTo(Unit.K, T_out);
double tau_in = T_star / T_in_K; double tau_in = T_star / T_in_K;
double tau_out = T_star / T_out_K; double tau_out = T_star / T_out_K;
double pi = Config.Units.ConvertTo(Config.Unit.Pa, pressure) / p_star_Pa; double pi = Units.ConvertTo(Unit.Pa, pressure) / p_star_Pa;
double h_in = tau_in * GammaTau(pi, tau_in) * R * T_in_K; 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 h_out = tau_out * GammaTau(pi, tau_out) * R * T_out_K;

View File

@ -291,7 +291,7 @@ namespace EventViewer
{ {
try try
{ {
Users.GlobalData.RemoteUsersDB = new Users.DBSettings(Common.DBType.MySql, Program.LocalSettings.UsersDBConnString); Users.GlobalData.RemoteUsersDB = new Common.DBSettings(Common.DBType.MySql, Program.LocalSettings.UsersDBConnString);
Users.Forms.LoginDlg dlg = new Users.Forms.LoginDlg(); Users.Forms.LoginDlg dlg = new Users.Forms.LoginDlg();
if (dlg.ShowDialog() == DialogResult.OK) if (dlg.ShowDialog() == DialogResult.OK)
{ {

View File

@ -48,9 +48,9 @@
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Config\Config.csproj"> <ProjectReference Include="..\Common\Common.csproj">
<Project>{743df7db-c7b6-42eb-986d-0f485e5588e4}</Project> <Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
<Name>Config</Name> <Name>Common</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\TBF\TBF.csproj"> <ProjectReference Include="..\TBF\TBF.csproj">
<Project>{8648fd92-cda1-4c3a-b5f9-fe547ce1fa48}</Project> <Project>{8648fd92-cda1-4c3a-b5f9-fe547ce1fa48}</Project>

View File

@ -115,12 +115,12 @@ namespace Results.Forms
{ {
if (e.SubItem == (int)Column.Units) if (e.SubItem == (int)Column.Units)
{ {
Config.Quantity quantity = (e.Item.Tag as ManualEntryItemSpec).Quantity; Quantity quantity = (e.Item.Tag as ManualEntryItemSpec).Quantity;
unitsCB.Items.Clear(); unitsCB.Items.Clear();
unitsCB.Items.Add(Config.Unit.None.ToDescription()); /// "---" unitsCB.Items.Add(Unit.None.ToDescription()); /// "---"
for (Config.Unit u = (Config.Unit)1; u < Config.Unit.Count; u++) for (Unit u = (Unit)1; u < Unit.Count; u++)
{ {
if (Config.Units.IsQuantity(u, quantity)) unitsCB.Items.Add(u.ToDescription()); if (Units.IsQuantity(u, quantity)) unitsCB.Items.Add(u.ToDescription());
} }
selectedResultsListViewEx.StartEditing(unitsCB, e.Item, e.SubItem); selectedResultsListViewEx.StartEditing(unitsCB, e.Item, e.SubItem);
} }
@ -139,7 +139,7 @@ namespace Results.Forms
{ {
case Column.Caption: item.Caption = e.DisplayText; return; case Column.Caption: item.Caption = e.DisplayText; return;
case Column.Units: case Column.Units:
for (Config.Unit u = 0; u < Config.Unit.Count; u++) for (Unit u = 0; u < Unit.Count; u++)
{ {
if (u.ToDescription().Equals(unitsCB.Text)) if (u.ToDescription().Equals(unitsCB.Text))
{ {
@ -190,10 +190,10 @@ namespace Results.Forms
{ {
treeView.Nodes.Clear(); treeView.Nodes.Clear();
IList<Config.Quantity> quantities = new List<Config.Quantity>(); IList<Quantity> quantities = new List<Quantity>();
for (Config.Quantity q = 0; q < Config.Quantity.Count; q++) quantities.Add(q); for (Quantity q = 0; q < Quantity.Count; q++) quantities.Add(q);
IList<Config.Quantity> sortedQuantities = quantities.OrderBy(x => x.ToDescription()).ToList(); IList<Quantity> sortedQuantities = quantities.OrderBy(x => x.ToDescription()).ToList();
foreach (var q in sortedQuantities) foreach (var q in sortedQuantities)
{ {

View File

@ -140,12 +140,12 @@ namespace Results.Forms
{ {
if (e.SubItem == (int)Column.Units) if (e.SubItem == (int)Column.Units)
{ {
Config.Quantity quantity = (e.Item.Tag as WMeterRsltItemSpec).Quantity; Quantity quantity = (e.Item.Tag as WMeterRsltItemSpec).Quantity;
unitsCB.Items.Clear(); unitsCB.Items.Clear();
unitsCB.Items.Add(Config.Unit.None.ToDescription()); /// "---" unitsCB.Items.Add(Unit.None.ToDescription()); /// "---"
for (Config.Unit u = (Config.Unit)1; u < Config.Unit.Count; u++) for (Unit u = (Unit)1; u < Unit.Count; u++)
{ {
if (Config.Units.IsQuantity(u, quantity)) unitsCB.Items.Add(u.ToDescription()); if (Units.IsQuantity(u, quantity)) unitsCB.Items.Add(u.ToDescription());
} }
selectedResultsListViewEx.StartEditing(unitsCB, e.Item, e.SubItem); selectedResultsListViewEx.StartEditing(unitsCB, e.Item, e.SubItem);
} }
@ -164,7 +164,7 @@ namespace Results.Forms
{ {
case Column.Caption: item.Caption = e.DisplayText; return; case Column.Caption: item.Caption = e.DisplayText; return;
case Column.Units: case Column.Units:
for (Config.Unit u = 0; u < Config.Unit.Count; u++) for (Unit u = 0; u < Unit.Count; u++)
{ {
if (u.ToDescription().Equals(unitsCB.Text)) if (u.ToDescription().Equals(unitsCB.Text))
{ {
@ -241,10 +241,10 @@ namespace Results.Forms
{ {
treeView.Nodes.Clear(); treeView.Nodes.Clear();
IList<Config.Quantity> quantities = new List<Config.Quantity>(); IList<Quantity> quantities = new List<Quantity>();
for (Config.Quantity q = 0; q < Config.Quantity.Count; q++) quantities.Add(q); for (Quantity q = 0; q < Quantity.Count; q++) quantities.Add(q);
IList<Config.Quantity> sortedQuantities = quantities.OrderBy(x => x.ToDescription()).ToList(); IList<Quantity> sortedQuantities = quantities.OrderBy(x => x.ToDescription()).ToList();
foreach (var q in sortedQuantities) foreach (var q in sortedQuantities)
{ {

View File

@ -22,7 +22,7 @@ namespace Results
public readonly Quantity Quantity; /// Quantity public readonly Quantity Quantity; /// Quantity
public readonly ItemCategory Category; /// public readonly ItemCategory Category; ///
public string Caption; /// Specifies item description to be printed as a caption (in the header, etc.) public string Caption; /// Specifies item description to be printed as a caption (in the header, etc.)
public Config.Unit Units; /// Specifies units for the output public Unit Units; /// Specifies units for the output
public ManualEntryItemSpec Clone() public ManualEntryItemSpec Clone()
@ -198,7 +198,7 @@ namespace Results
/// ///
item.Caption = field[1].Replace("\n", "~"); item.Caption = field[1].Replace("\n", "~");
item.Units = 0; item.Units = 0;
for (Config.Unit u = 0; u < Config.Unit.Count; u++) for (Unit u = 0; u < Unit.Count; u++)
{ {
if (u.ToString().Equals(field[2])) { item.Units = u; break; } if (u.ToString().Equals(field[2])) { item.Units = u; break; }
} }

View File

@ -14,7 +14,7 @@ using GenCode128;
namespace Results.Output.Printers.Label namespace Results.Output.Printers.Label
{ {
public class LabelPrintDocument : PrintersCommon public class LabelPrintDocument : Common.Printers.PrintersCommon
{ {
static QrEncoder encoder = new QrEncoder(); static QrEncoder encoder = new QrEncoder();

View File

@ -14,7 +14,7 @@ using GenCode128;
namespace Results.Output.Printers.MultiLabel namespace Results.Output.Printers.MultiLabel
{ {
public class MultiLabelPrintDocument : PrintersCommon public class MultiLabelPrintDocument : Common.Printers.PrintersCommon
{ {
static QrEncoder encoder = new QrEncoder(); static QrEncoder encoder = new QrEncoder();

View File

@ -393,7 +393,7 @@ namespace Results.Output.Printers.Munich
Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux); Results.Entities.MeterTestRslt auxMtr = wm.GetMeterTestRslt(mtr.Name(), CompoundMeterId.CompoundAux);
table.AddRow(new string[] { mtr.Name(), table.AddRow(new string[] { mtr.Name(),
Config.Units.ConvertTo(Config.Unit.lph, flow_ctv).ToString("F1"), Units.ConvertTo(Unit.lph, flow_ctv).ToString("F1"),
mtr.TestRslt.VolumeCTV.ToString("F2"), mtr.TestRslt.VolumeCTV.ToString("F2"),
mainMtr.VolumeMeter.ToString("F2"), mainMtr.VolumeMeter.ToString("F2"),
auxMtr.VolumeMeter.ToString("F2"), auxMtr.VolumeMeter.ToString("F2"),
@ -405,7 +405,7 @@ namespace Results.Output.Printers.Munich
else else
{ {
table.AddRow(new string[] { mtr.Name(), table.AddRow(new string[] { mtr.Name(),
Config.Units.ConvertTo(Config.Unit.lph, flow_ctv).ToString("F1"), Units.ConvertTo(Unit.lph, flow_ctv).ToString("F1"),
mtr.TestRslt.VolumeCTV.ToString("F2"), mtr.TestRslt.VolumeCTV.ToString("F2"),
mtr.VolumeMeter.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; double flow_ctv = (mtr.TestRslt.TestTime != 0) ? (3.6 * mtr.TestRslt.VolumeCTV / mtr.TestRslt.TestTime) : 0;
table.AddRow(new string[] { mtr.Name(), table.AddRow(new string[] { mtr.Name(),
Config.Units.ConvertTo(Config.Unit.lph, flow_ctv).ToString("F1"), Units.ConvertTo(Unit.lph, flow_ctv).ToString("F1"),
mtr.TestRslt.TempDownMean.ToString("F2"), mtr.TestRslt.TempDownMean.ToString("F2"),
mtr.TestRslt.DensityDiv.ToString("F2"), mtr.TestRslt.DensityDiv.ToString("F2"),
mtr.TestTime.ToString("F1"), mtr.TestTime.ToString("F1"),
Config.Units.ConvertTo(Config.Unit.bar, mtr.TestRslt.PressUpMean).ToString("F3"), Units.ConvertTo(Unit.bar, mtr.TestRslt.PressUpMean).ToString("F3"),
Config.Units.ConvertTo(Config.Unit.bar, mtr.TestRslt.PressDownMean).ToString("F3") }, Units.ConvertTo(Unit.bar, mtr.TestRslt.PressDownMean).ToString("F3") },
horizontalAlignment, horizontalAlignment,
verticalAlignment); verticalAlignment);
} }
@ -592,7 +592,7 @@ namespace Results.Output.Printers.Munich
iTop += SpacingOne; iTop += SpacingOne;
PrintAt(e, Tab1, iTop, "Luftdruck"); PrintAt(e, Tab1, iTop, "Luftdruck");
PrintAt(e, Tab2, iTop, Config.Units.ConvertTo(Config.Unit.mbar, wm.Batch.AmbPressMean()).ToString("F0") + " mbar"); PrintAt(e, Tab2, iTop, Units.ConvertTo(Unit.mbar, wm.Batch.AmbPressMean()).ToString("F0") + " mbar");
iTop += SpacingOne; iTop += SpacingOne;

View File

@ -11,7 +11,7 @@ using Results.Resources;
namespace Results.Output.Printers.OnePerBatch namespace Results.Output.Printers.OnePerBatch
{ {
public class OnePerBatchPrintDocument : PrintersCommon public class OnePerBatchPrintDocument : Common.Printers.PrintersCommon
{ {
const float GapBetweenTableColumns = 10; const float GapBetweenTableColumns = 10;
const float GapBetweenCommonColumns = 10; const float GapBetweenCommonColumns = 10;

View File

@ -14,7 +14,7 @@ using Results.Resources;
namespace Results.Output.Printers.OnePerMeter namespace Results.Output.Printers.OnePerMeter
{ {
public class OnePerMeterPrintDocument : PrintersCommon public class OnePerMeterPrintDocument : Common.Printers.PrintersCommon
{ {
const float GapBetweenTableColumns = 10; const float GapBetweenTableColumns = 10;
const float GapBetweenCommonColumns = 10; const float GapBetweenCommonColumns = 10;

View File

@ -96,7 +96,7 @@ namespace Results.Output
else else
{ {
bool isHeader = (colIx < Style.LeftHeadersCount) || (rowIx < Style.TopHeadersCount); bool isHeader = (colIx < Style.LeftHeadersCount) || (rowIx < Style.TopHeadersCount);
SizeF size = Printers.PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font); SizeF size = Common.Printers.PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font);
if (size.Width > columnWidth[colIx]) columnWidth[colIx] = size.Width; if (size.Width > columnWidth[colIx]) columnWidth[colIx] = size.Width;
if (size.Height > rowHeight[rowIx]) rowHeight[rowIx] = size.Height; if (size.Height > rowHeight[rowIx]) rowHeight[rowIx] = size.Height;
} }
@ -159,7 +159,7 @@ namespace Results.Output
{ {
/// In not a separator line /// In not a separator line
bool isHeader = (colIx < Style.LeftHeadersCount) || (rowIx < Style.TopHeadersCount); bool isHeader = (colIx < Style.LeftHeadersCount) || (rowIx < Style.TopHeadersCount);
SizeF size = Printers.PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font); SizeF size = Common.Printers.PrintersCommon.Measure(e, Rows[rowIx][colIx], isHeader ? Style.HeaderFont : Style.Font);
if ((Style.ColumnWidths != null) && (Style.ColumnWidths.Length > colIx)) if ((Style.ColumnWidths != null) && (Style.ColumnWidths.Length > colIx))
{ {
size.Width = Style.ColumnWidths[colIx]; /// Override measurement if column width is defined 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++) for (int colIndex = 0; colIndex < tblColumnsCount; colIndex++)
{ {
bool isHeader = (colIndex < Style.LeftHeadersCount) || (rowIndex < Style.TopHeadersCount); bool isHeader = (colIndex < Style.LeftHeadersCount) || (rowIndex < Style.TopHeadersCount);
Printers.PrintersCommon.PrintAt(e, oneTableRow[colIndex], Common.Printers.PrintersCommon.PrintAt(e, oneTableRow[colIndex],
isHeader ? Style.HeaderFont : Style.Font, isHeader ? Style.HeaderFont : Style.Font,
columnPos[colIndex], columnPos[colIndex],
rowPos[rowIndex], rowPos[rowIndex],

View File

@ -16,10 +16,10 @@ namespace Results.Output
{ {
public static Chart GetChart(WaterMeter wm, bool isPrinter) public static Chart GetChart(WaterMeter wm, bool isPrinter)
{ {
return GetChart(wm, isPrinter, Config.Unit.lph); return GetChart(wm, isPrinter, Unit.lph);
} }
public static Chart GetChart(WaterMeter wm, bool isPrinter, Config.Unit flowUnit) public static Chart GetChart(WaterMeter wm, bool isPrinter, Unit flowUnit)
{ {
double maxFlow = 0; double maxFlow = 0;
IList<PointF> unsortedPoints = new List<PointF>(); IList<PointF> unsortedPoints = new List<PointF>();
@ -32,7 +32,7 @@ namespace Results.Output
(td.Publish == (sbyte)Publish.Always || (!isPrinter && td.Publish == (sbyte)Publish.OnScreen))) (td.Publish == (sbyte)Publish.Always || (!isPrinter && td.Publish == (sbyte)Publish.OnScreen)))
{ {
if (flow > maxFlow) maxFlow = flow; if (flow > maxFlow) maxFlow = flow;
unsortedPoints.Add(new PointF((float)Config.Units.ConvertTo(flowUnit, flow), (float)mtr.Error)); unsortedPoints.Add(new PointF((float)Units.ConvertTo(flowUnit, flow), (float)mtr.Error));
} }
} }
IEnumerable<PointF> sortedPoints = unsortedPoints.OrderBy(x => x.X); IEnumerable<PointF> sortedPoints = unsortedPoints.OrderBy(x => x.X);
@ -68,8 +68,8 @@ namespace Results.Output
1000000, 2000000, 5000000, 1000000, 2000000, 5000000,
10000000 }; 10000000 };
double spacer = 0.8; double spacer = 0.8;
double from = Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin); double from = Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin);
double to = Config.Units.ConvertTo(flowUnit, isQ4 ? wm.WaterMeterData.Q4_Qmax : wm.WaterMeterData.Q3_Qn); double to = Units.ConvertTo(flowUnit, isQ4 ? wm.WaterMeterData.Q4_Qmax : wm.WaterMeterData.Q3_Qn);
bool inRange = false; bool inRange = false;
for (int i = 0; i < xs.Count - 3; i += 3) for (int i = 0; i < xs.Count - 3; i += 3)
{ {
@ -112,18 +112,18 @@ namespace Results.Output
Legend legend1 = new Legend { Name = "Legend1" }; Legend legend1 = new Legend { Name = "Legend1" };
Series upperLimit = new Series { Name = Strings.Upper_limit, ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.Red }; Series upperLimit = new Series { Name = Strings.Upper_limit, ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.Red };
upperLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin), 5); upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin), 5);
upperLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), 5); upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), 5);
upperLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), 2); upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), 2);
upperLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q3_Qn), 2); upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q3_Qn), 2);
if (isQ4) upperLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q4_Qmax), 2); if (isQ4) upperLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q4_Qmax), 2);
Series lowerLimit = new Series { Name = Strings.Lower_limit, ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.Red }; Series lowerLimit = new Series { Name = Strings.Lower_limit, ChartArea = "ChartArea1", ChartType = SeriesChartType.Line, Color = Color.Red };
lowerLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin), -5); lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q1_Qmin), -5);
lowerLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), -5); lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), -5);
lowerLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), -2); lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q2_Qt), -2);
lowerLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q3_Qn), -2); lowerLimit.Points.AddXY(Units.ConvertTo(flowUnit, wm.WaterMeterData.Q3_Qn), -2);
if (isQ4) lowerLimit.Points.AddXY(Config.Units.ConvertTo(flowUnit, wm.WaterMeterData.Q4_Qmax), -2); if (isQ4) lowerLimit.Points.AddXY(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 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 }; Series dots = new Series { Name = Strings.Relative_error + " ", ChartArea = "ChartArea1", ChartType = SeriesChartType.Point, Color = Color.RoyalBlue };

View File

@ -157,9 +157,6 @@
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="Output\Printers\OnePerBatch\OnePerBatchPrinterCfg.cs" /> <Compile Include="Output\Printers\OnePerBatch\OnePerBatchPrinterCfg.cs" />
<Compile Include="Output\Printers\PrintersCommon.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Output\Printers\Munich\MunichPrintDocument.cs"> <Compile Include="Output\Printers\Munich\MunichPrintDocument.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>

View File

@ -665,9 +665,9 @@ namespace Results
return FormatDbl(units, format, precisionOrEmpty, dfltPrecision, v, CultureInfo.CurrentCulture); return FormatDbl(units, format, precisionOrEmpty, dfltPrecision, v, CultureInfo.CurrentCulture);
} }
/// ///
public static string FormatDbl(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v, CultureInfo ci) public static string FormatDbl(Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v, CultureInfo ci)
{ {
double val = Config.Units.ConvertTo(units, v); double val = Common.Units.ConvertTo(units, v);
string precision = string.IsNullOrEmpty(precisionOrEmpty) ? dfltPrecision : precisionOrEmpty; string precision = string.IsNullOrEmpty(precisionOrEmpty) ? dfltPrecision : precisionOrEmpty;
@ -704,8 +704,8 @@ namespace Results
/// ///
public static string FormatDbl(Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v1, double v2, CultureInfo ci) public static string FormatDbl(Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v1, double v2, CultureInfo ci)
{ {
double val1 = Config.Units.ConvertTo(units, v1); double val1 = Common.Units.ConvertTo(units, v1);
double val2 = Config.Units.ConvertTo(units, v2); double val2 = Common.Units.ConvertTo(units, v2);
string precision = string.IsNullOrEmpty(precisionOrEmpty) ? dfltPrecision : precisionOrEmpty; string precision = string.IsNullOrEmpty(precisionOrEmpty) ? dfltPrecision : precisionOrEmpty;
@ -819,7 +819,7 @@ namespace Results
item.Caption = field[1].Replace("\n", "~"); item.Caption = field[1].Replace("\n", "~");
item.TestID = field[2]; item.TestID = field[2];
item.Units = 0; item.Units = 0;
for (Config.Unit u = 0; u < Config.Unit.Count; u++) for (Unit u = 0; u < Unit.Count; u++)
{ {
if (u.ToString().Equals(field[3])) { item.Units = u; break; } if (u.ToString().Equals(field[3])) { item.Units = u; break; }
} }

View File

@ -41,7 +41,7 @@ namespace TBF
/// Names and database settings of test benches. /// Names and database settings of test benches.
/// </summary> /// </summary>
[XmlArrayAttribute("TestBenches")] [XmlArrayAttribute("TestBenches")]
public Config.DatabaseSettings[] TestBenches; public DatabaseSettings[] TestBenches;
[XmlIgnore] [XmlIgnore]
public int BenchesCount { get { return (TestBenches != null) ? TestBenches.GetLength(0) : 0; } } public int BenchesCount { get { return (TestBenches != null) ? TestBenches.GetLength(0) : 0; } }

View File

@ -256,8 +256,8 @@ namespace TBF
{ {
log.FatalFormat("Test bench name: {0}", loginDlgBench.BenchName); log.FatalFormat("Test bench name: {0}", loginDlgBench.BenchName);
GlobalData.RemoteUsersDB = LocalSettings.TestBenches[i].UsersDBSettings; Users.GlobalData.RemoteUsersDB = LocalSettings.TestBenches[i].UsersDBSettings;
GlobalData.LocalUsersDB = LocalSettings.TestBenches[i].ProceduresDBSettings; Users.GlobalData.LocalUsersDB = LocalSettings.TestBenches[i].ProceduresDBSettings;
Users.Entities.User loadedUser = null; Users.Entities.User loadedUser = null;
try try
@ -276,7 +276,7 @@ namespace TBF
authorized = loadedUser.Authorize(loginDlgBench.Alias, loginDlgBench.Password, reqGrpMembership); authorized = loadedUser.Authorize(loginDlgBench.Alias, loginDlgBench.Password, reqGrpMembership);
if (authorized) if (authorized)
{ {
GlobalData.AuthorizedAs = Common.AuthorizedAs.PowerUser; Users.GlobalData.AuthorizedAs = Common.AuthorizedAs.PowerUser;
} }
} }
@ -285,7 +285,7 @@ namespace TBF
/// ///
if (!authorized) if (!authorized)
{ {
DBSettings[] dbs = new DBSettings[] { GlobalData.RemoteUsersDB, GlobalData.LocalUsersDB }; DBSettings[] dbs = new DBSettings[] { Users.GlobalData.RemoteUsersDB, Users.GlobalData.LocalUsersDB };
authorizedAs = Common.AuthorizedAs.RemoteUser; /// Try remote DB first authorizedAs = Common.AuthorizedAs.RemoteUser; /// Try remote DB first
@ -356,7 +356,7 @@ namespace TBF
/// Copy the selected bench settings to CurrentBench. /// Copy the selected bench settings to CurrentBench.
/// Clone() guarantees that current bench settings wont be modified /// Clone() guarantees that current bench settings wont be modified
/// when user modifies the database settings in DatabaseSettingsDlg. /// when user modifies the database settings in DatabaseSettingsDlg.
TBF.DB.CurrentBench = (Config.DatabaseSettings)LocalSettings.TestBenches[i].Clone(); TBF.DB.CurrentBench = (DatabaseSettings)LocalSettings.TestBenches[i].Clone();
Results.DB.DbType = TBF.DB.CurrentBench.WaterMetersDBSettings.DbType; Results.DB.DbType = TBF.DB.CurrentBench.WaterMetersDBSettings.DbType;
Results.DB.ConnectionString = TBF.DB.CurrentBench.WaterMetersDBSettings.ConnectionString; Results.DB.ConnectionString = TBF.DB.CurrentBench.WaterMetersDBSettings.ConnectionString;

View File

@ -13,7 +13,7 @@ namespace TBF.Rig.DataContainers.BackupAndSecurityOptions
/// <summary> /// <summary>
/// Holds backup and security options - serializable configuration. /// Holds backup and security options - serializable configuration.
/// </summary> /// </summary>
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -111,7 +111,7 @@ namespace TBF.Rig.DataContainers.BackupAndSecurityOptions
prms.PasswdExpirationPeriodDays = this.PasswdExpirationPeriodDays; prms.PasswdExpirationPeriodDays = this.PasswdExpirationPeriodDays;
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
ComponentCfg pars = new ComponentCfg(); ComponentCfg pars = new ComponentCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -304,7 +304,7 @@ namespace TBF.Rig.DataContainers.BenchInfo.Extended
prms.LenghtUnit = this.LenghtUnit; prms.LenghtUnit = this.LenghtUnit;
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
ComponentCfg pars = new ComponentCfg(); ComponentCfg pars = new ComponentCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -15,7 +15,7 @@ namespace TBF.Rig.DataContainers.BenchInfo.iPerl
/// <summary> /// <summary>
/// Holds information identifying the test bench - serializable configuration. /// Holds information identifying the test bench - serializable configuration.
/// </summary> /// </summary>
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -351,7 +351,7 @@ namespace TBF.Rig.DataContainers.BenchInfo.iPerl
prms.MaxTestIndex = this.MaxTestIndex; prms.MaxTestIndex = this.MaxTestIndex;
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
ComponentCfg pars = new ComponentCfg(); ComponentCfg pars = new ComponentCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -13,7 +13,7 @@ namespace TBF.Rig.DataContainers.Buoyancy
/// <summary> /// <summary>
/// Holds backup and security options - serializable configuration. /// Holds backup and security options - serializable configuration.
/// </summary> /// </summary>
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -114,7 +114,7 @@ namespace TBF.Rig.DataContainers.Buoyancy
prms.Buoyancy = this.Buoyancy; prms.Buoyancy = this.Buoyancy;
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
ComponentCfg pars = new ComponentCfg(); ComponentCfg pars = new ComponentCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -13,7 +13,7 @@ namespace TBF.Rig.DataContainers.Density
/// <summary> /// <summary>
/// Holds backup and security options - serializable configuration. /// Holds backup and security options - serializable configuration.
/// </summary> /// </summary>
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -124,7 +124,7 @@ namespace TBF.Rig.DataContainers.Density
prms.AtTemperature = this.AtTemperature; prms.AtTemperature = this.AtTemperature;
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
ComponentCfg pars = new ComponentCfg(); ComponentCfg pars = new ComponentCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -22,7 +22,7 @@ namespace TBF.Rig.DataContainers.Evaporation
/// </summary> /// </summary>
public double EvaporationRate(double temperature) public double EvaporationRate(double temperature)
{ {
return Config.Formulas.GetCorrection(temperature, Corrections) / 3600.0; /// Converted from kg/h to kg/s return MeasurementCorrection.GetCorrection(temperature, Corrections) / 3600.0; /// Converted from kg/h to kg/s
} }

View File

@ -115,7 +115,7 @@ namespace TBF.Rig.DataEntry.DataStream
prms.ShowCycleEndForm = this.ShowCycleEndForm; prms.ShowCycleEndForm = this.ShowCycleEndForm;
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
EntryFormCfg pars = new EntryFormCfg(); EntryFormCfg pars = new EntryFormCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -179,7 +179,7 @@ namespace TBF.Rig.DataEntry.Double24
prms.Column2Destination = Column2Destination; prms.Column2Destination = Column2Destination;
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
EntryFormCfg pars = new EntryFormCfg(); EntryFormCfg pars = new EntryFormCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -19,13 +19,13 @@ namespace TBF.Rig.DataEntry.HeatMeters12
/// ///
/// Serialized parameters /// Serialized parameters
/// ///
public Config.Unit DefaultUnits; public Common.Unit DefaultUnits;
public bool EnterSerialNrsAtTheEnd; public bool EnterSerialNrsAtTheEnd;
public bool ShowCycleEndForm; public bool ShowCycleEndForm;
public bool SensusExtensions; public bool SensusExtensions;
[XmlIgnore] [XmlIgnore]
public Config.Unit Units; public Common.Unit Units;
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
EntryFormCfg() EntryFormCfg()
@ -39,7 +39,7 @@ namespace TBF.Rig.DataEntry.HeatMeters12
Factory = factory; Factory = factory;
ParentName = string.Empty; ParentName = string.Empty;
DefaultUnits = Config.Unit.kWh; DefaultUnits = Common.Unit.kWh;
EnterSerialNrsAtTheEnd = false; EnterSerialNrsAtTheEnd = false;
ShowCycleEndForm = false; ShowCycleEndForm = false;
SensusExtensions = false; SensusExtensions = false;

View File

@ -204,9 +204,9 @@ namespace TBF.Rig.DataEntry.HeatMeters12
{ {
Localize(); Localize();
for (Config.Unit units = 0; units < Config.Unit.Count; units++) for (Common.Unit units = 0; units < Common.Unit.Count; units++)
{ {
if (Config.Units.IsEnergy(units)) unitsComboBox.Items.Add(units.ToString()); if (Common.Units.IsEnergy(units)) unitsComboBox.Items.Add(units.ToString());
} }
unitsComboBox.Text = entryFormCfg.Units.ToString(); unitsComboBox.Text = entryFormCfg.Units.ToString();
@ -283,7 +283,7 @@ namespace TBF.Rig.DataEntry.HeatMeters12
private void unitsComboBox_SelectedIndexChanged(object sender, EventArgs e) private void unitsComboBox_SelectedIndexChanged(object sender, EventArgs e)
{ {
for (Config.Unit u = 0; u < Config.Unit.Count; u++) for (Common.Unit u = 0; u < Common.Unit.Count; u++)
{ {
if (u.ToString() == unitsComboBox.Text) if (u.ToString() == unitsComboBox.Text)
{ {
@ -304,7 +304,7 @@ namespace TBF.Rig.DataEntry.HeatMeters12
if (endTextBoxes[i].Visible && endTextBoxes[i].Enabled) if (endTextBoxes[i].Visible && endTextBoxes[i].Enabled)
{ {
WMEndState[i] = Utils.ParseUDouble(endTextBoxes[i].Text); WMEndState[i] = Utils.ParseUDouble(endTextBoxes[i].Text);
EnergyEndState[i] = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(energyEndTextBoxes[i].Text)); EnergyEndState[i] = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(energyEndTextBoxes[i].Text));
} }
} }
} }
@ -317,7 +317,7 @@ namespace TBF.Rig.DataEntry.HeatMeters12
WMStartStateStr[i] = startTextBoxes[i].Text; WMStartStateStr[i] = startTextBoxes[i].Text;
WMStartState[i] = Utils.ParseUDouble(startTextBoxes[i].Text); WMStartState[i] = Utils.ParseUDouble(startTextBoxes[i].Text);
EnergyStartStateStr[i] = energyStartTextBoxes[i].Text; EnergyStartStateStr[i] = energyStartTextBoxes[i].Text;
EnergyStartState[i] = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(energyStartTextBoxes[i].Text)); EnergyStartState[i] = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(energyStartTextBoxes[i].Text));
} }
} }
} }
@ -507,8 +507,8 @@ namespace TBF.Rig.DataEntry.HeatMeters12
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox13.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox13.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox13.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox13.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -519,8 +519,8 @@ namespace TBF.Rig.DataEntry.HeatMeters12
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox14.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox14.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox14.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox14.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -531,8 +531,8 @@ namespace TBF.Rig.DataEntry.HeatMeters12
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox15.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox15.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox15.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox15.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -543,8 +543,8 @@ namespace TBF.Rig.DataEntry.HeatMeters12
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox16.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox16.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox16.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox16.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -555,8 +555,8 @@ namespace TBF.Rig.DataEntry.HeatMeters12
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox17.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox17.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox17.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox17.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -567,8 +567,8 @@ namespace TBF.Rig.DataEntry.HeatMeters12
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox18.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox18.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox18.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox18.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -579,8 +579,8 @@ namespace TBF.Rig.DataEntry.HeatMeters12
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox19.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox19.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox19.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox19.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -591,8 +591,8 @@ namespace TBF.Rig.DataEntry.HeatMeters12
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox20.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox20.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox20.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox20.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -603,8 +603,8 @@ namespace TBF.Rig.DataEntry.HeatMeters12
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox21.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox21.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox21.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox21.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -615,8 +615,8 @@ namespace TBF.Rig.DataEntry.HeatMeters12
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox22.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox22.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox22.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox22.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -627,8 +627,8 @@ namespace TBF.Rig.DataEntry.HeatMeters12
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox23.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox23.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox23.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox23.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -639,8 +639,8 @@ namespace TBF.Rig.DataEntry.HeatMeters12
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox24.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox24.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox24.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox24.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };

View File

@ -19,13 +19,13 @@ namespace TBF.Rig.DataEntry.HeatMeters6
/// ///
/// Serialized parameters /// Serialized parameters
/// ///
public Config.Unit DefaultUnits; public Common.Unit DefaultUnits;
public bool EnterSerialNrsAtTheEnd; public bool EnterSerialNrsAtTheEnd;
public bool ShowCycleEndForm; public bool ShowCycleEndForm;
public bool SensusExtensions; public bool SensusExtensions;
[XmlIgnore] [XmlIgnore]
public Config.Unit Units; public Common.Unit Units;
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
EntryFormCfg() EntryFormCfg()
@ -39,7 +39,7 @@ namespace TBF.Rig.DataEntry.HeatMeters6
Factory = factory; Factory = factory;
ParentName = string.Empty; ParentName = string.Empty;
DefaultUnits = Config.Unit.kWh; DefaultUnits = Common.Unit.kWh;
EnterSerialNrsAtTheEnd = false; EnterSerialNrsAtTheEnd = false;
ShowCycleEndForm = false; ShowCycleEndForm = false;
SensusExtensions = false; SensusExtensions = false;

View File

@ -196,9 +196,9 @@ namespace TBF.Rig.DataEntry.HeatMeters6
{ {
Localize(); Localize();
for (Config.Unit units = 0; units < Config.Unit.Count; units++) for (Common.Unit units = 0; units < Common.Unit.Count; units++)
{ {
if (Config.Units.IsEnergy(units)) unitsComboBox.Items.Add(units.ToString()); if (Common.Units.IsEnergy(units)) unitsComboBox.Items.Add(units.ToString());
} }
unitsComboBox.Text = entryFormCfg.Units.ToString(); unitsComboBox.Text = entryFormCfg.Units.ToString();
@ -275,7 +275,7 @@ namespace TBF.Rig.DataEntry.HeatMeters6
private void unitsComboBox_SelectedIndexChanged(object sender, EventArgs e) private void unitsComboBox_SelectedIndexChanged(object sender, EventArgs e)
{ {
for (Config.Unit u = 0; u < Config.Unit.Count; u++) for (Common.Unit u = 0; u < Common.Unit.Count; u++)
{ {
if (u.ToString() == unitsComboBox.Text) if (u.ToString() == unitsComboBox.Text)
{ {
@ -296,7 +296,7 @@ namespace TBF.Rig.DataEntry.HeatMeters6
if (endTextBoxes[i].Visible && endTextBoxes[i].Enabled) if (endTextBoxes[i].Visible && endTextBoxes[i].Enabled)
{ {
WMEndState[i] = Utils.ParseUDouble(endTextBoxes[i].Text); WMEndState[i] = Utils.ParseUDouble(endTextBoxes[i].Text);
EnergyEndState[i] = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(energyEndTextBoxes[i].Text)); EnergyEndState[i] = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(energyEndTextBoxes[i].Text));
} }
} }
} }
@ -309,7 +309,7 @@ namespace TBF.Rig.DataEntry.HeatMeters6
WMStartStateStr[i] = startTextBoxes[i].Text; WMStartStateStr[i] = startTextBoxes[i].Text;
WMStartState[i] = Utils.ParseUDouble(startTextBoxes[i].Text); WMStartState[i] = Utils.ParseUDouble(startTextBoxes[i].Text);
EnergyStartStateStr[i] = energyStartTextBoxes[i].Text; EnergyStartStateStr[i] = energyStartTextBoxes[i].Text;
EnergyStartState[i] = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(energyStartTextBoxes[i].Text)); EnergyStartState[i] = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(energyStartTextBoxes[i].Text));
} }
} }
} }
@ -426,8 +426,8 @@ namespace TBF.Rig.DataEntry.HeatMeters6
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox13.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox13.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox13.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox13.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -438,8 +438,8 @@ namespace TBF.Rig.DataEntry.HeatMeters6
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox14.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox14.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox14.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox14.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -450,8 +450,8 @@ namespace TBF.Rig.DataEntry.HeatMeters6
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox15.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox15.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox15.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox15.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -462,8 +462,8 @@ namespace TBF.Rig.DataEntry.HeatMeters6
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox16.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox16.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox16.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox16.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -474,8 +474,8 @@ namespace TBF.Rig.DataEntry.HeatMeters6
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox17.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox17.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox17.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox17.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };
@ -486,8 +486,8 @@ namespace TBF.Rig.DataEntry.HeatMeters6
double err = 0; double err = 0;
try try
{ {
double endState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox18.Text)); double endState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(endTextBox18.Text));
double startState = Config.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox18.Text)); double startState = Common.Units.ConvertFrom(entryFormCfg.Units, Utils.ParseUDouble(startTextBox18.Text));
err = 100.0 * (endState - startState - refEnergy) / refEnergy; err = 100.0 * (endState - startState - refEnergy) / refEnergy;
} }
catch { err = 1000.0f; }; catch { err = 1000.0f; };

View File

@ -40,7 +40,7 @@ namespace TBF.Rig.DataEntry.Standard24
System.Windows.Forms.Form modelessDlg; System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } } public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
Config.Unit volumeUnit; Common.Unit volumeUnit;
double refVolume; double refVolume;
double errLimLo; double errLimLo;
double errLimHi; double errLimHi;
@ -76,7 +76,7 @@ namespace TBF.Rig.DataEntry.Standard24
wmStartStateStr = new string[TBF.Data.WMsCount]; wmStartStateStr = new string[TBF.Data.WMsCount];
wmEndState = new double[TBF.Data.WMsCount]; wmEndState = new double[TBF.Data.WMsCount];
wmCycleEndState = new string[TBF.Data.WMsCount]; wmCycleEndState = new string[TBF.Data.WMsCount];
volumeUnit = (TBF.Rig.Sequences.ProcessData.BenchInfo != null) ? TBF.Rig.Sequences.ProcessData.BenchInfo.VolumeUnit : Config.Unit.l; volumeUnit = (TBF.Rig.Sequences.ProcessData.BenchInfo != null) ? TBF.Rig.Sequences.ProcessData.BenchInfo.VolumeUnit : Common.Unit.l;
currentOp = CurrentOp.None; currentOp = CurrentOp.None;
log.FatalFormat("{0} initialized: {1}", Name, this); log.FatalFormat("{0} initialized: {1}", Name, this);
} }

View File

@ -170,11 +170,11 @@ namespace TBF.Rig.Elde
if (nr % 2 == 1) if (nr % 2 == 1)
{ {
text = string.Format("T = {0:F1} °F", Config.Units.ConvertTo(Config.Unit.F, temp)); text = string.Format("T = {0:F1} °F", Common.Units.ConvertTo(Common.Unit.F, temp));
} }
else if (temp != 0) else if (temp != 0)
{ {
text = string.Format("SP = {0:F1} °F", Config.Units.ConvertTo(Config.Unit.F, temp)); text = string.Format("SP = {0:F1} °F", Common.Units.ConvertTo(Common.Unit.F, temp));
} }
else else
{ {

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using log4net; using log4net;
using Config.Entities;
using Dirichlet.Numerics; using Dirichlet.Numerics;
using TBF.Rig.Generic; using TBF.Rig.Generic;
using TBF.Boxes; using TBF.Boxes;
@ -51,7 +52,7 @@ namespace TBF.Rig.Elde.Diverter
/// </summary> /// </summary>
public double TestTimeCorrection(double flow) public double TestTimeCorrection(double flow)
{ {
return Config.Formulas.GetCorrection(flow, Corrections); return MeasurementCorrection.GetCorrection(flow, Corrections);
} }

View File

@ -1,11 +1,9 @@
/// ///
/// Copyright (c) 2013-2016 Sensus Metering Systems /// Copyright (c) 2013-2016 Sensus Metering Systems
/// ///
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using Config.Entities; using Common;
using TBF.Rig.Generic; using TBF.Rig.Generic;
namespace TBF.Rig.Elde.FixedStartRegisterReader namespace TBF.Rig.Elde.FixedStartRegisterReader

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using log4net; using log4net;
using Config.Entities;
using TBF.Boxes; using TBF.Boxes;
using TBF.Resources; using TBF.Resources;
@ -26,12 +27,12 @@ namespace TBF.Rig.Elde.FlowMeter
if (flow == 0) return LtrPerPulse; /// To avoid division by zero if (flow == 0) return LtrPerPulse; /// To avoid division by zero
/// Apply correction /// Apply correction
var rangeCorrections = new List<Config.Entities.MeasurementCorrection>(); var rangeCorrections = new List<MeasurementCorrection>();
foreach (var corr in Corrections) foreach (var corr in Corrections)
{ {
if (corr.RangeIx == rangeIx) rangeCorrections.Add(corr); if (corr.RangeIx == rangeIx) rangeCorrections.Add(corr);
} }
double correctedFlow = Config.Formulas.CorrectedValue(flow, rangeCorrections); double correctedFlow = MeasurementCorrection.CorrectedValue(flow, rangeCorrections);
return (LtrPerPulse * correctedFlow / flow); return (LtrPerPulse * correctedFlow / flow);
} }

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using log4net; using log4net;
using Config.Entities;
using TBF.Boxes; using TBF.Boxes;
namespace TBF.Rig.Elde.FlowMeterTriplet namespace TBF.Rig.Elde.FlowMeterTriplet
@ -23,7 +24,7 @@ namespace TBF.Rig.Elde.FlowMeterTriplet
public double LtrPerPulseCorrected(double flow, int rangeIx) public double LtrPerPulseCorrected(double flow, int rangeIx)
{ {
/// Apply correction /// Apply correction
double correctedFlow = Config.Formulas.CorrectedValue(flow, Corrections); double correctedFlow = MeasurementCorrection.CorrectedValue(flow, Corrections);
return (LtrPerPulse * correctedFlow / flow); return (LtrPerPulse * correctedFlow / flow);
} }

View File

@ -93,8 +93,8 @@ namespace TBF.Rig.Elde.PressureMeter
/// <returns>Pressure in mBar</returns> /// <returns>Pressure in mBar</returns>
public float ReadPressure() public float ReadPressure()
{ {
double rawPressure = Config.Units.ConvertFrom(Config.Unit.kPa, ControlBoard.Pressure(Idx0)); double rawPressure = Common.Units.ConvertFrom(Common.Unit.kPa, ControlBoard.Pressure(Idx0));
double correctedPressure = Config.Formulas.CorrectedValue(rawPressure, Corrections); double correctedPressure = Config.Entities.MeasurementCorrection.CorrectedValue(rawPressure, Corrections);
return (float)correctedPressure; return (float)correctedPressure;
} }

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using log4net; using log4net;
using Config.Entities;
using TBF.Rig.GenericDevices; using TBF.Rig.GenericDevices;
using TBF.Boxes; using TBF.Boxes;
@ -97,8 +98,8 @@ namespace TBF.Rig.Elde.RegulValve
nominalFlow = flowMeter.NominalFlow; nominalFlow = flowMeter.NominalFlow;
maximalFlow = nominalFlow * 1.25; maximalFlow = nominalFlow * 1.25;
double rdrdFlowLoBeforeCorr = requiredFlowLo - Config.Formulas.GetCorrection(requiredFlowLo, flowMeter.Corrections); double rdrdFlowLoBeforeCorr = requiredFlowLo - MeasurementCorrection.GetCorrection(requiredFlowLo, flowMeter.Corrections);
double rdrdFlowHiBeforeCorr = requiredFlowHi - Config.Formulas.GetCorrection(requiredFlowHi, flowMeter.Corrections); double rdrdFlowHiBeforeCorr = requiredFlowHi - MeasurementCorrection.GetCorrection(requiredFlowHi, flowMeter.Corrections);
this.reqFlowAve = (rdrdFlowLoBeforeCorr + rdrdFlowHiBeforeCorr) / 2; this.reqFlowAve = (rdrdFlowLoBeforeCorr + rdrdFlowHiBeforeCorr) / 2;
this.requiredFlowLo = (RqrdFlowRangeRatio * rdrdFlowLoBeforeCorr) + ((1 - RqrdFlowRangeRatio) * this.reqFlowAve); /// Move the lower limit a bit of the range up this.requiredFlowLo = (RqrdFlowRangeRatio * rdrdFlowLoBeforeCorr) + ((1 - RqrdFlowRangeRatio) * this.reqFlowAve); /// Move the lower limit a bit of the range up
this.requiredFlowHi = (RqrdFlowRangeRatio * rdrdFlowHiBeforeCorr) + ((1 - RqrdFlowRangeRatio) * this.reqFlowAve); /// Move the upper limit a bit of the range down this.requiredFlowHi = (RqrdFlowRangeRatio * rdrdFlowHiBeforeCorr) + ((1 - RqrdFlowRangeRatio) * this.reqFlowAve); /// Move the upper limit a bit of the range down

View File

@ -87,7 +87,7 @@ namespace TBF.Rig.Elde.TempMeter
{ {
if (Cfg.DebugLevel == DebugMode.Normal) if (Cfg.DebugLevel == DebugMode.Normal)
{ {
return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections); return Config.Entities.MeasurementCorrection.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections);
} }
else if (Cfg.DebugLevel == DebugMode.Simulate) else if (Cfg.DebugLevel == DebugMode.Simulate)
{ {

View File

@ -80,7 +80,7 @@ namespace TBF.Rig.Elde.TempMeterInternal
public double ReadTemperature() public double ReadTemperature()
{ {
return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections); return Config.Entities.MeasurementCorrection.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections);
} }
/// <summary> /// <summary>

View File

@ -73,7 +73,7 @@ namespace TBF.Rig.Elde.TempMeterMeret
public double ReadTemperature() public double ReadTemperature()
{ {
return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(tempMtrCfg.TempIdx0), Corrections); return Config.Entities.MeasurementCorrection.CorrectedValue((double)ControlBoard.Temperature(tempMtrCfg.TempIdx0), Corrections);
} }
/// <summary> /// <summary>

View File

@ -11,7 +11,7 @@ using TBF.Rig.Generic;
namespace TBF.Rig.Elde.TempMeterMeret namespace TBF.Rig.Elde.TempMeterMeret
{ {
public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, Config.Entities.IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -175,7 +175,7 @@ namespace TBF.Rig.Elde.TempMeterMeret
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
TempMeterCfg pars = new TempMeterCfg(); TempMeterCfg pars = new TempMeterCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -11,7 +11,7 @@ using TBF.Rig.Generic;
namespace TBF.Rig.Hart.Common namespace TBF.Rig.Hart.Common
{ {
public class HartCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider public class HartCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(HartCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(HartCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -234,7 +234,7 @@ namespace TBF.Rig.Hart.Common
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
HartCfg pars = new HartCfg(); HartCfg pars = new HartCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -196,7 +196,7 @@ namespace TBF.Rig.Hart.Nivotrack
/// <returns></returns> /// <returns></returns>
public double ReadLevel() public double ReadLevel()
{ {
return Config.Formulas.CorrectedValue(rawLevel_mm, Corrections); return Config.Entities.MeasurementCorrection.CorrectedValue(rawLevel_mm, Corrections);
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>

View File

@ -12,7 +12,7 @@ using TBF.Rig.Generic;
namespace TBF.Rig.Hart.Nivotrack namespace TBF.Rig.Hart.Nivotrack
{ {
public class NivotrackCfg : ComponentCfgBase, Generic.IChildComponentCfg, Config.Entities.IParamsProvider, GenericDevices.ICalibInfoCfg public class NivotrackCfg : ComponentCfgBase, Generic.IChildComponentCfg, IParamsProvider, GenericDevices.ICalibInfoCfg
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(NivotrackCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(NivotrackCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -182,7 +182,7 @@ namespace TBF.Rig.Hart.Nivotrack
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
NivotrackCfg pars = new NivotrackCfg(); NivotrackCfg pars = new NivotrackCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -285,7 +285,7 @@ namespace TBF.Rig.MettlerToledo.Standard
/// Get the serial number /// Get the serial number
/// </summary> /// </summary>
/// <remarks>After a successful SetUnits(kg) mass is still sent in g. MH 15.10.2013</remarks> /// <remarks>After a successful SetUnits(kg) mass is still sent in g. MH 15.10.2013</remarks>
public void SendSetUnitsCmd(Config.Unit unit) public void SendSetUnitsCmd(Common.Unit unit)
{ {
if (balanceCfg.DebugLevel == DebugMode.Simulate) return; if (balanceCfg.DebugLevel == DebugMode.Simulate) return;
@ -305,23 +305,23 @@ namespace TBF.Rig.MettlerToledo.Standard
stringBuilder.Clear(); stringBuilder.Clear();
switch (unit) switch (unit)
{ {
case Config.Unit.g: case Common.Unit.g:
log.InfoFormat("{0} - SetUnits({1}) - \"U g\\r\\n\"", Name, unit); log.InfoFormat("{0} - SetUnits({1}) - \"U g\\r\\n\"", Name, unit);
serialPort.Write("U g\r\n"); serialPort.Write("U g\r\n");
break; break;
case Config.Unit.t: case Common.Unit.t:
log.InfoFormat("{0} - SetUnits({1}) - \"U t\\r\\n\"", Name, unit); log.InfoFormat("{0} - SetUnits({1}) - \"U t\\r\\n\"", Name, unit);
serialPort.Write("U t\r\n"); serialPort.Write("U t\r\n");
break; break;
case Config.Unit.lb: case Common.Unit.lb:
log.InfoFormat("{0} - SetUnits({1}) - \"U lb\\r\\n\"", Name, unit); log.InfoFormat("{0} - SetUnits({1}) - \"U lb\\r\\n\"", Name, unit);
serialPort.Write("U lb\r\n"); serialPort.Write("U lb\r\n");
break; break;
case Config.Unit.oz: case Common.Unit.oz:
log.InfoFormat("{0} - SetUnits({1}) - \"U oz\\r\\n\"", Name, unit); log.InfoFormat("{0} - SetUnits({1}) - \"U oz\\r\\n\"", Name, unit);
serialPort.Write("U oz\r\n"); serialPort.Write("U oz\r\n");
break; break;
case Config.Unit.kg: case Common.Unit.kg:
default: default:
log.InfoFormat("{0} - SetUnits({1}) - \"U kg\\r\\n\"", Name, unit); log.InfoFormat("{0} - SetUnits({1}) - \"U kg\\r\\n\"", Name, unit);
serialPort.Write("U kg\r\n"); serialPort.Write("U kg\r\n");
@ -430,7 +430,7 @@ namespace TBF.Rig.MettlerToledo.Standard
CultureInfo.InvariantCulture, CultureInfo.InvariantCulture,
out mass)) out mass))
{ {
mass = Config.Units.ConvertFrom(ParseUnit(field[2]), mass); mass = Common.Units.ConvertFrom(ParseUnit(field[2]), mass);
Masses[balanceNr] = mass; Masses[balanceNr] = mass;
msrmntState = MsrmntState.Valid; msrmntState = MsrmntState.Valid;
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Mass = {2}", Name, received, mass); log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Mass = {2}", Name, received, mass);
@ -441,7 +441,7 @@ namespace TBF.Rig.MettlerToledo.Standard
CultureInfo.InvariantCulture, CultureInfo.InvariantCulture,
out mass)) out mass))
{ {
mass = Config.Units.ConvertFrom(ParseUnit(field[3]), mass); mass = Common.Units.ConvertFrom(ParseUnit(field[3]), mass);
Masses[balanceNr] = mass; Masses[balanceNr] = mass;
msrmntState = MsrmntState.Valid; msrmntState = MsrmntState.Valid;
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Mass = {2}", Name, received, mass); log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Mass = {2}", Name, received, mass);
@ -469,7 +469,7 @@ namespace TBF.Rig.MettlerToledo.Standard
CultureInfo.InvariantCulture, CultureInfo.InvariantCulture,
out mass)) out mass))
{ {
mass = Config.Units.ConvertFrom(ParseUnit(field[2]), mass); mass = Common.Units.ConvertFrom(ParseUnit(field[2]), mass);
Masses[balanceNr] = mass; Masses[balanceNr] = mass;
msrmntState = MsrmntState.Valid; msrmntState = MsrmntState.Valid;
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Mass = {2}", Name, received, mass); log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Mass = {2}", Name, received, mass);
@ -497,7 +497,7 @@ namespace TBF.Rig.MettlerToledo.Standard
CultureInfo.InvariantCulture, CultureInfo.InvariantCulture,
out mass)) out mass))
{ {
mass = Config.Units.ConvertFrom(ParseUnit(field[2]), mass); mass = Common.Units.ConvertFrom(ParseUnit(field[2]), mass);
msrmntState = MsrmntState.Valid; msrmntState = MsrmntState.Valid;
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Tara = {2}", Name, received, mass); log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Tara = {2}", Name, received, mass);
} }
@ -515,7 +515,7 @@ namespace TBF.Rig.MettlerToledo.Standard
CultureInfo.InvariantCulture, CultureInfo.InvariantCulture,
out mass)) out mass))
{ {
mass = Config.Units.ConvertFrom(ParseUnit(field[3]), mass); mass = Common.Units.ConvertFrom(ParseUnit(field[3]), mass);
msrmntState = MsrmntState.Valid; msrmntState = MsrmntState.Valid;
log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Tara = {2}", Name, received, mass); log.InfoFormat("{0} - Balance response = \"{1}<cr><lf>\", Tara = {2}", Name, received, mass);
} }
@ -623,13 +623,13 @@ namespace TBF.Rig.MettlerToledo.Standard
/// </summary> /// </summary>
/// <param name="unitStr">String: "kg", "g", "t", "lb" or "oz" expected</param> /// <param name="unitStr">String: "kg", "g", "t", "lb" or "oz" expected</param>
/// <returns></returns> /// <returns></returns>
protected Config.Unit ParseUnit(string unitStr) protected Common.Unit ParseUnit(string unitStr)
{ {
if (unitStr == "g") return Config.Unit.g; if (unitStr == "g") return Common.Unit.g;
if (unitStr == "t") return Config.Unit.t; if (unitStr == "t") return Common.Unit.t;
if (unitStr == "lb") return Config.Unit.lb; if (unitStr == "lb") return Common.Unit.lb;
if (unitStr == "oz") return Config.Unit.oz; if (unitStr == "oz") return Common.Unit.oz;
return Config.Unit.kg; return Common.Unit.kg;
} }
} }
} }

View File

@ -162,7 +162,7 @@ namespace TBF.Rig.MettlerToledo.Standard
double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite, double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite,
CultureInfo.InvariantCulture, out mass)) CultureInfo.InvariantCulture, out mass))
{ {
mass = Config.Units.ConvertFrom(ParseUnit(field[3]), mass); mass = Common.Units.ConvertFrom(ParseUnit(field[3]), mass);
Masses[balanceNr] = mass; Masses[balanceNr] = mass;
msrmntState = MsrmntState.Valid; msrmntState = MsrmntState.Valid;
log.InfoFormat("{0} - Balance response = {1}, Mass = {2}", Name, log.InfoFormat("{0} - Balance response = {1}, Mass = {2}", Name,
@ -205,7 +205,7 @@ namespace TBF.Rig.MettlerToledo.Standard
double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite, double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite,
CultureInfo.InvariantCulture, out mass)) CultureInfo.InvariantCulture, out mass))
{ {
mass = Config.Units.ConvertFrom(ParseUnit(field[3]), mass); mass = Common.Units.ConvertFrom(ParseUnit(field[3]), mass);
msrmntState = MsrmntState.Valid; msrmntState = MsrmntState.Valid;
log.WarnFormat("{0} - Balance response = {1}, Mass = {2}", Name, log.WarnFormat("{0} - Balance response = {1}, Mass = {2}", Name,
received.Replace("\r", "<cr>").Replace("\n", "<lf>"), mass); received.Replace("\r", "<cr>").Replace("\n", "<lf>"), mass);
@ -270,7 +270,7 @@ namespace TBF.Rig.MettlerToledo.Standard
/// </summary> /// </summary>
/// <param name="units"></param> /// <param name="units"></param>
/// <returns>SetUnitsOp instance reference casted to IOperaton</returns> /// <returns>SetUnitsOp instance reference casted to IOperaton</returns>
public IOperation SetUnitsOp(Config.Unit units) public IOperation SetUnitsOp(Common.Unit units)
{ {
return new SetUnitsOp(this, units); return new SetUnitsOp(this, units);
} }

View File

@ -123,7 +123,7 @@ namespace TBF.Rig.MettlerToledo.Standard
double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite, double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite,
CultureInfo.InvariantCulture, out mass)) CultureInfo.InvariantCulture, out mass))
{ {
mass = Config.Units.ConvertFrom(ParseUnit(field[3]), mass); mass = Common.Units.ConvertFrom(ParseUnit(field[3]), mass);
Masses[balanceNr] = mass; Masses[balanceNr] = mass;
msrmntState = MsrmntState.Valid; msrmntState = MsrmntState.Valid;
log.InfoFormat("{0} - Balance response = {1}, Mass = {2}", Name, log.InfoFormat("{0} - Balance response = {1}, Mass = {2}", Name,
@ -133,7 +133,7 @@ namespace TBF.Rig.MettlerToledo.Standard
double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite, double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite,
CultureInfo.InvariantCulture, out mass)) CultureInfo.InvariantCulture, out mass))
{ {
mass = Config.Units.ConvertFrom(ParseUnit(field[3]), mass); mass = Common.Units.ConvertFrom(ParseUnit(field[3]), mass);
Masses[balanceNr] = mass; Masses[balanceNr] = mass;
msrmntState = MsrmntState.Valid; msrmntState = MsrmntState.Valid;
log.InfoFormat("{0} - Balance response = {1}, Mass = {2}", Name, log.InfoFormat("{0} - Balance response = {1}, Mass = {2}", Name,
@ -176,7 +176,7 @@ namespace TBF.Rig.MettlerToledo.Standard
double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite, double.TryParse(field[2], NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite,
CultureInfo.InvariantCulture, out mass)) CultureInfo.InvariantCulture, out mass))
{ {
mass = Config.Units.ConvertFrom(ParseUnit(field[3]), mass); mass = Common.Units.ConvertFrom(ParseUnit(field[3]), mass);
msrmntState = MsrmntState.Valid; msrmntState = MsrmntState.Valid;
log.InfoFormat("{0} - Balance response = {1}, Mass = {2}", Name, log.InfoFormat("{0} - Balance response = {1}, Mass = {2}", Name,
received.Replace("\r", "<cr>").Replace("\n", "<lf>"), mass); received.Replace("\r", "<cr>").Replace("\n", "<lf>"), mass);
@ -231,7 +231,7 @@ namespace TBF.Rig.MettlerToledo.Standard
/// </summary> /// </summary>
/// <param name="units"></param> /// <param name="units"></param>
/// <returns>SetUnitsOp instance reference casted to IOperaton</returns> /// <returns>SetUnitsOp instance reference casted to IOperaton</returns>
public IOperation SetUnitsOp(Config.Unit units) public IOperation SetUnitsOp(Common.Unit units)
{ {
return new SetUnitsOp(this, units); return new SetUnitsOp(this, units);
} }

View File

@ -16,7 +16,7 @@ namespace TBF.Rig.MettlerToledo.Standard
/// Set by the constructor /// Set by the constructor
BalanceDev scale; BalanceDev scale;
Config.Unit units; Common.Unit units;
bool activityStarted; bool activityStarted;
/// <summary> /// <summary>
@ -24,7 +24,7 @@ namespace TBF.Rig.MettlerToledo.Standard
/// </summary> /// </summary>
/// <param name="scale">Balance device instance</param> /// <param name="scale">Balance device instance</param>
/// <param name="result">Reference to the serialNumber</param> /// <param name="result">Reference to the serialNumber</param>
public SetUnitsOp(BalanceDev scale, Config.Unit units) public SetUnitsOp(BalanceDev scale, Common.Unit units)
{ {
if (scale == null) throw new ArgumentNullException("balanceDev"); if (scale == null) throw new ArgumentNullException("balanceDev");
this.scale = scale; this.scale = scale;

View File

@ -1,10 +1,9 @@
/// ///
/// Copyright (c) 2017 Sensus Metering Systems /// Copyright (c) 2017 Sensus Metering Systems
/// ///
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml.Serialization; using System.Xml.Serialization;
using Config.Entities; using Common;
using TBF.Rig.Generic; using TBF.Rig.Generic;
namespace TBF.Rig.Modbus.Easytherm namespace TBF.Rig.Modbus.Easytherm

View File

@ -1,10 +1,9 @@
/// ///
/// Copyright (c) 2021 Sensus Slovensko a.s. /// Copyright (c) 2021 Sensus Slovensko a.s.
/// ///
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml.Serialization; using System.Xml.Serialization;
using Config.Entities; using Common;
using TBF.Rig.Generic; using TBF.Rig.Generic;
namespace TBF.Rig.Modbus.Novus namespace TBF.Rig.Modbus.Novus

View File

@ -47,8 +47,8 @@ namespace TBF.Rig.Modbus.PressureMeter.Meret
/// <returns>Pressure in mBar</returns> /// <returns>Pressure in mBar</returns>
public float ReadPressure() public float ReadPressure()
{ {
double rawPressure = Config.Units.ConvertFrom(Config.Unit.kPa, receivedPressure); double rawPressure = Units.ConvertFrom(Unit.kPa, receivedPressure);
double correctedPressure = Config.Formulas.CorrectedValue(rawPressure, Corrections); double correctedPressure = Config.Entities.MeasurementCorrection.CorrectedValue(rawPressure, Corrections);
return (float)correctedPressure; return (float)correctedPressure;
} }

View File

@ -11,7 +11,7 @@ using TBF.Rig.Generic;
namespace TBF.Rig.Modbus.UltrasoundLevelMeter namespace TBF.Rig.Modbus.UltrasoundLevelMeter
{ {
public class LevelMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg, Config.Entities.IParamsProvider public class LevelMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg, IParamsProvider
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(LevelMeterCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(LevelMeterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -131,7 +131,7 @@ namespace TBF.Rig.Modbus.UltrasoundLevelMeter
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
LevelMeterCfg pars = new LevelMeterCfg(); LevelMeterCfg pars = new LevelMeterCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -11,7 +11,7 @@ using TBF.Rig.Generic;
namespace TBF.Rig.Modbus.WaterAnalyzer namespace TBF.Rig.Modbus.WaterAnalyzer
{ {
public class AnalyzerCfg : ComponentCfgBase, Generic.IChildComponentCfg, Config.Entities.IParamsProvider public class AnalyzerCfg : ComponentCfgBase, Generic.IChildComponentCfg, IParamsProvider
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(AnalyzerCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(AnalyzerCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -132,7 +132,7 @@ namespace TBF.Rig.Modbus.WaterAnalyzer
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
AnalyzerCfg pars = new AnalyzerCfg(); AnalyzerCfg pars = new AnalyzerCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -11,7 +11,7 @@ using TBF.Rig.Generic;
namespace TBF.Rig.Modbus.WaterAnalyzer2 namespace TBF.Rig.Modbus.WaterAnalyzer2
{ {
public class AnalyzerCfg : ComponentCfgBase, Generic.IChildComponentCfg, Config.Entities.IParamsProvider public class AnalyzerCfg : ComponentCfgBase, Generic.IChildComponentCfg, IParamsProvider
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(AnalyzerCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(AnalyzerCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -155,7 +155,7 @@ namespace TBF.Rig.Modbus.WaterAnalyzer2
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
AnalyzerCfg pars = new AnalyzerCfg(); AnalyzerCfg pars = new AnalyzerCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -245,7 +245,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
while (dr.Read()) while (dr.Read())
{ {
int pruefungsNr = dr.GetInt32(0); int pruefungsNr = dr.GetInt32(0);
double flow = Config.Units.ConvertFrom(Unit.lph, dr.GetDouble(1)); double flow = Common.Units.ConvertFrom(Unit.lph, dr.GetDouble(1));
int testTime = dr.GetInt32(2); int testTime = dr.GetInt32(2);
double errLimHi = dr.GetDouble(3); double errLimHi = dr.GetDouble(3);
double errLimLo = dr.GetDouble(4); double errLimLo = dr.GetDouble(4);

View File

@ -14,7 +14,7 @@ namespace TBF.Rig.Output.EventTriggers.Iperl
/// <summary> /// <summary>
/// Serializable configuration of Output.EventTriggers.Standard component. /// Serializable configuration of Output.EventTriggers.Standard component.
/// </summary> /// </summary>
public class TriggerCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider public class TriggerCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TriggerCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TriggerCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -156,7 +156,7 @@ namespace TBF.Rig.Output.EventTriggers.Iperl
prms.PrintCaption = this.PrintCaption; prms.PrintCaption = this.PrintCaption;
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
TriggerCfg pars = new TriggerCfg(); TriggerCfg pars = new TriggerCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -14,7 +14,7 @@ namespace TBF.Rig.Output.EventTriggers.Standard
/// <summary> /// <summary>
/// Serializable configuration of Output.EventTriggers.Standard component. /// Serializable configuration of Output.EventTriggers.Standard component.
/// </summary> /// </summary>
public class TriggerCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider public class TriggerCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TriggerCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TriggerCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -403,7 +403,7 @@ namespace TBF.Rig.Output.EventTriggers.Standard
prms.E36 = this.E36; /// 34 or 37 prms.E36 = this.E36; /// 34 or 37
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
TriggerCfg pars = new TriggerCfg(); TriggerCfg pars = new TriggerCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -511,7 +511,7 @@ namespace TBF.Rig.Output.FileWriters.IperlLogger
void WriteOneToDisk(TextWriter logger, string id, Results.Entities.TestRslt tr) void WriteOneToDisk(TextWriter logger, string id, Results.Entities.TestRslt tr)
{ {
logger.WriteLine(string.Format("Prüfvolumen{0}={1}", id, Config.Units.ConvertTo(Unit.l, tr.TestData.TargetVolume).ToString(Program.AltCulture))); logger.WriteLine(string.Format("Prüfvolumen{0}={1}", id, Common.Units.ConvertTo(Unit.l, tr.TestData.TargetVolume).ToString(Program.AltCulture)));
logger.WriteLine(string.Format("Prüfmasse{0}={1}", id, 0)); /// 3,72610 logger.WriteLine(string.Format("Prüfmasse{0}={1}", id, 0)); /// 3,72610
logger.WriteLine(string.Format("Temp1_P{0}={1}", id, 0)); /// 20,0 logger.WriteLine(string.Format("Temp1_P{0}={1}", id, 0)); /// 20,0
logger.WriteLine(string.Format("Temp2_P{0}={1}", id, 0)); /// 20,0 logger.WriteLine(string.Format("Temp2_P{0}={1}", id, 0)); /// 20,0
@ -521,8 +521,8 @@ namespace TBF.Rig.Output.FileWriters.IperlLogger
logger.WriteLine(string.Format("Temp6_P{0}={1}", id, 0)); /// 20,0 logger.WriteLine(string.Format("Temp6_P{0}={1}", id, 0)); /// 20,0
logger.WriteLine(string.Format("Temp7_P{0}={1}", id, 0)); /// 0,0 logger.WriteLine(string.Format("Temp7_P{0}={1}", id, 0)); /// 0,0
logger.WriteLine(string.Format("Temp8_P{0}={1}", id, 0)); /// 0,0 logger.WriteLine(string.Format("Temp8_P{0}={1}", id, 0)); /// 0,0
logger.WriteLine(string.Format("Druck1_P{0}={1}", id, Config.Units.ConvertTo(Unit.bar, tr.PressUpMean).ToString(Program.AltCulture))); logger.WriteLine(string.Format("Druck1_P{0}={1}", id, Common.Units.ConvertTo(Unit.bar, tr.PressUpMean).ToString(Program.AltCulture)));
logger.WriteLine(string.Format("Druck2_P{0}={1}", id, Config.Units.ConvertTo(Unit.bar, tr.PressDownMean).ToString(Program.AltCulture))); logger.WriteLine(string.Format("Druck2_P{0}={1}", id, Common.Units.ConvertTo(Unit.bar, tr.PressDownMean).ToString(Program.AltCulture)));
logger.WriteLine(string.Format("K-Faktor{0}={1}", id, 0)); /// 0,99820080 logger.WriteLine(string.Format("K-Faktor{0}={1}", id, 0)); /// 0,99820080
logger.WriteLine(string.Format("Q_Waage{0}={1}", id, 0)); /// 26,89887 logger.WriteLine(string.Format("Q_Waage{0}={1}", id, 0)); /// 26,89887
logger.WriteLine(string.Format("Q_Vergleich{0}={1}", id, 0)); /// 26,83427 logger.WriteLine(string.Format("Q_Vergleich{0}={1}", id, 0)); /// 26,83427
@ -534,8 +534,8 @@ namespace TBF.Rig.Output.FileWriters.IperlLogger
logger.WriteLine(string.Format("VZ_Nummer{0}={1}", id, 0)); /// 3 logger.WriteLine(string.Format("VZ_Nummer{0}={1}", id, 0)); /// 3
logger.WriteLine(string.Format("Anfangsgewicht{0}={1}", id, 0)); /// 4,66535 logger.WriteLine(string.Format("Anfangsgewicht{0}={1}", id, 0)); /// 4,66535
logger.WriteLine(string.Format("Endgewicht{0}={1}", id, 0)); /// 8,39145 logger.WriteLine(string.Format("Endgewicht{0}={1}", id, 0)); /// 8,39145
logger.WriteLine(string.Format("MinDurchfluss{0}={1}", id, Config.Units.ConvertTo(Unit.lph, tr.FlowMin).ToString(Program.AltCulture))); logger.WriteLine(string.Format("MinDurchfluss{0}={1}", id, Common.Units.ConvertTo(Unit.lph, tr.FlowMin).ToString(Program.AltCulture)));
logger.WriteLine(string.Format("MaxDurchfluss{0}={1}", id, Config.Units.ConvertTo(Unit.lph, tr.FlowMax).ToString(Program.AltCulture))); logger.WriteLine(string.Format("MaxDurchfluss{0}={1}", id, Common.Units.ConvertTo(Unit.lph, tr.FlowMax).ToString(Program.AltCulture)));
logger.WriteLine(string.Format("Q_Einstellzeit{0}={1}", id, 0)); /// 4,17 logger.WriteLine(string.Format("Q_Einstellzeit{0}={1}", id, 0)); /// 4,17
logger.WriteLine(string.Format("Pumpennummer{0}={1}", id, 0)); /// 3 logger.WriteLine(string.Format("Pumpennummer{0}={1}", id, 0)); /// 3
logger.WriteLine(string.Format("Drehzahl{0}={1}", id, 0)); /// 1743 logger.WriteLine(string.Format("Drehzahl{0}={1}", id, 0)); /// 1743

View File

@ -11,7 +11,7 @@ using TBF.Resources;
namespace TBF.Rig.Output.FileWriters.IperlLogger namespace TBF.Rig.Output.FileWriters.IperlLogger
{ {
public class WriterCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider public class WriterCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(WriterCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(WriterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -139,7 +139,7 @@ namespace TBF.Rig.Output.FileWriters.IperlLogger
prms.DayFolders = this.DayFolders; prms.DayFolders = this.DayFolders;
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
WriterCfg pars = new WriterCfg(); WriterCfg pars = new WriterCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -184,7 +184,7 @@ namespace TBF.Rig.Output.FlexFlow
prms.SendUserId = this.SendUserId; prms.SendUserId = this.SendUserId;
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
FlexFlowCfg pars = new FlexFlowCfg(); FlexFlowCfg pars = new FlexFlowCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Xml.Serialization; using System.Xml.Serialization;
using Common;
using Config.Entities; using Config.Entities;
namespace TBF.Rig namespace TBF.Rig

View File

@ -13,7 +13,7 @@ namespace TBF.Rig.RegisterReaders.DataStream.MefImport
/// <summary> /// <summary>
/// Holds information identifying the test bench - serializable configuration. /// Holds information identifying the test bench - serializable configuration.
/// </summary> /// </summary>
public class MefImportCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider public class MefImportCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(MefImportCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(MefImportCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -108,7 +108,7 @@ namespace TBF.Rig.RegisterReaders.DataStream.MefImport
prms.CatalogDir = this.CatalogDir; prms.CatalogDir = this.CatalogDir;
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
MefImportCfg pars = new MefImportCfg(); MefImportCfg pars = new MefImportCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -13,7 +13,7 @@ namespace TBF.Rig.RegisterReaders.DataStream.Reader
/// <summary> /// <summary>
/// Holds information identifying the test bench - serializable configuration. /// Holds information identifying the test bench - serializable configuration.
/// </summary> /// </summary>
public class ReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg, Config.Entities.IParamsProvider public class ReaderCfg : ComponentCfgBase, Generic.IChildComponentCfg, IParamsProvider
{ {
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ReaderCfg) })[0]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ReaderCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; } public override XmlSerializer GetSerializer() { return Serializer; }
@ -118,7 +118,7 @@ namespace TBF.Rig.RegisterReaders.DataStream.Reader
prms.Position = this.Position; prms.Position = this.Position;
} }
public Config.Entities.IParamsProvider Clone() public IParamsProvider Clone()
{ {
ReaderCfg pars = new ReaderCfg(); ReaderCfg pars = new ReaderCfg();
CopyContentTo(pars); CopyContentTo(pars);

View File

@ -168,7 +168,7 @@ namespace TBF.Rig.RegisterReaders.KPackE.Radio
for (int offset = 0; offset <= (data.Count - MinRcvdTlgrmLen); offset++) for (int offset = 0; offset <= (data.Count - MinRcvdTlgrmLen); offset++)
{ {
if (DataFitFrame(data, offset, KPackETelegramFrame) && if (DataFitFrame(data, offset, KPackETelegramFrame) &&
(data[offset + 14] == Telegram.ClaculateTelegramChecksum(SubArray(data, offset + 2, 12)))) (data[offset + 14] == Telegram.CalculateTelegramChecksum(SubArray(data, offset + 2, 12))))
{ {
/// Read the telegram /// Read the telegram
KPackE_Type type = (KPackE_Type)((data[offset + 4] >> 5) & 0x07); KPackE_Type type = (KPackE_Type)((data[offset + 4] >> 5) & 0x07);

View File

@ -1,11 +1,9 @@
/// ///
/// Copyright (c) 2018 Sensus Slovensko a.s. /// Copyright (c) 2018 Sensus Slovensko a.s.
/// ///
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using Config.Entities; using Common;
using TBF.Rig.Generic; using TBF.Rig.Generic;
namespace TBF.Rig.RegisterReaders.KPackE.RegisterReader namespace TBF.Rig.RegisterReaders.KPackE.RegisterReader

View File

@ -3,7 +3,7 @@
/// ///
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml.Serialization; using System.Xml.Serialization;
using Config.Entities; using Common;
using TBF.Rig.Generic; using TBF.Rig.Generic;
namespace TBF.Rig.RegisterReaders.PulsesFromEldeCB namespace TBF.Rig.RegisterReaders.PulsesFromEldeCB

View File

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Common;
namespace TBF.Rig.RegisterReaders.SerialStream namespace TBF.Rig.RegisterReaders.SerialStream
{ {
@ -10,13 +11,13 @@ namespace TBF.Rig.RegisterReaders.SerialStream
public readonly int FrameLength; /// Frame length in characters/bytes, 0 = unknown public readonly int FrameLength; /// Frame length in characters/bytes, 0 = unknown
public readonly double FrameFrequency; /// Number of frames per second (Hz) public readonly double FrameFrequency; /// Number of frames per second (Hz)
public readonly Config.Unit VolumeUnits; public readonly Unit VolumeUnits;
public readonly double VolumeScaleFactor; /// Volume in VolumeInits = volmeRaw / VolumeScaleFactor public readonly double VolumeScaleFactor; /// Volume in VolumeInits = volmeRaw / VolumeScaleFactor
public readonly int VolumeFieldStart; /// Start of the volume field: 0-based index of the first character, -1 = no volume field in the frame public readonly int VolumeFieldStart; /// Start of the volume field: 0-based index of the first character, -1 = no volume field in the frame
public readonly int VolumeFieldEnd; /// End of the volume field: 0-based index of the last character public readonly int VolumeFieldEnd; /// End of the volume field: 0-based index of the last character
public readonly FieldFormat VolumeFieldFormat; /// Hexadecimal or Decimal public readonly FieldFormat VolumeFieldFormat; /// Hexadecimal or Decimal
public readonly Config.Unit TimeUnits; public readonly Unit TimeUnits;
public readonly double TimeScaleFactor; /// Time in TimeUnits = timeRaw / TimeScaleFactor public readonly double TimeScaleFactor; /// Time in TimeUnits = timeRaw / TimeScaleFactor
public readonly int TimeFieldStart; /// Start of the time field: 0-based index of the first character, -1 = no time field in the frame public readonly int TimeFieldStart; /// Start of the time field: 0-based index of the first character, -1 = no time field in the frame
public readonly int TimeFieldEnd; /// End of the time field: 0-based index of the last character public readonly int TimeFieldEnd; /// End of the time field: 0-based index of the last character
@ -38,9 +39,9 @@ namespace TBF.Rig.RegisterReaders.SerialStream
public readonly long RawTimeIncrementPerFrame; public readonly long RawTimeIncrementPerFrame;
public FrameFormat(int frameLength, double frameFrequency, public FrameFormat(int frameLength, double frameFrequency,
Config.Unit volumeUnits, double volumeScaleFactor, Unit volumeUnits, double volumeScaleFactor,
int volumeFieldStart, int volumeFieldEnd, FieldFormat volumeFieldFormat, int volumeFieldStart, int volumeFieldEnd, FieldFormat volumeFieldFormat,
Config.Unit timeUnits, double timeScaleFactor, Unit timeUnits, double timeScaleFactor,
int timeFieldStart, int timeFieldEnd, FieldFormat timeFieldFormat) int timeFieldStart, int timeFieldEnd, FieldFormat timeFieldFormat)
{ {
FrameLength = frameLength; FrameLength = frameLength;

View File

@ -20,13 +20,13 @@ namespace TBF.Rig.RegisterReaders.SerialStream
public int FrameLength; /// Frame length in characters/bytes, 0 = unknown public int FrameLength; /// Frame length in characters/bytes, 0 = unknown
public double FrameFrequency; /// Number of frames per second, 0 = unknown public double FrameFrequency; /// Number of frames per second, 0 = unknown
public Config.Unit VolumeUnits; public Common.Unit VolumeUnits;
public double VolumeScaleFactor; /// Volume = public double VolumeScaleFactor; /// Volume =
public int VolumeFieldStart; /// Start of the volume field: 0-based index of the first character, -1 = no volume field in the frame public int VolumeFieldStart; /// Start of the volume field: 0-based index of the first character, -1 = no volume field in the frame
public int VolumeFieldEnd; /// End of the volume field: 0-based index of the last character public int VolumeFieldEnd; /// End of the volume field: 0-based index of the last character
public FieldFormat VolumeFieldFormat; /// Hexadecimal or Decimal public FieldFormat VolumeFieldFormat; /// Hexadecimal or Decimal
public Config.Unit TimeUnits; public Common.Unit TimeUnits;
public double TimeScaleFactor; /// Time = public double TimeScaleFactor; /// Time =
public int TimeFieldStart; /// Start of the time field: 0-based index of the first character, -1 = no time field in the frame public int TimeFieldStart; /// Start of the time field: 0-based index of the first character, -1 = no time field in the frame
public int TimeFieldEnd; /// End of the time field: 0-based index of the last character public int TimeFieldEnd; /// End of the time field: 0-based index of the last character
@ -40,13 +40,13 @@ namespace TBF.Rig.RegisterReaders.SerialStream
FrameLength = 42; FrameLength = 42;
FrameFrequency = 8; FrameFrequency = 8;
VolumeUnits = Config.Unit.l; VolumeUnits = Common.Unit.l;
VolumeScaleFactor = 16000; VolumeScaleFactor = 16000;
VolumeFieldStart = 17; VolumeFieldStart = 17;
VolumeFieldEnd = 22; VolumeFieldEnd = 22;
VolumeFieldFormat = FieldFormat.HexadecimalWindow; VolumeFieldFormat = FieldFormat.HexadecimalWindow;
TimeUnits = Config.Unit.s; TimeUnits = Common.Unit.s;
TimeScaleFactor = 8192; TimeScaleFactor = 8192;
TimeFieldStart = 29; TimeFieldStart = 29;
TimeFieldEnd = 36; TimeFieldEnd = 36;
@ -112,9 +112,9 @@ namespace TBF.Rig.RegisterReaders.SerialStream
case 2: FrameFrequency = Utils.ParseUDouble(strValue); return CfgUpdateFlags.None; case 2: FrameFrequency = Utils.ParseUDouble(strValue); return CfgUpdateFlags.None;
case 3: case 3:
for (Config.Unit u = 0; u < Config.Unit.Count; u++) for (Unit u = 0; u < Unit.Count; u++)
{ {
if (Config.Units.IsQuantity(u, Config.Quantity.Volume) && u.ToDescription().Equals(strValue)) if (Units.IsQuantity(u, Quantity.Volume) && u.ToDescription().Equals(strValue))
{ {
VolumeUnits = u; VolumeUnits = u;
return CfgUpdateFlags.None; return CfgUpdateFlags.None;
@ -132,9 +132,9 @@ namespace TBF.Rig.RegisterReaders.SerialStream
break; break;
case 8: case 8:
for (Config.Unit u = 0; u < Config.Unit.Count; u++) for (Unit u = 0; u < Unit.Count; u++)
{ {
if (Config.Units.IsQuantity(u, Config.Quantity.Time) && u.ToDescription().Equals(strValue)) if (Units.IsQuantity(u, Quantity.Time) && u.ToDescription().Equals(strValue))
{ {
TimeUnits = u; TimeUnits = u;
return CfgUpdateFlags.None; return CfgUpdateFlags.None;
@ -180,9 +180,9 @@ namespace TBF.Rig.RegisterReaders.SerialStream
break; break;
case 3: case 3:
for (Config.Unit u = 0; u < Config.Unit.Count; u++) for (Unit u = 0; u < Unit.Count; u++)
{ {
if (Config.Units.IsQuantity(u, Config.Quantity.Volume) && u.ToDescription().Equals(strValue)) if (Units.IsQuantity(u, Quantity.Volume) && u.ToDescription().Equals(strValue))
{ {
return true; return true;
} }
@ -199,9 +199,9 @@ namespace TBF.Rig.RegisterReaders.SerialStream
break; break;
case 8: case 8:
for (Config.Unit u = 0; u < Config.Unit.Count; u++) for (Unit u = 0; u < Unit.Count; u++)
{ {
if (Config.Units.IsQuantity(u, Config.Quantity.Time) && u.ToDescription().Equals(strValue)) if (Units.IsQuantity(u, Quantity.Time) && u.ToDescription().Equals(strValue))
{ {
return true; return true;
} }

View File

@ -44,13 +44,13 @@ namespace TBF.Rig.RegisterReaders.SerialStream
public int FrameLength { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.FrameLength : 0; } } public int FrameLength { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.FrameLength : 0; } }
public double FrameFrequency { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.FrameFrequency : 0; } } public double FrameFrequency { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.FrameFrequency : 0; } }
public Config.Unit VolumeUnits { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.VolumeUnits : Config.Unit.l; } } public Common.Unit VolumeUnits { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.VolumeUnits : Common.Unit.l; } }
public double VolumeScaleFactor { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.VolumeScaleFactor : 1; } } public double VolumeScaleFactor { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.VolumeScaleFactor : 1; } }
public int VolumeFieldStart { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.VolumeFieldStart : 0; } } public int VolumeFieldStart { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.VolumeFieldStart : 0; } }
public int VolumeFieldEnd { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.VolumeFieldEnd : 0; } } public int VolumeFieldEnd { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.VolumeFieldEnd : 0; } }
public FieldFormat VolumeFieldFormat { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.VolumeFieldFormat : FieldFormat.None; } } public FieldFormat VolumeFieldFormat { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.VolumeFieldFormat : FieldFormat.None; } }
public Config.Unit TimeUnits { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.TimeUnits : Config.Unit.s; } } public Common.Unit TimeUnits { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.TimeUnits : Common.Unit.s; } }
public double TimeScaleFactor { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.TimeScaleFactor : 1; } } public double TimeScaleFactor { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.TimeScaleFactor : 1; } }
public int TimeFieldStart { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.TimeFieldStart : 0; } } public int TimeFieldStart { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.TimeFieldStart : 0; } }
public int TimeFieldEnd { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.TimeFieldEnd : 0; } } public int TimeFieldEnd { get { return (myCfg.ProcParams != null) ? myCfg.ProcParams.TimeFieldEnd : 0; } }
@ -633,11 +633,11 @@ namespace TBF.Rig.RegisterReaders.SerialStream
public event EventHandler<FrameReceivedEventArgs> FrameReceivedHandler; public event EventHandler<FrameReceivedEventArgs> FrameReceivedHandler;
public static double UnitVolume(Config.Unit units, double scaleFactor) public static double UnitVolume(Common.Unit units, double scaleFactor)
{ {
if (Config.Units.IsQuantity(units, Config.Quantity.Volume)) if (Common.Units.IsQuantity(units, Common.Quantity.Volume))
{ {
return Config.Units.ConvertFrom(units, 1.0) * scaleFactor; return Common.Units.ConvertFrom(units, 1.0) * scaleFactor;
} }
else else
{ {

View File

@ -1,11 +1,10 @@
/// ///
/// Copyright (c) 2018 Sensus Slovensko a.s. /// Copyright (c) 2018 Sensus Slovensko a.s.
/// ///
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO.Ports; using System.IO.Ports;
using System.Xml.Serialization; using System.Xml.Serialization;
using Config.Entities; using Common;
using TBF.Rig.Generic; using TBF.Rig.Generic;
namespace TBF.Rig.RegisterReaders.SerialStream namespace TBF.Rig.RegisterReaders.SerialStream

View File

@ -1582,9 +1582,9 @@ namespace TBF.Rig.Sequences
tstRslt.TestTime = tstRslt.TargetTime(); tstRslt.TestTime = tstRslt.TargetTime();
tstRslt.PulsesMaster = (outPath.FlowMeter.LtrPerPulse > 1E-6) ? (1.0075 * tstRslt.TargetVolume() / outPath.FlowMeter.LtrPerPulse) : 1; tstRslt.PulsesMaster = (outPath.FlowMeter.LtrPerPulse > 1E-6) ? (1.0075 * tstRslt.TargetVolume() / outPath.FlowMeter.LtrPerPulse) : 1;
tstRslt.MassStartRaw = 0; tstRslt.MassStartRaw = 0;
tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections); tstRslt.MassStart = Config.Entities.MeasurementCorrection.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections);
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Config.Formulas.RealDensity() / 1000.0f; tstRslt.MassEndRaw = tstRslt.TargetVolume() * Config.Formulas.RealDensity() / 1000.0f;
tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections); tstRslt.MassEnd = Config.Entities.MeasurementCorrection.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections);
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime;
tstRslt.FlowVolume = 3.6 * outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster / tstRslt.TestTime; tstRslt.FlowVolume = 3.6 * outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster / tstRslt.TestTime;
tstRslt.MassOfEvapWater = 0; tstRslt.MassOfEvapWater = 0;
@ -1697,9 +1697,9 @@ namespace TBF.Rig.Sequences
tstRslt.TestTime = tstRslt.TargetTime(); tstRslt.TestTime = tstRslt.TargetTime();
tstRslt.PulsesMaster = (outPath.FlowMeter.LtrPerPulse > 1E-6) ? (1.0075 * tstRslt.TargetVolume() / outPath.FlowMeter.LtrPerPulse) : 1; tstRslt.PulsesMaster = (outPath.FlowMeter.LtrPerPulse > 1E-6) ? (1.0075 * tstRslt.TargetVolume() / outPath.FlowMeter.LtrPerPulse) : 1;
tstRslt.MassStartRaw = 0; tstRslt.MassStartRaw = 0;
tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections); tstRslt.MassStart = Config.Entities.MeasurementCorrection.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections);
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Config.Formulas.RealDensity() / 1000.0f; tstRslt.MassEndRaw = tstRslt.TargetVolume() * Config.Formulas.RealDensity() / 1000.0f;
tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections); tstRslt.MassEnd = Config.Entities.MeasurementCorrection.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections);
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime;
tstRslt.FlowVolume = 3.6 * outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster / tstRslt.TestTime; tstRslt.FlowVolume = 3.6 * outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster / tstRslt.TestTime;
tstRslt.MassOfEvapWater = 0; tstRslt.MassOfEvapWater = 0;

View File

@ -680,9 +680,9 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
double massOfEvaporatedWater = tstRslt.TimeBtwnMassMsrmnts * outPath.Scale.EvaporationRate(tstRslt.TempDivMean); double massOfEvaporatedWater = tstRslt.TimeBtwnMassMsrmnts * outPath.Scale.EvaporationRate(tstRslt.TempDivMean);
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.RefPulses); /// Pulses of the master flow meter (test total) tstRslt.PulsesMaster = Convert.ToDouble(cBrd.RefPulses); /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = StartMass.Val; tstRslt.MassStartRaw = StartMass.Val;
tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, scale.Corrections); tstRslt.MassStart = Config.Entities.MeasurementCorrection.CorrectedValue(tstRslt.MassStartRaw, scale.Corrections);
tstRslt.MassEndRaw = EndMass.Val; tstRslt.MassEndRaw = EndMass.Val;
tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, scale.Corrections); tstRslt.MassEnd = Config.Entities.MeasurementCorrection.CorrectedValue(tstRslt.MassEndRaw, scale.Corrections);
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart + massOfEvaporatedWater) / tstRslt.TestTime; /// [kg/h] tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart + massOfEvaporatedWater) / tstRslt.TestTime; /// [kg/h]
double flow = 3.6 * LtrPerRefPulse * cBrd.RefPulses / tstRslt.TestTime; /// [m3/h] double flow = 3.6 * LtrPerRefPulse * cBrd.RefPulses / tstRslt.TestTime; /// [m3/h]
tstRslt.MassOfEvapWater = massOfEvaporatedWater; tstRslt.MassOfEvapWater = massOfEvaporatedWater;

View File

@ -1,10 +1,9 @@
/// ///
/// Copyright (c) 2013-2016 Sensus Metering Systems /// Copyright (c) 2013-2016 Sensus Metering Systems
/// ///
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using Common;
using Config.Entities; using Config.Entities;
using TBF.Rig.Generic; using TBF.Rig.Generic;

View File

@ -689,9 +689,9 @@ namespace TBF.Rig.TestMethods.DiverterTest
tstRslt.TimeBtwnMassMsrmnts = tMass2 - tMass1; tstRslt.TimeBtwnMassMsrmnts = tMass2 - tMass1;
tstRslt.PulsesMaster = Convert.ToDouble(cumulativeEtPulses[0]); /// Pulses of the master flow meter (test total) tstRslt.PulsesMaster = Convert.ToDouble(cumulativeEtPulses[0]); /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = StartMass.Val; tstRslt.MassStartRaw = StartMass.Val;
tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, scale.Corrections); tstRslt.MassStart = Config.Entities.MeasurementCorrection.CorrectedValue(tstRslt.MassStartRaw, scale.Corrections);
tstRslt.MassEndRaw = EndMass.Val; tstRslt.MassEndRaw = EndMass.Val;
tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, scale.Corrections); tstRslt.MassEnd = Config.Entities.MeasurementCorrection.CorrectedValue(tstRslt.MassEndRaw, scale.Corrections);
tstRslt.MassOfEvapWater = (double)tstRslt.TimeBtwnMassMsrmnts * outPath.Scale.EvaporationRate(tstRslt.TempDivMean); tstRslt.MassOfEvapWater = (double)tstRslt.TimeBtwnMassMsrmnts * outPath.Scale.EvaporationRate(tstRslt.TempDivMean);
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart + tstRslt.MassOfEvapWater) / tstRslt.TestTime; /// [kg/h] tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart + tstRslt.MassOfEvapWater) / tstRslt.TestTime; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]

View File

@ -1,10 +1,9 @@
/// ///
/// Copyright (c) 2019 Sensus Slovensko a.s. /// Copyright (c) 2019 Sensus Slovensko a.s.
/// ///
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using Common;
using Config.Entities; using Config.Entities;
using TBF.Rig.Generic; using TBF.Rig.Generic;

View File

@ -1,10 +1,9 @@
/// ///
/// Copyright (c) 2018 Sensus Slovensko a.s. /// Copyright (c) 2018 Sensus Slovensko a.s.
/// ///
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using Common;
using Config.Entities; using Config.Entities;
using TBF.Rig.Generic; using TBF.Rig.Generic;

View File

@ -520,8 +520,8 @@ namespace TBF.Rig.TestMethods.FixedStartAdvanced
while (!e.Contains(Event.PreviousStopped)); while (!e.Contains(Event.PreviousStopped));
double massStart = Config.Formulas.CorrectedValue(StartMass.Val, scale.Corrections); double massStart = Config.Entities.MeasurementCorrection.CorrectedValue(StartMass.Val, scale.Corrections);
double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, scale.Corrections); double massEnd = Config.Entities.MeasurementCorrection.CorrectedValue(EndMass.Val, scale.Corrections);
double densityOut = Config.Formulas.WaterDensityFromTempPress((TempUpStat.Average + TempDownStat.Average) / 2, double densityOut = Config.Formulas.WaterDensityFromTempPress((TempUpStat.Average + TempDownStat.Average) / 2,
(PressUpStat.Average + PressDownStat.Average) / 2); (PressUpStat.Average + PressDownStat.Average) / 2);
double buoyancy = Config.Formulas.Buoyancy(); double buoyancy = Config.Formulas.Buoyancy();

View File

@ -1,10 +1,9 @@
/// ///
/// Copyright (c) 2019 Sensus Slovensko a.s. /// Copyright (c) 2019 Sensus Slovensko a.s.
/// ///
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
using Common;
using Config.Entities; using Config.Entities;
using TBF.Rig.Generic; using TBF.Rig.Generic;

View File

@ -828,8 +828,8 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollDeferredEval
while (!e.Contains(Event.PreviousStopped)); while (!e.Contains(Event.PreviousStopped));
double massStart = Config.Formulas.CorrectedValue(StartMass.Val, scale.Corrections); double massStart = Config.Entities.MeasurementCorrection.CorrectedValue(StartMass.Val, scale.Corrections);
double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, scale.Corrections); double massEnd = Config.Entities.MeasurementCorrection.CorrectedValue(EndMass.Val, scale.Corrections);
double densityOut = Config.Formulas.WaterDensityFromTempPress((TempUpStat.Average + TempDownStat.Average) / 2, double densityOut = Config.Formulas.WaterDensityFromTempPress((TempUpStat.Average + TempDownStat.Average) / 2,
(PressUpStat.Average + PressDownStat.Average) / 2); (PressUpStat.Average + PressDownStat.Average) / 2);
double buoyancy = Config.Formulas.Buoyancy(); double buoyancy = Config.Formulas.Buoyancy();

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