Heat coefficient for water implemented in Formulas class, ver. 2.9.323
This commit is contained in:
parent
d8e8156cc9
commit
fd69bc6376
@ -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;
|
||||
|
||||
/// <summary> Constructor </summary>
|
||||
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
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculate density of distilled water from temperature
|
||||
/// </summary>
|
||||
@ -127,5 +180,70 @@ namespace TBF.BenchControl
|
||||
|
||||
return rawValue + corrections[count - 1].Correction;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the heat coefficient for water
|
||||
/// </summary>
|
||||
/// <param name="pressure">Pressure in bar</param>
|
||||
/// <param name="T_in">Inlet temperature in degree Celsius</param>
|
||||
/// <param name="T_out">Outlet temperature in degree Celsius</param>
|
||||
/// <param name="flowMeasuredAtInlet">true = flow measured @inlet, false = flow measured @outlet</param>
|
||||
/// <returns> Heat coefficient for water</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 = 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));
|
||||
}
|
||||
|
||||
/// <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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<Procedure> listOfProcedures = Config.FluentCommon.CreateSession(Config.Entities.DBKind.Config)
|
||||
.CreateQuery("FROM Procedure WHERE ProcedureState = 'Active' AND Name = :procName")
|
||||
.SetParameter("procName", LocalSettings.LastProcedureName)
|
||||
.List<Procedure>();
|
||||
|
||||
retryLogin = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -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")]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user