Specifications

Extensibility 3-59
3-59
8. The other function that is required to implement a Unit
Operation Extension is the Execute function.
Set hyFeedStrm =
hyContainer.FindVariable("FeedStream").Varia
ble.object
Set hyProdStrm =
hyContainer.FindVariable("ProductStream").Va
riable.object
Set hyWatStrm =
hyContainer.FindVariable("WaterStream").Vari
able.object
Set an object reference to the Feed,
Product and Water stream attachment
objects in the EDF.
If IsRecalling = False Then
End If
IsRecalling is False when the extension
is first added to the simulation,
IsRecalling is True when a saved
simulation case containing the extension
is loaded. The If statement uses
IsRecalling to set defaults. Saturate has
no default values, so none are set here.
ErrorTrap:
Line to which the On Error statement
branches if an error occurs.
End Function
Signifies the end of the function. This line
does not need to be added.
Code Explanation
Code Explanation
Public Sub Execute(ByVal Forgetting As Boolean)
This sub-routine is called whenever the
extension is executed.
On Error GoTo ErrorTrap
Enable Error trapping.
If Not Forgetting Then
When a change is made to a variable
which affects the extension, HYSYS
performs a Forgetting pass and two
Calculation Passes. The Forgetting pass is
used to identify the streams, unit
operations, etc. affected by the change.
The first Calculation pass is used to allow
the extension to complete its internal
calculations. The second Calculation pass
is made so that external references made
by the extension use correct values. If
the extension makes no external
references, then the second pass can be
bypassed using the SolveComplete
method of the Container object. This
command is included later in the code.
For efficiency, no calculations are made
during the Forgetting pass.