- Set up MATLAB interface by copying the necessary files to your MATLAB directory.
- Load the GERG-2008 EOS in MATLAB, below is the code to select the equation of state in REFPROP.
GERG 2008 Equation of state calculations
35 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello all,
I'm trying to calculate the natural gas properties using the GERG 2008 eqution of state.
Is there anyway to perform this without having to write the Equation of State script?
I understand that the NIST REFPROP can be connected with matlab, but how to control the Equation of State to be used?
Thank you.
0 commentaires
Réponses (1)
SOUMNATH PAUL
le 20 Déc 2023
I can understand that you are trying to calculate the natural gas properties using the GERG -2008 equation of state without writing the entire script from scratch by utilising NIST REFPROP with MATLAB.
For this, you need to follow certain steps. I am also assuming you already have REFPROP in your system.
% Add REFPROP path
addpath('C:\path\to\REFPROP');
% Set up REFPROP with GERG-2008
RP = py.ctREFPROP.ctREFPROP.REFPROPFunctionLibrary('C:\path\to\REFPROP');
MASS_SI = RP.GETENUMdll(int8(0), "MASS SI").iEnum;
ierr = RP.SETUPdll(int8(1), "GERG2008", "HMX.BNC", "DEF");
if ierr ~= 0
error('Error in REFPROP SETUP');
end
% Now you can calculate properties using the GERG-2008 EOS
% For example, to calculate density of methane at 100 K and 1 MPa:
T = 100; % Temperature in Kelvin
P = 1; % Pressure in MPa
z = {1.0}; % Composition (pure methane)
output = RP.REFPROPdll("", "TP", "D", MASS_SI, int8(0), int8(0), T, P, z);
density = double(output.Output(1));
After this step you can use various REFPROP functions to calculate different properties.
Kindly go through the below link to read more on GERG-2008 API :
Hope it helps!
Regards,
Soumnath
0 commentaires
Voir également
Catégories
En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!