0% found this document useful (0 votes)
112 views

Aspen Examples

Uploaded by

Biswash Paneru
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views

Aspen Examples

Uploaded by

Biswash Paneru
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 100

Reach Your True Potential

Aspen Custom Modeler™ 10.2

Examples 
February 2000
Copyright © 2000, Aspen Technology, Inc. All rights reserved.

™ ™ ™
Aspen Custom Modeler , Aspen Dynamics , Aspen Engineering Suite , Aspen Plus®, AspenTech®,

Plantelligence and the Plantelligence logo, Polymers Plus ®, Properties Plus ®, and the aspen leaf logo are
trademarks or registered trademarks of Aspen Technology, Inc., Cambridge, MA.

All other brand and product names are trademarks or registered trademarks of their respective companies.

This manual is intended as a guide to using AspenTech's software. This documentation contains AspenTech
proprietary and confidential information
information and may not be disclosed, used, or copied without the prior consent of 
AspenTech or as set forth in the applicable license agreement. Users are solely responsible for the proper use of the
software and the application of the results obtained.

Although AspenTech has tested the software and reviewed the documentation,
documentation, the sole warranty for the software
may be found in the applicable license agreement between AspenTech and the user. ASPENTECH MAKES NO
WARRANTY OR REPRESENTATION, EITHER EXPRESSED OR IMPLIED, WITH RESPECT TO
THIS DOCUMENTATION, ITS QUALITY, PERFORMANCE, MERCHANTABILITY, OR FITNESS
FOR A PARTICULAR PURPOSE.

Corporate
Aspen Technology, Inc.
Ten Canal Park 
Cambridge, MA 02141-2201
USA
Phone:
Phone: +1 (617)
(617) 949-10
949-1000
00
Fax: +1 (617) 949-0130
URL:
URL: http
http:/
://w
/www
ww.a
.asp
spen
ente
tech
ch.c
.com
om

Division
Design, Simulation, and Optimization
AspenTech Ltd
Sheraton House, Castle Park 
Cambridge CB3 0AX
UK
Phone:
Phone: +44
+44 (0)1
(0)122
223-3
3-3122
12220
20
Fax: (0)1223-366980 .
+44 (0)1223-366980
February 2000
Copyright © 2000, Aspen Technology, Inc. All rights reserved.

™ ™ ™
Aspen Custom Modeler , Aspen Dynamics , Aspen Engineering Suite , Aspen Plus®, AspenTech®,

Plantelligence and the Plantelligence logo, Polymers Plus ®, Properties Plus ®, and the aspen leaf logo are
trademarks or registered trademarks of Aspen Technology, Inc., Cambridge, MA.

All other brand and product names are trademarks or registered trademarks of their respective companies.

This manual is intended as a guide to using AspenTech's software. This documentation contains AspenTech
proprietary and confidential information
information and may not be disclosed, used, or copied without the prior consent of 
AspenTech or as set forth in the applicable license agreement. Users are solely responsible for the proper use of the
software and the application of the results obtained.

Although AspenTech has tested the software and reviewed the documentation,
documentation, the sole warranty for the software
may be found in the applicable license agreement between AspenTech and the user. ASPENTECH MAKES NO
WARRANTY OR REPRESENTATION, EITHER EXPRESSED OR IMPLIED, WITH RESPECT TO
THIS DOCUMENTATION, ITS QUALITY, PERFORMANCE, MERCHANTABILITY, OR FITNESS
FOR A PARTICULAR PURPOSE.

Corporate
Aspen Technology, Inc.
Ten Canal Park 
Cambridge, MA 02141-2201
USA
Phone:
Phone: +1 (617)
(617) 949-10
949-1000
00
Fax: +1 (617) 949-0130
URL:
URL: http
http:/
://w
/www
ww.a
.asp
spen
ente
tech
ch.c
.com
om

Division
Design, Simulation, and Optimization
AspenTech Ltd
Sheraton House, Castle Park 
Cambridge CB3 0AX
UK
Phone:
Phone: +44
+44 (0)1
(0)122
223-3
3-3122
12220
20
Fax: (0)1223-366980 .
+44 (0)1223-366980
Contents
Introduction
For More In forma tion......... ................................... ................................... ...................... viii
Online Help............ ................................... ................................... ............................... viii
P rinted Man ua ls ...............
......................
..............
..............
...............
...............
..............
..............
..............
...............
...............
..............
..............
.............
...... ix
P ortable Document
Document Forma t Files (PD Fs)...............
Fs).....................
.............
.............
............
............
............
............
............
...........
..... ix
World Wide
Wide Web
Web ................................. ................................... ................................... ......x
Technical Support...........................................................................................................x

1 Five
Fi ve Tanks Example
Run ning the Five Ta nks Exa mple....................................................................... ....... 1-2 1-2
Adva nced F eat ures in Five Ta nks Exa mple ............. ...................
.............
..............
.............
.............
..............
.............
.............
....... 1-3
1-3
U sing Microsoft
Microsoft Excel............ ................................... .................................... .............. 1-3 1-3
Run ning from Microsoft
Microsoft Visual B a sic ........................................................................ 1-4 1-4
Ta sks ..................... ......................... ........................ ......................... ......................... ... 1-5
1-5

2 Absorber
Absorber E xample
Models U sed in th e Absorber Exa mple ...................................................................... 2-2 2-2
Sett ing U p P roperties
roperties P lus for t he Absorber
Absorber E xample ...........
.................
...........
...........
............
............
...........
....... 2-3
2-3
Run ning th e Absorber Exa mple ............................................................... .................. 2-32-3
Adding Cont rollers
rollers to th e Absorber Exa mple ............................................................ 2-4 2-4

3 Double
Double Effect Evapo
E vaporator
rator Optimization
Opti mization Exam
E xample
ple
Running the Double Effect Eva pora
pora tor Exa mple.......
mple.............
............
............
.............
.............
............
............
...........
..... 3-2
3-2

4 Heated Metal Cube (PDE) Example


Running the Hea ted Cube Exa mple...........
mple.................
.............
..............
.............
.............
..............
.............
.............
..............
...........
.... 4-2
4-2

5 Heated Metal Slab (PDE) Example


Runn ing the Hea ted Sla b Exa mple.................
mple.......................
.............
..............
.............
.............
.............
.............
..............
............
..... 5-2
5-2
Viewing
Viewing a P lot
lot of th e C orner Temperatu
Temperatu res .............
...................
.............
..............
.............
.............
..............
.............
.........
... 5-3
5-3

6 Reactor
Reactor Dynamic E stimation
stimation E xample
xample
Running the Reactor D yna mic Estima tion Exa mple..............
mple....................
............
...........
...........
............
...........
....... 6-2
6-2

7 Steady-Sta
Steady-State
te Estimation
E stimation of a Methanol R eactor
eactor
Running the Metha nol R eactor Exa mple.............
mple...................
.............
..............
.............
.............
..............
.............
.............
......... 7-2
Cont rolling NL2SOL Options ......................................................... ............................ 7-47-4

As p e n C u s t om M od e l e r E x a m p l e s iii
Version 10.2
8 Catalytic Bed Regeneration Example
Running the Ca ta lytic B ed Exa mple.......................................................................... 8-3

9 Steady-State Methanol Reactor with Re-Cycle Example


Runn ing the Metha nol Exa mple.................................................................................... 9-2
Loa ding th e Exa mple.................. .................................... ................................... ......... 9-2
B uilding th e Flows heet. .............................................................. ................................ 9-3
Conn ecting th e B locks ................................ ................................... ............................. 9-4
En tering the Input Da ta ............................................................................................. 9-5
Running the Simula tion a nd Reviewing Results ....................................................... 9-6
Cha nging the Simula tion ........................................................................................... 9-6
View ing Ch a nges ............................... ................................... .................................... .. 9-7
Sa ving New Specifica tions..... .............................................................. ....................... 9-7
Homot opy...................................... ................................... .................................... ........... 9-8
Wha t is Homot opy?............................... .................................... .................................. 9-8
Running the Homotopy Exa mple ............................................................................... 9-8
Runn ing the Optimizat ion Exa mple .............................................................................. 9-9

10 SPEEDUP 5 Library With Flash Example


About SP EE DU P a nd the Aspen Cust om Modeler Libra ry ......................................10-2
P rocedures Required by the SP EE DU P 5 Librar y Models .......................................10-2
Models in the SU5Lib Library...................................................................................10-4
SPEEDUP 5 Library Files.........................................................................................10-5
Fla sh Exa mple Files .............................................................. .................................... 10-5
Running the Flash Example......................................................................................10-5

11 Water H ammer (PDE) Example


Running the Wat er Ha mmer Exa mple .....................................................................11-2

12 High Temperature Shift Reactor (PDE ) Example


Reactor Kinetics.........................................................................................................12-2
Modeling St ra tegy .................................. .................................... ...............................12-4
In itia lizat ion St ra tegy .......................................................... .....................................12-5
St ead y-St a te Design .............................................................. .................................... 12-6
Dynamic Operability Study.......................................................................................12-6
Setting Up the Interface............................................................................................12-7
Running the Example................................................................................................12-7

13 Dynamic Optimization E xample


Running the Dynamic Optimization Example..........................................................13-2
Viewin g th e Dy na mic Optimiza tion In puts ..............................................................13-2
Viewin g th e Flows heet Const ra int s .......................................................... ................13-3
Creating a Task to Implement the Optimal Profiles.................................................13-3

iv Aspen Cust om Modeler Exa mples


Version 10.2
14 CDI Example
Running the CDI Example........................................................................................14-2
P erforming a Dyn a mic Run an d G enerat ing the A Mat rix ......................................14-3

15 pH Controller Example using Simulation Access eXtensions


Running the pH Control Example.............................................................................15-2
Using SAX..................................................................................................................15-3

16 Gary Blau Estimation Example


Running the Parameter Estimation Example............................................................16-2

17 External Nonlinear Algebraic Solver E xample


B uilding a nd U sing the Exa mple D LL ......................................................................17-2

18 Exporting an Aspen Custom Modeler Flowsheet


Export ing the Cy clohexa ne P roduction Flowsh eet ...................................................18-2
Run ning th e Export ed Flow sheet in Aspen Plus ......................................................18-5

19 Handli ng Events in a Vi sual Basic ActiveX DLL


Creating the ActiveX DLL for the Example..............................................................19-2
Addin g a Test Pr oject .............................. ................................... ...............................19-3

Aspen Cust om Modeler Exa mples v


Version 10.2
vi Aspen C ust om Modeler E xa mples
Version 10.2
Introduction

Introduction
Exa mple simulat ions a re included in your Aspen Cust om Modeler™ insta llation.
If y ou ha ve insta lled in t he default location, these will be in the folder
C:\Program Files\AspenTech\Aspen Custom Modeler 10.2\Examples.

To run one of these examples:


 Copy th e files in th e exa mple directory t o a convenient w orking folder, for
example:

C:\ P rogra m Files\ AspenTech\ Working Folder\ Aspen Cu stom Modeler 10.2

This manual contains step-by-step instructions on the examples supplied with


Aspen Cust om Modeler™ including:
• Five Tanks example
• Absorber exa mple
• Double effect evaporator optimization example
• Hea ted meta l cube (P DE ) exa mple
• Heat ed meta l sla b (P DE ) exam ple
• Reactor dyna mic estimat ion example
• Steady-state estimation of a methanol reactor
• Catalytic bed regeneration example
• St eady-sta te metha nol reactor wit h recycle example
• S P E E D U P 5 li br a r y w i t h f la s h e xa m p le
• Wa ter ha mmer (P DE ) exa mple
• High tempera tur e rea ctor shift (P DE ) exa mple
• Dy na mic optimizat ion example
• CD I exa mple
• Simu la tion Access eXtensions exam ple
• G ar y B lau estima tion exa mple
• Ext erna l nonlinear a lgebra ic equa tion solver example
• Exporting a n Aspen Cust om Modeler flowsh eet a nd using it in Aspen P lus
• Ha ndling event s in a Visua l B a sic ActiveX DLL

Aspen C ust om Modeler E xa mples vii


Version 10.2
About This
Manual

For More Information


1
You can obta in informa tion on Aspen Modeler  products by:
• Accessing t he comprehensive online H elp syst em
• Reading t he printed man ua ls supplied w ith your product
• P rinting t he P orta ble Document F orma t (PD F) files supplied on th e
Documentation CD
• Accessing Aspen Technology's w eb pa ge
If you need more deta iled a ssista nce tha n t ha t provided in th e online Help an d
the P DF files, you can conta ct Technical S upport .

This section explains how t o use the online help, print P DF files, find Aspen
Technology on t he w eb, an d cont a ct Technica l Support .

Online Help
To a ccess onlin e H elp:

 Fr om th e Help menu, click H elp Topics an d t hen do one of the follow ing:

To Do this

Display a hierarchy of topics by Click the Contents tab


category

Display an index of all Help topics Click the Index tab and then type the word you require

Search for words or phrases within t he Click the Find tab and then type the word or phrase you require
Help topics

Tip To display H elp on but tons, fields, menu comma nds, an d oth er screen
element s, click th e Wha t's This but ton: or , at the top of the window, a nd
th en click the element.

Printing Online Help


To displa y informa tion on how t o print online H elp:
1. Open your Aspen Modeler product a nd fr om the H elp menu, click Help Topics.
2. On the Content s ta b, double-click Using H elp a nd th en double-click P rint
H elp Topics.

1
 Aspen Modeler products include Aspen Cust om Modeler™ , Aspen Dyn a mics™ , Aspen
ADSIM™ , and Aspen Ch romatography™ .

viii Aspen C ust om Modeler E xa mples


Version 10.2
Introduction

Improving Help
We value your comments, suggestions, and criticisms. If you could not find the
informa tion you wa nt ed, needed more assista nce, or ha ve any suggestions for
improvements to our online informa tion, we wa nt to know.

P lease email your comments to:

[email protected]

Printed Manuals
The following printed manual is supplied with your product:
• A sp en C u s t om M od el e r a n d A sp en D yn a m i c s I n st a l l a t i on M a n u a l  
This guide pr ovides inst ructions on inst a lling th e product(s).

Portable Document Format Files (PDFs)


In a ddition t o the printed ma nua ls supplied w ith your product, you ca n a lso print
copies of all of th e man ua ls supplied a s P orta ble Document F orma t files (P DF s)
on the D ocumenta tion CD . To do this, you must ha ve Adobe Acroba t Reader
insta lled on your ma chine.

Tip If you do not ha ve the Adobe Acrobat Reader, you ca n download a fr ee copy
from the Adobe web site a t http://www.adobe.com.

Note Adobe a nd Acroba t ar e tr a demar ks of Adobe Sy stems, Incorpora ted.

Aspen Cust om Modeler Exa mples ix


Version 10.2
About This
Manual

World Wide Web


For additional information about AspenTech products and services, check the
AspenTech World Wide Web home pa ge on t he I nt ernet a t:

http://www.aspentech.com/

Technical Support
You can get help from AspenTech's technical support resources on the World Wide
Web, or by contacting an AspenTech office.

AspenTech Technical Support on the Internet


AspenTech customers wit h a valid license and softw a re ma intena nce agreement
can r egister t o access the Online Technical Support Center a t :

http://support.aspentech.com/

Approximat ely t hree da ys a fter r egistering, you w ill receive a confirma tion e-ma il
a nd y ou w ill then be able to access this informa tion.

The w eb support site a llow s you to:


• Access current product document a tion
• Sea rch for tech tips, solutions a nd frequently a sked questions (FAQs)
• Sea rch for a nd download a pplica tion exa mples
• Submit a nd tr a ck technical issues
• Send suggestions
• Report product defects
• Review lists of know n d eficiencies an d defects
Registered u sers ca n a lso subscribe to our Technica l Su pport e-B ulletins. These e-
B ulletins a re used to proa ctively a lert users to importa nt technica l support
informa tion such a s:
• Technical advisories
• P roduct updates a nd S ervice P a ck a nnouncements
The most up-to-da te cont a ct informa tion for your n ear est support office is a lso
a va ilable on AspenTech's web pa ge.

x Aspen C ust om Modeler E xa mples


Version 10.2
Introduction

AspenTech Hotline
If you need help from an AspenTech Customer Support engineer, contact the
Hotline at a ny of these locations:

