You are on page 1of 103

PIPESIM

Open Link
Schlumberger 2 Open Link

Copyright 2008 Schlumberger. All rights reserved.


No part of this manual may be reproduced, stored in a retrieval system, or translated in any form or by
any means, electronic or mechanical, including photocopying and recording, without the prior written
permission of Schlumberger Information Solutions, 5599 San Felipe, Suite 1700, Houston, TX 77056-
2722, USA.
Use of this product is governed by the License Agreement. Schlumberger makes no warranties, express,
implied, or statutory, with respect to the product described herein and disclaims without limitation any
warranties of merchantability or fitness for a particular purpose. Schlumberger reserves the right to revise
the information in this manual at any time without notice.

PIPESIM
Schlumberger 3 Open Link

Table of Contents
Open Link Reference Manual .............................................................................................................................. 5
Overview ................................................................................................................................................... 5
Modules and Interfaces ........................................................................................................................... 6
Quick Start Tutorial .............................................................................................................................................. 7
Loading and running an existing model ................................................................................................ 7
Getting results .......................................................................................................................................... 9
Changing BlackOil fluid parameters ...................................................................................................... 9
Changing a choke property ..................................................................................................................... 9
Saving the changes................................................................................................................................... 9
Case Study 1 Building a Well Model from Excel .......................................................................................... 11
Problem Outline ..................................................................................................................................... 11
Requirements.......................................................................................................................................... 11
Procedure................................................................................................................................................ 11
Step by step tutorial............................................................................................................................... 11
Case Study 2 - Nodal Analysis............................................................................................................................ 21
Problem Outline ..................................................................................................................................... 21
Requirements.......................................................................................................................................... 21
Procedure................................................................................................................................................ 21
Step by Step Tutorial ............................................................................................................................. 21
Modules and Interfaces ...................................................................................................................................... 27
ISingleBranchModel Interface.............................................................................................................. 27
IObjectProperties Interface .................................................................................................................. 31
ITubing Interface.................................................................................................................................... 32
IVertCompObj Interface ........................................................................................................................ 34
IFlowlineObj Interface .......................................................................................................................... 35
IHeatTransfer Interface ......................................................................................................................... 35
IFluid Interface....................................................................................................................................... 36
IProjectInfo Interface ............................................................................................................................ 37
IErosionCorrosion Interface................................................................................................................. 37
INetModel Interface............................................................................................................................... 38
ModelBuilder object .............................................................................................................................. 43
IBlackOil object...................................................................................................................................... 43
ISinglePointCalib object........................................................................................................................ 44
IMultiPointCalib object ......................................................................................................................... 45
IViscosityData object............................................................................................................................. 46
IThermal object ...................................................................................................................................... 47
ICompositional object ........................................................................................................................... 48
FlowCorrelations Interface................................................................................................................... 51
Single Branch Operations...................................................................................................................... 52
Systems Analysis .................................................................................................................................... 52
Pressure and Temperature Profiles ..................................................................................................... 54
Flow Correlation Matching ................................................................................................................... 55
Nodal Analysis ........................................................................................................................................ 56
Wax Deposition ...................................................................................................................................... 58
Single Branch Operations: Supporting Interfaces.............................................................................. 59
IBoundaryProps Interface..................................................................................................................... 59
IEngineOptions Interface ...................................................................................................................... 59
Gas Lift Diagnostics COM Object......................................................................................................... 59
GLWell Interface and Object................................................................................................................. 59
IGLDesign Object ................................................................................................................................... 66
IDesignParams Object ........................................................................................................................... 69
IDesignBias Object................................................................................................................................. 69
IGLValveSystem Object ......................................................................................................................... 70
Single Branch Output Reader COM ..................................................................................................... 71
PerformCurve Object............................................................................................................................. 75

PIPESIM
Schlumberger 4 Open Link

PNSReaderCOM ..................................................................................................................................... 77
Inflow Performance Calculator COM .................................................................................................. 83
Units Library ........................................................................................................................................... 85
Defined constants and strings ........................................................................................................................... 87
Object Type Identifiers .......................................................................................................................... 87
Object Properties ................................................................................................................................... 87
Tubing objects properties .................................................................................................................... 91
Artificial Lift............................................................................................................................................ 93
Completion Options............................................................................................................................... 93
IPR Types (Vertical)............................................................................................................................... 93
IPR Types (Horizontal).......................................................................................................................... 94
IPR Options (Horizontal) ...................................................................................................................... 94
Fluid Types ............................................................................................................................................. 94
Pipe Flow Types..................................................................................................................................... 94
Rate Types............................................................................................................................................... 94
Separator Types ..................................................................................................................................... 94
Single Branch Operations...................................................................................................................... 94
Unit System.......................................................................................................................................................... 96
Case Studies......................................................................................................................................................... 99
Detailed explanation of routine............................................................................................................ 99

PIPESIM
Schlumberger 5 Open Link

Open Link Reference Manual


Overview
This guide is designed to explain how to use Open Link to interface with PIPESIM from external
applications.
An overview of the functionality of Open Link is provided along with the necessary interface
functions and arguments. This allows you to load both network and single branch PIPESIM
models, query them (equipment configuration, gas lift injection, etc.), and perform simulations.
Basic Functions
The functions described in this document fall into the following categories;
Get functions - Get the results after a simulation or query an item for its current data value,
such as obtaining the choke bean size.
Set functions - Set a valve to be used in subsequent simulation, such as setting the reservoir
pressure.
Operation functions - Perform an operation on a model, such as running a simulation.
Potential Usage
The Open Link functionality could be used in the following cases:
Running PIPESIM in batch mode with a number of scenarios
Creating custom reports
Importing production data from a database and populating the models
Running PIPESIM in-conjunction with other Engineering applications. Hyprotech have already
used this functionality to link Hysys and PIPESIM.
Utilizing Open Link
The Open Link functions can be called from any of the following:
VBA macro. This could be written in Excel, Access, etc.
Visual Basic programs.
C++ programs
Supported Interfaces
INetModel: for network models and network operations
ISingleBranchModel: for single branch models and operations
Dependency MAP
Open Link can be used to access PIPESIM functionality from external programs. The programs
that can automate PIPESIM simulations are those that are defined as automation clients
according to Microsoft standards, and in the same way, Open Link is an automation server.
Typical examples of automation clients include VBA (Visual Basic for Applications) macros, which
can be written from programs such as Excel or Access, C++ and Visual Basic. Open Link provides
therefore an open architecture where you control and automate PIPESIM simulation models
through custom programs or macros without having to manually enter the data or view the results
using the graphical interface. It is assumed you are familiar with both PIPESIM and the chosen
program or programming language in which the automation code is to be written. Those new to
VBA are recommended to closely follow the Quick Start Tutorial and the Case Studies.
The Open Link functionality is distributed with the PIPESIM installation and is included in a
number of library files.
The main file is Net32COM.DLL, which normally resides in the programs directory and
provides the framework and main entry points into both networks and single branch
simulation models. Net32COM.DLL must be copied to the PIPESIM programs directory and
registered.
There are other files that support Net32COM, for instance FluidModelCOM.DLL and
FlowCorrelationCOM, which provide access to properties defined in the fluid models and flow
correlations respectively.
Each library file, in turn, defines at least one interface, which is a logical entry point into a
well-defined area of functionality. Each interface includes a number of public access functions
that set or get a specified property or just perform operations (that is run a simulation). As
an example the FluidModelCOM library defines two interfaces: IBlackOil, for black oil models
and ICompositional, to deal with compositional models. IBlackOil defines property functions

PIPESIM
Schlumberger 6 Open Link

such as API, Watercut or GasSG. These properties can be set (assigned) to a model prior to a
simulation run or they can be get (retrieved) and copied into an Excel cell.
The Modules and Interfaces section lists the modules and interfaces that are part of Open Link.
This document contains further details of the modules and interfaces, together with some code
samples. Highlighted items represent information that is new, previously unpublished or amended
from the previous PIPESIM release. The present reference guide applies to the release version
2008.
Modules and Interfaces
Module Name Interfaces Remarks
Net32COM.DLL INetModel Network models and operations
ISingleBranchModel Single branch models and operations
IObjectProperties Generic equipment properties
TubingObj Tubing specific properties and operations
InjectorObj Injector specific properties
VertCompObj Vertical completion specific properties
FlowlineObj Flowline specific properties and operations
ErosionCorrosion Erosion and corrosion settings
HeatTransfer Heat transfer properties
PSOpSystems.DLL IISystemsAnalysis Systems Analysis operation
IIPTProfile Pressure/Temp Profiles operation
IICorrMatching Flow Correlation Matching operation
NodalOp.DLL IINodalAnal Nodal Analysis Operation
FluidModelCOM.DLL IBlackOil Black Oil model properties
ICompositional Compositional model properties
SinglePointCalib BO single point calibration properties
MultiPointCalib BO multipoint calibration properties
ViscosityData BO viscosity properties
Thermal BO thermal properties
FlowCorrelationCOM.DLL CIFlowCorrelation Vertical and horizontal flow correlation
properties
UnitsCOM.DLL IUnitSystem General unit conversions
GLDiagn.DLL GLWell Gas lifted well model for diagnostics
WaxOp.DLL IWaxOp Wax deposition operation

PIPESIM
Schlumberger 7 Open Link

Quick Start Tutorial


This quick start guide shows macro code written in VBA using Microsoft Excel. Even though each
language implements its own particular syntax, the basic logic to write an Open Link code or
macro will be identical. A number of case studies along with VBA code using Excel are provided
under the ..\Case Studies\Open Link directory.
1. Before you start - you must let VBA know about the Open Link interfaces. To do this, click
on Tools | References from the main menu in the VBA window. You should now see a dialog
box like the one below.

2. Scroll down the list of available references until you find the Net32COM 1.0 Type Library.
Check the box to the left of the reference.
3. Now do the same for the FluidModelCOM 1.0 Type Library and for PNSReader 1.0 type library.
4. Click on OK to close the References window.
Loading and running an existing model
1. Load the existing network model: Small Network.bpn, which is shipped with the PIPESIM
installation and normally located in:
C:\Program Files\Schlumberger\PIPESIM\Case Studies\Network
Analysis\Small Network\
If the model were opened from the PIPESIM graphical interface it would look like the picture
below:

PIPESIM
Schlumberger 8 Open Link

2. Using the VisualBasic editor (you can quickly open it from Excel using the shortcut Alt+F11)
create a variable of the type INetModel to perform the basic interaction with the network
model. We will call it NetModel:
Dim NetModel As New NET32COMLib.INetModel
3. Open the model:
NetModel.OpenModel C:\Program Files\Schlumberger\PIPESIM\Case
Studies\Network Analysis\Small Network\Small Network.bpn
4. Run the model (asynchronously):
NetModel.RunNetwork2 False, "-B"
The first argument, in this case False tells the calculation engine not to use a restart file and the
second argument -B is an engine switch that instructs the engine to run in batch mode. For more
information on engine commands please refer to the PIPESIM help.
When executing this macro you should see the calculation engine running in the background. This
process is run asynchronously which means that the macro will continue its execution without
waiting for the simulation run to finish.
If you want your macro to stop until the engine terminates in order to, say, display a result,
then you can replace the line above by the following code:
NetModel.RunNetwork2 False, "-B"
bRunning = NetModel.GetIsModelRunning
While bRunning = True
bRunning = NetModel.GetIsModelRunning
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Wend
MsgBox "Finished..."
This code will run the simulation synchronously. It starts the simulation and then waits until it is
finished. It checks every one second for the engine status through a call to GetIsModelRunning.
When GetIsModelRunning it returns False indicating that the simulation run is finished, the
macro code displays a message box.

PIPESIM
Schlumberger 9 Open Link

Getting results
We would like to display some results from the simulation. The library that reads the results file is
PNSReader and we must create a variable of the type PNSCom in order to extract data from the
simulation output. The public access functions available in PNSReader are detailed in
PNSReaderCOM.
1. Create a PNSCom variable, lets call it results:
Dim results As New PNSREADERLib.PNSCom
2. Read the results file. This file is located in the same directory as the model file and has the
same file name but with the extension .pns:
results.ReadPnsFile(C:\Program Files\Schlumberger\PIPESIM\Case
Studies\Network Analysis\Small Network\Small Network.pns)
3. Get the pressure and temperature at the sink Sink_1 (see model picture above)
Dim index as Long
Dim pressure as Double
Dim temperature as Double
index = results.GetNodeIndex(Sink_1)
pressure = results.GetNodeVariableValue (index, "Pressure")
temperature = results.GetNodeVariableValue (index, "Temperature ")
In the same way variables such as LiquidRate, GasRate, MassRate, GLR or WaterCut can
be obtained for Sink_1 or any other node in the network.
Changing BlackOil fluid parameters
So far, we have opened, run and obtained results for a network model as it was originally defined
within the PIPESIM graphical interface. In this step, we will change some parameters to the
opened model. Here is where the true power of Open Link starts to show, the Excel spreadsheet
may define a range of values to be tested in the context of a what if scenario and multiple
simulation jobs may be set up to compare results for a range of input values for one or more
properties.
1. Create a BlackOil variable:
Dim BlackOil As New FLUIDMODELCOMLib.IblackOil
2. Get the BlackOil model from the network
Set BlackOil = NetModel.BlackOilDefault
The BlackOil variable has been filled with the values defined in the blackoil model in NetModel.
You can corroborate this by adding a watch with the VBA debugging tool and inspecting the
different variable fields.
3. Set a Watercut value of 15%:
BlackOil.Watercut = 15
4. Set an API value of 27.5:
BlackOil.API = 27.5
5. Set this BlackOil with a modified watercut and API back into the network:
NetModel.BlackOilDefault = BlackOil
6. You can now re-run the model with this new values, get the new results, display them in an
Excel cell or plot, etc.
Changing a choke property
1. The following piece of code sets a new value for the choke bean size in Choke which is
defined in the single branch model that corresponds to the production well Well_1.
NetModel. SetPropertyVal (Choke, Well_1, "Bean Size", 3.5,
"inches")
The above line sets bean size = 3.5 inches to Choke in Well_1. .
Saving the changes
1. Any changes made to a single branch or network model can be saved simply by calling the
SaveModel() function.
Dim bOK as Boolean
bOK = NetModel.SaveModel(C:\MyOpenLinkModels\Network.bpn)

PIPESIM
Schlumberger 10 Open Link

The argument is the full path to the file where the model will be saved. It can also be re-saved to
the original model file.
2. bOK will be TRUE (1) or FALSE (0) depending on whether the save operation succeeded or
not. As with all Open Link function calls that return a TRUE/FALSE state, a FALSE value
indicates that some kind of error condition occurred and an error description can be obtained
by calling GetLastError():
Dim Error as String
If bOK = False Then
NetModel.GetLastError Error
MsgBox errorStr
End If

PIPESIM
Schlumberger 11 Open Link

Case Study 1 Building a Well Model from Excel


Problem Outline
It is often desired to build PIPESIM well models from a corporate database. The problem can be
solved by:
1. Pasting the wells data in excel.
2. Using a VBA routine containing Open Link statements to automate the Bps files creation.
This case study illustrates the resolution of such a problem.
Requirements
It is assumed that the reader is familiar with the basics of building models in PIPESIM.
No prior knowledge of VBA (Visual Basic For Application) is required. VBA is a programming
language that is accessed from Microsoft Excel. VBA statements can be used to interact with
Microsoft Applications. These statements cannot interact with PIPESIM. Open Link is the name
given to a group of statements that can be used in VBA to interact with PIPESIM.
Procedure
1. Create a Well Model Template. (That is build a well model in PIPESIM but do not fill any of
the objects that make up the model with values). Save the well model template with the name
template.bps.
2. Organize the wells data in tabular form in Excel.
3. Write the VBA routine that will create a Bps file for each well of the spreadsheet. (The routine
will make use of the model template.bps as will be shown further down in the text).
4. Run the routine The Bps are created and stored in a directory specified in the routine.
Step by step tutorial
Create a Well Model Template
1. Open PIPESIM Open a new well performance analysis window as shown below.

2. Create the following Well Model in the opened window.


3. Save the model with the simple model description selected in both the tubing object and the
flow line object. This is done by double-clicking on both the flowline_1 and tubing_1 object,
selecting simple model in each user form and pressing on the button OK.

PIPESIM
Schlumberger 12 Open Link

4. Save the well model under the name template.bps with the following path:
D:/OpenLink/template/template.bps
Create a table of wells data in Excel (2 vertical gas wells)
1. Open Excel.
2. In the Opened workbook, select sheet 1 (the sheet should be selected by default).
3. Create the following table in Excel (4 Rows 24 Columns).

4. Start the table at the cell $A$4 and finish at the cell $X$7.
5. List of the 24 columns (A to X in order) (The values are given for each column):
A: General Data:
Index. (1,2)
Field. (Field1, Field2)
Well Number (435,436)
Gathering Station (Man1,Man2)
B: Black Oil Data:
Gas Gravity (lbs/cu.ft gas sc) /(lbs/cu.ft air sc). (62,62)
Oil API (Field1, Field2)
GOR scf/bbl (800000,900000)
Water Cut % (10,20)
C: Completion Data:
Pws Psia (Static pressure of the reservoir). (1800,3000)
Temperature F (200,200)
PI mmscf/d/psi2 (1.5053E-08,1.7427E-7)
D: Tubing Data:
Perforation MD m (2104,2104)
Perforation TVD m (2104,2102)
Tubing 1 MD m (2054,2052)
Tubing 1 ID (2.44,2.44)

PIPESIM
Schlumberger 13 Open Link

Tubing 2 MD (Casing MD) (2104,2104)


Tubing 2 ID (Casing TVD) (5.5,5.5)
E: Flow line Data:
Flow line elevation (m) (0,0)
Flow line ID (3,3)
Flow line Length km (4.305,1.212)
F:Choke Data:
Choke Size 1/64th. (95,95)
G: Production Data:
Gas Rate mmscf/d (0.041,1.39)
Well Head Pressure psia (195,250)
Pressure at the end of the flow line. psia (150,440)
6. In cell $A$8 write the template path: D:/OpenLink/template/template.bps
7. In cell $A$9 write the path in which the Bps files are to be stored:
D:/OpenLink/
8. In cell $D$11 write the surface temperature: 90 F.
9. Save the current workbook under the name Openlink.xls with the following path:
D:/OpenLink/Excel/Openlink.xls
Preliminary steps
1. Enable Macros in your workbook.
2. Select the Menu tools Sub Menu Macro Security as shown below.

PIPESIM
Schlumberger 14 Open Link

The following user form should appear:

3. Select Medium. High does not let the user run any unsigned Macros.
4. Insert a Button in the workbook that will launch the routine. First, display the Control
Toolbox Toolbars.

PIPESIM
Schlumberger 15 Open Link

5. Then insert a button in the spreadsheet by clicking on the Command Button Icon in the
Control Toolbox; and clicking and dragging the button in the spreadsheet. This is shown
below:

Design Mode
Icon.

Command Button
Icon.

The default name of the button is CommandButton1.


Note: Clicking on the Command Button icon activates the design mode that allows you to place
buttons and other types of controls in the spreadsheet. You will need to deactivate the design
mode manually when you want the routine associated with the button to be executed when you
click on it.

PIPESIM
Schlumberger 16 Open Link

6. Next change the name of the button by right-clicking on the button CommandButton1 the
following menu should appear:

7. Click on CommandButton Object Submenu Edit. You can now change the caption of the
button CommandButton1 to: Create Well Model.
8. Open the VBA Editor Windows. As the design mode is activated, it is possible to open the VBA
editor windows by double-clicking on the button CommandButton1. The following window
should then appear:
Private Sub CommandButton1_Click()

End Sub
The window that contains the statements is called the Code window. You write VBA routines in
the Code window. The word Sub in the first line indicates to the computer that it is the beginning
of a new routine. (In effect, several routines can be written in the same Code window). The word
CommandButton1_Click in the first line indicates to the computer that the routine following can
only be executed by clicking on the button CommandButton_1. The statement End Sub indicates
to the computer that this is the end of the routine. Any routine must finish with this statement.
Activating the Open Link statements Libraries.
In order to be able to write our routine using Open Link statements we need to indicate to the
computer that we are going to use those statements. We need to activate those statements so that
they can be understood by VBA.
1. We can activate the Open Link statements by clicking on the menu Tools, submenu
References.

PIPESIM
Schlumberger 17 Open Link

You should now see a dialog box like the one below:

2. Scroll down the list of available references until you find the FluidModelCOM 1.0 Type Library.
Check the box to the left of the reference.
3. Now do the same for Net32COM 1.0 Type Library and NODALOPLib.INodalAnal.
4. Click on OK to close the reference window.
Each of the three library activated is a group of Open Link statements that can be used in VBA to
communicate with PIPESIM. These libraries will be available from Excel after having installed
PIPESIM. They need to be activated before they can be used while programming.
Note: If a routine is passed from one computer to another, and it does not work on the receiving
computer, it is because the Open Link Libraries have not been activated.
Write the VBA routine using Open Link Statements:
1. Write the following routine:
The actual workings of the routine will be explained in Case Studies.

PIPESIM
Schlumberger 18 Open Link

PIPESIM
Schlumberger 19 Open Link

PIPESIM
Schlumberger 20 Open Link

Run the routine


1. Go back to Excel and select the two wells with the mouse (by highlighting the corresponding
rows) you will have created two .bps files corresponding to the two wells of the spreadsheet.
The directory Open Link will contain the two .bps Files (shown below).

PIPESIM
Schlumberger 21 Open Link

Case Study 2 - Nodal Analysis


Problem Outline
It is required to see if our production data is consistent with what the model predicts the flow rate
should be. We will run a nodal analysis on each of the wells. The boundary conditions of the
problem are the reservoir static pressure and the outlet pressure of the model (i.e. the downstream
end of the flow line). The Stock tank gas flow rate at the operation point will be compared to the
Gas flow rate given in the production data.
Requirements
It is assumed that the reader is familiar with the PIPESIM Nodal Analysis User Form.
Procedure
You will write a VBA-Open Link routine that uses the table built in the previous case study. The
routine fills in a Nodal Analysis operation interface using the static pressure, tubing ID and Outlet
Pressure stored in Excel and then assigns this Nodal Analysis operation interface to the Well
Models created in Case study 1. Each of the models is then run. A Nodal Analysis plot (system
plot_.plt) is produced for each well. You can then check on the graphs if the stock tank flow rates
at the operation points are consistent with the production data.
Step by Step Tutorial
1. Open the Excel File (OpenLink.xls)
D:/OpenLink/Excel/Openlink.xls
2. Insert a second button in the Spreadsheet. This is done using the control toolbox as in Case
Study 1. The default name of the button will be CommandButton2.

3. Open the VBA editor. This is done as in Case Study 1 by double clicking on the button
CommandButton2. The code written for the previous case study will be visible.
Private Sub CommandButton2_Click()
End Sub

PIPESIM
Schlumberger 22 Open Link

At the end of the code, from the previous case study, the statements are visible. This is shown
below:

Write the VBA routine using Open Link statements


1. Write the routine:
The workings of the routine are explained in Case Studies.

PIPESIM
Schlumberger 23 Open Link

PIPESIM
Schlumberger 24 Open Link

PIPESIM
Schlumberger 25 Open Link

Run the routine


1. Go back to Excel and select the two wells (by highlighting the corresponding rows).
2. Press the button CommandButton_2. This runs a nodal analysis on the two .bps files
produced in Case Study 1. The contents of folder Open Link after having run the routine is
shown below:

. plt Files.

3. Clicking on the .plt files will display the following graphs:

.
Plot of Man1_435

PIPESIM
Schlumberger 26 Open Link

Plot of Man2_436

PIPESIM
Schlumberger 27 Open Link

Modules and Interfaces


