Specifications

3-58 Extension Unit Operations
3-58
7. The first function declared is the Initialize function. It is
called when the extension is first added to HYSYS or when a
case containing the extension is loaded.
Dim H2O As Integer
The index for water.
Dim Temp As Variant
Temporary variable.
Dim MoleFl As Variant
Array of molar flows.
Dim Count As Integer
Count variable.
Dim i As Integer
Count variable.
Dim IsKnownFeedArray As Variant
Are the feed streams in the array valid.
Dim CalcError(0 to 1) As Boolean
Error level used to display status messages.
Dim IsIgnoredBool As Boolean
Indicates if the unit op is ignored.
Const conEmpty As Integer = -32767
-32767 is used internally by HYSYS to
represent an empty value.
Code Explanation
Code Explanation
Public Function Initialize(ByVal Container As
Object, ByVal IsRecalling As Boolean) As Long
Initialize is called when the extension is
first added to the simulation or when a
simulation case containing the extension
is loaded.
On Error GoTo ErrorTrap
Enable Error trapping.
CalcError(0) = False
CalcError(1) = False
Initialize variables.
Initialize = extnCurrentVersion
Reference the current HYSYS version.
Set hyContainer = Container
Set myOp = hyContainer.ExtensionInterface
This reference lets the extension interact
with HYSYS through the extension
container, the
ExtnUnitOperationContainer object.
Methods from the ExtensionObject
object are also available.
Set Components =
hyContainer.Flowsheet.FluidPackage.Component
s
WaterPresent = False
For Each Component In Components
If Component.Name = "H2O" Then
WaterPresent = True
Next
If WaterPresent Then H2O =
Components.Index("H2O")
Get the list of components that are
currently attached to the fluid package.
For each component in the list, determine
if water is one of the components.
If water is present, determine the
internal index number of water.