Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Simulator/Files/Thermodynamic_Functions/package.mo
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ package Thermodynamic_Functions
input Real P;
input Real x;
input Real y;
input Real Phase_Density;
output Real Sliq, Svap;
protected
parameter Real Tref = 298.15, Pref = 101325;
Expand All @@ -103,7 +104,7 @@ package Thermodynamic_Functions
Entr := -(T - 298.15) * (Simulator.Files.Thermodynamic_Functions.VapCpId(VapCp, T) / (2 * T) + sum(Cp[:]) + Simulator.Files.Thermodynamic_Functions.VapCpId(VapCp, 298.15) / (2 * 298.15)) / n;
end if;
if x > 0 and y > 0 then
Sliq := Entr - R * log(P / Pref) - R * log(x) - HV(HOV, Tc, T) / T;
Sliq := Entr - R * log(P / Pref) - R * log(x) - HV(HOV, Tc, T) / T + P/1000/Phase_Density/T;
Svap := Entr - R * log(P / Pref) - R * log(y);
elseif x <= 0 and y <= 0 then
Sliq := 0;
Expand All @@ -112,7 +113,7 @@ package Thermodynamic_Functions
Sliq := 0;
Svap := Entr - R * log(P / Pref) - R * log(y);
elseif y == 0 then
Sliq := Entr - R * log(P / Pref) - R * log(x) - HV(HOV, Tc, T) / T;
Sliq := Entr - R * log(P / Pref) - R * log(x) - HV(HOV, Tc, T) / T + P/1000/Phase_Density/T;
Svap := 0;
else
Sliq := 0;
Expand Down Expand Up @@ -150,6 +151,7 @@ package Thermodynamic_Functions






function Dens
Expand Down
7 changes: 6 additions & 1 deletion Simulator/Streams/Material_Stream.mo
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ model Material_Stream
Real phasMolSpHeat[3] "phase Molar Specific Heat", compMolSpHeat[3, NOC] "Component Molar Specific Heat";
Real phasMolEnth[3] "Phase Molar Enthalpy", compMolEnth[3, NOC] "Component Molar Enthalpy";
Real phasMolEntr[3] "Phase Molar Entropy", compMolEntr[3, NOC] "Component Molar Entropy";
Real Liquid_Phase_Density;
Real LiqDens[NOC];
Simulator.Files.Connection.matConn inlet(connNOC = NOC) annotation(
Placement(visible = true, transformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Simulator.Files.Connection.matConn outlet(connNOC = NOC) annotation(
Expand Down Expand Up @@ -74,7 +76,7 @@ equation
compMolSpHeat[3, i] = Thermodynamic_Functions.VapCpId(comp[i].VapCp, T);
compMolEnth[2, i] = Thermodynamic_Functions.HLiqId(comp[i].SH, comp[i].VapCp, comp[i].HOV, comp[i].Tc, T);
compMolEnth[3, i] = Thermodynamic_Functions.HVapId(comp[i].SH, comp[i].VapCp, comp[i].HOV, comp[i].Tc, T);
(compMolEntr[2, i], compMolEntr[3, i]) = Thermodynamic_Functions.SId(comp[i].AS, comp[i].VapCp, comp[i].HOV, comp[i].Tb, comp[i].Tc, T, P, compMolFrac[2, i], compMolFrac[3, i]);
(compMolEntr[2, i], compMolEntr[3, i]) = Thermodynamic_Functions.SId(comp[i].AS, comp[i].VapCp, comp[i].HOV, comp[i].Tb, comp[i].Tc, T, P, compMolFrac[2, i], compMolFrac[3, i],Liquid_Phase_Density);
end for;
for i in 2:3 loop
phasMolSpHeat[i] = sum(compMolFrac[i, :] .* compMolSpHeat[i, :]) + resMolSpHeat[i];
Expand Down Expand Up @@ -111,5 +113,8 @@ algorithm
for i in 1:NOC loop
MW[:] := MW[:] + comp[i].MW * compMolFrac[:, i];
end for;
LiqDens[:] := Thermodynamic_Functions.Density_Racket(NOC, T, P, comp[:].Pc, comp[:].Tc, comp[:].Racketparam, comp[:].AF, comp[:].MW, Psat[:]);

Liquid_Phase_Density := 1 / sum(compMasFrac[2, :] ./ LiqDens[:]) / MW[2];

end Material_Stream;