NOTE:
1. Values returned as -7777 mean 'UNSET' or could not calculate do to missing data or has not
been calculated.
2. For all modules and interfaces, where applicable, required methods in are shown in RED and
those conditionally required in GREEN.
ISingleBranchModel Interface
ISingleBranchModel object - Get Methods
GetNameList (ObjectType As Long, Returns in pNameArray an array of String with
pNameArray, Count As Long) the names of objects of the given type
(ObjectType). The number of objects found is
returned in Count.
ObjectType can be any value of:
10 - Generic Source
11 - Vertical Completion
12 - Horizontal Completion
13 - Flowline
14 - Riser
15 - Zero length connector
16 - Tubing
17 - Generic Node
18 - Choke
19 - Compressor
20 - Expander
21 - Heat Exchanger
22 - Centrifugal Pump
23 - Multiphase Booster
24 - Injection Point
25 - Separator
26 - Report tool
27 - Adder/Multiplier
28 - Nodal Analysis Point
29 - Engine Keyword Tool
30 Reinjector
32 SSSV
33 Gas Lift Valve
34 Black Box
GetEquipmentInfo (EquipmentType As If ParentObject string is empty, the function is the
Long, ParentType As Long, ParentObject As same as GetNameList (). See GetNameList
String, EquipmentNames, Count As Long) () for a map to EquipmentType options.
Otherwise it returns in EquipmentNames array of
String with the names of child objects of the given
type (ObjectType) for specified ParentObject of
ParentType
GetHasArtificialLift (ObjectType As Returns 0: no artificial lift
Long, ObjectName As String, Lift As Long) 1: gas lift injection
2: ESP
-1: Object not found
ObjectType must be Tubing type (16)
ObjectName the name of the tubing
GetStartBoundaryObject (ObjectType As Returns the ObjectType (See GetNameList ())
Long, ObjectName As String) and its name of the upstream-most object in the
single branch model.

PIPESIM
Schlumberger 28 Open Link

GetCountObjectsInProfile (Count As Returns the number of objects in the single


Long) branch model
GetObjectAtIndex (Index As Long, Returns the object's type and name at the
ObjectType As Long, ObjectName As specified zero-based index. Index must between
String) zero and the number returned by
GetCountObjectsInProfile () minus 1.
GetLastError (ErrorStr As String) Returns the last error message produced by the
interface.
GetIsModelRunning () As Boolean Returns Boolean value True if the simulation
process is active
GetOperationInterface (pIOperation As Returns the operation object
Object)
GetOperationType () As Long Returns Long value as the operation defined for
the model. See Defined constants and strings
GetPropertyNames (ObjectName As Returns in PropNames the list of properties
String, PropNames) as Long defined for the object ObjectName. Returns the
number of properties as functions return value
GetPropertyVal (ObjectName As String, For specified property (PropName) in the
PropName As String, pValue As Double, specified object (ObjectName) function gets a
pUnitStr As String) As Boolean property value in Value and the units in UnitStr.
Return value is True if the property was retrieved
successfully, otherwise False. For implemented
PropNames see Defined constants and strings.
GetPropertyValAtObjectIndex Gets a specified property value.
(ObjectName As String, PropName As This function extends the functionality of
String, pValue As Double, pUnitStr As GetPropertyVal by allowing you to retrieve a
String, SubObjectType As Long, Index As property from a specified sub-component within
Long) As Boolean an object. A typical use of this is when for
instance it is required to get a gas lift flowrate
(PropName) from the top (Index = 0) gas lift
injection point (SubObjectType) in the tubing
Tubing_1 (ObjectName). For available options
see Defined constants and strings
GetPropertyStringAtObjectIndex The function is similar to
(ObjectName As String, PropName As GetPropertyValAtObjectIndex but for
String, pValue As String, Index As Long) As properties defined as string
Boolean
GetPropertyType (ObjectName As String, Returns the property type:
PropName As String) As Long UNDEFINED -1
REAL 0 (value in strict SI units)
INT 1
DOUBLE 2
STR 3
GetSensitivityInfo (ObjectType As Long, Returns the list of variable names upon which a
ObjectName As String, VariableNames, sensitivity analysis can be performed for the
ItemReference) given object (defined by its type and name). See
GetNameList () for object type values.
ItemReference holds additional binary
information about the sensitivity that is required
by some operation module interfaces (such as the
Artificial Lift COM interface)
GetSensitivityVariables (ObjectName As Requests the list of variable names and their
String, VariableNames, StdQtyNames) As measurements upon which a sensitivity analysis
Long can be performed for the given object (defined
by name). The return value holds number of the
variables

PIPESIM
Schlumberger 29 Open Link

ISingleBranchModel object - Set Methods


SetOperationInterface (pIOperation As pIOperation: The interface instance to an
Unknown) operation object. This function assigns the given
operation to the opened single branch model
SetOperationType (OperationType As Sets the operation type for the single branch
Long) model. See Defined constants and strings
SetPropertyVal (ObjectName As String, Sets the specified property (PropName) in the
PropName As String, value As Double, specified object (ObjectName) to the value given
UnitStr As String) As Boolean in Value in the given units (UnitStr). Function
returns True if the property was set successfully,
otherwise False. Implemented PropNames: see
Defined constants and strings.
SetPropertyStringAtObjectIndex As SetPropertyValAtObjectIndex () but for
(ObjectName As String, PropName As properties defined as string
String, value As String, Index As Long) As
Boolean
SetPropertyValAtObjectIndex This function extends the functionality of
(ObjectName As String, PropName As SetPropertyVal by allowing you to set a
String, value As Double, UnitStr As String, property to a specified sub-component within an
SubObjectType As Long, Index As Long) As object. A typical use of this is when for instance it
Boolean is required to set a gas lift flowrate (PropName)
through the top (Index = 0) gas lift injection point
(SubObjectType) in the tubing Tubing_1
(ObjectName). For available options see Defined
constants and strings.
SetPVTFile (bstrPVTFilename As String) Sets the compositional file (.pvt) to be used as the
main fluid in the simulations
SetUnitManager (p_VarUnitManager) Sets the Unit Manager object
ISingleBranchModel object - Properties
BlackOil As Object Gets/sets the Black Oil fluid definition object
Composition As Object Gets/sets the fluid composition object
FlowCorrelation As Object Gets/sets the Flow Correlation object
Fluid As FluidModel Gets/sets the FluidModel object (See
IFlowlineObj Interface)
FluidModelType As Long Gets/sets the fluid type (0: black oil, 1:
compositional, 2: PVT file, 3: MFL file)
GasLiftDesign As Object Gets/sets the Gas Lift Design object
GasLiftSystemProps As Object Gets/sets the Gas Lift System Properties object
ObjectProperties (ObjectName As String) Sets/returns a ProfileObject (See
As ProfileObj IObjectProperties Interface). Depending on the
object type of ObjectName this interface can be
set to the specific object type interface. For
instance a tubing object returns a ProfileObject,
which can be set to a TubingObj object. The
TubingObj (See ITubing Interface) contains
properties and methods to define or obtain
information from a detailed tubing object.
ProjectInfo As ProjectInfo Returns the ProjectInfo object to access project
specific data
ProjectPath As String Sets full path name to the model file
FieldSurvey As Object Gets/sets the FieldSurvey object
ErosionCorrosion As Object Gets/sets the ErosionCorrosion object
Keywords As String Gets/sets the additional engine keywords

PIPESIM
Schlumberger 30 Open Link

ISingleBranchModel object - Operations


ExportEngineFiles () This function generates an ASCII file (.psm) in the
PIPESIM engine keyword language that
corresponds to the opened model. This file can
then be used with PIPESIM expert mode.
ExportEngineFiles2 (operationfile As In addition to ExportEngineFiles (), this
String) As String function returns the full pathname to the
exported file (.psm) and its associated operation
file (.inc)
ExportEngineFiles3 (nExpertMode As This function is similar to ExportEngineFiles
Long) function but it allows to specify the format for
exported files in nExpertMode parameter:
0 default format,
1 with expert extensions
2 for ESP design
3 same as for 1 but warning is displayed if files
exist
KillSimulationProcess () Terminates the simulation process
NewModel (bstrModelFileName As String, Creates a new PIPESIM model.
ProfileTypesList, ProfileNamesList) As bstrModelFileName: full path to the file where the
Boolean new model is to be saved. ProfileTypesList: a list
of object type identifiers (integer numbers) that
describe the object connectivity in the model
see Defined constants and strings for ids map.
ProfileNamesList: a list of object names for each
one of the elements of ProfileTypesList. This
variant may be empty in which case default
names will be assigned. The method returns True
if operation was successful, False otherwise
OpenModel (bstrModelFileName As Opens the given single branch model. Filename
String) must be a valid PIPESIM single branch model file
(.bps).
This function must be called first when using this
interface.
RunSingleBranchModel (bRestart As Runs the currently opened model by calling the
Boolean) calculation engine program as specified in the
PIPESIM installation. If bRestart is True the
simulation will load any previously restart files
(.rst files) as its initial conditions. Return value is
True for successful engine start, False otherwise.
RunSingleBranchModel2 (bRestart As Similar to SetOperationInterface, it also
Boolean, EngSwitches As String, accepts one or more switches to be passed to the
DynamicPlot As Boolean) simulation engine and turns dynamic plotting
on/off.
RunSingleBranchModel3 (bRestart As Similar to SetOperationInterface2, it also
Boolean, EngSwitches As String, allows using of the Expert extensions
DynamicPlot As Boolean,
ExpertExtensions As Boolean)
SaveModel (bstrPathName As String) As Saves the currently opened model to a file given
Boolean by bstrPathName. Function returns True if model
is saved, otherwise the return value is False.
ValidateTubingConfiguration(MaxInjTV This function checks the tubing configuration
D As Double) As Boolean above the injection point to verify that all
dimensions are properly set. If function fails the
error message is available using the GetLastError
function.

PIPESIM
Schlumberger 31 Open Link

SetOutpoutUnits(nUnits As Integer) As This function forces the output to be written in


Boolean specified units (0 models default units, 1 Eng
units and 2 SI units).
ISingleBranchModel object Examples
VBA Sample Code
Dim SingleBranchObj As New NET32COMLib.ISingleBranchModel
Dim equipnames As Variant
Dim sensvarnames As Variant
Dim objref As Variant

Dim count As Long

'Open the model


SingleBranchObj.OpenModel C:\Program Files\Schlumberger\Pipesim\Case
Studies\Open Link\Gas Lift Performance.bps

'Export Psm file


Dim ExportFile As String
Dim OperationFile As String
ExportFile = SingleBranchObj.ExportEngineFiles2(OperationFile)

'Get object information

Dim count As Long


Dim objtype As Long
Dim objname As String

SingleBranchObj.GetCountObjectsInProfile count

'Write to the spreadsheet the list of objects in the single branch model
For indx = 0 To count - 1
SingleBranchObj.GetObjectAtIndex indx, objtype, objname
Cells(indx + 1, 1) = objname
Cells(indx + 1, 2) = objtype
Next

'Get Sensitivity Information for the tubing (type = 16) with identifier
Tub_1
SingleBranchObj.GetSensitivityInfo 16, Tub_1, sensvarnames, objref

'Write the list of sensitivity variables to the spreadsheet


Dim name As Variant
For Each name In sensvarnames
r.Cells(i, 1) = name
i = i + 1
Next
IObjectProperties Interface
ProfileObj object - Properties
Fluid As FluidModel Gets a FluidModel interface object (see
description below)
ProfileObj object - Get Methods
GetLastError () As String Returns an error description
GetPropertyNames (PropNames) As Returns in PropNames the array of properties
Long defined for the object. Functions return value is
the number of properties

PIPESIM
Schlumberger 32 Open Link

GetValue (PropName As String, pValue, Gets the specified property (PropName) value in
pUnitStr As String, Index As Long) As Value in the given units (UnitStr). Return value is
Boolean True if the property was set successfully,
otherwise False. Implemented PropNames: see
Defined constants and strings. Index is a reserved
argument, set it to 1.
ProfileObj object - Set Methods
SetValue (PropName As String, value, Sets the specified property (PropName) value in
UnitStr As String, Index As Long) As Value in the given units (UnitStr). Return value is
Boolean True if the property was set successfully,
otherwise False. Implemented PropNames: see
Defined constants and strings. Index is a reserved
argument, set it to 1.
ITubing Interface
TubingObj Object - Get Methods
GetCountDownholeEquipment (Type Returns the number of items specified in the
As Long) As Long detailed tubing model of a given type of equipment
Type: any of
16 Tubing section
18 - Choke
22 - Centrifugal Pump
24 - Injection Point
25 - Separator
32 SSSV
33 Gas Lift Valve
(See Object Type Identifiers)
GetCountTubingSection () As Long Similar to GetCountDownholeEquipment, but
specific to tubing sections
GetDeviationSurvey_SI (Type As Returns in a Variant the matrix of doubles defined
Long) As Variant as two columns and a variable number of rows.
The variable in each column depends in the
requested Type.
Type: 0 = md vs. tvd, 1 = md vs. angle, 2 = tvd vs.
angle
All values are in strict SI units
GetDownholeEquipment (Type As Returns the md (as functions return value) and the
Long, Index As Long, label As String) As label of a given Type of downhole equipment and
Double at given Index.
Type: any of
16 Tubing section
18 - Choke
22 - Centrifugal Pump
24 - Injection Point
25 - Separator
32 SSSV
33 Gas Lift Valve
Index: the 0 based positional index of the item.
Index = 0 refers to the top-most item closest to the
wellhead.
GetDownholeEquipmentAtIndex Returns the equipment type, label and md (as
(Index As Long, Type As Long, label As functions return value) in strict SI units at a given
String) As Double Index. See GetDownholeEquipment for
definition of Index

PIPESIM
Schlumberger 33 Open Link

GetGeothermalSurvey_SI (vbIsTVD Returns the geothermal survey in Variant matrix of


As Boolean) As Variant doubles defined as three columns and a variable
number of rows. The columns are defined as Depth
vs. Ambient Temperature vs. U value. Depth is
TVD if vbIsTVD = true, otherwise MD
GetTubingSection (Index As Long, Similar to GetDownholeEquipment, but specific
label As String) As Double to tubing sections
GetMDatTVD_SI (tvd As Double) As Returns the md given the tvd based on the
Double deviation survey
GetTVDatMD_SI (md As Double) As Returns the tvd given the md based on the
Double deviation survey
GetInputOK (info As String) As Validates the tubing data and returns True if
Boolean configuration is correct, otherwise the function
returns False and info contains the error message
TubingObj Object -Set Methods
SetDeviationSurvey_SI (Type As Sets a deviation survey to a detailed tubing model.
Long, Survey) As Boolean See GetDeviationSurvey_SI for available types.
Survey must be a variant matrix of double values
specified as a two-column table with any number
of rows (minimum 2).
SetGeothermalSurvey_SI (vbIsTVD Sets a geothermal survey to a detailed tubing
As Boolean, Survey) As Boolean model.
See GetGeothermalSurvey_SI for definition of
Survey and vbIsTVD.
TubingObj Object -Properties
InjectionPointFluid (Index As Long) Gets/sets the FluidModel object for the injection
As FluidModel point at a given index. This function is only
applicable for compositional models. See
ISinglePointCalib object.
RemedialCoiledTubingEnabled As Enables/disables Remedial Coiled Tubing option in
Boolean configuration
TubingObj Object - Operations
AddDownholeEquipment (Type As Adds an equipment item to the detailed tubing
Long, md_SI As Double, label As String) Type: any of
As Long 22 - Centrifugal Pump
24 - Injection Point
25 - Separator
32 SSSV
33 Gas Lift Valve
label: the items label
Function returns the 0 based positional index of
the added item. Index = 0 refers to the top-most
item closest to the wellhead
AddGasLiftValve_SI (md As Double, Adds a gas lift valve to the tubing object. Returns
manuf As String, series As String, the zero-based index corresponding to the valve
portName As String, portSize As Double, position with index of the topmost valve equal to 0.
mode As String, ptro As Double, Ap As
Double, Ab As Double, nomOD As
Double, cv As Double, dpfo As Double)
As Long

PIPESIM
Schlumberger 34 Open Link

AddTubingSection (BottomMD_SI As Adds a section of tubing


Double, label As String) As Long BottomMD_SI: the bottom md of the section in
strict SI units
label: the items label
Function returns the 0 based positional index of
the added section
ClearGasLiftValves () Removes all gas lift valves from the tubing
RemoveDownholeEquipment (Type Removes a piece of equipment of a given type and
As Long, Index As Long) at the given Index.
Type: any of
22 - Centrifugal Pump
24 - Injection Point
25 - Separator
32 SSSV
33 Gas Lift Valve
Index: the 0 based positional index of the item.
Index = 0 refers to the top-most item closest to the
wellhead
RemoveTubingSection (Index As Similar to RemoveDownholeEquipment but
Long) applicable to tubing sections
DisplayDialog (p_VarUnitManager, Function invokes tubing configuration dialog and
fluidtype As Integer) As Boolean returns True if OK button was clicked, False
otherwise. p_VarUnitManager is a Units Manager
object and fluidtype can be one of the following
values:
0: black oil
1: composition
2: PVT file
3: MFL file
IVertCompObj Interface
VertCompObj Object - Get Methods
GetInputOK (info As String) As Validates the flowline data and returns True if
Boolean configuration is correct, otherwise the function
returns False and info contains the error message
VertCompObj Object - Set Methods
SetMultipoint(value As Long) As Set either multipoint=1 or isochronal=0 type of
Boolean IPR data table
SetIPRFluidType(Type As Long) As Set fluid type for IPR: type_liquid=0, type_gas=1
Boolean
SetIPRTable_SI(QPPoints) As Boolean Sets the IPR table values. QPPoints is a 3-column
array of Doubles, where first column contains
Flowrate values, second column contans Pwf
values and the third one contains Pws values. All
values are in strict SI units
GetConingTableData(IsUsed As Returns the coning table data for the vertical
Boolean, ConedGasSG As Double, completion. IsUsed is TRUE if it is set and FALSE
Flowrate, GOR, WCut) As Boolean otherwise, ConedGasSG contains a value for coned
gas specific gravity, Flowrate, GOR and WCut are
the one-column arrays of Doubles containing
flowrate, GOR and watercut values respectively.
All values are in Eng units
VertCompObj Object - Operations
CalculateIPR() As Boolean

PIPESIM
Schlumberger 35 Open Link

DisplayDialog (p_VarUnitManager) As Function invokes Vertical Completion


Boolean configuration dialog and returns True if OK button
was clicked, False otherwise. Pass a Null variant
as the arguments value.
IFlowlineObj Interface
FlowlineObj Object - Properties
HeatTransfer As Object Gets/sets HeatTransfer object
FlowlineObj Object - Get Methods
GetInputOK (info As String) As Validates the flowline data and returns True if
Boolean configuration is correct, otherwise the function
returns False and info contains the error message
FlowlineObj Object - Operations
AddProfileNode_SI (distance As Adds a node to the flowline detailed node
Double, elevation As Double, ambientT description. All values must be given in strict SI
As Double, uValue As Double, label As units.
String)
ClearDetailedProfile () Deletes all nodes in the flowline detailed profile
UseDetailedProfile (UseDetailed As UseDetailed = True: instructs the flowline to use
Boolean) the detailed profile description.
UseDetailed = False: use the flowlines simple
description, detailed nodes will be generated
automatically.
DisplayDialog (p_VarUnitManager) As Function invokes flowline configuration dialog and
Boolean returns True if OK button was clicked, False
otherwise. Pass a Null variant as the arguments
value.
GetNodesCount () As Long Function returns a number of nodes defined in a
detailed profile
GetPipeOD (od as Double, units as Function calculates pipes OD based on coating
String) properties
IHeatTransfer Interface
HeatTransfer Object - Properties
UValueType As Long Gets/sets U Value type. Possible values are 0 for
calculated, 1 for insulated, 2 for coated, 3 for bare
in air, 4 for bare in water and 5 for user-specified
IsIFCIncluded As Boolean Gets/sets a Boolean value for inside filem
coefficient. True if IFC is included in U Value and
False if it is calculated separately.
AmbientFluidType As Long Gets/sets an ambient fluid type. 0 for air and 1 for
water.
HeatTransfer Object - Get Methods
GetUValue (uVal as Double, units as Returns U Value and units string. Fails if
String) UValueType is set to calculated
GetPipeConductivity (dblVal as Returns pipe conductivity value and units string.
Double, units as String) Fails if UValueType is not calculated
GetAmbientFluidVelosity (dblVal as Returns ambient fluid velocity value and units
Double, units as String) string. Fails if UValueType is not calculated
GetBurialDepth (dblVal as Double, Returns pipe burial depth value and units string.
units as String) Fails if UValueType is not calculated
GetGroundConductivity (dblVal as Returns ground conductivity value and units string.
Double, units as String) Fails if UValueType is not calculated

PIPESIM
Schlumberger 36 Open Link

GetCoatingData_SI (varData) Returns a pipe coating data array. First column


containts layer-specific conductivity values and a
second column containts layer thicknesses. Fails if
UValueType is not calculated
HeatTransfer Object - Set Methods
SetUValue (uVal as Double, units as Sets U Value in specified units. Fails if UValueType
String) is set to calculated
SetPipeConductivity (dblVal as Sets pipe conductivity value in specified units.
Double, units as String) Fails if UValueType is not calculated
SetAmbientFluidVelosity (dblVal as Sets ambient fluid velocity value in specified units.
Double, units as String) Fails if UValueType is not calculated
SetBurialDepth (dblVal as Double, Sets pipe burial depth value in specified units.
units as String) Fails if UValueType is not calculated
SetGroundConductivity (dblVal as Sets ground conductivity value in specified units.
Double, units as String) Fails if UValueType is not calculated
SetCoatingData_SI (varData) Sets a pipe coating data. Data has to be passed as
an array where first column containts layer-
specific conductivity values and a second column
containts layer thicknesses. Fails if UValueType is
not calculated
IFluid Interface
FluidModel Object - Properties
Composition As Object Accesses the ICompositional object (See
ISinglePointCalib object)
BlackOil As Object Accesses the IBlackOil object (Ref IBlackOil )
FluidModelType As Long Retrieves the fluid model type: 0: BlackOil, 1:
Compositional, 2 PVT File, 3 MFL File
OverrideValues As Boolean Sets/gets whether Wcut/GOR values are overridden
from the values defined in the fluid model.
WCutoverride_SI As Double Accesses the watercut override value
GORoverride_SI As Double Accesses the GOR override value
OGRoverride_SI As Double Accesses the OGR override value
LGRoverride_SI As Double Accesses the LGR override value
GLRoverride_SI As Double Accesses the GLR override value
GORoverride_Type As Integer Accesses which GOR type is being overridden
(0=GLR, 1=GOR, 2=LGR, 3=OGR)
IsLocalFluid As Boolean Sets/gets whether the object is using a local fluid
model
CompositionType As Long Sets/gets whether the local composition is a PVT
file or a defined PIPESIM composition or local
MFL file
FluidName As String Sets/gets a fluid name
FluidModel Object - Get Methods
GetInputOK (info As String) As Validates the fluid model data and returns True if
Boolean configuration is correct, otherwise the function
returns False and info contains the error message
FluidModel Object - Operations
DisplayDialog (p_VarUnitManager) As Function invokes fluid configuration dialog and
Boolean returns True if OK button was clicked, False
otherwise. Pass a Null variant as the arguments
value.

PIPESIM
Schlumberger 37 Open Link

IProjectInfo Interface
ProjectInfo Object - Properties
Description As String Gets/sets string property
User As String Gets/sets string property
Job As String Gets/sets string property
Company As String Gets/sets string property
Manager As String Gets/sets string property
Remarks As String Gets/sets string property
Date As String Gets/sets string property
Field As String Gets/sets string property
WellNumber As String Gets/sets string property
Lease As String Gets/sets string property
Country As String Gets/sets string property
Address As String Gets/sets string property
Email As String Gets/sets string property
Phone As String Gets/sets string property
Fax As String Gets/sets string property
IErosionCorrosion Interface
ErosionCorrosion Object - Properties
CalculatePH As Long Gets/sets value for Actual pH property (1
calculate value, 0 use user-defined pH value)
CorrosionEfficiency As Double Gets/sets corrosion efficiency value
CorrosionModel As Long Gets/sets value for Corrosion Model property (0
none, 1 use de Waard (1995) model )
ErosionEfficiency As Double Gets/sets erosion efficiency value
ErosionModel As Long Gets/sets value for Erosion Model property (0
API 14e model, 1- SALAMA (2000))
ErosionRate_Eng As Double Gets/sets acceptable erosion rate value
ErosionVelocityConst As Double Gets/sets erosion velocity constant value
GeometryConstant As Double Gets/sets geometry constant value
SandGrainSize_Eng As Double Gets/sets sand grain size value
SandProdRatio As Double Gets/sets sand production ratio value
UserDefinedPH As Double Gets/sets user-defined pH value
ProjectInfo Object Example
VBA Sample Code
Dim SingleBranchObj As New NET32COMLib.ISingleBranchModel
Dim equipnames As Variant
Dim sensvarnames As Variant
Dim objref As Variant

Dim count As Long

'Open the model


