Specifications
Automation 2-57
2-57
3. At this time it is probably a good idea to globally declare
some constants that are used in the Main sub-routine as
shown below.
4. You can now begin defining the Main sub-routine. Enter the
following code:
Figure 2.10
Code Explanation
Sub Main
Signifies the beginning main
sub-routine.
pipeSizes(1) = 2
pipeSizes(2) = 3
pipeSizes(3) = 4
pipeSizes(4) = 6
pipeSizes(5) = 8
pipeSizes(6) = 10
pipeSizes(7) = 12
pipeSizes(8) = 16
Defines an array of pipe
sizes (in inches).
Dim simcase As Object
Set simcase = ActiveCase
If simcase Is Nothing Then
MsgBox “No HYSYS case is open.”
End
End If
Looks for an open active
case. If there is no active
case, it alerts the user and
terminates.
Dim strm As Object
Set strm = SelectStream(simcase)
Calls the SelectStream
function to select a stream
in the simcase.