summaryrefslogtreecommitdiff
path: root/Simulator/Simulator/Files/ThermodynamicFunctions/HVapId.mo
diff options
context:
space:
mode:
Diffstat (limited to 'Simulator/Simulator/Files/ThermodynamicFunctions/HVapId.mo')
-rw-r--r--Simulator/Simulator/Files/ThermodynamicFunctions/HVapId.mo20
1 files changed, 20 insertions, 0 deletions
diff --git a/Simulator/Simulator/Files/ThermodynamicFunctions/HVapId.mo b/Simulator/Simulator/Files/ThermodynamicFunctions/HVapId.mo
new file mode 100644
index 0000000..7e681c2
--- /dev/null
+++ b/Simulator/Simulator/Files/ThermodynamicFunctions/HVapId.mo
@@ -0,0 +1,20 @@
+within Simulator.Files.ThermodynamicFunctions;
+
+ function HVapId
+ /* Calculates enthalpy of ideal vapor */
+ extends Modelica.Icons.Function;
+ input Real SH(unit = "J/kmol") "from chemsep database std. Heat of formation";
+ input Real VapCp[6] "from chemsep database";
+ input Real HOV[6] "from chemsep database";
+ input Real Tc "critical temp, from chemsep database";
+ input Real T(unit = "K") "Temperature";
+ output Real Hvap(unit = "J/mol") "Molar Enthalpy";
+ protected
+ Integer n = 100;
+ Real Cp[n - 1];
+ algorithm
+ for i in 1:n - 1 loop
+ Cp[i] := VapCpId(VapCp, 298.15 + i * (T - 298.15) / n);
+ end for;
+ Hvap := (T - 298.15) * (VapCpId(VapCp, T) / 2 + sum(Cp[:]) + VapCpId(VapCp, 298.15) / 2) / n;
+ end HVapId;