[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/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 Flowsheet protection
Page 1 of 2

COFE Flowsheet protection

PostPosted: 15 February 2024, 11:46
by spertant
Hello,

I would like to protect a COFE Flowsheet, so that the users cannot modify the Flowsheet (modify feed values and unit operations parameters, plug-unplug streams...). Is there a way to do so ?

Alternatively (it would be even better) I was thinking to put my Flowsheet in a COFE Flowsheet Unit Operation, so the users could only modify some inputs to this Unit Operation. But I would like to protect this Unit Operation, so the users cannot open it to see the details and of course cannot modify it. Is it possible to do it in COFE ?

Thanks in advance,

Savinien Pertant

Re: COFE Flowsheet protection

PostPosted: 15 February 2024, 12:18
by jasper
There is currently no such protection. I am also not sure what you would be looking for - just a way to prevent the user from opening the GUI and making modifications? That would be rather easy to circumvent, because the COCO .fsd file is just a zip file with an xml inside, which can be manipulated. So then one would need to put a password on the zip file as well, which means you cannot open it anymore without entering the password.

Or would you be looking for an option that says "read only" that can simply be turned off by the user, so no actual protection, but rather the ability to open a document in read-only mode to prevent making modifications by accident?

Re: COFE Flowsheet protection

PostPosted: 15 February 2024, 12:42
by spertant
Thank you for your answer.

In fact I want to build a tool for non-technical people in my company. The aim is to have a user friendly tool and to prevent mistakes by preventing people from modifying the flowsheet.
The best solution would be an excel file, where the user puts some input parameters (feed conditions, some unit operations parameters) and the results of the COFE simulation would be written back in the excel file.
This would work as a black box and the user wouldn't see the COFE flowsheet.
I have started testing the COFE-in-EXCEL document which seems adapted for this, but I also would like to hide (or at least "protect") the flowsheet.

Re: COFE Flowsheet protection

PostPosted: 15 February 2024, 14:56
by jasper
You can embed a COFE flowsheet directly in an Excel sheet (use the Excel template to get started). Then you can simply hide the sheet on which the COFE control is I suppose.

Note that the template uses VBA macros, this may be a disadvantage. It is meant to demo automation.

You can access automation also using COM interfaces directly (there is more info here: and here ). Let me know in case you have more specific questions about this approach.

Re: COFE Flowsheet protection

PostPosted: 20 February 2024, 14:44
by spertant
Hi Jasper,

Thank you for your help.
With the embedded flowsheet in Excel I'm on a good way to achieve my goal.
This topic : http://cape-open-forum.org/viewtopic.php?f=5&t=443
was particularly helpful to me to understand how to modify the flowsheet using excel.

Re: COFE Flowsheet protection

PostPosted: 11 March 2024, 15:15
by spertant
Hi Jasper,
I have another question related to the above topic.
Using the embedded flowsheet in excel, I noticed that when I modify the input values in the excel file, run the simulation, save the excel file and close it, if I re-open the excel file, the last results obtained by the COFE simulation have not been saved (but of course the modifications of the input values directly done in the excel file have been saved).
Is there a way to save the results obtained, avoiding to run again the simulation when we open the excel file ?

Thanks

Re: COFE Flowsheet protection

PostPosted: 11 March 2024, 19:52
by jasper
I am not sure whether this can be done. As the flowsheet is embedded as OLE object, Excel decides whether it should be saved or not. I suppose that if you edit the flowsheet after the solution was imposed, Excel will assume the OLE object was changed and it will be saved. But I do not see an easy way to do this in an automated manner.

Alternatively you could not use an embedded flowsheet, but create it as a COM object. Then Excel will not save it for you - you are on your own for that. You could save to string and load from string, and store the string value in an Excel cell. See LoadFromString, SaveFromString here:

Re: COFE Flowsheet protection

PostPosted: 11 March 2024, 19:54
by jasper
... down side is that apparently Excel can only contain 32000 or so characters in a cell: - for larger strings you need to find a different way, e.g. split it up over multiple cells.

Re: COFE Flowsheet protection

PostPosted: 13 March 2024, 08:10
by spertant
Ok, indeed I noticed that if I manually modify the flowsheet, the modifications are saved. But the COFE-in-EXCEL method loses of its interest...
I will have a look at the COM object. With this method, can I use all the macro that I wrote, to get and set values from/to COFE ?

Re: COFE Flowsheet protection

PostPosted: 13 March 2024, 08:16
by spertant
I have another question about the COFE-in-EXCEL method.
Is it possible to cancel a COFE calculation directly from EXCEL, for instance when the calculation struggles to converge ?

To run the calculation, I use the macro :

Public Sub COFE_CalculateFlowsheet()
Dim COFEDocument As COFE_Document
Set COFEDocument = COFE_GetCOFEDoc
COFEDocument.Solve
End Sub

So I would like to know if there is a similar function as COFEDocument.Solve to stop a calculation ?

Thanks a lot