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

Hysys User Variable Code

hysys user vaiable

This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic
Share this topic:
| More

#1 amiprocess

amiprocess

    Junior Member

  • Members
  • 15 posts

Posted 09 December 2013 - 01:04 AM

I am trying to calculate pipe thickness by coding in hysys using user variable option. I am using pipe segment where the user variable is available. To calculate pipe thickness I need some parameters given below.

 

1. Temperature(T) and Pressure(P) of inlet stream of pipe segment.

2. Diameter and thickness selected inside the pipe segment.

 

The problem is I can read T,P from the stream easily by using my code.

===========================

Sub PostExecute()
  On Error GoTo ErrorHandler
   Dim myFluid As Object
   Dim T ,P, Thk,OD,S,E,Y,CA As Double
 
   Set myFluid = ActiveObject.DuplicateFluid
 
'initial variable---------------------------
S=20*10^3 'strength
 
 
Y=0.4 '(API 14E)
CA=0.118 'inch (Corrosion Allowance)
OD=1.939 'inch Outer Diameter
E=1.0 'joint efficiency
'-------------------------------------------
T=myFluid.Temperature.GetValue("F")
P=myFluid.Pressure.GetValue("Psig")
P=P*1.2 'design pressure
 
Thk=P*OD/2.0/(S*E+P*Y)+CA
 
'thickness
ActiveVariableWrapper.Variable.SetValue Thk,"in"
   ErrorHandler:
   Exit Sub
 
End Sub
=======================================
 
This code is working when I write it inside the Stream User Variable code window.
But I want to read these data (T,P, OD) from Pipe Segment User Variable code window. 
Can anyone help me. Is there any document where I can get code sample regarding Pipe Segment User Variable Coding?
 
Regards
 
 
 





Similar Topics