Fortran User Model
Fortran User Model
You can use Fortran in Aspen Plus to perform any task that can be
written as valid Fortran expressions.
You can input Fortran expressions in a number of ways in Aspen Plus:
To ensure that you enter accurate variable names, click the right
mouse button. In the popup menu, click Variable List. The Defined
Variable List window appears. You can drag and drop the variables
from the Defined Variable List to the Fortran sheet.
To do this
Use
Indicate comments
Column one for C and leave column two blank
Enter statement labels Only columns three, four, and five
Begin executable
Column seven or beyond
statements
You can call your own subroutines or functions. You can use
labeled or blank (unlabeled) COMMON blocks.
Fortran variables you define on the Specification sheet cannot
be placed in a COMMON.
Do not use IMPLICIT, SUBROUTINE, ENTRY, RETURN, END statements,
nor arithmetic statement functions.
READ and WRITE statements to numbered file units (as in WRITE
(NTERM,*)) only work if the same compiler was used to compile
the code containing these statements and the code which opened
the files. Aspen Plus now uses the Intel Fortran compiler to
open its built-in units for the report file, history file, and
control panel. See Chapter 1 of Aspen Plus User Models for more
information.
DABS
DACOS
DASIN
DATAN
DATAN2
DCOS
DCOSH
DCOTAN
DMIN1
DMOD
DSIN
DSINH
DSQRT
DTAN
DTANH
IABS
IDINT
MAX0
MIN0
MOD
You can use the equivalent single precision or generic function names
in your Fortran statements. However, Aspen Plus always performs
double precision calculations, and using the other names will require
compilation.
If you use the following statements, you must enter them on the
Declaration sheet:
COMMON statements
ENTRY
EQUIVALENCE
IMPLICIT
LOGICAL
PARAMETER
PRINT
RETURN
READ
STOP
SUBROUTINE
To do this
Use
Indicate comments
Column one for C and leave column two blank
Enter statement labels Only columns three, four, and five
Begin executable
Column seven or beyond
statements
You can call your own subroutines or functions. You can use
labeled or blank (unlabeled) COMMON blocks.
Fortran variables you define on the Specification sheet cannot
be placed in a COMMON.
Do not use IMPLICIT, SUBROUTINE, ENTRY, RETURN, END statements,
nor arithmetic statement functions.
READ and WRITE statements to numbered file units (as in WRITE
(NTERM,*)) only work if the same compiler was used to compile
the code containing these statements and the code which opened
the files. Aspen Plus now uses the Intel Fortran compiler to
open its built-in units for the report file, history file, and
control panel. See Chapter 1 of Aspen Plus User Models for more
information.
Include statements
COMMON definitions
DIMENSION definitions
Include statements
COMMON definitions
DIMENSION definitions
Fortran variables that you defined on the Define sheet should not be
declared in the Declarations dialog box.
Fortran Declarations
You enter Fortran declarations in the same way as executable Fortran
statements, using the Declarations sheet instead of the Fortran
sheet.
You can include any Fortran declarations in an optimization problem,
including:
COMMON definitions
DIMENSION definitions
Fortran variables that you defined on the Define sheet should not be
declared on the Declarations sheet.
more Fortran subroutines that you write yourself when the models
provided by Aspen Plus do not meet your needs. A proper argument list
is needed in the subroutine to interface your user model to
Aspen Plus.
You can write the following kinds of user models for use in
Aspen Plus:
External Fortran
Application Types
User Unit Operation
Models
Kinetic Models
Use
NRPT
NHSTRY
Destination
Control Panel (if running from the user
interface)
Terminal (if running interactively
outside of the user interface), or
Log file (if running batch)
Aspen Plus report
Simulation history
Examples:
For writing to the Control Panel, enter:
WRITE(NTERM, *) A, B, C, X
For writing to the report file, enter:
WRITE(NRPT, *) A, B, C, X
If writing to the Aspen Plus report from a Fortran Calculator block,
select Report in the Execute field on the Sequence Sheet. Output
written to the report file will appear in the Flowsheet section of
the Calculator block report.
When writing to a user-defined file, use a Fortran unit number
between 50 and 100.
Writing to the predefined Aspen Plus units will only work in compiled
Fortran if the Fortran is compiled with the Intel compiler. Writing
to user-defined files will only work if the code that opened the file
and the code with the write statement were compiled with the same
compiler. See Chapter 1 in Aspen Plus User Models for more
information.
Excel Calculator blocks do not have the ability to write to the
Control Panel or Aspen Plus report or history files, but you may use
VBA macros to display information in dialog boxes.
Variable List window appears. You can drag and drop the variables
from the Defined Variable List to the Fortran sheet.
Description
No messages
Defined-variable values before block
execution are listed
Level 5 and defined-variable values after
block execution are listed
Material Streams
inlet One to four inlet material streams
outlet One to four outlet material streams
Heat Streams
inlet One heat stream (optional)
outlet One heat stream (optional)
Work Streams
inlet One work stream (optional)
outlet One work stream (optional)
Specifying User
You must specify the name of the subroutine model on the Input
Specifications sheet. You have the option of specifying:
Values of the integer and real arrays passed to the user model
subroutine
User Reference
User can model any unit operation model. You must write a Fortran
subroutine to calculate the values of the outlet streams based on the
inlet streams and parameters you specify.
User and User2 differ only in the number of inlet and outlet streams
allowed and the argument lists to the model subroutine. User is
limited to a maximum of four material and one heat or work inlet
stream and a maximum of four material and one heat or work outlet
stream. User2 has no limits on the number of inlet and outlet
streams.
BlockOptions
Results
Specifying User
You must specify the name of the subroutine model on the Input
Specifications sheet. You have the option of specifying:
Values of the integer and real arrays passed to the user model
subroutine
You can write the following kinds of user models for use in
Aspen Plus:
External Fortran
Application Types
User Unit Operation
Models
Kinetic Models
Use
User Models
Aspen Plus provides several methods for you to create your own unit
operation models:
Fortran
Excel
These models can simulate any unit operation model. For each type of
model, you write your own program or spreadsheet to calculate the
values of outlet streams, based on the specified inlet streams and
parameters.