Location Telephone Number Fax Number E-mail Address

North America & the +1-617/949-1021 +1-617/949-1724 [email protected]


Caribbean
+1-888/996-7001
(toll free)

South America
(Argentina office) +54-11/4393-5308 +54-11/4394-8621 [email protected]
(Brazil office) +55-11/5012-0321 +55-11/5012-4442 [email protected]

Europe, Gulf Region, & Africa [email protected]


(Brussels office) +32-2/724-0100 +32-2/705-4034
(UK office) +44-1223/312220 +44-1223/366980

Japan +81-3/3262-1743 +81-3/3262-1744 [email protected]

Asia & Australia +65/295-83-30 +65/295-83-25 [email protected]

   

Aspen C ust om Modeler E xa mples xi


Version 10.2
About This
Manual

x ii As p e n C u s t om M od e l e r E x a m p l e s
Version 10.2
Chapter 1

1 F i v e Ta n k s E x a m p l e
This exa mple models
models five open
open ta nks in series. The
The key a ssumpt ions
ions a re:
• Flow out of each tank is proportional to the square root of the level of fluid in
the ta nk
• Fluid
Fluid a t consta
consta nt density
• Ta nk geometr
geometr y is a regular sided
sided vert ica
ica l cylinder
cylinder
• No overflow condition

As p e n C u s t om M od e l e r E x a m p l e s 1- 1
Version 10.2
Five Tanks
Example

R unning
unning the Five Tanks E xample
xample
Exa mple simulat
simulat ions
ions a re included
included in your Aspe
Aspen n C ustom Modele
Modeler™
r™ insta lla
lla tion.
If you ha ve insta lled
lled in t he default loca
loca tion, file
filess for this example will be in th e
folder:
C:\ P rogram Files\Asp
Files\AspenTenTecech\
h\ Aspen
spen Cust om Modele
Modelerr 10.2
10.2\E
\E xamples\Fiveta nk

To run t his exa mple:


 Copy th e files
files in th e exa
exa mple directory
directory t o a convenient
convenient w orking folder,
folder, for
example:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\FiveTank

To run the simulation:


1. Fr om th e File menu, clic
click
k Open.
Open.
2. Open the FiveTa
FiveTa nk folder.
folder. If you ha ve copi
copied
ed the files
files to th e exam ple w orking
folder,
folder, t his is:

C:\ P rogra m Files\ AspenTec


spenTech\
h\ Working Folder\ Aspen Cus tom Modeler
Modeler 10.2

3. D ouble-clic
ouble-click
k t he file fivetank.acmf .

You
You can run the simulat ion ion dyna mica
mica lly and cha nge the feed
feed flo
flow r a te to the first
ta nk using a n AllV
AllVaa ria bles
bles ta ble.
ble. To
To do this:
 In t he Flow
Flow sheet
sheet w indow, double
double--clic
click
k the str eam FeedSt ream t ha t enters
Ta nk1. En ter a new va lue for
for th e varia ble displa
displa yed as Flow.

You can see the simulation respond to your step change by displaying a plot. To
do this:
1. In th e All It ems pa
pa ne of
of the Sim ula tion Explorer,
Explorer, clic
click
k Flow
Flow sheet.
2. In th e Cont ents pan e, double-cl
double-click
ick th e plot
plot TankVolumes to display
display it.
3. Double-cli
Double-click ck th e ta nk icons
icons on th e flowsheet.
flowsheet. This
This gives a more deta iled
iled plot
plot of
k ey
ey t a n k d a t a .
4. Click
Click Run and w a tch the simula
simula tion respond
respond to your step change.

1-2
1-2 Aspen Cu st om Modeler E xa mples
Version 10.2
Chapter 1

Advanced Features in Five Tanks


Example
The a dva nced feat ures in this example ar e:
• U sing Microsoft® Excel
• Running from Microsoft® Visua l B a sic®
• Tasks

Using Microsoft Excel


While Aspen Cust om Modeler™ is runn ing a simula tion, you ca n use Microsoft®
E xcel to display a rea l-time profile plot of th e ta nk levels.

1. Fr om E xcel, open FiveTa nk.xls.


2. If prompted, select th e options to ena ble ma cros a nd to upda te linked
information.
3. Select t he Ta nk Level Plot sheet, a nd click the Run butt on to run t he
simulation.

Capturing Real Time Data using Excel


You can use Visua l B a sic wit hin E xcel to capture simulat ion results t o a ta ble.

To run t he exam ple, load t he FiveTa nk.a cmf file a nd t he FiveTa nk.xls E xcel file.
1. In t he FiveTa nk.xls E xcel file, click th e w orksheet ca lled Im port D a ta .

You can change t he default va lues of th e fields.

By default, the volume of fluid in Tank5 is imported from the file


FiveTa nk.a cmf. The da ta is read into th e spreadsheet every t wo seconds of
real time.
2. In th e Excel spreadsheet, click the Run butt on to sta rt t he simulat ion running
an d to sta rt t he data reading into the sprea dsheet.

You can see time /value pairs a ppea ring in a column in t he spreadsheet.
3. When you have enough da ta , click the P a use butt on.

You can n ow use the time /value dat a to define a plot, or to use in further
spreadsheet calculat ions.

Aspen C ust om Modeler E xa mples 1- 3


Version 10.2
Five Tanks
Example

Applying Step Changes at Specified Times Using Excel


You can use Visual B a sic in E xcel to apply a number of step changes in fixed
variables at specific times. To do this, load the FiveTank.acmf file and the
FiveTank.xls Excel file.
1. Ma ke sure you ha ve run th e FiveTa nk exa mple a s described in Running th e
Five Ta nks E xa mple on pa ge 1-2.
2. In t he FiveTa nk.xls Excel file, click the w orksheet ca lled Schedule.

The w orksheet S chedule conta ins a number of t ime /va lue pairs r epresenting
the desired va lue of feed flowra te a t a specific time.

You can a lter t he va lues of th e feed flow ra te a pplied a t specific times by


editing the values in the columns. You can a lso a dd to the number of time /
value pairs.
3. In t he Excel spreadsheet, click the Run Schedule butt on to run the simulat ion
a nd a pply t he step cha nges at the specific times.

Running from Microsoft Visual Basic


You can cont rol the simulat ion from Microsoft® Visual B a sic® . This ena bles you
to ea sily make cha nges to the key input da ta va lues a nd get results back into a
single dia log box.

To loa d t he files int o Visua l B a sic:


 D ouble-click Fiv eTa nk.v bp

To run th e cont rol a pplicat ion:


 In Visual Ba sic, click the Sta rt but ton.

U se the spin box to alt er the feed flow ra te t o Ta nk1.

Ta nk volumes a re reported in th e cont rol pan el. The color of t he t ext la bels for
the ta nk volume indicate low a lar m a nd high a larm conditions.

1-4 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 1

Tasks
You can r un a ta sk tha t is supplied with the example. This ta sk covers the ma in
ta sk fea tur es a va ilable in Aspen Cust om Modeler™ .

To do th is, you need to a ctivat e the t a sk:


1. At the sta rt of a dyn a mic run, in the All It ems pa ne of the Simulat ion
Explorer, click F low sheet.
2. In t he Content s pa ne, double-click the ta sk named TestTask to activate it.

Now wh en you run a dyna mic simulat ion, the instructions in the ta sk ar e ca rried
out. These instr uctions show a number of different distur ban ces you ca n ma ke to
a dyna mic run.

You can look at the results of the simulation through predefined plots.

To display the TankVolumes plot :


1. In t he All It ems pa ne of the Sim ula tion Explorer, click Flow sheet.
2. In t he Cont ents pan e, double-click th e plot TankVolumes to display it.
3. Click Run and wa tch the simula tion respond to your step change.

Ea ch tan k on the flowsh eet conta ins a plot na med Ta nkP lot.

   

Aspen C ust om Modeler E xa mples 1- 5


Version 10.2
Five Tanks
Example

1-6 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 2

2 Absor ber E xa m ple


This example is for users of Aspen Cust om Modeler™ w ith P roperties P lus. You
therefore ha ve to have Aspen P lus® insta lled to use this exa mple.

Note If you are using a Simulat ion Engine insta llation from a client ma chine,
ma ke sure tha t y ou run Aspen P lus using the sa me server and the sam e working
folder a s you ha ve configur ed for Aspen Cu stom Modeler.

This exam ple simula tion is from Equi li bri um -Stage Separat ion Oper ati ons in 
Chemi cal Engi neeri ng , by Ernest J . Henley a nd J .D. Seader, Exa mple 12.8, page
466. A simple, 6-sta ge-a bsorber is used to r emove heavy components from a light
ga s strea m w ith a high-molecular weight oil.

There is a pressure cont roller a nd a level cont roller on t he column.

This example illustra tes t hese area s of Aspen C ustom Modeler™ :


• How to use models within models, or hierarchy
• How to use scripts to help initia lize models in stead y-sta te
• How to write equations which are automatically normalized
• How to use loca l or simplified physica l propert ies
• Model polymorphism ba sed upon the st ructu re of the flow sheet
• Model polymorphism based upon parameters
• How to sta rt a dyna mic simulat ion

Aspen C ust om Modeler E xa mples 2-1


Version 10.2
Absorber
Example

Models Used in the Absorber Example


There are several models in the simulation:

Model Name Used to

antoine_model Calculate coefficients for a simple ideal model for equilibrium k values based upon a
simplified Antoine’s equation

column Model a complete absorption column

enthalpy_model Calculate coefficients for a simple component enthalpy model for the vapor and liquid
phases

props Calculate physical properties based upon the simplified equations or rigorous physical
property calls from PROPERTIES PLUS

tray Model a single stage

tray_hydraulics Calculate the holdup and flow rates for the vapor and liquid phases for each tray

The tra y model is the hear t of the simula tion, and includes ma teria l and energy
bala nce equa tions for a n equilibrium sta ge model. The equat ions a re writ ten so
tha t th ey a re self-norma lized by the flows in t he column. This helps speed t he
solution of the problem. The column model orga nizes ea ch of the m odels int o the
a bsorber simulat ion.

Note the str ucture of ea ch of th e models. For exa mple, th e tra y model and column
model include IF st ructures a round logica l IS CONNE CTED for ea ch of th e ports.
This illustr a tes how t he model ca n convert it s equa tions to new equa tions
depending upon th e flow sheet connectivit y, an d is a n example of model
polymorphism. In a ddition, a para meter called proptype is used to switch the
models between rigorous and simple property models, and is another example of
polymorphism.

2-2 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 2

Setting Up Properties Plus for the Absorber Example


You need to set up Properties Plus for the simulation. You only need to do this
once:
1. Loca te the exa mple folder Absorber. If you copied th e files to the exa mple
working folder, this is:

C:\ P rogra m F iles\ AspenTech\ Working Folder\Aspen Cust om Modeler


10.2\Absorber

2. Load th e file Absorber.bkp in to Aspen P lus an d run it.


Note This is a properties only input file, so you will not see a flowsh eet in
Aspen Plus.
3. From the File menu, click Sa ve As an d save the simulation as a n Aspen P lus
document (.a pw file), th en exit Aspen P lus.

Now you ca n run th e exam ple.

Running the Absorber Example


When you have set up Properties Plus, you can run the Absorber example. To do
this:
1. In Aspen Cu stom Modeler, from the File menu, click Open.
2. Open the Absorber folder. If you copied the files to th e exa mple w orking
folder, t his is

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\Absorber

3. Click th e example file Absorber.acmf then click Open.


4. In t he All It ems pane of the Simula tion Explorer, click Flow sheet to select it.
5. In t he Content s pane, double-click the ta sk nam ed FeedDisturba nce to
activat e it.

6. In t he Contents pan e, double-click the script Init ializeSimulation to run it.


The InitializeSimulation script:
• Fixes the feed compositions, flows, temperatures, and pressures in each of
th e feed stream s. Notice a lso tha t w e use a strea m model.
• Init ializes the tempera tur e, liquid a nd va por flows in t he absorber. The
specabsorber script fixes the pressure and temperat ure in th e absorber,
a nd frees the duty for each sta ge.

Aspen C ust om Modeler E xa mples 2-3


Version 10.2
Absorber
Example

• Runs th e simulat ion. A stea dy-sta te run a t t his point is at a fixed


temperat ure of 50° C. This simulat ion converges very q uickly, a nd shows
the power of using simplified properties and initialization.
• Sw itches the simulat ion to rigorous properties and a n a diaba tic duty for
e a ch t r a y .
• Runs a steady-sta te simulation again.
• Switches the specifications of the absorber to dynamic specifications,
wh ere tra y coefficients a re used to ca lculat e the pressure, and the va por
a nd liquid product flows a re fixed.
Now you can a dd contr ollers.

Adding Controllers to the Absorber Example


When you have set up Properties Plus, and run the Absorber example, follow 
these steps to add controllers:
1. Fr om th e Models folder of the Modeler libra ry , pla ce a P ID contr oller on the
flow sheet. This will be a pressure controller to maint a in the vapor flow 
based on the pressure in the top sta ge of the a bsorber.
2. U se the built-in stream C ontrolSigna l to connect these va ria bles:

Connect from To

B1.p(1) PID variable PV

PID variable OP B1.vapor_out

3. P lace a nother P ID controller on the flowsh eet. This will be a level controller
to ma nipulate t he liquid flow ba sed on t he bott om st a ge liquid level. Use
ControlSigna l to connect t he new P ID contr oller:

Connect from To

B1.Stage(6).Sieve.Liquid_Height PID variable PV

PID variable OP B1.liquid_out

4. Double-click each cont roller t o access the cont roller fa ce-plat e, an d th en click
the C onfigure butt on . For each contr oller, click the In itialize Va lues but ton t o
set up defa ult va lues for t he contr oller.

2-4 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 2

5. En ter the follow ing tun ing par a meters:

Tuning Parameter Pressure Controller Level Controller

Gain 5 %/% 5 %/%

Integral Time 5 min 10000 min

Controller Action Direct Direct

6. When you ha ve a dded the controllers, run the simulat ion in steady-sta te
mode.
7. Cha nge the run mode to Dyna mic and sta rt the run.
8. View cha nges in th e column tempera tu re profile using th e Flowsh eet plot
TempP rofile.

   

Aspen C ust om Modeler E xa mples 2-5


Version 10.2
Absorber
Example

2-6 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 3

3 D ouble E ffect
E va pora t or Opt imiza t ion
Example
This example models a tw o-sta ge evaporat or system.

A glycol/w a ter solut ion ent ers th e first vessel an d is hea ted by stea m. The glycol
is concentr a ted a nd t he vapor offta ke from t he first vessel is used to heat the
second eva pora tion sta ge running a t a lower pressure.

The Objective expression t o be ma ximized is defined in t he Flowsh eet Const ra int


definition.

The decision va ria bles a re given a specifica tion Vary . For t his simulat ion, t he
decision va riables a re:
• Outlet P ressure for th e Va por str eam
• Valve position for t he process feed st rea m, effectively th e process feed flow 
rate
• Va lve position for t he stea m feed strea m, effectively t he stea m feed flow ra te
The following constraints are applied to the simulation in the Flowsheet
Constra ints definition:
• Minimum concentr a tion in E va porat or 2 is 0.12 kg/kg
• Minimum pressure in Eva pora tor 2 is 30.0 bar
• Ma ximum temperat ure in both evaporat ors is 100.0 Celsius

3 D ouble E ffect E va por a t or Opt imiza t ion E xa mple


Version 10.2
Double Effect
Evaporator

Running the Double Effect Evaporator Example


Exa mple simulat ions a re included in your Aspen Cust om Modeler™ insta llation.
If you ha ve insta lled in t he default loca tion, files for this example will be in th e
folder
C:\Program Files\AspenTech\Aspen Custom Modeler
10.2\Examples\EvaporatorOpt

To prepa re to run th is example:


 Copy th e files in th e exa mple directory t o a convenient w orking folder, for
example:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\EvaporatorOpt

To run t his exa mple:


1. Open th e file DoubleEffectE va p. If you copied the files to th e example
w orking folder, t hese files ar e locat ed in:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\EvaporatorOpt

2. Run the simulat ion in stea dy-sta te mode.


3. Cha nge the mode to Optimizat ion, a nd run the simulat ion aga in.

   

