Generate fluid property tables from REFPROP or CoolProp database
retrieves
the properties of a fluidTables
= twoPhaseFluidTables(uRange
,pRange
,mLiquid
,mVapor
,n
,substance
,installPath
)substance
from a database and tabulates
them for use in the Two-Phase Fluid Properties
(2P) block. The substance can be a pure fluid such as R-134a or
a predefined mixture such as R-404a, a ternary mixture of R-125, R-143a, and R-134a.
The database can be REFPROP, an industry standard developed by NIST, or the
open-source CoolProp.
The tables are stored in fluidTables
as a structure array. A
liquid
substructure contains the data for the
Liquid Properties tab and a vapor
substructure contains that for the Vapor Properties tab. The
fields of the substructures contain the fluid properties themselves—specific volume,
specific entropy, kinematic viscosity, thermal conductivity, and others needed for
simulation.
The tabulated data is in the two-dimensional space of block. A normalized specific internal energy varies across the rows, and absolute pressure varies across the columns. These variables have the special property that, when plotted against them, phase boundaries are vertical and straight, and block calculations are simpler and faster.
Normalized specific internal energy spans between the bounds in
uRange
across mLiquid
rows for the liquid
phase and mVapor
rows for the vapor phase. Pressure spans between
the bounds in pRange
across n
rows for both
liquid and vapor phases. The properties of liquid-vapor mixtures are determined by
interpolation between the pure phases.
twoPhaseFluidTables(
assigns the properties stored in the structure array block
,fluidTables
)fluidTables
to the parameters of the Two-Phase Fluid Properties
(2P) block in the path block
. Use the
alternative syntax of this function if necessary to generate
fluidTables
.
Get the properties of water from REFPROP and save them as tables in a
structure named waterTables
. Assume the REFPROP root folder
to be C:\REFPROP
. Specify a specific internal energy range of
25-4,000
kJ/kg split over 25
rows and
a pressure range of 0.01-15
MPa split over 60
columns:
waterTables = twoPhaseFluidTables([25,4000],[0.01,15],25,25,60,... 'water','C:\Program Files\REFPROP\')
Get the properties of R-134a from CoolProp and save them as
tables in a structure named r134aTables
. Assume the CoolProp
root folder to be C:\CoolProp
. Specify a specific internal
energy range of 80-500
kJ/kg split over 25
rows and a pressure range of 0.001-3
MPa split over 60
columns:
r134aTables = twoPhaseFluidTables([80,500],[0.001,3],25,25,60,... 'R134a','py.CoolProp.CoolProp.PropsSI')
Populate the parameter fields of a Two-Phase Fluid Properties
(2P) block with the property tables of R-134a (stored previously in the
structure r134aTables
). Select the block and get its path
name:
gcb
twoPhaseFluidTables(gcb,r134aTables)
Install REFPROP as described by NIST (https://www.nist.gov/srd/refprop). The root folder should contain a DLL file and a subfolder with FLD files—the fluid definitions. Only the 64-bit Windows version of REFPROP is supported. This function has been tested with REFPROP versions 9.1, 9.1.1, and 10.
Install CoolProp as described by the CoolProp development team
(http://www.coolprop.org/coolprop/wrappers/MATLAB/). CoolProp version 6.2 uses a Python
wrapper and requires that you install Python prior to use. CoolProp is compatible with
Windows, Linux, and Macintosh systems. twoPhaseFluidTables
has been
tested with CoolProp versions 6.0.0, 6.1.0, and 6.2.0.