Cape Thermo Material WrapperCalc Two Phase Prop Method
Definition
Assembly: CapeOpen (in CapeOpen.dll) Version: 1.0.0.0 (1.0.0.0)
public void CalcTwoPhaseProp(
string[] props,
string[] phaseLabels
)Public Sub CalcTwoPhaseProp (
props As String(),
phaseLabels As String()
)Parameters
- props String
- The list of identifiers for properties to be calculated. This must be one or more of the supported two-phase properties and derivatives (as given by the GetTwoPhasePropList method). The standard identifiers for two-phase properties are given in section 7.5.6 and 7.6.
- phaseLabels String
- Phase labels of the phases for which the properties are to be calculated. The phase labels must be two of the strings returned by the GetPhaseList method on the ICapeThermoPhases interface.
Remarks
CalcTwoPhaseProp calculates the values of properties such as surface tension or K-values. Properties that pertain to a single Phase are handled by the CalcSinglePhaseProp method of the ICapeThermoPropertyRoutine interface. Components that implement this method must get the input specification for the calculation (temperature, pressure and composition) from the associated Material Object and set the results in the Material Object.
Components such as a Property Package or Property Calculator must implement the ICapeThermoMaterialContext interface so that an ICapeThermoMaterial interface can be passed via the SetMaterial method.
A typical sequence of operations for CalcTwoPhaseProp when implemented by a Property Package component would be:
- Check that the phaseLabels specified are valid.
- Use the GetTPFraction method (of the Material Object specified in the last call to the SetMaterial method) to get the temperature, pressure and composition of the specified Phases.
- Calculate the properties.
- Store values for the properties in the Material Object using the SetTwoPhaseProp method of the ICapeThermoMaterial interface.
CalcTwoPhaseProp will request the values it requires from the Material Object through GetTPFraction or GetSinglePhaseProp calls. If a requested property is not available, the exception raised will be ECapeThrmPropertyNotAvailable. If this error occurs, then the Property Package can return it to the client, or request a different property. Material Object implementations must be able to supply property values using the client choice of basis by implementing conversion from one basis to another.
Clients should not assume that Phase fractions and Compound fractions in a Material Object are normalised. Fraction values may also lie outside the range 0 to 1. If fractions are not normalised, or are outside the expected range, it is the responsibility of the Property Package to decide how to deal with the situation.
It is recommended that properties are requested one at a time in order to simplify error handling. However, it is recognised that there are cases where the potential efficiency gains of requesting several properties simultaneously are more important. One such example might be when a property and its derivatives are required.
If a client uses multiple properties in a call and one of them fails, then the whole call should be considered to have failed. This implies that no value should be written back to the Material Object by the Property Package until it is known that the whole request can be satisfied.
CalcTwoPhaseProp must be called separately for each combination of Phase groupings. For example, vapour-liquid K-values have to be calculated in a separate call from liquid-liquid K-values.
Two-phase properties may not be meaningful unless the temperatures and pressures of all Phases are identical. It is the responsibility of the Property Package to check such conditions and to raise an exception if appropriate.
It is likely that a PME might request values of properties for Phases at conditions of temperature, pressure and composition where one or both of the Phases do not exist (according to the mathematical/physical models used to represent properties). The exception ECapeThrmPropertyNotAvailable may be raised or an extrapolated value may be returned. It is responsibility of the implementer to decide how to handle this circumstance.
Exceptions
| ECapeNoImpl | The operation is “not” implemented even if this method can be called for reasons of compatibility with the CAPE-OPEN standards. That is to say that the operation exists, but it is not supported by the current implementation. |
| ECapeLimitedImpl | Would be raised if the one or more of the properties requested cannot be returned because the calculation (of the particular property) is not implemented. This exception should also be raised (rather than ECapeInvalidArgument) if the props argument is not recognised because the list of properties in section 7.5.6 is not intended to be exhaustive and an unrecognised property identifier may be valid. If no properties at all are supported ECapeNoImpl should be raised (see above). |
| ECapeBadInvOrder | The necessary pre-requisite operation has not been called prior to the operation request. For example, the ICapeThermoMaterial interface has not been passed via a SetMaterial call prior to calling this method. |
| ECapeFailedInitialisation | The pre-requisites for the property calculation are not valid. For example, the composition of one of the Phases is not defined, or any other necessary input information is not available. |
| ECapeThrmPropertyNotAvailable | At least one item in the requested properties cannot be returned. This could be because the property cannot be calculated at the specified conditions or for the specified Phase. If the property calculation is not implemented then ECapeLimitedImpl should be returned. |
| ECapeSolvingError | One of the property calculations has failed. For example if one of the iterative solution procedures in the model has run out of iterations, or has converged to a wrong solution. |
| ECapeInvalidArgument | To be used when an invalid argument value is passed, for example an unrecognised value or UNDEFINED for the phaseLabels argument or UNDEFINED for the props argument. |
| ECapeUnknown | The error to be raised when other error(s), specified for this operation, are not suitable. |