3- 2 3 D ou
Version 10.2
Chapter 4

4 H ea t ed Met a l C ube
(P D E ) E xa mple
This simulat ion models a cube of a ma teria l heat ed across three surfa ces.

The heat flux through t he ma teria l slab is m odeled in t hree dimensions. The heat
flux equa tion is a second order, pa rtia l derivat ive. P a rt ial derivat ives a re used in
thr ee spa tia l dimensions t o model the cube of ma terial.

Ta sks ar e provided th a t simula te ra ising the temperat ure of thr ee of the surfa ces
of the cube an d ra ising the tempera tur e of th ree of th e edges of the cube. You can
combine these heating effects t o experiment w ith different dyn a mic temperat ure
profiles in t he cube.

A Microsoft® E xcel sprea dsheet file is provided, which shows t empera tu re


cont ours a t four slices in the cube.

Aspen C ust om Modeler E xa mples 4- 1


Version 10.2
Heated Metal
Cube Example

Running the Heated Cube Example


Exa mple simulat
simulat ions
ions a re included
included in your Aspe
Aspen n C ustom Modele
Modeler™
r™ insta lla
lla tion.
If you ha ve insta lled
lled in t he default loca
loca tion, file
filess for this example will be in th e
folder
C:\Program Files\AspenTech\Aspen Custom Modeler
10.2\Examples\HeatedCube

To run t his exa mple:


 Copy th e files
files in th e exa
exa mple directory
directory t o a convenient
convenient w orking folder,
folder, for
example:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\HeatedCube

To run th e example, follow


follow t hese st eps:
1. Fr om the F ile menu, clic
click
k Open.
2. Open th e Hea tedC ube folder.
folder. If you
you cop
copied
ied th e files
files to th e example working
folder,
folder, t hese files
files a re loca
loca ted in:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\HeatedCube

3. Double-click the example file HeatedCube.acmf .


4. In the All Items pane of the Simulation Explorer, click Flowsheet.
5. In the Contents pane, you can activa te a combicombina na tion of th e ta sks
Wa rmE dge1,
dge1, 2, a nd 3, an d Wa
Wa rmS urfa ce1,
ce1, 2,
2, an d 3. Yo
You ma y w ish to edit
these ta sks to alter the sta rt t imes,
imes, so tha t t he heat
heat ing effe
effeccts sta rt a t
different
different times.
Note After you you have edited
edited a ta sk, you must compil
compilee a nd then activat e it.
To do this, click the task with the right mouse button and then click Compile.
After compil
compiling
ing a ta sk, activa te it by clic
clicking
king it w ith t he right mouse butt on
and then clicking Activate.
6. Open
Open th e Micro
Microso
soft®
ft® Excel
Excel spreadsh
spreadsh eet eet file Hea tedCube.xls
tedCube.xls to display
display t he
temperat ures inside
inside the cube.
cube. If a dia loglog box
box appea
appea rs a sking if
if you
you wa nt t o
update your workbook, or your macros, click YES.
Note You
You need E xcel
xcel 7.0 or la
la ter t o use this file.
file.

7. In Aspen
Aspen Custom Model
Modeler,
er, clic
click
k Run to star t t he dyna mic run t hen in Excel
Excel,,
wa tch the plo
plots
ts change as the surfa ce temperat ures increase.
increase. You
You may need
to pause th e simula
simula tion to allow E xcel
xcel time to upda
upda te th e surface plo
plot.

   

4-2
4-2 Aspen Cu st om Modeler E xa mples
Version 10.2
Chapter 5

5 H ea t ed M et a l S l a b
(P D E ) E x a mpl
mp l e
This simulation models a slab of a material heated and cooled on opposite sides.
For example,
example, this simula tion coul
couldd represent
represent the hea t flow t hrough t he wa ll of
of a
vessel, heated or cooled with a jacket.

The heat flux through t he ma teria l slab is modeled


modeled in tw o dimensio
dimensions.
ns. The
The heat
flux equa tion isis a second
second order, pa
pa rtia l derivat
derivat ive.
ive. P a rt ial derivat ives
ives a re used in
in
tw o spa
spa tia l dimensio
dimensionsns to model
model the slab of mat erial.

Two t a sks a re used to model tra nsient effects


effects during dyna mic simula
simula tion. The
The
tasks model a pulse of warm fluid passing over two of the edges of the slab. These
pulses
pulses sta rt a t the sa me time, but the period
period is different,
different, so the pulses
pulses become
become out
out
of phase as the simulation proceeds.

A Microsoft®
Microsoft® E xcel
xcel spreadsh eet file is is provided to give a su rfa ce plot
plot of t he
temperat ure in th e tw o spa
spa tia l directions
directions modele
modeled.
d.

As p e n C u s t om M od e l e r E x a m p l e s 5- 1
Version 10.2
Heated Metal
Slab Example

Running the Heated Slab Example


Exa mple simulat
simulat ions
ions a re included
included in your Aspe
Aspen n C ustom Modele
Modeler™ r™ insta lla
lla tion.
If y ou ha ve insta lled
lled in t he default location,
location, the files
files for th is exa
exa mple will be in
th e folder
folder
C:\Program Files\AspenTech\Aspen Custom Modeler
10.2\Examples\HeatedSlab

To run t his exa mple:


 Copy th e files
files in th e exa
exa mple directory
directory t o a convenient
convenient w orking folder,
folder, for
example:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\HeatedSlab

To run t he exam ple:


1. Fr om the F ile menu, clic
click
k Open.
2. Open th e Hea tedS la b folder.
folder. If you
you cop
copied
ied th e files
files to th e example working
folder,
folder, t hese files
files a re loca
loca ted in:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\HeatedSlab

3. D ouble-clic
ouble-click
k t he f ile HeatedSlab.acmf .
4. In the All Items pane of the Simulation Explorer, click Flowsheet.
5. In t he Contents pan e, clic
click
k Flow
Flow sheet
sheet a nd a ctivat e the ta sk Side2.
Side2.
6. In t he mode box
box on
on t he Run C ontrol too
toolbar, cha nge the run mode to
Dynamic.
7. B efore
efore run ning the simulat ion,
ion, open
open th e Microsoft®
Microsoft® E xcel
xcel sprea dsheet file
file
Hea tedS lab.xls to display
display the tempera
tempera tur es inside the slab. If a dia log
log box
box
a ppea
ppea rs a sking if you
you w a nt to updat e your
your w orkbook,
rkbook, or
or your ma cros,
cros, clic
click
k
YES.
Note You You need
need Excel
Excel 95 or la ter to use th is sprea dsheet file.
file.
8. St ar t the dynam ic run an d wa tch the Excel
Excel surface plo
plot change as the
temperat ures change on tw o oppo
opposite
site edges
edges of the slab. You may need to
pause th e simulation to allow E xcel
xcel time to upda
upda te th e surfa ce plot.
plot.

5-2
5-2 Aspen Cu st om Modeler E xa mples
Version 10.2
Chapter 5

Viewing a Plot of the Corner Temperatures


You can view a plot in Aspen C ustom Modeler™ of the corner t empera tur es of th e
heated slab. To view this plot:
1. In t he All It ems pa ne of the Sim ula tion Explorer click Flowsh eet.
2. In t he Content s pane, double-click the plot called CornerTempera tu res.

   

Aspen C ust om Modeler E xa mples 5- 3


Version 10.2
Heated Metal
Slab Example

5-4 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 6

6 Rea ct or D y n a m ic
E stima t ion E xa mple
This exam ple models a simple rea ctor. There a re th ree component s in th e syst em
an d tw o main reactions.

The components are represented by A, Q, and S.

The rea ctions a re :

K3

A → S  (1)

K1 K2

A → Q  → S  (2)

Where both reactions a re ra te-ba sed.

The estima tion simulat ion calculat ed estimat ed values of K1, K2, a nd K 3 from
experimenta l measurements of the concentr a tions of A a nd Q.

Aspen C ust om Modeler E xa mples 6-1


Version 10.2
Reactor
Dynamic
Estimation
Example

Running the Reactor Dynamic Estimation Example


Exa mple simulat ions a re included in your Aspen Cust om Modeler™ insta llation.
If y ou ha ve insta lled in t he default location, the files for th is exa mple will be in
th e folder
C:\Program Files\AspenTech\Aspen Custom Modeler
10.2\Examples\ReactorDynEst

To run t his exa mple:


 Copy th e files in th e exa mple directory t o a convenient w orking folder, for
example:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\ReactorDynEst

There are th ree wa ys to run t he estimat ion example:


• U sing the Estima tion dia log box
• U sing the supplied Microsoft® Visua l B asic® script
• From external Microsoft® Visual B a sic® in t he supplied Microsoft® Excel®
spreadsheet

Using the Estimation Dialog Box


To run t he example using the E stima tion dialog box:
1. Fr om th e File menu, click Open.
2. Open th e file ReactorDynamicEstSetupComplete.acmf . If y ou copied th e
files to t he exam ple working folder, t his file is loca ted in:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\ReactorDynEst
3. To inspect t he setup of th e estim a tion experiment s, from the Tools menu, click
Estimation.
4. Click the Estima ted Var iables tab a nd note tha t it shows those varia bles
wh ich a re to be estima ted.
5. On the Dyna mic Experiments ta b select the dyna mic experiment listed on it
a nd click th e Edit but ton to view its deta ils.

6-2 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 6

6. In th e dialog box, note th e follow ing three ta bs:


• Measured Variables tab. Lists va ria bles for w hich t here is observed
dat a – in this case, the rea ction ra te consta nts.
• Fixed Variables tab. Lists va ria bles w hich ha ve prescribed values in t he
experiment. There are no fixed variables in this example.
• Initial Variables tab. Lists those var iables which are given a n initial
va lue in the experiment a nd ena bles you to modify t he initial va lue. There
a re no initia l var iables in this exa mple.

7. Cha nge th e run mode to Est imat ion and run th e simulat ion. Wa it for the
solution to complete.
8. To observe th e result s on the Est ima ted Var ia bles ta b, from th e Tools menu,
click Estimation.
9. To check the accura cy of th e plot, on th e Mea sured Var ia bles ta b of the
Est imat ion d ialog box, double-click t he mea sured va ria bles t o edit them, a nd
observe the deviations. You may also plot these results here.

From a Microsoft Visual Basic Script


To run t he exa mple from a Visual B a sic® script:
1. Fr om th e File menu, click Open.
2. Open th e Rea ctorDy nE st folder. If you copied th e files to the exa mple w orking
folder, t hese files a re loca ted in::

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\ReactorDynEst

3. Open th e file ReactorDyn a micEst .acmf


4. P erform a n initializat ion run.
5. In t he All It ems pane of the Simula tion Explorer, click Flow sheet to select it.
6. In th e Cont ents pan e, double-click the script ca lled est_dyn_cat .
The estima tion simula tion sta rt s.

Results of the simulat ion a re displayed in th e Simulat ion Messages window.

Aspen C ust om Modeler E xa mples 6-3


Version 10.2
Reactor
Dynamic
Estimation
Example

From External Visual Basic in an Excel Spreadsheet


To run t he example from externa l Microsoft® Visual B a sic® in a Microsoft®
Excel® spreadsheet:
1. Fr om the F ile menu, click Open.
2. Open th e folder ReactorD yn Es t. If you copied th e files to the exa mple w orking
folder, t hese files a re loca ted in:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\ReactorDynEst

3. Open th e file ReactorDynamicEst.acmf .


4. P erform a n initializat ion run.
5. If you ha ve E xcel 97 or la ter, open the sprea dsheet ReactorDynamicEst.xls .

– or –

If you have Excel 7.0, open the spreadsheet ReactorDynamicEst95.xls . This is


in Exa mples\Off95ExcelSheets.

Note If a dia log box a ppea rs asking if you wa nt t o enable macros, click
Enable Macros.
6. On the Results sheet, click the button Run Estima tion on the sprea dsheet.

After t he simulat ion completes, th e results a re put int o the E xcel spreadsh eet.

The E xcel spread sheet ha s some additional fea tur es:

You can To do this

Analyze the results of the Estimation run Select the Analysis worksheet.
You can check the results of the dynamic simulation with the estimated
values against the original experimental results.

Check the sensitivities of the estimated Select the Sensitivity worksheet.


variables to the measured variable

Check and alter the Estimation Solver Select the Estimation Solver Options worksheet.
Options Click Get to read in the current values of the estimation solver options.
Click Put to apply values.

   

6-4 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 7

7 S t ea dy -S t a t e E st im a t ion
of a Met ha nol Rea ct or
The rea ctor models th ese thr ee component s:

Component Represents

A H2O

B CH4

A2B CH3OH

Seven experiments a re run, va rying t he feed flow ra tes to a reactor. The


measur ed values a re the outlet concent ra tions of th e components A an d B .

The results of these experiments are coded in three ways for this example:
• U sing the Estima tion dia log box
• Visual B a sic Script a t t he flowsh eet level in th e simula tion
• Excel spreads heet (Excel 7.0 or lat er)

Aspen C ust om Modeler E xa mples 7-1


Version 10.2
Methanol
Reactor
Estimation
Example

Running the Methanol Reactor Example


Exa mple simulat ions a re included in your Aspen C ustom Modeler™ insta lla tion.
If y ou ha ve insta lled in t he default location, the files for th is exa mple will be in
th e folder
C:\Program Files\AspenTech\Aspen Custom Modeler
10.2\Examples\MethReactorSSEst

To run t his exa mple:


 Copy th e files in th e exa mple directory t o a convenient w orking folder, for
example:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\MethReactorSSEst

You can run the meth a nol reactor exam ple from the E stima tion dialog box, or
wit h a Visual B a sic script, or from a n E xcel spreadsheet.

Using the Estimation Dialog Box


To run t he example using the E stima tion dialog box:
1. Fr om th e File menu, click Open.
2. Open th e file MethReactorSSEstSetupComplete.acmf . If y ou copied th e
files to t he exam ple working folder, t his file is loca ted in:
 C:\ P rogra m Files\ AspenTech\ Working Folder\Aspen Cust om Modeler
10.2\MethReactorSSEst
3. To inspect t he setup of th e estim a tion experiment s, from the Tools menu, click
Estimation.
4. Click the Estima ted Var iables tab a nd note tha t it shows those varia bles
wh ich a re to be estima ted.
5. On the St eady St a te Experiments ta b, seven experiments ar e listed. Select
a n experiment a nd click th e Edit but ton to view it s deta ils.
6. In th e dialog box, note th e follow ing two ta bs:
• Measured Variables tab. Lists va ria bles for w hich t here is observed
dat a, a s well as enabling you to edit the da ta . It a lso displays results w hen
the estimat ion r un is complete.
• Fixed Variables tab. Lists va ria bles w hich ha ve prescribed values in the
experiment a nd ena bles you t o edit of th ose va lues.

7. Run t he simula tion. The results can be inspected on th e Mea sured Va ria bles
ta b for each experiment.

7-2 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 7

Running with a Visual Basic Script


To run t his exa mple with a Visua l B a sic script:
1. Fr om th e File menu, click Open.
2. Open th e MethR eactorS SE st folder. If you copied th e files to th e example
w orking folder, t hese files ar e locat ed in:

C:\My Simulat ion\Modeler\ MethReactorSSEst

3. D ouble-click th e file MethanolReacSSEst.acmf .


4. In t he All It ems pa ne of the Sim ula tion Explorer, click Flow sheet.
5. In t he Contents pane, double-click the script ca lled SS Est imat ion.

The results of the Estima tion run a re shown in the Simula tion Messages
window.

Running with an E xcel Spreadsheet


