Calculates one or more properties at phase equilibrium at one or more specified conditions. Both the flash constraints and the properties that can be calculated using this method are given by capeOpenFlashPropList.
[values,...]=capeOpenEquilibriumProp(handle,props,X,prop1,val1,prop2,val2,type)
handle: package handle, as obtained from capeOpenGetPackage
propNames: string. Multiple properties can be specified; either separate the properties by a space, or use a string matrix for multiple properties.
X: overall composition. Number of columns must match the number of compounds. Multiple rows indicate multiple evaluation conditions. X is in mole fraction or mass fraction, depending on the current basis.
prop1: string, first constraint property. A list of valid flash constraint properties can be obtained using capeOpenFlashPropList.
val1: value for the first flash constraint property. Can be a column vector for multiple conditions. The unit of measure of the value may depend on the basis.
prop2: string, second constraint property.
val2: value for the second flash constraint property. Can be a column vector for multiple conditions. The unit of measure of the value may depend on the basis.
type: string value indicating the desired solution type. Optional. Valid values are "Unspecified" (default), and if vapor fraction is part of the flash constraints, additional valid values are "Normal" or "Retrograde".
For X, val1 and val2, multiple rows mean multiple conditions. If multiple rows are specified for X, val1 or val2, those values that have multiple rows must have the same number of rows. Those values have a single row signify a constant condition or composition.
values: column vector of values. One vector will be returned for each property. The number of values in each vector matches the number of evaluation conditions.
As opposed to other functions, this function will return partial results if some of the calculations failed. Numbers that are not known are set to NaN; if the messages are turned on (default), failed calculations will produce a message.
» handle=capeOpenGetPackage('TEA (CAPE-OPEN 1.1)','C1_C2'); » %let's calculate and plot the phase envelope at 1 atm for this system » frac=0:0.05:1 frac = Columns 1 through 8 0 0.0500 0.1000 0.1500 0.2000 0.2500 0.3000 0.3500 Columns 9 through 16 0.4000 0.4500 0.5000 0.5500 0.6000 0.6500 0.7000 0.7500 Columns 17 through 21 0.8000 0.8500 0.9000 0.9500 1.0000 » X=[frac' 1-frac'] X = 0 1.0000 0.0500 0.9500 0.1000 0.9000 0.1500 0.8500 0.2000 0.8000 0.2500 0.7500 0.3000 0.7000 0.3500 0.6500 0.4000 0.6000 0.4500 0.5500 0.5000 0.5000 0.5500 0.4500 0.6000 0.4000 0.6500 0.3500 0.7000 0.3000 0.7500 0.2500 0.8000 0.2000 0.8500 0.1500 0.9000 0.1000 0.9500 0.0500 1.0000 0 » P=101325 P = 101325 » tbub=capeOpenEquilibriumProp(handle,'temperature',X,'pressure',P,'vaporFraction',0) tbub = 184.5500 165.1291 151.3888 142.7761 136.9731 132.7423 129.4731 126.8393 124.6508 122.7893 121.1765 119.7585 118.4966 117.3624 116.3342 115.3953 114.5326 113.7355 112.9956 112.3057 111.6600 » tdew=capeOpenEquilibriumProp(handle,'temperature',X,'pressure',P,'vaporFraction',1) tdew = 184.5500 183.6246 182.6609 181.6550 180.6022 179.4972 178.3334 177.1029 175.7962 174.4011 172.9025 171.2807 169.5095 167.5530 165.3595 162.8514 159.9023 156.2847 151.5130 144.1551 111.6600 » plot(frac,[tdew tbub])
» %another example: we start at T = 298.15 K and 1 atm, equimolar, and
» %we add 1 kJ/mol energy. We want to know the temperature increase
» h0=capeOpenEquilibriumProp(handle,'enthalpy',[0.5 0.5],'pressure',P,'temperature',298.15)
h0 =
-35.9793
» T1=capeOpenEquilibriumProp(handle,'temperature',[0.5 0.5],'pressure',P,'enthalpy',h0+1e3)
T1 =
320.2588