Professional Documents
Culture Documents
Pipesim 2008 Manual PDF
Pipesim 2008 Manual PDF
Open Link
Schlumberger 2 Open Link
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
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
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
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
PIPESIM
Schlumberger 14 Open Link
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.
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
PIPESIM
Schlumberger 21 Open Link
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:
PIPESIM
Schlumberger 23 Open Link
PIPESIM
Schlumberger 24 Open Link
PIPESIM
Schlumberger 25 Open Link
. plt Files.
.
Plot of Man1_435
PIPESIM
Schlumberger 26 Open Link
Plot of Man2_436
PIPESIM
Schlumberger 27 Open Link
PIPESIM
Schlumberger 28 Open Link
PIPESIM
Schlumberger 29 Open Link
PIPESIM
Schlumberger 30 Open Link
PIPESIM
Schlumberger 31 Open Link
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
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
PIPESIM
Schlumberger 34 Open Link
PIPESIM
Schlumberger 35 Open Link
PIPESIM
Schlumberger 36 Open Link
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
PIPESIM
Schlumberger 38 Open Link
SingleBranchObj.GetCountObjectsInProfile count
'Get Sensitivity Information for the tubing (type = 16) with identifier
Tub_1
SingleBranchObj.GetSensitivityInfo 16, Tub_1, sensvarnames, objref
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
PIPESIM
Schlumberger 41 Open Link
PIPESIM
Schlumberger 42 Open Link
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
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
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
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
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
PIPESIM
Schlumberger 51 Open Link
3
The compositional data is provided by the call to the Ipnscom Interface
PIPESIM
Schlumberger 52 Open Link
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
PIPESIM
Schlumberger 55 Open Link
PIPESIM
Schlumberger 56 Open Link
PIPESIM
Schlumberger 57 Open Link
PIPESIM
Schlumberger 58 Open Link
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
PIPESIM
Schlumberger 61 Open Link
PIPESIM
Schlumberger 62 Open Link
PIPESIM
Schlumberger 63 Open Link
PIPESIM
Schlumberger 64 Open Link
PIPESIM
Schlumberger 65 Open Link
PIPESIM
Schlumberger 66 Open Link
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
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
PIPESIM
Schlumberger 72 Open Link
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
if (success)
{
// Get the file creator's name
CreatorName = pPerCur->GetFileCreatorName();
PIPESIM
Schlumberger 74 Open Link
PIPESIM
Schlumberger 75 Open Link
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
PIPESIM
Schlumberger 77 Open Link
PIPESIM
Schlumberger 78 Open Link
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);.
PIPESIM
Schlumberger 80 Open Link
filename = Range(MODELFILE)
pos = InStr(1, filename, .bpn, 1)
If (pos > 0) Then
filename = Left(filename, pos)
filename = filename + pns
End If
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
End If
'--------------------------------------------------------
'Get the pressure profiles ------------------------------
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 (PltReaderObj.OpenWellFile(plcfile)) Then
distance = PltReaderObj.GetColumnVariableDataAt(Total
Distance (ft))
Lower = LBound(distance(0), 1)
Upper = UBound(distance(0), 1)
r1.Cells(i + 1) = distance(0)(i)
Next
pressure =
PltReaderObj.GetColumnVariableDataAt(Pressure (psia))
LowerO = LBound(distance(0), 1)
UpperO = UBound(distance(0), 1)
Next
PltReaderObj.CloseWellFile
End If
End If
col = col + 1
Next
End If
End Sub
PIPESIM
Schlumberger 83 Open Link
PIPESIM
Schlumberger 84 Open Link
pws = 4000.0
pws_unit = 'psia'
JonesObj.SetStaticPressure pws, pws_unit
' 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
PIPESIM
Schlumberger 87 Open Link
PIPESIM
Schlumberger 88 Open Link
PIPESIM
Schlumberger 89 Open Link
PIPESIM
Schlumberger 90 Open Link
PIPESIM
Schlumberger 91 Open Link
PIPESIM
Schlumberger 92 Open Link
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
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 !^
PIPESIM
Schlumberger 97 Open Link
PIPESIM
Schlumberger 98 Open Link
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
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
PIPESIM