Professional Documents
Culture Documents
html page 1 of 4
Updating COCO
To update COCO, please run COCO UPdate (CUP) from the COCO Start Menu. If CUP is not available, you are probably
running a version of COCO older than 1.13; please download the latest version of COCO.
The latest modifications to COCO are documented here.
CUP will use the default internet explorer proxy-server settings, if available from
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable
= (DWORD)1
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer
= (STRING)<server name>:<port number>
If not available, and the internet connection fails, you will be prompted for proxy server details. If your proxy server
requires authentication, you may get prompted for user name and password.
CUP supports the Basic, Digest and NTLM authorization schemes. CUP supports proxy server authorization since
version 1.13.0.5 (NTLM since version 1.13.0.6)
• define thermodynamics: enter the flowsheet configuration dialog, and add a thermodynamic property package.
You can use any CAPE-OPEN v1.0 or v1.1 compatible property package; if you have installed COCO, you will at
least have TEA installed. You can use an existing TEA property package or create your own TEA property
package. After loading a property package into your simulation, compound and phase definitions will
automatically be present. You can load multiple property packages in your simulation if you want to have access
to different models in different parts of your flowsheet,
• define material types: a material type in COFE defines what property package is used, and which compounds can
be present. The default material type is always present, and when you add your first property package, you will be
asked to associate this with the default material type,
• insert and configure unit operation models: a flowsheet in general has multiple unit operations in there. You can
mix unit operations from COUSCOUS, from ChemSep and from any third party model set, as long as the unit
operations are CAPE-OPEN v1.0 compatible.
• insert and hook up streams: you can now insert streams. To connect streams to ports of unit operations, simply
source: http://www.cocosimulator.org/index_support.html page 2 of 4
use the mouse to drag the beginning of a stream onto a unit operations' edge. Depending on the unit operations
graphical representation, connection points will be highlighted. You can modify the graphical representation of a
unit operation by clicking on the unit operation with the right mouse button and enter the Icon menu,
• define inlet stream conditions: for each inlet stream to the flowsheet (streams that do not originate from the outlet
of a unit operation), you will need to specify flow, pressure, temperature and composition. You can simply double
click on a stream to enter data,
• validate: if your model is ready to run, the run button is enabled. If not, you can obtain information of what part of
the flowsheet is incompletely specified by pressing the Validate button.
• For any programming environment that allows you to build COM objects, you need to perform the following steps:
• Create a project,
• Create a class that will represent the unit operation. This is the only class that external applications will
need to create, and thus needs to be registered as a COM object,
• All CAPE-OPEN objects are required to implement ICapeIdentication and the CAPE-OPEN error
interfaces,
• The unit operation class needs to implement ICapeUnit. It is advised to also implement ICapeUtilities.
Optionally you can implement ICapeUnitReport,
• You need to create additional COM classes for the parameter collection and the port collection. These
classes need to implement ICapeCollection (one of these collections could be the unit operation class
itself, but the unit operation cannot expose two ICapeCollection interfaces, so you will need to implement
at least one additional class),
• You will need to create one or more COM classes that function as ports. Ports need to expose
ICapeUnitPort,
• If you want to add parameters to your unit operation, you will need to implement one or more classes
exposing ICapeParameter. A parameter exposes a parameter specification, which may or may not be a
separate class. This class should implement ICapeParameterSpec, and depending on the parameter type
also any of the following: ICapeRealParameterSpec, ICapeIntegerParameterSpec,
ICapeBooleanParameterSpec, ICapeOptionParameterSpec, ICapeArrayParameterSpec,
• If your unit operation needs to save and load its state, it needs to implement either an IPersistStream or
an IPersistStreamInit interface,
• The unit operation class needs to be registered as a COM object. Additionally, the CapeDescription sub-
key of the CLSID key needs to be present, with its values (see the Methods and Tools document from the
CO-LaN web site). Additionally, the registration for the unit operation needs to include the CAPE-OPEN
Object category ID, and the CAPE-OPEN Unit Operation category ID.
• If you use Borland Delphi, you could start with the Delphi CAPE-OPEN wizard.
• If you are using .NET based programming languages, you can import the CAPE-OPEN type libraries directly. An
example if given by the FlowExhange unit operation for which the source code is available with the installation. A
CAPE-OPEN Primary Interop Assembly is in the making, and to be released by CO-LaN, as an alternative to
importing the type library. Once available, this should be used instead to avoid type conflicts in .NET 2 based
assemblies.
You could also use class libraries that will provide .NET to COM wrapping for you. One such a class library is
source: http://www.cocosimulator.org/index_support.html page 3 of 4
written by William Barrett (EPA, US), and is optionally installed by the COCO installer; the installer includes the
libraries, documentation and an example. Alternatively, you could use the MOSE CAPE-OPEN unit operation
wizard for .NET. This package contains base classes, a readme.txt describing how to generate a unit operation,
and examples. See here for details.
• If you are still using Visual Basic 6.0, make sure you have the CAPE-OPEN type libraries installed (available from
CO-LaN or by using the COCO installer). Start a new project, type ActiveX DLL. By default your project will have
one class. Save the project and the class using appropriate names (for example VB6unit.vbp and
UnitOperation.cls). Add a reference to the CAPE-OPEN type libraries (Project, References, CAPE-OPEN 1.1 type
library). Compile your class. Copy the resulting DLL to a reference location. Set the project compatibility mode to
Binary Compatibility (Component tab of project properties), and point to the reference DLL. This insures that the
CLSID between compilations will remain constant.
In the top of the unit operation class, type "Implements ICapeUnit", "Implements ICapeUtilities", "Implements
ICapeIdentification", "Implements ECapeUser", "Implements ECapeRoot", "Implements ECapeUnknown". All of
the functions of these interfaces will require implementation. The body of the function will be generated for you if
you select the interface name from the left combo-box and the function name from the right combo-box.
A unit operation requires two collections, one for ports and one for parameters. Add a class for each of these two
collections, and implement ICapeIdentification, ECapeUser, ECapeRoot, ECapeUnknown and ICapeCollection.
Add a class to represent ports, and implement ICapeIdentification, ECapeUser, ECapeRoot, ECapeUnknown and
ICapeUnitPort. If you want parameters in your unit operation, add a class to represent parameters. Implement
ICapeIdentification, ECapeUser, ECapeRoot, ECapeUnknown and ICapeParameter, and ICapeParameterSpec.
Depending on the type of parameter, you may also need to implement ICapeRealParameterSpec,
ICapeBooleanParameterSpec, ICapeArrayParameterSpec, ICapeIntegerParameterSpec and / or
ICapeOptionParameterSpec.
To implement persistence, set the unit operation class to persistable. Add the member routines
Class_ReadProperties and Class_WriteProperties.
Finally, you need to add information to the registry for other applications to find your CAPE-OPEN unit operation.
This requires you to know the CLSID of your unit operation object (which you can find using RegEdit.exe) and
write a .reg file that adds the appropriate entries for category IDs and the CapeDescription key.
A mixer-splitter example implementing all of the above can be downloaded from here.
• The mixer-splitter example is also available in Visual C++ (Visual Studio 2005 Professional) using ATL and STL,
and can be downloaded from here.
• Another alternative is to put together unit operations without programming. Examples of applications that allow
you to enter CAPE-OPEN unit operation model equations:
• AmsterCHEM's Excel-based CAPE-OPEN Unit Operation
• AmsterCHEM's Matlab CAPE-OPEN Unit Operation
• AmsterCHEM's SciLab CAPE-OPEN Unit Operation
• PSE's gPROMS gO:CAPE-OPEN
• COFE Flowsheet can be used as CAPE-OPEN Unit Operation, hence any combination of CAPE-OPEN
unit operations can be used as unit operation