Specifications
User Unit Operation 6-9
6-9
The three User Unit Operation sub-routines are described in the
following table:
Empty versions of these three sub-routines are automatically
generated for each new User Unit Operation Type.
The left border of the Code page is a development tool for you to
use as you add code to your operation. You may add break
points in this border thereby allowing you to step through your
code. Simply click the primary mouse button in the margin on
the left side of the code pane next to the line you want to insert
the break for.
Sub-routine Action
Initialize() Called immediately before the first time Execute is
called. This sub-routine should be used to set up the
unit operation. Decide which nozzles are valid and
name them; create any variables that will be needed
and give them initial values, etc.
Execute() Called whenever a trigger solve variable of the unit
operation is changed, and whenever any of its attached
streams re-calculates. This sub-routine should perform
all of the unit operation’s calculations. In this sub-
routine only, it is permissible (and recommended) to
use the Calculate method to write data to variables of
the operations attached streams. These variables are
then displayed in black in HYSYS, and cause an
inconsistency error if any other object attempts to
calculate their values.
StatusQuery() Called whenever HYSYS wants to update the status
information for its objects. This sub-routine should be
used to provide warning and error messages for any
missing connections, missing variable values, etc.
These messages will be displayed in the HYSYS status
bar, as well as at the bottom of the User Unit
Operation’s property view.
It is recommended that any sub-routine that you do not
want to be implemented be deleted or turned in to comments
by preceding each line with the single-quote comment
character. This ensures that HYSYS does not waste time
calling an empty sub-routine. The sub-routine can be
implemented or un-commented at any time.