To run t his exa mple with a n E xcel spreadsh eet:
1. Fr om th e File menu, click Open.
2. Open the MethReactorSS Est folder. If you ha ve insta lled Aspen Cust om
Modeler in the default location, this is:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\MethReactorSSEst
3. D ouble-click t he file MethanolReacSSEst.acmf .
4. If you ha ve E xcel 97 or la ter , open the sprea dsheet ReactorSSEst.xls.
– or –
If you have Excel 7.0, open the spreadsheet ReactorSSEst95.xls. This is in
Exa mples\Off95ExcelSheets. If a dia log box a ppea rs asking if you w a nt t o
enable ma cros, click " En a ble Macros".
5. Check the dat a on the Input Da ta page.
6. On the Results worksheet, run t he estima tion by clicking the Calculat e butt on
a nd w hen the estima tion simulation is complete, view the results.
7. For direct a ccess to th e estima tion algorithm options, select the Est imat ion
Solver Options w orksheet. Click G et to read va lues a nd P ut t o a pply va lues.
8. You ca n an a lyze th e results of the estima tion simulat ion to compa re the
estimat ed solution wit h th e mea sured dat a . After a n Est imat ion run, select
the Analyze w orksheet a nd click Ca lculat e.
9. You ca n check the sensitivities of the estima ted var iables to the measur ed
var iables. Select t he Sensitivity Analysis worksheet a nd click Ca lculat e.

Aspen C ust om Modeler E xa mples 7-3


Version 10.2
Methanol
Reactor
Estimation
Example

Controlling NL2SOL Options


You can r ead a nd cha nge the va lues of the estima tion routine NL2SOL solver
options in th e following wa ys:
• U se the E stima tion Solver Options worksheet in t he Excel file
ReactorSS Est .xls or ReactorSS Est 95.xls
• Use the supplied Visual Basic form NL2SOLOpt.vbp. You need either Visual
B a sic 5.0 Pr ofessional or Ent erprise Edit ion, or the C ontr ol Crea tion Edition.
• On th e Setup ta b of the Estima tion dialog box, click th e Options button t o
open the Solver Options dialog box with the E stima tion ta b a ctive.

   

7-4 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 8

8 C a t a ly t ic B ed
Regenera t ion E xa mple
The ca ta lyst in a packed bed rea ctor needs to be regenera ted by pa ssing
superheated st eam t hrough th e bed. The ca ta lyst a t a ll point s along the bed
needs to be held at 700°C for a period of time to ensure a ll the cata lyst if fully
regenera ted. The process strea m is a t 600°C .

Aspen C ust om Modeler E xa mples 8-1


Version 10.2
Catalytic
Bed Regen-
eration
Example

The temperature profile in the bed between the gas and solid in the bed is
described by the following equations.

∂T g  v  ∂T g 
=− − G  _ const (T g  − T s  )
∂t  ε  ∂z 

∂T s 
= S  _ const (T g  − T s  )
∂t 
Where:
T g  = G a s t emper a tur e

T s  = S olid t em per a tu re



= Time

= S tea m velocit y
ε 
= B ed voida ge
G_const  and
= H ea t t ra n sfer con st a nt s
S_const 

= B ed len gt h

The part ial derivat ive for t empera tur e in t erms of length is approximat ed by the
finite difference equation:

∂T g  T g  − T g  −


≈i  i  i  1

∂z  ∆z 
Where:

i  = E lement number

8-2 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 8

Running the Catalytic Bed Example


Exa mple simulat ions a re included in your Aspen C ustom Modeler™ insta llation.
If y ou ha ve insta lled in t he default location, the files for th is exa mple will be in
th e folder
C:\Program Files\AspenTech\Aspen Custom Modeler 10.2\Examples\Regen

To run t his exa mple:


 Copy th e files in th e exa mple directory t o a convenient w orking folder, for
example:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\Regen

You can ru n th is example in several w a ys:


• Loading t he text input file a nd use Aspen Cust om Modeler ta bles, run-time
plots a nd profile plots to ma ke input disturba nces a nd view key r esults
• U sing a Visua l Ba sic cont rol panel to run the simulat ion w ithout intera cting
wit h th e Aspen C ustom Modeler U ser Int erface
To run th is example from Aspen C ust om Modeler, complete th ese steps:
1. Fr om th e File menu, click Open.
2. Open the Regen folder. If you copied the files to the example working folder,
these files are located in:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\Regen

3. D ouble-click t he file Regen.acmf.


4. S t a r t a d y na m i c r u n .
5. View th e effect of th e cha nge in feed tempera tu re in the plot SolidTempP lot in
th e block B ed1. To view th is plot, click t he block B ed1 with th e right mouse
button then point to Forms and click SolidTempPlot.
6. You ca n run a predefined ta sk to simulat e changes in the temperat ure of the
stea m entering the bed:
• In the Simulation Explorer, under Flowsheet, double-click the
RegenerateCatalyst task icon to activate the task. This task simulates one
cycle of cat a lyst regenera tion.
You can a lso run the simulat ion from Visua l B a sic.

Aspen C ust om Modeler E xa mples 8-3


Version 10.2
Catalytic
Bed Regen-
eration
Example

Running the Catalytic Bed Example from Visual Basic


You can use Visua l B a sic to sta rt a n Aspen Cust om Modeler session a nd run th e
simulat ion w ithout intera cting with the Aspen C ustom Modeler U ser Int erface.
1. Run th e executa ble RegenDemo.exe .
2. Click the St ar t Regen Demo button. Ensure tha t the pathna me displa yed in
the box a t t he bott om of the cont rol pa nel show s the directory w here you ha ve
installed the example files.
3. Wa it for confirma tion tha t the simula tion is ready t o run.
4. If you wa nt t o see a n E xcel real-time tempera tur e profile, click the La unch
Excel but ton.
If a dialog box appears a sking if your w a nt to updat e your w orkbook, or your
macros, click Yes.
5. Click the Run butt on an d cha nge the feed vapor temperat ure with th e slider.
6. To close the simula tion, in the cont rol pa nel, from th e File menu, click Exit .
You a re a sked if you w a nt to close the Aspen Cust om Modeler session a t the
same time.

The Visual B a sic source code is included in t he files RegenDemo.vbp an d


RegenD emo.frm. These files a re compat ible wit h Visual B a sic 5 a nd Visual B a sic
6.

   

8-4 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 9

9 S t ea dy -S t a t e Met h a n ol
R ea ct or w it h R e-C y cle
Example
Exa mple simulat ions a re included in your Aspen Cust om Modeler™ insta llation.
If y ou ha ve insta lled in t he default location, the files for th is exa mple will be in
th e folder
C:\ P rogram Files\AspenTech\ Aspen Cust om Modeler 10.2\E xamples\S SMeth

To run t his exa mple:


 Copy th e files in th e exa mple directory t o a convenient w orking folder, for
example:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\SSMeth

The Meth a nol Reactor models a meth a nol production process including a recycle
loop.

A feed st ream of H ydrogen, Ca rbon Monoxide, Car bon D ioxide, Metha ne a nd


Wa ter is mixed w ith t he recycle strea m a nd fed to a rea ctor operat ing at 533
Celsius and 120 bar.

Two reactions are modeled in the reactor:


• The metha na tion reaction betw een C a rbon Monoxide and H ydrogen
CO + 2H2 -> CH3OH 

• A side rea ction betw een H ydrogen an d C a rbon Dioxide.


H 2 + C O 2 -> C O + H 2 O  

Metha nol a nd Wa ter a re extr a cted as a product st ream . To prevent t he build up


of impurities a proportion of the recycle stream is purged to waste.

Aspen C ust om Modeler E xa mples 9-1


Version 10.2
Methanol
Reactor with
Recycle

Running the Methanol Example


To run the Meth a nol exa mple, S SMeth Demo.acmf, you need to complete t he
follow ing s teps:
• Loading th e exam ple
• B uilding t he flowsh eet
• Connecting t he blocks
• Tidying th e flow sheet
• Ent ering the input dat a
• Running th e simulat ion a nd reviewing results
• Cha nging the simula tion
• Viewing changes
• Sa ving new specifications
Note There is a lso a Metha nol exa mple w ith the flow sheet a lready built,
SS Meth.a cmf. If you choose to load t his file, go stra ight t o Running the
Simula tion a nd Reviewing Results on page 9-6.

Loading the Example


To loa d t he exa mple:
1. Fr om th e File menu, click Open.
2. G o to the SS meth folder. If you copied th e files to the exa mple w orking folder,
these files are located in:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\SSMeth

3. D ouble-click one of t he follow ing:

File Name Description

SSMethDemo.acmf Contains text descriptions of the models required for the example, as well as variable
type definitions. You need to build the flowsheet yourself.

SSMeth.acmf Contains the models and flowsheet. Because this example is ready to run, go directly to
Running the Simulation and Reviewing Results.

9-2 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 9

Building the Flowsheet


If y ou ha ve opened t he SS MEt hD emo.acmf file, you need t o build the flowsheet:
1. In t he All It ems pa ne of the Simulat ion Explorer window, under Cust om
Modeling, expan d t he Models folder.
2. Click the first model in the list, FEE DE R. Elements a ssocia ted with t he model
a re shown in the Content s pane of th e Simulat ion Explorer window.
3. From the Content s pa ne, dra g and drop the FeedIcon ont o the flowsh eet.
4. Double-click th e specificat ion indicat or on t he sta tu s ba r. (The specifica tion
indica tor is either a gr een squa re or a r ed arr ow.) Keep the St a tus w indow 
open. You will see th e degrees of freedom cha nge a s you pla ce the blocks.
5. Cont inue building th e flow sheet:

Block Model

B1 FEEDER

B2 MAKEUP

B3 REACTOR

B4 SEPARATOR

B5 SPLITTER

When y ou ha ve placed th e blocks, the flowsh eet should look like this:

Aspen C ust om Modeler E xa mples 9-3


Version 10.2
Methanol
Reactor with
Recycle

Connecting the Blocks


If you a re using the S SME thD emo.acmf file, a fter you ha ve pla ced a ll the blocks
on th e flow sheet, y ou need to connect t hem. To connect th e blocks:
1. In t he All It ems pane of the Simula tion Explorer, click St rea m Types. From
the C ontent s pan e, drag t he Connection icon onto the flow sheet. B lue arr ow s
a ppea r on the icons where port s a re ava ilable.
2. Dr op the Connection on a port an d connect to a nother port a s shown in th e
flowsheet diagram. Repeat to complete the flowsheet. The finished flowsheet
should look like this:

Tidying the Flowsheet


You ma y n eed to reposition blocks on t he flowsheet. To do this:
1. Click th e right m ouse but ton on the flow sheet an d then click Zoom Full to
ensure the flowsheet is a s la rge a s possible.
2. To select all the blocks, hold dow n th e mouse butt on a nd dra g the cursor to
round th em to form a box.
3. Fr om th e Flowsh eet menu, click Align Blocks.
4. From the Flowsheet menu, click Reroute St ream s.

Note If you wa nt to use the Flow sheet a s Wa llpa per option, ma ke sure the
Flow sheet w indow is a ctive, a nd t hen from the Window menu click Flowsheet a s
Wa llpa per. This ma ximizes the flowsheet w indow so tha t it becomes th e
background for your simulat ion.

9-4 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 9

Entering the Input Data


You ca n enter the required input da ta from:
• AllVariables tables
• Microsoft® ActiveX® cont rol forms (user-defined forms)
To access t hese from t he flowsh eet:
 Click the required block to select it, then click with the right mouse button
a nd point to Forms. From t he displa yed list, click th e required form.

Entering Data from the AllVariables Table


En ter t he da ta for t he Feeder block from th e AllVa riables ta ble. To do this:
 In th e Flowsheet w indow, d ouble-click the block B 1.
An AllVa ria bles ta ble tha t conta ins a ll the varia bles in the block appea rs.

Tip To chan ge w hich columns a re show n, click the right mouse but ton on
the t a ble a nd t hen click P roperties. Va lue and S pec are usua lly the most
useful column s.

Fr om this t a ble, you can a lter t he TOTAL flow out of th e feeder block. Values to
run the simula tion successfully a re a lready defined. Close the AllVa riables ta ble.

Entering Data from the User Defined Forms


Complete t he da ta entry by using t he customized forms. A user-defined form is a
Microsoft® ActiveX® contr ol form, designed to display da ta for a par ticula r
model. You ca n design y our own forms for your ow n models. To access t he form:
1. Ma ke sure B3 (th e Rea ctor block) is selected, th en click it wit h th e right
mouse button, point to Forms and click ReactorSpec.
A user-defined form a ppea rs. This form ena bles you to ent er th e correct da ta
easily. To cha nge da ta in t his form, ma ke sure you click outside each box a fter
entering a n umber, otherw ise the va lue is not reta ined.
2. Repeat for block B5 (th e S epar a tor block), a nd observe the purge ra tio va lue.

Aspen C ust om Modeler E xa mples 9-5


Version 10.2
Methanol
Reactor with
Recycle

Running the Simulation and Reviewing Results


To run t he simulat ion a nd r eview results:
1. After a ll the da ta ha s been entered, you can show th e user defined form for
the Sepa ra tor B4.
The numbers chan ge when a result is calculat ed.
2. Ma ke sure the run mode box on the Run Control toolbar shows St eady S ta te
a nd click th e Run butt on.
3. U se th e user-defined forms t o look a t th e result s over the wh ole flow sheet.
4. En ter different va lues in the user-defined forms a nd run t he simulat ion to get
different results.
5. You ca n perform furt her run s, cha nging t he value of the feed flow t ota l a nd/or
th e component mole fra ctions in t he AllVa ria bles ta ble for block B 1.

Changing the Simulation


You can now t ry a ltering the structur e of the simulat ion.
1. Open the St a tus w indow , if it is not current ly displayed, by doing one of the
following:
• Double-click th e green sq ua re on the sta tus ba r.
• From t he View m enu, click S ta tus Window.
2. Click the Fixed Cha nges ta b.
3. In t he Flowsheet w indow, double-click th e feed block, B 1.
4. In t he AllVa ria bles ta ble, click th e Spec column cell for Tota l.
5. Ch a nge th e spec from Fixed to Fr ee.
The simulation is now underspecified by one. On the tab for Fixed Changes,
the va ria ble th a t you just cha nged appears on the unFixed list.
6. Open the AllVa ria bles ta ble for B 4, the sepa ra tor.
7. Cha nge the spec for th e varia ble meprod from Free to Fixed.
The simulation is squar e aga in.
8. Now r un th e simula tion aga in to ca lculat e the required feed for th e specified
metha nol production ra te.

9-6 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 9

Viewing Changes
To view th e cha nges you ha ve ma de, edit th e Feeder model. To do th is:
1. In t he Simulat ion Explorer, expand Cust om Modeling an d expan d the Models
folder.
2. In the Contents pane, click FEE DE R with the right mouse button and then
click E dit.
The text equa tions for t he model appear in a Text Edit or w indow. Tow a rds
th e end of th e model description, th e specificat ion va lue for some var iables a re
set t o Free or F ixed. These ar e the defa ult specificat ions for th e model.
3. To view th e cha nges from the defa ult specifica tion, double-click th e
specification indicator to open the specification Status window, if it is not
already displayed.

Saving New Specifications


You can save the new specification values by creating scripts. To do this:
1. If th e Sta tus w indow is not a lready open, open it. To do this, from th e View 
menu, click St a tus Window then click the Genera l ta b.
2. Click the Script butt on, supply a n a me for th e new script an d click OK.
3. In t he All It ems pa ne of the Sim ula tion Explorer, click Flow sheet.
The script a ppea rs in t he Contents pan e.
4. To edit th e script, click wit h th e right mouse button on the script icon th en
click E dit.
The changes ma de from the defa ult specification va lues are r ecorded in t he
script.
5. To apply th e cha nges ma de in th e script, double-click the script icon to invoke
it .
6. To revert t o th e defa ult specifica tion provided in the models, in th e St a tu s
window, on th e Fixed Ch a nges ta b, click th e Reset butt on.
Now you ca n easily sw itch between the default spec and t he new spec between
runs.
7. You ca n use a Microsoft® Visua l Ba sic® a pplica tion to switch between a
design a nd ra ting case. You can fix th e total feed flow ra te to the flowsh eet, or
switch to fixing the total methanol produced. The front end provides you with
the values of the key data .

If you are running the file Use this Visual Basic form from the SSMeth folder

ssmeth.acmf MethanolLoop.vbp
ssmethdemo.acmf MethanolLoopDemo.vbp

Aspen C ust om Modeler E xa mples 9-7


Version 10.2
Methanol
Reactor with
Recycle

Homotopy
You can run a Homotopy example using t he input file SS Meth.a cmf.

