-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathVLEFluid_dT.mo
138 lines (130 loc) · 4.49 KB
/
VLEFluid_dT.mo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
within TILMedia;
model VLEFluid_dT
"Compressible fluid model with d, T and xi as independent variables"
extends TILMedia.BaseClasses.PartialVLEFluid_dT(
vleFluidPointer=
TILMedia.Internals.TILMediaExternalObject(
"VLEFluid",
vleFluidType.concatVLEFluidName,
computeFlags,
vleFluidType.mixingRatio_propertyCalculation[1:end - 1]/sum(
vleFluidType.mixingRatio_propertyCalculation),
vleFluidType.nc,
0,
getInstanceName()),
M_i = {TILMedia.VLEFluidObjectFunctions.molarMass_n(i-1,vleFluidPointer) for i in 1:vleFluidType.nc});
protected
constant Real invalidValue=-1;
final parameter Integer computeFlags=TILMedia.Internals.calcComputeFlags(
computeTransportProperties,
interpolateTransportProperties,
computeSurfaceTension,
deactivateTwoPhaseRegion,
deactivateDensityDerivatives);
equation
assert(vleFluidType.nc == 1, "This TILMedia VLEFluid interface cannot handle variable concentrations");
(crit.d,crit.h,crit.p,crit.s,crit.T) =
TILMedia.Internals.VLEFluidObjectFunctions.cricondentherm_xi(xi,
vleFluidPointer);
//calculate molar mass
M = M_i[1];
//Calculate Main Properties of state
h =
TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.specificEnthalpy_dTxi(
d,
T,
xi,
vleFluidPointer);
p =
TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.pressure_dTxi(
d,
T,
xi,
vleFluidPointer);
s =
TILMedia.Internals.VLEFluidObjectFunctions.PureComponentDerivatives.specificEntropy_dTxi(
d,
T,
xi,
vleFluidPointer);
//Calculate Additional Properties of state
(q,cp,cv,beta,kappa,drhodp_hxi,drhodh_pxi,drhodxi_ph,w,gamma) =
TILMedia.Internals.VLEFluidObjectFunctions.additionalProperties_dTxi(
d,
T,
xi,
vleFluidPointer);
//Calculate VLE Properties
//VLE only depends on p or T
(VLE.d_l,VLE.h_l,VLE.p_l,VLE.s_l,VLE.T_l,VLE.xi_l,VLE.d_v,VLE.h_v,VLE.p_v,VLE.s_v,
VLE.T_v,VLE.xi_v) =
TILMedia.Internals.VLEFluidObjectFunctions.VLEProperties_dTxi(
-1,
T,
xi,
vleFluidPointer);
//Calculate Transport Properties
if computeTransportProperties then
(transp.Pr,
transp.lambda,
transp.eta,
transp.sigma) =
TILMedia.Internals.VLEFluidObjectFunctions.transportPropertyRecord_dTxi(
d,
T,
xi,
vleFluidPointer);
else
transp = TILMedia.Internals.TransportPropertyRecord(
invalidValue,
invalidValue,
invalidValue,
invalidValue);
end if;
//compute VLE Additional Properties
if computeVLEAdditionalProperties then
//VLE only depends on p or T
(VLEAdditional.cp_l,VLEAdditional.beta_l,VLEAdditional.kappa_l,
VLEAdditional.cp_v,VLEAdditional.beta_v,VLEAdditional.kappa_v) =
TILMedia.Internals.VLEFluidObjectFunctions.VLEAdditionalProperties_dTxi(
-1,
T,
xi,
vleFluidPointer);
else
VLEAdditional.cp_l = invalidValue;
VLEAdditional.beta_l = invalidValue;
VLEAdditional.kappa_l = invalidValue;
VLEAdditional.cp_v = invalidValue;
VLEAdditional.beta_v = invalidValue;
VLEAdditional.kappa_v = invalidValue;
end if;
//compute VLE Transport Properties
if computeVLETransportProperties then
//VLE only depends on p or T
(VLETransp.Pr_l,VLETransp.Pr_v,VLETransp.lambda_l,VLETransp.lambda_v,
VLETransp.eta_l,VLETransp.eta_v) =
TILMedia.Internals.VLEFluidObjectFunctions.VLETransportPropertyRecord_dTxi(
-1,
T,
xi,
vleFluidPointer);
else
VLETransp.Pr_l = invalidValue;
VLETransp.Pr_v = invalidValue;
VLETransp.lambda_l = invalidValue;
VLETransp.lambda_v = invalidValue;
VLETransp.eta_l = invalidValue;
VLETransp.eta_v = invalidValue;
end if;
annotation (
defaultComponentName="vleFluid",
Protection(access=Access.packageDuplicate),
Documentation(info="<html>
<p>
The VLE-fluid model VLEFluid_dT calculates the thermopyhsical property data with given inputs: density (d), temperature (T), mass fraction (xi) and the parameter vleFluidType.<br>
The interface and the way of using, is demonstrated in the Testers -> <a href=\"modelica://TILMedia.Testers.TestVLEFluid\">TestVLEFluid</a>.
</p>
<hr>
</html>"));
end VLEFluid_dT;