Académique Documents
Professionnel Documents
Culture Documents
Contents
Contents.................................................................................................................iii
Who Should Read this Guide ...................................................................................1
Introducing OOMF Script Language.........................................................................3
Introduction ....................................................................................................3
Using the Interactive Prompt .............................................................................4
Defining and Executing Scripts...........................................................................5
Defining Scripts .....................................................................................5
Executing Scripts ...................................................................................5
Input Language Rules .......................................................................................6
General.................................................................................................6
Related Documentation .....................................................................................6
Technical Support ............................................................................................7
1 Script Commands ................................................................................................9
Command Summary .........................................................................................9
2 OOMF Script Language Basics ...........................................................................21
Redirecting Output and Journaling.................................................................... 21
Redirecting the Output of a Command .................................................... 21
Changing the Report Device .................................................................. 23
Changing the History Device.................................................................. 23
Flushing the Devices............................................................................. 24
Journaling ........................................................................................... 24
Examining the Output Devices ............................................................... 25
Examples of Redirecting Output ............................................................. 25
Script Parameters .......................................................................................... 26
Global Script Parameters....................................................................... 26
Local Script Parameters ........................................................................ 27
Built-In Script Parameters ..................................................................... 27
Setting Script Parameter Values ............................................................. 29
Unsetting Script Parameters .................................................................. 30
Accessing Parameter Values .................................................................. 30
Examples of Script Parameters............................................................... 30
Invoke Commands ......................................................................................... 32
Invoking an External File....................................................................... 32
Invoking a Block Script ......................................................................... 32
Invoking Scripts Within a Scope ............................................................. 33
Script Arguments ................................................................................. 33
Examples of Invoke Commands ............................................................. 33
Program Flow Control ..................................................................................... 34
IF-THEN-ELSE Command ...................................................................... 34
Contents
iii
iv
Contents
Contents
Measurement Qualities.................................................................................... 96
Disabling Simple Measured-Parameterized Pairs....................................... 97
Disabling Measured-Parameterized Pairs in Specification Groups ................ 97
Enabling Specification Groups ................................................................ 98
Executing the Variable Quality Capability................................................. 98
Examples of Measurement Qualities........................................................ 98
6 Saving and Restoring ......................................................................................101
Commands for Saving and Restoring Variable and Block Data ............................ 101
Saving Variables To a Binary File.......................................................... 101
Restoring Variables From a Binary File .................................................. 102
Restoring Free Variables From a Binary File ........................................... 103
Updating Variables In a Binary File ....................................................... 103
Saving Variables To an ASCII File......................................................... 104
Restoring Variables From an ASCII File ................................................. 104
Comparing Variables With an ASCII File ................................................ 105
Saving Variables and Block Attributes to an ASCII File ............................ 106
Reading Variables and Block Attributes from an ASCII File....................... 106
Examples of Commands to Save and Restore Variable Data..................... 107
Persisting Simulation and Block Data in Compound Storage (Binary) Files ........... 107
Saving a Simulation to a Compound Storage File.................................... 108
Opening a Simulation from a Compound Storage File.............................. 108
Adding all the Blocks in a Compound Storage File to a Simulation ............ 109
Saving a Block to a Compound Storage File ........................................... 109
Loading a Block from a Compound Storage File...................................... 109
Examples of Binary Persistence Commands ........................................... 109
Persisting Simulation and Block Data in XML Files............................................. 110
XML Schema for Simulation Persistence ................................................ 110
Writing a Simulation to a XML File ........................................................ 115
Reading a Simulation from a XML File ................................................... 115
Appending all the Blocks in a XML File to a Simulation ............................ 116
Writing a Block to a XML File ............................................................... 116
Reading a Block from a XML File........................................................... 116
Examples of XML Persistence Commands .............................................. 116
7 Objective Functions.........................................................................................119
Objective Function Commands ....................................................................... 119
Changing Objective Function Attributes................................................. 119
Evaluating the Objective Function ........................................................ 120
Evaluating the Objective Functions Derivatives...................................... 120
Evaluating the Objective Functions Hessian .......................................... 120
Printing the Objective Function ............................................................ 121
Jacobian and Derivative Commands................................................................ 121
Analyzing the Jacobian........................................................................ 121
Analyzing the Jacobian Sparsity ........................................................... 121
Evaluating the Jacobian ...................................................................... 122
Printing the Jacobian .......................................................................... 122
Printing Jacobian Variables .................................................................. 122
Printing Jacobian Equations ................................................................. 123
Printing Block Derivative Methods......................................................... 123
Examples Of Derivative Commands ...................................................... 123
vi
Contents
8 Analysis...........................................................................................................125
Analysis Commands...................................................................................... 125
Checking Degrees of Freedom.............................................................. 125
Sensitivity Analysis............................................................................. 125
Analyzing Variables ............................................................................ 126
Analyzing Equations ........................................................................... 127
Examples of Analysis Commands.......................................................... 127
Solver Commands ........................................................................................ 129
Setting the Solver .............................................................................. 129
Viewing Solver Settings ...................................................................... 129
Entering DMO Parameters ................................................................... 129
Entering LSSQP Parameters................................................................. 131
Entering NSOLVE Parameters............................................................... 136
Solving the Problem ........................................................................... 137
Examples of Solver Commands ............................................................ 137
Recovery Commands .................................................................................... 138
Resetting Variables to Initial Values...................................................... 138
9 Printing and Reports .......................................................................................139
Printing Problem Information ......................................................................... 139
Printing the Problem Summary ............................................................ 139
Printing Problem Convergence ............................................................. 139
Examples of Printing Problem Information ............................................. 139
Formatted Printing ....................................................................................... 140
Print Formatted Command .................................................................. 140
Examples of Formatted Printing ........................................................... 142
Miscellaneous Printing Commands .................................................................. 143
The Echo Command............................................................................ 143
Examples of the Miscellaneous Printing Commands................................. 143
Report Commands........................................................................................ 144
Reporting Blocks ................................................................................ 144
Reporting the Objective Function.......................................................... 144
10 Support for Dynamic Models..........................................................................145
Script Parameters that Support Dynamic Models .............................................. 145
Script Language Commands that Support Dynamic Models ................................ 146
Pausing a simulation........................................................................... 146
Running a simulation .......................................................................... 146
Stepping through a simulation ............................................................. 146
Stopping a simulation ......................................................................... 146
Reinitializing a simulation .................................................................... 147
Loading task definitions ...................................................................... 147
Viewing tasks .................................................................................... 147
Deleting a task .................................................................................. 147
Activating a variable profile ................................................................. 147
Inactivating a variable profile............................................................... 148
Viewing a variable profile .................................................................... 148
Viewing a variable history ................................................................... 148
Saving a snapshot .............................................................................. 149
Loading a snapshot ............................................................................ 149
Viewing snapshots.............................................................................. 149
Contents
vii
viii
Contents
Contents
ix
Contents
This manual is intended for users of the stand-alone OOMF core component or
users of the equation-oriented capabilities of products, such as Aspen Plus,
that embed OOMF. Typically, users write scripts to manipulate the simulation
data. Note that such scripts are not necessary for normal operations of
products that embed OOMF. However, these scripts may be used to extend
the capabilities of these products or to analyze the current simulation.
OOMF is embedded within several AspenTech products such as Aspen Plus,
Aspen HYSYS Refining, Aspen Advisor, Aspen PIMS, Aspen Water, Aspen
HYSYS to host models exported from Aspen Custom Modeler, Aspen MBO etc.
Some of these products have extended the capabilities of the OOMF scripting
language. These product specific extensions may be found in separate
sections at the end of this document.
Introduction
This document describes the script language used by the OOMF kernel the
engine behind the EO strategy in products such as Aspen Plus. These script
commands may be typed at the command line or entered into script files or
input forms.
The script language is very effective for tasks such as:
Key Strokes
Description
HOME
END
BACKSPACE
DEL
RETURN
LEFT ARROW
RIGHT ARROW
UP ARROW
DOWN ARROW
Defining Scripts
Scripts may be defined in the following ways:
An external file that may be created with a standard text editor. The
extension of the file should be EBS.
Executing Scripts
Scripts may be executed in a number of ways:
By manually executing the script from the command line or from another
script. This may be done with the INVOKE command.
This method is executed when the block is created and is available for
all blocks except hierarchies.
PRESOLVE
POSTSOLVE
The script that is assigned as the block method may be an external file.
You may also manually execute a blocks script method with the INVOKE
command.
More on invoking scripts may be found in Invoke Commands.
Input in EBS files or the command line may start in any column and go to
column 256.
The input is, in general, not case sensitive. (One exception is the format
string for formatted printing.)
Lines may be continued by using the backslash character (\) as the last
character of the line.
Single line comments are denoted by a double slash (//). When script
commands are entered in the INP file a semicolon (;) may be used.
Multi-line comments begin with slash asterisk (/*) and end with asterisk
slash (*/).
Use double quotation marks (") to enclose strings containing spaces and
to preserve upper and lower case.
Related Documentation
Title
Content
Technical Support
AspenTech customers with a valid license and software maintenance
agreement can register to access the online AspenTech Support Center at:
http://support.aspentech.com
This Web support site allows you to:
Search for tech tips, solutions and frequently asked questions (FAQs)
Send suggestions
Technical advisories
Customer support is also available by phone, fax, and email. The most up-todate contact information is available at the AspenTech Support Center at
http://support.aspentech.com.
1 Script Commands
Command Summary
Below is a list of the script commands. This list may be displayed from the
kernel with the HELP command.
EO Commands
Command
Purpose
ADD ALIASES
ADD BLOCKS
ADD CONNECTIONS
ADD MEASUREMENTS
ADD PORT
ADD SIMULATION
Append the block data from a specified binary file to the current
simulation
ADD SPECIFICATION
CONNECTIONS
ALIAS
ANALYZE DOF
ANALYZE EQUATIONS
ANALYZE JACOBIAN
ANALYZE SPARSITY
ANALYZE VARIABLES
APPEND BLOCKS
Append all the blocks from a specified XML file to the current
simulation
BLOCK SCRIPTS
BLOCKS
CHANGE FLUSHING
CHANGE SCOPE
1 Script Commands
parsity patterns.
Command
Purpose
CHECK CONNECTIONS
Analyze all connections and connection groups. Report status and any
inconsistencies.
CHECK MEASUREMENT
COMPARE VARFILE
CONDITIONAL EQUATION
CONNECTION
DELETE BLOCKS
DELETE PORTS
DELETE SNAPSHOT
DELETE TASK
DERIVATIVE
Show the derivative method for all blocks in the current scope
DISABLE CONNECTION
DISABLE MEASUREMENT
DISABLE SPECIFICATION
GROUPS
ECHO
Print a value
ENABLE CONNECTION
ENABLE MEASUREMENT
ENABLE SPECIFICATION
GROUPS
EVALUATE EQUATIONS
EVALUATE JACOBIAN
EVALUATE OBJECTIVE
DERIVATIVE
EVALUATE RESIDUALS
EXCLUDE BLOCKS
Exclude a block
EXPOSE PORT
Expose a port contained within the current scope to the block which
FIND BLOCK
FIX STREAMS
FLUSH
FREE STREAMS
HOMOTOPY PARAMETERS
Show or Set the list of variables, the appropriate target values, and, if
necessary, the appropriate initial values that should be used as
parameters, parameter targets, and parameter initial values by the
parsity solver.
IDENTIFY LIBRARY
INACTIVATE VARIABLE
PROFILE
10
1 Script Commands
Command
Purpose
INCLUDE BLOCKS
INITIALIZE BLOCKS
INITIALIZE PORT
INVOKE
LINEAR OBJECTIVE
LOAD BLOCK
Load the block in a specified binary file into the current simulation
LOAD LIBRARY
LOAD SNAPSHOT
MEASUREMENTS
OPEN SIMULATION
OPENSOLVER LOAD
OPENSOLVER UNLOAD
PAUSE
POP SCOPE
PRINT ACTIVE_BOUNDS
Print a report for variables showing shadow prices and active bounds
Print a report for variables showing SSI shadow prices and active
bounds
PRINT ALIASES
Print all blocks in the current scope including those in child containers
PRINT BLOCK PORTS DETAILED Print detailed port information for a specified list of blocks
PRINT BLOCK PORTS
PRINT BLOCK STATISTICS FULL Print block statistics (with indices) for all or listed blocks
PRINT BLOCK STATISTICS
PRINT CONNECTION VARIABLES Print the connection name that references the specified variables
PRINT CONNECTIONS DETAILED Print a detailed report for each connection named in the supplied list.
PRINT CONNECTIONS
Print all blocks in the current scope and child containers that are
currently excluded
PRINT FIXED
PRINT FLUSHING
PRINT FORMATTED
1 Script Commands
11
Command
Purpose
PRINT INACTIVE CONNECTIONS Print any inactive connection whose name matches a list of name
expressions.
PRINT INACTIVE SPECIFICATION Print any inactive specification group whose name matches a list of
GROUPS
name expressions.
PRINT INCLUDED BLOCKS
Print all blocks in the current scope and child containers that are
currently included
PRINT INCOMPLETE
CONNECTIONS
PRINT JACOBIAN
PRINT MEASUREMENTS
PRINT MEASUREMENTS
VARIABLES
PRINT OBJECTIVE
PRINT QUERY
PRINT RESIDUALS
PRINT SCOPE
PRINT SOLVERS
PRINT SPECIFICATIONS
PRINT SUMMARY
PRINT TIMER
PRINT VARIABLES
PRINT VARIABLES
CONNECTIONS
12
1 Script Commands
Command
Purpose
PUSH SCOPE
READ BLOCK
Load a block from the specified XML file into the current simulation
READ SIMULATION
READ VARFILE
REINITIALIZE
REMOVE CONNECTIONS
REMOVE SPECIFICATION
GROUPS
REPORT BLOCKS
REPORT OBJECTIVE
RESET SCOPE
RESET VARIABLES
Reset the variable values to their state before the solve command
was issued
RESTART TIMER
RESTORE VARIABLES
RUN
SAVE BLOCK
SAVE SIMULATION
SAVE VARIABLES
SAVE SNAPSHOT
SCOPE INVOKE
SENSITIVITY
SHOW DECOMPOSITION
SHOW TASKS
SNAPSHOTS
Print the list of snapshots in the current scope to the current output
device
SOLVE
SOLVER SETTINGS
SOLVER
START TIMER
STEP
1 Script Commands
13
Command
Purpose
STOP
STOP TIMER
SWAP PROPERTY
SYMBOLIC OBJECTIVE
SYSTEM
Changes the status of any connections and spec groups that cross the
current scope boundary
UNLOAD LIBRARY
UPDATE VARIABLES
WRITE BLOCK
WRITE SIMULATION
WRITE SNAPSHOT
WRITE VARFILE
See Also
Aspen Plus Extensions - Command Summary
Aspen Custom Modeler Extensions - Adding an ACM Model to OOMF
Aspen HYSYS Refining Extensions - Command Summary
For these commands, arguments should be separated by commas. Many of
these commands support output redirection by adding TO followed by an
output device specification. Additional help may be available for these
commands by typing help followed by the commands full name.
Commands above that support regular expressions can understand GLOB or
REGEXP style regular expressions. Commands listed below (except
assignment) do not support GLOB.
Additional Commands
ADD UOM {uom1} = (multiplier * ){uom2} ([+ | -] offset)
BREAK
CONTINUE
EXIT
IF, FOR, and WHILE blocks
HELP [command name]
PRINT uom(s) [ list_of_uom_specs | for list_of_physical_types]
QUIT
SET paramname = expression
LOCAL paramname [= expression] [, paramname ]
RETURN [expression]
14
1 Script Commands
Assignments
variableId[.lower | .upper | .step | .scale | .bound | .spec | .sbweight] = expression
variableId(.uom) = { uom }
variableId(.spec) = const | calc | meas | param | optim | recon | indep(endent) | fixed
| free
variableId(.bound) = hard | relaxed | soft
blockId(.deriv_method) = analytic | numeric | update_numeric | update_analytic
blockId(.nlratiodev) = real
blockId(.zerotol) = real
blockId(.move) = TRUE | FALSE
blockId(.moveamount) = real
blockId(.pert) = real
blockId(.included) = expression
blockId.streamId.str.spec = const | calc | meas | param | optim | recon |
indep(endent) | fixed | free
blockId.streamId.str.phase = unknown | liquid | vapor | vl | vlf
objId.direction = MAXIMIZE | MINIMIZE
objId.scale = expression
objId.uom = { uom }
equationId(.included) = TRUE | FALSE |
parsit expression
regexp = expression
<>
Indicates that you must choose one of the keywords within. For example,
list_of_< parsit variableId> indicates you must enter a list of alias
names or variable names.
variableId
Name of a variable.
aliasId
Name of a alias.
equationId
Name of an equation.
uom
Units of measure. When you enter the units of measure for a variable,
you must place it within braces, { }.
list_of_
regex
expression
condition
Notes
expression may be any of:
1 Script Commands
number
15
regexp
identifier
&identifier
variable_attribute
expression + expression
expression expression
expression * expression
expression / expression
expression ^ expression
expression OR expression
expression . expression
( expression )
op ( expression )
expression
NOT expression
integer
real
integer { uom }
real { uom }
integer { $ / uom }
real { $ / uom }
real {si}
real {ssi}
real {*}
where uom is a valid unit (see section on Unit of Measure and Physical Types)
num_or_param is one of:
number
&identifier
relop is any of these relational operators: < > = <> <= >=
vmaskElem is any of:
name
physical_type
lower
value
upper
scale
units
spec
step
sbweight
shadow
active
vmask is [ list_of_vmaskElem ]
op is any of:
16
1 Script Commands
abs
loge
log10
cos
sin
tan
exp
defined
head
tail
string2id
id2string
OpenFile
OpenBinary
DeviceInfo
OpenTee
ToLower
ToUpper
BlockVars
QueryVars
Int
Val
TypeOf
AliasesByVar
ConnectionsByVar
MeasurementsByVar
SpecGroupsByVar
ActiveConn
InActiveConn
ActiveSpecGroup
InActiveSpecGroup
ActiveMeas
InActiveMeas
BlockAttrs
regexp is % regular_expression %
You can use echo to examine the value of block attributes, equation residuals
and attributes, and variable values and attributes. For example:
echo blkname.deriv_method
echo variable_name.spec
blkname.model
blkname.sparsity_file
blkname.sparsity_type
blkname.sparsity_gen
1 Script Commands
17
Description
BLOCKS
BUILD_DATE
BUILD_NUMBER
CHECK_UOM
CONVERGED
DATE
DEFAULT_FLUSHING
DIAG_LEVEL
DYN_RUN_TO
DYN_INTERVAL
FLANGE_PHASE
HISTORY_DEVICE
JOURNAL_DEVICE
JOURNAL_LEVEL
MAJOR_VERSION
MEAS_CAPACITY
MEAS_DESC_WIDTH
18
MEAS_UOM_WIDTH
MINOR_VERSION
MODE
Calculation mode
(Legal values are: SIM, PAR, REC, OPT; default: SIM)
NAME_WIDTH
NUMBER_WIDTH
OBJECTIVE
ONLINE
P_AMB
PAGE_WIDTH
PRINT_VAR_MASK
PROBID
PROBNAME
PROMPT
READ_VARFILE_MASK
RELAX_TOL
Relaxed-bound tolerance
REPORT_DEVICE
1 Script Commands
Parameter
Description
REUSE_SOLVER
RUN_MODE
Run mode for a simulation. The options are SS (for steadystate simulations), INIT (for initialization simulations) and DYN
(for dynamic simulations). The default value is SS. (The INIT
and DYN run modes are relevant only to dynamic models.)
SOFT_BOUND
STEP_BOUND
UOM_WIDTH
1 Script Commands
19
20
1 Script Commands
Input Language
command TO device
21
NOWHERE
"file"
OPENFILE
Redirects output to the specified ASCII file. To simply open the file,
enter:
OPENFILE( "file" )
The name of the file is enclosed in double quotation marks. To open
the file with an option, enter:
OPENFILE( [ "file", option ] )
Note the use of the brackets. option is one of the following:
READ
Redirects output to the specified binary file. To simply open the file,
enter:
OPENBINARY( "file" )
The name of the file is enclosed in double quotation marks. To open
the file with an option, enter:
OPENBINARY( [ "file", option ] )
Note the use of the brackets. option is one of the following:
BINARY_READ Open file for binary reading only.
BINARY_WRITE Open file for binary writing only.
BINARY_APPEND Open file for binary writing. Any data written will
be appended to the end of the file.
OPENTEE
22
Input Language
SET REPORT_DEVICE = device
NOWHERE
OPENFILE
OPENTEE
See the section Redirecting the Output of a Command for details on these
options.
Input Language
SET HISTORY_DEVICE = device
NOWHERE
OPENFILE
OPENTEE
See the section Redirecting the Output of a Command for details on these
options.
23
Input Language
FLUSH
PRINT FLUSHING device
CHANGE FLUSHING device, level
Device to flush.
level
Flushing level. This determines how frequently the program will force any
buffered data to be written to the output device. The default is set to script
parameter DEFAULT_FLUSHING.
NEVER
Never flush
PER_LINE
PER_WRITE
Journaling
A parameter is available to create a journal of all the commands you type at
the console or are invoked in script files. This parameter is called
JOURNAL_DEVICE and may be displayed with the ECHO command and
changed with the SET command. This output can be directed to a file and/or
the terminal. You turn it off by directing it NOWHERE.
A parameter is available to control the level of invoke commands that will be
journaled. This parameter is called JOURNAL_LEVEL and may be displayed
with the ECHO command and changed with the SET command. A value of 0
will journal only the topmost level of commands. A value of 1 will journal the
top two levels of commands. A value of 99999 will journal all levels.
The journal file starts with a comment (using //) indicating the build number
and build date of the executable being run followed by the current date, time
and journal status. Each command executed is added to the journal file
followed by a time-stamp comment. The journal file is designed so that it may
be run like any other script file, i.e. with the INVOKE command.
24
Input Language
SET JOURNAL_DEVICE = device
SET JOURNAL_LEVEL = level
level
Journaling level. This controls the level of invoke commands that will be
journaled. A value of 0 will journal only the topmost level of commands. A
value of 1 will journal the top two levels of commands. A value of 99999 will
journal all levels.
NOWHERE
OPENFILE
OPENTEE
See the section Redirecting the Output of a Command for details on these
options.
Input Language
ECHO &REPORT_DEVICE
ECHO &HISTORY_DEVICE
ECHO &JOURNAL_DEVICE
25
Script Parameters
Script parameters are quantities that are local to the scripting language. You
may define your own script parameters to perform a variety of tasks:
Names must start with a letter (A-Z) and only contain letters, numbers,
and underscores (A-Z 0-9 _ ).
All names must begin with a letter (A-Z), digit (0-9) or a dollar sign ($).
A-Z 0-9 $ : + - _ .
The following characters can appear in a name, but when they do, the
whole name must be delimited by single quotation marks:
(blank) ; / = * , () [] {} <>
The ampersand (&), percent sign (%) and the pound sign (#) are not
valid characters.
26
Description
BLOCKS
BUILD_DATE
BUILD_NUMBER
CONVERGED
CHECK_UOM
Indicates if the user is required to enter the units of measure for every value
entered (default = FALSE)
DATE
The date and time of day as a string. (read only) The format is
DAY, MON DATE, YEAR, HRS:MIN.
DEFAULT_FLUSHING
Default flushing level for new files. NEVER is recommended for VMS
systems.
DIAG_LEVEL
NEVER
Never flush
PER_LINE
PER_WRITE
DYN_INTERVAL
DYN_RUN_TO
FLANGE_PHASE
Used as a default phase for a stream connection from a mole flow stream to
a mole fraction stream. This determines the type of flash to be performed:
HISTORY_DEVICE
VL
VLF
Mixed vapor, liquid and free water phases (flash with free
water required)
UNKNOWN
NOWHERE
OPENFILE
OPENTEE
27
Script Parameter
Description
JOURNAL_DEVICE
NOWHERE
OPENFILE
OPENTEE
How many levels of invoke commands are journaled. A value of 0 will journal
only the topmost level of commands. A value of 1 will journal the top two
levels of commands. A value of 99999 will journal all levels.
MAJOR_VERSION
MEAS_CAPACITY
MINOR_VERSION
MODE
NAME_WIDTH
NUMBER_WIDTH
OBJECTIVE
The name of the objective function to be used during the solution (default =
NONE)
ONLINE
P_AMB
PAGE_WIDTH
Width of the page for some output commands, such as WRITE VARFILE,
and WRITE VARFILE EXCEPT (default = 131)
PRINT_VAR_MASK
Default variable mask used for the PRINT VARIABLES, PRINT FIXED,
PRINT QUERY, PRINT ALIAS, and PRINT ACTIVE_BOUNDS commands
(default = [NAME, LOWER, VALUE, UPPER, UNITS, SPEC]).
PROBID
PROBNAME
PROMPT
READ_VARFILE_MASK
RELAX_TOL
REPORT_DEVICE
Destination where output from the PRINT and REPORT commands are to
be directed. Use ECHO &REPORT_DEVICE to examine the current value.
device defaults to TERMINAL but may be any of the following:
TERMINAL
NOWHERE
OPENFILE
OPENTEE
28
Script Parameter
Description
RUN_MODE
SCRIPT_PATH
SOFT_BOUND
STEP_BOUND
UOM_WIDTH
WRITE_VARFILE_MASK
Default variable mask used for the WRITE VARFILE command (default =
[NAME, UNITS, VALUE, INIT, CHANGE, LOWER, UPPER, STEP,
BOUND, SPEC, SSPEC, SCALE, SBWEIGHT, RLOWER, RUPPER])
Input Language
SET parameter = expression
LOCAL parameter = expression
expression
29
Input Language
UNSET parameter
30
31
Invoke Commands
These commands allow you to call, or invoke, other scripts. These may be
scripts that have been entered in external files.
Input Language
INVOKE file, arg1, arg2,
arg1,
arg2
Optional list of arguments passed to the script file. This may be referenced in
the invoked script as &ARG1, &ARG2 etc. These are local script parameters
and thus only available within the invoked script. The total number of
arguments passed to the script file is available as &ARGC. The value returned
to the invoking script is available as &RET_VALUE.
Input Language
INVOKE blockid, method, arg1, arg2,
32
blockid
method
arg1,
arg2
Optional list of arguments passed to the script. This may be referenced in the
invoked script as &ARG1, &ARG2 etc. These are local script parameters and
thus only available within the invoked script. The total number of arguments
passed to the script file is available as &ARGC. The value returned to the
invoking script is available as &RET_VALUE.
Input Language
SCOPE INVOKE blockid, method
Name of the scope to execute. SELF refers to the name of the current scope.
method
See Also
Aspen Plus Extensions - Invoke Commands
Script Arguments
Scripts may have arguments passed to them and may return a single
argument. The arguments are passed with the INVOKE command:
INVOKE file, arg1, arg2,
These may be referenced in the invoked script as &ARG1, &ARG2 etc. These
are local script parameters and thus only available within the invoked script.
The total number of arguments passed to the script file is available as
&ARGC.
The script file may define a return value using the RETURN command:
RETURN value
This command terminates execution of the script.
The invoking script may reference the returned value as &RET_VALUE. This
is a local script parameter.
33
PLANT
S1
B1
B2
S2
B3
B6
S3
B4
B5
IF-THEN-ELSE Command
This command can be used to define conditionals to control program
execution.
Input Language
IF ( condition ) THEN
ELSEIF ( condition ) THEN
ELSE
ENDIF
34
FOR-DO Command
This command can be used to define an execution loop.
Input Language
FOR index IN list DO
BREAK
CONTINUE
ENDFOR
Index in the defined list. If the index is defined before the FOR-DO loop
executes, its original value will be restored after the loop terminates. If
the index is undefined before the loop executes, it will be undefined after
the loop terminates.
list
List of quantities that define the FOR-DO loop. The list is separated by
commas and enclosed in brackets.
BREAK
CONTINUE
35
WHILE-DO Command
This command can be used to define an execution loop.
Input Language
WHILE ( condition ) DO
BREAK
CONTINUE
ENDWHILE
BREAK
CONTINUE
36
ENDIF
This is an example of a FOR-DO loop:
FOR I IN [1, 2, 4] DO
ECHO &I
ENDFOR
This will cause the following lines to be output to the report device:
1
2
4
A more pertinent example would be to define a script parameter that holds
certain blocks in a problem and then use the list in a FOR-DO loop:
SET BLOCKLIST = [ F,
C2S,
CIN,
CDEF,
CVAP,
CONDUA
FOR I IN &BLOCKLIST DO
REPORT BLOCK &I
ENDFOR
\
\
\
\
\
]
This will cause each block to be reported in the ordered set in the script
parameter.
A more complex example would be to create a list of script parameters and to
refer to them in a FOR-DO loop:
SET
SET
SET
FOR
TEST1 = 100
TEST2 = 200
VARNAME = [ TEST1, TEST2 ]
I IN &VARNAME DO
ECHO &&I
ENDFOR
Note the use of &&I to indicate a double parameter reference. This will result
in the following output:
100
200
37
Input Language
expression
(expression) # {uom}
Mathematical Functions:
38
Addition
Subtraction
Multiplication
Division
Power
ABS
Absolute value
LOGE
Natural logarithm
LOG10
Logarithm
COS
Cosine
SIN
Sine
TAN
Tangent
EXP
Exponentiation
SQRT
Square root
INT
Nearest integer
String Functions:
.
String concatenation
STRING2ID
Converts string to an ID
ID2STRING
Converts ID to a string
TOUPPER
TOLOWER
LENGTH
Length of string
SUBSTR
Source string.
Source string.
substring
Source string.
substring
Substring to insert.
Source string.
39
Relational Functions:
<
Less than
<=
Equal to
<>
Not equal to
>
Greater than
>=
Logical Functions:
AND
Logical AND
OR
Logical OR
NOT
Logical NOT
File Functions:
OPENFILE
Redirects output to the specified ASCII file. To simply open the file,
enter:
OPENFILE( "file" )
The name of the file is enclosed in double quotation marks. To open
the file with an option, enter:
OPENFILE( [ "file", option ] )
Note the use of the brackets. option is one of the following:
OPENBINARY
READ
WRITE
APPEND
Redirects output to the specified binary file. To simply open the file,
enter:
OPENBINARY( "file" )
The name of the file is enclosed in double quotation marks. To open
the file with an option, enter:
OPENBINARY( [ "file", option ] )
Note the use of the brackets. option is one of the following:
OPENTEE
BINARY_READ
BINARY_WRITE
BINARY_APPEND
DEVICEINFO
40
List Functions:
.
ELEM
HEAD
NUM
REPLELEM
TAIL
Query Functions:
BLOCKVARS
BLOCKATTRS
QUERYVARS
ALIASBYVAR
CONNECTIONSBYVAR
MEASUREMENTSBYVAR
SPECGROUPSBYVAR
Miscellaneous Functions:
VAL
Returns the value of the quantity, rather than a reference to the ID.
TYPEOF
DEFINED
Logical function indicating if the parameter argument has been given value.
41
42
43
44
45
46
Upper \n"
----- \n"
Wildcards
There are two wildcard capabilities in OOMF: glob-style and regular
expression matching. The former is the simplest and meets most user needs.
The latter is more complex but is more powerful.
Glob-Style Wildcards
Glob-style wildcards are a simple way to refer to a group of objects so you
can access them in one statement, rather than having to repeat a similar
command again. Not all commands in the script language support glob
wildcards.
Matches what appears to the left of the bar or the right of the bar. This
operator has the lowest preference.
()
47
[]
Used to define a set of characters. This will match a single character in the
brackets. The range [ab] will match a single a or b. The range [^ab] will
match any character other than a or b. You can indicate a group of characters
using the hyphen. [a-z] will match any character in the alphabet.
There is an implied wildcard at the beginning and end of the string in percent
signs. The ^ and $ special characters allow you to override this implied
wildcard.
When using regular expression to match variable names, you must include
the entire variable name within the percent signs. That is, some parts of the
variable name cannot lie outside the percent signs. The attribute you are
changing may lie outside the percent signs.
Examples of Wildcards
To enter a lower limit of zero for all flows in the flowsheet with glob style
wildcards enter:
*.FLOW.LOWER = 0.0 {KMOL/HR}
To enter a lower limit of zero for all the flows in block C2S:
C2S.*.FLOW.LOWER = 0.0 {KMOL/HR}
Consider the following regular expression:
%FLOW\.LOWER% = 0.0
In simple wildcard jargon, this is equivalent to
*FLOW.LOWER* = 0.0
This is because of the implied wildcard of the percent signs. This would place
lower bounds on all variables that have FLOW in them, i.e., both mass and
molar flows. Note the use of the \ to treat the . as a literal. We do not enter
the units of measure so that we apply the zero as Kmol/Hr for mole flows and
Kg/Hr for mass flows.
If we write
%\.FLOW\.LOWER% = 0.0 {KMOL/HR}
This is equivalent to
*.FLOW.LOWER* = 0.0 {KMOL/HR}
In this case the \ makes the . a literal character. Thus, we only change mole
flows and we can enter the units if we want to. Entering
%.FLOW\.LOWER% = 0.0 {KMOL/HR}
is equivalent to
%FLOW\.LOWER% = 0.0 {KMOL/HR}
because the . is a single-character wildcard and the beginning of the string is
a multicharacter wildcard.
If we wanted to access only stream component molar flows, we enter:
%STR\..*\.FLOW\.LOWER% = 0.0 {KMOL/HR}
This is equivalent to:
48
General Commands
These general commands include a powerful help facility, a timer for tracking
execution times and other useful functions.
Getting Help
This command provides on-line help.
Input Language
HELP command
49
Input Language
QUIT
EXIT
Input Language
SYSTEM " command "
Timer
A timer that tracks CPU usage is available.
Input Language
START TIMER
STOP TIMER
RESTART TIMER
PRINT TIMER
50
START TIMER
STOP TIMER
RESTART TIMER
PRINT TIMER
Models exported from Aspen Custom Modeler may be loaded into OOMF
using the OOMF loadable DLL named acmexp.
Aspen Plus equation oriented models may be loaded into OOMF using the
OOMF loadable DLLs named rtoblk and pmlbridge.
Aspen HYSYS Refining reactor models may be loaded into OOMF using
OOMF loadable DLLs named usrdmo and refpmlbridge.
The example model called pltcon that is delivered with OOMF may be
loaded into OOMF using the OOMF loadable DLL named pltcon.
Input Language
IDENTIFY LIBRARY dll_name
LOAD LIBRARY dll_name
UNLOAD LIBRARY dll_name
LOAD LIBRARY
UNLOAD LIBRARY
51
52
3 Hierarchies, Blocks,
Variables and Equations
Hierarchies
Hierarchies are blocks that are used to contain parts of a flowsheet. This
allows you to organize your flowsheet into manageable sections that may be
solved separately.
See Also
Aspen Plus Extensions - Hierarchies
53
54
Hierarchy Input
Hierarchies have sets of input that are similar to what can be defined for an
entire flowsheet.
In standalone OOMF the inputs include:
Streams.
Blocks.
The type of input that may be entered for an EO configuration item is limited
by the scope.
See Also
Aspen Plus Extensions - Hierarchies
Finding a Block
At the top of the tree, when the scope is the CONTROLLING KERNEL, the
entire problem is visible to the kernel. At this level, hierarchies appear as
single blocks.
When you move down the tree into a hierarchy by pushing the scope, the
scope becomes the name of the hierarchy. At this scope, all the blocks within
the hierarchy, the user connections and the measurements become visible.
Understanding how the scope works is very important. Consider the example:
55
Flowsheet Level
S1
B1
B2
S2
B3
B6
S3
B4
B5
56
Only after each hierarchy is completely built is execution passed to the next
hierarchy.
57
Input Language
PUSH SCOPE blockid
CHANGE SCOPE blockid
POP SCOPE
RESET SCOPE
PRINT SCOPE
Pushes the scope down the tree into the specified hierarchy.
CHANGE SCOPE Resets the scope and then pushes the scope down the tree into the
specified hierarchy.
POP SCOPE
RESET SCOPE
PRINT SCOPE
Input Language
PRINT BLOCK HIERARCHY
Finding a Block
This command is used to find a block within a flowsheet. It searches within
the current scope and, if the block is not found, continues the search from the
global scope.
Input Language
FIND BLOCK blockid
58
Solving at a Scope
A scope may be solved separately from the rest of the flowsheet. This may be
done by changing the scope to the desired level, which may be done through
the products user interface or with the PUSH SCOPE command. The scope
may then be solved either through the products user interface or with the
SOLVE command.
A complication arises when connections and specification groups cross the
scope boundary. When this occurs, the scope may be non-square. (You may
use the ANALYZE DOF command to check.) Specification Management
automatically inactivates these objects when the SOLVE is executed. This
keeps the problem well defined at any scope level. It is therefore very
straightforward to solve your problem at any scope.
The inactivation of these objects occurs at the instant the SOLVE command is
issued and reactivated immediately afterwards. Therefore, when you examine
your reduced scope problem, what you see is not what the solver is seeing.
You may use the TOGGLE SOLVE SCOPE command to inactivate any
connections and specification groups that cross the scope boundary. If you
issue the command again, the connections and specification groups are reactivated.
Input Language
TOGGLE SOLVE SCOPE
Examples of Hierarchy
The following interactive session shows a flowsheet with two hierarchies
called C2HIER and C3HIER and a normal block. First, the block statistics are
printed and the hierarchies appear as any other block. When the scope is
pushed into one of the hierarchies, the blocks within the hierarchy appear.
Within the hierarchy the problem is non-square due to streams, connections
and specification groups that cross the hierarchy boundary. When the
TOGGLE SOLVE SCOPE command is issued the problem becomes square.
The SOLVE command solves the reduced scope problem.
EO> PRINT BLOCK STATISTICS
---Block-- -Nvar- -Neqn- -NfixC2HIER
1369
1324
24
C3HIER
79
64
7
CONDUA
12
5
3
---------- ------ ------ -----Total
1460
1393
34
EO> PUSH SCOPE C3HIER
EO> PRINT BLOCK STATISTICS
---Block-- -Nvar- -Neqn- -NfixCVAP
41
33
3
CIN
35
30
3
C3MEAS
3
1
1
---------- ------ ------ -----Total
79
64
7
59
Residual
Objective
Objective
Overall
Model
Convergence Convergence Function Nonlinearity Nonlinearity Worst
Iteration
Function
Function
Value
Ratio
Ratio
Model
--------- ----------- ----------- ---------- ------------ ------------ ------0
2.834D-01
0.000D+00 0.000D+00
1.000D+00
1.000D+00 CVAP
1
4.147D-06
0.000D+00 0.000D+00
1.000D+00
1.000D+00 CVAP
2
0.000D+00
0.000D+00 0.000D+00
Successful solution.
Time
========
MODEL computations
DMO computations
Miscellaneous
-------------------------------Total Optimization Time
0.02 secs
0.00 secs
0.14 secs
--------0.16 secs
Percent
=======
12.50 %
0.00 %
87.50 %
------100.00 %
Problem converged
EO> ANALYZE DOF
Problem is square
EO> TOGGLE SOLVE SCOPE
EO> ANALYZE DOF
Problem has 1 degrees of freedom
EO> RESET SCOPE
EO> ANALYZE DOF
Problem is square
EO>
60
Block Commands
The block commands are used to control the blocks that are to be included in
the OOMF solution.
Listing Blocks
The BLOCKS command is used to show the list of instantiated blocks in the
current scope. This command does not list blocks in child containers.
Input Language
BLOCKS
The PRINT ALL BLOCKS command is used to list all the blocks in the current
scope, including child containers. The blocks are listed by their full qualified
names.
Input Language
PRINT ALL BLOCKS
The PRINT EXCLUDED BLOCKS command is used to list all blocks in the
current scope, including child containers, that are currently excluded. The
blocks are listed by their full qualified names.
Input Language
PRINT EXCLUDED BLOCKS
The PRINT INCLUDED BLOCKS command is used to list all blocks in the
current scope, including child containers, that are currently included. The
blocks are listed by their full qualified names.
Input Language
PRINT INCLUDED BLOCKS
Excluding Blocks
These commands can be used to exclude blocks from the problem. Excluding
a block removes all its equations and variables from the flowsheet.
When a block is excluded, Spec Management automatically reprocesses all the
Connections and Spec Groups to ensure that the problem remains square.
61
Connections and Spec Groups that contain references to the excluded block
become Inactive. (The Status on the GUI is not updated until an Incremental
Build or Solve is performed.) Variables that are connected from an excluded
block return to their pre-connected specifications, usually Constant.
When a block is excluded, it still appears in the list of blocks. If you display
the block with PRINT BLOCK STATISTICS, the block name will appear in
parentheses. Equation residuals and Jacobian values are not calculated for
excluded blocks.
Input Language
EXCLUDE BLOCKS block_list
Including Blocks
This command can be used to include blocks that have been previously
excluded. This procedure works in a similar manner to the EXCLUDE
BLOCKS command (see previous section).
Input Language
INCLUDE BLOCKS block_list
Input Language
BLOCK SCRIPTS block_list
62
Input Language
PRINT BLOCK CONVERGENCE block_list
Input Language
PRINT BLOCK STATISTICS block_list
PRINT BLOCK STATISTICS FULL block_list
PRINT BLOCK STATISTICS FULL also includes the starting indices of the
variables, equations and non-zeroes for each block. A description of each
column heading follows:
Column
Description
Block
Nvar
Neqn
Number of equations.
Nfix
Nexcld
Ndof
NfreeI
Nnz
Nnz%
63
Input Language
blockid.attribute = value
attribute
Attribute to be changed.
value
Block Attributes
INCLUDED
NLRATIODEV
DERIV_METHODDerivative method.
PERT
ANALYTIC
NUMERIC
ZEROTOL
MOVE
MOVEAMOUNT Amount to move variables with zero value during numeric sparsity
detection. (default = 0.01)
For a list the block attributes that are supported by the exported Aspen
Custom Modeler models but not the base OOMF models attributes, see ACM
Block Attributes
Input Language
PRINT BLOCK ATTRIBUTES block_list
64
Input Language
PRINT BLOCK ATTRIBUTES DETAILED block_list
Input Language
PRINT BLOCK PARAMETERS block_list
65
66
Variable Commands
These commands may be used to change and print variable attributes.
Variable Attributes
The following table shows the variable attributes along with allowable values.
Attribute
Description
NAME
Name.
VALUE
INITIAL
Initial value.
CHANGE
LOWER
UPPER
STEP
BOUND
Bound type:
HARD Hard bound.
RELAXED
Relaxed bound.
SCALE
Scale factor.
INTSCALE
RLOWER
RUPPER
PHYSICAL_TYPE
UNITS
SPEC
SSPEC
SHADOW_PRICE
ACTIVE_BOUND
67
Attribute
Description
QUALITY
OVERRIDE
overridden.
THRESHOLD
Threshold value.
RAMPED
CONN_TYPE
Connection type. See the section Connection Types for the list
of supported connection types.
SIM
PAR
REC
OPT
CONST
Fixed
Fixed
Fixed
Fixed
CALC
Free
Free
Free
Free
MEAS
Free
Fixed
Fixed
Free
PARAM
Fixed
Free
Free
Fixed
OPTIM
Fixed
Fixed
Fixed
DOF
RECON
Fixed
Fixed
DOF
Fixed
INDEP
Fixed
Fixed
DOF
DOF
Input Language
variableid.attribute = value
aliasid.attribute = value
...
68
VALUE
INITIAL
CHANGE
LOWER
UPPER
STEP
BOUND
SBWEIGHT
SPEC
UNITS
SCALE
PHYSICAL_TYPE
QUALITY
BASEUOM
When a value is entered, you may also enter the units of measure enclosed in
braces, {}. If no units of measure are entered, the value is assumed to be in
the units of measure of the variable. This functionality can be controlled by
the script parameter CHECK_UOM. When CHECK_UOM is FALSE (the
default), the units of measure may be omitted. When CHECK_UOM is TRUE,
the units of measure must be entered with every value.
Printing Variables
Prints to the report device selected information about the listed variables.
The set of attributes to print for each variable is determined by the variable
masking, which is a list of variable attributes enclosed by parentheses.
For PRINT VARIABLES, values are given in the variables units of measure;
for PRINT VARIABLES SSI, values are given in scaled SI units.
The list of variables can be specified by variable index, variable name or a list
of block names.
The format of the output is affected by script parameter NAME_WIDTH.
Input Language
PRINT VARIABLES [ vmask ], list
PRINT VARIABLES SSI [ vmask ], list
list
INITIAL
CHANGE
LOWER
UPPER
STEP
BOUND
SBWEIGHT
SPEC
UNITS
SCALE
PHYSICAL_TYPE
QUALITY
BASEUOM
SHADOW_PRICE
ACTIVE_BOUND
NAME
69
The set of attributes to print for each variable is determined by the variable
masking, which is a list of variable attributes enclosed by parentheses.
Numerical values are given in the variables units of measure.
The list of variables can be specified by variable index, variable name or a list
of block names.
The format of the output is affected by script parameters NAME_WIDTH and
UOM_WIDTH.
Input Language
PRINT FIXED [ vmask ], list
Optional list of variable attributes to print. This list is separated by spaces and
enclosed in brackets.
If no list is given, then the script parameter PRINT_VAR_MASK is used as
the list of attributes to print. This default list includes the name, lower, value,
upper, units and specification.
list
INITIAL
CHANGE
LOWER
UPPER
STEP
BOUND
SBWEIGHT
SPEC
UNITS
SCALE
PHYSICAL_TYPE
QUALITY
BASEUOM
SHADOW_PRICE
ACTIVE_BOUND
NAME
Input Language
PRINT SPECIFICATIONS block_list
70
Input Language
PRINT ACTIVE_BOUNDS [ vmask ], list
PRINT ACTIVE_BOUNDS SSI [ vmask ], list
list
INITIAL
CHANGE
LOWER
UPPER
STEP
BOUND
SBWEIGHT
SPEC
UNITS
SCALE
PHYSICAL_TYPE
QUALITY
BASEUOM
SHADOW_PRICE
ACTIVE_BOUND
NAME
Input Language
PRINT LARGEST VARIABLE SHADOW_PRICES integer, list
71
list
Input Language
PRINT QUERY [ vmask ], block_list, query
block_list
A comma separated list of block names. If omitted, all blocks are queried.
query
INITIAL
CHANGE
LOWER
UPPER
STEP
BOUND
SBWEIGHT
SPEC
UNITS
SCALE
PHYSICAL_TYPE
QUALITY
BASEUOM
SHADOW_PRICE
ACTIVE_BOUND
NAME
72
INITIAL
CHANGE
LOWER
UPPER
STEP
BOUND
SBWEIGHT
SPEC
UNITS
SCALE
PHYSICAL_TYPE
QUALITY
BASEUOM
SHADOW_PRICE
ACTIVE_BOUND
NAME
OR
Logical or operator
NOT
ISMODIFIED()
ISALIAS()
=
=
=
=
0.0001
0.00001
0.0002
INDEP
73
Alias Commands
Aliases are user-defined alternate names for variables. The alias may be used
to refer to a variable in other script language commands. This is useful to
avoid typing long variable names.
Printing Aliases
This command lists the alias definitions for the current scope.
Input Language
ALIAS
Input Language
PRINT ALIAS name [ vmask ]
74
vmask
These attributes can be used. (See the Variable Commands section for
descriptions.)
VALUE
INITIAL
CHANGE
LOWER
UPPER
STEP
BOUND
SBWEIGHT
SPEC
UNITS
SCALE
PHYSICAL_TYPE
QUALITY
BASEUOM
SHADOW_PRICE
ACTIVE_BOUND
Input Language
PRINT ALIAS VARIABLES var_list
75
Equation Commands
The equation commands are used to include or exclude equations from the
OOMF solution.
Excluding Equations
This command may be used to exclude, or remove, equations from the
problem. This may change the number of degrees of freedom, depending on
the variable specifications.
Input Language
equationid.INCLUDED = FALSE
Equation name.
Including Equations
This command may be used to include equations that have been previously
excluded.
Input Language
equationid.INCLUDED = TRUE
Equation name.
Evaluating Equations
Equations may be evaluated with either of the following commands. Equations
in excluded blocks are not evaluated.
Input Language
EVALUATE EQUATIONS
EVALUATE RESIDUALS
76
Printing Equations
Prints the listed equation names and attributes to the report device.
The list can be generated by block, equation index or equation name. If no
argument is given, all the problem equations are printed.
The residual equations are not evaluated by this command. To evaluate the
equations use EVALUATE RESIDUALS or EVALUATE EQUATIONS.
The width of the name field in the report may be controlled with script
parameter NAME_WIDTH.
Input Language
PRINT EQUATIONS list
PRINT RESIDUALS list
Input Language
PRINT LARGEST RESIDUALS integer, block_list
PRINT LARGEST EQUATIONS integer, block_list
block_list
Optional comma separated list of blocks. The largest residuals in each block
will be printed. If omitted, the largest residuals in the problem are printed.
77
Input Language
PRINT LARGEST RESIDUAL SHADOW_PRICES integer, block_list
PRINT LARGEST EQUATIONS SHADOW_PRICES integer, block_list
PRINT LARGEST RESIDUAL SCALED_SHADOW_PRICES integer,
block_list
PRINT LARGEST EQUATION SCALED_SHADOW_PRICES integer,
block_list
78
integer
block_list
Input Language
REMOVE SPECIFICATION GROUP spec_list
79
Input Language
DISABLE SPECIFICATION GROUP spec_list
Input Language
ENABLE SPECIFICATION GROUP spec_list
Input Language
PRINT SPECIFICATION GROUP spec_list
80
Input Language
PRINT INACTIVE SPECIFICATION GROUPS spec_list
Input Language
PRINT SPECIFCATION GROUP VARIABLES var_list
81
Stream Commands
These commands are used to change stream or port attributes such as the
specification and the phase.
Name.
Type.
Direction.
Phase.
Attached stream.
PRINT BLOCK PORTS DETAILED will list the above along with:
Number of variables.
Number of components.
Input Language
PRINT BLOCK PORTS block_list
PRINT BLOCK PORTS DETAILED block_list
Input Language
PRINT VARIABLES blockid.streamid.STR
82
blockid
Name of the block the stream is associated with. Note that a stream
connected between two blocks will have variables associated with it in both
blocks. A connection equation ensures that at the solution, these values will
be the same.
streamid
Input Language
blockid.streamid.STR.attribute = value
The specification of the stream. This is a string that sets the specification in
each mode. (See table below.)
During the run of any particular mode, only the specification for that mode is
known to the OOMF system.
PHASE
TYPE
Phase of the stream. This is used for connection processing when connecting
a mole-based stream to a mole fraction-based stream to determine if a flash
is necessary.
VAPOR
Vapor phase
LIQUID
Liquid phase
VL
VLF
water
Mixed vapor, liquid and free water phases (flash with free
required)
UNKNOWN
An information stream
UNDEFINED
Stream Specifications
SPEC
SIM
PAR
REC
OPT
CONST
Fixed
Fixed
Fixed
Fixed
CALC
Free
Free
Free
Free
MEAS
Free
Fixed
Fixed
Free
PARAM
Fixed
Free
Free
Fixed
OPTIM
Fixed
Fixed
Fixed
DOF
RECON
Fixed
Fixed
DOF
Fixed
INDEP
Fixed
Fixed
DOF
DOF
See Also
Aspen Plus Extensions - Stream Commands
83
Connection Commands
These commands are used to control connections between variables.
Connections create an equation equivalencing two variables. When
connections are processed, OOMF checks the specification of each variable in
the current mode.
The rules for connection processing specification changes are simple. If only
one variable in the connection is specified in all four modes (type CONST,
OPTIM, RECON or INDEP), then this variable will become free (type CALC) by
the connection processing. If both variables are a specified type, then the
variable listed first, the destination variable, will become free.
The following table shows the connection rules for the seven specification
types. The rows are the destination variables (the variable listed first in the
connection); the columns are the source variables (the variable listed second
in the connection).
CONST
CALC
MEAS
PARAM
OPTIM
RECON
INDEP
CALC=RECON CALC=INDEP
CALC =
CALC=CALC
N/A
N/A
N/A
CALC=CALC
CALC=CALC
CALC=CALC
MEAS =
MEAS=CALC
N/A
N/A
CALC=CALC
MEAS=CALC
MEAS=CALC
MEAS=CALC
CALC=CALC N/A
CALC=RECON CALC=INDEP
CALC=RECON CALC=INDEP
CALC=RECON CALC=INDEP
OPTIM=
INDEP=
Adding Connections
This command is used to add connections either between one or more pairs of
variables or between one or more pairs of ports.
Input Language
ADD CONNECTION cxn_name, cxn_list
84
cxn_list
Input Language
ADD CUSTOM CONNECTION cxn_name, cxn ports, cxn_types
cxn_ports
cxn_types
Removing Connections
This command is used to remove Connections and Spec Groups, completely
eliminating them from the EO Strategy. The product specific user interface
input, of course, is not affected.
When a Connection is removed, Spec Management automatically reprocesses
all the Connections and Spec Groups to ensure that the problem remains
square. The removed Connections and Spec Groups will not appear in any
PRINT command, and will have an Inactive status in the GUI, if defined
there. (The Status on the GUI is not updated until an Incremental Build or
Solve is performed.)
If you use these commands from within products that embed OOMF, note that
any Connections defined in the products user interface that are removed with
this command are recreated if the EO Strategy is reinitialized either from SM
Results or from a complete rebuild.
This command will not remove product specific connections such as
Input Language
REMOVE CONNECTION cxn_list
85
Disabling Connections
This command is used to disable a specific Connection or Spec Group. For a
Connection, this excludes the connection equation from the problem. For a
Spec Group, this disables the group.
When a connection is disabled, Spec Management automatically reprocesses
all the Connections and Spec Groups to ensure that the problem remains
square. (The Status on the GUI is not updated until an Incremental Build or
Solve is performed.)
Input Language
DISABLE CONNECTION cxn_list
Enabling Connections
This command is used to enable a specific Connection or Spec Group. It does
the reverse of the DISABLE CONNECTION command discussed in the
previous section.
Input Language
ENABLE CONNECTION cxn_list
86
Checking Connections
This command is used to check the integrity of all flowsheet connections.
Input Language
CHECK CONNECTIONS
Printing Connections
The CONNECTIONS command prints from the current scope level only:
Spec Groups.
User connections.
Spec Groups.
User connections.
Input Language
CONNECTIONS
PRINT CONNECTIONS cxn_list
PRINT CONNECTIONS DETAILED cxn_list
PRINT VARIABLES CONNECTIONS
PRINT MEASUREMENT CONNECTIONS cxn_list
PRINT MEASUREMENT CONNECTIONS DETAILED cxn_list
87
User connections.
These may become inactive because the connection was disabled through the
products user interface or because a block involved in the connection has
been excluded.
The PRINT INACTIVE MEASUREMENT CONNECTIONS command is used
to print measurement connections that are inactive.
Input Language
PRINT INACTIVE CONNECTIONS cxn_list
PRINT INACTIVE MEASUREMENT CONNECTIONS cxn_list
Spec Groups.
User connections.
These may be incomplete due to an input error, such as a bad variable name
or an improper specification.
Input Language
PRINT INCOMPLETE CONNECTIONS cxn_list
88
Spec Groups.
User connections.
Input Language
PRINT CONNECTION VARIABLES var_list
See Also
Aspen Plus Extensions - Stream Commands
Aspen Plus Extensions - HXFlux Commands
89
90
5 Measurements
Measurement Commands
Measurements are used to associate model variables with actual plant
measurements. Measurements are typically configured through the products
user interface. If you are using standalone OOMF, measurements may be
added using the add measurements command. Do not use the add
measurements command from within the Aspen Plus user interface. These
commands allow you to control the status of your measurements.
Checking Measurements
This command is used to verify that the measurements for the problem are
properly defined. This will check for the following
Input Language
CHECK MEASUREMENTS
5 Measurements
91
Disabling Measurements
This command is used to disable a specific measurement. This excludes the
measurement from the problem: the measurement connection is broken, the
variables are removed, and the offset equation is excluded.
When a measurement is disabled, Spec Management automatically
reprocesses all the Connections and Spec Groups to ensure that the problem
remains square. Connections and Spec Groups that contain references to the
disabled measurement become Inactive. (The Status on the GUI is not
updated until an Incremental Build or Solve is performed.)
Input Language
DISABLE MEASUREMENT meas_list
Enabling Measurements
This command is used to enable a specific measurement. It does the reverse
of the DISABLE MEASUREMENT command discussed in the previous
section.
Input Language
ENABLE MEASUREMENT meas_list
92
5 Measurements
Printing Measurements
Prints a list of measurements to the report device.
Input Language
PRINT MEASUREMENTS meas_list
Input Language
PRINT MEASUREMENTS VARIABLES var_list
5 Measurements
93
Pspec
----Const
Const
Meas
Meas
Meas
Optim
Optim
Meas
Ospec
----Const
Const
Param
Param
Param
Const
Const
Param
Pspec
----Const
Const
Meas
Meas
Meas
Optim
Optim
Meas
Ospec
----Const
Const
Param
Param
Param
Const
Const
Param
Note the reduction in size of the measurement block, C2MEAS, and that it
now contains an excluded equation.
In this next example, we repeat the above except that measurement
C2MEAS.XD is disabled. This measurement appears in Spec Group C2MEAS,
causing it to become Inactive. Since this Spec Group is used to ensure proper
configuration of all the measurements, once it becomes Inactive, a number of
94
5 Measurements
Pspec
----Const
Const
Const
Const
Const
Const
Const
Const
Ospec
----Calc
Calc
Calc
Calc
Calc
Calc
Calc
Calc
5 Measurements
95
Pspec
----Const
Const
Meas
Meas
Meas
Optim
Optim
Meas
Ospec
----Const
Const
Param
Param
Param
Const
Const
Param
Measurement Qualities
The quality of a variable may be used to change problem specifications. The
Variable Quality capability allows you to:
Every variable has a QUALITY attribute. The quality may be set with the
following script command:
variableid.QUALITY = status
Where status is one of the following:
GOOD
BAD
OVERRIDE
96
5 Measurements
The BAD_STATUS_LIST contains a list of Specification Groups and VariableSpecification Group pairs used by the Variable Quality capability. This script
parameter may be defined with the SET script command:
SET BAD_STATUS_LIST =[ specid1, specid2, ...
[ variableid1, specid1 ], \
[ variableid2, specid2 ], ... ]
The following sections discuss the use of the Variable Quality capability.
5 Measurements
97
Input Language
PROCESS VARIABLE QUALITY
UNPROCESS VARIABLE QUALITY
98
5 Measurements
If we reset the quality to GOOD and process again, the new Specification
Group is removed:
EO> C2HIER.C2MEAS.BLK.RR_PLANT.QUALITY = GOOD
EO> PROCESS VARIABLE QUALITY
Remove bad spec group AS__PARMODE
EO>
In this example, we first disable Specification Group PARMODE and associate
it with the reflux ratio variable. When the variables quality goes BAD,
Specification Group PARMODE is enabled.
EO> DISABLE SPEC GROUP PARMODE
1 specification group disabled.
EO> SET BAD_STATUS_LIST = [[C2HIER.C2MEAS.BLK.RR_PLANT,PARMODE]]
EO> C2HIER.C2MEAS.BLK.RR_PLANT.QUALITY = BAD
EO> PROCESS VARIABLE QUALITY
Enable spec group PARMODE
EO>
5 Measurements
99
100
5 Measurements
This chapter describes the OOMF Script commands used for saving and
restoring variable and block data to and from binary and ASCII files. It also
describes how simulation and block data can be persisted in compound
storage (binary) files and XML files.
Input Language
SAVE VARIABLES [ vmask ], list TO "file"
list
Optional list of block names, variable names, stream names, or port names.
The list is separated by commas. If no list is given, then all variables in the
current scope are saved.
file
101
These attributes can be used. (See the Variable Commands section for
descriptions.)
VALUE
INITIAL
LOWER
UPPER
STEP
UNITS
BOUND
SBWEIGHT
SPEC
SCALE
QUALITY
PHYSICAL_TYPE
BASEUOM
Input Language
RESTORE VARIABLES [ vmask ], list FROM "file"
RESTORE VARIABLES EXCEPT [ vmask ], list FROM "file"
list
Optional list of block names, variable names, stream names, or port names.
The list is separated by commas. For RESTORE VARIABLES, list is the list of
objects to restore. For RESTORE VARIABLES EXCEPT, list is the list of
objects not to restore. In either case, if no list is given, then all variables in
the current scope are restored.
file
INITIAL
LOWER
UPPER
STEP
BOUND
SBWEIGHT
SPEC
UNITS
SCALE
QUALITY
PHYSICAL_TYPE
BASEUOM
102
Input Language
RESTORE FREE VARIABLES [ vmask ], list FROM "file"
RESTORE FREE VARIABLES EXCEPT [ vmask ], list FROM "file"
list
Optional list of block names, variable names, stream names, or port names.
The list is separated by commas. For RESTORE FREE VARIABLES, list is the
list of objects to restore. For RESTORE FREE VARIABLES EXCEPT, list is
the list of objects not to restore. In either case, if no list is given, then all
variables in the current scope are restored.
file
INITIAL
LOWER
UPPER
STEP
UNITS
BOUND
SBWEIGHT
SPEC
SCALE
QUALITY
PHYSICAL_TYPE
BASEUOM
Input Language
UPDATE VARIABLES [ vmask ] TO "file"
file
103
These attributes can be used. (See the Variable Commands section for
descriptions.)
VALUE
STEP
SCALE
SPEC
LOWER
SBWEIGHT
UNITS
PHYSICAL_TYPE
UPPER
Input Language
WRITE VARFILE [ vmask ], list TO "file"
WRITE VARFILE EXCEPT [ vmask ], list TO "file"
list
Optional list of block names, variable names, variable indices, stream names,
or port names. The list is separated by commas. For WRITE VARFILE, list is
the list of objects to write. For WRITE VARFILE EXCEPT, list is the list of
objects not to write. In either case, if no list is given, then all variables in the
current scope are written. (The name of the current hierarchy, if any, is not
added to the variable name prefix.)
file
These attributes can be used. (See the Variable Commands section for
descriptions.)
VALUE
INITIAL
CHANGE
LOWER
UPPER
STEP
BOUND
SBWEIGHT
SPEC
UNITS
SCALE
PHYSICAL_TYPE
QUALITY
BASEUOM
SHADOW_PRICE
ACTIVE_BOUND
NAME
SSPEC
RLOWER
RUPPER
104
Input Language
READ VARFILE [ vmask ], list FROM "file"
READ VARFILE EXCEPT [ vmask ], list FROM "file"
READ VARFILE QUERY [QUERY], [ vmask ], list FROM "file"
list
Optional list of block names, variable names, variable indices, stream names,
or port names. The list is separated by commas. For READ VARFILE, the list
is the list of objects to read. For READ VARFILE EXCEPT, the list is the list
of objects not to read. In either case, if no list is given, then all variables
within the current scope are read.
file
query
These attributes can be used. (See the Variable Commands section for
descriptions.)
VALUE
INITIAL
CHANGE
LOWER
UPPER
STEP
BOUND
SBWEIGHT
SPEC
UNITS
SCALE
PHYSICAL_TYPE
QUALITY
BASEUOM
Input Language
COMPARE VARFILE [ vmask ], list FROM "file"
list
Optional list of block names, variable names, variable indices, stream names,
or port names. The list is separated by commas. If no list is given, then all
variables within the current scope are compared.
file
These attributes can be used. (See the Variable Commands section for
descriptions.)
UNITS
LOWER
BOUND
SCALE
VALUE
UPPER
SPEC
SBWEIGHT
INITIAL
STEP
105
Input Language
WRITE SNAPSHOT [ vmask ], list TO file
Examples:
WRITE SNAPSHOT TO "file.snp"
WRITE SNAPSHOT [ units, value, lower, upper ] TO "file.txt"
WRITE SNAPSHOT [ units, value, spec ], a, b* TO &history_device
list
Optional list of block names, variable names, variable indices, stream names,
or port names. The list is separated by commas. For WRITE VARFILE, list is
the list of objects to write. For WRITE VARFILE EXCEPT, list is the list of
objects not to write. In either case, if no list is given, then all variables in the
current scope are written. (The name of the current hierarchy, if any, is not
added to the variable name prefix.)
file
These attributes can be used. (See the Variable Commands section for
descriptions.)
VALUE
INITIAL
CHANGE
LOWER
UPPER
STEP
BOUND
SBWEIGHT
SPEC
UNITS
SCALE
PHYSICAL_TYPE
QUALITY
BASEUOM
SHADOW_PRICE
ACTIVE_BOUND
NAME
SSPEC
RLOWER
RUPPER
106
list
Optional list of block names, variable names, variable indices, stream names,
or port names. The list is separated by commas. For READ VARFILE, the list
is the list of objects to read. For READ VARFILE EXCEPT, the list is the list
of objects not to read. In either case, if no list is given, then all variables
within the current scope are read.
file
query
These attributes can be used. (See the Variable Commands section for
descriptions.)
VALUE
INITIAL
CHANGE
LOWER
UPPER
STEP
BOUND
SBWEIGHT
SPEC
UNITS
SCALE
PHYSICAL_TYPE
QUALITY
BASEUOM
107
Input Language
SAVE SIMULATION TO "file"
Input Language
OPEN SIMULATION FROM "file"
108
Input Language
ADD SIMULATION FROM "file"
Input Language
SAVE BLOCK blk_name TO "file"
Input Language
LOAD BLOCK FROM "file"
109
110
111
</xs:complexType>
<xs:complexType name="modulesType">
<xs:sequence>
<xs:element name="module" type="moduleType" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="moduleType">
<xs:attribute name="name" use="required"/>
</xs:complexType>
<xs:complexType name="blocksType">
<xs:sequence>
<xs:element name="block" type="blockType" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="blockType">
<xs:all>
<xs:element name="blocks" type="blocksType" minOccurs="0"
maxOccurs="1"/>
<xs:element name="blockAttributes"
type="blockAttributesType" minOccurs="0" maxOccurs="1"/>
<xs:element name="blockPorts" type="blockPortsType"
minOccurs="0" maxOccurs="1"/>
<xs:element name="connections" type="connectionsType"
minOccurs="0" maxOccurs="1"/>
<xs:element name="blockSpecificData" minOccurs="0"
maxOccurs="1"/>
</xs:all>
<xs:attribute name="name" use="required"/>
<xs:attribute name="type" use="required"/>
<xs:attribute name="modid" use="required"/>
<xs:attribute name="subid" use="optional"/>
<xs:attribute name="included" use="optional"/>
<xs:attribute name="category" use="optional"/>
<xs:attribute name="parent" use="optional"/>
</xs:complexType>
<xs:complexType name="blockAttributesType">
<xs:sequence>
<xs:element name="blockAttribute" type="blockAttributeType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="blockPortsType">
<xs:sequence>
<xs:element name="blockPort" type="blockPortType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="blockAttributeType">
<xs:attribute name="name" use="required"/>
<xs:attribute name="readOnly" use="required"/>
<xs:attribute name="modified" use="required"/>
<xs:attribute name="baseType" use="required"/>
<xs:attribute name="type" use="required"/>
<xs:attribute name="value" use="required"/>
</xs:complexType>
112
<xs:complexType name="blockPortType">
<xs:sequence>
<xs:element name="variables" type="portVariablesType"
minOccurs="1" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="name" use="required"/>
<xs:attribute name="direction" use="optional"/>
<xs:attribute name="type" use="optional"/>
<xs:attribute name="sosType" use="optional"/>
<xs:attribute name="basis" use="optional"/>
<xs:attribute name="defaultPhase" use="optional"/>
<xs:attribute name="phase" use="optional"/>
<xs:attribute name="portPhase" use="optional"/>
<xs:attribute name="portSpec" use="optional"/>
<xs:attribute name="portStream" use="optional"/>
<xs:attribute name="portType" use="optional"/>
</xs:complexType>
<xs:complexType name="portVariablesType">
<xs:sequence>
<xs:element name="variable" type="portVariableType"
minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="portVariableType">
<xs:attribute name="index" use="required"/>
</xs:complexType>
<xs:complexType name="connectionsType">
<xs:sequence>
<xs:element name="connection" type="connectionType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="connectionType">
<xs:attribute name="name" use="required"/>
<xs:attribute name="connType" use="required"/>
<xs:attribute name="type" use="required"/>
<xs:attribute name="destID" use="required"/>
<xs:attribute name="sourceID" use="required"/>
<xs:attribute name="multiplier" use="required"/>
<xs:attribute name="offset" use="required"/>
<xs:attribute name="enabled" use="required"/>
</xs:complexType>
<xs:complexType name="variablesType">
<xs:sequence>
<xs:element name="variable" type="variableType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="variableType">
<xs:attribute name="index" use="required"/>
<xs:attribute name="name" use="required"/>
<xs:attribute name="value" use="optional"/>
<xs:attribute name="uomID" use="optional"/>
<xs:attribute name="baseUOM" use="optional"/>
<xs:attribute name="initial" use="optional"/>
<xs:attribute name="lowerBound" use="optional"/>
<xs:attribute name="upperBound" use="optional"/>
113
114
Input Language
WRITE SIMULATION TO "file"
Input Language
READ SIMULATION FROM "file"
115
Input Language
APPEND BLOCKS FROM "file"
Input Language
WRITE BLOCK blk_name TO "file"
Input Language
READ BLOCK blk_name FROM "file"
116
117
118
7 Objective Functions
This chapter describes the OOMF Script commands for manipulating objective
functions, Jacobians, and derivatives.
There are three types of objective functions available: linear, sum of squares
and symbolic. The coefficient of a term in a linear objective function may have
a constant numeric value with units or another variables name. In the latter
case the objective term is either bi-linear or quadratic. You can define as
many objective functions as you want. In this way, you can keep track of all
your objective function values during any particular run. The objective
function you wish to solve is determined by the setting of script parameter
OBJECTIVE.
Note that variables are stored internally in OOMF in the units in which model
residuals are evaluated (model base units). Some models may be in SI units
while others may be in metric units. Hence, SI units are used during the
evaluation of a custom objective function in order to have a common basis for
evaluation in the overall flowsheet.
Input Language
objid.attribute = value
7 Objective Functions
119
Value of the objective function. If you do not enter the units of measure,
SI units are assumed.
Direction for the optimization.
MAXIMIZE
Maximize value
MINIMIZE
Minimize value
SCALE
UOM
Units of measure.
Input Language
EVALUATE OBJECTIVE objid
Input Language
EVALUATE OBJECTIVE DERIVATIVE objid
Input Language
EVALUATE OBJECTIVE HESSIAN objid
120
7 Objective Functions
Input Language
PRINT OBJECTIVE objid
Input Language
ANALYZE JACOBIAN reltol, pertsize, block_list
Relative error tolerance. If the relative error is greater than this value, the
analytical and numerical derivatives are reported for each term in error.
pertsize
block_list
Optional list of blocks in which to analyze the Jacobian. The list entries are
separated by commas. All the blocks in the list must be within the current
scope.
Input Language
ANALYZE SPARSITY zerotol, pertsize, block_list
7 Objective Functions
121
Zero tolerance. If the numerical value of the Jacobian element is less than
this tolerance, then the element is considered zero. (default = 1.0E-12)
pertsize
block_list
Optional list of blocks in which to analyze the Jacobian. The list entries are
separated by commas. All the blocks in the list must be within the current
scope.
Input Language
EVALUATE JACOBIAN
Input Language
PRINT JACOBIAN list
Input Language
PRINT JACOBIAN VARIABLES list
122
7 Objective Functions
Input Language
PRINT JACOBIAN EQUATIONS list
Input Language
DERIVATIVE
7 Objective Functions
123
Lets interactively query the derivatives for a small flowsheet and then change
one of the blocks to use numerical derivatives with a perturbation size of
1.0E-7.
EO> DERIVATIVE
--block- --deriv- --pert size- --when update fails- --nonlinearity r. deviation
DDEF analytic
C2S analytic
F analytic
C2MEAS analytic
EO> DDEF.DERIV_METHOD = NUMERIC
EO> DDEF.PERT = 1.0D-7
EO> DERIVATIVE
--block- --deriv- --pert size- --when update fails- --nonlinearity r. deviation
DDEF numeric 1e-007
C2S analytic
F analytic
C2MEAS analytic
Lets interactively analyze the Jacobian for block C2S and report errors for
any derivatives with relative errors greater than 0.1 using a perturbation size
of 1.0E-6.
EO> ANALYZE JACOBIAN 1.0, 1.0D-6, C2S
Analyzing C2S
Found 5 significant differences out of 6858 non-zeros
---i--- ----------equation---------- ----------variable---------- --analytic-- ---numeric-148 C2S.BLKEQN_PHSEQBL_1_C2H4
C2S.BLK.CVAP_1.C2H6
-0.4405
-447.5
254 C2S.BLKEQN_PHSEQBL_3_C2H4
C2S.BLK.CVAP_3.C2H6
-1.969e-006
4.254e-007
3392 C2S.BLKEQN_PHSEQBL_59_C2H4
C2S.F.STR.MOLES
0.002919
-0.001528
3393 C2S.BLKEQN_PHSEQBL_59_C2H4
C2S.BLK.F.C2H4.FL_VMFRC
0.001769
0.0233
3403 C2S.BLKEQN_PHSEQBL_59_C2H4
C2S.BLK.EFF_1
-0.09316
0.01107
124
7 Objective Functions
8 Analysis
This chapter describes the OOMF Script commands used for analysis and
controlling the solver.
Analysis Commands
These commands help you analyze your problem and can assist in debugging.
Input Language
ANALYZE DOF
Sensitivity Analysis
This command computes the sensitivity between a set of independent and
dependent variables. The sensitivity is the derivative or gain between the
variables. This can be very useful for analyzing flowsheet behavior or in
control system design. This output is sent to the HISTORY_DEVICE.
Input Language
SENSITIVITY obj [ depend ], [ indep ]
8 Analysis
125
indep
Analyzing Variables
This command analyzes the structure of the problem and divides the variables
into a set of observable and unobservable variables and redundant and
nonredundant measurements. A variable is defined as observable or
determinable if there are sufficient measurements or fixed variables that will
allow it to be determined through the model. A measurement is defined as
redundant if the variable associated with it can be determined or estimated
even in the absence of this measurement.
A problem is well determined if there are no unobservable variables.
Consider the following simple system:
X1 = X2 + X3
X3 = 1
X3 is determined from the second equation. However X1 and X2 cannot be
determined from the first equation. Therefore both are unobservable. If we fix
X1 or X2 , then all the variables are observable.
If we attach measurement X2m to variable X2, then X2 can be estimated
from its measurement:
X2 = X2m
Then X1 can be computed from X2 and X3. Thus X2 becomes observable.
However this would not be possible without this measurement. Therefore
measurement X2m is nonredundant.
This report is written to the history device.
Input Language
ANALYZE VARIABLES obj, [ list ]
126
obj
list
Comma separated list of variables. If provided, the command will pick from
the list the minimum number of variables to fix to make the problem solvable.
8 Analysis
Analyzing Equations
Equation analysis is a numerical tool that helps to troubleshoot problems with
singular jacobians by isolating the groups of equations which are linearly
dependent. These groups are unique and do not depend on any options for
the LU factorization. An equation is linearly dependent with other equations if
it can be reproduced by adding the other equations multiplied by appropriate
factors.
A problem with linearly dependent equations can arise from:
Note that because this algorithm factorizes the Jacobian, you should evaluate
the jacobian before invoking this command. Also note that active bounds are
not yet considered.
This command reports groups of dependent equations. Each group defines a
cluster of equations that are dependent among themselves. The equations
from one group are not dependent with respect to the other groups. Generally
speaking, the more groups you have the more broken your problem is.
This report is written to the history device.
Input Language
ANALYZE EQUATIONS
1489
0
3
0
8 Analysis
127
128
8 Analysis
Solver Commands
These commands are used to specify the solver and its parameters.
Input Language
SOLVER solver
Name of the solver to use. A blank will print the current solver.
DMO
DMO (default)
LSSQP
LSSQP
NSOLVE
NSOLVE
SPARSE
SPARSE
DECOMP LSSQP
DECOMP SPARSE
Input Language
SOLVER SETTINGS parameter = value, parameter = value,
value
Input Language
DMO.parameter = value
8 Analysis
129
value
DMO Parameters
DMO Parameter
Description
MAXITER
MINITER
CREEPFLAG
Flag for the creep mode. This mode is very effective for making the optimizer
moves more conservative. It is very helpful when the problem diverges.
0
No (default)
Yes
CREEPITER
CREEPSIZE
Creep mode step size. This is the fraction of the full step to be taken when in
creep mode (default = 0.1).
SEARCHMODE
LINESEARCH
FACTORSPEED
USEDROPTOL
DROPTOL
130
Aggressive mode. The Hessian is initialized with small values. This mode
moves the problem to its bounds faster than the normal mode and is the
preferred mode for highly constrained optimization problems with few
degrees of freedom at the solution.
Normal mode. The Hessian is initialized with the identity matrix (default).
Exact penalty
LU factorization method.
1
Fast method. Uses original pivot sequence if possible. This can be faster.
In some cases (i.e. extreme phase changes) may cause additional
factorization.
Nonzero drop tolerance used to remove small Jacobian values. A larger tolerance
will reduce the number of nonzeroes and decrease factorization time. If the value
is too large, then the accuracy of the Jacobian will be reduced. This may lead to
an increase in the number of iterations and/or singularities. (default = 1.0D-20)
8 Analysis
DMO Parameter
Description
SAVEJDFFILE
Flag to save binary form of the Jacobian in the JDF file. This file is read by the
solution analysis, DMOSAT.
SCREENFORM
HESSIANUPDATES
RIGORUPDATES
FACTORSPACE
Parameter related to the workspace allocated for the solution of the linear system
of equations. Problems with excessive fill-in may require a higher number.
(default = 6)
ACTIVESPACE
Parameter related to the workspace allocated for part of the active set strategy.
(default = 2)
PIVOTSEARCH
VARSCALE
PRINTFREQ
1
Maximum diagnostics (including all variable and residual values at every
iteration)
LUSTATS
QPSTATS
No diagnostics (default)
Full diagnostics
No diagnostics (default)
Full diagnostics
IWORKF
RWORKF
RESCVG
OBJCVG
ANALYSISTHRES
Input Language
LSSQP.parameter = value
8 Analysis
131
value
LSSQP Parameters
LSSQP
Parameter
KPTLEV
KPFREQ
Description
History print level.
4
Control the frequency of printing full variable/constraint vectors. The first and last
vectors are always printed when requested by KPLLEV (default=1).
KPNTOP
Control the number of top entries to print in top entry outputs (default=10).
MAXITR
MINITR
RELEPS
NFINFB
RFINFB
NFEASB
Maximum number of feasibility corrections allowed at each SQP iteration to try to keep
constraint violations below RFEASB (default = 2). The more feasibility corrections
allowed, the more the solution will become like a feasible-path optimization.
RFEASB
Tolerance on iteration constraint violations (default = RFINFB for simulation, 1.0D-2 for
other modes). See above.
ITRBND
Number of initial iterations when CHGBND instead of CHGMAX is used to limit search
steps (default = 3). This parameter, along with CHGBND, can be used to reduce the
step size during the initial iterations, thus keeping the optimization moves more
conservative.
CHGBND
Initial limit on the optimization step size. See above. The step size is limited such that
k|dk| CHGBND * max(1,|xk|). This is a relative step size limit. A negative value for
CHGBND implies an absolute step size limit (default=0.25).
CHGMAX
Step size limit after the first ITRBND iterations. The step size is limited such that k|dk|
CHGMAX *max(1,|xk|) (default=0.5).
ALFALS
MAXLSC
Maximum number of line search cutbacks allowed per SQP iteration. When this limit is
reached, the SQP iteration continues with the final step size (default=1 for simulation, 10
for other modes).
MAXLSF
Maximum number of consecutive SQP iterations with line search failure before
terminating LSSQP (default=10 for simulation, 3 for other modes).
132
8 Analysis
LSSQP
Parameter
Description
MAXQPF
GNPMAX
An artificial weighting factor to drive the QP problem to the feasible region. In rare
occasions, it has to be increased to avoid a small feasibility index (default=1.0D6).
MDHESS
Hessian approximation option. Generally, this should only be changed for the DRPE case.
The options follow:
LEWBAS
LSCOPT
IXSCS
Coordinate basis (less overhead especially for problems with large degree of
freedoms)
Same as option 3 for the first ITRBND iterations. Perform only step bounding
with CHGMAX thereafter.
Same as option 4 for the first ITRBND iterations. Perform only step bounding
with CHGMAX thereafter.
Exact penalty function with trust region control and second order correction.
LSSQP internal variable and constraint scaling options. Allowed options follow:
0
Derive variable scaling from initial x0; derive constraint scaling from Jacobian
QPINFE
QP infeasible parameter. If QPINFE is positive and greater than the QP feasibility index,
then a new search direction is determined by minimizing the sum of absolute violations.
This can be helpful when trying to find a feasible solution to an initially infeasible
optimization problem (default=0.0).
KMUDEC
Use Lagrange multiplier as penalty parameter. This may work better for some
problems.
TOLBAS
TOLANA
Threshold pivot tolerance for the rare case of reanalyzing a matrix (default=0.1).
8 Analysis
133
LSSQP
Parameter
Description
SPDROP
Matrix elements with absolute value smaller than SPDROP are dropped by the sparse
linear solver (default=1.D-15).
SINGT1
Matrix elements with absolute value less than SINGT1 are not allowed to become pivot
elements when selecting a basis (default=1.D-8).
SINGT2
Matrix elements with absolute value less than SINGT2 are not allowed to become pivot
elements during numerical factorization (default=1.D-10).
NNDCMP
DELTLS
Actual to predicted merit function reduction ratio below which a line search step will be
rejected (default=0.1).
BIGBND
BNDADJ
BSMALL
SMLSCL
BIGSCL
LCHBAS
No
Yes (default)
BASFLP
Growth of the largest sensitivity matrix element to trigger a new basis selection
(default=100.). Parameter LCHBAS must be 1. Set this number to a larger value to
prevent LSSQP from reselecting the basis.
TAUHYB
LSIZEB
Hessian sizing option. This is represented as a two-digit decimal number; each digit sets
a parameter:
0
Dont resize Hessian after first iteration; use identity matrix for initial Hessian.
Dont resize Hessian after first iteration; use FSCALF to scale initial Hessian.
10
Resize Hessian after first iteration; use identity matrix for initial Hessian.
11
Resize Hessian after first iteration; use FSCALF to scale initial Hessian (default).
FSCALF
Initial Hessian scaling factor. If FSCALF is positive, the initial Hessian is set to
FSCALF*I. Otherwise, the initial Hessian is set to |FSCALF|*FSCALV*I where FSCALV
is an estimate of the magnitude of the objective function. If FSCALF is zero, a value of
-0.1 is used (default=0.01).
RRLOW
RRHIGH
ETASKP
Range-space to full step ratio above which BFGS update will be skipped (default=0.95).
VMUINI
VMUMIN
VMUFAC
MSFREQ
134
No matrix scaling.
8 Analysis
LSSQP
Parameter
Description
MSMETH
KOWARM
LUBNDS
LINCST
IFDTYP
No
Yes (default)
No (default)
Yes
IFDITR
ZPERTF
NICHK
Iteration count to check if the problem should be reinitialized. LSSQP checks the problem
status at the current iteration, INICHK iterations ago and 2*INICHK iterations ago. If
the problem is not making adequate progress, it is reinitialized. This causes the Hessian
to be reset, the problem to be rescaled, and a new basis to be selected (default=20).
KFOWDG
Accumulated line search counts to force a watchdog step. This relaxes the line search
criteria and allows the merit function to decrease. LSSQP will search along this path for
KBKOUT iterations. If the merit function has not improved by then, LSSQP will backtrack
to the iteration where the watchdog took place and perform a line search. The watchdog
relaxation technique can often help converge the problem (default=10).
KBKOUT
Number of iterations to wait for merit function to improve before backing out of a forced
watchdog relaxation (default=20).
NBDBAS
Number of bound violations for insensitive dependent variables before basis switching
(default=10).
8 Analysis
135
LSSQP
Parameter
Description
IFDTYP
Numerical derivative option. Users should use the numerical derivative options provided
by the executive. Potential nonzeros in the gradient that are actual zeros should be set
to small values for options 2 and 4:
0
Relative perturbation size for numerical derivative calculation. See above (default=1.D6).
XPMIN
DERDIF
DERMIN
Input Language
NSOLVE.parameter = value
value
NSOLVE Parameters
NSOLVE Parameter
Description
Maximum_iterations
Bound_iterations
Divergent_steps
Stable_iterations
Number of initial iterations where the variable step sizes are controlled by
stabilization strategies such as Powells Dogleg or One Dimensional LineSearch (default=4). Stabilization techniques are enforced on subsequent
iterations only if the steps are grossly divergent.
136
8 Analysis
NSOLVE Parameter
Description
Stabilization
Check_steps
Flag that indicates whether the 2-norm of the variable step vector needs to
be within the specified tolerance: 0=do not check for step sizes, 1=check for
step sizes (default = 1).
Print_level
Iteration history printing level. Values higher than 4 print a detailed iteration
history in the solver report file (default = 4).
Function_tolerance
Maximum_function_error Maximum error allowed based on the 2-norm of the residual function vector
(default =1.0D30).
Variable_tolerance
Allowed tolerance on variable step sizes based on the 2-norm of the variable
step vector (default = 0.01). This is used only if the parameter
Check_steps=1.
Trust_radius
Radius of the initial trust region measured as a ratio of the 2-norm of the
variable vector (default=0.1). This is used only with Powells Dogleg strategy
(when parameter Stabilization=0). The radius is automatically adjusted after
each iteration using Powells formula.
Input Language
SOLVE objid
Models may add a custom solution algorithm that can augment or substitute
this primary solution process. These custom solution algorithms will be
invoked automatically.
8 Analysis
137
Recovery Commands
These commands are used to restore the problem state after a failed solution.
Input Language
RESET VARIABLES
RESET VARS
RESET VAR
See Also
Aspen Plus Extensions - Recovery Commands
138
8 Analysis
This chapter describes the OOMF Script commands that let you print
information and create reports.
Input Language
PRINT SUMMARY
Input Language
PRINT CONVERGENCE SUMMARY
SUMMARY
variables:
incident variables:
fixed variables:
free variables:
1526
1523
32
1491
139
Number of equations:
Number of included equations:
Block equations:
Connection equations:
Number of excluded equations:
Number of non-zeros:
Number of incident non-zeros:
Number of inactive connections:
Number of incomplete connections:
Problem is square
1492
1492
1443
49
0
7640
7261
0
0
This example shows the output form the PRINT CONVERGENCE SUMMARY
command.
EO> PRINT CONVERGENCE SUMMARY
Convergence summary
------------------Status:
Converged
Iterations:
7
Residual convergence: 3.861e-008
Objective convergence: 1.566e-007
Initial objective:
2.556
Final objective:
2.647
Formatted Printing
Formatted print is a powerful tool to allow you to create your own custom
reports.
Input Language
PRINT FORMATTED expression1 , expression2 , expression3 ,
The format for the print. This must evaluate to a string data type. The
format may refer to a previously defined script parameter, in which case
the & should proceed the name in the PRINT command. The script
parameter may be defined with the SET command.
expression2
The data to print. The type of this data should match the corresponding
data type in the format string.
Note that in the above, the expressions are separated by commas, and that
the commas must be surrounded by blanks. Expressions are discussed further
in the section titled Expressions and Conditionals.
The format string is based on the ANSI C library function PRINTF. The format
may contain literal characters as well as control characters. The control
characters are case sensitive and are as follows:
140
Control
Character
Description
\n
Indicates a carriage return, line feed. Format statements are not assumed
to end with a carriage return and line feed so you must use the \n at the
end of the format if you wish to move to a new line.
\t
\v
\b
\r
\f
\a
\\
%n.mf
%n.me
%n.mg
%nd
%no
%nx
Print an integer value in hexadecimal. The case of the x indicates the case
of the hexadecimal letters.
%c
%ns
%%
In the above formats, a flag may be placed between the percent sign (%)
and the format which indicates the following:
Flag
Description
space
Specifies an alternate output form. For o, the first digit will be zero. For x, 0x
will be prefixed to a non-zero result. For e, f, and g, the output will always
have a decimal point. For g, trailing zeros will not be removed.
141
Note the use of the \n in the format to create the carriage return and line
feed.
We can create a more complex output using a parameter for the format:
PRINT FORMATTED "Name
Low
Value
PRINT FORMATTED "---------SET FMT = "%-15s %-12.7g %-12.7g %-12.7g \n"
PRINT FORMATTED &FMT , "Top Comp" ,
\
MSMT.BLK.XD_PLANT.LOWER, \
MSMT.BLK.XD_PLANT,
\
MSMT.BLK.XD_PLANT.UPPER
Upper \n"
----- \n"
Low
--1e-05
0.001
Value
----0.0001
0.015
Upper
----0.0002
0.05
Here, we use the s format for the string output and we use the g format for
the numbers. For the g format, we force the output to take up 12 spaces to
keep the table aligned regardless of the magnitude of the numbers. We use
the - flag in the format to left-justify the output.
142
Miscellaneous Printing
Commands
This section includes a general purpose printing command.
Input Language
ECHO expression
143
Report Commands
These commands are used to generate reports. Products that embed OOMF
may have additional commands.
See Also
Aspen Plus Extensions - Report Commands
Reporting Blocks
This command prints a report of the specified blocks to the report device.
Input Language
REPORT BLOCKS block_list
Input Language
REPORT OBJECTIVE objid
144
OOMF supports the instantiation of, interaction with, and solution of event
driven dynamic models. Typically, these models are comprised of differential
and algebraic equation systems. This chapter describes the OOMF
parameters, equation-based scripting language commands, and the XMLbased, task-modeling language that can be used to interact with these
models and control the simulation while it is running
Description
RUN_MODE
Run mode for the simulation. The options are SS (for steady-state
simulations), INIT (for initialization simulations) and DYN (for dynamic
simulations). The default value is SS. The INIT and DYN run modes are
relevant only to dynamic models
DYN_RUN_TO
DYN_INTERVAL
145
Pausing a simulation
This command is used to pause a dynamic simulation while it is running and
to enter dynamic interactive mode, which will be depicted by a Dyn> prompt
in the client window.
Input Language
PAUSE
Running a simulation
This command is used to continue running a dynamic simulation from a
paused state. The simulation will continue to run until the time specified in
the dyn_run_to parameter is reached or another pause command is invoked.
OOMF will only respond to a run command when it is in dynamic interactive
mode.
Input Language
RUN
Input Language
STEP
Stopping a simulation
This command is used to exit from dynamic interactive mode.
Input Language
STOP
146
Reinitializing a simulation
This command is used to reinitialize a dynamic simulation.
Input Language
REINITIALIZE
Input Language
ADD TASKS FROM <file>
Full path to a file that contains the task definitions. The file
should have a .xml extension.
Viewing tasks
This command is used to send a list of all the tasks loaded in OOMF to the
current output device.
Input Language
SHOW TASKS
Deleting a task
This command is used to unload a task from OOMF.
Input Language
DELETE TASK <task_name>
Input Language
ACTIVATE VARIABLE PROFILE <var_list>
147
Input Language
INACTIVATE VARIABLE PROFILE <var_list>
Input Language
PRINT VARIABLE PROFILE <var_list>
Input Language
PRINT VARIABLE HISTORY <var_name, start_time, end_time,
interval>
148
var_name
start_time
end_time
interval
Saving a snapshot
This command is used to save a snapshot for a simulation.
A snapshot is the state of a simulation at a given instance. A snapshot can
be used to rollback a simulation to a prior point in time. For instance, you
could save a snapshot of the simulation after it has been initialized.
Each time OOMF saves a snapshot, it assigns it an ID.
Input Language
SAVE SNAPSHOT <snapshot_name>
Loading a snapshot
This command is used to load a snapshot into OOMF.
Input Language
LOAD SNAPHOT <snapshot_id>
Viewing snapshots
This command is used to send the list of saved snapshots to the current
output device. The name, ID and time of each snapshot is printed to the
output device.
Input Language
SNAPSHOTS
Deleting a snapshot
This command is used to delete a snapshot.
Input Language
DELETE SNAPSHOT <snapshot_id>
149
Task Language
The OOMF task language is an XML-based language with which the user can
write task specifications that can be loaded into the OOMF kernel to
automatically carry out certain actions during the execution of a dynamic
simulation. For instance, a task can be used to assign a value to a variable,
ramp a variable, invoke a loop, create a snapshot, print a variable or perform
other actions during the simulation run.
This section includes an overview of the task language, including its XML
schema, and some examples of common tasks written in the language.
150
151
<xs:sequence>
<xs:element name="Body" type="TaskBody" minOccurs="1"
maxOccurs="1" />
<xs:element name="False" type="Conditional"
minOccurs="0" maxOccurs="1" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="CreateSnapshot">
<xs:complexContent>
<xs:extension base="TaskStatement">
<xs:sequence />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Wait">
<xs:complexContent>
<xs:extension base="TaskStatement">
<xs:sequence />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="WaitFor">
<xs:complexContent>
<xs:extension base="TaskStatement">
<xs:sequence />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Parallel" mixed="true">
<xs:complexContent>
<xs:extension base="TaskStatement">
<xs:sequence>
<xs:element name="Body" type="TaskBody" minOccurs="1"
maxOccurs="1" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Pause">
<xs:complexContent>
<xs:extension base="TaskStatement">
<xs:sequence />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Print" mixed="true">
<xs:complexContent>
<xs:extension base="TaskStatement">
<xs:sequence>
<xs:element name="Arg" type="xs:string" minOccurs="0"
maxOccurs="unbounded" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
152
<xs:complexType name="Ramp">
<xs:complexContent>
<xs:extension base="TaskStatement">
<xs:sequence>
</xs:sequence>
<xs:attribute name="variable" type="xs:string"
use="required" />
<xs:attribute name="period" type="xs:double"
use="required" />
<xs:attribute name="target" type="xs:string"
use="required" />
<xs:attribute name="type" type="EnumRampType"
use="required" />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:simpleType name="EnumRampType">
<xs:restriction base="xs:string">
<xs:enumeration value="Continuous" />
<xs:enumeration value="Discrtete" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="SRamp">
<xs:complexContent>
<xs:extension base="TaskStatement">
<xs:sequence>
</xs:sequence>
<xs:attribute name="variable" type="xs:string"
use="required" />
<xs:attribute name="period" type="xs:double"
use="required" />
<xs:attribute name="target" type="xs:double"
use="required" />
<xs:attribute name="type" type="EnumRampType"
use="required" />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Return">
<xs:complexContent>
<xs:extension base="TaskStatement">
<xs:sequence />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Invoke" mixed="true">
<xs:complexContent>
<xs:extension base="TaskStatement">
<xs:sequence>
<xs:element name="Script" type="xs:string"
minOccurs="1" maxOccurs="1" />
<xs:element name="Input" type="xs:string" minOccurs="0"
maxOccurs="unbounded" />
<xs:element name="Output" type="xs:string"
minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:extension>
153
</xs:complexContent>
</xs:complexType>
<xs:complexType name="TaskBody">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Assign" type="Assignment" />
<xs:element name="If" type="Conditional" />
<xs:element name="CreateSnapshot" type="CreateSnapshot" />
<xs:element name="Wait" type="Wait" />
<xs:element name="WaitFor" type="WaitFor" />
<xs:element name="Parallel" type="Parallel" />
<xs:element name="Pause" type="Pause" />
<xs:element name="Print" type="Print" />
<xs:element name="Ramp" type="Ramp" />
<xs:element name="SRamp" type="SRamp" />
<xs:element name="Return" type="Return" />
<xs:element name="Invoke" type="Invoke" />
<xs:element name="Stop" type="Stop" />
<xs:element name="For" type="For" />
</xs:choice>
</xs:complexType>
<xs:complexType name="Stop">
<xs:complexContent>
<xs:extension base="TaskStatement">
<xs:sequence />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="For" mixed="true">
<xs:complexContent>
<xs:extension base="TaskStatement">
<xs:sequence>
<xs:element name="Body" type="TaskBody" minOccurs="1"
maxOccurs="1" />
</xs:sequence>
<xs:attribute name="each" type="xs:string"
use="required"/>
<xs:attribute name="in" type="xs:string" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
154
Example Tasks
This section contains several example tasks written in the OOMF task
language.
Ramping a variable
The following example depicts how to ramp the value of a variable:
<?xml version="1.0" encoding="utf-8"?>
<Tasks>
<Task name="RampHeat" active="true" once="true" time="0.0">
<Body>
<Ramp variable="B1.Q" target="10" period="5.0" type="Discrete" />
</Body>
</Task>
</Tasks>
In this task, the value of variable B1.Q is ramped to a value of 10 over a
period of 5 time units starting a time 0. If the ramp type is Discrete, as
shown in the example, the solver will update the value of the ramped variable
at each communication step whereas if the ramp type is Continuous, the
solver will update the value at each integration step. While continuous ramps
are more accurate, they may also cause the solver to slow down.
155
Suspending a task
The following example depicts how to suspend a task:
<?xml version="1.0" encoding="utf-8"?>
<Tasks>
<Task name="Task1" active="true" once="true" time="0.0">
<Body>
<WaitFor> B1.M > 5{kg}</WaitFor>
<Assign to="B1.F">2{kg/hr}</Assign>
</Body>
</Task>
</Tasks>
The task is suspended until the value of B1.M reaches a value greater than 5
kg. When this condition is satisfied, the task resumes and the value of B1.F is
set to 2 kg/hr.
156
157
Conditional tasks
The previous examples all depicted tasks that are invoked at a specific time.
The following example presents a task that is carried out when a specified
condition is satisfied:
<?xml version="1.0" encoding="utf-8"?>
<Tasks>
<Task name="ImplicitTask" active="true" once="true">
<When>B1.Z < 3.2</When>
<Body>
<Assign to="B1.K">5.8</Assign>
</Body>
</Task>
</Tasks>
This task is only invoked when the value of variable B1.Z acquires a value of
3.2 or less. When this condition is satisfied, the variable B1.K is assigned a
value of 5.8.
158
11 Units of Measure,
Physical Types and
Connection Types
This chapter describes the OOMF script commands used to manipulate units
of measure, and lists the available units of measure and physical types.
Input Language
variableid.UOM = {uom}
Variable name.
uom
Units of measure. These units must be of the same physical type as the
variable.
159
Input Language
PRINT UOM {uom}
PRINT UOM FOR type
type
Temperature change
PRESSURE
Pressure
MOLE-FLOW
Mole flow
MASS-FLOW
Mass flow
ENTHALPY
Specific enthalpy
Input Language
variableid ## {uom}
Variable name.
uom
Units of measure.
160
Units of Measure
The units available include the English engineering set (ENG), the
International System set (SI) and the metric engineering set (MET), as well
as other common units. OOMF supports up to 2147483648 units of measure
per physical type.. The following table contains the set of available units.
Type of Units
Code SI Set
ENG Set
MET Set
ANGLE
32
RAD
DEG
DEG
AREA
SQM
SQFT
SQM
AREA-PRICE
54
$/SQM
$/SQFT
$/SQM
$/SQCM, $/SQIN,
$/SQMILE, $/SQMM
AREA-USAGE
62
SQM/SEC
SQFT/HR
SQM/HR
SQM/DAY, SQM/YEAR
BOND-WORK-IN 34
J/KG
KWHR/TON
KWHR/TON
KJ/KG
CAPACITY
91
KG/KG
LB/LB
KG/KG
CHROM-VEL
69
M/SEC
FT/SEC
CM/HR
COMPOSITION
MOL-FR
MOL-FR
MOL-FR
MASS-FR
CONTENTS
85
FRACTION
PERCENT
FRACTION
PPM
COST-RATE
119
$/SEC
$/HR
$/HR
CURRENT
114
AMP
MAMP
DELTA-T
31
C, R, DELTA-K, DELTA-F,
DELTA-C, DELTA-R
DENSITY
KG/CUM
LB/CUFT
GM/CC
DESIGN-PRES
93
N/SQM-GAUGE
PSIG
BARG
DIFFUSIVITY
SQM/SEC
SQFT/HR
SQCM/SEC
CS
DIMENSIONLES 44
UNITLESS
UNITLESS
UNITLESS
UNTLESS, UNITLES
DIPOLEMOMENT 45
(J*CUM)**.5
(BTU*CUFT)**.5 DEBYE
(KJ*CUM)**.5
161
Type of Units
Code SI Set
ENG Set
MET Set
ELEC-POWER
47
WATT
KW
KW
ELEC-PRICE
48
$/J
$/KWHR
$/KWHR
ENERGY
BTU
CAL
ENERGY-PRICE
30
$/J
$/BTU
$/CAL
ENERGY-VOL
117
CUM/J
BBL/BTU
BBL/MMBTU
ENTHALPY
J/KMOL
BTU/LBMOL
CAL/MOL
ENTHALPY-CYC
105
WATT/CYCLE
BTU/CYCLE
CAL/CYCLE
J/CYCLE, GJ/CYCLE,
KCAL/CYCLE,
MMKCAL/CYCLE,
MMBTU/CYCLE,
MMKCAL/CYCLE,
MMBTU/CYCLE,
PCU/CYCLE,
MMPCU/CYCLE, KJ/CYCLE,
KW/CYCLE, GCAL/CYCLE
ENTHALPY-FLO
13
WATT
BTU/HR
CAL/SEC
ENTHALPY-OPR
109
WATT/CYCLE
BTU/OP-HR
CAL/OP-SEC
J/OP-SEC, GJ/OP-HR,
KCAL/OP-HR,
MMKCAL/OP-HR,
MMBTU/OP-HR,
MMKCAL/OP-DAY,
MMBTU/OP-DAY, PCU/OPHR, MMPCU/OP-HR,
KJ/OP-SEC, KW/CYCLE,
GCAL/OP-HR, GCAL/OPDAY
ENTROPY
J/KMOL-K
BTU/LBMOL-R
CAL/MOL-K
J/KG-K, BTU/LB-R,
CAL/GM-K, MJ/KMOL-K,
KCAL/KMOL-K,
GCAL/KMOL-K,
MBTU/LBMOL-R
F-FACTOR
101
(KGCUM)**.5/SEC
(LBCUFT)**.5/HR
(GM-L)**.5/MIN (LB-GAL)**.5/MIN
FILTER-RESIS
35
1/METER
1/FT
1/METER
FISCAL
162
1/CM, 1/IN
Type of Units
Code SI Set
ENG Set
MET Set
FLOW
KG/SEC
LB/HR
KG/HR
LB/SEC, MLB/HR,
TONS/DAY, MCFH,
TONNE/HR, LB/DAY,
KG/DAY, TONS/HR,
KG/MIN, KG/YEAR,
GM/MIN, GM/HR, GM/DAY,
MGM/HR, GGM/HR,
MGM/DAY, GGM/DAY,
LB/MIN, MMLB/HR,
MLB/DAY, MMLB/DAY,
LB/YEAR, MLB/YEAR,
MMLB/YEAR, TONS/MIN,
MTONS/YEAR,
MMTONS/YEAR, LTONS/MIN, L-TONS/HR, LTONS/DAY, MLTONS/YEAR, MMLTONS/YEAR,
KTONNE/YEAR
FLUX
61
CUM/SQM-SEC
CUFT/SQFT-SEC
L/SQM-SEC
L/SQM-HR, GAL/SQFT-MIN
FLUX-HEAT-AR
120
WATT/SQM
BTU/HR-SQFT
CAL/SEC-SQM
FLUX-MOLE
121
KMOL/SQM-S
LBMOL/SQFT-HR KMOL/SQM-HR
FORCE
14
NEWTON
LBF
DYNE
FREQUENCY
28
HZ
RPM
RPM
G-RATE
92
KG/SEC-SQM
LB/HR-SQFT
KG/HR-SQM
HEAD
33
J/KG
FT-LBF/LB
M-KGF/KG
HEAT
53
BTU
CAL
HEAT-FLUX
80
WATT/M
BTU/HR-FT
CAL/SEC-M
J/SEC-M, MMBTU/HRFT,GCAL/HR-M,GJ/HR-M,
KCAL/HR-M, KJ/HR-M,
HEAT-FLUX-AR
95
WATT/SQM
BTU/HR-SQFT
CAL/SEC-SQM
J/SEC-SQM, MMBTU/HRSQFT
HEAT-RATE-V
122
WATT/CUM
BTU/HR-CUFT
CAL/SEC-CUM
LBMOL/SQFT-S,
MOL/SQCM-S
RAD/SEC, RPS, KRPM,
MMRPM, RPH
163
Type of Units
Code SI Set
ENG Set
MET Set
HEAT-TRANS-C
16
WATT/SQM-K
BTU/HR-SQFT-R
CAL/SEC-SQCM- KCAL/SEC-SQM-K,
K
KCAL/HR-SQM-K, PCU/HRSQFT-K, KW/SQM-K,
J/SEC-SQM-K, KJ/SECSQM-K, MMBTU/HR-SQFTR, KJ/SEC-SQM-C,
MJ/SEC-SQM-K, MJ/SECSQM-C, GJ/HR-SQM-K,
GJ/HR-SQM-C, KCAL/HRSQM-C, BTU/HR-SQFT-F,
MMBTU/HR-SQFT-F
INVERSE-AREA
78
1/SQM
1/SQFT
1/SQM
INVERSE-HT-C
87
SQM-K/WATT
HR-SQFT-R/BTU
SEC-SQCMK/CAL
INVERSE-LENG
68
1/M
1/FT
1/CM
1/IN, 1/MM
INVERSE-PRES
82
SQM/N
1/PSI
1/ATM
SQFT/LBF, 1/BAR,
1/TORR, 1/IN-WATER,
SQCM/KG, 1/MMHG,
1/KPA, 1/MM-WATER
INVERSE-TEMP
81
1/K
1/R
1/K
INVERSE-TIME
59
1/SEC
1/HR
1/HR
ITEM-PRICE
56
$/ITEM
$/ITEM
$/ITEM
LENGTH
17
METER
FT
METER
LN-INV-TIME
60
LN(1/SEC)
LN(1/HR)
LN(1/HR)
LN(1/MIN)
MASS
18
KG
LB
KG
MASS-CONC
58
KG/CUM
LB/CUFT
GM/L
MASS-CYCL
102
KG/CYCLE
LB/CYCLE
KG/CYCLE
LB/CYCLE, MLB/CYCLE,
TONS/CYCLE, GM/CYCLE,
TONNE/CYCLE, LB/CYCLE,
KG/CYCLE, TONS/CYCLE,
TONS/CYCLE
MASS-DENSITY 38
KG/CUM
LB/CUFT
GM/CC
MASS-ENTHALP 40
J/KG
BTU/LB
CAL/GM
KCAL/KG, MMKCAL/KG,
MMBTU/LB, PCU/LB,
MMPCU/LB, KJ/KG, MJ/KG,
GCAL/KG, MBTU/LB
MASS-ENTROPY 42
J/KG-K
BTU/LB-R
CAL/GM-K
KCAL/KG-K, KJ/KG-K,
MJ/KG-K, GCAL/KG-K,
MBTU/LB-R
164
Type of Units
Code SI Set
ENG Set
MET Set
MASS-FLOW
10
KG/SEC
LB/HR
KG/HR
LB/SEC, MLB/HR,
TONS/DAY, GM/SEC,
TONNE/HR, LB/DAY,
KG/DAY, TONS/YEAR,
TONS/HR, TONNE/DAY,
TONNE/YEAR, KG/MIN,
KG/YEAR, GM/MIN,
GM/HR, GM/DAY,
MGM/HR, GGM/HR,
MGM/DAY, GGM/DAY,
LB/MIN, MMLB/HR,
MLB/DAY, MMLB/DAY,
LB/YEAR, MLB/YEAR,
MMLB/YEAR, TONS/MIN,
MTONS/YEAR,
MMTONS/YEAR, LTONS/MIN, L-TONS/HR, LTONS/DAY, MLTONS/YEAR, MMLTONS/YEAR,
KTONNE/YEAR
MASS-FLUX
70
KG/SQM-S
LB/SQFT-HR
KG/SQM-HR
LB/SQFT-S, GM/SQCM-S,
KG/SQCM-S, MLB/SQFTHR, TONS/SQFT-HR, LTONS/SQFT-HR,
TONNE/SQFT-HR
MASS-HEAT-CA 49
J/KG-K
BTU/LB-R
CAL/GM-K
KCAL/GM-K, PCU/LB-K,
KJ/KG-K, BTU/LB-F
MASS-OPER
106
KG/OP-SEC
LB/OP-HR
KG/OP-HR
LB/OP-SEC, MLB/OP-HR,
TONS/OP-DAY, GM/OPSEC, TONNE/OP-HR,
LB/OP-DAY, KG/OP-DAY,
TONS/OP-YEAR,
TONS/OP-HR
MASS-PER-LEN
116
KG/M
LB/FT
KG/M
MASS-TRANS-C 66
KG/S-SQMKG/CUM
LB/HR-SQFLB/CUF
GM/S-SQCMGM/CC
MASS-VOLUME
115
CUM/KG
CUFT/LB
CC/G
MOLAR-PERM
90
KMOL/SQMSEC0PA
LBMOL/SQFT-HR- KMOL/SQM-HRPSI
ATM
LBMOL/SQFT-HR-ATM,
SCFT/SQFT-DAY-PSI,
SCFT/SQFT-HR-100PSI,
STDCC/SQCM-SEC-CMHQ,
BARRERS/CM
MOL-FLOW-LEN 89
KMOL/SEC-M
LBMOL/HR-FT
KMOL/HR-M
MOLE-CONC
KMOL/CUM
LBMOL/CUFT
MOL/CC
64
BPD/MLBPH, CC/KG
165
Type of Units
Code SI Set
ENG Set
MET Set
MOLE-CYCL
103
KMOL/CYCLE
LBMOL/CYCLE
KMOL/CYCLE
MMSCFH/CYCLE,
MMSCMH/CYCLE,
MOL/CYCLE,
LBMOL/CYCLE,
SCMH/CYCLE,
LBMOL/CYCLE,
KMOL/CYCLE,
MMSCFD/CYCLE,
SCFM/CYCLE
MOLE-DENSITY
37
KMOL/CUM
LBMOL/CUFT
MOL/CC
LBMOL/GAL, MOL/L
MOLE-ENTHALP 39
J/KMOL
BTU/LBMOL
CAL/MOL
KCAL/MOL, TCAL/MOL,
MMKCAL/MOL,
MMBTU/LBMOL,
PCU/LBMOL,
MMPCU/LBMOL, KJ/KMOL,
GJ/KMOL, MJ/KMOL,
KCAL/KMOL, GCAL/KMOL,
MBTU/LBMOL, BTU/SCF,
GCAL/MOL
MOLE-ENTROPY 41
J/KMOL-K
BTU/LBMOL-R
CAL/MOL-K
KCAL/MOL-K, KJ/KMOL-K,
TCAL/MOL-K, MJ/KMOL-K,
KCAL/KMOL-K,
GCAL/KMOL-K,
MBTU/LBMOL-R
MOLE-FLOW
11
KMOL/SEC
LBMOL/HR
KMOL/HR
MMSCFH, MMSCMH,
MOL/SEC, LBMOL/SEC,
SCMH, LBMOL/DAY,
KMOL/DAY, MMSCFD,
MSCFD, SCFM, MOL/MIN,
KMOL/KHR, KMOL/MHR,
MOL/HR, MMOL/HR,
MLBMOL/HR, LBMOL/MHR,
LBMOL/MMHR, MSCFM,
SCFH, MSCFH, SCFD,
NCMH, NCMD, KMOL/MIN,
KMOL/WEEK,
KMOL/MONTH,
KMOL/YEAR, KMOL/OPERYEAR
MOLE-FLUX
96
KMOL/SQM-S
LBMOL/SQFT-HR KMOL/SQM-HR
LBMOL/SQFT-S,
MOL/SQCM-S
MOLE-HEAT-CA 15
J/KMOL-K
BTU/LBMOL-R
CAL/MOL-K
MOLE-OPER
107
KMOL/OP-SEC
LBMOL/OP-HR
KMOL/OP-HR
MMSCF/CYCLE-HR,
MMSCM/CYCLE-HR,
MOL/OP-SEC, LBMOL/OPSEC, SCM/CYCLE-HR,
LBMOL/OP-DAY,
KMOL/OP-DAY,
MMSCF/CYCLE-DAY,
SCF/CYCLE-MIN
MOLE-PRICE
125
$/KMOL
$/LBMOL
$/MOL
166
Type of Units
Code SI Set
ENG Set
MET Set
MOLE-RXN-RAT 123
KMOL/CUM-S
LBMOL/CUFT-HR
KMOL/CUM-HR
MOL/CC-S
MOL-RXN-RATW 124
KMOL/KG-S
LBMOL/LB-HR
KMOL/KG-HR
MOL/GM-S
MOLE-VOLUME
43
CUM/KMOL
CUFT/LBMOL
CC/MOL
ML/MOL, BBL/MSCF
MOLES
51
KMOL
LBMOL
KMOL
MOM-INERTIA
112
KG-SQM
LB-SQFT
KG-SQM
GM-SQCM, LB-SQIN
NUM-CON-RATE 77
NO/CUM-SEC
NO/CUFT-SEC
NO/L-SEC
NUM-CONC
NO/CUM
NO/CUFT
NO/L
NO/CC, 1E6/CC
57
PACK-FACTOR
76
1/M
1/FT
1/M
1/CM, 1/IN,1/MM
PDROP
75
N/SQM
PSI
ATM
PDROP-PER-HT
74
N/CUM
IN-WATER/FT
MM-WATER/M
MBAR/M, MMHG/FT,
TORR/M, MMHG/M
PDROP-PER-LEN 94
PA/M
PSI/FT
KGF/SQCM-KM
POP-DENSITY
86
NO/M/CUM
NO/FT/CUFT
NO/M/L
NO/MM/L, NO/MU/CC,
NO/IN/CUIN
POWER
19
WATT
HP
KW
POWERVOLUME
65
WATT/CUM
HP/CUFT
KW/L
KW/CUM
PRESSURE
20
N/SQM
PSIA
ATM
167
Type of Units
Code SI Set
ENG Set
MET Set
RHO-VSQRD
110
KG/M-SQSEC
LB/FT-SQSEC
KG/M-SQSEC
SIEMENS-M
118
SIEMENS/M
SIEMENS/FT
SIEMENS/M
SIEMENS/CM
SOLUPARAM
46
(J/CUM)**.5
(BTU/CUFT)**.5
(CAL/CC)**.5
(KCAL/CUM)**.5,
(KJ/CUM)**.5,
(CAL/ML)**0.5
SOLUTE-PERM
72
SQM/M-S
SQFT/FT-HR
SQM/M-HR
SQCM/CM-S, SQFT/FT-S
SOLVENT-PERM 71
KG/SQM-S-PA
LB/SQFT-HR-ATM KG/SQM-HRATM
SOUND-LEVEL
111
DECIBELS
DECIBELS
DECIBELS
SPEC-FLT-RES
36
METER/KG
FT/LB
METER/KG
SPECIFICAREA
67
SQM/CUM
SQFT/CUFT
SQCM/CC
SURFACE-TENS 21
N/M
DYNE/CM
DYNE/CM
TEMP-VOLUME
83
CUM-K/KMOL
CUFT-R/LBMOL
CC-K/MOL
TEMPERATURE
22
C, R
THERMAL-COND 23
WATT/M-K
BTU-FT/HRSQFT-R
KCAL-M/HRSQM-K
TIME
24
SEC
HR
HR
UA
50
J/SEC-K
BTU/HR-R
CAL/SEC-K
KJ/SEC-K, KCAL/SEC-K,
KCAL/HR-K, BTU/HR-F
UNIT-PRICE
29
$/KG
$/LB
$/KG
USR-DUMMY0
90
USR-DUMMY1
91
USR-DUMMY2
92
USR-DUMMY3
93
USR-DUMMY4
94
USR-DUMMY5
95
USR-DUMMY6
96
USR-DUMMY7
97
USR-DUMMY8
98
USR-DUMMY9
99
VELOCITY
25
M/SEC
FT/SEC
M/SEC
SQM/SEC
GPM/FT
SQCM/SEC
SQM/HR, SQFT/MIN
VFLOW-LENGTH 84
168
GM/SQCM-S-ATM,
GM/SQCM-S-PA
CM/GM
LBF/FT, MN/M
Type of Units
Code SI Set
ENG Set
MET Set
VFLOW-RPM
100
CUM/SEC/RPM
CUFT/HR/RPM
L/MIN/RPM
GAL/MIN/RPM,
GAL/HR/RPM,
BBL/DAY/RPM,
CUM/HR/RPM,
CUFT/MIN/RPM,
BBL/HR/RPM,
CUFT/SEC/RPM,
CUM/DAY/RPM,
CUM/YEAR/RPM,
L/HR/RPM,
KBBL/DAY/RPM,
MMCUFT/HR/RPM,
MMCUFT/DAY/RPM,
MCUFT/DAY/RPM,
L/SEC/RPM, L/DAY/RPM,
CUM/MIN/RPM
VISCOSITY
26
N-SEC/SQM
CP
CP
LB/FT-HR, MN-SEC/SQM,
P, GM/SEC-CM, DYNSEC/SQCM, PA-SEC
VOL-ENTHALPY
88
J/CUM
BTU/CUFT
CAL/CC
KCAL/CUM, KJ/CUM,
MMBTU/BBL
VOL-HEAT-CAP
79
J/CUM-K
BTU/CUFT-R
CAL/CC-K
KCAL/CUM-K, KJ/CUM-K,
BTU/CUFT-F
VOL-HTR-COEF
126
WATT/CUM-K
BTU/HR-CUFT-R
CAL/SEC-CC-K
VOLTAGE
113
VOLT
KVOLT
VOLUME
27
CUM
CUFT
VOLUME-CYCL
104
CUM/CYCLE
CUFT/CYCLE
L/CYCLE
GAL/CYCLE, GAL/CYCLE,
BBL/CYCLE, CUM/CYCLE,
CUFT/CYCLE, BBL/CYCLE,
CUFT/CYCLE, CUM/CYCLE,
CUM/CYCLE, L/CYCLE,
KBBL/CYCLE,
MMCUFT/CYCLE
169
Type of Units
Code SI Set
ENG Set
MET Set
VOLUME-FLOW
12
CUM/SEC
CUFT/HR
L/MIN
GAL/MIN, GAL/HR,
BBL/DAY, CUM/HR,
CUFT/MIN, BBL/HR,
CUFT/SEC, CUM/DAY,
CUM/YEAR, L/HR,
KBBL/DAY, MMCUFT/HR,
MMCUFT/DAY,
MCUFT/DAY, L/SEC,
L/DAY, CUM/MIN,
KCUM/SEC, KCUM/HR,
KCUM/DAY, MCUM/SEC,
MCUM/HR, MCUM/DAY,
ACFM, CUFT/DAY,
MCUFT/MIN, MCUFT/HR,
MMCUFT/HR, MGAL/MIN,
MMGAL/MIN, MGAL/HR,
MMGAL/HR, MBBL/HR,
MMBBL/HR, MBBL/DAY,
MMBBL/DAY
VOLUME-OPER
108
CUM/OP-SEC
CUFT/OP-HR
L/OP-MIN
GAL/OP-MIN, GAL/OP-HR,
BBL/OP-DAY, CUM/OP-HR,
CUFT/OP-MIN, BBL/OPHR, CUFT/OP-SEC,
CUM/OP-DAY, CUM/OPYEAR, L/OP-HR, KBBL/OPDAY, MMCUFT/OP-HR
VOLUME-PRICE
55
$/CUM
$/CUFT
$/L
CUM/SEC
CUFT/HR
L/HR
VOLUME-USAGE 63
WATER-RATE
73
KG/J
LB/HP-HR
KG/KW-HR
WORK
52
HP-HR
KW-HR
Most of the above units are self-explanatory. Units and unit parts that may
require explanation follow:
170
Units
Description
MM
SQ
Units
Description
CU
VAC
IN-WATER,
IN-WATER-60F
MMKCAL
MN
MilliNewtons
MLB
Thousand lbs
NCM
NCMH
NCMD
PCU
PSIA
SCF
SCFH
SCFD
SCM
SCMH
TCAL
TONNE
Physical Types
Every model variable has a physical dimensionality (physical type) that is
assigned by the model developer. Each physical type has a corresponding
integer code.
Type Code
Physical Type
UNTYPED
AREA (SQM)
COMPOSITION
MASS-DENSITY (KG/CUM)
DIFFUSIVITY (SQM/SEC)
ENERGY (J)
ENTHALPY (J/KMOL)
171
172
Type Code
Physical Type
ENTROPY (J/KMOL-K)
FISCAL ($)
FLOW (KG/SEC)
10
MASS-FLOW (KG/SEC)
11
MOLE-FLOW (KMOL/SEC)
12
VOLUME-FLOW (CUM/SEC)
13
ENTHALPY-FLO (WATT)
14
FORCE (N)
15
MOLE-HEAT-CA (J/KMOL-K)
16
HEAT-TRANS-C (WATT/SQM-K)
17
LENGTH (M)
18
MASS (KG)
19
POWER (WATT)
20
PRESSURE (N/SQM)
21
SURFACE-TENS (N/M)
22
TEMPERATURE (K)
23
THERMAL-COND (WATT/M-K)
24
TIME (SEC)
25
VELOCITY (M/SEC)
26
VISCOSITY (N-SEC/SQM)
27
VOLUME (CUM)
28
FREQUENCY (HZ)
29
UNIT-PRICE ($/KG)
30
ENERGY-PRICE ($/J)
31
DELTA-T (DELTA-K)
32
ANGLE (RAD)
33
HEAD (J/KG)
34
BOND-WORK-IN (J/KG)
35
FILTER-RESIS (1/M)
36
SPEC-FLT-RES (M/KG)
37
MOLE-DENSITY (KMOL/CUM)
38
MASS-DENSITY (KG/CUM)
39
MOLE-ENTHALPY (J/KMOL)
40
MASS-ENTHALPY (J/kg))
41
MOLE-ENTROPY (J/KMOL/K)
42
MASS-ENTROPY (J/KG-K)
43
MOLE-VOLUME (CUM/KMOL)
44
DIMENSIONLESS
45
DIPOLEMOMENT (J*CUM)**0.5
46
SOLUPARAM (J/CUM)**0.5
47
ELEC-POWER (WATT)
48
ELEC-PRICE ($/J)
49
MASS-HEAT-CA (J/KG-/K)
Type Code
Physical Type
50
UA (J/SEC-K)
51
MOLES (KMOL)
52
WORK (J)
53
HEAT (J)
54
AREA-PRICE ($/SQM)
55
VOLUME-PRICE ($/CUM)
56
ITEM-PRICE ($/ITEM)
57
NUM-CONC (NO/CUM)
58
MASS-CONC (KG/CUM)
59
INVERSE-TIME (1/SEC)
60
LN-INV-TIME (LN(1/SEC))
61
FLUX (CUM/SQM-SEC)
62
AREA-USAGE (SQM/SEC)
63
VOLUME-USAGE (CUM/SEC)
64
MOLE-CONC (KMOL/CUM)
65
POWER-VOLUME (WATT/CUM)
66
MASS-TRANS-C (KG/S-SQM-KG/CUM)
67
SPECIFICAREA (SQM/CUM)
68
INVERSE-LENG (1/M)
69
CHROM-VELOCITY (M/SEC)
70
MASS-FLUX (KG/SQM-SEC)
71
SOLVENT-PERM (KG/SQM-S-PA)
72
SOLUTE-PERM (SQM/M-S)
73
WATER-RATE (KG/J)
74
PDROP-PER-HT (N/CUM)
75
PDROP (N/SQM)
76
PACK-FACTOR (1/M)
77
NUM-CON-RATE (NO/CUM-SEC)
78
INVERSE-AREA (1/SQM)
79
VOL-HEAT-CAP (J/CUM-K)
80
HEAT-FLUX (WATT/M)
81
INVERSE-TEMP (1/K)
82
INVERSE-PRES (SQM/N)
83
TEMP-VOLUME (CUM-K/KMOL)
84
VFLOW-LENGTH (SQM/SEC)
85
CONTENTS (FRACTION)
86
POP-DENSITY (NO/M/CUM)
87
INVERSE-HT-C (SQM-K/WATT)
88
VOL-ENTHALPY (J/CUM)
89
MOLE-FLOW-LEN (KMOL/SEC-M)
90
USR-DUMMY0
91
USR-DUMMY1
92
USR-DUMMY2
173
174
Type Code
Physical Type
93
USR-DUMMY3
94
USR-DUMMY4
95
USR-DUMMY5
96
USR-DUMMY6
97
USR-DUMMY7
98
USR-DUMMY8
99
USR-DUMMY9
100
VFLOW-RPM (CUM/SEC/RPM)
101
F-FACTOR (KG-CUM)**0.5/SEC
102
MASS-CYCL (KG/CYCLE)
103
MOLE-CYCL (MOL/CYCLE)
104
VOLUME-CYCL (L/CYCLE)
105
ENTHALPY-CYC (J/CYCLE)
106
MASS-OPER (KG/OP-SEC)
107
MOLE-OPER (MOL/OP-SEC)
108
VOLUME-OPER (L/OP-MIN)
109
ENTHALPY-OPR (J/OP-SEC)
110
RHO-VSQRD (KG/M-SQSEC)
111
SOUND-LEVEL (DECIBELS)
112
MOM-INERTIA
113
VOLTAGE (VOLT)
114
CURRENT (AMP)
115
MASS-VOLUME (CUM/KG)
116
MASS-PER-LEN
117
ENERGY-VOL
118
SIEMENS-M
119
COST-RATE
120
FLUX-HEAT-AR
121
FLUX-MOLE
122
HEAT-RATE-V
123
MOLE-RXN-RATE
124
MOL-RXN-RATW
125
MOLE-PRICE
126
VOL-HTR-COEF
Connection Types
Connection types can be specified for block variables. Connection types are
used to create custom connections between block ports.
In OOMF, every physical type has a corresponding connection type with the
same name. Additionally, there are several special connection types which are
listed in the following table.
Type Code
Connection Type
AROM-FACTOR
ANILINE-PT
API
AROM-BY-VOL
BASIC-N2-CONT
BENZ-BY-VOL
CON-11
CON-CLEAR
CONRAD-CARBON
10
CETANE-IDX
11
DON-11
12
DON-CLEAR
13
EX-BENZ-EMISS
14
WATSON-K
15
LUMIN-NO
16
MON-11
17
MON-CLEAR
18
NPLUS2A-BY-VOL
19
NAPH-VOL-PCT
20
NOX-EMISS
21
OLEF-VOL-PCT
22
O2-WT-PCT
23
POUR-PT
24
POUR-PT-IDX
25
RON-11
26
RON-CLEAR
27
RVP-IDX
28
REID-VAP-PRES
29
SP-GRAVITY
30
SP-VOLUME
31
SULF-WT-PCT
32
TOXIC-EMISS
33
VANADIUM-BY-WT
175
Type Code
Connection Type
34
VISCO-INDEX
35
VOC-EMISS
36
AROM-BY-WT
37
ASPHALT-CONT
38
C5-BY-WT
39
CLOUD-PT
40
COPPER-CONT
41
IRON-CONT
42
D2887-X-PCT
43
D86-X-PCT
44
DRIVE-IDX
45
FLASH-PT
46
FREEZE-PT
47
NPLUSA-BY-VOL
48
NAPH-WT-PCT
49
NICKEL-CONT
50
N2-CONT
51
OLEF-WT-PCT
52
PARAF-VOL-PCT
53
PARAF-WT-PCT
54
REFRACT-INDEX
55
SMOKE-PT
56
SODIUM-CONT
57
STD-LIQ-DEN
58
SULFUR-MCAP-WT
59
TBP-X-PCT
60
WAX-CONT
61
X-PCT-EVAP
176
Input Language
variableid.conn_type = {conn_type}
Variable name.
Conn_type
Connection type. The connection type must be one from table presented
earlier.
177
178
12 Global Structures
Overview
Variable data within any model in OOMF can serve as a global data structure
that can be used within another model in OOMF. Models that contain global
structure data can be instantiated and deleted in a manner similar to any
other OOMF model. In order to account for the possibility that the model with
global structure data may move around in the matrix after it is first
instantiated since a hierarchy container or another intermediate block may
expand or contract and to account for the possibility that the global structure
may be deleted by a user without deleting the model that uses the structure,
a generic OOMF model has the capability to restructure itself in place, i.e.,
starting at the position in the matrix where it was first instantiated.
Since a generic OOMF model can now restructure itself after it is placed in the
matrix, it can be parameterized by another model that contains global
structure data. For example, a model that wishes to be a consumer of
external global data within another model should have a named block
attribute or parameter that can later be associated with an instance of the
model that contains the global data. This mechanism will allow the model
that is consumer of a global structure to be able to instantiate itself in the
matrix even if the global structure has not been placed yet. When the model
that uses an external global structure, referred to as AModel, is first
instantiated, with instance name B2, it can build all its variables, including
dummy variables that are similar to those contained in the structure
instance, and the associated equations. Later, when a model with global
structure data, referred to as AStruct, is instantiated, with instance name
B1, and the global structure parameter of B2 is assigned to be B1, B2
will restructure itself in place, i.e., the dummy (redundant) variables
and incorrect rows in B2 will get eliminated and a new set of variables and
equations that now refer to the global structure data from B1 will be
created. The choice of what B2 adds to the matrix initially when the global
structure instance is not present and later when it restructures is completely
up to the model writer. The only requirement is that B2 is square before
and after the global structure instance is assigned.
OOMFs default implementation of the abstract class AMFEOBlock,
AMFEOBlockImpl, provides all the necessary functionality. All OOMF
12 Global Structures
179
compatible models except the Aspen Plus EO models derive from this class
and inherit this new functionality. Hence, any OOMF model that derives from
AMFEOBlockImpl can choose to act as a global structure, a consumer of a
global structure, or both (if necessary). The implementation has the
following restrictions:
The instance of the model (AStruct) with global structure data must be
placed in the root container, i.e., outside hierarchy containers.
The name of the global structure parameter in the model (AModel) that is
a consumer of the global structure data must be different from the names
of the 13 default OOMF model parameters
"DERIV_METHOD", "INCLUDED", "MODEL", "PERT", "DIAG_LEVEL",
"NLRATIODEV", "NLRATIO", "ZEROTOL", "MOVE", "MOVEAMOUNT",
"SPARSITY_FILE", "SPARSITY_GEN", and "SPARSITY_TYPE".
A model that can be used as a global structure must set the structure data
variable start offset. This is an offset from the model's variable start
index. It must also set the number of consecutive structure data
variables.
A model that uses a global structure must set the generic type of the
global structure that it can consume. This is used for type checking when
the model is parameterized by the global structure instance.
Example
An example of how the global structure data within AStruct can be used within a
generic OOMF model AModel is presented in the example script that follows:
load lib "amodel"
load lib "astruct"
load lib "pltcon"
DEFINE SUPERPLANT myplant
END myplant
add block hier as myplant
add block b1 as astruct
push scope hier
add block b2 as amodel
add block PLT as pltcon
print var
print eqn
print jac
180
12 Global Structures
reset scope
print var
print eqn
print jac
solver dmo
dmo.rescvg=1e-8
solve
print var
print jac
solve
print var
solve
print var
solve
print var
reset scope
B5.ASTRUCT.VAR_1=8
solve
print var
blocks
//Reset b4's global structure instance to be nothing
b4.mystruct=""
print var
print eqn
print jac
solve
print var
12 Global Structures
181
182
12 Global Structures
This chapter describes the commands that let you use Aspen Properties data
in an OOMF simulation.
Input Language
LOAD PROP DATA filename
Aspen Properties file that contains the properties data. This file
usually has the extension aprpdf or appdf.
Input Language
FREE PROP DATA filename
183
Input Language
SWAP PROPERTY list
184
Aspen Plus embeds OOMF and extends its equation oriented capabilities. The
following sections explain how to use OOMF and these extensions from within
the Aspen Plus user interface or the engine.
From the Control Panel, set the strategy to Sequential Modular and
solve the problem. Then switch the strategy to Equation Oriented. This
will synchronize the EO strategy. Commands may be typed at the
Command Line near the bottom of the Control Panel.
From IAP
o
See Also
Standard OOMF - Using the Interactive Prompt
185
An external file that may be created with a standard text editor. The
extension of the file should be EBS.
Scripts may be defined within the Aspen Plus user interface as a LOCAL
script or a GLOBAL script. In the Aspen Plus user interface there is an
object manager for each of these at the flowsheet level and at each
hierarchy level. When you define a script in this manner, you type your
script commands into a text box in the Aspen Plus user interface.
Do not enter more than 64 characters per line, and do not begin lines
with more than 3 spaces within the Aspen Plus user interface. The scripts
are saved with the rest of the flowsheet input.
Local scripts are available only within the scope where they are defined.
Global scripts are available everywhere, regardless of scope. More
information on hierarchies and scope may be found in chapter.
Scripts may be defined in the INP (input language) file. Input in the INP
file must skip column one and may go to column 80. The script follows a
line with a GLOBALSCRIPT or LOCALSCRIPT keyword and the script name;
this line begins in column one. Use the following format:
GLOBALSCRIPT scriptname
SCRIPT 'first script line' / 'second script line' / &
'third script line' / &
'fourth script line' / 'fifth script line'
For more information on using scripts in the INP file, see Chapter 48 of
the Aspen Plus Input Language Guide.
Executing Scripts
Scripts may be executed in a number of ways:
186
By manually executing the script from the command line or from another
script. This may be done with the INVOKE, INVOKELOCAL and
INVOKEGLOBAL commands.
This method is executed when the block is created and is available for
all blocks except hierarchies.
PRESOLVE
POSTSOLVE
MIXSOLVE
The script that is assigned as the block method can be an external file, a
local script, or a global script. You can also manually execute a blocks
script method with the INVOKE command.
More on invoking scripts may be found in Invoke Commands.
See Also
Standard OOMF - Defining and Executing Scripts
Command Summary
In addition to the generic OOMF commands mentioned in previous sections,
the following commands are available within the Aspen Plus environment.
EO Commands
Command
Purpose
Apply the solver settings from the input file to the current mode.
DISABLE HXFLUX
DISABLE STREAM
ENABLE HXFLUX
ENABLE STREAM
HXFLUX
INVOKEGLOBAL
INVOKELOCAL
RECOVER
Recover from a bad EO solution by calling every block's pre and postsolve steps
REPORT ALL
REPORT APBLK
REPORT FLOWSHEET
REPORT FULL
Print a full Aspen Plus report for the current set of blocks and streams
REPORT STREAMS
SETCOMPLIST
STREAMS
SYNCHRONIZE
UPDATE BLEND
UPDATE PDF
See Also
Standard OOMF - Command Summary
187
Invoke Commands
These commands allow you to call, or invoke, other scripts. These may be
scripts that have been entered in the Aspen Plus user interface or external
files.
Input Language
INVOKELOCAL scriptid, arg1, arg2,
arg1,
arg2
Optional list of arguments passed to the script. This may be referenced in the
invoked script as &ARG1, &ARG2 etc. These are local script parameters and
thus only available within the invoked script. The total number of arguments
passed to the script file is available as &ARGC. The value returned to the
invoking script is available as &RET_VALUE.
Input Language
INVOKEGLOBAL scriptid, arg1, arg2,
arg1,
arg2
Optional list of arguments passed to the script. This may be referenced in the
invoked script as &ARG1, &ARG2 etc. These are local script parameters and
thus only available within the invoked script. The total number of arguments
passed to the script file is available as &ARGC. The value returned to the
invoking script is available as &RET_VALUE.
See Also
Standard OOMF - Invoke Commands
188
Miscellaneous Commands
Specific to Aspen Plus
Updating Crude Blends
This command is used to update the crude assays.
Input Language
UPDATE BLEND
Input Language
UPDATE PDF
Hierarchies
Aspen Plus has the following extensions that make it easier for a user to
create hierarchies.
See Also
Standard OOMF - Hierarchies
Hierarchy Input
Hierarchies have sets of input that are similar to what can be defined for an
entire flowsheet. These include:
Property methods.
Streams.
Blocks.
189
The type of input that may be entered for an EO configuration item is limited
by the scope.
Stream Commands
Adding and Removing Stream Connections
This command controls all the Aspen Plus stream connections within the
current scope.
Input Language
STREAMS status
Stream connection status. ALL indicates that all stream connections in the
current scope are to be added to the problem. NONE indicates that all the
stream connections in the current scope are to be removed from the
problem (they will not appear on the Inactive connection list). With no
argument, all the active stream connections in the current scope are
printed to the current report device.
Input Language
DISABLE STREAMS
Input Language
ENABLE STREAMS
190
HXFlux Commands
These commands are used to control the connections configured for HXFlux
blocks. These commands only affect the HXFlux connections defined through
the blocks input form and not connections defined through EO
Configuration | Connection forms.
Input Language
HXFLUX status
191
the problem remains square. (The Status on the GUI is not updated until an
Incremental Build or Solve is performed.)
Input Language
DISABLE HXFLUX
This command disables both the temperature and duty connections for all
HXFlux blocks in the current scope. A PRINT INACTIVE CONNECTIONS
command will show the disabled connections. This command no effect on
connections defined through the EO Configuration | Connection forms.
Input Language
ENABLE HXFLUX
Recovery Commands
These commands are used to restore the problem state after a failed solution.
Recovery
This command calls every block's pre and post-solve methods. This command
was introduced because Aspen Plus blocks use their post-solve method to
update SM block values after an EO solution. If the EO solution does not
converge, the EO variable values are bad and the SM data is corrupted with
bad values. In order to recover the state of the flowsheet, you must use the
RESET VARIABLES command to restore the EO variable values, followed by
this command.
192
Input Language
RECOVER
RECOVERFROMBADSOLUTION
See Also
Standard OOMF -Recovery Commands
Report Commands
These commands are used to generate an Aspen Plus report.
Reporting Everything
These commands print Aspen Plus report files. REPORT ALL prints
information on the current scope level only (not into any hierarchies).
REPORT FULL prints information on the complete flowsheet, regardless of
the current scope.
Input Language
REPORT ALL
REPORT FULL
Input Language
REPORT FLOWSHEET
Reporting Streams
This command prints a report of the specified streams to the report device.
Input Language
REPORT STREAMS stream_list
See Also
Standard OOMF Report Commands
193
194
Click Start | Run, type cmd and click OK to open a command window.
Add the path to the folder that contains oomf.exe (typically C:\Program
Files\AspenTech\OOMF\version\Xeq) and the path to the folder that
contains acmexp.dll (typically C:\Program Files\AspenTech\AMSystem
version\Bin) to the current path environment variable. For example:
set path= C:\Program Files\AspenTech\OOMF V7.3\Xeq;C:\Program
Files\AspenTech\AMSystem V7.3\Bin;%path%
See Also
Standard OOMF - Using the Interactive Prompt
195
Export the model from ACM and install it on your PC by following the
instructions given in the ACM user guide.
The examples which follow assume that the name of the model that you
exported is MyModel, it does not require physical property evaluations, and
the model DLL was installed in the folder
C:\AMModels\MyModel\
The italic sections in these examples should be updated to match your
situation.
2
add block b1 as
acmexp("model=mymodel,library=mymodel,path=C:\AMModels\MyModel")
or
add block b1 as acmexp("model=C:\AMModels\MyModel\MyModel")
solver sparse
6
solve
7
quit
If the exported ACM model requires Aspen Properties to evaluate physical
properties of components, then review the example applications listed in the
document titled A Programmers Guide to OOMF that illustrate the steps
needed to load the components listed in an Aspen Properties file, implement a
host component list manager, and analyze the simulation.
196
Steady State
Initialization
Dynamic
This mode is normally set by the solver and should not be modified
by scripting.
Procedure_Mode
IncrementalUpdate Enable model dependency updates (1, 0). Each 0 (Off) call must be
matched with a 1 (On).
Solution_Mode
SM_Status
EO_Status
DOF
Equation Oriented
Sequential Modular
(Read Only) The status of the block under its sequential modular
container:
Not Converged the last solution using the block did not
converge
(Read Only) The status of the block under its equation oriented
container
Not Converged the last solution using the block did not
converge
197
198
Command Summary
In addition to the generic OOMF commands mentioned in previous sections,
the following commands are available within the Aspen HYSYS Refining
environment. These commands are implemented in the OOMF loadable DLL
called refcmds.
199
EO Commands
Command
Purpose
CONNECTIONSTATUS
INITAPROP
SWAPPROP
VARSINSPECGROUP
See Also
Standard OOMF - Command Summary
200
Index
Index
201
202
customer support, 7
DATE script parameter, 27
DEFAULT_FLUSHING script
parameter, 24, 27
DEFINED script function, 41
Degrees of freedom, checking, 125
Deleting a snapshot
script command, 149
Deleting a task
script command, 147
DELTLS LSSQP parameter, 134
DERDIF LSSQP parameter, 136
DERIV_METHOD block attribute, 63
Derivative Commands. See
Jacobian and Derivative
Commands
DERIVATIVE script command, 123
DERMIN LSSQP parameter, 136
DEVICEINFO script function, 40
DIAG_LEVEL script parameter, 27
DIRECTION Objective function
attribute, 119
DISABLE CONNECTION script
command, 86
DISABLE HXFLUX script command,
191
DISABLE MEASUREMENT script
command, 92
DISABLE SPECIFICATION GROUPS
script command, 80
DISABLE STREAMS script
command, 190
Divergent_steps NSOLVE
parameter, 136
DMO script command, 129
DPERTF LSSQP parameter, 136
DROPTOL DMO parameter, 130
DYN_INTERVAL
script parameter, 145
DYN_RUN_TO
script parameter, 145
e-bulletins, 7
ECHO script command, 143
ENABLE CONNECTION script
command, 86
ENABLE HXFLUX script command,
192
ENABLE MEASUREMENT script
command, 92
ENABLE SPECIFICATION GROUP
script command, 80
ENABLE STREAMS script command,
190
Index
203
204
Index
206
WHILE-DO constructs, 36
PROMPT script parameter, 28
PUSH SCOPE script command, 57
QPINFE LSSQP parameter, 133
QPSTATS DMO parameter, 131
Query
Printing variables with, 71
Query script functions, 41
QUERYVARS script function, 41
QUIT script command, 50
READ SNAPSHOT script command,
106
READ VARFILE EXCEPT script
command, 104
READ VARFILE script command,
104
READ_VARFILE_MASK script
parameter, 28
RECOVER script command, 192
Recovery commands
Recovery, 192
Resetting variables, 138
Redirecting output and Journaling
Examining the output devices, 25
Flushing, 24
Journaling, 24
Redirecting the output of a
command, 21
the history device, 23
the report device, 23
Reinitializing a simulation
script command, 147
Relational script functions, 40
RELAX_TOL script parameter, 28
RELEPS LSSQP parameter, 132
REMOVE CONNECTIONS script
command, 84, 85
REMOVE SPECIFICATION GROUPS
script command, 79, 146, 147,
148, 149
REMOVESTR script function, 39
REPORT ALL script command, 193
REPORT BLOCKS script command,
144
Report Commands
Reporting blocks, 144
Reporting everything, 193
Reporting streams, 193
Reporting the flowsheet, 193
Reporting the objective function,
144
REPORT FLOWSHEET script
command, 193
Index
Unsetting, 30
SCRIPT_PATH script parameter, 29
Scripts
Defining, 5, 186
Executing, 5, 186
Global, defined, 5, 186
Local, defined, 5, 186
SEARCHMODE DMO parameter,
130
SENSITIVITY script command, 125
SET script command, 29
SIN script function, 38
SINGT1 LSSQP parameter, 134
SINGT2 LSSQP parameter, 134
SMLSCL LSSQP parameter, 134
snapshot, 149
SOFT_BOUND script parameter, 29
SOLVE script command, 137
Solver commands
Entering DMO parameters, 129
Entering LSSQP parameters, 131
Entering NSOLVE parameters,
136
Setting the solver, 129
Solving the problem, 137
Viewing solver settings, 129
SOLVER script command, 129
SOLVER SETTINGS script
command, 129
SPDROP LSSQP parameter, 134
SPEC Stream attribute, 83
SPEC variable attribute, 66
SPECGROUPSBYVAR script
function, 41
Specification Group Commands
Disabling Specification Groups,
80
Enabling Specification Groups,
80
Printing inactive specification
groups, 80
Printing Specification Group
variables, 81
Printing specification groups, 80
Removing Specification Groups,
79, 146, 147, 148, 149
Specification variable attribute, 66
SQRT script function, 38
Stabilization NSOLVE parameter,
137
Stable_iterations NSOLVE
parameter, 136
START TIMER script command, 50
207
208
Index
Index
209