SingleBranchObj.OpenModel C:\Program Files\Schlumberger\PIPESIM\Case Studies\Open
Link\Gas Lift Performance.bps

'Export Psm file


Dim ExportFile As String
Dim OperationFile As String
ExportFile = SingleBranchObj.ExportEngineFiles2(OperationFile)

'Get object information

PIPESIM
Schlumberger 38 Open Link

Dim count As Long


Dim objtype As Long
Dim objname As String

SingleBranchObj.GetCountObjectsInProfile count

'Write to the spreadsheet the list of objects in the single branch


model
For indx = 0 To count - 1
SingleBranchObj.GetObjectAtIndex indx, objtype, objname
Cells(indx + 1, 1) = objname
Cells(indx + 1, 2) = objtype
Next

'Get Sensitivity Information for the tubing (type = 16) with identifier
Tub_1
SingleBranchObj.GetSensitivityInfo 16, Tub_1, sensvarnames, objref

'Write the list of sensitivity variables to the spreadsheet


Dim name As Variant
For Each name In sensvarnames
r.Cells(i, 1) = name
i = i + 1
Next
INetModel Interface
INetModel Interface - Get Methods
DoesCustomKeyExists (KeyName Returns true if custom data has been stored against
as String) as Boolean the KeyName string

GetNameList (ObjectType As Long, Returns in pNameArray an array of String with the


pNameArray, Count As Long) names of objects of the given type (ObjectType). The
number of objects found is returned in Count.
ObjectType can be any of:
1 - Folder
2 - Source
3 - Sink
4 - Junction
5 - Branch
6 - Text Object
7 - Production Well
8 Injection Well
GetHasArtificialLift (ObjectType As Returns:
Long, ObjectName As String, Lift As 0: no artificial lift
Long) 1: gas lift injection
2: ESP
-1: Object not found
ObjectType must be Tubing type (16)
ObjectName the name of the tubing
GetEquipmentInfo (EquipmentType Returns the names of equipment of type
As Long, ParentType As Long, EquipmentType (See GetNameList () for the
ParentObject As String, ISingleBranch object for available types), which are
EquipmentNames, Count As Long) part of the single branch model of object
ParentObject of type ParentType. ParentType should
be ProductionWell (7), InjectionWell (8), or Branch
(5)

PIPESIM
Schlumberger 39 Open Link

GetLastError (ErrorStr As String) Returns the last error message produced by the
interface
GetBoundaryProperties Returns the boundary properties set in the model for
(ObjectName As String, Pressure As object with identifier ObjectName. ObjectName must
Double, Temperature As Double, be a boundary object (Source, Sink, Production Well
Fluidrate As Double, Fluidtype As or Injection Well)
Long) Pressures in psia
Temperatures in F
Fluidtype = 0 (liquid rate), Fluidrate in STB/D
Fluidtype = 1 (gas rate), Fluidrate in mmscf/d
Fluidtype = 2 (mass rate), Fluidrate in lb/s
GetBoundaryProperties_SI Similar to GetBoundaryProperties except that this
(ObjectName As String, Pressure As function returns the properties in strict SI units.
Double, Temperature As Double,
Fluidrate As Double, fluidtype As Long)
GetBoundaryBlackOil (ObjectName Gets the BlackOil object used by the source with
As String, BlackOil As Object) As identifier ObjectName. Only applicable for BlackOil
Boolean models. The function returns True in case of success
and False otherwise
GetBoundaryComposition Gets the Compositional object used by the source
(ObjectName As String, Composition with identifier ObjectName. Only applicable for
As Object) As Boolean compositional models, The function returns True in
case of success and False otherwise
GetBoundaryCompositionType Returns the composition model location used by the
(ObjectName As String, Type As Long) ObjectName source object:
0: object is using a locally defined composition
1: object is using a locally defined PVT file
2: object is using the models globally defined
composition or PVT file
3: object is using a locally defined MFL file
GetBoundaryPVTFile (ObjectName Gets the PVT file used by the source with identifier
As String, PVTFilename As String) As ObjectName. Only applicable for Compositional/PVT
Boolean models
GetBoundaryType (ObjectName As Returns the boundary condition type specified for the
String, Type As Long, CurveOption As ObjectName source:
Long) Type = 0 pressure and/or flowrate specified
Type = 1 PQ curve specified
If Type = 1 then CurveOption returns:
CurveOption = 0 create curve when required
CurveOption = 1 create curve at every engine run
CurveOption = 2 use a specified PQ curve file
GetCountObjectsInProfile Returns the number of objects in the single branch
(NetObjectName As String) As Long model defined for NetObjectName.
GetIsModelRunning () As Boolean Returns True if simulation is running
GetPropertyNames (ObjectName As Returns in PropNames the list of properties defined
String, ParentName As String, for the object ObjectName. If ObjectName is defined
PropNames) As Long at the single branch level then ParentName must be
the identifier for its parent Network object. Return
value is the number of properties
GetPropertyVal (ObjectName As For specified property (PropName) in the specified
String, ParentName As String, object (ObjectName) function gets a property value in
PropName As String, pValue As Double, Value and the units in UnitStr. Return value is True if
pUnitStr As String) As Boolean the property was retrieved successfully, otherwise
False. ParentName is the object at the network level
and should define ObjectName in its single branch
model. Implemented PropNames: see Defined

PIPESIM
Schlumberger 40 Open Link

constants and strings


GetPropertyValAtObjectIndex Gets a specified property value.
(ObjectName As String, ParentName As This function extends the functionality of
String, PropName As String, pValue As GetPropertyVal by allowing you to retrieve a
Double, pUnitStr As String, property from a specified sub-component within an
SubObjectType As Long, Index As object. A typical use of this is when for instance it is
Long) As Boolean required to get a gas lift flowrate (PropName) from
the top (Index = 0) gas lift injection point
(SubObjectType) in the tubing Tubing_1
(ObjectName). ParentName is the object at the
network level and should define ObjectName in its
single branch model. For available options see
Defined constants and strings
GetPropertyStringAtObjectIndex The function is similar to
(ObjectName As String, ParentName As GetPropertyValAtObjectIndex () but for
String, PropName As String, pValue As properties defined as string
String, Index As Long) As Boolean
GetSingleBranchModel Returns the ISingleBranchModel object for the
(NetObjectName As String) As NetObjectName specified
ISingleBranchModel
GetNamesInFolder(FolderName As Returns in pNameArray an array of String with the
String, ObjectType As Long, names of objects of the given type (ObjectType). The
pNameArray, Count As Long) number of objects found is returned in Count.
All allowed ObjectType values are described for
GetNameList function
GetNodeCooordinates(ObjectName Returns the array of coordinates for GUI element with
As String, pCoordArray) As Boolean name in ObjectName parameter. Values are central
point X, central point Y, left, top, right, and bottom
GetConnectionInfo(pBranchArray, Returns the array of all branch names, the array of
pSNodeArray, pENodeArray) As starting nodes and the array of ending nodes for those
Boolean branches
GetBoundaryCurveFile(ObjectName Returns the offline curve file name for the specified
As String) As String well name
GetCustomData(KeyName As String, Returns a variant byte array of the custom data that
pValue) As Boolean has been stored against the supplied KeyName string
GetCustomKeys(pKeyNameArray) As Returns an array of the KeyNames strings for which
Boolean custom data has been stored
GetFlowrateLimits_SI(ObjectName Returns a two-column array of Doubles for specified
as String) As Variant branch. First column contains lower limits for mass
flowrate, liquid flowrate, water flowrate, oil flowrate
and gas flowrate. The second one contains upper
limits for the same rates.
INetModel Interface - Set Methods
SetBoundaryBlackOil (ObjectName Sets a BlackOil object to a given source. The function
As String, BlackOil As Object) As returns True in case of success and False otherwise
Boolean
SetBoundaryComposition Sets a compositional object to a source with identifier
(ObjectName As String, Composition ObjectName. Only applicable for compositional
As Object) As Boolean models. The function returns True in case of success
and False otherwise
SetBoundaryCurveFile (ObjectName Sets the source boundary condition as defined by the
As String, CurveFileName As String) As curve in file CurveFileName. The format of the file
Boolean must be that of a plot file revision C or later. One way
to generate a boundary file is using the Well
Performance Curves operation in PIPESIM. The

PIPESIM
Schlumberger 41 Open Link

object identified by ObjectName must be a


Production Well.
SetBoundaryFluidrate (ObjectName Sets the given value in the given units as fluidrate
As String, Fluidtype As Long, value As boundary condition for source object ObjectName.
Double, UnitStr As String) Fluidtype can be any of:
0 = liquid rate, 1 = gas rate, 2 = mass rate
SetBoundaryPressure (ObjectName Sets the given value in the given units as pressure
As String, value As Double, UnitStr As boundary condition for source object ObjectName.
String)
SetBoundaryPVTFile (ObjectName Sets a PVT file to a given source. PVTFilename must
As String, PVTFilename As String) As contain the full path to a PVT file
Boolean
SetBoundarySourcePQPoints Sets a number of pressure and flowrate pairs as a
(ObjectName As String, PQPoints, boundary condition to the referred ObjectName.
fluidtype As Long, PressureUnits As PQPoints is a 2-dimensional array of
String, FlowrateUnits As String) As pressure/temperature values. The object must be of
Boolean the type generic source. Number of data points
cannot exceed 30.
SetBoundaryTemperature Sets the given value in the given units as temperature
(ObjectName As String, value As boundary condition for source object ObjectName.
Double, UnitStr As String)
SetBoundaryType (ObjectName As Sets the type of boundary condition for source object
String, Type As Long, CurveOption As ObjectName.
Long) Type = 0 for pressure and flowrate boundary
condition
Type = 1 for curve
If the Type is curve (1) AND the source object is a
Production Well then CurveOption controls how the
wells-offline file is created or used:
CurveOption = 0 create automatically when required
CurveOption = 1 create automatically every time
engine is run
CurveOption = 2 use file (See
SetBoundaryCurveFile ())
SetPropertyVal (ObjectName As Sets the specified property (PropName) in the
String, ParentName As String, specified object (ObjectName) to the value given in
PropName As String, value As Double, Value in the given units (UnitStr). Function returns
UnitStr As String) As Boolean True if the property was set successfully, otherwise
False. ParentName is the object at the network level
and should define ObjectName in its single branch
model. Implemented PropNames: see Defined
constants and strings.
SetPropertyValAtObjectIndex This function extends the functionality of
(ObjectName As String, ParentName As SetPropertyVal by allowing you to set a property to
String, PropName As String, value As a specified sub-component within an object. A typical
Double, UnitStr As String, use of this is when for instance it is required to set a
SubObjectType As Long, Index As gas lift flowrate (PropName) through the top (Index
Long) As Boolean = 0) gas lift injection point (SubObjectType) in the
tubing Tubing_1 (ObjectName) which is defined for
Well_1 (ParentName). For available options see
Defined constants and strings.
SetPropertyStringAtObjectIndex Similar to SetPropertyValAtObjectIndex ()
(ObjectName As String, ParentName As except that PropName is a string type property.
String, PropName As String, value As
String, Index As Long) As Boolean
SetPVTFile (bstrPVTFilename As Sets the compositional file (.pvt) to be used as the

PIPESIM
Schlumberger 42 Open Link

String) main fluid in the simulations


SetSingleBranchModel Sets the underlying single branch model by way of its
(NetObjectName As String, filename As associated .bps file to a network object.
String) As Boolean
SetCustomData(KeyName As String, Stores a variant array of byte data against a KeyName
pValue) As Boolean string. This can be used to persist additional custom
data, and can later be retrieved by specifying the
KeyName
SetFlowrateLimits_SI(ObjectName Sets flowrate limits for specified branch passing a
as String, Limits) two-column array of Doubles. First column contains
lower limits for mass flowrate, liquid flowrate, water
flowrate, oil flowrate and gas flowrate. The second
one contains upper limits for the same rates.

INetModel Interface - Properties


BlackOilDefault As Object Gets/sets the default BlackOil model to/from a
BlackOil object
CompositionDefault As Object Gets/sets the default composition to/from a
Composition object
FlowCorrelation As Object Gets/sets the flow correlation properties to/from a
FlowCorrelation object
FluidModelType As Long 0: BlackOil, 1: Compositional, 2: PVT File, 3: MFL File
LocalFluid (ObjectName As String) As Gets/sets the Fluid object for the specified object
FluidModel (ObjectName)
ModelFileName As String Returns the file path of the current model
ModelBuilder As ModelBuilder Returns a ModelBuilder object - see ModelBuilder
ProjectInfo As ProjectInfo Get the ProjectInfo object to access project specific
data
ErosionCorrosion As Object Gets/sets the ErosionCorrosion object
UseNetErCorrSettings As Long Gets/sets the flag value to use network erosion &
corrosion settings over local branches settings (if = 1)
or to use local settings overwise
BottomKeywords As String Gets/sets the network engine keywords to be added at
bottom of tnt file
TopKeywords As String Gets/sets the network engine keywords to be added
on top of tnt file
AppVersion As String Gets the version of PIPESIM

INetModel Interface - Operations


ExportEngineFiles () This function generates an ASCII file ( .tnt) and a
number of ASCII files (.pst) in the PIPESIM engine
keyword language that is used as input by the
calculation engine. This .tnt file can then be used with
PIPESIM expert mode.
KillSimulationProcess () Terminates the simulation process
OpenModel (bstrModelFileName As Opens the given network model. Filename must be a
String) valid PIPESIM network model file (.bpn)
This function must be called first when using this
object.

PIPESIM
Schlumberger 43 Open Link

RunNetwork (bRestart As Boolean) Runs the currently opened model by calling the
calculation engine program as specified in the
PIPESIM installation.
If bRestart is True the simulation will load any
previously restart files (.rst files) as its initial
conditions.
RunNetwork2 (bRestart As Boolean, Similar to RunNetwork and also accepts one or
EngSwitches As String) more switches to be passed to the simulation engine.
SaveModel (bstrPathName As String) Saves the currently opened model to a file given by
As Boolean bstrPathName
ResetLocalErCorrSettings() As Overrides all local erosion and corrosion settings with
Boolean the global ones
ModelBuilder object
SetNodeCoordinates (NodeName As Sets the node coordinates for node object NodeName
String, X As Long, Y As Long) to X, Y coordinates
TopLeftCoordinate_X As Long Sets/returns the top left X coordinate of the graphical
panel. SetNodeCoordinates values are passed in
relation to TopLeftCoordinate_X and
TopLeftCoordinate_Y
TopLeftCoordinate_Y As Long As above for the Y coordinate

BottomRightCoordinate_X As Long Returns the bottom right X coordinate of the


graphical panel (this is a read-only property)
BottomRightCoordinate_Y As Long As above for the Y coordinate

GetNodeCoordinates (NodeName As Gets the node X, Y coordinates for node object


String, X As Long, Y As Long) NodeName
GetLastError () As String Returns the last error message produced by the object

IBlackOil object
IBlackOil object - Properties
API As Double API value
ConingEnabled As Boolean True/False
ConingGasSG As Double Coning gas specific gravity
ConingRateType As Long 0: liquid, 1: gas, 2: mass
ConingTable_SI As Variant A 3-column array with rate, gor/glr, wcut values, use
strict SI units
GasSG As Double Black oil specific gravity
GLR_SI As Double Gas/Liquid Ratio use strict SI units
GOR_SI As Double Gas/Oil Ratio use strict SI units
GOR_Type As Integer (0=GLR, 1=GOR, 2=LGR, 3=OGR)
LGR_SI As Double Liquid/Gas Ratio use strict SI units
OGR_SI As Double Oil/Gas Ratio use strict SI units
SolutionGasCorrelation As Long 0 = Lasater, 1 = Standing, 2 = Vazquez and Beggs, 3 =
Glaso, 4 = Kartoatmodjo
Watercut As Double Water Cut
WaterSG As Double Water specific gravity
Name As String Name of the fluid
Comment As String String containing the text in the comments field
Calibration As Long Calibration type: 0 no calibration, 1 single point
and 2 - multipoint
SinglePointCalib As Object Single point calibration data object
MultiPointCalib As Object Multipoint calibration data object

PIPESIM
Schlumberger 44 Open Link

Viscosity As Object String containing the text in the comments field


ThermalData As Object String containing the text in the comments field
Contaminants As Variant Array of Doubles for contaminant values in a
following order: CO2, H2S, N2, H2 and CO
IBlackOil object - Methods
SetBubblePointCalibration Sets the bubble point data
(SatGas_SI As Double, Pressure_SI As
Double, Temperature_SI As Double)
GetBubblePointCalibration Gets the bubble point data. Return value is a
(Pressure_SI As Double, Saturation Gas correlation : 0 for Lasater, 1 for
Temperature_SI As Double) As Double Standing, 2 for Vazquez and Beggs, 3 for Glaso, 4 for
Kartoatmodjo, 5 for De Ghetto at al or 6 for Petrosky-
Farshad
IBlackOil object - Operations
SetBlob (sBlob As String) Sets data for the required fluid
sBlob = String containing black oil information
ISinglePointCalib object
ISinglePointCalib object Get Methods
GetCalibrationAtBubblePoint Function gets calibration data at bubble point. The
(Pressure_SI As Double, return value is Saturation Gas correlation: 0 for
Temperature_SI As Double, SatGas_SI Lasater, 1 for Standing, 2 for Vazquez and Beggs, 3 for
As Double) as Long Glaso, 4 for Kartoatmodjo, 5 for De Ghetto et al. or 6
for Petrosky-Farshad
GetCalibrationAboveBubblePoint Function gets calibration data above bubble point.
(OFVF As Double, Density_SI as The return value is density type: 0 for Density, 1 for
Double, Compressibility_SI as Double, OFVF or 3 for Compressibility
Pressure_SI As Double,
Temperature_SI As Double) as Long
GetCalibrationBelowBubblePoint Function gets calibration data below bubble point.
(OFVF As Double, Density_SI as The return value is density type: 0 for Density or 1 for
Double, Pressure_SI As Double, OFVF
Temperature_SI As Double) as Long
GetLiveOilViscBelowBubblePoint Function gets live oil viscosity data below bubble
(Pressure_SI As Double, point. The return value is Live Oil Viscosity
Temperature_SI As Double, Correlation: 0 for Beggs & Robinson, 1 for Chew &
LiveOilVisc_SI) as Long Connally, 2 for Kartoatmodjo, 3 for Khan, 4 for De
Ghetto et al., 5 for Hossain, 6 for Elsharkawyor 7 for
Petrosky-Farshad
GetGasViscBelowBubblePoint Function gets gas viscosity data below bubble point.
(Pressure_SI As Double, The return value is gas viscosity.
Temperature_SI As Double) as Double
GetGasZBelowBubblePoint (GasZ as Function gets gas Z data below bubble point. The
Double, Pressure_SI As Double, return value is gas Z correlation: 0 for Standing, 1 for
Temperature_SI As Double) as Long Hall Yarborough or 2 for Robinson et al.
ISinglePointCalib object Set Methods
SetCalibrationAtBubblePoint Function sets calibration data at bubble point. The
(SolGasCorr as Long, Pressure_SI As acceptable values for Saturation Gas correlation are:
Double, Temperature_SI As Double, 0 for Lasater, 1 for Standing, 2 for Vazquez and Beggs,
SatGas_SI As Double) 3 for Glaso, 4 for Kartoatmodjo, 5 for De Ghetto et al.
or 6 for Petrosky-Farshad
SetCalibrationAboveBubblePoint Function sets calibration data above bubble point.
(DensType as Long, OFVF As Double, The acceptable values for density type are: 0 for
Density_SI as Double, Density, 1 for OFVF or 3 for Compressibility
Compressibility_SI as Double,

PIPESIM
Schlumberger 45 Open Link

Pressure_SI As Double,
Temperature_SI As Double)
SetCalibrationBelowBubblePoint Function sets calibration data above bubble point.
(DensType as Long, OFVF As Double, The acceptable values for density type are: 0 for
Density_SI as Double, Pressure_SI As Density or 1 for OFVF
Double, Temperature_SI As Double)
SetLiveOilViscBelowBubblePoint Function sets live oil viscosity data below bubble
(LiveOilCorr as Long, Pressure_SI As point. The acceptable values for Live Oil Viscosity
Double, Temperature_SI As Double, Correlation are: 0 for Beggs & Robinson, 1 for Chew
LiveOilVisc_SI) & Connally, 2 for Kartoatmodjo, 3 for Khan, 4 for De
Ghetto et al., 5 for Hossain, 6 for Elsharkawyor 7 for
Petrosky-Farshad
SetGasViscBelowBubblePoint Function sets gas viscosity data below bubble point.
(Pressure_SI As Double,
Temperature_SI As Double, GasVisc_SI
as Double)
SetGasZBelowBubblePoint Function sets gas Z data below bubble point. The
(GasZCorr as Long, GasZ as Double, acceptable values for gas Z correlation are: 0 for
Pressure_SI As Double, Standing, 1 for Hall Yarborough or 2 for Robinson et
Temperature_SI As Double) al.
IMultiPointCalib object
IMultiPointCalib object Properties
OFVF as Boolean True for Oil FVF or False for Oil Density
IMultiPointCalib object Get Methods
GetCalibUnits (UnitsArray) Function returns an array of Strings containing units
for Pressure, Solution Gas GOR, Oil Density, Oil
Viscosity and Gas Viscosity
GetCorrelations (CorrArray) Function returns an array of Longs containing
correlations for Solution Gas, OFVF, Oil Viscosity,
Gas Z factor and Gas Viscosity. Available values for
each correlation are the same as for
ISinglePointCalib methods
GetTemperature (Value As Double, Function returns a calibration temperature and units.
Units as String)
GetCalibrationAtBubblePoint Function gets calibration data at bubble point as an
(CalibData) array of Doubles. It contains values for Pressure,
Solution Gas, OFVF or Density, Oil Viscosity, Gas Z
factor and Gas Viscosity. All values are in units
supplied by GetCalibUnits method
GetCalibrationAboveBubblePoint Function gets calibration data above bubble point as
(CalibData) a two-dimensional array of Doubles. Each row
contains values for Pressure, Solution Gas, OFVF or
Density, Oil Viscosity, Gas Z factor and Gas Viscosity.
All values are in units supplied by GetCalibUnits
method
GetCalibrationBelowBubblePoint Function gets calibration data below bubble point as
(CalibData) a two-dimensional array of Doubles. Each row
contains values for Pressure, Solution Gas, OFVF or
Density, Oil Viscosity, Gas Z factor and Gas Viscosity.
All values are in units supplied by GetCalibUnits
method
IMultiPointCalib object Set Methods
SetCalibUnits (UnitsArray) Function sets units for Pressure, Solution Gas GOR,
Oil Density, Oil Viscosity and Gas Viscosity supplied
as an array of Strings

PIPESIM
Schlumberger 46 Open Link

SetCorrelations (CorrArray) Function sets correlations for Solution Gas, OFVF, Oil
Viscosity, Gas Z factor and Gas Viscosity supplied as
an array of Longs. Available values for each
correlation are the same as for ISinglePointCalib
methods
SetTemperature (Value As Double Function sets a calibration temperature in specified
Units as String) units.
SetCalibrationAtBubblePoint Function sets calibration data at bubble point passed
(CalibData) as an array of Doubles. It must contain values for
Pressure, Solution Gas, OFVF or Density, Oil
Viscosity, Gas Z factor and Gas Viscosity. All values
are in units supplied by GetCalibUnits method
SetCalibrationAboveBubblePoint Function sets calibration data above bubble point
(CalibData) passed as a two-dimensional array of Doubles. Each
row must contain values for Pressure, Solution Gas,
OFVF or Density, Oil Viscosity, Gas Z factor and Gas
Viscosity. All values are in units supplied by
GetCalibUnits method
SetCalibrationBelowBubblePoint Function sets calibration data below bubble point
(CalibData) passed as a two-dimensional array of Doubles. Each
row must contain values for Pressure, Solution Gas,
OFVF or Density, Oil Viscosity, Gas Z factor and Gas
Viscosity. All values are in units supplied by
GetCalibUnits method
IViscosityData object
IViscosityData object Properties
DeadOilCorr as Long Dead Oil Viscosity correlation. Possible values are: 0
for Beggs & Robinson, 1 for Glaso, 2 for
Kartoatmodjo, 3 for De Ghetto et al., 4 for Hossain, 5
for Elsharkawy, 6 for Petrosky-Farshad, 7 for user
specified 2 points or 8 for user-supplied table
LiveOilCorr as Long Live Oil Viscosity correlation. Possible values are: 0
for Beggs & Robinson, 1 for Chew & Connally, 2 for
Kartoatmodjo, 3 for Khan, 4 for De Ghetto et al., 5 for
Hossain, 6 for Elsharkawyor 7 for Petrosky-Farshad
EmulViscosity as Long Emulsion Viscosity Method. Possible values are: 0 for
continuous phase, 1 for volume ratio, 2 for Pipesim
Original Woelflin Loose Emulsion, 3 for Woelflin
Loose Emulsion, 4 for Woelflin Medium Emulsion, 5
for Woelflin Tight Emulsion, 6 for Brinkman, 7 for
Vand with Vand coefficients, 8 for Vand with Barnea
& Mizrahi coefficients, 9 for Vand with user-supplied
coefficients, 10 for Richardson, 11 for Leviton &
Leighton and 12 for user-supplied table
UsatOilViscosity as Long Undersaturated Oil Viscosity. Possible values are: 0
for Vasquez &Beggs, 1 for Kouzel, 2 for Kartoatmodjo,
3 for Khan, 4 for De Ghetto et al., 5 for Hossain, 6 for
Elsharkawy, 7 for Bergman & Sutton, 8 for Petrosky-
Farshad or 9 for none
IViscosityData object Get Methods
GetDOPoints (Temp1 as Double, Function returns temperature and viscosity values for
Temp2 as Double, TUnits as String, Dead Oil for user-specified 2-point Dead Oil Viscosity
Visc1 as Double, Visc2 as Double, Correlation
VUnits as String)
GetUserViscTable_SI (Table) Function returns a two-column array of Doubles