What is Homotopy?
Homotopy enables you to move from one stea dy st a te solution to a nother st eady
sta te solution in sma ll increments. I n some circumsta nces, the simula tion ma y
not converge for t he ta rget stea dy-sta te solution from the current stea dy-sta te
solution. H omotopy allows you to approach th e ta rget st eady-sta te solution in
sta ges, thereby improving the cha nces tha t t he ta rget stea dy-sta te solution is
reached.

This example uses a Visua l B a sic script t o initia lize a solution t owa rds a set of
ta rget va lues for fixed va ria bles.

When Flow sheet is selected in t he All Items pa ne, th e Homotopy script is sh own
in th e Contents pa ne (this a pplies to SS Meth only, not SS MethD emo). You can
edit this script to cha nge the ta rget va lues of the fixed va ria bles, and a lter the
number of steps ta ken to reach th e tar get stead y-sta te solution.

Running the Homotopy Example


You can run the H omotopy exa mple from the input file SSMeth .acmf.

To run t he H omotopy exa mple:


1. In t he All It ems pane of the Simula tion Explorer, click Flowsh eet. In the
Cont ents pa ne, double-click the script ca lled RunH omotopy.
This script initializes the homotopy ta rget va ria bles a nd ena bles homotopy.
2. To see the result s of runnin g th is script, from the Tools menu, click Homotopy.
In t he Homotopy dialog box, you can cha nge the initial a nd t a rget va lues of
the va riables by double-clicking th e var iable na mes in t he list.
3. To sta rt t he solution, click th e Run but ton.
The simula tion solution is moved from th e curr ent solution point to th e
solution a t t he ta rget va lues of thr ee fixed va ria bles:
• Feed Flowra te
• Reactor Tempera tur e
• Reactor Pressure
The script steps from the current solution to the target solution.

9-8 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 9

You can reset th e simulation to th e original va lues of th e fixed var iables by


double-clicking t he script ca lled Rest a rt Homotopy.

Running the Optimization Example


You can r un a n optimization simulation from the input file SS Meth.a cmf.

The optim iza tion ma ximizes the profit ma de by t he rea ctor a nd r ecycle loop. The
profit is calculat ed from the a mount of metha nol produced minus th e amount of
effluent pur ged from th e recycle.

In order t o maximize the profit, t he optimiza tion a lters t he va lues of th e following


variables:
• Reactor Tempera tur e
• Reactor Pressure
• P urge Ratio
The optimiza tion t a kes place subject t o the following conditions:
• Rea ctor Tempera tu re > 500 C
• Rea ctor Tempera tu re < 550 C
• Reactor P ressure > 100 ba r
• Reactor P ressure < 150 ba r
• Effluent Methanol fraction < 0.003
You can a ccess the definit ions of the objective function t o be ma ximized an d t he
constr a ints by editing the Flowsh eet C onstr a ints in the Simula tion Explorer.

To open t he Opt imiza tion d ia log box, on t he Tools menu , click Opt imiza tion. The
Decision Varia bles ta b shows th e varia bles wh ich w ill be varied to achieve the
optimum, a nd t he Objective Va ria bles ta b shows th e value of the va ria bles wh ich
a re being optimized. Run t he optimizat ion by cha nging th e run mode to
Optimizat ion a nd clicking the Run but ton.

   

Aspen C ust om Modeler E xa mples 9-9


Version 10.2
Methanol
Reactor with
Recycle

9-10 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 10

10 S P E E D U P 5 L ibr a r y
Wit h F la sh E xa mple
The SPEEDUP 5 steady-state example simulation models a two-stage separation
process wit h nin e chemical components. I t consists of a feed unit , compressor, a nd
tw o flash units.

To use th is exa mple, you need to ha ve Aspen P lus® inst a lled, a s well as Aspen
Custom Modeler™ .

Notes
• Ma ke sure the Aspen P lus Simulat ion E ngine is on your pat h. If you ha ve
insta lled Aspen P lus in the defa ult loca tion, the simulat ion engine ca n be
found in C:\Program Files\AspenTech\Aspen Plus 10.2\engine\xeq. This
enables you to use the command which creates the properties file.
• If you a re using a S imulat ion En gine insta llation from a client ma chine, you
must ma ke sure tha t you run Aspen P lus using the sa me server and t he same
w orking folder a s you ha ve configured for Aspen Cus tom Modeler.

Aspen C ust om Modeler E xa mples 10-1


Version 10.2
SPEEDUP 5
Library
Example

About SPEEDUP and the Aspen Custom Modeler


Library
The SP EE DU P ® 5.5-6 libra ry ha s been converted a nd delivered as a n Aspen
Cust om Modeler™ library to provide a ba sic set of exa mple models tha t y ou can
use as a sta rting point wh en developing your own m odels.

The models a nd modeling techniques a re those used in th e SP EE DU P 5 library


a nd not t he sta te-of-th e-a rt techniques ava ilable in t he Aspen D yna mics™
models. The SP EE DU P 5 librar y w ill not be further developed.

The librar y conta ins SP EE DU P 5 va ria bles, stream s, models, procedures, and
ma cros covering the a reas of heat excha nge an d pressure cha nge; distillat ion a nd
reactors; mixers a nd splitters; a nd feed and contr ol.

The libra ry does not cont a in th e SP EE DU P 5 procedure-based distillat ion models


(FnPm) and macros (COL_FnPm); RADFRAC-based distillation models (RFnPm);
and polymer-related procedures and models.

The library is available in metric (Su5lib.acmf) and U.S. (Su5libu.acmf) units of


measurement.

Procedures Required by the SPEEDUP 5 Library


Models
The Su 5lib libra ry conta ins a num ber of non-physica l property procedures, w hich
ar e required by the SP EE DU P 5 librar y models:
• CHORD_LENGTH COMP_CHAR
• DBAND
• DISC
• DISCF
• LOGMEAN
• MANVEL
• MANW
• PRBS
• REACTION
• SCTRAY_LUMP
• SCVAP_COMP
• SE G MENT_AREA SP RMOD
• TME
• VE L

10-2 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 10

The dyn a mically linked libra ry for th ese procedur es is Su5lib.dll. This cont a ins
SP EE DU P 5 Fort ra n procedure code modified for Aspen Cust om Modeler™ .

If you installed Aspen Custom Modeler in the default location, Su5lib.dll can be
found in:

C:\ Program Files\ AspenTech\ AMSystem 10.2\ bin

Note COMP _CH AR d efines a compressor performan ce cha ra cteristic a nd


REACTION calculat es the reaction ra te a nd h eat of rea ction of a reacting process.
The Fort ra n code for th ese tw o procedur es is not provided. You mu st pr ovide th e
Fortra n a nd generat e a D LL file for th ese procedures.

Aspen C ust om Modeler E xa mples 10-3


Version 10.2
SPEEDUP 5
Library
Example

Models in the SU5Lib Library


The Su5lib libra ry in Aspen C ust om Modeler™ cont a ins th e follow ing
models/ma cros from the SP EE DU P 5 librar y:

ALARM ALARM_SIG BUBBLE COMPARATOR


COMPRESSOR COMPRESSOR_SS CSPLIT CSTR
CVALVE DEAD_TIME DEW DISC
DRUM DRUM2 DTRAY_L DUPLIC
EXPANDER FLASH FLASH_SS FLASH3
FOPDT FTRAY FTRAY_SS HEAT_COOL
HEAT_EXCH HI_SEL IAE ISE
ITAE KETTLE LAG LAG_1
LAG_2 LAG_DELAY LAG2 LAG2_DELAY
LEAD_LAG LIN_CVALVE LM LO_SEL
LPUMP MECH_CVALVE MIX_TANK MIXER
ML MOL_FEED MULTI_DUPLICATOR MULTI_HIGH
MULTI_LOW MULTI_SUMMER MULTIMIX MV
OVERHEAD OVERHEAD2 P_LAG_DELAY PCOND
PCOND_SS PHASE PI_CONT PID
PID_CONT PRBS RATIO_ REACTOR
REBOILER_SS RFNPMINIT_D RFNPMINIT_D2 RSPLIT
SCALE SCALER SCDLUMP SCFLASH
SCFLUMP SCLIQLIB SCLUMP SCPART_COND
SCREBOILER SCSENSOR SCTOT_COND SCVAPLIB
SECTION SECTION_SS SENSOR SIG_OPS
SOPDT SPLIT SPLIT_RANGE SUM
TANK TCOND TCOND_SS TEAR_  
THERMO TRAY TRAY_SS VALVE
VALVE_DYN VALVE_GAS VALVE_LIQ VEL_PID
VM VOL_FEED WT_FEED ZSOPDT

The library does not conta in th e SP EE DU P procedure-based distillat ion m odels


(FnPm) and macros (COL_FnPm); RADFRAC-based distillation models (RFnPm);
and polymer-related models.

Ma ny of th e control models in th e SP EE DU P 5 libra ry ha ve been improved and


a re ava ilable in Aspen C ustom Modeler Libra ry.

10-4 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 10

SPEEDUP 5 Library Files


The following files are supplied for t he SP EE DU P 5 librar y:

File Name Description

Su5lib.acmf Text input file for the SPEEDUP 5 library using metric units of measurement

Su5libu.acmf Text input file for the SPEEDUP 5 library using US units of measurement

Su5lib.dll Dynamic Link Library containing compiled SPEEDUP 5 Fortran procedure code.
If you have installed in the default directory, this dll will be in
C:\Program Files\AspenTech\AMSystem 10.2\bin

Gpu.dll Dynamic Link Library containing compiled Fortran code for the physical property routines using U.S.
units of measurement. This dll is only used by Su5libu.
If you have installed in the default directory, this dll will be in
C:\Program Files\AspenTech\AMSystem 10.2\bin

Flash Example Files


In addition to the Su5lib library files, the following files are supplied for the flash
example:

Filename Description

flash.acmf Text input file

demo.inp Text input file for setting up properties

Running the Flash Example


Exa mple simulat ions a re included in your Aspen Cust om Modeler™ insta llation.
If you ha ve insta lled in t he default location, files for t his exa mple will be in t he
folder
C:\ P rogram Files\AspenTech\ Aspen Cust om Modeler 10.2\E xamples\S U 5Lib

To run t his exa mple:


 Copy th e files in th e exa mple directory t o a convenient w orking folder, for
example:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\SU5Lib

Aspen C ust om Modeler E xa mples 10-5


Version 10.2
SPEEDUP 5
Library
Example

Complete the following steps to run t he fla sh exa mple using the SP EE DU P 5
library with metric units:
1. Set up the interfa ce for Aspen Cust om Modeler™ a nd Aspen P lus® . To do
this, open a Comma nd P rompt window a nd in it, move to the directory w here
you have installed the Su5lib flash example files. If you copied the files to the
example working folder, th ese files ar e locat ed in:

C:\ Program Files\ AspenTech\ Working Folder\ Aspen Custom


Modeler 10.2\ Su5lib
2. Ent er the comma nd ASP EN DEMO.
Note You can delete all the new files creat ed by the ASP EN run except t he
demo.inp a nd demo.a ppdf file.
3. In Aspen Cu stom Modeler, from the File menu, click Open.
4. Na viga te to the Su5lib folder a nd double-click th e example file Su5lib.acmf.
5. From the File menu, click Creat e Libra ry.
The Save As dialog box appears.
6. Na vigat e to th e lib folder. If you insta lled in the defa ult location, this is
C:\ P rogram Files\AspenTech\ AMSy stem 10.2\lib. C lick S a ve.

Note The Cr eat e Libra ry comma nd consolidat es the content s of the S u5lib
libra ry int o a binar y S u5lib.acml librar y file.
7. In Aspen Cu stom Modeler, from the File menu, click Open.
8. Open the Su 5lib folder a nd double-click th e exa mple file flash.acmf .
9. Click Run to run the simulat ion in steady sta te.

   

10-6 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 11

11 Wa t er H a m m er (P D E )
Example
This example simula tion consists of a pipeline termina ted by a va lve. If t he va lve
is slammed shut , a pressure wa ve tra vels ba ck up the pipe. The pipe expands d ue
to th e increased pressure. When t he pressure wa ve reaches the pipe inlet, th e
pressure is relieved by back flow. The pressure wave oscillates back and forth
a long t he pipe. The pressures decrea se as ener gy is a bsorbed by friction.

Depending on t he severity of the va lve closure, either the flow is ha lted w ithout
a ny problems, or else th e pressure in some or a ll sections of th e pipe fa lls below 
the va por pressure of wa ter. The model does not simula te cavit a tion, but if y ou
see the pressure falling too fa r below one bar , you can estima te th a t cavit a tion
can occur, and you need to close the valve more gently.

With the current simulation configuration, closing the valve Cv to 100 causes no
cavitation in the pipe following closure, whereas a closure to a Cv value of 10
causes extensive cavita tion. The ta sk used t o close the va lve uses a n S RAMP
function. You ma y w a nt to tr y increasing th e period over w hich t he va lve closes.

Aspen C ust om Modeler E xa mples 11-1


Version 10.2
Water
Hammer
Example

Running the Water Hammer Example


Exa mple simulat ions a re included in your Aspen C ustom Modeler™ insta lla tion.
If y ou ha ve insta lled in t he default location, the files for th is exa mple will be in
th e folder
C:\Program Files\AspenTech\Aspen Custom Modeler
10.2\Examples\WaterHammer

To prepa re to run th is example:


 Copy th e files in th e exa mple directory t o a convenient w orking folder, for
example:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\WaterHammer

To run t he example using a ta sk, follow th ese steps:


1. D ouble-click t he file WaterHammer.acmf to open it .
2. In th e Simula tion Explorer, expand th e Cust om Modeling folder. Expa nd the
P rocedures folder, a nd double-click t he pr ocedure F ricFa c. This pr ocedure is
used to calculate the pipe friction factor from the Reynolds number. If
necessary, edit the Library and Implementation statements to include the
correct pat h for the directory in w hich you a re runn ing the simulat ion.
3. Close th e editor, and if you ha ve cha nged the procedure, compile it.
4. The exam ple includes th e built DL L file, wh.d ll, w hich conta ins the procedure
Fortran . If you wa nt t o rebuild this DLL:
− Renam e or delete the existing wh .dll.
− Click the procedure wit h th e right mouse butt on and t hen select G enera te
Code.
− Select t he Wra ppers, G enerat e an d E xecute options a nd t hen click OK.
The DL L is rebuilt .
5. Ensure the run mode is St eady Sta te and then run the simulat ion.
6. Double-click th e tw o plots of pressure profiles and flows a long t he pipe,
MovingP ressurePr ofile and F lowsP lot.
7. En sure th e run mode is Dy na mic a nd then run th e simulat ion.
At t ime = 0.75, the va lve closes. Observe th e rea ction to the va lve closure on
the plots.

   

11-2 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 12

12 H igh Tem per a t ur e S h ift


Rea ct or (P D E ) E xa mple
This example is for users of Aspen Cust om Modeler™ w ith P roperties P lus. You
therefore ha ve to have Aspen P lus® insta lled to use this exa mple.

Note If you are using a Simulat ion Engine insta llation from a client ma chine,
you must make sure tha t you run Aspen P lus using th e same server a nd t he
sa me working folder a s you ha ve configured for Aspen Cus tom Modeler.

This example models a high t empera tur e shift rea ctor, w hich is importa nt for
ma ny indust ria l plan ts, including ammonia plan ts. The high temperat ure shift
reactor example illustra tes:
• Complex reaction kinet ics
• G enera lized solution of par tia l differentia l equat ions
• A flowsh eet initializat ion st ra tegy w hich includes generalized ca lls to
initialization scripts, and homotopy scripts of each model
• A dynam ic opera bility study of the rea ctor

Aspen C ust om Modeler E xa mples 12-1


Version 10.2
Shift
Reactor
Example

Reactor Kinetics
The reactor uses a solid cat a lyst t o complete the gas pha se wa ter shift r eaction:

CO + H 2O ←
  → CO2 + H 2 

The reaction is exothermic, with the heat effects determined from enthalpies
wh ich include heat s of forma tion. The rea ctor is considered ad iaba tic beca use th e
thr oughputs a re high an d the a rea (which is insulat ed) a va ilable for hea t loss is
small.

Numerous kinetic relationships have been developed for t he w a ter ga s shift


reaction over iron ba sed ca ta lysts used in high tempera tur e shift rea ctors.
La ngmuir-Hinshelwood models ha ve been shown to be superior to power law -
based models for th is rea ction. C onsequently, L a ngmuir-Hinshelwood kinetics ar e
used a sub-model.

