A flowsheet as Unit Operation
You can run a COFE flowsheet as unit operation. This makes it possible to use 'sub-flowsheets' in COFE, but also in other simulation environments. Inserting a flowsheet as unit operation works just like inserting other unit operations; insert a unit operation of type "COFE Flowsheet Unit Operation".
Initially, the inserted flowsheet will be empty. When editing the unit operation, a flowsheet editing window will appear that let's you configure the flowsheet. Selecting Import Existing Flowsheet from the Unit Operation menu allows for loading a pre-configured flowsheet.
Streams and external connections
After loading an existing flowsheet, or when adding streams, streams may be present that do not flow to or from an internal unit operation. These streams are global feed and product streams to the entire embedded flowsheet. Each of these streams will automatically be mapped to a port. The ports must be connected to streams in the host simulation environment for the flowsheet unit operation to be able to run. Upon calculation, values from the external streams will be copied to the internal feed streams. Then the flowsheet is calculated. Finally, values of the product streams are copied to the external product streams.
The compounds on the internal material streams must match the compounds on the streams connected to the external ports; the order may differ, but each of the internally present compounds must match exactly one of the externally present compounds. The matching is automatic, but you may be asked to identify which external compound matches an internal compound at the moment a port is connected. Your choice is remembered and you will not be asked again. You can inspect and reset previously matched compounds (if any) from the Unit Operation menu while editing the flowsheet unit operation.
For energy and information ports, an exact match is not required. The mapping between external and internal data items is automatic; at least one data item must be successfully mapped. Internal input data items that cannot be mapped will be set to a missing number. External output data items that cannot be mapped will be set to their default value (if one is available) or to a missing number.
During copying from and to external material streams, the thermodynamic equilibrium will be recalculated. If the external thermodynamics are consistent with the thermodynamics used for the internal stream, the equilibrium calculation will give the same values. For different internal and external thermodynamic systems, these values may be different and may depend on which variables are kept fixed for the equilibrium calculation.
Selecting External Ports from the Unit Operation menu allows for inspecting all external ports currently present, and for configuring which values are kept constant during the equilibrium calculation when copying from and to external material streams. For the TP specification, temperature and pressure are kept constant. For the PH specification, temperature and enthalpy are kept constant. For the Auto specification, TP will be used by default. If there is only one compound present on the material stream, PH will be used instead.
Internal and external parameters
The internal unit operations may expose parameters. These parameters can be exposed to the external simulation environment, as part of the flowsheet unit operation. To configure which parameters are exposed, select External Parameters from the Unit Operation menu. Setting parameters in the host simulation environment will immediately translate into setting the corresponding parameters on the internal unit operations.
Internal thermodynamic systems
Configuring thermodynamic systems for the embedded flowsheet works like configuring thermodynamics of any COFE flowsheet. In addition to the CAPE-OPEN Property Packages, you can also add thermodynamics that are consistent with the material streams connected to the external material ports. Multiple external thermodynamic systems are supported: you can add one thermodynamic package for each external material port.
If a port disappears (because the internal stream is deleted or connected to an internal unit operation), the thermodynamic system associated with that port (if present) is automatically removed.
The compounds definitions of a thermodynamic system that uses the material stream connected to an external port will match the compounds on the external material stream. Using external thermodynamics thus allows for an easy way to make sure that the compounds match, and will ensure thermodynamic consistency with the host environment.
Messages that appear in the log of the embedded flowsheet are - if supported by the host simulation environment - automatically forwarded to the host environment's log. This can be disabled by unchecking Forward Logged Messages To Host from the Unit Operation menu.
Applications of flowsheets embedded as unit operations
One can use flowsheets embedded as unit operations to
- create sub-flowsheets in COFE,
- create COFE based sub-flowsheets in other CAPE-OPEN compliant simulation environments,
- get things to run in other CAPE-OPEN compliant simulation environments if support for certain features lacks in these environments, but is present in COFE. For example: if a third party unit operation only supports version 1.1 thermodynamics and a host simulation environment only supports version 1.0 thermodynamics, you can add a COFE based flowsheet and insert the third party unit operation in there. Configure usage of the external thermodynamics, and COFE will take care of the version 1.0 / version 1.1 conversions.