Page 1 of 1

Read/Write Stream/Unit Operation parameters using COM

PostPosted: 07 March 2019, 12:44
by maazulmosaid
I want to read the temperature of the stream and the parameter of the unit operation using Automation COM Interface of COFE in Excel. I have the following code:
Sub Button1_Click()
Dim document As COFE_Document
Dim unit As ICapeUnit
Dim uti As ICapeUtilities
Dim stream As ICOFEStream


Set document = GetObject("......\Flowsheet.fsd")
Set stream = document.GetStream(1)
Set unit = document.GetUnit(1)
package = document.GetReactionPackageNames()

End Sub

There is no documentation available which shows how do to this. Is this possible in COFE document? If not then when it will be possible to read and write the stream properties?

Re: Read/Write Stream/Unit Operation parameters using COM

PostPosted: 11 March 2019, 10:14
by jasper
The easiest way to do this is to look at the existing code in COFE.xlt, located in the COCO installation folder. Double-click it to start a new Excel document with COFE embedded. Then when it promps for which examples to keep, keep all.

On the 'Access Unit Operations' and 'Access Streams' example sheets you will find the corresponding formulae. You can change these at will by inspecting the VBA code.

The documentation is available both online and in the COCO help on your computer. The automation interfaces: https://www.cocosimulator.org/index_help.php?page=COFE/Automation/automation.htm. The functions that are provided in VBA in Excel: https://www.cocosimulator.org/index_help.php?page=COFE/Automation/Excel/excel.htm