中缅线组分 昆明
using System;
namespace MPD_Z_AGA8_92DC_NS//AGA8—92DC
{
public static class Z_CAL
{
public unsafe static double Z_result_ZhongMianNG(double XiangDuiYaLi, double WenDu, double localAtmosphericPressure_kPa)
{
double TT, D, Z, BMIX;
// Gas compositions for example calculations组分,中缅组分
double[] ex1 =
{
0.9907,//CH4
0.0019,//N2
0.0050,//CO2
0.0012,//C2H6
0.0003,//C3H8
0.0000,//H2O
0.0000,//H2S
0.0000,//H2
0.0000,//CO
0.0000,//O2
0.0001,//iC4H10
0.0000,//nC4H10
0.0000,//iC5H12
0.0000,//nC5H12
0.0000,//nC6H14
0.0000,//nC7H16
0.0000,//nC8H18
0.0008,//nC9H20
0.0000,//nC10h22
0.0000,//He
0.0000 //Ar
};
// Temperatures for example calculations工况温度
// Pressures for example calculations工况压力
double DaQi_YaLi = localAtmosphericPressure_kPa / 1000;// 0.0808;//昆明大气压
double p = XiangDuiYaLi + DaQi_YaLi;// Pressures for example calculations工况压力MPa,YaLi为相对压力,需要转换成绝对压力;
MDP_Z.DCAGA(ex1);
TT = WenDu + 273.15;
MDP_Z.DZOFPT(&p, &TT, &D, &Z, &BMIX);
return Z;
}
//后期接口,开放组分时用的
unsafe static double Z_result_QiTq_NG(double[] ZuFen, double YaLi, double WenDu)
{
double TT, D, Z, BMIX;
double DaQi_YaLi = 0.0808;//昆明大气压
// Gas compositions for example calculations组分
double[] ex1 = {
0.9650, 0.0030, 0.0060, 0.0180, 0.0045, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0010, 0.0010, 0.0005, 0.0003, 0.0007, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000 };
double p = YaLi + DaQi_YaLi;// Pressures for example calculations工况压力MPa,YaLi为相对压力,需要转换成绝对压力;
MDP_Z.DCAGA(ex1);
TT = WenDu + 273.15;// Temperatures for example calculations工况温度℃,需要转换成热力学温度;
MDP_Z.DZOFPT(&p, &TT, &D, &Z, &BMIX);
return Z;
}
}
public static class MDP_Z
{
static double[] A = {
0.153832600, 1.341953000, -2.998583000, -0.048312280, 0.375796500, -1.589575000, -0.053588470, 0.886594630, -0.710237040, -1.471722000,
1.321850350, -0.786659250, 0.2291290e-8, 0.157672400, -0.436386400, -0.044081590, -0.003433888, 0.032059050, 0.024873550, 0.073322790,
-0.001600573, 0.642470600, -0.416260100, -0.066899570, 0.279179500, -0.696605100, -0.002860589, -0.008098836, 3.150547000, 0.007224479,
-0.705752900, 0.534979200, -0.079314910, -1.418465000, -0.599905e-16, 0.105840200, 0.034317290, -0.007022847, 0.024955870, 0.042968180,
0.746545300, -0.291961300, 7.294616000, -9.936757000, -0.005399808, -0.243256700, 0.049870160, 0.003733797, 1.874951000, 0.002168144,
-0.658716400, 0.000205518, 0.009776195, -0.020487080, 0.015573220, 0.006862415, -0.001226752, 0.002850908 };
static double[] B = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 7, 7, 8, 8, 8, 9, 9 };
static double[] C = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1 };
static double[] K = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 2, 2, 4, 4, 0, 0, 2, 2, 2, 4, 4, 4, 4, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 0, 0, 2, 2, 2, 4, 4, 0, 2, 2, 4, 4, 0, 2, 0, 2, 1, 2, 2, 2, 2 };
static double[] G = {
0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 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