by jasper » 01 June 2013, 06:16
You cannot use a Property Package as a Material Object. Many functions of the Property Package take a Material Object as argument. So you pass a Material Object to the Property Package. This means that you will have to implement a Material Object.
A Material Object implements functionality to set and get property values, so it serves as a storage container. It has several tasks
- It defines which components are present in the mixture. This can be all components of the Property Package or a subset thereof (*)
- It gets passed to a Property Package for property or equilibrium calculations. It contains the calculation conditions, and the Property Package will set the results of the calculation on the Material Object (*)
- In flowsheet simulations it also represents a material stream, so it gets connected to material ports of Unit Operations.
- Therefore it serves as a means for the Unit Operation to perform property and equilibrium calculations
- The Property Package may set values in one basis (e.g. enthalpy in J/mol) and the Unit Operation may want to obtain it in another (e.g. J/kg). The Material Object has the responsibility to perform the basis conversions. For most properties this is rather straight forward using the compound molecular weights or the mixture molecular weight. However for composition derivatives you should take into account the effect of the composition change on the molecular weight as well, so the chain rule applies and conversion of, say, enthalpy.DmolFraction also requires to have the value of enthalpy.
If you are not making a flowsheet environment but if you are only interested in creating a property package to perform property and equilibrium calculations, only a subset of the functionality of a Material Object needs to be implemented. In particular, those with a (*) marked above.
I do not have a code example for a Material Object implementation at hand. It requires creation of a COM object that implements the appropriate interfaces (ICapeIdentification, error interfaces and ICapeThermoMaterialObject). You create the COM object from your own code, so it will not be created by other applications using CoCreateInstance. Hence, the COM object does not need to be registered in the Windows registry.