mission

CAPE-OPEN
COCO
Excel Thermo Import
Excel Unit Operation
Matlab Unit Operation
» 
Help
Matlab Thermo Import
OO Calc Thermo Import
REFPROP PPM
SciLab Unit Operation
SciLab Thermo Import
Python Thermo Import
FlowExchange
ThermoSystemAdapter

ScanIt

downloads

services

links

about us

contact us

Matlab script

The calculations performed by the unit operations are defined by Matlab script. You can enter the script by editing the unit operation, and select Script on the Matlab tab.

The Matlab script is run in a fresh Matlab environment, in which useful global variables and functions are predefined. The script should:

DOs and DON'Ts

Do

Don't

Testing

To test your Matlab input, make sure the ports are connected. Then, while writing the script, click the Test button for feedback.

Editing

You can edit the script in the text box provided on the Script tab, or you can click the Edit button. The Edit button will open the external editor. The Matlab Unit Operation dialog will block until this editor has been closed.

The default editor is medit.exe in the Matlab program folder (or notepad.exe if medit.exe cannot be found). You can select a different text editor by holding down Ctrl while clicking on the Edit button.

Example

Example script for a simple adiabatic mixer with two feeds and one product:

f1=getFeedProp(1,'flow')
f2=getFeedProp(2,'flow')
h1=getFeedProp(1,'enthalpy')
h2=getFeedProp(2,'enthalpy')
p1=getFeedProp(1,'pressure')
p2=getFeedProp(2,'pressure')
p=min(p1,p2)
f=f1+f2
h=(h1*f1+h2*f2)/f
totF=sum(f)
setProduct(1,totF,f/totF,'pressure',p,'enthalpy',h)

(This particular script does not take into account that the total flow may be zero; it will fail in this case).

INDEX
CONTENT