PIPESIM
Schlumberger 47 Open Link

containing values for Temperature and Viscosity for


user-supplied table Dead Oil Viscosity Correlation
GetUserEmulTable_SI (Type as Function returns a three-column array of Doubles
Long, Table) containing values for Temperature, Viscosity Ratio
and Viscosity for user-supplied table Emulsion
Viscosity. Type equals 0 for Temperature-Viscosity
Ratio table or 1 for Temperature-Viscosity table.
GetWCutCutoff (Method as Long, Function returns a watercut cutoff method (0 for
WCut As Double, Units as String) user-defined or 1for Brauner & Ullman) and a cutoff
value and units .
GetEmulCoeffs (Method as Long, Function returns a emulsion viscosity method and
Coeff1 as Double, Coeff2 as Double) user-supplied coefficients if applicable. Method
equals 9 for Vand with user-supplied coefficients, 10
for Richardson or -1 for all other chosen methods.
GetKouzelCoeffs (ParA as Double, Function returns Kouzel coefficients for
ParB as Double) Undersaturated Oil Viscosity
IViscosityData object Set Methods
SetDOPoints (Temp1 as Double, Function sets temperature and viscosity values for
Temp2 as Double, TUnits as String, Dead Oil for user-specified 2-point Dead Oil Viscosity
Visc1 as Double, Visc2 as Double, Correlation
VUnits as String)
SetUserViscTable_SI (Table) Function sets a user-supplied table for Dead Oil
Viscosity Correlation passing a two-column array of
Doubles containing values for Temperature and
Viscosity.
SetUserEmulTable_SI (Type as Long, Function sets a user-supplied table for Emulsion
Table) Viscosity passing a three-column array of Doubles
containing values for Temperature, Viscosity Ratio
and Viscosity for. Type equals 0 for Temperature-
Viscosity Ratio table or 1 for Temperature-Viscosity
table.
SetWCutCutoff (Method as Long, Function sets a watercut cutoff method (0 for user-
WCut As Double, Units as String) defined or 1for Brauner & Ullman) and a cutoff value
in specified units.
SetEmulCoeffs (Method as Long, Function sets user-supplied coefficients for
Coeff1 as Double, Coeff2 as Double) corresponding emulsion viscosity method. Method
must be 9 for Vand with user-supplied coefficients or
10 for Richardson.
SetKouzelCoeffs (ParA as Double, Function sets Kouzel coefficients for Undersaturated
ParB as Double) Oil Viscosity
IThermal object
IThermal object Get Methods
GetConductivity (Values, Units as Function returns an array of 3 Doubles containing
String) Gas, Oil and Water thermal conductivity values and a
units string
GetEnthropy (Values, Units as String) Function returns an array of 3 Doubles containing
Gas, Oil and Water heat capacity values and a units
string
ISinglePointCalib object Set Methods
SetConductivity (Values, Units as Function sets values for Gas, Oil and Water thermal
String) conductivities passed as an array of 3 Doubles in
specified units
SetEnthropy (Values, Units as String) Function sets values for Gas, Oil and Water heat
capacities passed as an array of 3 Doubles in
specified units

PIPESIM
Schlumberger 48 Open Link

ICompositional object
ICompositional object - Properties
Name As String Name of the fluid
ICompositional object - Get Methods
GetComment () As String Returns a string containing the text in the comments
field
GetPackage () As Boolean Returns the compositional package description, 0 =
Multiflash and 1 = SIEPs SPPTS
GetPackageType () As Long Returns the Compositional Package Type to use as
long integer according to the following formula:
0 = SIS Flash, 1 = Multiflash, 2 = SPPTS.
GetComponentList Returns the current component names list.
GetComponentList (pVart, pVar, pVar2, pVar = list of component names as an array of strings
HydComp1 As Long, AquComp1 As pVar2 = list of hydrocarbon names as an array of
Long) As Long strings
pVar3 = list of aqueous names as an array of strings
AquComp1 = number of aqueous components
HydComp1 = number of aqueous components.
Returns total number of components
GetLibraryComptBP (pVar) Returns the boiling points of the library components
set by SetLibraryComptCalculator.
pVar = list of boiling points as an array of doubles.
GetLibraryComptMW (pVar) Returns the molecular weight of the library
components set by SetLibraryComptCalculator.
pVar = list of molecular weights as an array of
doubles.
GetLibraryComptOM (pVar) Returns the acentric factors of the library
components set by SetLibraryComptCalculator.
pVar = list of acentric factors as an array of doubles.
GetLibraryComptPC (pVar) Returns the critical pressures of the library
components set by SetLibraryComptCalculator.
pVar = list of critical pressures as an array of doubles.
GetLibraryComptSG (pVar) Returns the specific gravities of the library
components set by SetLibraryComptCalculator.
pVar = list of specific gravities as an array of doubles.
GetLibraryComptTC (pVar) Returns the critical temperatures of the library
components set by SetLibraryComptCalculator.
pVar = list of critical temperatures as an array of
doubles.
GetLibraryList (pVar) As Long pVar = list of component descriptors as an array of
Booleans with the values corresponding to the
component names returned from
GetComponentList.
True = normal component
False = user defined (petroleum fraction) component.
Return value is a size of the array.
GetMolarList (pVar) As Long pVar = list of molar flow rates as an array of Doubles
with the values corresponding to the component
names returned from GetComponentList.
Return value is a size of the array.
GetMolWeightList (pVar) As Long pVar = list of molecular weights as an array of
doubles with the values corresponding to the
component names returned from
GetComponentList.
Return value is a size of the array.

PIPESIM
Schlumberger 49 Open Link

GetBoilingPointList (pVar) As Long pVar = list of boiling points as an array of doubles


with the values corresponding to the component
names returned from GetComponentList.
Return value is a size of the array.
GetSpecificGravityList (pVar) As pVar = list of specific gravities as an array of doubles
Long with the values corresponding to the component
names returned from GetComponentList.
Return value is a size of the array.
GetCriticalPressureList (pVar) As pVar = list of critical pressures as an array of doubles
Long with the values corresponding to the component
names returned from GetComponentList.
Return value is a size of the array
GetCriticalTemperatureList (pVar) pVar = list of critical temperatures as an array of
As Long doubles with the values corresponding to the
component names returned from
GetComponentList.
Return value is a size of the array.
GetAcentricFactorList (pVar) As pVar = list of acentric factors as an array of doubles
Long with the values corresponding to the component
names returned from GetComponentList.
Return value is a size of the array.
ICompositional object - Set Methods
SetComment (sComment As String) Sets a string in the comments field of the
compositional description 1 .
SetPackage (sPackage As Boolean) Sets the compositional package description, False =
Multiflash and true = SIEPs SPPTS.
SetPackageType (lPackageType As Sets the Compositional Package Type to use. The
Long) following values of lPackageType will set the package
as described:
0 = SIS Flash, 1 = Multiflash, 2 = SPPTS
SetComponentList (pVar, CompNum Sets the component names list.
As Long, pVar2, CompNum2 As Long) pVar = list of hydrocarbon names as an array of
strings
pVar2 = list of aqueous names as an array of strings
CompNum = number of hydrocarbon components
CompNum2 = number of aqueous components 2 .
SetMolarList (pVar, CompNum As pVar = list of molar flow rates as an array of doubles
Long) with the values corresponding to the component
names set in SetComponentList ensuring that the
molar flow rates of the aqueous components come
after the molar flow rates of the hydrocarbon
components.
CompNum = total number of components
SetLibraryList (pVar, CompNum As pVar = list of component descriptions as an array of
Long) bools with the values corresponding to the
component names set in SetComponentList
ensuring that the component descriptions of the
aqueous components come after the component
descriptions of the hydrocarbon components.
CompNum = total number of components

1
Before any set methods are called in Icompositional Interface CreateNewComposition must be called
2
After all the set methods are called from Icompositional Interface UpdateComposition must be called

PIPESIM
Schlumberger 50 Open Link

SetLibraryComptCalculator (pVar, pVar = list of library component names ONLY as an


CompNum As Long) array of strings.
CompNum = number of components within the above
list.
SetLibraryComptCalculator sets the library
component names within the compositional module
and calculates the component parameters.
SetMolwtList (pVar, CompNum As pVar = list of molecular weights as an array of
Long) doubles with the values corresponding to the
component names set in SetComponentList
ensuring that the molecular weights of the aqueous
components come after the molecular weights of the
hydrocarbon components.
CompNum = total number of components.
SetPvtFile SetPvtFile (sFile As Calls the compositional pvt file reader to read the
String) inputted pvt file.
SetBoilingPointList (pVar, CompNum pVar = list of boiling points as an array of doubles
As Long) with the values corresponding to the component
names set in SetComponentList ensuring that the
boiling points of the aqueous components come after
the boiling points of the hydrocarbon components.
CompNum = total number of components
SetSpecificGravityList (pVar, pVar = list of specific gravities as an array of doubles
CompNum As Long) with the values corresponding to the component
names set in SetComponentList ensuring that the
specific gravities of the aqueous components come
after the specific gravities of the hydrocarbon
components.
CompNum = total number of components
SetCriticalPressureList (pVar, pVar = list of critical pressures as an array of doubles
CompNum As Long) with the values corresponding to the component
names set in SetComponentList ensuring that the
critical pressures of the aqueous components come
after the critical pressures of the hydrocarbon
components.
CompNum = total number of components
SetCriticalTemperatureList (pVar, pVar = list of critical temperatures as an array of
CompNum As Long) doubles with the values corresponding to the
component names set in SetComponentList
ensuring that the critical temperatures of the aqueous
components come after the critical temperatures of
the hydrocarbon components.
CompNum = total number of components.
SetAcentricFactorList (pVar, pVar = list of acentric factors as an array of doubles
CompNum As Long) with the values corresponding to the component
names set in SetComponentList ensuring that the
acentric factors of the aqueous components come
after the acentric factors of the hydrocarbon
components.
CompNum = total number of components
ICompositional object - Operations
CreateNewComposition () Blanks all compositional arrays and parameters in
memory

PIPESIM
Schlumberger 51 Open Link

UpdateComposition () Updates all compositional arrays and parameters in


memory
SetBlob (sBlob As String) Sets data for the required composition
sBlob = String containing compositional information 3 .
FlowCorrelations Interface
CIFlowCorrelation object - Get Methods
GetHorizontalCorrelationName () Returns the horizontal correlation name. The
As String returned string is a unique keyword name.
GetHorizontalSourceName () As Returns the correlations source name (such as bja,
String tulsa)
GetVerticalCorrelationName () As Returns the vertical correlation name. The returned
String string is a unique keyword name (for example
ANSAR, BJA, BBR, BBOTD)
GetVerticalSourceName () As String Returns the correlations source name (such as bja,
tulsa)
GetSensitivityItems (VerticalCorrs Returns the 4-column array (help string, engine code,
As Boolean, Items) As Long main code and quantity class) of available sensitivity
variables in Items for Vertical (if VerticalCorrs is
True) or Horizontal (VerticalCorrs is False). Number
of items is a functions return value
CIFlowCorrelation object - Set Methods
SetHorizontalCorrelation (sSource Set a horizontal correlation. For example, for the
As String, sCorrelation As String) Tulsa correlation source it can be any of: BBO,
BBOTD, BBR, BBRTD, BJA, DKAGAD, DKAGAF, DR,
DRTD, LOCKMAR, LOCKMARTD, MB, NOSLIP,
OLIEMANS, XIAO.
sSource can be BJA, TULSA
SetHorizUserCorrelation (sSource Set a horizontal user correlation
As String, sCorrelation As String)
SetVerticalCorrelation (sSource As Set a vertical source and correlation. For example for
String, sCorrelation As String) the Tulsa correlation source it can be any of: TBB,
TDR, TGA, THB, TMB, TORK
SetVertUserCorrelation (sSource As Set a vertical user correlation
String, sCorrelation As String)
CIFlowCorrelation object - Properties
SwapAngle As Double Vertical-Horizontal Correlation Swap Angle
HorizontalFrictionFactor As Double Horizontal Friction Factor
VerticalFrictionFactor As Double Vertical Friction Factor
VerticalHoldup As Double Vertical Holdup
HorizontalHoldup As Double Horizontal Holdup
SinglePhaseCorrelation As String Any of: Moody, AGA, Pan-A, Pan-B, HazWill,
Weymouth, CULSMITH
Note: See the PIPESIM help for the complete list of available vertical and horizontal flow
correlations and sources.
CIFlowCorrelation object - Operations
DisplayDialog () Displays PIPESIM dialog for flow correlation (this
method is obsolete, use DisplayDialog2 instead).
DisplayDialog2 () As Boolean Displays PIPESIM dialog for flow correlation ().
Return value is True if data is changed and False
otherwise

3
The compositional data is provided by the call to the Ipnscom Interface

PIPESIM
Schlumberger 52 Open Link

Single Branch Operations


Single Branch operations in PIPESIM are defined as ActiveX interfaces that can be accessed from
any model. Systems Analysis, Pressure and Temperature Profiles and Flow Correlation Matching
are housed in PSOpSystems.DLL and its ActiveX interfaces are: ISystemsAnalysis, IIPTProfile
and IICorrMatching respectively. A Nodal Analysis operation interface resides in NodalOp.DLL
and can be created by defining an object of the type IINodalAnal.
The operations ActiveX interface already defined in a single branch PIPESIM model is accessed
by calling the GetOperationInterface function for an ISingleBranchModel object. The argument
returned after a call to this function will be a COM interface of the type corresponding to the
selected operation in the PIPESIM model. A call to GetOperationType () will returned the
selected operation. See (Single Branch Operations) for a list of operation IDs. Similarly, any
operation interface can be set to the model by calling SetOperationInterface () and
SetOperationType ().
Systems Analysis
ISystemsAnalysis Object - Properties
BoundaryConds As IBoundaryProps Get/set property to access boundary conditions. See
the definition of IBoundaryProps Interface for its
methods and properties
Engine As IEngineOptions Gets the IEngineOptions object to set simulation
parameters and run the operation. See
IEngineOptions Interface for its methods and
properties
FixedInjectionDepths As Boolean Applicable to gas lifted systems, this property
sets/gets whether gas lift valves are installed in the
tubing
PermuteSensVars As Boolean Sets/gets whether the sensitivity values for the
different variables are permuted against each other or
changed in step.
MaxSensitivityVars As Long Gets the max available number of the sensitivity
variables allowed for the operation
SensitivityObject (indx As Long) As indx: the sensitivity box indx. Pass 1 for the X-axis
String variable, 0,1,2,, (MaxSensitivityVars -1) for the
corresponding sensitivity.
Returns the sensitivity object name for the specified
index.
SensitivityVariable (indx As Long) As indx: the sensitivity box indx. Pass 1 for the X-axis
String variable, 0,1,2,, (MaxSensitivityVars -1) for the
corresponding sensitivity.
Returns the sensitivity variable name for the specified
index
ISystemsAnalysis Object - Get Methods
GetIsUnset () As Boolean Returns True if the operations data is all blank
(unset)
GetLastError () As String Returns an error description after function call
failure. Must be called immediately after the call to
the failed function.

PIPESIM
Schlumberger 53 Open Link

GetSensitivityData_SI (indx As Long, Returns the sensitivity data specified for the
ObjectStr As String, VarStr As String, operation.
Values_SI, QuantClass As String) Indx: the sensitivity box indx. Pass 1 for the X-axis
variable, 0,1,2, , (MaxSensitivityVars -1) for the
corresponding sensitivity.
ObjectStr: the object name is returned here
VarStr: the sensitivity variable name is returned here
Values_SI: an array of double values in strict SI units
containing the list of sensitivity values
QuantClass: the unit class name for the selected
sensitivity variable. See Unit System for a list of unit
classes
ISystemsAnalysis Object - Set Methods
SetSensitivityData (indx As Long, Sets the sensitivity information.
ObjectStr As String, VarStr As String, Indx: the sensitivity box indx. Pass 1 for the X axis
Values_DefEng, vbActive As Boolean) variable, 0,1,2, , (MaxSensitivityVars -1) for the
corresponding sensitivity.
ObjectStr: the object name
VarStr: the sensitivity variable name
Values_DefEng: an array of double values in default
engineering units containing the list of sensitivity
values
vbActive: sets the sensitivity group active (True) or
inactive (False)
SetSensitivityData_SI (indx As Long, Similar to SetSensitivityData, but uses strict SI
ObjectStr As String, VarStr As String, units
Values_SI, vbActive As Boolean, indx: the sensitivity box indx. Pass 1 for the X axis
QuantClass As String) variable, 0,1,2, , (MaxSensitivityVars -1) for the
corresponding sensitivity.
ObjectStr: the object name
VarStr: the sensitivity variable name
Values_DefEng: an array of double values in default
engineering units containing the list of sensitivity
values
vbActive: sets the sensitivity group active (True) or
inactive (False)
QuantClass: measurement string (for example
temperature, pressure etc.)
SetLanguage (nlLanguageID As Long) Sets the user interface language
As Boolean Available values for nlLanguageID are:
0x0809 English (UK)
0x0419 Russian
0x080A Spanish (Mexican)
0x0416 Portuguese (Brazilian)
0x0804 Chinese (PRC)
Function returns True if language was changed
successfully and False otherwise
ISystemsAnalysis Object - Operations
WriteOperationFile () As Boolean Writes an ASCII file (modelname.inc) containing the
instructions to the simulation engine to run the
operation.
DisplayDialog (p_VarUnitManager, Displays the operations graphical interface. Pass a
CloseOK As Boolean) Null variant as the first argument. Returns True if
dialog box was closed OK, otherwise False.

PIPESIM
Schlumberger 54 Open Link

Pressure and Temperature Profiles


IPTProfile Object - Properties
BoundaryConds As IBoundaryProps Get/set property to access boundary conditions. See
the definition of IBoundaryProps for its methods and
properties
Engine As IEngineOptions Gets the IEngineOptions object to set simulation
parameters and run the operation. See
IEngineOptions for its methods and properties
FixedInjectionDepths As Boolean Applicable to gas lifted systems, this property
sets/gets whether gas lift valves are installed in the
tubing
EnableSurveyOpts As Boolean Gets/sets whether survey data is used for profile
plotting
ProfileType As Long The default profile to be plotted initially with PSPlot:
0: Elevation vs. Pressure
1: Elevation vs. Temperature
2: Pressure vs. Total Distance
3: Temperature vs. Total Distance
SensitivityObject (indx As Long) As indx: the sensitivity box indx. Pass 1 for the X-axis
String variable, 0,1,2, , (MaxSensitivityVars -1) for the
corresponding sensitivity.
Returns the sensitivity object name for the specified
index.
SensitivityVariable (indx As Long) As indx: the sensitivity box indx. Pass 1 for the X-axis
String variable, 0,1,2, , (MaxSensitivityVars -1) for the
corresponding sensitivity.
Returns the sensitivity object name for the specified
index.
IPTProfile Object - Get Methods
GetIsUnset () As Boolean Returns true if the operations data is all blank (unset)
GetLastError () As String Returns an error description after function call
failure. Must be called immediately after the call to
the failed function.
GetSensitivityData_SI (ObjectStr As Returns the sensitivity data specified for the
String, VarStr As String, Values_SI, operation.
QuantClass As String) ObjectStr: the object name is returned here
VarStr: the sensitivity variable name is returned here
Values_SI: an array of double values in strict SI units
containing the list of sensitivity values
QuantClass: the unit class name for the selected
sensitivity variable. See Units Library for a list of unit
classes.
IPTProfile Object - Set Methods
SetSensitivityData (ObjectStr As Sets the sensitivity information.
String, VarStr As String, ObjectStr: the object name
Values_DefEng) VarStr: the sensitivity variable name
Values_DefEng: an array of double values in default
engineering units containing the list of sensitivity
values

PIPESIM
Schlumberger 55 Open Link

SetSensitivityData_SI (ObjectStr As Same as SetSensitivityData method, but for strict SI


String, VarStr As String, Values_SI, units
QuantClass As String) ObjectStr: the object name
VarStr: the sensitivity variable name
Values_SI: an array of double values in strict SI units
containing the list of sensitivity values
QuantClass: the unit class name for the selected
sensitivity variable. See Units Library for a list of unit
classes.
SetSurveyData_SI (SurveyName As Associates field data to the operation. This data
String, SurveyDate As Date, pressure and/or temperature profiles is then plotted
Var_MD_Pres_Temp) along with the calculated data.
SurveyName: an arbitrary given name (such as the
well name)
SurveyDate: the survey date
Var_MD_Pres_Temp: a three-column matrix
containing measured depths, pressure and
temperature values, in that order. Units in strict SI.
SetLanguage (nlLanguageID As Long) Sets the user interface language
As Boolean Available values for nlLanguageID are:
0x0809 English (UK)
0x0419 Russian
0x080A Spanish (Mexican)
0x0416 Portuguese (Brazilian)
0x0804 Chinese (PRC)
Function returns True if language was changed
successfully and False otherwise
IPTProfile Object - Operations
WriteOperationFile () As Boolean Writes an ASCII file (modelname.inc) containing the
instructions to the simulation engine to run the
operation.
DisplayDialog (p_VarUnitManager, Displays the operations graphical interface. Pass a
CloseOK As Boolean) Null variant as the first argument. Returns True if
dialog box was closed OK, otherwise False.
Flow Correlation Matching
ICorrMatching object - Properties
BoundaryConds As IBoundaryProps Get/set property to access boundary conditions. See
IBoundaryProps Interface for its methods and
properties
Engine As IEngineOptions Gets the IEngineOptions object to set simulation
parameters and run the operation. See
IEngineOptions Interface for its methods and
properties
EnableSurveyOpts As Boolean Gets/sets whether survey data is used for profile
plotting
ProfileType As Long The default profile to be plotted initially with PSPlot:
0: Elevation vs. Pressure
1: Elevation vs. Temperature
2: Pressure vs. Total Distance
3: Temperature vs. Total Distance
ICorrMatching object - Get Methods
GetIsUnset () As Boolean Returns true if the operations data is all blank (unset)
GetLastError () As String Returns an error description after function call
failure. Must be called immediately after the call to
the failed function.

PIPESIM
Schlumberger 56 Open Link

GetSelectedCorrelation Function returns in EngineCodes the array of string


