The CAPE-OPEN Wizard consists of two parts:
The wizard is available as a stand-alone program or can be installed as a Delphi wizard.
Compiling and running the wizard inside Delphi: The source code for the Delphi wizard is available in the \<CapeOpenFolder>\CapeOpenWizard folder. To install the wizard in Delphi, open the CapeOpenWizard.dpk file in Delphi, view the Project Manager, right-click on the CapeOpenWizard.bpl entry and click on install. Alternatively build the package, then install the wizard by clicking on Install Packages..., then click on Add..., browse to the output folder for compiled packages and select the CapeOpenWizard.bpl file. This should install the wizard and make it available when clicking on File, New and selecting Other.
Compiling and running the stand-alone wizard: The source code for the stand-alone wizard is available in the \<CapeOpenFolder>\CapeOpenWizard\StandAlone folder. Open the StandAloneWizard.dpr file in Delphi and compile and run.
Creating a new CapeOpen project using the wizard: After launching the wizard, the user should see the following window:
The different fields in the wizard are used as follows:
The tab control contains information relevant to each CapeOpen model in the project:
To add extra components to the project, click the Add button. Once all the components have been specified, click the Create project button. This will create a new ActiveX library project, a type library, a Pascal unit for every CAPE-OPEN component in the project, a LinkGUIDsUnit.pas file and (if a Unit component is in the project) a simple editor in InputForm.pas.
A lot of functionality required for a Unit by the CAPE-OPEN specification is contained in a parent class structure. After creating a new CAPE-OPEN Unit, only four methods are automatically created in the new class: PMCInitialize, Terminate, Edit and Calculate. Typical use of each method is described below.
SetWindowPos(Form.Handle, HWND_TOPMOST, Form.Left, Form.Top, Form.Width, Form.Height, SWP_SHOWWINDOW + SWP_NOSIZE);
Additional functionality that can be customized include:
A parent class for the CAPE-OPEN Property Package component has not yet been written. Refer to the PropPackage unit in the TestPropPackage project for an example of a property package class.
A Thermo property system is a class that can be used to select/configure a property package from a list of available packages. Refer to the ThermoSystemUnit in the TestPropPackage project for an example of a property system class.
A CAPE-OPEN Wizard model can be debugged inside Delphi by selecting Debug info under Compiler options. Specify the path to a simulator exe under Run|Parameters| Host Application. Sometimes this does not work properly. The alternative is to start the executable outside the IDE and then attach to the process from inside Delphi (Run|Attach to process).
One can use COCO for testing CAPE-OPEN components, get more detailed results about compliance to the CAPE-OPEN standard, the values and formats of parameters passed over COM and possible error values returned via COM.
The Delphi Type library editor sometimes add bogus methods to the TCapeUnit class in CapeUnitIMPL.pas (observed in Delphi 6, 7, 2005, Turbo Delphi Explorer 2006). Just delete these methods and recompile. Try not to modify stuff using the type library editor. A fix that seems to work in D2005 and D2006 is to remove the unit implementing an automation object from the project, i.e. edit the project file and delete the "in someunit.pas'" bit after the problematic unit e.g. change "Unit1 in 'Unit1.pas'" to "Unit1".
Aspen Plus 2004.1 and 2006 do not correctly process requests to Get/Set compound molar flows. If Aspen is detected as the PME, a call to Get/SetMolarFlows is changed to a Get/SetOverallComposition and getting/setting the total molar flow via the OverallMolarFlow property.