[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
CAPE-OPEN • View topic - COFE functions in Excel - Get/set

COFE functions in Excel - Get/set

Discusses use of COCO, the process simulation and modelling software suite from AmsterCHEM, downloadable from http://www.cocosimulator.org

Moderator: jasper

COFE functions in Excel - Get/set

Postby HenkF » 31 December 2014, 14:28

Hi Jasper,
as you indicated a while ago, apart from getting data from a flowsheet, it also is possible to set values from external sources. I'm trying to make flowsheets and results available to my colleagues, with some opportunities of changing some data: T,P and feed compositions (to some extent).

I would prefer an Excel-based I/O, where results may be presented, and to some extent input data (temperature, pressure, feed fractions, a U.A factor in heat exchangers, etc) changed.
The best thing: most of it already is available!
* a good development environment for model creation and basic data reference. To me COFE is a perfect hatstand to build upon.
* COFE provides an excellent Excel integration
* From other sources OPC integration, and real time data, is available

Only one thing lacking : the setters for temperature, pressure, feed fractions, and e.g. U.A for a HeatX? Could you please give me a hint, preferably some code snippets, on how to make this working?

Wish you and all board members a happy and loving New Year!
Henk
HenkF
 
Posts: 87
Joined: 24 February 2013, 14:50
Location: Hengelo,NL

Re: COFE functions in Excel - Get/set

Postby jasper » 31 December 2014, 17:31

User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: COFE functions in Excel - Get/set

Postby jasper » 31 December 2014, 17:35

Also note that you are not bound to Excel for doing this; any environment that easily supports automation, for example VB.net, can be used to drive COFE.
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: COFE functions in Excel - Get/set

Postby HenkF » 03 January 2015, 18:12

Hi Jasper,
I will try this option and report the results. I'm aware of other, and maybe more convenient environments that suit my needs, but I like to incorporate thie options within a VBA environment.
Many thanks!
regards, Henk
HenkF
 
Posts: 87
Joined: 24 February 2013, 14:50
Location: Hengelo,NL

Re: COFE functions in Excel - Get/set

Postby kevin032 » 28 November 2019, 09:03

Good morning all,

I desperatly try to set parameters on my COCO file with VBA but I don't manage to do so.

I tried the SetStreamTemperature you defined in previous post but it returns an error : str1.SetProp("temperature", "overall", Empty, "", "", v) (= is needed).
Moreover, I don't manage to make this subroutine accessible in the Macros windows.

Besides, I noticed that the COFE_CompleteCOFERecalc() Macro doesn't seem to work well on my file. Everytime, I set MANUALLY a parameter (for instance a Temperature in the first stream), It doesn't converge and I get the following message :

warning: Simulation Context error in ICapeMaterialTemplateSystem::CreateMaterialTemplate: Invalid stream type name
warning: Material object error in GetComponentConstant: No data
warning: Material object error in GetComponentConstant: One or more missing values
warning: Material object error in GetComponentConstant: No data
warning: Material object error in GetComponentConstant: One or more missing values
warning: Material object error in GetComponentConstant: No data
warning: Material object error in GetComponentConstant: One or more missing values
warning: Simulation Context error in ICapeMaterialTemplateSystem::CreateMaterialTemplate: Invalid stream type name
warning: Material object error in GetComponentConstant: No data
warning: Material object error in GetComponentConstant: One or more missing values
warning: Material object error in GetComponentConstant: No data
warning: Material object error in GetComponentConstant: One or more missing values
warning: Material object error in GetComponentConstant: No data
warning: Material object error in GetComponentConstant: One or more missing values
warning: Simulation Context error in ICapeMaterialTemplateSystem::CreateMaterialTemplate: Invalid stream type name
warning: Material object error in GetComponentConstant: No data
warning: Material object error in GetComponentConstant: One or more missing values
warning: Material object error in GetComponentConstant: No data
warning: Material object error in GetComponentConstant: One or more missing values
warning: Material object error in GetComponentConstant: No data
warning: Material object error in GetComponentConstant: One or more missing values


Would someone be able to help me or to send me a working file with setter so that I could be inspired xD.

Thank you very much for your help.
Best regards,
Kevin
kevin032
 
Posts: 4
Joined: 08 November 2017, 13:46

Re: COFE functions in Excel - Get/set

Postby jasper » 28 November 2019, 09:23

Please note that setting data on the flowsheet is not always safe: https://www.cocosimulator.org/index_hel ... mation.htm

Setting parameter values on unit operations should mostly be ok though.

Can you provide me with the exact error message?

The Macro window shows all public functions that have no arguments. Make sure your macro is public and has no arguments. If the macro is public but does have arguments, you can still use it as a formula from within an Excel cell.

Can you attach an Excel worksheet that demonstrates the problems with COFE_CompleteCOFERecalc?
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: COFE functions in Excel - Get/set

Postby jasper » 28 November 2019, 09:26

User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: COFE functions in Excel - Get/set

Postby kevin032 » 05 December 2019, 09:45

Hi Jasper,

Thank you for your prompt reply. I didn't expect it that quickly :)

You can find the excel file as attached. It is just a simple flash with I am trying to communicate...
Honestly, It's been a long time since I haven't code in VBA so I may miss some skills...

If you have a working file with "Set" so that I could be inspired it would be great.

For scripts, I will have a look for sure.

Best regards,
Kevin
Attachments
SetTemp_Excel_COFE.xlsm
(158.75 KiB) Downloaded 747 times
kevin032
 
Posts: 4
Joined: 08 November 2017, 13:46

Re: COFE functions in Excel - Get/set

Postby jasper » 08 December 2019, 14:12

I see an error on the "access unit operations example" page, cell G5 contains no unit name or index.

Other than that I am not sure what you are trying to do and where. Can you describe what you want to do with this sheet and provide me with steps to reproduce your issue?
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain


Return to COCO (AmsterCHEM)

Who is online

Users browsing this forum: No registered users and 3 guests

cron