The specific form of the rate expression used is:

   pH 2 * pCO2  
 
k * pCO * pH 2 O −  
 
K 1
r  =
2
( DEN )
Where:

 DEN = 1 + KCO * pCO + KH 2 * pH 2 + KCO2 * pCO2 + KH 2 O * pH2 O

The reaction ra te consta nt, k , is a function of temperat ure, activa tion energy, a nd
frequency factor, in the classic Arrhenius form:

− E  /  RT 


k = A* e

Litera tur e dat a indica te th e activat ion energy in the a bsence of diffusion effects
a s 121.8 kJ /kmol. The frequency fa ctor w a s determined fr om litera tur e a nd plant
data.

Similar ly, the a dsorption equilibrium constan ts a re functions of tempera tur e,


heat s of adsorption, an d a frequency factor:

∆ Hi  /  RT 


Ki = Ai * e

i = CO , H 2, CO 2, H 2 O
The rea ction equilibrium consta nt is a function of temperat ure. The w a ter ga s
shift rea ction equilibrium consta nt is a function of tempera tur e.

Ki = f ( T )

12-2 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 12

Diffusional Effects
The reactor kinetics discussed a re intrinsic kinetics tha t a re va lid in the a bsence
of diffusional or heat t ra nsfer resista nces. B ulk phase concentr a tions (par tia l
pressures) a nd temperat ures ar e not present at the a ctive sites within th e
cata lyst pellets, since the pore structure can offer significa nt resistan ce to
diffusion, a nd mild resista nce to heat t ra nsfer exists between the bulk pha se and
the pellet sur face. Litt le resista nce to heat tr a nsfer exists w ithin t he pellets.

The diffusiona l effects a re a ccounted for usin g th e clas sic effectiveness fa ctor.

actual rate throughout pellet with resistances 


η=
rateevaluated without resistances 

Eva luat ing the num erat or of this expression requires simulta neous integra tion of
the rate and diffusion relationships. Simplification of the effectiveness factor
calculation can be applied for conditions which cause the diffusional resistance to
be la rge. The simplifica tion is:

3 K(De)
η=
rp k(K + 1)ρp

Inst ead of calcula ting t he effectiveness factor in t he model, which w ould be a


computa tional burden, the effectiveness factor is entered a s a function of length
a s a consta nt profile. The effectiveness fa ctor is primar ily a function of t he
catalyst pellet size, pore size, and pore size distribution. Because this is a
relat ively w eak function of opera ting conditions over the n orma l ra nge of these
condit ions, t he effect of imposing it a s const a nt profile is very sma ll. The result s
of reactor simulations with the effectiveness factor profiles fixed agree very well
wit h measur ed results from industria l reactors, an d with r esults presented in the
literature.

The relat ionship a mong a ctual r eaction r a te, intr insic ra te, effectiveness factor,
an d ca ta lyst activity is:

ri ,observed = η i × α × ri ,intrinsic  
Where:
η = Effectiveness factor
α = Relative catalyst activity (accounting for aging, sintering, pore closure)
ri, intrinsic  = Rate calculated with bulk fluid conditions

The ca ta lyst a ctivity is calculat ed as a para meter, updated from opera ting da ta .

The sub-model LH H W is used t o model these kinetics. A Microsoft® Visua l


B a sic® script in t he ma in rea ctor model, CONSTANTS can be used t o fix a ll of
the kinetic parameters.

Aspen C ust om Modeler E xa mples 12-3


Version 10.2
Shift
Reactor
Example

Modeling Strategy
Although the rea ctor can be treat ed as a simple equilibrium reactor, a kinetic
model is necessa ry t o reproduce dyna mic beha vior. The ma in rea ctor model uses
the Aspen C ustom Modeler™ domain a nd distribut ion models, thus a llowing t he
par tia l differential equa tions for t he reactor a nd t he solid ca ta lyst t o be solved
easily. Severa l methods can be selected for t he solution of the r eactor equa tions,
such a s orth ogona l collocat ion of finite elements a nd finit e differences.

Representa tion includes a par tia l differentia l equa tion for the convective reaction
equa tion, convective gas energy equa tion, an d conductive solid energy equa tion.

The Configure ta ble in t he reactor model ha s severa l configura ble pa ra meters to


control the type of partial-differential solution:

This parameter Is the And

LFIX Length parameter Controls the length of the reactor.

METHOD PDE method parameter It can have values of:


• Upwind difference (Finite difference method)
• Central difference (Finite difference method)
• Mixed difference (Finite difference method)
• Orthogonal Collocation of Finite Elements (OCFE)
SPAC Spacing parameter It can have values of:
• EQUIDISTANT
• IRREGULAR
If irregular spacing is chosen, you may enter various values in
the length array, z(*).

N Number of finite difference The location of the FD points is determined by the array z(*) and the
points parameter SPAC.

NCOL Number of collocation points


per element for OCFE,
including the exterior points

NE Number of finite elements to The spacing is determined by the array z(*) and the parameter SPAC.
be used by OCFE

The part ial differentia l equa tions are wr itten using multi-dimensiona l arr a ys,
an d the D EL an d LAP LACE sub-models. DE L calculates the first spatia l
derivat ive, wh ile LAP LACE calculat es the second spa tia l deriva tive.

12-4 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 12

A simple example model, DI FFU SI ON is also included to show how a par tia l
differentia l equa tion ca n be represented in Aspen C ustom Modeler™ . Notice tha t
the boundary conditions are simple, explicit equations. The form of the partial
differentia l equa tion is for diffusion-convection. The hea rt of the meth od is the
par a meterizat ion of th e distr ibution equa tions by the set, PD ES ET. Notice how it
is used to write the part ial differentia l equa tion with multi-dimensional ar ra ys.
The user need only be a ble to wr ite the par tia l differential equa tion an d use
either P DE SE T or P DE SE T2 ( one less bounda ry point for diffusion only
problems).

Initialization Strategy
The equa tions of th e reactor a re highly non-linea r, a nd w ill require a
comprehensive str a tegy to converge in steady st a te. Fortuna tely, Visual B a sic®
scripts in Aspen Cu stom Modeler w ill a llow ea sy convergence of th e simulat ion.
Several feat ures of the rea ctor w hich are modeled ar e:
• The chosen state variable is concentration for the convective equation
• The reactor is adia ba tic
• Axial conduction is considered down t he length of the rea ctor in th e solid
catalyst
The most difficult of th ese feat ures is th a t the r eactor is a diaba tic. The
temperat ure profile of the rea ctor is not known a nd must be ca lculat ed.
U nfortuna tely, the reaction equa tions are highly dependent on the tempera tur e,
a nd w ill not converge if the temperat ure is freely calculat ed. However, if th e
temperat ure is fixed, th e kinetic equa tions ar e well behaved. In a ddition, th e
density of the ga s is ea sily estima ted by the ideal gas law (high temperat ure
ga ses ar e mostly ideal, regar dless of the pressure).

Thus, the sta te concentra tions ca n be estima ted from the ideal ga s law a nd th e
entering molefractions. In a ddition, I nitia l specifica tions for t he solid a nd ga s
temperat ure can be used. These specifications w ill a llow a n initia l run to
converge ea sily. The In itia l script w ill prompt for t he pressure dr op (0.3 ba r) an d
the t empera tur e rise (60° C).

In a series of homotopy-type runs, you can change the specifications and perform
stea dy-sta te runs. I f you switch the specifica tions for solid an d ga s temperat ure to
fixed conditions, an d free th e duty , a stea dy-sta te ru n converges easily. Then you
can retur n th e ga s tempera tur e specifications back to Init ial, an d fix the duty t o
adiabatic conditions, thus an adiabatic condition. In the last steady-state run, you
can fix the solid temperat ure slack to 0, an d retur n t he solid tempera tur e to
specifications to Initial.

Aspen C ust om Modeler E xa mples 12-5


Version 10.2
Shift
Reactor
Example

E a ch of th ese steps is a ccomplished w ith block level Visua l B a sic Script s,


Initialize, Homoinit, Homostep, and Homostep2. These scripts are called from a
genera lized flowsheet Init ialize script, w hich can be used to converge an entire
flowsheet.

Steady-State Design
The rea ctor opera tes a t over 380° C a nd 35 bar , a nd u ses an iron oxide/chromium
oxide cat a lyst . The rea ction is exoth ermic, but th e rea ctor is not cooled. The feed
composition to the reactor is mostly water and hydrogen (35%each), 15%
nit rogen, 8%ca rbon monoxide, a nd 5%ca rbon dioxide. The rea ctor product is
enriched with hydrogen, and much of the carbon monoxide is consumed. Thermal
stress is a significa nt d egrading fa ctor for the ca ta lyst. The reactor ha s a 3.5-
meter bed of cylindr ical pellets, a nd t he a vera ge velocity is a bout 0.5 m/s. There
is a t empera tur e profile and composition from a n operat ing reactor, an d th e
estimat ion capa bilities of Aspen C ustom Modeler™ ha ve been used to adjust t he
kinetics to plan t da ta .

Dynamic Operability Study


The HTS r eactor ha s a significa nt t herma l mass beca use of the cata lyst bed. A
complete st udy w ould include the st a rtu p, shutdown, a nd loss of feed cases. A
20%reduction in th e feed for a bout 20 minutes ha s been used, an d t he increa se of
the feed to the norma l flow ra te.

We wa nt t o know wh a t is the effect of th is therma l mass, a nd how w ill it a ffect


th e reintr oduction of the feed to the rea ctor. The model is completely dyn a mic an d
includes the effect of heat-tr a nsfer to t he cata lyst, conduction in the bed, a s w ell
a s th e reaction kinetics a nd a dsorption effects. S o the results of the model will
predict th e same response a s th e reactor.

12-6 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 12

Setting Up the Interface


You need to set up t he interface for Aspen Cust om Modeler™ a nd Aspen P lus® .
H owever, you only need to do this once:
1. Open th e Aspen P lus® U ser Int erface.
2. Select Open a n Exist ing Sim ula tion /More Files...
3. Open the Wa ter S hift Rea ctor folder. If you copied th e files to the exa mple
w orking folder, t hese files ar e locat ed in::

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\WaterShiftReactor

4. Load the file shift.inp into Aspen P lus, a nd run it.


Note This is a properties only input file, so you will not see a flowsh eet in
Aspen Plus.
5. From the File menu, click Sa ve As an d save the simulation as a n Aspen P lus
document (.a pw file), th en exit Aspen P lus.

Now you ca n run th e exam ple.

Running the Example


Exa mple simulat ions a re included in your Aspen Cust om Modeler™ insta llation.
If y ou ha ve insta lled in t he default location, the files for th is exa mple will be in
th e folder
C:\Program Files\AspenTech\Aspen Custom Modeler
10.2\Examples\WaterShiftReactor

To run t his exa mple:


 Copy th e files in th e exa mple directory t o a convenient w orking folder, for
example:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\WaterShiftReactor

Aspen C ust om Modeler E xa mples 12-7


Version 10.2
Shift
Reactor
Example

After you ha ve set up t he interfa ce, you ca n run th e Wa ter S hift Rea ctor example.
To do this:
1. Fr om th e File menu, click Open.
2. Open th e Wa ter Sh iftRea ctor folder. If you copied th e files to the exam ple
w orking folder, t hese files ar e locat ed in:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\WaterShiftReactor

3. Click th e example file Wa terS hiftR eactor.a cmf th en click Open.


4. In t he All It ems pa ne of the Simulat ion Explorer, ensure Flowsh eet is
selected.
5. In th e Contents pa ne, click the script Initia lize w ith the right mouse butt on
a nd t hen click Invoke Script.
6. En ter estimat es for the pressure drop a nd tempera tur e increase over the
reactor. You can a ccept the defau lt va lues.
7. When the In itialize script ha s completed, cha nge the run mode to Dy na mic in
the Run Mode box on the toolbar.
8. In t he All It ems pa ne of the Simulat ion Explorer, ensure Flowsh eet is
selected. Activa te t he ta sks Ra mpDown a nd Ra mp2 by double-clicking on th e
ta sk icons.
9. Click the run button to sta rt the dynamic run.

   

12-8 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 13

13 D y n a mic Opt im iza t ion


Example
This exa mple cont a ins a m odel of a ba tch fed reactor w ith five stat e varia bles an d
tw o fixed va ria bles FeedRa te an d CoolingRat e.

There are two reactions present:

A+ B →C (desired product formu lat ion)

B + C →D (competit ive rea ction)

P roduct, represented by va ria ble Holdup_C in the simulat ion, is the quan tity t ha t
we w a nt t o ma ximize at t he end of th e process, a t fina l time 60 hours by var ying
the feed ra te.

Constr a ints on the optimizat ion a re a fina l tempera tur e at 60 hours of betw een
295 and 300 °C a nd a path constra int on the temperatur e throughout t he whole
process to confine it to less th a n 520 °C. To achieve these const ra int s t he cooling
ra te will also be varied.

Aspen C ust om Modeler E xa mples 13-1


Version 10.2
Dynamic
Optimization

Running the Dynamic Optimization Example


Exa mple simulat ions a re included in your Aspen Cust om Modeler™ insta llation.
If y ou ha ve insta lled in t he default location, the files for th is exa mple will be in
th e folder
C:\Program Files\AspenTech\Aspen Custom Modeler
10.2\Examples\NonIsothermalReactor

To prepa re to run th is example:


 Copy th e files in th e exa mple directory t o a convenient w orking folder, for
example:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\NonIsothermalReactor

To run t his exa mple:


1. Fr om th e File menu, click Open.
2. Open the NonI sotherm a l folder. If you copied th e files to the exa mple w orking
folder, t hese files a re loca ted in:
C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler
10.2\NonIsothermalReactor
3. Double-click th e file nonisotherma lrea ctor.acmf.

Viewing the Dynamic Optimization Inputs


To view the d yna mic optimizat ion input s:
1. Double-click th e model in th e flow sheet to displa y th e ta ble of optimiza tion
variables.
2. Fr om th e Tools menu, click Optimiza tion
3. In the Optimization dia log box, note tha t P erform Dyn a mic Optimizat ion is
selected.
4. Click Options to see th a t th e objective is being maximized.
5. Select t he Control Discretizat ion ta b. Note the Fina l Time of 60 a nd th e
Number of Elements of 5.
This mean s th a t t he contr ol va ria bles w ill ha ve five switching points for th e
optimizer to vary .
6. Click th e Objective Var ia bles ta b in th e Optimiza tion dialog box. Holdup_C is
shown . The va lue of H oldup_C w ill be maximized.
Note You ca n insert a n objective va ria ble by dragging a nd dropping it from
a t a b l e.

13-2 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 13

7. Click the Contr ol Va riables tab in the Optimization dia log box.
8. Note tha t CoolingRat e a nd FeedRa te have been selected.
9. With t he right mouse butt on, click CoolingRat e and select Edit I nitia l Control
Element Values to see the initial estimates for the optimal control profile.

Viewing the Flowsheet Constraints


To view the flowsheet constraints:
1. In t he All It ems pa ne of the Simulat ion Explorer, ensure Flowsh eet is
selected.
2. In t he Cont ents pan e of th e Sim ula tion Explorer, double-click th e Flowsh eet
icon.

For the pat h constr a int, you ca n see th a t t he integral of th e viola tion squa red
of t he temperat ure a bove 520 is posed a s a constr a int t o the optimizer. Notice
in the flowsh eet t here is a va ria ble violat ion mea suring th e total violat ion
squared.

The path constr a int is posed as a " soft" constr a int. You can a llow a larger
degree of violat ion by increasing t he value of the number on the right h a nd
side of the constr a int equa tion.
3. P erform the optimiza tion run.

Creating a Task to Implement the Optimal Profiles


To use a t a sk feat uring t he optima l profiles ca lculat ed for t he contr ol va ria bles:
1. Fr om th e optimiza tion dialog box, click the Ta sk butt on.
2. When prompted, enter a na me for the task.
The ta sk is genera ted.
3. Close th e Optimiza tion dia log box.
4. Click the Reset butt on an d cha nge the run mode to Dy na mic.
5. In t he Content s pa ne of the Simulat ion Explorer, ensure Flowsh eet is
selected, a nd t hen double-click th e ta sk you ha ve just crea ted t o activat e it.
6. From the Run menu, click P a use At a nd set the pause time to 60 hours.
7. En sure th e Cont rolP lots plot is open.