(IsVertical As Boolean, EngineCodes) for chosen vertical flow correlations if IsVertical is
True and for horizontal correlations if IsVertical is
False
ICorrMatching object - Set Methods
SetSurveyData_SI (SurveyName As Associates field data to the operation. This data,
String, SurveyDate As Date, pressure and/or temperature profiles is then plotted
Var_MD_Pres_Temp) along with the calculated data.
SurveyName: an arbitrary given name (such as the
well name)
SurveyDate: the survey date
Var_MD_Pres_Temp: a three-column matrix
containing measured depths, pressure and
temperature values, in that order. Units in strict SI
SetSelectedCorrelation (helpStr As Set or removes selection for the correlation specified
String, engineCode As String, mainCode by engineCode depending on IsSelected value
As String, IsVertical As Boolean, IsVertical = True for vertical correlations, False for
IsSelected As Boolean) horizontal.
SetLanguage (nlLanguageID As Long) Sets the user interface language
As Boolean Available values for nlLanguageID are:
0x0809 English (UK)
0x0419 Russian
0x080A Spanish (Mexican)
0x0416 Portuguese (Brazilian)
0x0804 Chinese (PRC)
Function returns True if language was changed
successfully and False otherwise
ICorrMatching object - Operations
WriteOperationFile () As Boolean Writes an ASCII file (modelname.inc) containing the
instructions to the simulation engine to run the
operation.
DisplayDialog (p_VarUnitManager, Displays the operations graphical interface. Pass a
CloseOK As Boolean) Null variant as the first argument. Returns True if
dialog box was closed OK, otherwise False.
Nodal Analysis
INodalAnal Object - Properties
CFactor As Double Sets a Constant C value
EngineSwitch As String Sets/gets extra command line arguments for the
PIPESIM engine
FetkovichExp As Double Sets a Fetkovich n exponent value
FixedInjectionDepths As Boolean Applicable to gas lifted systems, this property
sets/gets whether gas lift valves are installed in the
tubing
FutureAOFP As Double Sets a future AOFP value
FutureIPR As Boolean Sets a flag whether to use Future IPR option (True
by default)
IncludeFilePath As String The full path name to the engines operation file
InflowCurveRangeLimit As Boolean Allow the inflow curves to extend to the AOFP (true)
InflowObject As String Returns/sets the inflow object name
InflowVariable As String Returns/sets the inflow variable name
MaxPressureForOutflow_SI As Maximum pressure for the outflow curves
Double
MaxRate_SI As Double The maximum fluidrate in strict SI units
MaxRateFluidType As Long The maximum fluid rate type: 0: liquid, 1: gas, 2 mass

PIPESIM
Schlumberger 57 Open Link

NumberInflowPoints As Long The number of points on each inflow curve


NumberOutflowPoints As Long The number of points on each outflow curve
OutflowCurveRangeLimit As Boolean Allow the outflow curves to extend to the supplied
maximum flowrate
OutflowObject As String Returns/sets the outflow object name
OutflowVariable As String Returns/sets the outflow variable name
OutletPressure_SI As Double Gets/sets the outlet pressure in strict SI units
PipesimEnginePath As String The full path to the PIPESIM engine
PlotToolPath As String The full path to the plotting tool (PSPlot)
PsmFilePath As String The full path to the model file (.psm file)
ReservoirPressure As Double Set a reservoir pressure. Used for future AOFP
calculations
RunEngineMinimised As Long Runs the engine in a minimised window
RunPlotToolWithEngine As Long If True (1) shows the plotting tool (PSPlot) as the
simulation runs
INodalAnal Object - Get Methods
GetIsEngineActive (p_bActive As Returns True (1) if the PIPESIM engine is running,
Long) otherwise False (0)
GetIsUnset GetIsUnset (pVar As Long) Returns True (1) if the operations data is all blank
(unset)
GetLastError (errorStr As String) Returns an error description after function call
failure. Must be called immediately after the call to
the failed function.
GetSensitivityData_SI (InflowOutflow Returns the sensitivity data specified for the
As Long, ObjectStr As String, VarStr As operation.
String, Values_SI, QuantClass As String) InflowOutflow: 0: inflow data, 1 outflow data
ObjectStr: the object name is returned here
VarStr: the sensitivity variable name is returned here
Values_SI: an array of double values in strict SI units
containing the list of sensitivity values
QuantClass: the unit class name for the selected
sensitivity variable. See Unit System.
INodalAnal Object - Set Methods
SetSensitivityData_SI Sets the sensitivity data specified for the operation.
(InflowOutflow As Long, ObjectStr As InflowOutflow: 0: inflow data, 1 outflow data
String, VarStr As String, Values_SI, ObjectStr: the object name
QuantClass As String) VarStr: the sensitivity variable name
Values_SI: an array of double values in strict SI units
containing the list of sensitivity values
QuantClass: the unit class name for the selected
sensitivity variable. See Unit System.
SetLanguage (nlLanguageID As Long) Sets the user interface language
As Boolean Available values for nlLanguageID are:
0x0809 English (UK)
0x0419 Russian
0x080A Spanish (Mexican)
0x0416 Portuguese (Brazilian)
0x0804 Chinese (PRC)
Function returns True if language was changed
successfully and False otherwise
INodalAnal Object - Operations
KillOperation () Terminates the engine run
RunOperation () Runs the simulation

PIPESIM
Schlumberger 58 Open Link

WriteOperationFile (bOK As Boolean) Writes an ASCII file containing the instructions to


the simulation engine to run the operation.
DisplayDialog (p_VarUnitManager) Displays the operations graphical interface. Pass a
NULL variant as the first argument.
This method is obsolete. Use DisplayDialog2
method instead
DisplayDialog2 (p_VarUnitManager, Displays the operations graphical interface. Pass a
bCloseOK As Boolean) Null variant as the first argument. Returns true if
dialog box was closed OK, otherwise false.
Wax Deposition
IWaxOp Object - Properties
RunEngineMinimised As Boolean Runs the engine in a minimised window
RunPlotToolWithEngine As Boolean If True (1) shows the plotting tool (PSPlot) as the
simulation runs
PsmFilePath As String The full path to the model file (.psm file)
PlotToolPath As String The full path to the plotting tool (PSPlot)
IncludeFilePath As String The full path name to the engines operation file
PipesimEnginePath As String The full path to the PIPESIM engine
EngineSwitch As String Sets/gets extra command line arguments for the
PIPESIM engine
WaxProperties As Variant
IWaxOp Object - Get Methods
GetLastError() As String Returns an error description after function call
failure. Must be called immediately after the call to
the failed function.
GetIsUnset() As Boolean Returns True (1) if the operations data is all blank
(unset)
GetIsEngineActive() As Boolean Returns True (1) if the PIPESIM engine is running,
otherwise False (0)
IWaxOp Object - Set Methods
SetLanguage(nlLanguageID As Long) Sets the user interface language
As Boolean Available values for nlLanguageID are:
0x0809 English (UK)
0x0419 Russian
0x080A Spanish (Mexican)
0x0416 Portuguese (Brazilian)
0x0804 Chinese (PRC)
Function returns True if language was changed
successfully and False otherwise
IWaxOp Object - Operations
DisplayDialog(p_VarUnitManager As Displays the operations graphical interface. Pass a
Variant) NULL variant as the first argument.
This method is obsolete. Use DisplayDialog2
method instead
DisplayDialog2(p_VarUnitManager As Displays the operations graphical interface. Pass a
Variant) As Boolean Null variant as the first argument. Returns true if
dialog box was closed OK, otherwise false.
RunOperation(); Runs the simulation
KillOperation(); Terminates the engine run
WriteOperationFile() As Boolean Writes an ASCII file containing the instructions to the
simulation engine to run the operation.
IWaxOp2 Object - Properties
WaxMethod As Integer WaxMethod can be one of the following values:
0: Shell;

PIPESIM
Schlumberger 59 Open Link

1: BP;
2: Schlumberger DBR;
3: None
IWaxOp3 Object - Properties
ModelIsInjectionWell As Boolean True if the model is an injection well, Flase otherwise
Single Branch Operations: Supporting Interfaces
IBoundaryProps Interface
IBoundaryProps - Properties
OutletPressure_SI As Double Gets/sets the outlet pressure in strict SI units
InletPressure_SI As Double Gets/sets the inlet pressure in strict SI units
FluidRate_SI As Double Gets/sets the fluid rate in strict SI units
CalculatedVariable As Long Gets/sets the calculated variable:
0: Outlet Pressure
1: Inlet Pressure,
2: FluidRate
FluidType As Long Gets/sets the fluidrate type:
0: liquid
1: gas
2: mass
IEngineOptions Interface
IEngineOptions - Properties
EngineSwitch As String Sets/gets extra command line arguments for the
PIPESIM engine
IncludeFilePath As String The full path name to the engines operation file
PipesimEnginePath As String The full path to the PIPESIM engine
PlotToolPath As String The full path to the plotting tool (PSPlot)
PsmFilePath As String The full path to the model file (.psm file)
RunEngineMinimised As Boolean Runs the engine in a minimised window
RunPlotToolWithEngine As Boolean If True shows the plotting tool (PSPlot) as the
simulation runs
IEngineOptions - Get Methods
GetIsEngineActive () As Boolean Returns True if the PIPESIM engine is running,
otherwise False
IEngineOptions - Operations
KillOperation () Terminates the engine run
RunOperation () Runs the simulation
Gas Lift Diagnostics COM Object
Name
The name of the COM is GLDIAGN.DLL
Supported Interfaces
GLWell interface: to model and perform diagnostics on a gas lift injected well
Dependency MAP
List of Dependencies: WELLCURVE.DLL, MFC42.DLL
GLWell Interface and Object
The GetArrayXXX functions return a one-dimensional array. The number of components in the
array is equal to the number of valves defined in the well (see the 'AddGasLiftValve5' method). The
first component in the array (index = 0) corresponds to the top valve.
GLWell Object - Get Methods
GetArrayEqCurvePressure(pVar) Returns in pVar an array of Doubles with the
equilibrium curve pressure at each valve depth
GetArrayGasRate(pVar) Returns in pVar an array of Doubles with the

PIPESIM
Schlumberger 60 Open Link

actual throughputs for each valve. Uses


Thornhill & Craver equation
GetArrayInjectionPressure(pVar) Returns in pVar an array of Doubles with the
injection pressure at each valve depth
GetArrayInjectionTemperature(pVar) Returns in pVar an array of Doubles with the
injection temperature at each valve depth
GetArrayMaxGasRate(pVar) Returns in pVar an array of Doubles with the
maximum throughputs for each valve. Uses
Thornhill & Craver equation
GetArrayProductionPressure(pVar) Returns in pVar an array of Doubles with the
production pressure at each valve depth
GetArrayProductionTemperature(pVar) Returns in pVar an array of Doubles with the
production temperature at each valve depth
GetArrayValveClosePressure(pVar) Returns in pVar an array of Doubles with closing
pressures for each valve
GetArrayValveOpenPressure(pVar) Returns in pVar an array of Doubles with
opening pressures for each valve
GetArrayValveStatus(pVar) Returns in pVar an array of Strings with the
valve status: such as Throttling, Fully Open.
GetEquilibriumCurve(pVar) Returns in pVar a 2-dimensional array of
Doubles with {injection TVD, equilibrium
pressure} pairs in [ft, psia]. The number of data
points is variable and match the results from the
plot file.
GetLastError(sLastError As String) Returns the last error message produced by
GLD.
GetProductionPressureCurve(pVar, type Returns in pVar a 2-dimensional array of
As Long) Doubles with {pressure, depth} pairs in [psia, ft].
The number of data points is variable and match
the results from the plot file.
Type: if 0 depth values are MD, if 1 depth values
are TVD
GetProductionTemperatureCurve (pVar, Returns in pVar a 2-dimensional array of
type As Long) doubles with {temperature, depth} pairs in [F, ft].
The number of data points is variable and match
the results from the plot file.
Type: if 0 depth values are MD, if 1 depth values
are TVD
GLWell Object - Set Methods
AddCalculatedPressureProfile (type As Type: 0 = MD; 1 = TVD
Long, pVar, pressUnits As String, lenUnits As pVar: a two dimensional array containing
String) Doubles {depth, pressure}
pressUnits: pressure units for the values in the
arrays
lenUnits: units for the depth values in the array.
Any of ft miles, m, km
This method can be used when the profile type
is 'Simulate' to enter an existing simulated
profile. Use in conjunction with the property
CalculatePressureProfileOnDisplay to
control the execution of PIPESIM.
AddCalculateTempProfile (type As Long, Type: 0 = MD; 1 = TVD
pVar, tempUnits As String, lenUnits As pVar: a two dimensional array containing
String) Doubles {depth, temperature} tempUnits:
temperature units for the values in the arrays
lenUnits: units for the depth values in the array.

PIPESIM
Schlumberger 61 Open Link

Any of ft miles, m, km. This method can be to


enter an existing simulated temperature profile.
If not supplied the temperature profile will be
calculated internally by the Diagnostics module.
AddDeviationSurvey (pVar, TVDUnits As Required if ProfileMode property is set to User
String, MDUnits As String) Survey AND Pressure Survey type is MD
pVar: a two dimensional array containing
Doubles {TVD, MD}
TVDUnits: units for the TVD values in the array.
Any of ft, miles, m, km
MDUnits: units for the MD values in the array.
Any of ft, miles, m, km
AddEquilibriumCurve (pVar, pressUnits pVar: a two dimensional array containing
As String, lenUnits As String) Doubles {depth, pressure}
pressUnits: pressure units for the values in the
arrays
lenUnits: units for the depth values in the array.
Any of ft, miles, m, km
This method can be used to enter an existing
equilibrium curve. Use in conjunction with the
property CalculateEqCurveOnDisplay to
control the execution of PIPESIM.
AddGasLiftValve5 (type As Long, depth As Type: valve type Any of:
Double, Ptro As Double, ptroUnits As String, 0 = IPO, 1 = PPO, 2 = IPS, 3 = PPS, 4 = Orifice, 5
Ap As Double, ApAb As Double, PortSize As = Dummy
Double, NomOD As Double, desc As String, depth [ft]: valve depth
Cd As Double, dpfo As Double) ptro: test rack pressure
ptrUnits: test rack pressure units
Ap[in2]: port area
ApAb: port area/bellows area
PortSize [in]: port size
NomOD [in]: nominal OD
Desc: valve name/model
Cd: Cd value if Cd = 0 GLD will calculate it
Dpfo [psi]: default = -7777. If default the
Venezuelan method will be used for gas
throughput calculations, if given value not equal
default value, NZ method will be used
AddPressureSurvey (type As Long, pVar, Required if ProfileMode property is set to User
pressUnits As String, lenUnits As String) Survey
Type: 0 = MD; 1 = TVD
pVar: a two dimensional array containing
Doubles {depth, pressure}
pressUnits: pressure units for the values in the
arrays
lenUnits: units for the depth values in the array.
Any of ft, miles, m, km
AddTemperatureSurvey (type As Long, Type: 0 = MD; 1 = TVD
pVar, tempUnits As String, lenUnits As pVar: a two dimensional array containing
String) Doubles {depth, temperature}
tempUnits: temperature units for the values in
the arrays
lenUnits: units for the depth values in the array.
Any of ft, miles, m, km
SetApi Optional, this parameters are written to the u2p
(api As Double) file

PIPESIM
Schlumberger 62 Open Link

SetGLWellProperties2 (gsg As Double, gsg: gas specific gravity


resDepth As Double, chp As Double, resDepth: reservoir depth [ft]
chpUnits As String, cht As Double, tht As chp: injection head pressure
Double, rest As Double, surft As Double, Qgi chpUnits: pressure units for the value entered as
As Double) chp. Any of: psia psig, bara, barg, atma, atmg,
kPa a, kPa g, kg/cm2 a, kg/cm2 g
cht: injection head temperature [F]
tht: production head temperature [F]
rest: reservoir temperature [F]
surf: surface ambient temperature [F]
Qgi: measured injection gas rate [mmscf/d]
SetHorizontalCorrelation (bsName As Optional, this parameters are written to the u2p
String, HoldupFactor As Double, file
FrictionFactor As Double)
SetIprTypeAndValue (IprType As Long, Optional, these parameters are written to the
IprValue As Double) u2p file. IprType = 0 for WELLPI, IprType = 1 for
VOGEL
SetPressureUnits (unitStr As String) Call this function to specify pressure units to
display in GLD output. Any of: psia psig, bara,
barg, atma, atmg, kPa a, kPa g, kg/cm2 a,
kg/cm2 g
SetProductionPressureGradient (value Required if ProfileMode property is set to
As Double, unitStr As String) Constant Gradient
SetSinglePhaseCorrelation (bsName As Optional, this parameters are written to the u2p
String, Efficiency As Double) file
SetTransferLinesParams3 kickOffInjPressure: casing head pressure to
(kickOffInjPressure As Double, start unloading
kickOffPres_Units As String, unloadingGrad kickOffPres_Units: the pressure units for the
As Double, unloadingGrad_Units As String, above parameter
injPresDrop As Double, injPresDrop_Units unloadingGrad: the unloading gradient
As String, locatingDPAtValve As Double, unloadingGrad_Units: Any of psi/ft, bar/m,
locatingDP_Units As String, TransferFactor atm/m, kPa/m
As Double) injPresDrop: pressure drop between valves
injPresDrop_Units: Any of: psi, bar ,atm, kPa,
kg/cm2
locatingDPAtValve: Safety factor normally used
for both injection pressure operated and
production pressure operated valves. This is an
offset from the injection pressure line to the
start of the transfer (unloading) line at each
valve location. Default value for injection
pressure operated valves is 50 psi. and default
for production pressure operated valves is 100
psi
Call this function to display transfer line plots

PIPESIM
Schlumberger 63 Open Link

SetTransferLinesParams4 The same as SetTransferLinesParams ()


(kickOffInjPressure As Double, with the added design mode parameters:
kickOffPres_Units As String, unloadingGrad SurfaceOffset: percentage of the difference
As Double, unloadingGrad_Units As String, between the operating production (wellhead)
injPresDrop As Double, injPresDrop_Units pressure and the injection pressure. The pseudo
As String, locatingDPAtValve As Double, wellhead pressure is then the operating wellhead
locatingDP_Units As String, SurfaceOffset pressure plus this surface offset value. Used in
As Double, BottomOffset As Double, Variable Gradient method in design mode.
BottomOffset_Units As String) BottomOffset: The bottom hole offset is a
pressure difference value. The pseudo flowing
bottom pressure is then the bottom hole
injection pressure minus the bottom hole offset
value. The pseudo production pressure used for
design is then a straight line drawn between the
pseudo wellhead pressure and the pseudo
bottom hole pressure. Used in Variable Gradient
method in design mode.
SetValveTemperatureFrom (long
ValveTempFrom)
This function sets the valve temperature to be
equal to :0: Production Temperature, 1: Ambient
Temperature, 2: Injection Temperature. Only
applicable in design mode
SetTransferLinesParams5
(kickOffInjPressure As Double,
kickOffPres_Units As String, unloadingGrad
As Double, unloadingGrad_Units As String,
injPresDrop As Double, injPresDrop_Units
As String, locatingDPAtValve As Double,
locatingDP_Units As String, TransferFactor
As Double, vbIsTransferPinjPprod As
Boolean)
SetTubingHeadPressure (value As Required if ProfileMode property is set to
Double, unitStr As String) Constant Gradient or Variable Gradients
SetVerticalCorrelation (bsName As Optional, this parameters are written to the u2p
String, HoldupFactor As Double, file
FrictionFactor As Double, SwapAngle As
Double)
GLWell Object - Operations
DisplayGasLiftDialog Pops up the GLD GUI
DisplayGasLiftDialog2 (JpgFilename As Same as DisplayGasLiftDialog but it allows to
String, p_VarUnitManager, bCloseOK As pass Jpeg file name where plot will be stored
Boolean)
GLWell Object - Properties
PressureProfileMode As Long Mode = 0 Constant Gradient
Mode = 1 User Survey
Mode = 2 PIPESIM Calculated
Mode = 3 Variable Gradients
Use this property to set/get the pressure profile
mode.

PIPESIM
Schlumberger 64 Open Link

CalculateEqCurveOnDisplay As Boolean If True the GLD module will calculate the


equilibrium curve just before displaying the GUI
(when calling DisplayGasLiftDialog ()). If an
existing curve has been entered with the method
AddEquilibriumCurve this property should be
set to false to avoid recalculation.
CalculatePressureProfileOnDisplay As If True (AND the profile type is 'Simulate') the
Boolean GLD module will calculate the pressure profile
just before displaying the GUI (when calling
DisplayGasLiftDialog ()). If an existing profile
has been entered with the method
AddCalculatedPressureProfile this property
should be set to false to avoid recalculation.
DesignMode As Boolean Sets the module in design mode (True)
otherwise diagnostics mode (False). Default is
False
Gor As Double The gor in scf/bbl. Required if
PressureProfileMode = 3
IterationMode As Long Mode = 0 calculate flowrate {DEFAULT}
Mode = 1 calculate inlet pressure
This is applicable when PressureProfileMode
=2
LiquidRate As Double The production liquid rate in bbl/d. Required if
PressureProfileMode = 3
PipesimEnginePath As String bstrPath is the full path to a valid PIPESIM
engine
This data is required if PressureProfileMode =
2
PipesimIterationTolerance As Double Sets/gets the tolerance in % for the convergence
of PIPESIM iterations (default = 1 %)
ProductionPressureGradient As Double The pressure gradient in psi/ft. Required if
PressureProfileMode = 0
PsmFilePath As String The full path to a valid psm file
This data is required if PressureProfileMode =
2
ReservoirPressure As Double Gets/sets the static reservoir pressure
SetDisplayUnitSystem As Long System = 0 Engineering (DEFAULT), System = 1
SI

ShowAmbientTemperature As Long (default = 1)


ShowEquilibriumCurvePlot As Long (default = 1)
ShowEquilibriumCurvePlot As Long (default = 1)
ShowInjectionPressure As Long (default = 1)
ShowProductionPressurePlot As Long (default = 1)
ShowProductionTemperature As Long (default = 1)
ShowTransferLinesPlot As Long (default = 1)
ShowValveClosePressure As Long (default = 1)
ShowValveOpenPressure As Long (default = 1)
ValveTemperature (ValveIndx As Long) As Sets to valve at 0-based index ValveIndx (top
Double valve is indx = 0) the temperature given in val
[F]. See also the function
SetValveTemperatureFrom ()
Watercut As Double The watercut in %. Required if
PressureProfileMode = 3

PIPESIM
Schlumberger 65 Open Link

WellName As String An optional well description


GLWell Object Example
VBA Sample Code
'Create an instance of the GLWell interface

Dim obj As GLDIAGNOSTICSLib.GLWell


Set obj = New GLWell

'Display all variables using SI default units


obj.SetDisplayUnitSystem = 1

'Set the pressure units to be 'barg'


obj.SetPressureUnits barg

'Assign a name to the well


obj.WellName = Well_123

'Set the well properties


gsg = 0.64 'gas specific gravity
res_depth = 8000 'reservoir depth = 8000 ft
ch_p = 1400 'injection pressure 1400 psia
ch_t = 70 'injection temperature 200 F
tub_t = 120 'tubing head temperature 120 F
res_t = 220 'reservoir temperature 220 F
amb_t = 70 'surface ambient temp 70 F
tub_head_pres = 180 'tubing head pressure 180 psia
mqgi = 2 'measured injection gas rate 2 mmscf/d

obj.SetGLWellProperties2 gsg, res_depth, ch_p, psia,ch_t, tub_t, res_t,


amb_t, mqgi
obj.SetTubingHeadPressure tub_head_pres, psia

'Set the pressure profile type to Variable Gradients


obj.PressureProfileMode = 3

'Add 4 valves valves:


'type : IPO, PPO, IPS, PPS, ORIF, DUM
'depth in ft
'test rack pressure
'test rack pressure units
'port area
'port area over bellows area
'nominal port size
'nominal external diameter
'description
'Cd value (default 0.865)
'Delta P fully open

obj.AddGasLiftValve5 IPO, 3000, 1950 , psig, 0.013, 0.0169, 0.1250, 1.5,


Camco R20 1/8 Port, 0.865, 800

obj.AddGasLiftValve5 IPO, 4000, 1960 , psig, 0.013, 0.0169, 0.1250, 1.5,


Camco R20 1/8 Port, 0.865, 800

obj.AddGasLiftValve5 IPO, 5000, 1980 , psig, 0.013, 0.0169, 0.1250, 1.5,

PIPESIM
Schlumberger 66 Open Link

Camco R20 1/8 Port, 0.865, 800

obj.AddGasLiftValve5 IPO, 6000, 1990 , psig, 0.013, 0.0169, 0.1250, 1.5,


Camco R20 1/8 Port, 0.865, 800

obj.AddGasLiftValve5 IPO, 7000, 1995 , psig, 0.013, 0.0169, 0.1250, 1.5,


Camco R20 1/8 Port, 0.865, 800

'Display the graphical interface


obj.DisplayGasLiftDialog

'Get the status of each of the valves


Dim vtest As Variant
obj.GetArrayValveStatus vtest

