This action might not be possible to undo. Are you sure you want to continue?
tasks. Since Aspen Plus is a sequential modular simulator that executes one unit operation at a time, you must specify where in the sequence of unit operations each Calculator block is to be executed. You can do this by specifying one of these:
Which flowsheet variables are Imported from and Exported to Aspen Plus by the Calculator block The position of the Calculator block in the list of unit operation blocks
Define a Calculator block by: 1. 2. 3. 4. Creating the Calculator block. Identifying the flowsheet variables that the block samples or manipulates. Entering the Excel formulas or Fortran statements. Specifying when the Calculator block is executed.
Note: Variables changed by a Calculator will remain at their last values at the start of the next run if you do not reinitialize the problem. If you modify the problem so that these variables are no longer changed, the old changed variables will retain their last values from the Calculator (rather than values previously specified on other forms) until otherwise changed or reinitialized. 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:
• • •
In Fortran Calculator blocks On the Fortran sheets of other blocks, such as design specifications, sensitivity or optimization problems In external Fortran subroutines
Fortran Calculator blocks:
• • •
Contain Fortran expressions used to perform user-defined tasks Can read and/or write flowsheet variables Are executed at a specific point in the simulation
Aspen Plus checks your Fortran code interactively as you enter it so most syntax errors are detected before a run. If the status indicator on a Fortran sheet is , use Next to find out what is incomplete. You can write external User Fortran subroutines when the models provided by Aspen Plus do not meet your needs. After you compile these subroutines, they are dynamically linked when the simulation is run. Aspen Plus allows extensive customization of the models through the use of these external user subroutines. For more information on external user subroutines, see Aspen Plus User Models. Aspen Plus can interpret most in-line Fortran. Fortran that cannot be interpreted is compiled and dynamically linked to the Aspen Plus module. Because dynamic linking is used, the overhead for in-line Fortran requiring compilation is small.
3. such as: • • • • • • Calculating and setting input variables before they are used (feedforward control) Writing information to the Control Panel Reading input from a file Writing results to the Aspen Plus report or to any external file Calling external subroutines Writing your own user models Define a Fortran Calculator block by: 1. From the Data menu. point to Flowsheeting Options. A Fortran variable name must: • • • Be eight characters or less Start with an alphabetic character (A – Z) Have subsequent alphanumeric characters (A – Z. Use the Define sheet to identify a flowsheet variable and assign it a variable name. In the Create New ID dialog box. 2. Entering the Fortran statements on the Calculate sheet.Note: If the Fortran cannot be interpreted. – or – To edit an existing variable. Calculator blocks let you insert Fortran statements into flowsheet computations to perform userdefined tasks. 2. You must identify the flowsheet variables used in a Calculator block and assign them variable names. specify the variables on the Variable Definition dialog box. In Excel. 3. click New. 0 – 9) . 1. and click OK. Identifying the flowsheet variables that the block samples or manipulates. The Define sheet shows a concise summary of all the accessed variables. click the Open Excel Spreadsheet button. but you cannot modify the variables on the Define sheet. select a variable and click the Edit button on the Define sheet. on the Calculate sheet. 2. 4. Type the name of the variable in the Variable Name field. Creating the Calculator block. When completing a Define sheet. On the Calculate sheet. select Fortran (default). a Fortran compiler is needed. Specifying when the Calculator block is executed. See chapter 1 of Aspen Plus User Models for information on supported compilers and on configuring Aspen Plus to use your compiler. See Also To create a Fortran Calculator block: 1. click the New button on the Define sheet. To create a new variable. select the cell and click the Define button on the Aspen Plus toolbar. enter an ID or accept the default. Now identify the flowsheet variables. A variable name identifies a flowsheet variable on other Calculator block sheets. In the Calculator Object Manager. then Calculator. – or – To create or edit the variable from Excel. 4.
such as A1 or R1C1. Export variables in recycle loops may instead be marked as tear variables to indicate that they should be torn for solving the loops. You can specify the description of the EO variable in the calculator block. For more information. Aspen Plus will assign a unique name to the variable based on its type. units. where blkid is the name of the calculator block and description is the description provided. 4. variable names must: • • Follow the above limitations on Fortran variable names Not be a cell reference. The EO variable names of calculator block variables will be blkid. See EO Usage Notes for Calculator. 6. Tip: Use the Delete button to quickly delete a variable and all of the fields used to define it. If you do not specify this name. If you do not provide a description. If you choose a variable in the parameter category. see Import and Export Variables. see chapter 18.BLK. In Calculator blocks. see Converging Loops Introduced by Calculator Blocks. Note: Variables changed by a Calculator will remain at their last values at the start of the next run if you do not reinitialize the problem. select the variable type from the list in the Type field. use the option button to select the variable category.• Not begin with IZ or ZZ In Excel Calculator blocks. In the Category frame. you can specify the physical type. Click Close to return to the Define sheet. 7. it will be filled in automatically. In the Information Flow frame. For more information. In Fortran. the first letter of the variable name does not affect its type (integer or real). when you switch to the EO solution strategy. and which are changed by the Calculator block. and initial value of the variable. select whether the variable is to be imported from Aspen Plus or exported to Aspen Plus from the Calculator block. 5. if possible. . For more information on accessing variables. Use the Edit button to modify the definition of a variable in the Variable Definition dialog box. Import Variables and Export Variables are used to establish which of the variables appearing on the Define sheet are only sampled variables. FLOW and Flow refer to the same variable. The type is determined by the type of the value being referenced. you can specify additional options used in EO calculations: • • • You can specify the EO variable which is connected to this calculator variable. Aspen Plus displays the other fields necessary to complete the variable definition. If you modify the problem so that these variables are no longer changed.description. For instance. 3. Variable names are not case-sensitive in either Fortran or Excel. the old changed variables will retain their last values from the Calculator (rather than values previously specified on other forms) until otherwise changed or reinitialized. In the Reference frame.
Do not use variable names beginning with IZ or ZZ. Use double precision functions (for example. and cannot be specified as Export variables: • • Mole-Frac. Variables assigned a value are treated as export variables. 1D0). The Import and Export Variable specifications will apply when the block is run in EO. are double precision real. and control panel. nor arithmetic statement functions. variables beginning with A through H. Note: The following variables are results variables. that variable is also treated as an Export Variable. • READ and WRITE statements to numbered file units (as in WRITE (NTERM. follow these rules: • • • By default. MASS-ENTROPY. or O through Z. . Stdvol-Frac. Only Calculator blocks with at least one variable specified as an Import Variable or Export Variable are run in EO. You can use labeled or blank (unlabeled) COMMON blocks. four. RETURN. Mass-Frac. In Excel Calculator blocks. You can specify Import Variables and Export Variables in addition to specifying the execute time on the Sequence sheet. MASS-DENSITY. use the Execute statement to specify explicitly when the block is executed. all variables must be specified as Import or Export Variables. Aspen Plus also performs this check in SM if you have specified only Import Variables or only Export Variables.*)) only work if the same compiler was used to compile the code containing these statements and the code which opened the files. history file. Because Fortran is column-sensitive. LFRAC To achieve successful compilation of your Fortran statements. The execute-time specification will take precedence for sequencing the block in SM. MOLEENTROPY. • Fortran variables you define on the Specification sheet cannot be placed in a COMMON.• • • Import Variables establish information flow from the block or stream containing a sampled (read-only) variable to the Calculator block. Aspen Plus now uses the Intel Fortran compiler to open its built-in units for the report file. If the automatic sequencing logic using Import Variables and Export Variables does not appear to work properly. and five Begin executable Column seven or beyond statements • You can call your own subroutines or functions. Variables beginning with I through N are integer. In equation-oriented mode. and Stream-Prop variables The following Stream-Var variables: MOLE-ENTHALPY. Export Variables establish information flow from the Calculator block to Aspen Plus. ENTRY. See Chapter 1 of Aspen Plus User Models for more information. this table shows how to do certain things: To do this Use Indicate comments Column one for C and leave column two blank Enter statement labels Only columns three. END statements. and other variables are treated as import variables. SUBROUTINE. MASS-ENTHALPY. • Do not use IMPLICIT. DSQRT) and double precision constants (for example. If you specify a variable as a Tear Variable on the Variable Definition dialog box. Aspen Plus examines user Fortran statements to determine whether unspecified variables are assigned a value. MOLE-DENSITY.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue reading from where you left off, or restart the preview.