Aspen C ust om Modeler E xa mples 13-3


Version 10.2
Dynamic
Optimization

8. P erform the dyna mic run.


9. Click with th e right mouse butt on on the plot a nd from the menu tha t
a ppea rs, click Show As H istory.

Observe how t he fina l tempera tur e constr a int is sat isfied. Note tha t th e pa th
constr a int is not completely sa tisfied, as it w a s posed as a soft constr a int.

   

13-4 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 14

14 C D I E xa m ple
A CD I exa mple is supplied w ith Aspen Cust om Modeler™ . This exam ple is a
model of a column a nd side str ipper for the separ a tion of a mixture of benzene,
toluene, an d xylene. B enzene and xylene a re th e main column's top an d bottom
products respectively, a nd t oluene is the product fr om the sidestr ipper. This
example includes scripts to:
• Specify the CD I input an d output var iables
• G enerat e mat rices which you can t hen exa mine to determine the suita bility of
the input var iables to contr ol the specified output va riables

Aspen C ust om Modeler E xa mples 14- 1


Version 10.2
CDI
Example

Running the CDI Example


If you ha ve insta lled in t he default loca tion, files for this example will be in th e
folder:
C:\ P rogram Files\AspenTech\ Aspen Cust om Modeler 10.2\E xamples\B txCD I

To run t he CD I exa mple supplied wit h Aspen Cust om Modeler™ :


1. Crea te a subfolder in your working folder wh ich ha s the name btxcdi.
2. Copy the files btxcdi.a cmf a nd btxa llp.dll to this new subfolder. If you copied
the files to the example working folder, these files are located in:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\btxcdi
Alterna tively, you can copy th e dll to a folder wh ich is on your pa th.
3. Na viga te to th e btxcdi folder and open the file btxcdi.a cmf.
4. Ensure the run mode is St eady Sta te.
5. Fr om th e Tools menu, click Sna pshots.
6. In the Sna pshot Man a gement dialog box, click the result labeled St eady
St a te to select it, t hen click th e Copy Va lues button.
7. On th e Ma tches Found dia log box, click OK to copy th e va ria bles a nd close th e
Snapshot Management dialog box.
8. P erform a stea dy-sta te run.
9. In th e All It ems pa ne of the Sim ula tion Explorer, click Flow sheet.
10. Invoke the CD I run script C DI _LINE ARIS E_RU N.
This script specifies the CD I input a nd output va ria bles a nd t hen generat es
the st a te space mat rices a t t he converged stea dy st a te solution. These appea r
in your current w orking folder. The RG A and G ma trices ca n be exa mined to
determine the suitability of the input variables to control the specified output
variables.
11. This script a lso generat es an MDL file wh ich can be used as input int o
DMC plus. The MDL file conta ins results from a step change in t he chosen
var iables and can be used to design a DMC plus controller for this simulat ion.

Now edit a script to genera te the A ma trix.

14-2 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 14

Performing a Dynamic Run and Generating the A


Matrix
To perform a dyna mic run a nd generat e the A ma tr ix:
1. Cha nge the run mode to Dy na mic.
2. From the Run menu, click Pa use At.
3. Type a P a use a t time of 1 a nd click OK.
4. P erform the dyna mic run.
5. Select the CD I_LINE ARIS E_RU N script. Click wit h the right mouse butt on
on it a nd from the menu tha t a ppea rs, click Edit.
6. Edit t he script so tha t only the A ma tr ix is produced, tha t is, a dd this line:

LINEARISE.MatricesRequired "A"

7. Sa ve th e changes an d invoke the changed script. This will generat e the A


ma trix at t ime 1.
The A matrix can be used to determine the linearized stability of the BTX
column a t time 1.

   

Aspen C ust om Modeler E xa mples 14- 3


Version 10.2
CDI
Example

14-4 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 15

15 pH C on t r oller E xa mple
us ing S im ula t ion Access
eXtensions
This exam ple models a pH cont rol system. An a cid effluent is fed into a stir red
ta nk a nd neutr a lized using a lkali. The flow of a lkali is contr olled by a P ID
contr oller t ha t m easures th e pH of the ta nk content s. A step cha nge in the a cid
flow from 0.025 to 0.03 is int roduced a t t ime 5.0 to test t he cont roller r esponse.

This exa mple includes a simple exa mple of using th e Simu la tion Access
eXtensions (SAX) int erfa ce. The int erfa ce code is supplied a nd can be used a s a
sta rt ing point in the development of your own S AX interface.

Aspen C ust om Modeler E xa mples 15- 1


Version 10.2
SAX
Example

Running the pH Control Example


Exa mple simulat ions a re included in your Aspen Cust om Modeler™ insta llation.
If you ha ve insta lled in t he default loca tion, files for this example will be in th e
folder
C:\Program Files\AspenTech\Aspen Custom Modeler 10.2\Examples\SAX

To run t his exa mple:


 Copy th e files in th e exa mple directory t o a convenient w orking folder, for
example:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\SAX

To loa d t he S imula tion Access eXtensions exa mple:


1. Fr om th e File menu, click Open.
2. Loca te th e SAX folder. If you copied th e files to the exam ple w orking folder,
this is:

C:\ P rogra m F iles\ AspenTech\ Working Folder\Aspen Cust om Modeler


10.2\SAX
3. D ouble-click t he file phcon.acmf .
4. In t he Explorer select Flow sheet an d double-click th e ta sk AcidFlowS tep to
a ctiva te it, th en double-click AcidFlow P lot t o open it.
5. Run th e simulat ion. You will see a st ep change in the acid flow ra te at 5
hours, and the resulting change in pH in the ta nk w ith time.

15-2 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 15

Using SAX
You can run this exam ple using SAX to int roduce a disturba nce in th e acid feed
flow ra te a t 5 hours. To do this:
1. Modify th e ma kefile a nd crea te the dll a s described in Modifying th e Ma kefile
a nd B uilding t he DLL on page 15-6.
2. If you have already run th e simulat ion resta rt it and ensure tha t the task
AcidFlowStep is not active.
3. Fr om the Tools menu, click Simula tion Access eXtensions. The Simu lat ion
Access E xtensions dia log box is display ed.
4. Ma ke sure the Output Varia bles ta b is on top by clicking it. Note tha t th e
var iable CS T.Acid.flow ha s been a dded to t his list of var iables for
tra nsmission t o the S AX function.

Tip An easy wa y to add va riables to this list is to dra g and drop them from a
table.
5. Click the P rocedure ta b and note th a t the following da ta h a s been entered:
F un ct ion n a m e: S AXF un ct ion

L i br a r y n a m e : C : \ P r o gr a m F i le s\ A sp en Te ch \ Wo rk in g F ol de r \ As p en C u s t om Mo de le r
10.2\SAX\phconsax.dll
(or location of your inst a llation: chan ge the library n am e if necessa ry)

6. En sure tha t th e After Dyn a mic St ep check box is selected, so tha t t he function
is ca lled aft er each st ep. Also select th e Ena ble Simula tion Access eXtensions
check box to ena ble SAX a nd t hen close the S AX wind ow.
7. In t he Explorer, click Flowsh eet an d th en double-click AcidFlowP lot t o open it.
8. Run th e simulat ion. You will see a st ep change in the acid flow ra te at 5
hours, and the resulting change in pH in the ta nk w ith time.

Defining the SAX Interface Function


The C code to be used is in the files sax_example.h a n d sax_example.c.

The ma in fun ction is ca lled SAXFun ction. This corr esponds t o the na me given to
the function in th e SAX dia log box. It ha s a fixed argu ment list, so tha t it ca n be
found w hen the D LL is loa ded.

The body of the code is a la rge switch st a tement, w ith a case for each of the
possible types of event. In this ca se, only t hree events a re of int erest: those at th e
beginning and end of a simulation, and the event after a dynamic step.

Aspen C ust om Modeler E xa mples 15- 3


Version 10.2
SAX
Example

At t he sta rt of a simula tion, which is wh enever a new simulat ion is loa ded, or a
structural change is made to a loaded simulation, a number of ar ra ys a re
allocated. These need to be allocated for both lists of variables being passed to
SAX. For each, a list of nam e pointers a nd a list of type specifiers a re a llocated,
wit h one entry for each varia ble in the list, a nd th ree sma ller a rra ys for rea l
values, integer values, and string va lues. Note tha t a dditiona l arra ys may ha ve
to be a llocated if we wished to ma nipulat e varia ble bounds or oth er var iable
a tt ributes. These allocations a re performed in the function
GenerateProblemData().

At t he end of a simula tion, these sa me dat a a rra ys a re deleted by the function


DeleteProblemData().

15-4 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 15

After a dyna mic step, we need to check th e simula tion time an d th e value of
CS T.ACI D.FL OW, wh ich in t his case is the only va ria ble passed in, a nd cha nge it
a s a ppropria te. This is done by t he following code:
case SAX_AFTER_DYN_STEP: /* after a dynamic step */
{
DiagPrint("\nSAXFunction, after dyn step:");
LoadVector(nOut, OutList, OutTypes, OutReals, OutInts,
OutStrings);
/** PHCON SPECIFIC **/
{
/*
* Since there is only one variable, it must be in
* position [0] of our data arrays
*/
int changed=0;
if (Time>= 20.00)
{
if (OutReals[0]!=0.03)
{
OutReals[0] = 0.03;
  changed++;
}
}
  else
{
if (OutReals[0]!=0.025)
{
OutReals[0] = 0.025;
  changed++;
}
}
if (changed)
{
  ACM_Print(0,
"SAX: Modified value of %s to %g at time %g",
  OutNames[0],&OutReals[0],&Time);
UnloadVector(nOut, OutList, OutTypes, OutReals,
 OutInts, OutStrings);
}
}
/** END PHCON SPECIFIC **/
}
  break;

This code loa ds t he current va ria ble data for t he var iables passed into your SAX
function by ca lling LoadVector (this fun ction is cont a ined in t he source file), th en
checks th e time, and the va lue of CS T.ACI D.FL OW. If t his va lue needs t o be
changed, it modifies it, an d causes a message to be sent to the S imulat ion
Messages window of the client, using ACM_P rint(), to say t ha t it ha s done so.
The changed value is then loaded back into the server by a call to UnloadVector().

This code is designed to be generic. It ca n be used a s th e sta rt ing point for your
SAX applica tions.

Aspen C ust om Modeler E xa mples 15- 5


Version 10.2
SAX
Example

Modifying the Makefile and Building the DL L


Complete the following steps to build the DLL:

1. The makefile is supplied in the exa mples directory a s MakeP hconS a x. If you
have not installed in the default location or have copied the examples files you
w ill need t o modify t he follow ing definitions.

Cha nge th e following definitions to correspond wit h y our insta llation location:
ACMSAXSOURCEPATH \Program Files\Common Files\AspenTech Shared\AMSystem 10.2\Procedures
ACMSAXINCLUDEPATH \Program Files\Common Files\AspenTech Shared\AMSystem 10.2\Procedures

Ch a nge the follow ing definitions to corr espond w ith t he locat ion of your
example directory.
SOURCEDIR \Program Files\AspenTech\Working Folder\Aspen Custom Modeler 10.2\SAX\ 
DLLDIR \Program Files\AspenTech\Working Folder\Aspen Custom Modeler 10.2\SAX\ 

2. If you ha ve not alrea dy done so, creat e the directory specified by DLLD IR,
otherw ise the make w ill fail.
3. Na vigat e to th e directory conta ining th e file Ma kePhconSa x a nd then build
the DL L by entering the following comma nd in a D OS w indow:
nmake –f MakePhconSax

   

15-6 Aspen Cu st om Modeler E xa mples


Version 10.2
Chapter 16

16 G a r y B la u E st im a t ion
Example
This exa mple is based on the 1986 paper " Nonlinear P a ra meter Est imat ion: a
Ca se St udy Compa rison" by L.T.Biegler, J .J .Da miano and G .E.B lau in the
AIC hE J ourna l, Volume 32, Num ber 1, pa ges 29 to 45. The paper compar es the
solutions from several a uth ors to a difficult estimat ion problem formulat ed by
Dow.

The problem is th e estima tion of nine par a meters fr om a complex kinetics model
of a batch reactor.

Since the estima tion is ha rd t o solve, in t he Aspen C ustom Modeler™ model:


• Sensible sca le factors for t he estimat ed var iables a re given. These help the
num erical beha vior of th e solvers a nd impr ove robustn ess of convergence.
• B oth sides of th e Arrh enius equa tions ar e logged an d logs of the
preexponentia l factor estima ted ra ther t ha n th e preexponentia l factor; this
significant ly ma kes convergence of the problem more robust s ince th e ra nge of
the logged factors ar e smaller an d th e associat ed sensitivities a re better
scaled.

Aspen C ust om Modeler E xa mples 16-1


Version 10.2
Gary Blau
Estimation

Running the Parameter Estimation Example


To run t he exam ple:
1. Fr om th e File menu, click Open.
2. Open th e file gary blau example.acmf . If y ou copied th e files t o the exam ple
w orking folder, t his file is loca ted in:

C:\ Program Files\ AspenTech\ Working Folder\ Aspen C ustom


Modeler 10.2\ BlauEstimation
3. To inspect t he setup of th e estim a tion experiment s, from the Tools menu, click
Estimation.
4. Click the Estima ted Var iables tab a nd note tha t it shows those varia bles
wh ich a re to be estima ted.
5. Click the Dyn a mic Experiment s ta b. Three dynam ics experiments a re listed.
To view the details of an experiment, select an experiment and click the Edit
butt on. A dialog box with t hree ta bs appears:
Measured Variables tab. This lists va ria bles for w hich th ere is observed
da ta . To view (and modify) the observed da ta , select a va ria ble and click
Ed it. When th e estima tion is complete, the resulting ta ble shows results
a nd ena bles you to crea te plots.
Fixed Variables tab. Lists va ria bles w hich ha ve prescribed values in the
experiment. To view the details of these variables, select Edit.
• Initial Variables tab. Lists var iables which are given a n initial va lue in
th e experiment a nd ena bles you to modify th a t initia l value.

6. Cha nge the run mode to Est imat ion and run th e simulat ion. Wa it for the
solution to complete. This ma y t a ke some minut es.
7. To observe the results on the Est ima ted Var iab les ta b, from th e Tools menu
click Estimation.
8. To check the accura cy of th e plot, on th e Mea sured Var ia bles ta b of the
Est imat ion dia log box, double-click th e measur ed var iables to edit th em a nd
observe the deviations. You may also plot these results here.

Tip Covar ian ce a nd Correlat ion ma trices a re norma lly a va ilable from the
Estima tion dia log’s S ta tus t ab by clicking the ma trices butt on. Note that the
correlat ion ma tr ix is computed from th e cova ria nce mat rix; when t he lea ding
diagona l of the cova ria nce ma trix conta ins negat ive values, it is not possible
to compute a correlat ion ma tr ix.

   

16-2 Aspen C ust om Modeler E xa mples


Version 10.2
Chapter 17

17 E xt er n a l Non lin ea r
Algebra ic S olver
Example
This exa mple shows how to write a nd use a DL L cont a ining an externa l
Nonlinear Algebra ic solver. The exam ple implements a n extern a l solver called
NLEQ1S a vailable in:

http://www.zib.de/SciSoft/CodeLib/frame_nonlin.en.html

Note The exam ple is given und er th e a ssumpt ion th a t you ha ve MS -Developer's
St udio insta lled on your ma chine.

Aspen C ust om Modeler E xa mples 17-1


Version 10.2
Open
Solvers
Example

Building and Using the Example DLL


Exa mple simulat ions a re included in your Aspen Cust om Modeler™ insta llation.
If you ha ve insta lled in t he default loca tion, files for this example will be in th e
folder:

C:\ Program Files\ AspenTech\ Aspen Custom Modeler


10.2\ Examples\ OpenSolvers

The following instructions assum e tha t the previous directory w a s used. If y ou


chose to use a different one, modify th e instr uctions according ly.

To build this exa mple DLL :