IGLDesign Object
IGLDesign Object - Get Methods
GetCurrentGLValve (indx As Long, Returns the recently calculated valve parameters at
manuf As String, series As String, the specified index
portname As String, portsize As Double, manuf: manufacturer name
choke As Double, mode As String, ptro series: series name
As Double, Ap As Double, Ab As Double, portname:
nomOD As Double, Cd As Double, tvd portsize:
As Double, gasrate As Double) choke: valve choke
mode: valve type (IPO, PPO, IPS, PPS, Orifice or
Dummy)
md [ft]: valve depth
ptro: test rack pressure
Ap [in2]: port area
Ab: port area/bellows area
portsize [in]: port size
nomOD [in]: nominal OD
Cd: Cd value
GetCurrentSystem(pIValveSystem As Returns the recently calculated IGLValveSystem
Object) object
GetCurrentValveSystemCount(Valve Returns the count of recently calculated GL valves
Count As Long
GetDesignBias() As IDesignBias Returns the IDesignBias object
GetDesignParams () As IDesignParams Returns the IDesignParams object
GetGLValve (indx As Long, manuf As Returns the installed valve parameters at the
String, series As String, portname As specified index
String, portsize As Double, choke As manuf: manufacturer name
Double, mode As String, ptro As Double, series: series name
Ap As Double, Ab As Double, nomOD As portname:
Double, Cd As Double, md As Double, portsize:
gasrate As Double) choke: valve choke
mode: valve type (IPO, PPO, IPS, PPS, Orifice or
Dummy)
md [ft]: valve depth
ptro: test rack pressure
Ap [in2]: port area
Ab: port area/bellows area
portsize [in]: port size
nomOD [in]: nominal OD
Cd: Cd value

PIPESIM
Schlumberger 67 Open Link

GetIsUnset(bUnset As Boolean) Returns True is data is not set and False otherwise
GetProductionPressure(depth As Returns the production pressure
Double) As Double
GetProductionTemperature(depth As Returns the production temperature
Double) As Double
GetProjectData(ProjData) Returns the array of strings containing project data
GetValveSystemCount(ValveCount As Returns the count of installed GL valves
Long)
GetLastError(errorStr As String) Returns the last error message
IGLDesign Object - Set Methods
SetCompletionParams(Params) Sets the completion type as String for report
purposes. String must be passed as Variant type
SetCurrentSystem(pIValveSystem As Sets the IGLValveSystem object
Object)
SetFlowCorrsParams(Params) Sets the flow correlation as String for report
purposes. String must be passed as Variant type
SetFluidParameters(Params) Sets the flow correlation as String for report
purposes. String must be passed as arrays of 3 String
elements. First one is GOR/OGR value, the second is
WCut value and the last one is Api value.
SetLanguage(nlLanguageID As Long) Sets the user interface language
As Boolean Available values for nlLanguageID are:
0x0809 English (UK)
0x0419 Russian
0x080A Spanish (Mexican)
0x0416 Portuguese (Brazilian)
0x0804 Chinese (PRC)
Function returns True if language was changed
successfully and False otherwise
SetProjectData(ProjData) Sets the Project data. The data must be passed as
array of 8 Strings. These strings are:
Project name,
Project User,
Job name,
Work Order,
Client Name,
Manager Name,
Company Name,
Model Specification
IGLDesign Object - Operations
AddDeviationSurvey(pVar_MDvsTVD_ Sets user-defined deviation survey
Points) pVar: a two dimensional array containing Doubles {
MD , TVD} in Strict_SI units
CheckInput(Description As String) As Validates the design data and returns True if data is
Boolean ok. Otherwise the return value is False and
Description contains the error message
DisplayGasLiftDesign(p_VarUnitMana Pops up the GLDesign GUI.
ger, bCloseOK As Boolean)
DisplayResults(p_VarUnitManager) As Pops up the results of the GL design calculations
Boolean
PerformDesign() As Boolean Runs the engine to perform design
IGLDesign Object - Properties
AmbientTemperature As Double
BottomHoleOffset As Double

PIPESIM
Schlumberger 68 Open Link

DesignInjectionPressure As Double
DesignMethod As String Can be one of the following: API, IPO-Surface Close,
Variable Gradient, PPO Design
DesignMethod_ As Long 0 for API or IPO-Surface Close,
1 for IPO-Pt Mai/Max,
2 for PPO Design
DesignSpacing As Long 0 for new spacing,
1 for current spacing
EngineFilePath As String
InjGasSpecificGravity As Double
InjGasSurfaceTemperature As
Double
InjPresDropBetweenValves As
Double
InstallCurrentSystem As Boolean
KickoffInjectionPressure As Double
LocatingDPAtValveLocation As
Double
MinimumValveInjDP As Double
MinimumValveSpacing As Double
OperatingProdPressure As Double
PackerDepth As Double
PlotToolPath As String
ProductionPressureCurve As Integer Production Pressure Curve
0 for Production Pressure Model
1 for Equilibrium Curve
PsmFilePath As String
Recommendations As String
ReservoirDepth As Double
ReservoirPressure As Double
ReservoirTemperature As Double
SurfaceOffset As Double
SurfaceOffsetDP As Double
SurfaceOffsetType As Boolean
TargetInjGasRate As Double
TransferFactor As Double
TubingName As String
UnloadingGradient As Double
UnloadingProdPressure As Double
ValveLocation As Long Top Valve location
0 for liquid to surface,
1 for liquid not to surface
ValveManufacturer As String Valve manufacturer filter value
ValveMinPortSize As Double Valve min port size filter value
ValveSeries As String Valve series filter value
ValveType As String Valve type filter value
ValveNominalOD As Double Valve size filter value
ValveTemperature As String Can be one of the following: Production, Ambient,
Injection or Unloading

PIPESIM
Schlumberger 69 Open Link

ValveTemperature_NonTop As Long Unloading temperature for non-top valve:


0 for Production
1 for Ambient
2 for Injection
3 for Unloading
ValveTemperature_Top As Long Unloading temperature for top valve:
0 for Production
1 for Ambient
2 for Injection
3 for Unloading
WellAbsorbs As Boolean
IDesignParams Object
IDesignParams Object - Properties
BracketingSpacing As Double
BracketingTVD As Double
DesignInjectionPressure As Double
InjGasSpecificGravity As Double
InjGasSurfaceTemperature As
Double
InletPressure As Double
IsBracketingEnabled As Boolean
IsPressureCondition As Boolean
KickoffInjectionPressure As Double
LiquidRate As Double
MinimumValveInjDP As Double
MinimumValveSpacing As Double
MinUnloadingLiqRate As Double
OperatingProdPressure As Double
ReservoirPressure As Double
TargetInjGasRate As Double
UnloadingGradient As Double
UnloadingProdPressure As Double
UseAnnulusGasGradient As Boolean Specifies usage of static gradient if True and
rigorous friction and elevation DP otherwise
IDesignBias Object
IDesignBias - Properties
BottomOrifCD As Double Discharge coefficient for orifice
DeltaPtroBottomValve As Double
InjPresDropBetweenValves As
Double
IsCalculateInjPresDrop As Boolean
IsPlaceIPOatBottom As Boolean
IsPlaceOrificeatBottom As Boolean
IsTransferFactorBetweenIPandPP
As Boolean
LocatingDPAtValveLocation As
Double
TransferFactor As Double

PIPESIM
Schlumberger 70 Open Link

IGLValveSystem Object
IGLValveSystem Object - Get Methods
GetGasLiftProps(InjPressure As Returns the GL properties:
Double, MaxAvailableRate As Double, InjPressure injection pressure
InjTemp As Double, GasSG As Double, MaxAvailableRate gas rate
bstrPvtFile As String, bIsBlackOil As InjTemp surface injection temperature
Boolean) GasSG gas specific gravity
bstrPvtFile PVT file name (for compositional
model)
bIsBlackOil True if black oil model deifned, False
otherwise
GetIsUnset(bUnset As Boolean) Returns True is data is not set and False otherwise
GetLastError(errorStr As String) Returns the last error message
GetValveCount(lValveCnt As Long) Returns the count of installed GL valves
IGLValveSystem Object - Set Methods
SetGasLiftProps(InjPressure As Sets the GL properties:
Double, MaxAvailableRate As Double, InjPressure injection pressure
InjTemp As Double, GasSG As Double, MaxAvailableRate gas rate
bstrPvtFile As String, bIsBlackOil As InjTemp surface injection temperature
Boolean) GasSG gas specific gravity
bstrPvtFile PVT file name (for compositional
model)
bIsBlackOil True if black oil model deifned, False
otherwise
SetLanguage(nlLanguageID As Long) Sets the user interface language
As Boolean Available values for nlLanguageID are:
0x0809 English (UK)
0x0419 Russian
0x080A Spanish (Mexican)
0x0416 Portuguese (Brazilian)
0x0804 Chinese (PRC)
Function returns True if language was changed
successfully and False otherwise
IGLValveSystem Object - Operations
AddGLValve(manuf As String, series As manuf: manufacturer name
String, portname As String, portsize As series: series name
Double, choke As Double, mode As portname:
String, ptro As Double, Ap As Double, portsize:
Ab As Double, nomOD As Double, Cd As choke: valve choke
Double, tvd As Double, gasrate As mode: valve type (IPO, PPO, IPS, PPS, Orifice or
Double) Dummy)
ptro: test rack pressure
Ap: port area
Ab: port area/bellows area
nomOD : nominal OD
Cd: Cd value
tvd : valve depth
gasrate
ClearValveSystem() Removes all installed valves
DisplayGLValveSystem(p_VarUnitMan Pops up the GL Valve System GUI
ager, bCloseOK As Boolean)

PIPESIM
Schlumberger 71 Open Link

IGLValveSystem Object - Properties


BellowsArea(iValveIndx As Long) As Gets bellows area for the valve specified by
Double iValveIndx
(Read only property)
ChokeSize(iValveIndx As Long) As (Read only property)
Double
DPFO(iValveIndx As Long) As Double
Manufacturer(iValveIndx As Long) As (Read only property)
String
MeasuredDepth(iValveIndx As Long) (Read only property)
As Double
nomOD(iValveIndx As Long) As Double (Read only property)
PortArea(iValveIndx As Long) As (Read only property)
Double
portname(iValveIndx As Long) As (Read only property)
String
portsize(iValveIndx As Long) As (Read only property)
Double
ptro(iValveIndx As Long) As Double (Read only property)
series(iValveIndx As Long) As String (Read only property)
UseAnnulusGasGradient As Boolean
UseValveDetails As Boolean
ValveCv(iValveIndx As Long) As Double (Read only property)
ValveMode(iValveIndx As Long) As (Read only property)
String
ValveModeType(iValveIndx As Long) (Read only property)
As Long
Single Branch Output Reader COM
An ATL COM DLL has been developed to read data from a performance curves file.
Name
The name of the COM is WELLCURVE.DLL.
Interfaces supported & Registering
The COM is support on C++ and Visual basic
Register the COM by using REGSVR32.EXE.
For C++ usage:
Include the following paragraph in the stdafx.h header file:
#import wellcurve.dll no_namespace
For Visual basic usage:
Include the COM object in your project, select Projects -> References, then WELLCURVELib 1.0
type library.
1. COM diagram
2. Dependency map
3. COM methods
ReadData Object - Get methods
GetFileCreatorName() As String Returns the name of the simulator that has been used to
create the performance curves.
Parameters - None
Return Value - A string.
GetNumberofVariables() As Long Returns the number of variables (data columns) in the
performance curve.
Parameters - None
Return Value - An integer.

PIPESIM
Schlumberger 72 Open Link

GetUnitofVariable(VariableName As Returns the unit of given the column variable name.


String) As String Parameters - VariableNme - Name of the column variable
Return Value -A string.
GetDataofVariable(VariableName As Returns the array of data at the given column variable name
String) in the performance curves file.
Parameters - VariableNme -Name of the column variable
Return Value - A variant (as an array of variants). The
number of elements in a sub variant is equal to the number of
data points between two NEWLINE keywords in the
VarName column plus one (for legends).
GetVariableName(Index As Long) As Returns the name of column variable given the position of
String the variable.
Parameters - Index - The position of the variable name in the
column variable list.
Return Value - A string.
GetMultipleVariablesData(Indexes) Returns the array of data at the given number of variables in
the performance curves file
Parameters - Indexes - Indexes is a variant that contains an
array of integers (indexes of the column variables)
Return Value - A variant (as an array of variants). The
number of variants in the main array is equal to the number
of elements in the Indexes array.
GetTitle() As String Returns the title of the well performance curves file.
Parameters - None
Return Value - A string.
GetNumberofDataSets() As Long Returns the number of data sets (= number of NEWLINE
cards) in the performance curves file.
Parameters - None
Return Value - An integer.
GetVariableNamesList() Returns the list of names of column variables in the
performance curves file.
Parameters - None
Return Value - A Variant. The number of elements in the
Variant is equal to the number of columns in the
performance curves file.
GetAllData() Returns the entire column variables data in the performance
curves file.
Parameters - None
Return Value - A Variant (as an array of variants). The
number of Variants in the array is equal to the number of
column variables and the number of elements (number of
double type values) in a sub Variant is equal to the number of
data points per column variable in the performance curves
file.
GetLastError() As String Returns the last error message
ReadData Object - Operations
OpenFile(FilePath As String) As Boolean Opens the given performance curves file, and returns a
Boolean type. This function must be called before any other
functions (methods) in the DLL are called.
Parameters - FileName -the full path (including the name)
of the performance curves file.
Return Value - True for successful open or False for failure
to open.

PIPESIM
Schlumberger 73 Open Link

CloseFile() As Boolean Closes the performance curves file that has been previously
opened, and returns a Boolean type. This function must be
called after finish reading the data and before open another
file.
Parameters - None
Return Value - True for successful closure, or False for
failure to close.
ReadData Object Examples
Visual C++ Sample Code
void CPerformCurve::OnRun()
{
_bstr_t CreatorName; // File creator's name
_bstr_t VarName; // Column name
int NoVars; // Number of data columns in the file
int NoSets; // Number of data sets per column
_variant_t vaData; // Data in a column
_variant_t vaVarList; // Column names list
int ist, ied; // lower and upper bound of a variant
int jst, jed; // lower and upper bound of a variant
int i, j; // Counters
SAFEARRAY *sa1, *sa2; // Supporting variables
_variant_t va1, va2; // Supporting variables
long index; // Supporting variable

// Initialize the COM library


CoInitialize(NULL);

// Define a pointer to ReadData COM object


IReadDataPtr pPerCur;

// Create an instance of ReadData


if (pPerCur.CreateInstance(_uuidof(ReadData)) != S_OK)
{
AfxMessageBox(Performance curve ReadData component not found);
return;
}

// Open the performance curve file


BOOL success = pPerCur->OpenFile(D:\\SOURCE\\CASE1\\WELL_11.PLT);

if (success)
{
// Get the file creator's name
CreatorName = pPerCur->GetFileCreatorName();

// Get number of variables (columns) in the file


NoVars = pPerCur->GetNumberofVariables();

// Get number of data sets in a column


NoSets = pPerCur->GetNumberofDataSets();

// Get name of the first column (= Column number 1 NOT 0)


VarName = pPerCur->GetVariableName(1);

// Get data for the above variable (column)


vaData = pPerCur->GetDataofVariable(VarName);

PIPESIM
Schlumberger 74 Open Link

// How to get data out of vaData


if (vaData.vt != VT_EMPTY)
{
sa1 = vaData.parray;
// Get lower bound of vaData, should be zero
ist = sa1->rgsabound[0].lLbound;
// Get upper bound of vaData, should be equal to NoSets
ied = sa1->rgsabound[0].cElements;
for (i=ist; i<=ied; i++)
{
index = i;
SafeArrayGetElement(sa1, &index, &va1);
if (va1.vt != VT_EMPTY)
{
sa2 = va1.parray;
// Get lower bound of vatmp, should be zero
jst = sa2->rgsabound[0].lLbound;
// Get upper bound of vatmp, should be equal
// to number of data points per data set plus one (legend)
jed = sa2->rgsabound[0].cElements;
for (j=jst; j<=jed; j++)
{
index = j;
SafeArrayGetElement(sa2, &index, &va2);
}
}
}
}

// Get variable list


vaVarList = pPerCur->GetVariableNamesList();

// Close the file


pPerCur->CloseFile();
}

// Destroy the pPerCur


pPerCur.Release();

// Close COM library


CoUninitialize();
}
Visual basic Sample Code
Option Explicit
Private wtst As New WELLCURVELib.ReadData ' create an object of the
performance curve reader
Private Sub Command1_Click()
Dim vtmp As Variant
Dim vData As Variant
Dim NoCol As Integer
Dim NoDataSets As Integer
Dim str As String
Dim ist As Integer
Dim ied As Integer
Dim i As Integer

PIPESIM
Schlumberger 75 Open Link

' Open the file


If (wtst.OpenFile(d:\source\case1\well_11.plt)) Then
' Get the file creator's (simulator's) name
str = wtst.GetFileCreatorName()
' Get number of variables listed in the file
NoCol = wtst.GetNumberofVariables()
' Get the variable list
vtmp = wtst.GetVariableNamesList()
If (Not IsEmpty(vtmp)) Then
ist = LBound(vtmp)
ied = UBound(vtmp)
For i = ist To ied
' Get individual variable names (method 1)
str = vtmp(i)
' Get individual variable names (method 2)
str = wtst.GetVariableName(i + 1)
' Get the data for above variable (str)
vData = wtst.GetDataofVariable(str)
Next i
End If
' Get number of data sets in the file (= number of NEWLINE keywords)
NoDataSets = wtst.GetNumberofDataSets()
' Get the title of performance curve
str = wtst.GetTitle()
' Get all variable data
vData = wtst.GetAllData()
' Get multiple variable data
' Create indexes array
ReDim vtmp(2)
vtmp(0) = 1
vtmp(1) = 4
vtmp(2) = 6
vData = wtst.GetMultipleVariablesData(vtmp)
' Close the file
wtst.CloseFile
End If
Set wtst = Nothing
End Sub

PerformCurve Object
PerformCurve Object - Get methods
GetAllVariables() Returns a Variant type containing multidimensional array of
all values from the curve file. First dimension is a number of
the variables, second dimension is a number of cases and
the third dimension contains all values for the each case
plus the case name. All returned values are wrapped into
Variants
GetAttributeDetailsAt(VariableName Returns a String (as Variant) containing plotting attributes
As String) for the specified variable
GetAxisBoundaries() Returns a Variant type containing two-dimensional array of
the low/upper boundaries for the plot variables.
GetBubblePointData() Returns (as Variant type) the array of three doubles values
for saturation pressure, saturation temperature and
saturation GOR. (Black oil models only.)

PIPESIM
Schlumberger 76 Open Link

GetColumnVariableDataAt(VarName Returns a Variant type containing two-dimensional array of


As String) all values for specified variable. First dimension is a number
of cases and the second dimension contains all values for
the each case plus the case name. All returned values are
wrapped into Variants
GetConcatenationData()
GetConeGasSG() As Double Returns a Double value (wrapped into Variant type) of cone
gas specific gravity
GetCreationDate() Returns a String value (wrapped into Variant type) of curve
file date/time stamp
GetCurrentModelUnitSettings() Returns (as Variant type) the two-column array of strings
for all plotted variables. First column contains variables
measurement and a second column contains variables units
GetDefaultXAxis() As Long Returns an index for X axis variable
GetDefaultYAxis() As Long Returns an index for Y axis variable
GetDynamicPlotFileName() As String Returns a curve file name (short form)
GetDynamicPlotLongFileName() As Returns a curve file name (long form)
String
GetFileFormatStatus() As String Return a String New if curve file has new format, otherwise
return value is Old
GetLastError() As String Returns the last error message produced by the interface.
GetMultipleColumnsDataAt(Index) Returns data similar to GetAllVariables function but for
variables passed in Index array
GetNoOfDataColumn() As Long Returns the total number of variables in curve file
GetNumberOfCases() As Long Returns the number of cases in curve file
GetPhysicalPropertyData() Returns (as Variant type) the array of 6 doubles values for
API, production gas specific gravity, injection gas specific
gravity, water specific gravity, watercut and GOR. (Black
oil models only.)
GetProductionData() () Returns (as Variant type) the array of 2 doubles values for
Well PI and static reservoir pressure
GetSimulatorName() As String Returns String with the simulator name
GetTitle() As String Returns String with the project description
GetUnitDetailsAt(VariableName As Returns (as Variant type) the array of 5 Variants containing
String) units information for the specified variable. First element is
a String with measurement name, second element is a String
with current units, third and forth elements are Doubles
with multiplier and adder for conversion from strict SI units
and last fifth element is a String with strict SI units
GetUnitsOfVariableName(sVarName Returns String with the current units for the specified
As String) As String variable
GetUnitType() As String Returns String ENG or S depending on unit system user
selected for the output files
GetUserName() As String Returns String with the user name form project properties
GetVarableNamesList() Returns (as Variant type) the array of Strings containing all
variables names from curve file
GetVariableDataAt(ColName As String) Returns (as Variant type) the array of Doubles containing all
values for the specified variable
GetVariableDataAtCase(VarName As Similar to GetVariableDataAt but returned values are for
String, CaseNo As Long) the specified case only (case index is 1-based)
GetVariableNameAt(Index As Long) As Returns String with the variable name at specified index (1-
String based)
GetViscosityData() Returns (as Variant type) the array of 4 doubles values for
temperatures and viscosities

PIPESIM
Schlumberger 77 Open Link

PerformCurve Object - Operations


OpenFile(FilePath As String) As Boolean Opens the given performance curves file, and returns a
Boolean type. This function must be called before any other
functions (methods) in the DLL are called.
Parameters - FileName -the full path (including the name)
of the performance curves file.
Return Value - True for successful open or False for failure
to open.
CloseFile() As Boolean Closes the performance curves file that has been previously
opened, and returns a Boolean type. This function must be
called after finish reading the data and before open another
file.
Parameters - None
Return Value - True for successful closure, or False for
failure to close.
IsWellFileOpened() As Boolean Returns True if the curve file is open and False otherwise
PNSReaderCOM
PNSREADER.DLL includes COM compatible interfaces that can be used to read output from the
output file (PNS) generated by the PIPESIM and PIPESIM-NET engines.
Supported Interfaces
IPNSComPtr: for network models and single branch operations.
Dependency MAP
PNSREADER.DLL has no PIPESIM dependencies. It can be found in the Schlumberger\
COMMON\ACTIVEX folder.
IPNSComPtr Interface Operational methods
ReadPnsFile Read a Net engine (.PNS) output file
Params BSTR FileName - Full path of net engine file
(.PNS)
IPNSComPtr Interface - Get Methods
GetNodeCount Get total number of nodes, junctions + wells +
source + sinks
params (#) int *iNodeCount
GetBranchCount Get total number of branches (that is excluding wells
which engine treats as branch + source/sink)
params (#) int - *BranchCount
GetNodeData Fill a supplied SAFEARRAY (blob) with node data
for i'th node, data format fixed as - name, type, g
rate, l rate, m rate, press, temp , press resid, rate
resid, glr, lgr, wcut
params int iNode - index of node in array (#)
VARIANT *vNodeData SAFEARRAY to hold data
GetBranchOutData, Fill a supplied SAFEARRAY (blob) with node data
GetBranchInData for i'th branch, data
format fixed as - name, type, g retell rate, m rate,
press, temp , press resid,
rate resid, glr, lgr, wcut
params int iNode - index of node in array
(#) VARIANT *vNodeData SAFEARRAY to hold data
GetNodeName name of the i'th node in the array
params int iNode - index in array
(#) BSTR *sName - name of i'th element
GetNodeType Get Network node type
params int iNode - index in array
(#) BSTR* sName - Source, Sink, Well, Junction

PIPESIM
Schlumberger 78 Open Link

GetBranchName name of the i'th branch in the array


params int iNode - index in array
(#) BSTR *sName - name of i'th element
GetNodeVariableValue, Gets value of variable type Gas Rate, glr etc. for i'th
GetBranchOutVariableValue, element of array
GetBranchInVariableValue params int iNode - index of element in the array
(#) double *dValue - value requested. 6 - Baker
Jardine COM documentation
PIPESIM
BSTR sType - GasRate, LiquidRate, MassRate,
Pressure, Temperature, PressureResidual,
RateResidual, GLR, LGR, Water Cut
GetNodeStrVariableValue, Gets value of variable type Gas Rate, glr etc. for
GetBranchInStrVariableValue, named element of array
GetBranchOutVariableValue Params BSTR sName - Object identifier (name) for
example, Well_1
(#) double *dValue - value requested
BSTR sType - GasRate, LiquidRate, MassRate,
pressure, Temperature, PressureResidual,
RateResidual, GLR, LGR, Water Cut, Max Pres, Comp
Power, Choke DP
GetModelStatus Gets convergence error information from the .PNS
file
Params (#) BSTR sName - Convergence status string
of the form 'Model failed to converge Convergence
error = %4.3f Material balance error = %4.3f '
IPNSComPtr Interface Examples
C++ Sample Code
CMyObj::ReadPnsFunc()
{
CString sNodeType;
CoInitialize(NULL);
IPNSComPtr pPNS;
if (pPNS.CreateInstance(_uuidof(PNSCom)) != S_OK)
{
AfxMessageBox(PNS reader component not found);
return;
}
pPNS->ReadPnsFile((LPCTSTR)case1.pns );
iNumNodes = pPNS->GetNodeCount();
iNumBranches = pPNS->GetBranchCount();
iNumWells = pPNS->GetWellCount();
BSTR ss = pPNS->GetModelStatus();
for ( int i = 0 ; i < iNumNodes; i++)
{
BSTR Name = pPNS->GetNodeName(i);
BSTR sNodeType= pPNS->GetNodeType( i );
dVal = pPNS->GetNodeVariableValue( i, Pressure);
if( dVal != Unset() ) // = -7777
{
dVal = pPNS->GetNodeVariableValue( i, Temperature);
dVal = pPNS->GetNodeVariableValue( i, MassRate);
dVal = pPNS->GetNodeVariableValue( i, LiquidRate);
dVal = pPNS->GetNodeVariableValue( i, GasRate);
dVal = pPNS->GetNodeVariableValue( i, GLR);
dVal = pPNS->GetNodeVariableValue( i, Water Cut);

PIPESIM
Schlumberger 79 Open Link

}
int start = iNumNodes + 2;
// Branches
for ( int j = 0; j <= 1; j ++ )
{
for ( i = 0; i < iNumBranches; i++ )
{
BSTR sName = pPNS->GetBranchName( i );
if ( j != 1 )
{
dVal = pPNS->GetBranchInVariableValue( i, Pressure);
dVal2 = pPNS->GetBranchOutVariableValue( i, Pressure);
dVal = pPNS->GetBranchInVariableValue( i, Temperature);
dVal = pPNS->GetBranchInVariableValue( i, MassRate);
dVal = pPNS->GetBranchInVariableValue( i, LiquidRate);
dVal = pPNS->GetBranchInVariableValue( i, GasRate);
dVal = pPNS->GetBranchInVariableValue( i, GLR);
dVal = pPNS->GetBranchInVariableValue( i, Water Cut);
dVal = pPNS->GetBranchInVariableValue( i, Max Pres);
dVal = pPNS->GetBranchInVariableValue( i, Comp Power);
dVal = pPNS->GetBranchInVariableValue( i, Choke DP);
}
else
{
dVal = pPNS->GetBranchOutVariableValue( i, Pressure);
dVal2 = pPNS->GetBranchInVariableValue( i, Pressure);
dVal = pPNS->GetBranchOutVariableValue( i, Temperature);
dVal = pPNS->GetBranchOutVariableValue( i, MassRate);
dVal = pPNS->GetBranchOutVariableValue( i, LiquidRate);
dVal = pPNS->GetBranchOutVariableValue( i, GasRate);
dVal = pPNS->GetBranchOutVariableValue( i, GLR);
dVal = pPNS->GetBranchOutVariableValue( i, Water Cut);.

dVal = pPNS->GetBranchOutVariableValue( i, Max Pres);


dVal = pPNS->GetBranchOutVariableValue( i, Comp Power);
dVal = pPNS->GetBranchOutVariableValue( i, Choke DP);
}
start ++;
}
}
// Wells
for ( j = 0; j <= 1; j ++ )
{
for ( i = 0; i < iNumWells; i++ )
{
BSTR sName = pPNS->GetWellName( i );
if ( j != 1 )
{
dVal = pPNS->GetWellInVariableValue( i, Pressure);
dVal = pPNS->GetWellInVariableValue( i, Temperature);
dVal = pPNS->GetWellInVariableValue( i, MassRate);
dVal = pPNS->GetWellInVariableValue( i, LiquidRate);
dVal = pPNS->GetWellInVariableValue( i, GasRate);
dVal = pPNS->GetWellInVariableValue( i, GLR);
dVal = pPNS->GetWellInVariableValue( i, Water Cut);
dVal = pPNS->GetWellInVariableValue( i, Max Pres);
dVal = pPNS->GetWellInVariableValue( i, Comp Power);

PIPESIM
Schlumberger 80 Open Link

dVal = pPNS->GetWellInVariableValue( i, Choke DP);


}
else
{
dVal = pPNS->GetWellOutVariableValue( i, Pressure);
dVal = pPNS->GetWellOutVariableValue( i, Temperature);
dVal = pPNS->GetWellOutVariableValue( i, MassRate);
dVal = pPNS->GetWellOutVariableValue( i, LiquidRate);
dVal = pPNS->GetWellOutVariableValue( i, GasRate);
dVal = pPNS->GetWellOutVariableValue( i, GLR);
dVal = pPNS->GetWellOutVariableValue( i, Water Cut);
dVal = pPNS->GetWellOutVariableValue( i, Max Pres);
dVal = pPNS->GetWellOutVariableValue( i, Comp Power);
dVal = pPNS->GetWellOutVariableValue( i, Choke DP);
}
start ++;
}
}
pPNS.Release();
CoUninitialize();
}
VBA Sample Code
Taken from EXPORT.XLS Open Link Case study
Private Sub ShowResults()

Dim PnsReader As New PNSREADERLib.PNSCom


Dim filename

'clear output range


Set rv = Range(OUTVAL_RANGE)
rv.ClearContents

filename = Range(MODELFILE)
pos = InStr(1, filename, .bpn, 1)
If (pos > 0) Then
filename = Left(filename, pos)
filename = filename + pns
End If

Dim nodeindex As Long


Dim sourcename As Variant
Dim value As Double
Dim bOK

If (PnsReader.ReadPnsFile(filename)) Then

Set r = Range(SOURCE_RANGE)
Dim col
col = 1

Set r1 = Range(OUTINJGAS_RANGE2)
r1.ClearContents

Set r2 = Range(OUTFLOWRATE_RANGE2)
r2.ClearContents

PIPESIM
Schlumberger 81 Open Link

For Each sourcename In r.Columns


nodeindex = PnsReader.GetNodeIndex(sourcename)

If (nodeindex <> -1) Then

value = PnsReader.GetNodeVariableValue(nodeindex, Pressure)


If (value <> -7777) Then
rv.Cells(1, col) = value
End If

If (value <> -7777) Then


value = PnsReader.GetNodeVariableValue(nodeindex,
Temperature)
rv.Cells(2, col) = value
End If

If (value <> -7777) Then


value = PnsReader.GetNodeVariableValue(nodeindex,
LiquidRate)
rv.Cells(3, col) = value
End If

If (value <> -7777) Then


value = PnsReader.GetNodeVariableValue(nodeindex, GasRate)
rv.Cells(4, col) = value
End If

If (value <> -7777) Then


value = PnsReader.GetNodeVariableValue(nodeindex, MassRate)
rv.Cells(5, col) = value
End If

If (value <> -7777) Then


value = PnsReader.GetNodeVariableValue(nodeindex, GLR)
rv.Cells(6, col) = value
End If

If (value <> -7777) Then


value = PnsReader.GetNodeVariableValue(nodeindex, Water
Cut)
rv.Cells(7, col) = value
End If

End If

'--------------------------------------------------------
'Get the pressure profiles ------------------------------

Dim PltReaderObj As New WELLCURVELib.PerformCurve


Dim plcfile, tempfile
Dim distance
Dim pressure

plcfile = Range(MODELFILE)
tempfile = plcfile

PIPESIM
Schlumberger 82 Open Link

Do
pos = InStr(1, tempfile, \, 1)
tempfile = Right(tempfile, Len(tempfile) - pos)
Loop While pos > 0

If (Len(tempfile) > 0) Then

plcfile = Left(plcfile, Len(plcfile) - Len(tempfile))


plcfile = plcfile + sourcename + .plc

If (PltReaderObj.OpenWellFile(plcfile)) Then

distance = PltReaderObj.GetColumnVariableDataAt(Total
Distance (ft))

Dim Lower, Upper, i

Lower = LBound(distance(0), 1)
Upper = UBound(distance(0), 1)

For i = Lower To Upper - 1

r1.Cells(i + 1) = distance(0)(i)

Next

pressure =
PltReaderObj.GetColumnVariableDataAt(Pressure (psia))

Dim LowerO, UpperO


Dim outter

LowerO = LBound(distance(0), 1)
UpperO = UBound(distance(0), 1)

For outter = LowerO To UpperO - 1

r2.Cells(outter + 1, col) = pressure(0)(outter)

Next

Set rtitle = Range(CASE1TITLE_RANGE)


rtitle.Cells(1, col) = pressure(0)(outter)

PltReaderObj.CloseWellFile

End If
End If

col = col + 1
Next

End If
End Sub

PIPESIM
Schlumberger 83 Open Link

Inflow Performance Calculator COM


Name
The name of the COM module is WellModelCOM.DLL.
Interfaces supported & Registration
Support provided for any COM compliant application
Supported COM Interfaces
Jones: To fit and visualise the IPR curve for a given number of data points according to the Jones'
equation:
Pws - Pwf = BQ + AQ^2 (Liquid)
Pws^2 - Pwf^2 = BQ + AQ^2 (Gas)
Dependency MAP
List of Dependencies: Spr32x30.ocx, TeeChart.ocx, MFC42.DLL
COM Interface: Jones - Get Methods
GetJonesAandBConstants ([out] a: the value of the A parameter in the Jones equation
double * a, [out] BSTR * a_unit, [out] a_unit: the unit string for the A parameter
double * b, [out] BSTR * b_unit) b: the value of the B parameter in the Jones equation
b_unit: the unit string for the B parameter
COM Interface: Jones - Set Methods
AddFlowrateAndPwfPoint ([in] frate: flowrate value (double)
double frate, [in] BSTR frate_unit, frate_unit: unit string for the flowrate value. Any of:
[in] double pwf, [in] BSTR pwf_unit) STB/d, sm3/d for Liquid Rates OR: mmscf/d mscf/d,
scf/d, mmsm3/d, msm3/d, sm3/d for gas rates
pwf: tubing flowing pressure (double)
pwf_unit: unit string for the pwf value: Any of: psia
psig, bara, barg, atma, atmg, kPa a, kPa g, kg/cm2 a,
kg/cm2 g
Call this function once for each survey point.
AddFlowrateAndPwfData ([in] ftype: fluid type, type_liquid = 0, type_gas = 1
short ftype, [in] BSTR frate_unit, [in] frate_unit: unit string for the flowrate value. Any of:
BSTR pwf_unit, [in] BSTR Legend, STB/d, sm3/d for Liquid Rates OR: mmscf/d mscf/d,
[in] VARIANT * vData, [in] const scf/d, mmsm3/d, msm3/d, sm3/d for gas rates
unsigned long pType) pwf_unit: unit string for the pwf value: Any of: psia
psig, bara, barg, atma, atmg, kPa a, kPa g, kg/cm2 a,
kg/cm2 g
Legend: Legend to show on plot
vData: variant whose SAFEARRAY contains a 2D
array (col[0] = FlowRate data, col[1] = Pwf data) Line
= 0; Bar = 1; HorizBar = 2; Area = 3; Point = 4
Use this function to compare an observed set of
points with the fitted curve.
SetFluidType (/*[in]*/ short ftype) ftype: fluid type, type_liquid = 0, type_gas = 1
SetStaticPressure ([in] double pres, Pres: static pressure value
[in] BSTR unitStr) UnitStr: units for the pressure value. Any of: psia psig,
bara, barg, atma, atmg, kPa a, kPa g, kg/cm2 a, kg/cm2
g
SetJonesAConstant ([in] double val: the A parameter in the Jones equation
val, [in] short unitSystem) unitSystem: 0: val is in default Eng : psi/(STB/d)^2
(liq) or (psi/mmscf/d)^2 (gas)
1: val is default SI: bar/(sm3/d)^2 (liq) or
(bar/mmsm3/d)^2 (gas)
Set this value to calculate the B parameter given A
and one survey point

PIPESIM
Schlumberger 84 Open Link

SetJonesBConstant ([in] double val: the B parameter in the Jones equation


val, [in] short unitSystem) unitSystem: 0: val is in default Eng: psi/STB/d (liq) or
psi2/mmscf/d (gas) 1: val is default SI: bar/sm3/d (liq)
or bar2/mmsm3/d (gas). Set this value to calculate the
A parameter given B and one survey point
SetJonesMeasuredAConstant ([in] val: the A parameter in the Jones equation
double val, [in] short unitSystem) unitSystem: 0: val is in default Eng: psi/(STB/d)^2
(liq) or (psi/mmscf/d)^2 (gas) 1: val is default SI:
bar/(sm3/d)^2 (liq) or (bar/mmsm3/d)^2 (gas) For
display purposes only. Set this value to compare a
measured pair of A and B values with the calculated
ones
SetJonesMeasuredBConstant ([in] val: the B parameter in the Jones equation
double val, [in] short unitSystem) unitSystem: 0: val is in default Eng: psi/STB/d (liq) or
psi2/mmscf/d (gas) 1: val is default SI: bar/sm3/d (liq)
or bar2/mmsm3/d (gas)
For display purposes only. Set this value to compare a
measured pair of A and B values with the calculated
ones
SetUnitSystem ([in] long unitSystem: 0: values will be displayed in default
unitSystem) Engineering units; 1: SI units
COM Interface: Jones - Operations
DoCalculateConstants () Calculates the A and B parameters based on the given
data: static reservoir pressure and {pwf, flowrate}
points
ShowInflowPerformanceDlg () Displays the IPR COM graphical interface
COM Interface: Jones Example
VBA Sample Code
'Create an instance of the Jones COM interface
Dim JonesObj As WELLMODELCOMLib.Jones
Set JonesObj = New Jones

'Set static pressure as 4000 psia


'legal pressure units: psia psig bara barg atma atmg kPa a kPa g kg/cm2
kg/cm2 g

pws = 4000.0
pws_unit = 'psia'
JonesObj.SetStaticPressure pws, pws_unit

'Set the fluid type: 0 for liquid 1 for Gas


JonesObj.SetFluidType 1 'Gas

'legal liquidRate units : STB/d sm3/d


'legal gasRate units mmscf/d mscf/d, scf/d, mmsm3/d msm3/d, sm3/d,

'Add 4 data points


JonesObj.AddFlowrateAndPwfPoint 10.0, 'mmscf/d', 3600, 'psia'
JonesObj.AddFlowrateAndPwfPoint 28.0, 'mmscf/d', 2400, 'psia'
JonesObj.AddFlowrateAndPwfPoint 30.0, 'mmscf/d', 2100, 'psia'
JonesObj.AddFlowrateAndPwfPoint 25.0, 'mmscf/d', 1600, 'psia'

' Display graphical interface to show the fitted curve and calculated
constants
JonesObj.ShowInflowPerformanceDlg

PIPESIM
Schlumberger 85 Open Link

Units Library
IUnitSystem Interface
Note: See Unit System for the available quantity names and unit strings.
Convert Converts in_value to [out_value, out_unit] given the
[in] BSTR quantity_name, [in] double in_values conversion factor and adder to convert it
in_value, [in] double factor_to_SI, [in] to its strict SI unit. Returns out_value in the given
double adder_to_SI, [in] BSTR out_unit
out_unit, [out, retval] double *
out_value
Convert_SI Converts a given quantity in strict SI units to the
[in] BSTR quantity name, [in] double given out_unit
si_value, [in] BSTR out_unit, [out,
retval] double * out_value
ConvertAny Converts a quantity given as [in_value, in_units] to
[in] BSTR quantity_name, [in] double an out_unit
in_value, [in] BSTR in_unit, [in] BSTR
out_unit, [out, retval] double *
out_value
ConvertStrictSIToCurrentUnits Converts a quantity given as [value] in strict SI to an
[in] BSTR quantity_name, [in] double out_unit defined according to the units file
value, [in] BSTR out_unit, [out, retval] imported using ImportUnitFile. By default it will
double * out_value be Eng units if no unit file has been imported
ConvertToDefEng Converts a quantity given as [in_value, in_units] to
[in] BSTR quantity_name, [in] double the PIPESIMs default engineering unit for that
value, [in] BSTR value_unit, [out] BSTR quantity.
*eng_unit, [out, retval] double
*eng_value
ConvertToDefSI Converts a quantity given as [in_value, in_units] to
[in] BSTR quantity_name, [in] double the PIPESIMs default SI unit for that quantity.
value, [in] BSTR value_unit, [out] BSTR Please note that default SI is not necessarily equal
*si_unit, [out, retval] double * si_value to strict SI.
ConvertToStrictSI Converts a quantity given as [in value, in units] to
[in] BSTR quantity_name, [in] double the strict SI unit for that quantity. Please note that
value, [in] BSTR value_unit, [out] BSTR default SI is not necessarily equal to strict SI
*si_unit, [out, retval] double *si_value
DisplayUnitDialog Displays the graphical user interface for unit system
[in] VARIANT_BOOL selection.
bShowFileOptions, [in]
VARIANT_BOOL bShowDeaultOptions,
[out] VARIANT * pVar
GetDefEngUnitString Returns the default engineering unit string for a
[in] BSTR quantity name, [out, retval] given quantity.
BSTR * unit string
GetDefSIUnitString Returns the default SI unit string for a given
[in] BSTR quantity_name, [out, retval] quantity.
BSTR * unit_string
GetLastError Returns an error description. This method should
[out, retval] BSTR * ErrorStr be called immediately after a function has returned
an error code.
GetStrictSIUnitString Returns the strict SI unit string for a given quantity.
[in] BSTR quantity name, [out, retval]
BSTR * unit_string

PIPESIM
Schlumberger 86 Open Link

GetUnitStrings Returns an array of unit strings defined for the


[in] BSTR quantity name, [out] given quantity.
VARIANT * pVar
GetUnknownValue Returns PIPESIMs definition of unset or
[out, retval] double *pVal unknown value.
ImportUnitFile [in] BSTR filename Imports a saved units file (saved by default with a
.unf extension)
IReal Interface
UnitClass Gets/sets unit class name
string
SetRealValue Sets a Value in the specified unit string
[in] double Value, [in] BSTR Unit
GetRealVal Returns a value in the units corresponding to pUnit
[out] double * pValue, [out] BSTR *
pUnit
SetSelectedUnit Selects the given unit string
[in] BSTR UnitStr, [out, retval]
VARIANT_BOOL
GetSelectedUnit Returns the selected unit string
[out, retval] BSTR * UnitStr
GetDefEngValue Returns the value in default engineering units
[out, retval] double * Val
GetStrictSIValue Returns the value in strict SI units
GetUserValue Returns the value in user selected units
SetStrictSIValue Sets a Value in strict SI units

PIPESIM
Schlumberger 87 Open Link

Defined constants and strings


Object Type Identifiers
Object ID Object Type Description
1 n_FOLD (network folder)
2 (network source)
n_SOURCE
3 n_SINK (network sink)
4 n_JUNC (network junction)
5 n_BRANCH (network branch)
6 n_TEXT (text object)
7 n_PRODWELL (network production well)
8 n_INJWELL (network injection well)
30 n_REINJECTOR (network reinjector)
31 n_WELLCONNECTOR (network well connector)

Object ID Object Type Description


10 n_PINTSOURCE (single branch source)
11 n_PINTVERTCOMP (Vertical Comp.)
12 n_PINTHORCOMP (Horizontal Comp.)
13 n_FLOWLINE (Flowline)
14 n_RISER (Riser)
15 n_CONNECTOR (Zero length connector)
16 n_TUBING (Tubing)
17 n_NODE (generic node)
18 n_CHOKE (choke)
19 n_COMPRESSOR (compressor)
20 n_EXPANDER (expander)
21 n_HEATX (heat exchanger)
22 n_PUMP (centrifugal pump)
23 n_BOOSTER (multiphase booster)
24 n_INJECTOR (injection point)
25 n_SEPARATOR (separator)
26 n_REPORT (report tool)
27 n_ADDMULT (adder/multiplier)
28 n_NAPOINT (nodal analysis point)
29 n_EKT (engine keyword tool)
32 n_SSSV (SSSV, tubing sub-component)
33 n_GLValve (Gas Lift valve, subcomponent)
34 n_BLACKBOX (Generic equipment type)
Object Properties
Vertical Completion objects properties
Common properties
Property name Description
PRESSURE Static reservoir pressure
TEMPERATURE Reservoir temperature
IPRTYPE Completion model type (see IPR Types
(Vertical))

PIPESIM
Schlumberger 88 Open Link

Well PI specific properties


Property name Description
WELLPI FLUIDTYPE Fluid type for the model (see Fluid Types)
WELLPI GASPI Gas PI
WELLPI LIQPI Liquid PI
WELLPI NONLINEARCORRECTION Use Vogel below bubble point (for liquid)
Vogels Equation specific properties
Property name Description
VOGEL AOFP Absolute Open Flow Potential
VOGEL N Vogel coefficient
Fetkovitchs Equation specific properties
Property name Description
FETKOVITCH AOFP Open Flow Potential
FETKOVITCH N n exponent
Joness Equation specific properties
Property name Description
JONES FLUIDTYPE (see Fluid Types) Fluid type for the model (see Fluid Types)
JONES GASA A (turb) coefficient for Gas
JONES GASB B (lam) coefficient for Gas
JONES LIQA A (turb) coefficient for Liquid
JONES LIQB B (lam) coefficient for Liquid
BackPressure Equation specific properties
Property name Description
BACKPRESSURE C Constant C
BACKPRESSURE N Slope n
Pseudo Steady State specific properties
Property name Description
PSEUDOSS IPRBASIS Fluid type for the model (see Fluid Types)
PSEUDOSS USEPSEUDOPRES Use pseudo pressure method (for gas)
PSEUDOSS VOGEL Use Vogel below bubble point (for liquid)
PSEUDOSS THICKNESS Reservoir thickness
PSEUDOSS WELLBOREID Wellbore diameter
PSEUDOSS PERMEABILITY Reservoir permeability
PSEUDOSS DEFRADIUS Use Drainage radius (if set)
PSEUDOSS DRAINRADIUS Drainage radius
PSEUDOSS RESAREA Reservoir area
PSEUDOSS SHAPEFACTOR Shape factor
PSEUDOSS SKIN Mechanical skin
PSEUDOSS RATESKIN GAS Rate dependent skin for gas
PSEUDOSS RATESKIN LIQ Rate dependent skin for liquid
PSEUDOSS CALCSKIN Calculate Mechanical skin (if set)
PSEUDOSS CALCRATESKIN Calculate Rate dependent skin (if set)
PSEUDOSS COMPOPTIONS Completion options type
PSEUDOSS DAMAGEDID Damaged zone diameter
PSEUDOSS DAMAGEDPERM Damaged zone permeability
PSEUDOSS COMPACTEDID Compacted zone diameter
PSEUDOSS COMPACTEDPERM Compacted zone permeability
PSEUDOSS GRAVELPERM Gravel pack permeability
PSEUDOSS GRAVELTUNNEL Gravel pack tunnel length
PSEUDOSS GRAVELCASINGID Gravel pack casing ID
PSEUDOSS GRAVELSCREENSZ Gravel pack screen diameter

PIPESIM
Schlumberger 89 Open Link

PSEUDOSS COMPVERTPERM Completion vertical permeability


PSEUDOSS COMPINTERVAL Completion open interval
PSEUDOSS COMPDEVIATION Completion deviation
PSEUDOSS PERFSKINMETHOD Perforation skin method (0 for McLeod, 1 for
Karakas/Tariq)
PSEUDOSS PERFID Perforation diameter
PSEUDOSS PERFLENGTH Depth of penetration
PSEUDOSS PERFSHOTDENSITY Perforation density
PSEUDOSS PERFPHASEANG Phase angle
PSEUDOSS FPSKINMETHOD FracPack skin method (0 for Fracture
properties, 1 for conductivity)
PSEUDOSS FPFRACHALFLEN Fracture half length
PSEUDOSS FPFRACWIDTH Fracture width
PSEUDOSS FPPROPPERM Fracture proppant permeability
PSEUDOSS FPCOND FracPack conductivity
PSEUDOSS FPFACESKINCALC Include Frac Face skin (if set)
PSEUDOSS FPDAMAGEDEPTH Frac Face Depth of damage
PSEUDOSS FPDAMPERM Frac Face Damage permeability
PSEUDOSS FPCHOKESKINCALC Include Choke Fracture skin (if set)
PSEUDOSS FPCHOKELENGTH Choke length
PSEUDOSS FPCHOKEPERM Frac choke permeability
PSEUDOSS DZSKINCALC Include damaged zone skin (if set)
PSEUDOSS GPSKINCALC Include gravel pack skin (if set)
PSEUDOSS PFSKINCALC Include perforation skin (if set)
PSEUDOSS PPDSKINCALC Include partial penetration/deviation skin (if
set)
PSEUDOSS FPSKINCALC Include FracPack skin (if set)
Forchheimers Equation specific properties
Property name Description
FORCH A A (lam) coefficient
FORCH F F (turb) coefficient
Hydraulic Fracture specific properties
Property name Description
HYDFRACT IPRBASIS Fluid type for the model (see Fluid Types)
HYDFRACT VOGEL Use Vogel below bubble point (for liquid)
HYDFRACT PERMEABILITY Reservoir permeability
HYDFRACT THICKNESS Reservoir thickness
HYDFRACT DRAINRADIUS Drainage radius
HYDFRACT WELLBOREID Wellbore diameter
HYDFRACT FRACTLENGTH Fracture half length
HYDFRACT FRACTPERM Fracture permeability
HYDFRACT FRACTWIDTH Fracture width
HYDFRACT TRANSIENT Use transient parameters (if set)
HYDFRACT TIME Time
HYDFRACT POROSITY Porosity
HYDFRACT COMPRESS Total compressibility
Transient specific properties
Property name Description
TRANSIENTIPR IPRBASIS Fluid type for the model (see Fluid Types)
TRANSIENTIPR USEPSEUDOPRES Use pseudo pressure method (for gas)
TRANSIENTIPR VOGEL Use Vogel below bubble point (for liquid)
TRANSIENTIPR PERMEABILITY Reservoir permeability

PIPESIM
Schlumberger 90 Open Link

TRANSIENTIPR THICKNESS Reservoir thickness


TRANSIENTIPR DRAINRADIUS Drainage radius
TRANSIENTIPR WELLBOREID Wellbore diameter
TRANSIENTIPR TIME Time
TRANSIENTIPR POROSITY Porosity
TRANSIENTIPR COMPRESS Total compressibility
TRANSIENTIPR SKIN Mechanical skin
TRANSIENTIPR RATESKIN GAS Rate dependent skin for gas
TRANSIENTIPR RATESKIN LIQ Rate dependent skin for liquid
TRANSIENTIPR CALCSKIN Calculate Mechanical skin (if set)
TRANSIENTIPR CALCRATESKIN Calculate Rate dependent skin (if set)
TRANSIENTIPR COMPOPTIONS Completion options type
TRANSIENTIPR DAMAGEDID Damaged zone diameter
TRANSIENTIPR DAMAGEDPERM Damaged zone permeability
TRANSIENTIPR COMPACTEDID Compacted zone diameter
TRANSIENTIPR COMPACTEDPERM Compacted zone permeability
TRANSIENTIPR GRAVELPERM Gravel pack permeability
TRANSIENTIPR GRAVELTUNNEL Gravel pack tunnel length
TRANSIENTIPR GRAVELCASINGID Gravel pack casing ID
TRANSIENTIPR GRAVELSCREENSZ Gravel pack screen diameter
TRANSIENTIPR COMPDEVIATION Completion deviation
TRANSIENTIPR PERFSKINMETHOD Perforation skin method (0 for McLeod, 1 for
Karakas/Tariq)
TRANSIENTIPR COMPINTERVAL Completion open interval
TRANSIENTIPR COMPVERTPERM Completion vertical permeability
TRANSIENTIPR PERFID Perforation diameter
TRANSIENTIPR PERFLENGTH Depth of penetration
TRANSIENTIPR PERFSHOTDENSITY Perforation density
TRANSIENTIPR PERFPHASEANG Phase angle
TRANSIENTIPR DZSKINCALC Include damaged zone skin (if set)
TRANSIENTIPR GPSKINCALC Include gravel pack skin (if set)
TRANSIENTIPR PFSKINCALC Include perforation skin (if set)
TRANSIENTIPR PPDSKINCALC Include partial penetration/deviation skin (if
set)
FCV properties
Property name Description
FCV VALVETYPE FCV type: 0 generic, 1-specific
(manufactured)
FCV GENERICVALVETYPE Generic FCV type: 0 equivalent choke area,
1 maximum rate through valve
FCV CHOKEEQUATION Gas choke equation: 0 mechanistic
FCV EQCHOKEARIA Equivalent choke area
FCV MAXLIQRATE Maximum liquid rate through valve
FCV MAXGASRATE Maximum gas rate through valve
FCV LIQCOEFF Liquid flow coefficient
FCV GASCOEFF Gas flow coefficient
FCV PRESSDROP Pressure drop ratio factor
FCV MANUFACTURER FCV manufacturer
FCV TYPE FCV type (munufacturers specific)
FCV PARTNUMBER FCV partnumber
FCV VALVEPOSITION Valve postion
FCV VALVEPERSENTOPEN Valve percent open

PIPESIM
Schlumberger 91 Open Link

Tubing objects properties


Common properties
Property name Description
ACTIVATE Make tubing active
TUBING MODEL Tubing model (0: simple, 1 detailed)
LIFT TYPE Artificial Lift type (0: Gas Lift, 1: ESP)
KICKOFF ANGLE Kick Off angle
KICKOFF TVD Kick Off TVD
PERFS MD Perforation MD
PERFS TEMPERATURE Reservoir Temperature
PERFS TVD Perforation TVD
SURFACE TEMPERATURE Surface temperature
SURFACE TVD Surface TVD
COILED TUB MD Coiled tubing bottom MD
COILED TUB RATE OPTION Coiled tubing rate option (0 for gas rate, 1 for
GLR)
COILED TUB RATE Coiled tubing gas rate
COILED TUB GLR Coiled tubing GLR
COILED TUB SPECIFIC GRAVITY Coiled tubing specific gravity
COILED TUB ID Coiled tubing ID
COILED TUB SURFACE PRESSURE Coiled tubing gas rate surface pressure
COILED TUB OD Coiled tubing OD
Tubing sub-object properties
(accessed by GetPropertyValAtObjectIndex& SetPropertyValAtObjectIndex methods)
Property name Description
CHOKE
CHOKE MD Choke MD
BEAN SIZE Bean size

Property name Description


PUMP
ESP MD ESP MD (simple profile)
ESP STAGES Number of stages (simple profile)
ESP SPEED ESP speed (simple profile)
ESP MANUFACTURER Manufacturer name (simple profile)
ESP MODEL Model name (simple profile)
ESP EFFICIENCY ESP efficiency (simple profile)
ESP GASSEPARATOR Gas separator present (if set) (simple profile)
ESP SEPEFFICIENCY Separator efficiency (simple profile)
ESP MD NODE Same as ESP MD but for detailed profile
ESP STAGES NODE Same as ESP STAGES but for detailed profile
ESP SPEED NODE Same as ESP SPEED but for detailed profile
ESP MANUFACTURER NODE Same as ESP MANUFACTURER but for
detailed profile
ESP MODEL NODE Same as ESP MODEL but for detailed profile
ESP EFFICIENCY NODE Same as ESP EFFICIENCY but for detailed
profile
ESP GASSEPARATOR NODE Same as ESP GASSEPARATOR but for
detailed profile
ESP SEPEFFICIENCY NODE Same as ESP SEPEFFICIENCY but for
detailed profile

PIPESIM
Schlumberger 92 Open Link

Property name Description


INJECTOR
GAS LIFT RATE OPTION Gas lift rate option (0 for gas rate, 1 for GLR)
(simple profile)
GAS LIFT RATE Gas lift gas rate (simple profile)
GAS LIFT GLR Gas lift tubing GLR (simple profile)
GAS LIFT MD Gas lift MD (simple profile)
GAS LIFT PORT DIAMETER Gas lift port diameter (simple profile)
GAS LIFT PVTFILE Composition file name (simple profile)
GAS LIFT PVTTYPE Composition type (0 for local composition, 1
for local PVT, 2 for global PVT, 3 for local
MFL) (simple profile)
GAS LIFT SPECIFIC GRAVITY Gas lift specific gravity (simple profile)
GAS LIFT SURFACE PRESSURE Surface pressure (simple profile)
GAS LIFT SURFACE TEMPERATURE Surface temperature (simple profile)
GAS LIFT RATE OPTION NODE Same as GAS LIFT RATE OPTION but for
detailed profile
GAS LIFT RATE NODE Same as GAS LIFT RATE but for detailed
profile
GAS LIFT GLR NODE Same as GAS LIFT GLR but for detailed
profile
GAS LIFT MD NODE Same as GAS LIFT MD but for detailed profile
GAS LIFT PORT DIAMETER NODE Same as GAS LIFT PORT DIAMETER but for
detailed profile
GAS LIFT PVTFILE NODE Same as GAS LIFT PVTFILE but for detailed
profile
GAS LIFT PVTTYPE NODE Same as GAS LIFT PVTTYPE but for detailed
profile
GAS LIFT SPECIFIC GRAVITY NODE Same as GAS LIFT SPECIFIC GRAVITY but
for detailed profile
GAS LIFT SURFACE PRESSURE NODE Same as GAS LIFT SURFACE PRESSURE but
for detailed profile
GAS LIFT SURFACE TEMPERATURE NODE Same as GAS LIFT SURFACE
TEMPERATURE but for detailed profile

Property name Description


SEPARATOR
SEPARATOR MD Separator MD
EFFICIENCY Efficiency
TYPE Type (see Separator Types)

Property name Description


SSSV
SSSV MD SSSV MD (simple profile)
SSSV ID SSSV ID (simple profile)
SSSV MD NODE Same as SSSV MD but for detailed profile
SSSV ID NODE Same as SSSV ID but for detailed profile

Property name Description


GLValve
VALVE MD Valve MD
VALVE AB Valve Ab

PIPESIM
Schlumberger 93 Open Link

VALVE AP Valve Ap
VALVE CHOKESIZE Choke size
VALVE CV Valve Cv
VALVE PORTSIZE Port size
VALVE PTRO Valve Ptro
VALVE MANUF Manufacturer name
VALVE SERIES Series name
VALVE PORTNAME Port name
VALVE TYPE Valve type
VALVE DPFO Valve Dpfo

Property name Description


Tubing (pipe section)
PIPE AMB TEMPERATURE Pipe ambient temperature (simple profile)
PIPE FLOWTYPE Flow type (see Pipe Flow Types) (simple
profile)
PIPE ID Pipe ID (simple profile)
PIPE MD Pipe MD (simple profile)
PIPE OD Pipe OD (simple profile)
PIPE ROUGHNESS Pipe roughness (simple profile)
PIPE WT Pipe wall thickness (simple profile)
PIPE AMB TEMPERATURE NODE Same as PIPE AMB TEMPERATURE
but for detailed profile
PIPE FLOWTYPE NODE Same as PIPE FLOWTYPE but for detailed
profile
PIPE ID NODE Same as PIPE ID but for detailed profile
PIPE MD NODE Same as PIPE MD but for detailed profile
PIPE OD NODE Same as PIPE OD but for detailed profile
PIPE ROUGHNESS NODE Same as PIPE ROUGHNESS but for detailed
profile
PIPE WT NODE Same as PIPE WT but for detailed profile
Artificial Lift
Lift Value Description
0 No artificial lift
1 Gas lift injection
2 ESP
Completion Options
Type Value Description
0 None
1 Open hole
2 Perforated
3 Gravel packed and perforated
4 Open hole gravel pack
5 Frac pack
IPR Types (Vertical)
Type Value Description
0 Well PI
1 Vogel
2 Fetkovitch
3 Jones

PIPESIM
Schlumberger 94 Open Link

4 BackPressure
5 PseudoSteadyState
6 Forchheimer
7 Hydraulic Fracture
8 Transient
IPR Types (Horizontal)
Type Value Description
0 Joshi (Oil)

1 Joshi (Gas)
2 Babu & Odeh (Oil)
3 Babu & Odeh (Gas)
4 Distributed PI
IPR Options (Horizontal)
Type Value Description
0 Distributed PI
1 Single Point PI
Fluid Types
Type Value Description
0 Liquid Rate
1 Gas Rate
2 Mass Rate
Pipe Flow Types
Type Value Description
0 Tubing
1 Annular
2 Tubing+Annular
Rate Types
Type Value Description
0 GLR
1 GOR
2 LGR
3 OGR
Separator Types
Type Value Description
0 Liquid
1 Gas
2 Water
Single Branch Operations
Operation Value Operation Name
-1 No Operation
0 System Analysis
1 Pressure and Temp Profile
2 Nodal Analysis
3 Injection Gas Vs Casing Head Pressure
4 Horizontal Well Performance
5 Reservoir Tables

PIPESIM
Schlumberger 95 Open Link

6 Artificial Lift
7 Flow Correlation Profile Match
8 (Reserved)
9 Wax Deposition
10 Well Performance Curves
11 Gas Lift - Diagnostics
12 Gas Lift - Deepest Injection Point
13 Gas Lift - Lift Gas Response
14 Gas Lift - Bracketing

PIPESIM
Schlumberger 96 Open Link

Unit System
Quantity Name Class Name Defined Unit Names
(* def.Engineering, ^ def.SI, ! strict SI)
ADIM UNITLESS
UNITLESS
AGASRATE ACFM *,
ft3/min, acm/s ^, m3/s!, m3/min, bbl/min,
bbl/d,
m3/d ,
AREA AREA in2 *,
mm2 ^,
m2 ! , acres
AREAL AREA EARTH ft2 *. m2 ^!, acres, mi2, ha, km2
SURFACE
COMPRESS COMPRESSIBILITY 1/psia *,
COMPRESSIBILITY 1/bara ^,
1/Pa !
CONDUCTIVITY THERMAL Btu/hr/ft/F *,
THERMALCOUCTIVITY CONDUCTIVITY W/m/K !^

DELTAP PRESSURE Psi *,


PRESSUREDROP (DELTA) Bar ^, atm, kPa, kg/cm2,
Pa!
DELTAT TEMPERATURE F *,
(DELTA) C! ^, K, R,
DENSITY DENSITY LIQUID lb/ft3 *,
kg/m3! ^,
g/cc,
DISTGASPI SPECIFIC Mmscf/d/psi2/ft *,
DISTRIBUTEDGASPI PRODUCTIVITY mmsm3/d/bar2/m ^, msm3/d/kPa2/m,
INDEX (GAS PER sm3/s/Pa2/m!
LENGTH)
DISTLIQPI SPECIFIC STB/d/psi/ft *,
DISTRIBUTEDLIQPI PRODUCTIVITY sm3/d/bar/m ^, sm3/d/kPa/m,
INDEX (LIQ PER sm3/s/Pa/m!
LENGTH)
ENTHALPY ENERGY PER MASS Btu/lb *,
(ENTHALPY) J/g ^,
J/kg!
ENTROPY SPECIFIC Btu/lb/F *,
ENTROPY J/g/K ^,
J/kg/K!
FLOWGLRATIO STD VOLUME PER scf/bbl *, sm3/m3 ^!
VOLUME (GLR)
FRACTION RATIO (%) % *! ^
fract.,
GASPI SPECIFIC Mmscf/d/psi2 *,
PRODUCTIVITY mmscf/d/kPa2, mmsm3/d/bar2 ^,
INDEX (GAS) msm3/d/kPa2, 1.E4sm3/d/MPa2,
m3/s/Pa2!

PIPESIM
Schlumberger 97 Open Link

GASRATE STD VOLUME GAS Mmscf/d *,


RATE Mscf/d, scf/d, mmsm3/d ^, msm3/d,
sm3/d, 1.E3sm3/d, 1.E4sm3/d,
sm3/s!
GASRATE(FLOWING) FLOW RATE Mmcf/d *,
VOLUME BASIS mcf/d, cf/d, mmm3/d ^, mm3/d, m3/d,
(GAS) 1.E3m3/d, 1.E4m3/d, m3/s!
GASRATERECIP STD VOLUME GAS 1/mmscf/d *, 1/mscf/d, 1/scf/d, 1/mmsm3/d,
RATE 1/msm3/d, 1/sm3/d, 1/1.E3sm3/d,
(RECIPROCAL) 1/1.E4sm3/d, 1/sm3/s!
GOR VOLUME PER Scf/STB *,
GLR VOLUME (GLR) sm3/sm3! ^
HEAD ENERGY PER MASS ft-lbf/lbm *,
COMPRESSORHEAD (HEAD) kJ/kg ^, J/kg!
JONESGASA (JONES A GAS) (psi/mmscf/d)^2 *,
(bar/mmsm3/d)^2 ^,
(Pa/sm3/s)^2!
(bar/msm3/d)^2
JONESGASB (JONES B GAS) psi2/mmscf/d *,
bar2/mmsm3/d ^,
Pa2/sm3/s!
bar2/msm3/d
JONESLIQA (JONES A LIQ) psi/(STB/d)^2 *,
bar/(sm3/d)^2 ^,
Pa/(sm3/s)^2!
JONESLIQB (JONES B LIQ) psi/STB/d *,
bar/sm3/d ^,
Pa/sm3/s!
LENGTH LENGTH Inches *,
DIAMETER, ID, OD, WT, SHORTRANGE ft, miles, mm ^, cm, m!, km, 1/64in,
LENGTH(SHORT)
LENGTHL LENGTH Ft *,
LENGTH(LONG) MIDRANGE Miles, m! ^, km,
LIQPI SPECIFIC STB/d/psi *,
PRODUCTIVITY STB/d/kPa, sm3/d/bar ^, sm3/d/kPa,
INDEX (LIQ) sm3/d/MPa, sm3/s/Pa!
LIQRATE STD VOLUME STB/d *,
LIQUID RATE sm3/d ^,
sm3/s!
LIQRATE(FLOWING) FLOWRATE bbl/d *,
VOLUME BASIS m3/d ^, m3/s!
(LIQ)
LIQRATERECIP STD VOLUME 1/STB/d, 1/sm3/d, 1/sm3/s
LIQUID RATE
(RECIPROCAL)
MASS MASS Lb *, Kg! ^
MASSRATE FLOWRATE MASS lb/s *,
BASIS lb/h, kg/s! ^, kg/h,
MOLARVOLUME SPECIFIC VOLUME ft3/mol *,
MOLE m3/mol! ^
OGR VOLUME PER STB/mmscf *,
LGR VOLUME (LGR) sm3/mmsm3 ^, sm3/msm3, sm3/1.E4sm3,
m3/E3m3, sm3/sm3!

PIPESIM
Schlumberger 98 Open Link

PERMEABILITY PERMEABILITY Md *^,


Darcy, nm2,
M2 !
POWER POWER Hp *,
KW ^, Btu/s, kcal/s, Btu/h, kcal/h,
W!
PRESSURE PRESSURE Psia *,
Psig, bara ^, barg, atma, atmg, kPa a, kPa g,
MPa a, MPa g, kg/cm2 a, kg/cm2 g, Pa a!, Pa
g,
PRESSUREGRAD PRESSURE psi/ft *,
PRESSUREGRADIENT GRADIENT bar/m ^, atm/m, kPa/m, kg/cm2,
Pa/m!
ROTVELOCITY FREQUENCY Hz *! ^
FREQUENCY Rpm,
SHOTS PER LENGTH Shots/ft *,
Shots/m! ^
SURFTENSION SURFACE TENSION Dyne/cm *,
SURFACETENSION N/m! ^
TEMPERATURE TEMPERATURE F *,
C! ^, K, R,
TIME TIME Hr *^,
Min, s!, days, years
U HEAT TRANSFER Btu/hr/ft2/F *,
HEATTRANSFERCOEFFI COEFFICIENT W/m2/K! ^
CIENT
VELOCITY VELOCITY ft/s *,
m/s! ^
VISCOSITY VISCOSITY Cp *^
DYNAMIC Ns/m2 ! , lb/s/ft,
VOLFRAC VOLUME PER STD Bbl/mmscf *,
VOLUMEFRACTION VOLUME M3/mmsm3 ^, m3/sm3!
VOLUME VOLUME (LIQUID) ft3 *, m3! ^
VOLUME GAS VOLUME (GAS) ft3 *, m3! ^
NOTE: The keyword _STRICTSI in place of the unit name will set or get a value in the strict SI
unit.

PIPESIM
Schlumberger 99 Open Link

Case Studies
Detailed explanation of routine
The Open Link functionality is distributed with the PIPESIM installation and is contained in a
number of library files. The main file is Net32COM.DLL, which normally resides in the programs
directory and provides the framework and main entry points into both network and single branch
simulation models. Two other files are FluidModelCOM.DLL and FlowCorrelationCOM.DLL, which
provide access to properties defined in the fluid and flow correlation models respectively.
Pre-Loop Steps
Step 1

Dim Bo as New FLUIDMODELCOMLib.IblackOil


Dim Obj as New NET32COMLib.IsingleBranchModel
These statements define the variables Bo and Obj as a black oil object and a Single branch model
object respectively.
A Single Branch Model Object corresponds to the Single Branch Model Interface.
Dim x, n, TempAmb, TempSurf as Integer
This statement let the computer know that the variables x ,n, TempAmb, TempSurf used in the
program are integer. (It is good programming practice to declare all variables used in a program at
the beginning of the listing).

PIPESIM
Schlumberger 100 Open Link

Step 2:
TempAmb = Cells(11,4).value
If TmpAmb = then
Exit Sub
End If
This assigns the value located in the cell cells(11,4) to the Integer variables TempAmb.
Step 3:
PathTemplate = cells(8,1)
If PathTemplate = Then
Exit Sub
End If
Assign the template path specified by the user in the spreadsheet to the variable PathTemplate.
Step 4:
Path = Cells(9,1).Value
If Path = Then
Exit Sub
End If
Assign the Path specified by the user in the spreadsheet to the variable Path.
This is the path where the .bps files that the routine creates are stored.
Step 5:
case1 = ActiveCell.Row
cases = Selection.Rows.Count
lastcase = case1 + cases 1
This statement allows us to loop on the selected rows by assigning the index of the top row to the
variable case1 and the index of the last row 1 to the variable lastcase.

PIPESIM
Schlumberger 101 Open Link

Loop Steps
Step 6:
For n = case1 to lastcase
This statement initiates a loop that will be executed from the value case1 to the value last case.
Step 7:
Obj.OpenModel PathTemplate
This statement is equivalent to doing the following things: From the PIPESIM singlebranch object
interface (Reminder: Object Obj is a single branch object), go to the menu File, select Open Model
and open the model PathTemplate (which is a string defined in the spreadsheet)
Although the PIPESIM windows is not visible after the statement is executed the model is opened
and can be altered.
Step 8:
Bo.GasSg = Cells(n,5)




Obj.BlackOil =Bo

PIPESIM
Schlumberger 102 Open Link

The first statement assign to the gas standard gravity field in the BlackOil interface Bo the value
corresponding to the cells (n,5). It is the cell (3,5) during the first loop and the cell (4,5) in the
second loop.
There are also some conditional statements. The first of those states that if the water cut is above
95% then the value in the blackoil object must be 95.
The second one states that if the GOR is superior to 1000000 then assign an OGR of 0 to the
blackoil object instead of the actual GOR value.
The last statement assigns to the single branch object Obj the black oil properties of the Blackoil
object Bo.

Step 9,10,11,12:
These statements fill the different GUI (Graphical User Interface) objects making up the
SingleBranchObject (that is the completion object, the tubing object, the choke object and the
flow line object).
For example the statement:
Obj.SetPropertyVal Tubing_1, Pipe WT, 0.5, inches
Assigns the value 0.5 to the wall thickness of the tubing object of Template.bps.
The more general statement could be written as:
Obj.SetPropertyVal name of the object(string), name of the field in the object(string), value to be
assigned to that field(double), Units to be used(string)

PIPESIM
Schlumberger 103 Open Link

Step 13: Saving the Template with another name


The statement
Obj.SaveModel Path & Stationname & _ & Wellname & .bps
saves the model Template.bps under a new name in the folder specified in the string variable Path.
Step 14: Restart Loop
The statement Next n indicates to Visual Basic for Application to go back to the statement for n =
case1 to lastcase and to redo the code for a different value of n (that is the next well).
This will happen until n = lastcase (last selected row).

PIPESIM

You might also like