Page 1 of 1

Getting properties from TEA

Posted: 07 March 2015, 13:07
by HenkF
Hi Jasper, all,

I'm trying to interface a custom model with COCO, using Delphi (unfortunately I didn't succeed using Lazarus with COM successfully) I understand how to read and write stream data and compositions.

I would appreciate some hints on how to read thermo data from TEA (H0, S0, Cp), and/or direct H, S and G value calculations.

kind regards,
Henk

Re: Getting properties from TEA

Posted: 07 March 2015, 14:21
by jasper
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.

Re: Getting properties from TEA

Posted: 07 March 2015, 16:43
by HenkF
Hi Jasper,
Thanks for your comprehensive answer!
As a more detailed question: from the input material streams I want to use the enthalp, entropy and Cp-function values (e.g. the ideal Cp function is defined as A+exp(B/T+C+D%T+E*T^2) is there a way to extract those A,B,C,D and E parameters from the material streams?

kind regards,
Henk

Re: Getting properties from TEA

Posted: 07 March 2015, 16:57
by jasper
No. There is not. Unless the PP would expose them as parameters, which TEA does not.

Re: Getting properties from TEA

Posted: 07 March 2015, 16:58
by jasper
But why would you need them? First order derivatives are available.... as a black box, but still, available. What other advantage would you have from having the coefficients? Note that the Cp itself is available, along with its T derivative, as T dependent property "idealGasHeatCapacity", and the S part (without its P contribution) as "idealGasEntropy".

Re: Getting properties from TEA

Posted: 07 March 2015, 17:29
by HenkF
I want to use them with a Multi-phase Gibbs minimization routine. Currently I read those data (H,S, Cp) from an external database.
I will check the code if it's posible to use those calculated H,S,Cp (and G values).
Thanks!

Re: Getting properties from TEA

Posted: 07 March 2015, 17:54
by jasper
You will need the formation terms in that case too, clearly.