GERG 2008 Equation of state calculations

34 visualizzazioni (ultimi 30 giorni)
Hosam Ismail
Hosam Ismail il 5 Dic 2023
Risposto: SOUMNATH PAUL il 20 Dic 2023
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.

Risposte (1)

SOUMNATH PAUL
SOUMNATH PAUL il 20 Dic 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.
  1. Set up MATLAB interface by copying the necessary files to your MATLAB directory.
  2. Load the GERG-2008 EOS in MATLAB, below is the code to select the equation of state in REFPROP.
% 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

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Tag

Prodotti


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by