COCO - CAPE-OPEN to CAPE-OPEN simulation environment
 Help

Thermodynamic functions

The thermodynamic functions are implemented in the module COFEThermo. The following functions are currently available:

COFE_GetTemplateCount
declared as: Public Function COFE_GetTemplateCount()
arguments: [none]
return value: number of material templates
description: returns the numbers of available material templates in the flowsheet document object. The template names can be obtained from COFE_GetTemplateNames.
example pageCalculate properties example

COFE_GetTemplateNames
declared as: Public Function COFE_GetTemplateNames(Optional growArray As Integer = 0)
arguments: growArray: grows the array to the specified amount of elements, leaving blanks for unused elements (optional, see Entering array formulas)
return value: array of available template names
description: returns the available material templates in the flowsheet document object. Any of the template names can be used for each of the thermodynamic functions. Passing a template name is optional for all functions. If a template name is not specified, the name default is used.
The returned array is in column format.
example pageCalculate properties example

COFE_GetCompoundCount
declared as: Public Function COFE_GetCompoundCount(Optional templateName As String = "default")
arguments: templateName: name of the template for which to return the number of compounds (optional)
return value: number of compounds
description: Returns the number of compounds in materials of the specified type. Composition inputs to thermodynamic functions need to be an array of which the size corresponds to the number of compounds. Property values that are evaluated for each compounds - such as fugacityCoefficient - will be an array with the number of elements matching the number of compounds.
example pageCalculate properties example

COFE_GetCompoundNames
declared as: Public Function COFE_GetCompoundNames(Optional templateName As String = "default", Optional growArray As Integer = 0)
arguments: templateName: name of the material template for which to get the compound names
growArray: grows the array to the specified amount of elements, leaving blanks for unused elements (optional)
return value: List of compound names available in materials of the specified type.
description: Returns a list of compound names available in materials of the specified type.
The returned array is in column format.
example pageCalculate properties example, Calculate equilibrium example

COFE_ObtainProperty
declared as: Public Function COFE_ObtainProperty(p As Double, T As Double, composition As Range, compositionBasis As String, propertyName As String, phaseName As String, calcType As String, basis As String, Optional templateName As String = "default")
arguments: p: pressure, Pa
T: temperature, K
composition: composition, mole fraction or mass fraction
compositionBasis: basis for composition, "mole" or "mass"
propertyName : name of the property to calculate
phaseName: name of the phase for which to calculate the property
calcType: calculation type, "mixture" or "pure"
basis: basis for the returned property, "mole", "mass" or ""
templateName: type of material to use for the calculation (optional)
return value: Calculated property value
description: This is the main routine for calculation of physical or thermodynamic properties at specified pressure, temperature and composition (mole or mass fraction), for the specified phase (typically "vapor" or "liquid". For a list of property names available in the flowsheet document object, go to the flowsheet configuration, select the Properties tab, which is a subset of the full list of CAPE-OPEN properties.
Properties that have dimenensions that include a mass or mole specification require either "mass" or "mole" for the basis. All other properties require an empty string for the basis. The calculation type must be either "mixture" or "pure", the latter referring to the compounds as if they were not in the mixture (if "pure", the specified composition does not play a role in the calculation). The template name is optional; if not specified, the "default" stream type will be used.
The returned array is often a scalar. For vector properties, expect a row vector.
See also: COFE_FormatPropertyDimensionality.
example pageCalculate properties example

COFE_ObtainComponentConstant
declared as: Public Function COFE_ObtainComponentConstant(propertyName As String, compoundName As String, Optional templateName As String = "default")
arguments: [none]
return value: propertyName: name of the constant property to obtain
compoundName: name of the compound for which to obtain the constant
templateName: type of material to use
description: Obtain a compound constant for a given compound. For a list of available compound constant names, see CAPE-OPEN version 1.0 thermodynamic interface, section 4.12.1, or list of constant properties.
See also: COFE_FormatCompoundConstantDimensionality.
example pageCalculate properties example

COFE_CalculateEquilibrium
declared as: Public Function COFE_CalculateEquilibrium(eqType As String, spec1 As Double, spec2 As Double, composition As Range, basis As String, Optional templateName As String = "default", Optional growArray As Integer = 0)
arguments: eqType: equilibrium specification type
spec1: first specification (see table)
spec2: second specification (see table)
composition: overall composition (mass or mole fraction)
basis: basis argument for composition and spec1 and spec2, as well as resulting compositions and phase fractions (if applicable), "mass" or "mole"
templateName: type of material to use (optional)
growArray: grows the array to the specified amount of elements, leaving blanks for unused elements (optional)
return value: array containing phase fractions for each phase and compositions for each phase
description: Calculates an equilibrium using either of the following type specifications:

type spec1 spec2
TPtemperaturepressure
PTpressuretemperature
PVFpressurevapor fraction
VFPvapor fractionpressure
TVFtemperaturevapor fraction
VFTvapor fractiontemperature
PHpressureenthalpy
HPenthalpypressure
THtemperatureenthalpy
HTenthalpytemperature
HVFenthalpyvapor fraction
VFHvapor fractionenthalpy
PSpressureentropy
SPentropypressure
TStemperatureentropy
STentropytemperature
SVFentropyvapor fraction
VFSvapor fractionentropy

Depending on the property package, not all of the above may be supported. If no template name is supplied, the "default" stream type will be used.

The input specifications have the following dimension:

specification "mole" basis "mass" basis
compositionmole fractionmass fraction
pressurePaPa
temperatureKK
vapor fractionmole fractionmole fraction
enthalpyJ/molJ/kg
entropyJ/mol/KJ/kg/K

The output phase fractions and compositions are in mole or mass fractions, depending on the specified basis.

A list of headers indicating the meaning of the values can be obtained from the COFE_CalculateEquilibriumHeaders function.

The returned array is in row format.

example pageCalculate equilibrium example

COFE_CalculateEquilibriumHeaders
declared as: Public Function COFE_CalculateEquilibriumHeaders(basis As String, Optional templateName As String = "default", Optional growArray As Integer = 0)
arguments: basis: basis argument as passed to COFE_CalculateEquilibrium
templateName: template name as passed to COFE_CalculateEquilibrium
growArray: grows the array to the specified amount of elements, leaving blanks for unused elements (optional)
return value: Array of headers corresponding to the values from COFE_CalculateEquilibrium
description: Returns an array of names corresponding to the elements of the array returned by COFE_CalculateEquilibrium.
The returned array is in row format.
example pageCalculate equilibrium example

INDEX
CONTENT