Jump to content



Featured Articles

Check out the latest featured articles.

File Library

Check out the latest downloads available in the File Library.

New Article

Product Viscosity vs. Shear

Featured File

Vertical Tank Selection

New Blog Entry

Low Flow in Pipes- posted in Ankur's blog

1

Using Vector User Variable In Hysys

hysys vector user variable

No replies to this topic
Share this topic:
| More

#1 Ulbert Zsolt

Ulbert Zsolt

    Brand New Member

  • Members
  • 2 posts

Posted 01 March 2024 - 07:47 PM

Hello, I would like to use a vector user variable in Hysys V14. For example, I  prepared the following code to create a vector user variable using stream temperature: 
 
Sub PostExecute()
    Dim hysysuv As HYSYS.InternalRealFlexVariable
    Dim varVals As Variant
    Dim Count As Integer
    Dim myFluid As Object
    On Error GoTo GetOut
    Set myFluid = ActiveObject.DuplicateFluid
    'Linking to wrapper to hysysuv variable
    Set hysysuv = ActiveVariableWrapper.Variable
    'Setting the range
    hysysuv.SetBounds 2,0,0
    'Retrieving an array of values
    varVals = hysysuv.Values
    'Calculating values using stream temperature
    For Count = 0 To 1
            varVals(Count)= Count*myFluid.Temperature
    Next
    'varVals into hysysuv
    hysysuv.SetValues varVals,"C"
    'Retrieving values (using unit Kelvin)
    varVals = hysysuv.GetValues  ("K")
GetOut:
End Sub
 
I debugged the code and it looks working well, but in the user variable property windows only the <Multidimensional> word is displayed for my multidim user variable (see the attached picture). When I try to send this variable to a spreadsheet object a <empty>  value is only inserted.
Does someone know how I can see the results of a vector variable variable and use its components?
 
Thank you,
Zsolt

Attached Files






Similar Topics