Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Aspen Plus has become an important tool in the study, design, development and op-
timization stages of a chemical process, being widely used in both academy and industry.
However as the ideas and concepts of the chemical engineering evolve, the capabilities of
Aspen Plus become limited. For that reason Aspen Plus offer some alternatives to the users
to customize the simulator and adjust it to their needs. One of them is the development of
Fortran user models, subroutines written by the user that can be used in sizing and costing
and unit operation models among others (Aspen Technologies, 2012).
Figure D.1: Basic steps for the development of a Fortran user model
Here a description of the process to develop a Kinetic subroutine for the modeling of a
reactive distillation column using the RadFrac unit is presented in order to circumvent the
limitations of the introduction of the reaction kinetics for such a case, as mentioned in section
9. The version of Aspen Plus used here is the number 7.3.
To write and use any Fortran user model three steps are required as presented in Figure
D.1. The versions of the programs required for the code development and compiling steps
(Microsoft Visual Studio
R
and Intel Fortran compiler
R
) have to match with each other to
avoid compatibility problems. A summary of the couples of versions that can be used can
be found under Start > Programs > AspenTech > Process Modeling V.7.3. > Aspen Plus >
Select compiler for Aspen Properties and Aspen Plus model libraries. Once a matching couple
has been successfully installed OK will appear instead of ERROR in the column State of
the corresponding line (See Figure D.2). At the bottom part of the mentioned list an option
is required in order to configure the compiler of Aspen Plus for USER and MACHINE. In
both cases the option corresponding to the installed software (the number at the left column
of the line) must be given.
101
102
Figure D.2: Window for the compiler selection used in the development of a Fortran User model
for reactive distillation modeling the base file (usrknt.for) can be found under Programfiles
> AspenTech > Aspen Plus V7.3. > Engine > User.
Almost all the arguments used in the subroutine are information required for the model
that is automatically taken from the simulation in Aspen Plus when the subroutine is called.
Other are useful as an information bridge between the Aspen Plus simulation and the sub-
routine, allowing to pass specific information from one file to the other. In this case, for
example, the diameter dependent parameters and the number of discretes per stage were
imported to the model using the real and integer vectors given for this purpose and acces-
sible from the subroutine form in Aspen Plus (See Figure D.3). In that way the frequent
modification, compilation and linking of the subroutine is avoided, what would result tedious
and impractical. In the same way the argument RATEL is used to communicate to Aspen
Plus the result of the determination of the reaction rate. A more complete description of the
arguments of the subroutine can be found in the Aspen Plus User Models guide (2012).
If the kinetic model is based in activities, as in this case, the following code can be
103
Figure D.3: Subroutine form in Aspen Plus to facilitate the passing of information between the simulator
and the user model
L GAMMA=DMS ALIPOFF3(24)
Do J=1, NCOMP
GAMMA(J)= exp(B(L GAMMA+LCLIST LBLCLIST+J))
End do
When other properties such as density, volumetric fraction, etc. are required in the model,
they can be calculated by calling the corresponding function or Physical property Monitors.
A detailed description of them can be found in the User models manual (Aspen Technologies,
2012). It is important to emphasize that the initialization of variables must be made before
the executable code begins. If it is not made in that way compilation errors will appear.
The kinetic expression can be codified directly and equalize to the RATEL coordinate
once all the required parameters and properties for its calculation have been imported or
calculated. Each coordinate of the vector RATEL corresponds to a reaction occurring in the
liquid phase, and the order of those reactions agrees with the initialization arrangement in
Aspen Plus. An equivalent vector, RATEV, is given for reactions in the vapor phase. In
this case, however, only one reaction (the esterification of BuOH with AA) was considered,
and therefore the RATEL vector has only one coordinate: RATEL(1). Remember that, as
mentioned in section 9.1.2, the result of the reaction rate calculated with a subroutine will
not be multiplied by the holdup once it is exported to Aspen Plus. Thus, it is important to
verify that the value obtained from the calculation of the reaction rate is given in units of
kmol/s.
As illustration, the executable code developed for the case of study is presented as follows.
104
K1=0.244065
K2=0.748227
K3=2.105
K4=2.288
L GAMMA=DMS ALIPOFF3(24)
Do J=1, NCOMP
GAMMA(J)= exp(B(L GAMMA+LCLIST LBLCLIST+J))
End do
Do J=1, NCOMP
ACT(J)=GAMMA(J)*X(J)
End do
keq=exp((-1888.657978/T)+8.17201)
Driv force=K0*EXP(-EA/8.314/T)*(act(1)*act(2)-1/keq*act(3)*act(4))
Adsorp=(1+K1*act(1)+K2*act(2)+K3*act(3)+K4*act(4))**2
C RATEL is the value of the reaction rate in the liquid phase. Exports to Aspen and it
C will be automatically multiplied by the stoichiometric coefficient of each component
105
RATEL(1)=MCATD/disc*CACT*Driv force/Adsorp/1000
RETURN
END
is employed.
Figure D.4: Steps for the compiling and linking steps to be performed in the Aspen Simulation Engine
screen
For this process the Aspen Plus Simulation Engine must be opened. It can be found
under the route Start > Programs > AspenTech > Process Modeling V.7.3. > Aspen Plus
> Aspen Plus Simulation Engine. In the screen the route of the default working directory is
shown. If the code file was saved un oder folder, the corresponding address must be given
typing cd followed by the folder direction. This and the following steps to be performed in
the Aspen Simulation Engine are presented in Figure D.4.
This process generates an object file (with the extension .obj), which consists of an or-
ganized machine code file that will allow the linking process. The procedure starts creating
a file with the program Notepad, in which the direction where the object file is placed must
be written. This file must be saved with the extension .opt. If this file is saved in the same
folder than the object file, the complete address is unnecessary, and only the name of the file
must be given (See Figure D.5).
To perform the linking process the following code must be typed on the Aspen Simulation
Engine:
asplink [dlopt name of the objfile.opt] name of file
A successful process can be seen in the Aspen Simulation Engine once a message informing
the creation of a .dll file appears.
An .opt file must be now created following the same procedure mentioned before but now
including the direction of the .dll file (See Figure). This file is used to indicate to Aspen
where to find the subroutine file. If the .opt file and the .dll file are in the same folder the
complete direction is unnecessary, being enough if the name of the .dll file is written.
Finally, in the Aspen Plus simulation under Run > Settings > Engine Files > Miscella-
neous files > Linker options the direction of the .opt file containing the location of the .dll
file must be given. Again only the name of the file will be required if the simulation and the
.opt file are in the same folder.
After doing this the subroutine can be used when the name of the file is introduced in
the corresponding box in the subroutine form, as shown in Figure D.3. When changes must
be made over the code, the compilation and linking process (the generation od the .dll file)
must be repeated. In that case the simulation must be closed to avoid connection problems.