diff --git a/TestBenchFramework/BenchControl/Formulas.cs b/TestBenchFramework/BenchControl/Formulas.cs
index 538b4d549..86c5c1ad4 100644
--- a/TestBenchFramework/BenchControl/Formulas.cs
+++ b/TestBenchFramework/BenchControl/Formulas.cs
@@ -11,6 +11,59 @@ namespace TBF.BenchControl
{
private static readonly ILog log = LogManager.GetLogger(typeof(Formulas));
+ ///
+ /// Tables to calculate specific enthalpy
+ ///
+ private static readonly int[] Ii;
+ private static readonly int[] Ji;
+ private static readonly double[] ni;
+
+ /// Constructor
+ static Formulas()
+ {
+ ///
+ /// Tables to calculate specific enthalpy
+ ///
+ 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
+ };
+ }
+
///
/// Calculate density of distilled water from temperature
///
@@ -127,5 +180,70 @@ namespace TBF.BenchControl
return rawValue + corrections[count - 1].Correction;
}
+
+
+ ///
+ /// Calculates the heat coefficient for water
+ ///
+ /// Pressure in bar
+ /// Inlet temperature in degree Celsius
+ /// Outlet temperature in degree Celsius
+ /// true = flow measured @inlet, false = flow measured @outlet
+ /// Heat coefficient for water
+ 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 = 16.53E6; /// [Pa] (16.53 MPa)
+ const double T_star = 1386.0; /// [K]
+ const double T0C = 273.15; /// 0 degree Celsius in Kelvin
+
+ double T_in_K = T_in + T0C; /// T_in in Kelvin
+ double T_out_K = T_out + T0C; /// T_out in Kelvin
+ double tau_in = T_star / T_in_K;
+ double tau_out = T_star / T_out_K;
+ double pi = (pressure * 1E5) / p_star; /// pressure is in bar, p_star in Pa (1 bar = 1E5 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
+ : GammaPi(pi, tau_out) * R * T_out_K / p_star;
+
+ return (h_in - h_out) / (ni * (T_in - T_out));
+ }
+
+ ///
+ /// gamma(pi) see also STN EN 1434-1 Annex A (A.4)
+ ///
+ /// pi = p / p* where p* = 16.53 MPa
+ /// tau = T* / T where T* = 1386 K
+ /// gamma(pi)
+ 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;
+ }
+
+ ///
+ /// gamma(tau) see also STN EN 1434-1 Annex A (A.7)
+ ///
+ /// pi = p / p* where p* = 16.53 MPa
+ /// tau = T* / T where T* = 1386 K
+ /// gamma(tau)
+ 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;
+ }
}
}
diff --git a/TestBenchFramework/Program.cs b/TestBenchFramework/Program.cs
index ebfefa3e0..edc84bb45 100644
--- a/TestBenchFramework/Program.cs
+++ b/TestBenchFramework/Program.cs
@@ -251,6 +251,12 @@ namespace TBF
log.FatalFormat("LocalSettings.BatchNr updated to {0}", Program.LocalSettings.BatchNr);
}
+ /// This is to trigger an exception in case of a power user and no Config database
+ IList listOfProcedures = Config.FluentCommon.CreateSession(Config.Entities.DBKind.Config)
+ .CreateQuery("FROM Procedure WHERE ProcedureState = 'Active' AND Name = :procName")
+ .SetParameter("procName", LocalSettings.LastProcedureName)
+ .List();
+
retryLogin = false;
break;
}
diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs
index 41eebb041..cfe9bf5f6 100644
--- a/TestBenchFramework/Properties/AssemblyInfo.cs
+++ b/TestBenchFramework/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("2.9.322.1")]
-[assembly: AssemblyFileVersion("2.9.322.1")]
+[assembly: AssemblyVersion("2.9.323.1")]
+[assembly: AssemblyFileVersion("2.9.323.1")]