- 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
33 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
SOUMNATH PAUL
2023-12-20
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!