1. Copy the files in the exa mple directory to a convenient w orking folder, for
example:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\OpenSolvers
2. Obta in a copy of the file nleq1s.f (ensur e you ha ve the right s to do so) a nd
copy it into the directory C:\Program Files\AspenTech\Working
Folder\Aspen Custom Modeler 10.2\OpenSolvers, replacing the dummy one
provided.
3. Double-click C:\ P rogra m Files\ AspenTech\ Working Folder\ Aspen Cu stom
Modeler 10.2\OpenSolvers\OpenSolvers.dsw. This will start the MS-Dev
Studio GU I.
4. Click on th e MS-Dev St udio window t o ma ke it a ctive a nd press F7. This will
build th e OpenS olvers.dll in:

C:\ Program Files\ AspenTech\ Working Folder\ Aspen C ustom


Modeler 10.2\ OpenSolvers\ Debug\ OpenSolvers.dll
5. U se your Windows E xplorer to locat e th e file:

C:\ Program Files\ AspenTech\ Working Folder\ Aspen C ustom


Modeler 10.2\ OpenSolvers\ FiveTank.acmf 

a nd double click it. Aspen Cust om Modeler w ill sta rt w ith t his file loa ded a nd
the external solver DLL loaded. This simulation contains nonlinear blocks in
both the initialization and dynamic decompositions. The external solver
NLEQ1S will be used to solve any of these nonlinear blocks.

Tip If you receive th e follow ing error messa ge:


After NLEQ1 IERR=-999
Group 1: External nonlinear solver failed

it mean s you are using the dumm y NLE Q1S Fortra n code provided. You ha ve
probably forgotten to put the correct NLEQ1S.f file in position.

17-2 Aspen C ust om Modeler E xa mples


Version 10.2
Chapter 17

Using the NLEQ1S Solver


To use the NLE Q1S solver provided in t he exam ple D LL:
1. Fr om th e Run menu, click Solver Options.
2. Click on the Nonlinear Solver ta b.
3. In t he Mode box, select Open NLA Solver.
4. In th e box provided for th e DL L na me, ty pe:

C:\Program Files\AspenTech\Working Folder\Aspen Custom Modeler


10.2\OpenSolvers\Debug\OpenSolvers.dll

Alterna tively, you can sear ch for your D LL using the search butt on at t he
right of t he box.
5. Click the Apply butt on (this w ill loa d the D LL into ACM) and list the
ava ilable par ameters.
6. You ca n modify the par a meters by clicking on th em. A dia log box will open,
a llow ing you to set a new va lue.
7. Click OK

From now, w henever ACM needs to solve a nonlinea r a lgebra ic system, it w ill use
the n onlinear solver provided in t he DL L.

Debugging Your Code for the External Nonlinear


Algebraic Solver Example
If y our code is not behaving a s you think it should, you can debug its execution a s
follows. The instr uctions a re given using t he sa me example as a bove.
1. St a rt ACM, load your problem, a nd loa d the externa l solver DL L. Do not yet
run it.
2. Double-click C:\ Program Files\ AspenTech\ Working Folder\ Aspen
Custom Modeler 10.2\ OpenSolvers\ OpenSolvers.dsw, which will start
MS -Dev S tu dio. In MS -Dev S tu dio, click on B uild->[St a rt Debug]->[Att a ch to
process] a nd select " sim_server" a s t he process to debug. Click on t he w indow 
cont a ining th e C+ + code nleq1_int.cpp a nd locate line 470, press " F9" (this
will add a breakpoint a t t his line).
3. St a rt your run on the Aspen Cust om Modeler w indow . The MS-Dev St udio
window will be active as soon a s th e execution enters t he externa l solver D LL
code. You ca n now st a rt debugging it a s you wish.

   

Aspen C ust om Modeler E xa mples 17-3


Version 10.2
Open
Solvers
Example

17-4 Aspen C ust om Modeler E xa mples


Version 10.2
Chapter 18

18 E xpor t in g a n Aspen
C us t om Modeler
Flowsheet
Cyclohexane can be produced by the hydrogenation of benzene in the following
reaction:
C6 H 6  + 3H 2 = C6 H 12
Benzene Hydrogen Cyclohexane

The benzene and hydrogen feeds are combined with recycle hydrogen and
cyclohexane a nd preheat ed before entering a fixed bed ca ta lytic reactor.

The reactor effluent is cooled and the light gases separated from the product
str eam. P a rt of the light ga s strea m is fed back to the rea ctor a s recycled
hydrogen.

The liquid product str eam from the separa tor is fed to a distilla tion column t o
furth er remove an y dissolved light gases a nd t o sta bilize the end product. A
proport ion of th e cyclohexa ne product is recycled to th e react or to a id in
temperat ure contr ol.

In the Aspen P lus® simulat ion, t he reactor is modeled a s a stoichiometric reactor


(RS TOIC block) w ith a n a ssumed fixed fra ctional conversion of benzene of 99.8%.
The reactor model in a n Aspen Cust om Modeler™ simulat ion includes a ra te
expression.

Rate = k∗ CBenzene ∗ Chydrogen 


^3
 

Aspen C ust om Modeler E xa mples 18-1


Version 10.2
Exporting a
Flowsheet

Exporting the Cyclohexane Production Flowsheet


To be a ble to run t his exa mple:
• You must ha ve Aspen P lus® , Aspen Cust om Modeler™ , and a Microsoft® C+ +
compiler insta lled, tested, a nd r unning.
• Your compiler must be able to run from the command line.
• Aspen P lus must run w ith th e same server an d in the same working folder as
you ha ve configur ed for Aspen Cu stom Modeler.
Example problems are included as part of your Aspen Custom Modeler*
insta llation. If you ha ve insta lled in t he default location, the files for this example
w ill be in t he folder:

C:\Program Files\AspenTech\Aspen Custom Modeler


10.2\ Exa mples\F lowsh eet Export

To prepa re t o run t he exam ple in Aspen C ust om Modeler:


 Copy the files in t he insta llation example folder to a convenient working
folder. The default installation directory is typically:

C:\Program Files\AspenTech\Aspen Custom Modeler


10.2\E xamples\C yclohexan e P roduction

Setting up the Properties Plus Interface


You need to first set up Aspen P roperties P lus® w ith t he Aspen Modeler
interfa ce. This can be done w ith Aspen P lus® or w ith Aspen P ropert ies:
1. Open the Aspen P lus User Interfa ce a nd loa d the Flowsh eet Export feat ure
example backup file, named Cyclohexane.bkp.
2. Run the problem. Note tha t this is a P roperties P lus run ty pe wit h no
flowsheet.
3. When th e P roperties Plus setu p is completed, from the File menu, click Sa ve
As t o save a s a n Aspen P lus document (.apw extension) file, a nd n a me th e file
cyclohexane.
The cyclohexane.appdf file is automatically saved for use with Aspen Custom
Modeler.

Note Ma ke sure tha t the cyclohexane.appdf file is sa ved in the same


location as the cyclohexane.acmf file.
4. Exit Aspen P lus.

18-2 Aspen C ust om Modeler E xa mples


Version 10.2
Chapter 18

Running the Cyclohexane Production Flowsheet Export


Example
To run th e exa mple in Aspen Cus tom Modeler™ :
1. Open Aspen Cust om Modeler an d loa d the Cyclohexa ne.a cmf file. The
flowsh eet conta ins thr ee blocks a nd t wo str eams.

The RX_FEED block is an AplusFeed model. The RX_PROD block is an


AplusP rod model. These models a re used to convert th e Aspen Modeler syst em
base units of mea surement set (Metric) into SI un its. SI units a re the valid
units for export t o Aspen P lus® .

The AplusFeed and AplusProd models are used to map the


MoleFractionPort_SI port type (required for the Compiled Flowsheet Export
tool) to a MoleFractionPort port type and vice versa. The MoleFractionPort
port type is the port type used by the reactor model block itself and by
extension, t he lar ger flowsh eet, if t here wa s one.

The port variables to be exported and therefore to be used in the Aspen Plus
flowsh eet a re defined by th e port na med MoleFra ctionP ort_SI found in t he
Modeler library.

Note All model types, port types, va ria ble types, para meter t ypes etc.
referenced in t his exam ple exist in th e delivered Modeler or D yna mics
libraries.
2. Run the simulat ion in stea dy stat e run mode.
3. Review the key results from the ReactorResults ta ble in the
Simu la tion/Flowsh eet content s folder.

Aspen C ust om Modeler E xa mples 18-3


Version 10.2
Exporting a
Flowsheet

Exporting the Flowsheet


To use export th e flow sheet:
1. Fr om th e Tools menu, click Export Compiled Flowsh eet.
The Flowsheet Export menu is displayed.
2. On the Compiled Flowsh eet E xport form, cha nge the Export D irectory to be
the sa me a s t he directory w here th e Cyclohexane.bkp. file is located, for
example:

E:\ Aspen P roducts\ Working Directory\ Flowsh eet Export


3. In t he Library File box, specify the directory a nd th e name of the Aspen P lus
U ser Model Libra ry (.apm extension) file to be genera ted. This directory is t he
same location as the original Cyclohexane.bkp file. For example:

E:\ Aspen P roducts\ Working Directory\ Flowsheet Export \cyclohexane.a pm

Note The first t ime th is file is specified, you w ill be a sked if you wa nt t o
creat e one, since the file does not yet exist.
4. In t he Input s Ta ble box, select Rea ctorIn put s from th e list. This is th e form
that defines the variables that Aspen Plus will display as inputs.
5. In t he Results Ta ble box, select Rea ctorResults from th e list. This is the form
that defines the variables that Aspen Plus will display as results.

Note Forms must ha ve been previously creat ed in t he Flowsheet folder t o be


available in the list.
6. To genera te the DL L a nd th e .a pm (Aspen Plus user model libra ry ) file, click
OK .
7. Check the Simula tion Messages window t o see if the Aspen P lus model libra ry
flow sheet export a nd t he dll generat ion process succeeded. The dll an d t he
apm extension files should have been created in the specified export and
library directories.
8. E xit Aspen Cu stom Modeler.

18-4 Aspen C ust om Modeler E xa mples


Version 10.2
Chapter 18

Running the Exported Flowsheet in Aspen Plus


To run t he flowsheet y ou ha ve exported:
1. St a rt Aspen Plus® a nd loa d the Cyclohexane.bkp file. There is no flowsh eet a s
the run type is still P roperties Plus.
2. Ch a nge the run type to Flowsh eet from the Da ta /Set up/Specifica tion form
under t he G loba l settings section.
The flowsheet is display ed.
3. Run the simulat ion.
4. When th e run completes successfully, reconcile str eam s RX-FE ED a nd RX-
P ROD to provide good estima tes for th e Aspen C ustom Modeler™ (ACM)
reactor feed a nd product st ream s. To do this, select t he str eam, click t he right
mouse butt on t o display the S tr eam menu, a nd t hen click Reconcile.
5. Fr om th e menu ba r, click Libra ry/References.
6. On the Librar y References form, click Br owse a nd na vigat e to the directory
wh ere the Cy clohexane.a pm file is located. Open Cyclohexane.apm to a dd t he
exported Aspen Cu stom Modeler flowsh eet to the Aspen P lus model libra ry .

Note B efore closing th e Libra ry/References form, ma ke sur e th a t


Cyclohexane.apm is selected in the d isplayed list of ava ilable libra ries.
7. Click OK to leave th e Libra ry references form.
A new t a b na med ACM F lowsh eets is a dded to the model palette.
8. In t he Pr ocess Flow sheet (PFS ) window, delete the RSTOIC r eactor block R-
104.
9. 8. Select th e ACM Flowsheets ta b and dr a g the Cyclohexane icon onto th e
P FS to r eplace block R-104.
10. Connect existing s tr eam RX-FE ED to th e inlet of th e new block (th e exported
ACM flow sheet) an d connect str eam RX-P ROD to th e outlet of th e new 
rea ctor. The flowsheet is now complete.
11. Use the Next but ton, ACM r eactor block pull down menu, or the D a ta
Browser to access the ACM Cyclohexane reactor block input forms.
12. On the C onnections form for t he new block, click th e strea m field for P ort I D
RX-FE ED a nd select strea m RX-FE ED , and click the strea m field for P ort I D
RX-P ROD a nd select strea m RX-P ROD.

Note In I NP U T mode, the Va ria bles ta b form displays t he var iables defined
in Aspen Custom Modeler ReactorInputs form.

Aspen C ust om Modeler E xa mples 18-5


Version 10.2
Exporting a
Flowsheet

13. Click t he Next butt on t o run t he simulat ion.


14. When t he ru n completes, use th e block pull dow n m enu t o view th e ACM
Reactor model block results from the ReactorResults form.

   

18-6 Aspen C ust om Modeler E xa mples


Version 10.2
Chapter 19

19 H a ndling E vent s in a
Visua l B a sic Act iveX
D LL
To run t his exa mple, you need to:
• Create the DLL
• Add a test project t o test the D LL
Note If you have insta lled Aspen Custom Modeler™ in the default location, the
Microsoft® Visua l B a sic® s ource code for both t he projects in t his exam ple is
a v a i la b l e a t :

C:\Program Files\AspenTech\Aspen Custom Modeler


10.2\Examples\ACMEvent\ACMEventsExample.vbg

For more information about Application Object events, see the Automation
Reference.

Aspen Cu st om Modeler Exa mples 19-1


Version 10.2
Handling
Events in a
Visual Basic
ActiveX DLL

Creating the ActiveX DLL for the Example


To crea te t he necessar y D LL, complete t he following procedure:
1. Sta rt Microsoft® Visual B asic® .
2. Cr eat e a new pr oject, selecting the ActiveX dll type.
3. Renam e Cla ss1 to CE ventS ink. En sure tha t the insta ncing property for this
class is set to 5 – MultiUse.
4. G o to Pr oject| References and in the Ava ilable References list, select Aspen
Cu stom Modeler 10.2 Type Libra ry .
5. U nder P roject P roperties, rena me the project to ACME vents.
6. In th e Decla ra tions section of the class a dd the line:
Implements IAspenModelerEvents

7. In t he Object list a t t he top of th e code for th is cla ss, select


IaspenModelerEvents.
8. Crea te a code stub for each of the events in t he P rocedure list by selecting
each of them in tur n.
9. Add th e follow ing line to th e decla ra tions of this clas s:
private ACMApp as AspenCustomModeler

10. Add th e follow ing t w o public functions:


Public Sub AddRef()
 Set ACMApp = New AspenCustomModeler
 ACMApp.Visible = True
 ACMApp.AddEventSink Me
End Sub

Public Sub Release()


 ACMApp.RemoveEventSink Me
End Sub

Aspen C ust om Modeler E xa mples 19-2


Version 10.2
Chapter 19

This completes the information needed to handle ACM events. You must now add
instru ctions t o make th e DLL work. To do this:
1. Add the follow ing function:
Public Sub Go()
 if not (ACMApp is Nothing) then
ACMApp.OpenDocument App.Path & "\fivetank.acmf"
Dim Sim As AspenModelerSimulation
Set Sim = ACMApp.Simulation
Sim.Step (True)
Set Sim = Nothing
ACMApp.CloseDocument False
 end if
End Sub

2. Modify th e definition of th e OnOpened event :


Private Sub IAspenModelerEvents_OnOpened(ByVal sPath As Variant)
 Msgbox "Opened " & sPath
End Sub

3. Sa ve th e project.

Adding a Test Project


You next n eed to ad d a test project t o test t he dll. To do th is:
1. From the File menu, click Add P roject a nd select Sta nda rd E xe.
2. Select P roject References and ensure tha t ACMEvents — the project t ha t you
just crea ted — is checked.
3. Cha nge th e project na me to TestACME vents.
4. In t he project browser, right-click TestACME vents a nd click Set a s St a rt U p.
5. Add a comma nd butt on to the default form. Cha nge its caption to Go. In th e
command button’s Click event add the following code:
Private Sub Command1_Click()
 Dim x As ACMEvents.CEventSink
 Set x = New ACMEvents.CEventSink
 x.AddRef
 x.Go
 x.Release
End Sub
6. Sa ve th e project. You ca n also save the project group if you wish .
7. St a rt runn ing the project wit h a full compila tion [Ct rl+ F5].

Aspen C ust om Modeler E xa mples 19-3


Version 10.2

You might also like