HOME  |  KNOWLEDGE BASE  |  HOW TO BUY  |   MY PROFILE 

US & Canada 1-800-786-8545 / International 1-360-292-4050
SEARCH:


Writing Excel Macros for use with PIPE-FLO .txt File

  • Print this page
    Print this page
  • Remove Highlighting
    Remove Highlighting
  • Edit this Article
    Edit this Article
  • Export to PDF
    Export to PDF
You can save your PIPE-FLO system design data and calculated results to a text file and then import them later into word processing or spreadsheet programs.  A sample Excel macro is provided that demonstrates how to read and use the data in the text file.

get PF data.xls Macro
The macro contained in Excel file "get PF data.xls" stores the PIPE-FLO .txt file pipeline and device data in two, 2-demensional arrays [pipe(i,j) and device(i,j)].  System unit data is stored in a 1-demensional array, units(i).

Subroutine "Get_data()" fills the arrays.  Two additional subroutines ("setup()" and "writedata()") are also included in the Excel file to demonstrate how you can use the array data.  These subroutines set up a new worksheet and then write the data stored in the arrays to the new sheet.

To run the macro:
1) Open "get PF data.xls."
2) Open a PIPE-FLO .txt file in Excel.
3) Press the Alt + F8 keys.
4) Select 'get PF data.xls'!Get_data from the list of macros.
5) Click the Run button.

The macro reads in the data from the .txt file and writes it out to a new worksheet.  Note: If you want to remove the subroutines that write out the data, comment out the subroutine calls below the "SAMPLE SUBROUTINES" comment in the "Get_data()" subroutine.

Below is a listing of the data stored in the pipe() and device() arrays.

Pipeline array:
pipe(n,1) = pipe name
pipe(n,2) = status
pipe(n,3) = from node
pipe(n,4) = from node elevation
pipe(n,5) = to node
pipe(n,6) = to node elevation
pipe(n,7) = length
pipe(n,8) = inside diameter
pipe(n,9) = total K value
pipe(n,10) = flow rate
pipe(n,11) = roughness
pipe(n,12) = density
pipe(n,13) = viscosity
pipe(n,14) = vapor pressure or k
pipe(n,15) = pressure drop
pipe(n,16) = head loss
pipe(n,17) = pipe head loss
pipe(n,18) = minor head loss
pipe(n,19) = Reynolds number
pipe(n,20) = friction factor

Where n = 1 to the number of pipelines

Device array:
Nodes
device(n,1) = node name
device(n,2) = status
device(n,3) = pressure
device(n,4) = grade
device(n,5) = elevation
device(n,12) = device type
device(n,13) - device(n,18) = connecting pipelines

Tanks
device(n,1) = tank name
device(n,2) = surface pressure
device(n,3) = level
device(n,4) = status
device(n,5) = flow
device(n,6) = pressure
device(n,7) = grade
device(n,8) = elevation
device(n,12) = device type
device(n,13) = connecting pipeline

Demands
device(n,1) = demand name
device(n,2) = set value
device(n,3) = flow
device(n,4) = pressure
device(n,5) = status
device(n,6) = grade
device(n,7) = elevation
device(n,12) = device type
device(n,13) - device(n,18) = connecting pipelines

Pumps
device(n,1) = pump name
device(n,2) = operation
device(n,3) = flow
device(n,4) = status
device(n,5) = TDH
device(n,6) = dP
device(n,7) = NPSHa
device(n,8) = suction pressure
device(n,9) = discharge pressure
device(n,10) = suction elevation
device(n,11) = discharge elevation
device(n,12) = device type
device(n,13),  device(n,14) = connecting pipelines

Components
device(n,1) = component name
device(n,2) = flow
device(n,3) = status
device(n,4) = HL
device(n,5) = dP
device(n,6) = inlet pressure
device(n,7) = outlet pressure
device(n,8) = inlet elevation
device(n,9) = outlet elevation
device(n,12) = device type
device(n,13),  device(n,14) = connecting pipelines

Controls
device(n,1) = control name
device(n,2) = control type
device(n,3) = set value
device(n,4) = status
device(n,5) = flow
device(n,6) = dP
device(n,7) = HL
device(n,8) = inlet pressure
device(n,9) = outlet pressure
device(n,10) = elevation
device(n,12) = device type
device(n,13),  device(n,14) = connecting pipelines

where n = number of devices

Units array:
units(1) = flow rate unit
units(2) = pressure unit
units(3) = dP unit
units(4) = length unit
units(5) = size unit
units(6) = density unit
units(7) = velocity unit
units(8) = elevation unit

Related Articles

No related articles were found.

Attachments

Article Details

Last Updated
11th of May, 2009

Version
2005, 2007, 2009

Program
Flow of Fluids, PIPE-FLO Lite, PIPE-FLO Professional

Would you like to...

Print this page Print this page Email this page Email this page Remove Highlighting Remove Highlighting Edit this Article Export to PDF

User Opinions (0 votes)

No users have voted.

How would you rate this answer?



Thank you for rating this answer.

Visitor Comments

No visitor comments posted. Post a comment

Post a comment

To post a comment for this article, simply complete the form below. Fields marked with an asterisk are required.

Entering your email address is optional. It will not be displayed on this page, but may be used by our staff to contact you regarding your comment.

For technical support, please do not use this form. Use our Web Support Form or email solutions@eng-software.com, instead.

   Name:
   Email:
* Comment:
* Enter the code below: