by jasper » 07 March 2015, 14:21
If you are writing a unit operation, you get all thermo data from the material object. You cannot determine whether it is TEA or other thermo associated with the material object (or for that matter, you can but should not even need to determine which simulator you are running in).
A unit operation has ports, which have a type and direction. A material port connects to a material object, which either exposes CAPE-OPEN version 1.0 interfaces (ICapeThermoMaterialObject) or CAPE-OPEN version 1.1 interfaces (ICapeThermoCompounds, ICapeThermoPhases, ICapeThermoPropertyRoutine, ICapeThermoEquilibriumRoutine, ICapeThermoMaterial, ICapeThermoUniversalConstants), depending on support of the PME. Or both. Unit operation that can only use version 1.1 thermo (such as the Excel unit operation) therefore depend on the simulation environment implementing a 1.1 material object.
On the feed material, you may only get properties (T, P, flow, total flow, fraction, phase fraction). If you need to get other properties, such as enthalpy, you need to calculate them first, and this is not allowed on a feed material (no side effects may take place on a material object connected to a feed port). However, you can Duplicate the material object and do your calculations on there. The unit operation must make sure that compound flows, or total flow and composition, are set on each product material and calculate the phase equilibrium on a product material.
So if you want any other thermodynamic calculations done, make a Duplicate of any material connected to any port, and do your calculations on there. Or do them directly on a product material, this is allowed. For a single phase property, the general scheme is, set T, P (for 1.0, on the overall phase, for 1.1, on the phase of interest) and composition, calculate the property, get the property. In 1.0 a phase equilibrium calculation is as simple as setting overall composition and the equilibrium inputs (e.g. T and P) and call CalcEquilibrium. Then you can list the resulting phases and their properties (note that again anything beyond T, P, fraction, phase fraction requires calculation first). For 1.1 it is similar, except that you must set the present phases on the MO prior to the equilibrium calculation. This set of phases represents the phases that are allowed to result from the phase equilibrium calculation, in other words, you can do a phase equilibrium calculation considering only a subset of all defined phases.
If you are not writing a unit operation, let me know what kind of software component you are writing. In case of a stand-alone component that does not run inside a simulator, you will have to provide a material object implementation yourself, as this is normally implemented by the simulation environment.