Está en la página 1de 103

PIPESIM

Open Link

Schlumberger

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 770562722, 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

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

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

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

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
Net32COM.DLL

Interfaces INetModel ISingleBranchModel IObjectProperties TubingObj InjectorObj VertCompObj FlowlineObj ErosionCorrosion HeatTransfer IISystemsAnalysis IIPTProfile IICorrMatching IINodalAnal IBlackOil ICompositional SinglePointCalib MultiPointCalib ViscosityData Thermal CIFlowCorrelation IUnitSystem GLWell IWaxOp

Remarks Network models and operations Single branch models and operations Generic equipment properties Tubing specific properties and operations Injector specific properties Vertical completion specific properties Flowline specific properties and operations Erosion and corrosion settings Heat transfer properties Systems Analysis operation Pressure/Temp Profiles operation Flow Correlation Matching operation Nodal Analysis Operation Black Oil model properties Compositional model properties BO single point calibration properties BO multipoint calibration properties BO viscosity properties BO thermal properties Vertical and horizontal flow correlation properties General unit conversions Gas lifted well model for diagnostics Wax deposition operation

PSOpSystems.DLL

NodalOp.DLL FluidModelCOM.DLL

FlowCorrelationCOM.DLL UnitsCOM.DLL GLDiagn.DLL WaxOp.DLL

PIPESIM

Schlumberger

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. 3. 4. 1.

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. Now do the same for the FluidModelCOM 1.0 Type Library and for PNSReader 1.0 type library. Click on OK to close the References window.

Loading and running an existing model


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

Open Link

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.

2.

PIPESIM

Schlumberger

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. Organize the wells data in tabular form in Excel. 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). Run the routine The Bps are created and stored in a directory specified in the routine.

2. 3. 4.

Step by step tutorial


Create a Well Model Template 1. Open PIPESIM Open a new well performance analysis window as shown below.

2. 3.

Create the following Well Model in the opened window. 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. 5.

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

PIPESIM

Schlumberger
Tubing 2 MD (Casing MD) Tubing 2 ID (Casing TVD) E: Flow line Data: Flow line elevation (m) Flow line ID Flow line Length km F:Choke Data: Choke Size 1/64th. G: Production Data:

13 (2104,2104) (5.5,5.5) (0,0) (3,3) (4.305,1.212) (95,95)

Open Link

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
The following user form should appear:

14

Open Link

3. 4.

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

PIPESIM

Schlumberger
5.

15

Open Link

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
6.

16

Open Link

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

7. 8.

Click on CommandButton Object Submenu Edit. You can now change the caption of the button CommandButton1 to: Create Well Model. 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. 2. Open the Excel File (OpenLink.xls) D:/OpenLink/Excel/Openlink.xls 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, pNameArray, Count As Long) Returns in pNameArray an array of String with 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 If ParentObject string is empty, the function is the same as GetNameList (). See GetNameList () 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 Returns 0: no artificial lift 1: gas lift injection 2: ESP -1: Object not found ObjectType must be Tubing type (16) ObjectName the name of the tubing Returns the ObjectType (See GetNameList ()) and its name of the upstream-most object in the single branch model.

GetEquipmentInfo (EquipmentType As Long, ParentType As Long, ParentObject As String, EquipmentNames, Count As Long)

GetHasArtificialLift (ObjectType As Long, ObjectName As String, Lift As Long)

GetStartBoundaryObject (ObjectType As Long, ObjectName As String)

PIPESIM

Schlumberger
GetCountObjectsInProfile (Count As Long) GetObjectAtIndex (Index As Long, ObjectType As Long, ObjectName As String) GetLastError (ErrorStr As String) GetIsModelRunning () As Boolean GetOperationInterface (pIOperation As Object) GetOperationType () As Long GetPropertyNames (ObjectName As String, PropNames) as Long GetPropertyVal (ObjectName As String, PropName As String, pValue As Double, pUnitStr As String) As Boolean

28

Open Link

Returns the number of objects in the single branch model Returns the object's type and name at the specified zero-based index. Index must between zero and the number returned by GetCountObjectsInProfile () minus 1. Returns the last error message produced by the interface. Returns Boolean value True if the simulation process is active Returns the operation object Returns Long value as the operation defined for the model. See Defined constants and strings Returns in PropNames the list of properties defined for the object ObjectName. Returns the number of properties as functions return value For specified property (PropName) in the specified object (ObjectName) function gets a 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. Gets a specified property value. This function extends the functionality of GetPropertyVal by allowing you to retrieve a property from a specified sub-component within 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 The function is similar to GetPropertyValAtObjectIndex but for properties defined as string Returns the property type: UNDEFINED -1 REAL 0 (value in strict SI units) INT 1 DOUBLE 2 STR 3 Returns the list of variable names upon which a sensitivity analysis can be performed for the 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) Requests the list of variable names and their measurements upon which a sensitivity analysis can be performed for the given object (defined by name). The return value holds number of the variables

GetPropertyValAtObjectIndex (ObjectName As String, PropName As String, pValue As Double, pUnitStr As String, SubObjectType As Long, Index As Long) As Boolean

GetPropertyStringAtObjectIndex (ObjectName As String, PropName As String, pValue As String, Index As Long) As Boolean GetPropertyType (ObjectName As String, PropName As String) As Long

GetSensitivityInfo (ObjectType As Long, ObjectName As String, VariableNames, ItemReference)

GetSensitivityVariables (ObjectName As String, VariableNames, StdQtyNames) As Long

PIPESIM

Schlumberger
ISingleBranchModel object - Set Methods SetOperationInterface (pIOperation As Unknown) SetOperationType (OperationType As Long) SetPropertyVal (ObjectName As String, PropName As String, value As Double, UnitStr As String) As Boolean

29

Open Link

SetPropertyStringAtObjectIndex (ObjectName As String, PropName As String, value As String, Index As Long) As Boolean SetPropertyValAtObjectIndex (ObjectName As String, PropName As String, value As Double, UnitStr As String, SubObjectType As Long, Index As Long) As Boolean

pIOperation: The interface instance to an operation object. This function assigns the given operation to the opened single branch model Sets the operation type for the single branch model. See Defined constants and strings Sets the specified property (PropName) in the specified object (ObjectName) to the value given 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. As SetPropertyValAtObjectIndex () but for properties defined as string

SetPVTFile (bstrPVTFilename As String)

SetUnitManager (p_VarUnitManager) ISingleBranchModel object - Properties BlackOil As Object Composition As Object FlowCorrelation As Object Fluid As FluidModel FluidModelType As Long GasLiftDesign As Object GasLiftSystemProps As Object ObjectProperties (ObjectName As String) As ProfileObj

This function extends the functionality of SetPropertyVal by allowing you to set a property to a specified sub-component within an object. A typical use of this is when for instance it 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. Sets the compositional file (.pvt) to be used as the main fluid in the simulations Sets the Unit Manager object Gets/sets the Black Oil fluid definition object Gets/sets the fluid composition object Gets/sets the Flow Correlation object Gets/sets the FluidModel object (See IFlowlineObj Interface) Gets/sets the fluid type (0: black oil, 1: compositional, 2: PVT file, 3: MFL file) Gets/sets the Gas Lift Design object Gets/sets the Gas Lift System Properties object Sets/returns a ProfileObject (See 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. Returns the ProjectInfo object to access project specific data Sets full path name to the model file Gets/sets the FieldSurvey object Gets/sets the ErosionCorrosion object Gets/sets the additional engine keywords

ProjectInfo As ProjectInfo ProjectPath As String FieldSurvey As Object ErosionCorrosion As Object Keywords As String

PIPESIM

Schlumberger
ISingleBranchModel object - Operations ExportEngineFiles ()

30

Open Link

ExportEngineFiles2 (operationfile As String) As String

ExportEngineFiles3 (nExpertMode As Long)

KillSimulationProcess () NewModel (bstrModelFileName As String, ProfileTypesList, ProfileNamesList) As Boolean

OpenModel (bstrModelFileName As String)

RunSingleBranchModel (bRestart As Boolean)

RunSingleBranchModel2 (bRestart As Boolean, EngSwitches As String, DynamicPlot As Boolean) RunSingleBranchModel3 (bRestart As Boolean, EngSwitches As String, DynamicPlot As Boolean, ExpertExtensions As Boolean) SaveModel (bstrPathName As String) As Boolean ValidateTubingConfiguration(MaxInjTV D As Double) As Boolean

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. In addition to ExportEngineFiles (), this function returns the full pathname to the exported file (.psm) and its associated operation file (.inc) This function is similar to ExportEngineFiles 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 Terminates the simulation process Creates a new PIPESIM model. bstrModelFileName: full path to the file where the 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 Opens the given single branch model. Filename must be a valid PIPESIM single branch model file (.bps). This function must be called first when using this interface. 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. Return value is True for successful engine start, False otherwise. Similar to SetOperationInterface, it also accepts one or more switches to be passed to the simulation engine and turns dynamic plotting on/off. Similar to SetOperationInterface2, it also allows using of the Expert extensions

Saves the currently opened model to a file given by bstrPathName. Function returns True if model is saved, otherwise the return value is False. This function checks the tubing configuration 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
SetOutpoutUnits(nUnits As Integer) As Boolean

31

Open Link

This function forces the output to be written in 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 ProfileObj object - Get Methods GetLastError () As String GetPropertyNames (PropNames) As Long Gets a FluidModel interface object (see description below) Returns an error description Returns in PropNames the array of properties defined for the object. Functions return value is the number of properties

PIPESIM

Schlumberger
GetValue (PropName As String, pValue, pUnitStr As String, Index As Long) As Boolean

32

Open Link

Gets the specified property (PropName) value in Value in the given units (UnitStr). Return value is 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. Sets the specified property (PropName) value in Value in the given units (UnitStr). Return value is 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, UnitStr As String, Index As Long) As Boolean

ITubing Interface
TubingObj Object - Get Methods GetCountDownholeEquipment (Type As Long) As Long Returns the number of items specified in the 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) Similar to GetCountDownholeEquipment, but specific to tubing sections Returns in a Variant the matrix of doubles defined 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 Returns the md (as functions return value) and the label of a given Type of downhole equipment and 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. Returns the equipment type, label and md (as functions return value) in strict SI units at a given Index. See GetDownholeEquipment for definition of Index

GetCountTubingSection () As Long GetDeviationSurvey_SI (Type As Long) As Variant

GetDownholeEquipment (Type As Long, Index As Long, label As String) As Double

GetDownholeEquipmentAtIndex (Index As Long, Type As Long, label As String) As Double

PIPESIM

Schlumberger
GetGeothermalSurvey_SI (vbIsTVD As Boolean) As Variant

33

Open Link

GetTubingSection (Index As Long, label As String) As Double GetMDatTVD_SI (tvd As Double) As Double GetTVDatMD_SI (md As Double) As Double GetInputOK (info As String) As Boolean

Returns the geothermal survey in Variant matrix of 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 Similar to GetDownholeEquipment, but specific to tubing sections Returns the md given the tvd based on the deviation survey Returns the tvd given the md based on the deviation survey Validates the tubing data and returns True if configuration is correct, otherwise the function returns False and info contains the error message Sets a deviation survey to a detailed tubing model. 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). Sets a geothermal survey to a detailed tubing model. See GetGeothermalSurvey_SI for definition of Survey and vbIsTVD. Gets/sets the FluidModel object for the injection point at a given index. This function is only applicable for compositional models. See ISinglePointCalib object. Enables/disables Remedial Coiled Tubing option in configuration Adds an equipment item to the detailed tubing Type: any of 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 Adds a gas lift valve to the tubing object. Returns the zero-based index corresponding to the valve position with index of the topmost valve equal to 0.

TubingObj Object -Set Methods SetDeviationSurvey_SI (Type As Long, Survey) As Boolean

SetGeothermalSurvey_SI (vbIsTVD As Boolean, Survey) As Boolean

TubingObj Object -Properties InjectionPointFluid (Index As Long) As FluidModel

RemedialCoiledTubingEnabled As Boolean TubingObj Object - Operations AddDownholeEquipment (Type As Long, md_SI As Double, label As String) As Long

AddGasLiftValve_SI (md As Double, manuf As String, series As String, portName As String, portSize As Double, 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
AddTubingSection (BottomMD_SI As Double, label As String) As Long

34

Open Link

ClearGasLiftValves () RemoveDownholeEquipment (Type As Long, Index As Long)

RemoveTubingSection (Index As Long) DisplayDialog (p_VarUnitManager, fluidtype As Integer) As Boolean

Adds a section of tubing 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 Removes all gas lift valves from the tubing Removes a piece of equipment of a given type and 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 Similar to RemoveDownholeEquipment but applicable to tubing sections Function invokes tubing configuration dialog and 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 Boolean VertCompObj Object - Set Methods SetMultipoint(value As Long) As Boolean SetIPRFluidType(Type As Long) As Boolean SetIPRTable_SI(QPPoints) As Boolean Validates the flowline data and returns True if configuration is correct, otherwise the function returns False and info contains the error message Set either multipoint=1 or isochronal=0 type of IPR data table Set fluid type for IPR: type_liquid=0, type_gas=1 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 Returns the coning table data for the vertical completion. IsUsed is TRUE if it is set and FALSE 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

GetConingTableData(IsUsed As Boolean, ConedGasSG As Double, Flowrate, GOR, WCut) As Boolean

VertCompObj Object - Operations CalculateIPR() As Boolean

PIPESIM

Schlumberger
DisplayDialog (p_VarUnitManager) As Boolean

35

Open Link

Function invokes Vertical Completion 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 FlowlineObj Object - Get Methods GetInputOK (info As String) As Boolean FlowlineObj Object - Operations AddProfileNode_SI (distance As Double, elevation As Double, ambientT As Double, uValue As Double, label As String) ClearDetailedProfile () UseDetailedProfile (UseDetailed As Boolean) Gets/sets HeatTransfer object Validates the flowline data and returns True if configuration is correct, otherwise the function returns False and info contains the error message Adds a node to the flowline detailed node description. All values must be given in strict SI units. Deletes all nodes in the flowline detailed profile UseDetailed = True: instructs the flowline to use the detailed profile description. UseDetailed = False: use the flowlines simple description, detailed nodes will be generated automatically. Function invokes flowline configuration dialog and returns True if OK button was clicked, False otherwise. Pass a Null variant as the arguments value. Function returns a number of nodes defined in a detailed profile Function calculates pipes OD based on coating properties

DisplayDialog (p_VarUnitManager) As Boolean

GetNodesCount () As Long GetPipeOD (od as Double, units as String)

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 Gets/sets a Boolean value for inside filem coefficient. True if IFC is included in U Value and False if it is calculated separately. Gets/sets an ambient fluid type. 0 for air and 1 for water. Returns U Value and units string. Fails if UValueType is set to calculated Returns pipe conductivity value and units string. Fails if UValueType is not calculated Returns ambient fluid velocity value and units string. Fails if UValueType is not calculated Returns pipe burial depth value and units string. Fails if UValueType is not calculated Returns ground conductivity value and units string. Fails if UValueType is not calculated

IsIFCIncluded As Boolean

AmbientFluidType As Long

HeatTransfer Object - Get Methods GetUValue (uVal as Double, units as String) GetPipeConductivity (dblVal as Double, units as String) GetAmbientFluidVelosity (dblVal as Double, units as String) GetBurialDepth (dblVal as Double, units as String) GetGroundConductivity (dblVal as Double, units as String)

PIPESIM

Schlumberger
GetCoatingData_SI (varData)

36

Open Link

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 Sets U Value in specified units. Fails if UValueType is set to calculated Sets pipe conductivity value in specified units. Fails if UValueType is not calculated Sets ambient fluid velocity value in specified units. Fails if UValueType is not calculated Sets pipe burial depth value in specified units. Fails if UValueType is not calculated Sets ground conductivity value in specified units. Fails if UValueType is not calculated Sets a pipe coating data. Data has to be passed as an array where first column containts layerspecific 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 String) SetPipeConductivity (dblVal as Double, units as String) SetAmbientFluidVelosity (dblVal as Double, units as String) SetBurialDepth (dblVal as Double, units as String) SetGroundConductivity (dblVal as Double, units as String) SetCoatingData_SI (varData)

IFluid Interface
FluidModel Object - Properties Composition As Object BlackOil As Object FluidModelType As Long OverrideValues As Boolean WCutoverride_SI As Double GORoverride_SI As Double OGRoverride_SI As Double LGRoverride_SI As Double GLRoverride_SI As Double GORoverride_Type As Integer IsLocalFluid As Boolean CompositionType As Long Accesses the ICompositional object (See ISinglePointCalib object) Accesses the IBlackOil object (Ref IBlackOil ) Retrieves the fluid model type: 0: BlackOil, 1: Compositional, 2 PVT File, 3 MFL File Sets/gets whether Wcut/GOR values are overridden from the values defined in the fluid model. Accesses the watercut override value Accesses the GOR override value Accesses the OGR override value Accesses the LGR override value Accesses the GLR override value Accesses which GOR type is being overridden (0=GLR, 1=GOR, 2=LGR, 3=OGR) Sets/gets whether the object is using a local fluid model Sets/gets whether the local composition is a PVT file or a defined PIPESIM composition or local MFL file Sets/gets a fluid name Validates the fluid model data and returns True if configuration is correct, otherwise the function returns False and info contains the error message Function invokes fluid configuration dialog and returns True if OK button was clicked, False otherwise. Pass a Null variant as the arguments value.

FluidName As String FluidModel Object - Get Methods GetInputOK (info As String) As Boolean FluidModel Object - Operations DisplayDialog (p_VarUnitManager) As Boolean

PIPESIM

Schlumberger

37

Open Link

IProjectInfo Interface
ProjectInfo Object - Properties Description As String User As String Job As String Company As String Manager As String Remarks As String Date As String Field As String WellNumber As String Lease As String Country As String Address As String Email As String Phone As String Fax As String Gets/sets string property Gets/sets string property Gets/sets string property Gets/sets string property Gets/sets string property Gets/sets string property Gets/sets string property Gets/sets string property Gets/sets string property Gets/sets string property Gets/sets string property Gets/sets string property Gets/sets string property Gets/sets string property Gets/sets string property

IErosionCorrosion Interface
ErosionCorrosion Object - Properties CalculatePH As Long CorrosionEfficiency As Double CorrosionModel As Long ErosionEfficiency As Double ErosionModel As Long Gets/sets value for Actual pH property (1 calculate value, 0 use user-defined pH value) Gets/sets corrosion efficiency value Gets/sets value for Corrosion Model property (0 none, 1 use de Waard (1995) model ) Gets/sets erosion efficiency value Gets/sets value for Erosion Model property (0 API 14e model, 1- SALAMA (2000)) Gets/sets acceptable erosion rate value Gets/sets erosion velocity constant value Gets/sets geometry constant value Gets/sets sand grain size value Gets/sets sand production ratio value Gets/sets user-defined pH value

ErosionRate_Eng As Double ErosionVelocityConst As Double GeometryConstant As Double SandGrainSize_Eng As Double SandProdRatio As Double UserDefinedPH As Double 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 Link\Gas Lift Performance.bps

Files\Schlumberger\PIPESIM\Case Studies\Open

'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 as String) as Boolean GetNameList (ObjectType As Long, pNameArray, Count As Long) Returns true if custom data has been stored against the KeyName string Returns in pNameArray an array of String with the 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 Returns: 0: no artificial lift 1: gas lift injection 2: ESP -1: Object not found ObjectType must be Tubing type (16) ObjectName the name of the tubing Returns the names of equipment of type EquipmentType (See GetNameList () for the ISingleBranch object for available types), which are part of the single branch model of object ParentObject of type ParentType. ParentType should be ProductionWell (7), InjectionWell (8), or Branch (5) PIPESIM

GetHasArtificialLift (ObjectType As Long, ObjectName As String, Lift As Long)

GetEquipmentInfo (EquipmentType As Long, ParentType As Long, ParentObject As String, EquipmentNames, Count As Long)

Schlumberger
GetLastError (ErrorStr As String) GetBoundaryProperties (ObjectName As String, Pressure As Double, Temperature As Double, Fluidrate As Double, Fluidtype As Long)

39

Open Link

GetBoundaryProperties_SI (ObjectName As String, Pressure As Double, Temperature As Double, Fluidrate As Double, fluidtype As Long) GetBoundaryBlackOil (ObjectName As String, BlackOil As Object) As Boolean GetBoundaryComposition (ObjectName As String, Composition As Object) As Boolean GetBoundaryCompositionType (ObjectName As String, Type As Long)

Returns the last error message produced by the interface Returns the boundary properties set in the model for object with identifier ObjectName. ObjectName must be a boundary object (Source, Sink, Production Well or Injection Well) 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 Similar to GetBoundaryProperties except that this function returns the properties in strict SI units.

GetBoundaryPVTFile (ObjectName As String, PVTFilename As String) As Boolean GetBoundaryType (ObjectName As String, Type As Long, CurveOption As Long)

GetCountObjectsInProfile (NetObjectName As String) As Long GetIsModelRunning () As Boolean GetPropertyNames (ObjectName As String, ParentName As String, PropNames) As Long

GetPropertyVal (ObjectName As String, ParentName As String, PropName As String, pValue As Double, pUnitStr As String) As Boolean

Gets the BlackOil object used by the source with identifier ObjectName. Only applicable for BlackOil models. The function returns True in case of success and False otherwise Gets the Compositional object used by the source with identifier ObjectName. Only applicable for compositional models, The function returns True in case of success and False otherwise Returns the composition model location used by the 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 Gets the PVT file used by the source with identifier ObjectName. Only applicable for Compositional/PVT models Returns the boundary condition type specified for the ObjectName source: 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 Returns the number of objects in the single branch model defined for NetObjectName. Returns True if simulation is running Returns in PropNames the list of properties defined for the object ObjectName. If ObjectName is defined at the single branch level then ParentName must be the identifier for its parent Network object. Return value is the number of properties For specified property (PropName) in the specified object (ObjectName) function gets a property value in Value and the units in UnitStr. Return value is True if 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

GetPropertyValAtObjectIndex (ObjectName As String, ParentName As String, PropName As String, pValue As Double, pUnitStr As String, SubObjectType As Long, Index As Long) As Boolean

GetPropertyStringAtObjectIndex (ObjectName As String, ParentName As String, PropName As String, pValue As String, Index As Long) As Boolean GetSingleBranchModel (NetObjectName As String) As ISingleBranchModel GetNamesInFolder(FolderName As String, ObjectType As Long, pNameArray, Count As Long)

constants and strings Gets a specified property value. This function extends the functionality of GetPropertyVal by allowing you to retrieve a property from a specified sub-component within 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). 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 The function is similar to GetPropertyValAtObjectIndex () but for properties defined as string Returns the ISingleBranchModel object for the NetObjectName specified Returns in pNameArray an array of String with the names of objects of the given type (ObjectType). The number of objects found is returned in Count. All allowed ObjectType values are described for GetNameList function Returns the array of coordinates for GUI element with name in ObjectName parameter. Values are central point X, central point Y, left, top, right, and bottom Returns the array of all branch names, the array of starting nodes and the array of ending nodes for those branches Returns the offline curve file name for the specified well name Returns a variant byte array of the custom data that has been stored against the supplied KeyName string Returns an array of the KeyNames strings for which custom data has been stored Returns a two-column array of Doubles for specified 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. Sets a BlackOil object to a given source. The function returns True in case of success and False otherwise Sets a compositional object to a source with identifier ObjectName. Only applicable for compositional models. The function returns True in case of success and False otherwise Sets the source boundary condition as defined by the curve in file CurveFileName. The format of the file 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

GetNodeCooordinates(ObjectName As String, pCoordArray) As Boolean GetConnectionInfo(pBranchArray, pSNodeArray, pENodeArray) As Boolean GetBoundaryCurveFile(ObjectName As String) As String GetCustomData(KeyName As String, pValue) As Boolean GetCustomKeys(pKeyNameArray) As Boolean GetFlowrateLimits_SI(ObjectName as String) As Variant

INetModel Interface - Set Methods SetBoundaryBlackOil (ObjectName As String, BlackOil As Object) As Boolean SetBoundaryComposition (ObjectName As String, Composition As Object) As Boolean SetBoundaryCurveFile (ObjectName As String, CurveFileName As String) As Boolean

PIPESIM

Schlumberger

41

Open Link

SetBoundaryFluidrate (ObjectName As String, Fluidtype As Long, value As Double, UnitStr As String) SetBoundaryPressure (ObjectName As String, value As Double, UnitStr As String) SetBoundaryPVTFile (ObjectName As String, PVTFilename As String) As Boolean SetBoundarySourcePQPoints (ObjectName As String, PQPoints, fluidtype As Long, PressureUnits As String, FlowrateUnits As String) As Boolean SetBoundaryTemperature (ObjectName As String, value As Double, UnitStr As String) SetBoundaryType (ObjectName As String, Type As Long, CurveOption As Long)

object identified by ObjectName must be a Production Well. Sets the given value in the given units as fluidrate boundary condition for source object ObjectName. Fluidtype can be any of: 0 = liquid rate, 1 = gas rate, 2 = mass rate Sets the given value in the given units as pressure boundary condition for source object ObjectName. Sets a PVT file to a given source. PVTFilename must contain the full path to a PVT file Sets a number of pressure and flowrate pairs as a boundary condition to the referred ObjectName. PQPoints is a 2-dimensional array of pressure/temperature values. The object must be of the type generic source. Number of data points cannot exceed 30. Sets the given value in the given units as temperature boundary condition for source object ObjectName. Sets the type of boundary condition for source object ObjectName. 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 ()) Sets the specified property (PropName) in the specified object (ObjectName) to the value given in Value in the given units (UnitStr). Function returns 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. This function extends the functionality of SetPropertyVal by allowing you to set a property to a specified sub-component within an object. A typical use of this is when for instance it 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) which is defined for Well_1 (ParentName). For available options see Defined constants and strings. Similar to SetPropertyValAtObjectIndex () except that PropName is a string type property.

SetPropertyVal (ObjectName As String, ParentName As String, PropName As String, value As Double, UnitStr As String) As Boolean

SetPropertyValAtObjectIndex (ObjectName As String, ParentName As String, PropName As String, value As Double, UnitStr As String, SubObjectType As Long, Index As Long) As Boolean

SetPropertyStringAtObjectIndex (ObjectName As String, ParentName As 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
String) SetSingleBranchModel (NetObjectName As String, filename As String) As Boolean SetCustomData(KeyName As String, pValue) As Boolean

42

Open Link

main fluid in the simulations Sets the underlying single branch model by way of its associated .bps file to a network object. Stores a variant array of byte data against a KeyName string. This can be used to persist additional custom data, and can later be retrieved by specifying the KeyName Sets flowrate limits for specified branch passing a 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.

SetFlowrateLimits_SI(ObjectName as String, Limits)

INetModel Interface - Properties BlackOilDefault As Object CompositionDefault As Object FlowCorrelation As Object FluidModelType As Long LocalFluid (ObjectName As String) As FluidModel ModelFileName As String ModelBuilder As ModelBuilder ProjectInfo As ProjectInfo ErosionCorrosion As Object UseNetErCorrSettings As Long

BottomKeywords As String TopKeywords As String AppVersion As String

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

INetModel Interface - Operations ExportEngineFiles ()

KillSimulationProcess () OpenModel (bstrModelFileName As String)

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. Terminates the simulation process Opens the given network model. Filename must be a valid PIPESIM network model file (.bpn) This function must be called first when using this object.

PIPESIM

Schlumberger
RunNetwork (bRestart As Boolean)

43

Open Link

RunNetwork2 (bRestart As Boolean, EngSwitches As String) SaveModel (bstrPathName As String) As Boolean ResetLocalErCorrSettings() As Boolean SetNodeCoordinates (NodeName As String, X As Long, Y As Long) TopLeftCoordinate_X As Long

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. Similar to RunNetwork and also accepts one or more switches to be passed to the simulation engine. Saves the currently opened model to a file given by bstrPathName Overrides all local erosion and corrosion settings with the global ones Sets the node coordinates for node object NodeName to X, Y coordinates Sets/returns the top left X coordinate of the graphical panel. SetNodeCoordinates values are passed in relation to TopLeftCoordinate_X and TopLeftCoordinate_Y As above for the Y coordinate Returns the bottom right X coordinate of the graphical panel (this is a read-only property) As above for the Y coordinate Gets the node X, Y coordinates for node object NodeName Returns the last error message produced by the object

ModelBuilder object

TopLeftCoordinate_Y As Long BottomRightCoordinate_X As Long BottomRightCoordinate_Y As Long GetNodeCoordinates (NodeName As String, X As Long, Y As Long) GetLastError () As String

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

PIPESIM

Schlumberger
Viscosity As Object ThermalData As Object Contaminants As Variant

44

Open Link

String containing the text in the comments field String containing the text in the comments field Array of Doubles for contaminant values in a following order: CO2, H2S, N2, H2 and CO Sets the bubble point data

IBlackOil object - Methods SetBubblePointCalibration (SatGas_SI As Double, Pressure_SI As Double, Temperature_SI As Double) GetBubblePointCalibration (Pressure_SI As Double, Temperature_SI As Double) As Double

Gets the bubble point data. Return value is a Saturation Gas correlation : 0 for Lasater, 1 for Standing, 2 for Vazquez and Beggs, 3 for Glaso, 4 for Kartoatmodjo, 5 for De Ghetto at al or 6 for PetroskyFarshad Sets data for the required fluid sBlob = String containing black oil information

IBlackOil object - Operations SetBlob (sBlob As String)

ISinglePointCalib object
ISinglePointCalib object Get Methods GetCalibrationAtBubblePoint (Pressure_SI As Double, Temperature_SI As Double, SatGas_SI As Double) as Long GetCalibrationAboveBubblePoint (OFVF As Double, Density_SI as Double, Compressibility_SI as Double, Pressure_SI As Double, Temperature_SI As Double) as Long GetCalibrationBelowBubblePoint (OFVF As Double, Density_SI as Double, Pressure_SI As Double, Temperature_SI As Double) as Long GetLiveOilViscBelowBubblePoint (Pressure_SI As Double, Temperature_SI As Double, LiveOilVisc_SI) as Long Function gets calibration data at bubble point. The return value is Saturation Gas correlation: 0 for Lasater, 1 for Standing, 2 for Vazquez and Beggs, 3 for Glaso, 4 for Kartoatmodjo, 5 for De Ghetto et al. or 6 for Petrosky-Farshad Function gets calibration data above bubble point. The return value is density type: 0 for Density, 1 for OFVF or 3 for Compressibility

Function gets calibration data below bubble point. The return value is density type: 0 for Density or 1 for OFVF Function gets live oil viscosity data below bubble point. The return value is Live Oil Viscosity Correlation: 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 Function gets gas viscosity data below bubble point. The return value is gas viscosity. Function gets gas Z data below bubble point. The return value is gas Z correlation: 0 for Standing, 1 for Hall Yarborough or 2 for Robinson et al. Function sets calibration data at bubble point. The acceptable values for Saturation Gas correlation are: 0 for Lasater, 1 for Standing, 2 for Vazquez and Beggs, 3 for Glaso, 4 for Kartoatmodjo, 5 for De Ghetto et al. or 6 for Petrosky-Farshad Function sets calibration data above bubble point. The acceptable values for density type are: 0 for Density, 1 for OFVF or 3 for Compressibility

GetGasViscBelowBubblePoint (Pressure_SI As Double, Temperature_SI As Double) as Double GetGasZBelowBubblePoint (GasZ as Double, Pressure_SI As Double, Temperature_SI As Double) as Long ISinglePointCalib object Set Methods SetCalibrationAtBubblePoint (SolGasCorr as Long, Pressure_SI As Double, Temperature_SI As Double, SatGas_SI As Double) SetCalibrationAboveBubblePoint (DensType as Long, OFVF As Double, Density_SI as Double, Compressibility_SI as Double,

PIPESIM

Schlumberger
Pressure_SI As Double, Temperature_SI As Double) SetCalibrationBelowBubblePoint (DensType as Long, OFVF As Double, Density_SI as Double, Pressure_SI As Double, Temperature_SI As Double) SetLiveOilViscBelowBubblePoint (LiveOilCorr as Long, Pressure_SI As Double, Temperature_SI As Double, LiveOilVisc_SI)

45

Open Link

Function sets calibration data above bubble point. The acceptable values for density type are: 0 for Density or 1 for OFVF Function sets live oil viscosity data below bubble point. The acceptable values for Live Oil Viscosity Correlation 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 Function sets gas viscosity data below bubble point.

SetGasViscBelowBubblePoint (Pressure_SI As Double, Temperature_SI As Double, GasVisc_SI as Double) SetGasZBelowBubblePoint (GasZCorr as Long, GasZ as Double, Pressure_SI As Double, Temperature_SI As Double)

Function sets gas Z data below bubble point. The acceptable values for gas Z correlation are: 0 for Standing, 1 for Hall Yarborough or 2 for Robinson et al.

IMultiPointCalib object
IMultiPointCalib object Properties OFVF as Boolean IMultiPointCalib object Get Methods GetCalibUnits (UnitsArray) True for Oil FVF or False for Oil Density Function returns an array of Strings containing units for Pressure, Solution Gas GOR, Oil Density, Oil Viscosity and Gas Viscosity 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 Function returns a calibration temperature and units. Function gets calibration data at bubble point as an 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 Function gets calibration data above bubble point as 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 Function gets calibration data below bubble point as 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 Function sets units for Pressure, Solution Gas GOR, Oil Density, Oil Viscosity and Gas Viscosity supplied as an array of Strings PIPESIM

GetCorrelations (CorrArray)

GetTemperature (Value As Double, Units as String) GetCalibrationAtBubblePoint (CalibData)

GetCalibrationAboveBubblePoint (CalibData)

GetCalibrationBelowBubblePoint (CalibData)

IMultiPointCalib object Set Methods SetCalibUnits (UnitsArray)

Schlumberger
SetCorrelations (CorrArray)

46

Open Link

SetTemperature (Value As Double Units as String) SetCalibrationAtBubblePoint (CalibData)

SetCalibrationAboveBubblePoint (CalibData)

SetCalibrationBelowBubblePoint (CalibData)

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 Function sets a calibration temperature in specified units. Function sets calibration data at bubble point passed 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 Function sets calibration data above bubble point 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 Function sets calibration data below bubble point 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 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 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 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 PetroskyFarshad or 9 for none Function returns temperature and viscosity values for Dead Oil for user-specified 2-point Dead Oil Viscosity Correlation Function returns a two-column array of Doubles

LiveOilCorr as Long

EmulViscosity as Long

UsatOilViscosity as Long

IViscosityData object Get Methods GetDOPoints (Temp1 as Double, Temp2 as Double, TUnits as String, Visc1 as Double, Visc2 as Double, VUnits as String) GetUserViscTable_SI (Table)

PIPESIM

Schlumberger

47

Open Link

GetUserEmulTable_SI (Type as Long, Table)

GetWCutCutoff (Method as Long, WCut As Double, Units as String) GetEmulCoeffs (Method as Long, Coeff1 as Double, Coeff2 as Double)

GetKouzelCoeffs (ParA as Double, ParB as Double) IViscosityData object Set Methods SetDOPoints (Temp1 as Double, Temp2 as Double, TUnits as String, Visc1 as Double, Visc2 as Double, VUnits as String) SetUserViscTable_SI (Table)

containing values for Temperature and Viscosity for user-supplied table Dead Oil Viscosity Correlation Function returns a three-column array of Doubles 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. Function returns a watercut cutoff method (0 for user-defined or 1for Brauner & Ullman) and a cutoff value and units . Function returns a emulsion viscosity method and user-supplied coefficients if applicable. Method equals 9 for Vand with user-supplied coefficients, 10 for Richardson or -1 for all other chosen methods. Function returns Kouzel coefficients for Undersaturated Oil Viscosity Function sets temperature and viscosity values for Dead Oil for user-specified 2-point Dead Oil Viscosity Correlation Function sets a user-supplied table for Dead Oil Viscosity Correlation passing a two-column array of Doubles containing values for Temperature and Viscosity. Function sets a user-supplied table for Emulsion Viscosity passing a three-column array of Doubles containing values for Temperature, Viscosity Ratio and Viscosity for. Type equals 0 for TemperatureViscosity Ratio table or 1 for Temperature-Viscosity table. Function sets a watercut cutoff method (0 for userdefined or 1for Brauner & Ullman) and a cutoff value in specified units. Function sets user-supplied coefficients for corresponding emulsion viscosity method. Method must be 9 for Vand with user-supplied coefficients or 10 for Richardson. Function sets Kouzel coefficients for Undersaturated Oil Viscosity

SetUserEmulTable_SI (Type as Long, Table)

SetWCutCutoff (Method as Long, WCut As Double, Units as String) SetEmulCoeffs (Method as Long, Coeff1 as Double, Coeff2 as Double)

SetKouzelCoeffs (ParA as Double, ParB as Double)

IThermal object
IThermal object Get Methods GetConductivity (Values, Units as String) GetEnthropy (Values, Units as String) Function returns an array of 3 Doubles containing Gas, Oil and Water thermal conductivity values and a units string Function returns an array of 3 Doubles containing Gas, Oil and Water heat capacity values and a units string Function sets values for Gas, Oil and Water thermal conductivities passed as an array of 3 Doubles in specified units Function sets values for Gas, Oil and Water heat capacities passed as an array of 3 Doubles in specified units PIPESIM

ISinglePointCalib object Set Methods SetConductivity (Values, Units as String) SetEnthropy (Values, Units as String)

Schlumberger

48

Open Link

ICompositional object
ICompositional object - Properties Name As String ICompositional object - Get Methods GetComment () As String GetPackage () As Boolean GetPackageType () As Long Name of the fluid Returns a string containing the text in the comments field Returns the compositional package description, 0 = Multiflash and 1 = SIEPs SPPTS Returns the Compositional Package Type to use as long integer according to the following formula: 0 = SIS Flash, 1 = Multiflash, 2 = SPPTS. Returns the current component names list. pVar = list of component names as an array of strings pVar2 = list of hydrocarbon names as an array of 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 Returns the boiling points of the library components set by SetLibraryComptCalculator. pVar = list of boiling points as an array of doubles. Returns the molecular weight of the library components set by SetLibraryComptCalculator. pVar = list of molecular weights as an array of doubles. Returns the acentric factors of the library components set by SetLibraryComptCalculator. pVar = list of acentric factors as an array of doubles. Returns the critical pressures of the library components set by SetLibraryComptCalculator. pVar = list of critical pressures as an array of doubles. Returns the specific gravities of the library components set by SetLibraryComptCalculator. pVar = list of specific gravities as an array of doubles. Returns the critical temperatures of the library components set by SetLibraryComptCalculator. pVar = list of critical temperatures as an array of doubles. 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. 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. 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.

GetComponentList GetComponentList (pVart, pVar, pVar2, HydComp1 As Long, AquComp1 As Long) As Long

GetLibraryComptBP (pVar)

GetLibraryComptMW (pVar)

GetLibraryComptOM (pVar)

GetLibraryComptPC (pVar)

GetLibraryComptSG (pVar)

GetLibraryComptTC (pVar)

GetLibraryList (pVar) As Long

GetMolarList (pVar) As Long

GetMolWeightList (pVar) As Long

PIPESIM

Schlumberger
GetBoilingPointList (pVar) As Long

49

Open Link

GetSpecificGravityList (pVar) As Long

GetCriticalPressureList (pVar) As Long

GetCriticalTemperatureList (pVar) As Long

GetAcentricFactorList (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. pVar = list of specific gravities as an array of doubles with the values corresponding to the component names returned from GetComponentList. Return value is a size of the array. pVar = list of critical pressures as an array of doubles with the values corresponding to the component names returned from GetComponentList. Return value is a size of the array pVar = list of critical temperatures as an array of doubles with the values corresponding to the component names returned from GetComponentList. Return value is a size of the array. pVar = list of acentric factors as an array of doubles with the values corresponding to the component names returned from GetComponentList. Return value is a size of the array. Sets a string in the comments field of the compositional description 1 . Sets the compositional package description, False = Multiflash and true = SIEPs SPPTS. Sets the Compositional Package Type to use. The following values of lPackageType will set the package as described: 0 = SIS Flash, 1 = Multiflash, 2 = SPPTS Sets the component names list. 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 . pVar = list of molar flow rates as an array of doubles 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 pVar = list of component descriptions as an array of 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

ICompositional object - Set Methods SetComment (sComment As String) SetPackage (sPackage As Boolean) SetPackageType (lPackageType As Long)

SetComponentList (pVar, CompNum As Long, pVar2, CompNum2 As Long)

SetMolarList (pVar, CompNum As Long)

SetLibraryList (pVar, CompNum As Long)

1 2

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

PIPESIM

Schlumberger
SetLibraryComptCalculator (pVar, CompNum As Long)

50

Open Link

SetMolwtList (pVar, CompNum As Long)

SetPvtFile SetPvtFile (sFile As String) SetBoilingPointList (pVar, CompNum As Long)

SetSpecificGravityList (pVar, CompNum As Long)

SetCriticalPressureList (pVar, CompNum As Long)

SetCriticalTemperatureList (pVar, CompNum As Long)

SetAcentricFactorList (pVar, CompNum As Long)

pVar = list of library component names ONLY as an 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. pVar = list of molecular weights as an array of 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. Calls the compositional pvt file reader to read the inputted pvt file. pVar = list of boiling points as an array of doubles 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 pVar = list of specific gravities as an array of doubles 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 pVar = list of critical pressures as an array of doubles 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 pVar = list of critical temperatures as an array of 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. pVar = list of acentric factors as an array of doubles 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 Blanks all compositional arrays and parameters in memory

ICompositional object - Operations CreateNewComposition ()

PIPESIM

Schlumberger
UpdateComposition () SetBlob (sBlob As String)

51

Open Link

Updates all compositional arrays and parameters in memory Sets data for the required composition sBlob = String containing compositional information 3 .

FlowCorrelations Interface
CIFlowCorrelation object - Get Methods GetHorizontalCorrelationName () As String GetHorizontalSourceName () As String GetVerticalCorrelationName () As String GetVerticalSourceName () As String GetSensitivityItems (VerticalCorrs As Boolean, Items) As Long Returns the horizontal correlation name. The returned string is a unique keyword name. Returns the correlations source name (such as bja, tulsa) Returns the vertical correlation name. The returned string is a unique keyword name (for example ANSAR, BJA, BBR, BBOTD) Returns the correlations source name (such as bja, tulsa) Returns the 4-column array (help string, engine code, 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 Set a horizontal correlation. For example, for the 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 Set a horizontal user correlation Set a vertical source and correlation. For example for the Tulsa correlation source it can be any of: TBB, TDR, TGA, THB, TMB, TORK Set a vertical user correlation

CIFlowCorrelation object - Set Methods SetHorizontalCorrelation (sSource As String, sCorrelation As String)

SetHorizUserCorrelation (sSource As String, sCorrelation As String) SetVerticalCorrelation (sSource As String, sCorrelation As String)

SetVertUserCorrelation (sSource As String, sCorrelation As String) CIFlowCorrelation object - Properties SwapAngle As Double HorizontalFrictionFactor As Double VerticalFrictionFactor As Double VerticalHoldup As Double HorizontalHoldup As Double SinglePhaseCorrelation As String

Vertical-Horizontal Correlation Swap Angle Horizontal Friction Factor Vertical Friction Factor Vertical Holdup Horizontal Holdup 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 Displays PIPESIM dialog for flow correlation (this DisplayDialog () method is obsolete, use DisplayDialog2 instead). Displays PIPESIM dialog for flow correlation (). DisplayDialog2 () As Boolean Return value is True if data is changed and False otherwise

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 Gets the IEngineOptions object to set simulation parameters and run the operation. See IEngineOptions Interface for its methods and properties Applicable to gas lifted systems, this property sets/gets whether gas lift valves are installed in the tubing Sets/gets whether the sensitivity values for the different variables are permuted against each other or changed in step. Gets the max available number of the sensitivity variables allowed for the operation indx: the sensitivity box indx. Pass 1 for the X-axis variable, 0,1,2,, (MaxSensitivityVars -1) for the corresponding sensitivity. Returns the sensitivity object name for the specified index. indx: the sensitivity box indx. Pass 1 for the X-axis variable, 0,1,2,, (MaxSensitivityVars -1) for the corresponding sensitivity. Returns the sensitivity variable name for the specified index Returns True if the operations data is all blank (unset) Returns an error description after function call failure. Must be called immediately after the call to the failed function.

Engine As IEngineOptions

FixedInjectionDepths As Boolean

PermuteSensVars As Boolean

MaxSensitivityVars As Long SensitivityObject (indx As Long) As String

SensitivityVariable (indx As Long) As String

ISystemsAnalysis Object - Get Methods GetIsUnset () As Boolean GetLastError () As String

PIPESIM

Schlumberger
GetSensitivityData_SI (indx As Long, ObjectStr As String, VarStr As String, Values_SI, QuantClass As String)

53

Open Link

Returns the sensitivity data specified for the operation. 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 Sets the sensitivity information. 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 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) Similar to SetSensitivityData, but uses strict SI units 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 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.) Sets the user interface language 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 Writes an ASCII file (modelname.inc) containing the instructions to the simulation engine to run the operation. Displays the operations graphical interface. Pass a Null variant as the first argument. Returns True if dialog box was closed OK, otherwise False.

ISystemsAnalysis Object - Set Methods SetSensitivityData (indx As Long, ObjectStr As String, VarStr As String, Values_DefEng, vbActive As Boolean)

SetSensitivityData_SI (indx As Long, ObjectStr As String, VarStr As String, Values_SI, vbActive As Boolean, QuantClass As String)

SetLanguage (nlLanguageID As Long) As Boolean

ISystemsAnalysis Object - Operations WriteOperationFile () As Boolean

DisplayDialog (p_VarUnitManager, CloseOK As Boolean)

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 Gets the IEngineOptions object to set simulation parameters and run the operation. See IEngineOptions for its methods and properties Applicable to gas lifted systems, this property sets/gets whether gas lift valves are installed in the tubing Gets/sets whether survey data is used for profile plotting 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 indx: the sensitivity box indx. Pass 1 for the X-axis variable, 0,1,2, , (MaxSensitivityVars -1) for the corresponding sensitivity. Returns the sensitivity object name for the specified index. indx: the sensitivity box indx. Pass 1 for the X-axis variable, 0,1,2, , (MaxSensitivityVars -1) for the corresponding sensitivity. Returns the sensitivity object name for the specified index. Returns true if the operations data is all blank (unset) Returns an error description after function call failure. Must be called immediately after the call to the failed function. Returns the sensitivity data specified for the operation. 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. Sets the sensitivity information. 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

Engine As IEngineOptions

FixedInjectionDepths As Boolean

EnableSurveyOpts As Boolean ProfileType As Long

SensitivityObject (indx As Long) As String

SensitivityVariable (indx As Long) As String

IPTProfile Object - Get Methods GetIsUnset () As Boolean GetLastError () As String

GetSensitivityData_SI (ObjectStr As String, VarStr As String, Values_SI, QuantClass As String)

IPTProfile Object - Set Methods SetSensitivityData (ObjectStr As String, VarStr As String, Values_DefEng)

PIPESIM

Schlumberger
SetSensitivityData_SI (ObjectStr As String, VarStr As String, Values_SI, QuantClass As String)

55

Open Link

SetSurveyData_SI (SurveyName As String, SurveyDate As Date, Var_MD_Pres_Temp)

SetLanguage (nlLanguageID As Long) As Boolean

Same as SetSensitivityData method, but for strict SI units 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. Associates field data to the operation. This data pressure and/or temperature profiles is then plotted 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. Sets the user interface language 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 Writes an ASCII file (modelname.inc) containing the instructions to the simulation engine to run the operation. Displays the operations graphical interface. Pass a Null variant as the first argument. Returns True if dialog box was closed OK, otherwise False.

IPTProfile Object - Operations WriteOperationFile () As Boolean

DisplayDialog (p_VarUnitManager, CloseOK As Boolean)

Flow Correlation Matching


ICorrMatching object - Properties BoundaryConds As IBoundaryProps Get/set property to access boundary conditions. See IBoundaryProps Interface for its methods and properties Gets the IEngineOptions object to set simulation parameters and run the operation. See IEngineOptions Interface for its methods and properties Gets/sets whether survey data is used for profile plotting 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 Returns true if the operations data is all blank (unset) Returns an error description after function call failure. Must be called immediately after the call to the failed function.

Engine As IEngineOptions

EnableSurveyOpts As Boolean ProfileType As Long

ICorrMatching object - Get Methods GetIsUnset () As Boolean GetLastError () As String

PIPESIM

Schlumberger
GetSelectedCorrelation (IsVertical As Boolean, EngineCodes)

56

Open Link

Function returns in EngineCodes the array of string for chosen vertical flow correlations if IsVertical is True and for horizontal correlations if IsVertical is False Associates field data to the operation. This data, pressure and/or temperature profiles is then plotted 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 Set or removes selection for the correlation specified by engineCode depending on IsSelected value IsVertical = True for vertical correlations, False for horizontal. Sets the user interface language 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 Writes an ASCII file (modelname.inc) containing the instructions to the simulation engine to run the operation. Displays the operations graphical interface. Pass a Null variant as the first argument. Returns True if dialog box was closed OK, otherwise False.

ICorrMatching object - Set Methods SetSurveyData_SI (SurveyName As String, SurveyDate As Date, Var_MD_Pres_Temp)

SetSelectedCorrelation (helpStr As String, engineCode As String, mainCode As String, IsVertical As Boolean, IsSelected As Boolean) SetLanguage (nlLanguageID As Long) As Boolean

ICorrMatching object - Operations WriteOperationFile () As Boolean

DisplayDialog (p_VarUnitManager, CloseOK As Boolean)

Nodal Analysis
INodalAnal Object - Properties CFactor As Double EngineSwitch As String FetkovichExp As Double FixedInjectionDepths As Boolean Sets a Constant C value Sets/gets extra command line arguments for the PIPESIM engine Sets a Fetkovich n exponent value Applicable to gas lifted systems, this property sets/gets whether gas lift valves are installed in the tubing Sets a future AOFP value Sets a flag whether to use Future IPR option (True by default) The full path name to the engines operation file Allow the inflow curves to extend to the AOFP (true) Returns/sets the inflow object name Returns/sets the inflow variable name Maximum pressure for the outflow curves The maximum fluidrate in strict SI units The maximum fluid rate type: 0: liquid, 1: gas, 2 mass

FutureAOFP As Double FutureIPR As Boolean IncludeFilePath As String InflowCurveRangeLimit As Boolean InflowObject As String InflowVariable As String MaxPressureForOutflow_SI As Double MaxRate_SI As Double MaxRateFluidType As Long

PIPESIM

Schlumberger
NumberInflowPoints As Long NumberOutflowPoints As Long OutflowCurveRangeLimit As Boolean OutflowObject As String OutflowVariable As String OutletPressure_SI As Double PipesimEnginePath As String PlotToolPath As String PsmFilePath As String ReservoirPressure As Double RunEngineMinimised As Long RunPlotToolWithEngine As Long

57

Open Link

The number of points on each inflow curve The number of points on each outflow curve Allow the outflow curves to extend to the supplied maximum flowrate Returns/sets the outflow object name Returns/sets the outflow variable name Gets/sets the outlet pressure in strict SI units The full path to the PIPESIM engine The full path to the plotting tool (PSPlot) The full path to the model file (.psm file) Set a reservoir pressure. Used for future AOFP calculations Runs the engine in a minimised window If True (1) shows the plotting tool (PSPlot) as the simulation runs Returns True (1) if the PIPESIM engine is running, otherwise False (0) Returns True (1) if the operations data is all blank (unset) Returns an error description after function call failure. Must be called immediately after the call to the failed function. Returns the sensitivity data specified for the operation. 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. Sets the sensitivity data specified for the operation. InflowOutflow: 0: inflow data, 1 outflow data 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 Unit System. Sets the user interface language 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 Terminates the engine run Runs the simulation

INodalAnal Object - Get Methods GetIsEngineActive (p_bActive As Long) GetIsUnset GetIsUnset (pVar As Long) GetLastError (errorStr As String)

GetSensitivityData_SI (InflowOutflow As Long, ObjectStr As String, VarStr As String, Values_SI, QuantClass As String)

INodalAnal Object - Set Methods SetSensitivityData_SI (InflowOutflow As Long, ObjectStr As String, VarStr As String, Values_SI, QuantClass As String)

SetLanguage (nlLanguageID As Long) As Boolean

INodalAnal Object - Operations KillOperation () RunOperation ()

PIPESIM

Schlumberger
WriteOperationFile (bOK As Boolean) DisplayDialog (p_VarUnitManager)

58

Open Link

DisplayDialog2 (p_VarUnitManager, bCloseOK As Boolean)

Writes an ASCII file containing the instructions to the simulation engine to run the operation. Displays the operations graphical interface. Pass a NULL variant as the first argument. This method is obsolete. Use DisplayDialog2 method instead Displays the operations graphical interface. Pass a Null variant as the first argument. Returns true if dialog box was closed OK, otherwise false.

Wax Deposition
IWaxOp Object - Properties RunEngineMinimised As Boolean RunPlotToolWithEngine As Boolean PsmFilePath As String PlotToolPath As String IncludeFilePath As String PipesimEnginePath As String EngineSwitch As String Runs the engine in a minimised window If True (1) shows the plotting tool (PSPlot) as the simulation runs The full path to the model file (.psm file) The full path to the plotting tool (PSPlot) The full path name to the engines operation file The full path to the PIPESIM engine Sets/gets extra command line arguments for the PIPESIM engine

WaxProperties As Variant IWaxOp Object - Get Methods GetLastError() As String

GetIsUnset() As Boolean GetIsEngineActive() As Boolean

Returns an error description after function call failure. Must be called immediately after the call to the failed function. Returns True (1) if the operations data is all blank (unset) Returns True (1) if the PIPESIM engine is running, otherwise False (0) Sets the user interface language 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 Displays the operations graphical interface. Pass a NULL variant as the first argument. This method is obsolete. Use DisplayDialog2 method instead Displays the operations graphical interface. Pass a Null variant as the first argument. Returns true if dialog box was closed OK, otherwise false. Runs the simulation Terminates the engine run Writes an ASCII file containing the instructions to the simulation engine to run the operation. WaxMethod can be one of the following values: 0: Shell;

IWaxOp Object - Set Methods SetLanguage(nlLanguageID As Long) As Boolean

IWaxOp Object - Operations DisplayDialog(p_VarUnitManager As Variant)

DisplayDialog2(p_VarUnitManager As Variant) As Boolean RunOperation(); KillOperation(); WriteOperationFile() As Boolean

IWaxOp2 Object - Properties WaxMethod As Integer

PIPESIM

Schlumberger

59 1: BP; 2: Schlumberger DBR; 3: None

Open Link

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 InletPressure_SI As Double FluidRate_SI As Double CalculatedVariable As Long Gets/sets the outlet pressure in strict SI units Gets/sets the inlet pressure in strict SI units Gets/sets the fluid rate in strict SI units Gets/sets the calculated variable: 0: Outlet Pressure 1: Inlet Pressure, 2: FluidRate Gets/sets the fluidrate type: 0: liquid 1: gas 2: mass

FluidType As Long

IEngineOptions Interface
IEngineOptions - Properties EngineSwitch As String IncludeFilePath As String PipesimEnginePath As String PlotToolPath As String PsmFilePath As String RunEngineMinimised As Boolean RunPlotToolWithEngine As Boolean Sets/gets extra command line arguments for the PIPESIM engine The full path name to the engines operation file The full path to the PIPESIM engine The full path to the plotting tool (PSPlot) The full path to the model file (.psm file) Runs the engine in a minimised window If True shows the plotting tool (PSPlot) as the simulation runs Returns True if the PIPESIM engine is running, otherwise False Terminates the engine run Runs the simulation

IEngineOptions - Get Methods GetIsEngineActive () As Boolean IEngineOptions - Operations KillOperation () RunOperation ()

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 Returns in pVar an array of Doubles with the GetArrayEqCurvePressure(pVar) equilibrium curve pressure at each valve depth Returns in pVar an array of Doubles with the GetArrayGasRate(pVar)

PIPESIM

Schlumberger

60

Open Link
actual throughputs for each valve. Uses Thornhill & Craver equation Returns in pVar an array of Doubles with the injection pressure at each valve depth Returns in pVar an array of Doubles with the injection temperature at each valve depth Returns in pVar an array of Doubles with the maximum throughputs for each valve. Uses Thornhill & Craver equation Returns in pVar an array of Doubles with the production pressure at each valve depth Returns in pVar an array of Doubles with the production temperature at each valve depth Returns in pVar an array of Doubles with closing pressures for each valve Returns in pVar an array of Doubles with opening pressures for each valve Returns in pVar an array of Strings with the valve status: such as Throttling, Fully Open. 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. Returns the last error message produced by GLD. Returns in pVar a 2-dimensional array of 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 Returns in pVar a 2-dimensional array of 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 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 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. Type: 0 = MD; 1 = TVD pVar: a two dimensional array containing Doubles {depth, temperature} tempUnits: temperature units for the values in the arrays lenUnits: units for the depth values in the array.

GetArrayInjectionPressure(pVar) GetArrayInjectionTemperature(pVar) GetArrayMaxGasRate(pVar)

GetArrayProductionPressure(pVar) GetArrayProductionTemperature(pVar) GetArrayValveClosePressure(pVar) GetArrayValveOpenPressure(pVar) GetArrayValveStatus(pVar) GetEquilibriumCurve(pVar)

GetLastError(sLastError As String) GetProductionPressureCurve(pVar, type As Long)

GetProductionTemperatureCurve (pVar, type As Long)

GLWell Object - Set Methods AddCalculatedPressureProfile (type As Long, pVar, pressUnits As String, lenUnits As String)

AddCalculateTempProfile (type As Long, pVar, tempUnits As String, lenUnits As String)

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. Required if ProfileMode property is set to User 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 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 This method can be used to enter an existing equilibrium curve. Use in conjunction with the property CalculateEqCurveOnDisplay to control the execution of PIPESIM. Type: valve type Any of: 0 = IPO, 1 = PPO, 2 = IPS, 3 = PPS, 4 = Orifice, 5 = Dummy depth [ft]: valve depth 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 Required if ProfileMode property is set to User 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 Type: 0 = MD; 1 = TVD pVar: a two dimensional array containing 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 Optional, this parameters are written to the u2p file

AddDeviationSurvey (pVar, TVDUnits As String, MDUnits As String)

AddEquilibriumCurve (pVar, pressUnits As String, lenUnits As String)

AddGasLiftValve5 (type As Long, depth As Double, Ptro As Double, ptroUnits As String, Ap As Double, ApAb As Double, PortSize As Double, NomOD As Double, desc As String, Cd As Double, dpfo As Double)

AddPressureSurvey (type As Long, pVar, pressUnits As String, lenUnits As String)

AddTemperatureSurvey (type As Long, pVar, tempUnits As String, lenUnits As String)

SetApi (api As Double)

PIPESIM

Schlumberger

62

Open Link
gsg: gas specific gravity resDepth: reservoir depth [ft] chp: injection head pressure chpUnits: pressure units for the value entered as 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] Optional, this parameters are written to the u2p file Optional, these parameters are written to the u2p file. IprType = 0 for WELLPI, IprType = 1 for VOGEL 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 Required if ProfileMode property is set to Constant Gradient Optional, this parameters are written to the u2p file kickOffInjPressure: casing head pressure to start unloading kickOffPres_Units: the pressure units for the above parameter unloadingGrad: the unloading gradient unloadingGrad_Units: Any of psi/ft, bar/m, atm/m, kPa/m 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

SetGLWellProperties2 (gsg As Double, resDepth As Double, chp As Double, chpUnits As String, cht As Double, tht As Double, rest As Double, surft As Double, Qgi As Double)

SetHorizontalCorrelation (bsName As String, HoldupFactor As Double, FrictionFactor As Double) SetIprTypeAndValue (IprType As Long, IprValue As Double) SetPressureUnits (unitStr As String)

SetProductionPressureGradient (value As Double, unitStr As String) SetSinglePhaseCorrelation (bsName As String, Efficiency As Double) SetTransferLinesParams3 (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)

PIPESIM

Schlumberger

63

Open Link
The same as SetTransferLinesParams () with the added design mode parameters: SurfaceOffset: percentage of the difference between the operating production (wellhead) pressure and the injection pressure. The pseudo wellhead pressure is then the operating wellhead pressure plus this surface offset value. Used in Variable Gradient method in design mode. 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

SetTransferLinesParams4 (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, SurfaceOffset As Double, BottomOffset As Double, BottomOffset_Units As String)

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 Double, unitStr As String) SetVerticalCorrelation (bsName As String, HoldupFactor As Double, FrictionFactor As Double, SwapAngle As Double) GLWell Object - Operations DisplayGasLiftDialog DisplayGasLiftDialog2 (JpgFilename As String, p_VarUnitManager, bCloseOK As Boolean) GLWell Object - Properties PressureProfileMode As Long

Required if ProfileMode property is set to Constant Gradient or Variable Gradients Optional, this parameters are written to the u2p file

Pops up the GLD GUI Same as DisplayGasLiftDialog but it allows to pass Jpeg file name where plot will be stored

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
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. If True (AND the profile type is 'Simulate') the 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. Sets the module in design mode (True) otherwise diagnostics mode (False). Default is False The gor in scf/bbl. Required if PressureProfileMode = 3 Mode = 0 calculate flowrate {DEFAULT} Mode = 1 calculate inlet pressure This is applicable when PressureProfileMode =2 The production liquid rate in bbl/d. Required if PressureProfileMode = 3 bstrPath is the full path to a valid PIPESIM engine This data is required if PressureProfileMode = 2 Sets/gets the tolerance in % for the convergence of PIPESIM iterations (default = 1 %) The pressure gradient in psi/ft. Required if PressureProfileMode = 0 The full path to a valid psm file This data is required if PressureProfileMode = 2 Gets/sets the static reservoir pressure System = 0 Engineering (DEFAULT), System = 1 SI (default = 1) (default = 1) (default = 1) (default = 1) (default = 1) (default = 1) (default = 1) (default = 1) (default = 1) Sets to valve at 0-based index ValveIndx (top valve is indx = 0) the temperature given in val [F]. See also the function SetValveTemperatureFrom () The watercut in %. Required if PressureProfileMode = 3

CalculateEqCurveOnDisplay As Boolean

CalculatePressureProfileOnDisplay As Boolean

DesignMode As Boolean

Gor As Double IterationMode As Long

LiquidRate As Double PipesimEnginePath As String

PipesimIterationTolerance As Double ProductionPressureGradient As Double PsmFilePath As String

ReservoirPressure As Double SetDisplayUnitSystem As Long ShowAmbientTemperature As Long ShowEquilibriumCurvePlot As Long ShowEquilibriumCurvePlot As Long ShowInjectionPressure As Long ShowProductionPressurePlot As Long ShowProductionTemperature As Long ShowTransferLinesPlot As Long ShowValveClosePressure As Long ShowValveOpenPressure As Long ValveTemperature (ValveIndx As Long) As Double

Watercut As Double

PIPESIM

Schlumberger

65

Open Link

An optional well description WellName As String 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
Camco R20 1/8 Port, 0.865, 800

66

Open Link

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, manuf As String, series As String, portname As String, portsize As Double, choke As Double, mode As String, ptro As Double, Ap As Double, Ab As Double, nomOD As Double, Cd As Double, tvd As Double, gasrate As Double) Returns the recently calculated valve parameters at the specified index manuf: manufacturer name series: series name portname: portsize: 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 Returns the recently calculated IGLValveSystem object Returns the count of recently calculated GL valves Returns the IDesignBias object Returns the IDesignParams object Returns the installed valve parameters at the specified index manuf: manufacturer name series: series name portname: portsize: 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 Object) GetCurrentValveSystemCount(Valve Count As Long GetDesignBias() As IDesignBias GetDesignParams () As IDesignParams GetGLValve (indx As Long, manuf As String, series As String, portname As String, portsize As Double, choke As Double, mode As String, ptro As Double, Ap As Double, Ab As Double, nomOD As Double, Cd As Double, md As Double, gasrate As Double)

PIPESIM

Schlumberger
GetIsUnset(bUnset As Boolean) GetProductionPressure(depth As Double) As Double GetProductionTemperature(depth As Double) As Double GetProjectData(ProjData) GetValveSystemCount(ValveCount As Long) GetLastError(errorStr As String) IGLDesign Object - Set Methods SetCompletionParams(Params) SetCurrentSystem(pIValveSystem As Object) SetFlowCorrsParams(Params) SetFluidParameters(Params)

67

Open Link

Returns True is data is not set and False otherwise Returns the production pressure Returns the production temperature Returns the array of strings containing project data Returns the count of installed GL valves Returns the last error message Sets the completion type as String for report purposes. String must be passed as Variant type Sets the IGLValveSystem object Sets the flow correlation as String for report purposes. String must be passed as Variant type 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. Sets the user interface language 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 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 Sets user-defined deviation survey pVar: a two dimensional array containing Doubles { MD , TVD} in Strict_SI units Validates the design data and returns True if data is ok. Otherwise the return value is False and Description contains the error message Pops up the GLDesign GUI. Pops up the results of the GL design calculations Runs the engine to perform design

SetLanguage(nlLanguageID As Long) As Boolean

SetProjectData(ProjData)

IGLDesign Object - Operations AddDeviationSurvey(pVar_MDvsTVD_ Points) CheckInput(Description As String) As Boolean

DisplayGasLiftDesign(p_VarUnitMana ger, bCloseOK As Boolean) DisplayResults(p_VarUnitManager) As Boolean PerformDesign() As Boolean IGLDesign Object - Properties AmbientTemperature As Double BottomHoleOffset As Double

PIPESIM

Schlumberger
DesignInjectionPressure As Double DesignMethod As String DesignMethod_ As Long

68

Open Link

DesignSpacing As Long 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

Can be one of the following: API, IPO-Surface Close, Variable Gradient, PPO Design 0 for API or IPO-Surface Close, 1 for IPO-Pt Mai/Max, 2 for PPO Design 0 for new spacing, 1 for current spacing

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

ValveManufacturer As String ValveMinPortSize As Double ValveSeries As String ValveType As String ValveNominalOD As Double ValveTemperature As String

Top Valve location 0 for liquid to surface, 1 for liquid not to surface Valve manufacturer filter value Valve min port size filter value Valve series filter value Valve type filter value Valve size filter value Can be one of the following: Production, Ambient, Injection or Unloading

PIPESIM

Schlumberger
ValveTemperature_NonTop As Long

69

Open Link

ValveTemperature_Top As Long

Unloading temperature for non-top valve: 0 for Production 1 for Ambient 2 for Injection 3 for Unloading 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 DeltaPtroBottomValve As Double InjPresDropBetweenValves As Double IsCalculateInjPresDrop As Boolean IsPlaceIPOatBottom As Boolean IsPlaceOrificeatBottom As Boolean IsTransferFactorBetweenIPandPP As Boolean LocatingDPAtValveLocation As Double TransferFactor As Double Discharge coefficient for orifice

PIPESIM

Schlumberger

70

Open Link

IGLValveSystem Object
IGLValveSystem Object - Get Methods GetGasLiftProps(InjPressure As Double, MaxAvailableRate As Double, InjTemp As Double, GasSG As Double, bstrPvtFile As String, bIsBlackOil As Boolean) Returns the GL properties: InjPressure injection pressure MaxAvailableRate gas rate InjTemp surface injection temperature GasSG gas specific gravity bstrPvtFile PVT file name (for compositional model) bIsBlackOil True if black oil model deifned, False otherwise Returns True is data is not set and False otherwise Returns the last error message Returns the count of installed GL valves Sets the GL properties: InjPressure injection pressure MaxAvailableRate gas rate InjTemp surface injection temperature GasSG gas specific gravity bstrPvtFile PVT file name (for compositional model) bIsBlackOil True if black oil model deifned, False otherwise Sets the user interface language 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 manuf: manufacturer name series: series name portname: portsize: choke: valve choke mode: valve type (IPO, PPO, IPS, PPS, Orifice or Dummy) ptro: test rack pressure Ap: port area Ab: port area/bellows area nomOD : nominal OD Cd: Cd value tvd : valve depth gasrate Removes all installed valves Pops up the GL Valve System GUI

GetIsUnset(bUnset As Boolean) GetLastError(errorStr As String) GetValveCount(lValveCnt As Long) IGLValveSystem Object - Set Methods SetGasLiftProps(InjPressure As Double, MaxAvailableRate As Double, InjTemp As Double, GasSG As Double, bstrPvtFile As String, bIsBlackOil As Boolean)

SetLanguage(nlLanguageID As Long) As Boolean

IGLValveSystem Object - Operations AddGLValve(manuf As String, series As String, portname As String, portsize As Double, choke As Double, mode As String, ptro As Double, Ap As Double, Ab As Double, nomOD As Double, Cd As Double, tvd As Double, gasrate As Double)

ClearValveSystem() DisplayGLValveSystem(p_VarUnitMan ager, bCloseOK As Boolean)

PIPESIM

Schlumberger
IGLValveSystem Object - Properties BellowsArea(iValveIndx As Long) As Double ChokeSize(iValveIndx As Long) As Double DPFO(iValveIndx As Long) As Double Manufacturer(iValveIndx As Long) As String MeasuredDepth(iValveIndx As Long) As Double nomOD(iValveIndx As Long) As Double PortArea(iValveIndx As Long) As Double portname(iValveIndx As Long) As String portsize(iValveIndx As Long) As Double ptro(iValveIndx As Long) As Double series(iValveIndx As Long) As String UseAnnulusGasGradient As Boolean UseValveDetails As Boolean ValveCv(iValveIndx As Long) As Double ValveMode(iValveIndx As Long) As String ValveModeType(iValveIndx As Long) As Long

71

Open Link

Gets bellows area for the valve specified by iValveIndx (Read only property) (Read only property)

(Read only property) (Read only property) (Read only property) (Read only property) (Read only property) (Read only property) (Read only property) (Read only property)

(Read only property) (Read only property) (Read only property)

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 Returns the name of the simulator that has been used to GetFileCreatorName() As String create the performance curves. Parameters - None Return Value - A string. Returns the number of variables (data columns) in the GetNumberofVariables() As Long performance curve. Parameters - None Return Value - An integer.

PIPESIM

Schlumberger
GetUnitofVariable(VariableName As String) As String GetDataofVariable(VariableName As String)

72

Open Link

GetVariableName(Index As Long) As String

GetMultipleVariablesData(Indexes)

GetTitle() As String

GetNumberofDataSets() As Long

GetVariableNamesList()

GetAllData()

GetLastError() As String ReadData Object - Operations OpenFile(FilePath As String) As Boolean

Returns the unit of given the column variable name. Parameters - VariableNme - Name of the column variable Return Value -A string. Returns the array of data at the given column variable name 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). Returns the name of column variable given the position of the variable. Parameters - Index - The position of the variable name in the column variable list. Return Value - A string. 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. Returns the title of the well performance curves file. Parameters - None Return Value - A string. Returns the number of data sets (= number of NEWLINE cards) in the performance curves file. Parameters - None Return Value - An integer. 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. 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. Returns the last error message 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
CloseFile() As Boolean

73

Open Link

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 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

' create an object of the

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 Returns a String (as Variant) containing plotting attributes for the specified variable Returns a Variant type containing two-dimensional array of the low/upper boundaries for the plot variables. Returns (as Variant type) the array of three doubles values for saturation pressure, saturation temperature and saturation GOR. (Black oil models only.)

GetAttributeDetailsAt(VariableName As String) GetAxisBoundaries() GetBubblePointData()

PIPESIM

Schlumberger
GetColumnVariableDataAt(VarName As String)

76

Open Link

Returns a Variant type containing two-dimensional array of 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 Returns a Double value (wrapped into Variant type) of cone gas specific gravity Returns a String value (wrapped into Variant type) of curve file date/time stamp 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 Returns an index for X axis variable Returns an index for Y axis variable Returns a curve file name (short form) Returns a curve file name (long form) Return a String New if curve file has new format, otherwise return value is Old Returns the last error message produced by the interface. Returns data similar to GetAllVariables function but for variables passed in Index array Returns the total number of variables in curve file Returns the number of cases in curve file 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.) Returns (as Variant type) the array of 2 doubles values for Well PI and static reservoir pressure Returns String with the simulator name Returns String with the project description Returns (as Variant type) the array of 5 Variants containing 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 Returns String with the current units for the specified variable Returns String ENG or S depending on unit system user selected for the output files Returns String with the user name form project properties Returns (as Variant type) the array of Strings containing all variables names from curve file Returns (as Variant type) the array of Doubles containing all values for the specified variable Similar to GetVariableDataAt but returned values are for the specified case only (case index is 1-based) Returns String with the variable name at specified index (1based) Returns (as Variant type) the array of 4 doubles values for temperatures and viscosities

GetConcatenationData() GetConeGasSG() As Double GetCreationDate() GetCurrentModelUnitSettings()

GetDefaultXAxis() As Long GetDefaultYAxis() As Long GetDynamicPlotFileName() As String GetDynamicPlotLongFileName() As String GetFileFormatStatus() As String GetLastError() As String GetMultipleColumnsDataAt(Index) GetNoOfDataColumn() As Long GetNumberOfCases() As Long GetPhysicalPropertyData()

GetProductionData() () GetSimulatorName() As String GetTitle() As String GetUnitDetailsAt(VariableName As String)

GetUnitsOfVariableName(sVarName As String) As String GetUnitType() As String GetUserName() As String GetVarableNamesList() GetVariableDataAt(ColName As String) GetVariableDataAtCase(VarName As String, CaseNo As Long) GetVariableNameAt(Index As Long) As String GetViscosityData()

PIPESIM

Schlumberger
PerformCurve Object - Operations OpenFile(FilePath As String) As Boolean

77

Open Link

CloseFile() As Boolean

IsWellFileOpened() 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. 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. 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 Read a Net engine (.PNS) output file ReadPnsFile Params BSTR FileName - Full path of net engine file (.PNS) IPNSComPtr Interface - Get Methods Get total number of nodes, junctions + wells + GetNodeCount source + sinks params (#) int *iNodeCount Get total number of branches (that is excluding wells GetBranchCount which engine treats as branch + source/sink) params (#) int - *BranchCount Fill a supplied SAFEARRAY (blob) with node data GetNodeData 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 Fill a supplied SAFEARRAY (blob) with node data GetBranchOutData, for i'th branch, data GetBranchInData 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 name of the i'th node in the array GetNodeName params int iNode - index in array (#) BSTR *sName - name of i'th element Get Network node type GetNodeType params int iNode - index in array (#) BSTR* sName - Source, Sink, Well, Junction

PIPESIM

Schlumberger
GetBranchName

78

Open Link

GetNodeVariableValue, GetBranchOutVariableValue, GetBranchInVariableValue

GetNodeStrVariableValue, GetBranchInStrVariableValue, GetBranchOutVariableValue

GetModelStatus

name of the i'th branch in the array params int iNode - index in array (#) BSTR *sName - name of i'th element Gets value of variable type Gas Rate, glr etc. for i'th element of array 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 Gets value of variable type Gas Rate, glr etc. for named element of array 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 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( dVal = pPNS->GetBranchOutVariableValue( dVal = pPNS->GetBranchOutVariableValue( } 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, dVal = pPNS->GetWellInVariableValue( i, dVal = pPNS->GetWellInVariableValue( i, dVal = pPNS->GetWellInVariableValue( i, dVal = pPNS->GetWellInVariableValue( i, dVal = pPNS->GetWellInVariableValue( i, dVal = pPNS->GetWellInVariableValue( i, dVal = pPNS->GetWellInVariableValue( i, dVal = pPNS->GetWellInVariableValue( i, PIPESIM i, Max Pres); i, Comp Power); i, Choke DP);

Pressure); Temperature); MassRate); LiquidRate); GasRate); GLR); Water Cut); Max Pres); Comp Power);

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 Dim Dim Dim nodeindex As Long sourcename As Variant value As Double 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 Dim Dim Dim PltReaderObj As New WELLCURVELib.PerformCurve plcfile, tempfile distance pressure

plcfile = Range(MODELFILE) tempfile = plcfile

PIPESIM

Schlumberger
Do

82

Open Link

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 a: the value of the A parameter in the Jones equation GetJonesAandBConstants ([out] a_unit: the unit string for the A parameter double * a, [out] BSTR * a_unit, [out] b: the value of the B parameter in the Jones equation double * b, [out] BSTR * b_unit) b_unit: the unit string for the B parameter COM Interface: Jones - Set Methods frate: flowrate value (double) AddFlowrateAndPwfPoint ([in] frate_unit: unit string for the flowrate value. Any of: double frate, [in] BSTR frate_unit, STB/d, sm3/d for Liquid Rates OR: mmscf/d mscf/d, [in] double pwf, [in] BSTR pwf_unit) 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. ftype: fluid type, type_liquid = 0, type_gas = 1 AddFlowrateAndPwfData ([in] frate_unit: unit string for the flowrate value. Any of: short ftype, [in] BSTR frate_unit, [in] STB/d, sm3/d for Liquid Rates OR: mmscf/d mscf/d, BSTR pwf_unit, [in] BSTR Legend, scf/d, mmsm3/d, msm3/d, sm3/d for gas rates [in] VARIANT * vData, [in] const pwf_unit: unit string for the pwf value: Any of: psia unsigned long pType) 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. ftype: fluid type, type_liquid = 0, type_gas = 1 SetFluidType (/*[in]*/ short ftype) SetStaticPressure ([in] double pres, Pres: static pressure value UnitStr: units for the pressure value. Any of: psia psig, [in] BSTR unitStr) bara, barg, atma, atmg, kPa a, kPa g, kg/cm2 a, kg/cm2 g val: the A parameter in the Jones equation SetJonesAConstant ([in] double unitSystem: 0: val is in default Eng : psi/(STB/d)^2 val, [in] short unitSystem) (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
SetJonesBConstant ([in] double val, [in] short unitSystem)

84

Open Link

SetJonesMeasuredAConstant ([in] double val, [in] short unitSystem)

SetJonesMeasuredBConstant ([in] double val, [in] short unitSystem)

SetUnitSystem ([in] long unitSystem) COM Interface: Jones - Operations DoCalculateConstants ()

val: the B parameter in the Jones equation 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 val: the A parameter in the Jones equation 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 val: the B parameter in the Jones equation 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 unitSystem: 0: values will be displayed in default Engineering units; 1: SI units Calculates the A and B parameters based on the given data: static reservoir pressure and {pwf, flowrate} points Displays the IPR COM graphical interface

ShowInflowPerformanceDlg () 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 JonesObj.AddFlowrateAndPwfPoint JonesObj.AddFlowrateAndPwfPoint JonesObj.AddFlowrateAndPwfPoint

10.0, 28.0, 30.0, 25.0,

'mmscf/d', 'mmscf/d', 'mmscf/d', 'mmscf/d',

3600, 2400, 2100, 1600,

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

PIPESIM

Schlumberger
GetUnitStrings [in] BSTR quantity name, [out] VARIANT * pVar GetUnknownValue [out, retval] double *pVal ImportUnitFile [in] BSTR filename

86

Open Link

Returns an array of unit strings defined for the given quantity. Returns PIPESIMs definition of unset or unknown value. Imports a saved units file (saved by default with a .unf extension) Gets/sets unit class name Sets a Value in the specified unit string Returns a value in the units corresponding to pUnit

IReal Interface UnitClass string SetRealValue [in] double Value, [in] BSTR Unit GetRealVal [out] double * pValue, [out] BSTR * pUnit SetSelectedUnit [in] BSTR UnitStr, [out, retval] VARIANT_BOOL GetSelectedUnit [out, retval] BSTR * UnitStr GetDefEngValue [out, retval] double * Val GetStrictSIValue GetUserValue SetStrictSIValue

Selects the given unit string

Returns the selected unit string Returns the value in default engineering units Returns the value in strict SI units Returns the value in user selected units Sets a Value in strict SI units

PIPESIM

Schlumberger

87

Open Link

Defined constants and strings


Object Type Identifiers
Object ID 1 2 3 4 5 6 7 8 30 31 Object ID 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 32 33 34 Object Type n_FOLD
n_SOURCE

Description (network folder) (network source) (network sink) (network junction) (network branch) (text object) (network production well) (network injection well) (network reinjector) (network well connector) Description (single branch source) (Vertical Comp.) (Horizontal Comp.) (Flowline) (Riser) (Zero length connector) (Tubing) (generic node) (choke) (compressor) (expander) (heat exchanger) (centrifugal pump) (multiphase booster) (injection point) (separator) (report tool) (adder/multiplier) (nodal analysis point) (engine keyword tool) (SSSV, tubing sub-component) (Gas Lift valve, subcomponent) (Generic equipment type)

n_SINK n_JUNC n_BRANCH n_TEXT n_PRODWELL n_INJWELL n_REINJECTOR n_WELLCONNECTOR Object Type n_PINTSOURCE n_PINTVERTCOMP n_PINTHORCOMP n_FLOWLINE n_RISER n_CONNECTOR n_TUBING n_NODE n_CHOKE n_COMPRESSOR n_EXPANDER n_HEATX n_PUMP n_BOOSTER n_INJECTOR n_SEPARATOR n_REPORT n_ADDMULT n_NAPOINT n_EKT n_SSSV n_GLValve n_BLACKBOX

Object Properties
Vertical Completion objects properties Common properties Property name PRESSURE TEMPERATURE IPRTYPE Description Static reservoir pressure Reservoir temperature Completion model type (see IPR Types (Vertical))

PIPESIM

Schlumberger
Well PI specific properties Property name WELLPI FLUIDTYPE WELLPI GASPI WELLPI LIQPI WELLPI NONLINEARCORRECTION Vogels Equation specific properties Property name VOGEL AOFP VOGEL N Fetkovitchs Equation specific properties Property name FETKOVITCH AOFP FETKOVITCH N Joness Equation specific properties Property name JONES FLUIDTYPE (see Fluid Types) JONES GASA JONES GASB JONES LIQA JONES LIQB BackPressure Equation specific properties Property name BACKPRESSURE C BACKPRESSURE N Pseudo Steady State specific properties Property name PSEUDOSS IPRBASIS PSEUDOSS USEPSEUDOPRES PSEUDOSS VOGEL PSEUDOSS THICKNESS PSEUDOSS WELLBOREID PSEUDOSS PERMEABILITY PSEUDOSS DEFRADIUS PSEUDOSS DRAINRADIUS PSEUDOSS RESAREA PSEUDOSS SHAPEFACTOR PSEUDOSS SKIN PSEUDOSS RATESKIN GAS PSEUDOSS RATESKIN LIQ PSEUDOSS CALCSKIN PSEUDOSS CALCRATESKIN PSEUDOSS COMPOPTIONS PSEUDOSS DAMAGEDID PSEUDOSS DAMAGEDPERM PSEUDOSS COMPACTEDID PSEUDOSS COMPACTEDPERM PSEUDOSS GRAVELPERM PSEUDOSS GRAVELTUNNEL PSEUDOSS GRAVELCASINGID PSEUDOSS GRAVELSCREENSZ

88

Open Link

Description Fluid type for the model (see Fluid Types) Gas PI Liquid PI Use Vogel below bubble point (for liquid) Description Absolute Open Flow Potential Vogel coefficient Description Open Flow Potential n exponent Description Fluid type for the model (see Fluid Types) A (turb) coefficient for Gas B (lam) coefficient for Gas A (turb) coefficient for Liquid B (lam) coefficient for Liquid Description Constant C Slope n Description Fluid type for the model (see Fluid Types) Use pseudo pressure method (for gas) Use Vogel below bubble point (for liquid) Reservoir thickness Wellbore diameter Reservoir permeability Use Drainage radius (if set) Drainage radius Reservoir area Shape factor Mechanical skin Rate dependent skin for gas Rate dependent skin for liquid Calculate Mechanical skin (if set) Calculate Rate dependent skin (if set) Completion options type Damaged zone diameter Damaged zone permeability Compacted zone diameter Compacted zone permeability Gravel pack permeability Gravel pack tunnel length Gravel pack casing ID Gravel pack screen diameter PIPESIM

Schlumberger
PSEUDOSS COMPVERTPERM PSEUDOSS COMPINTERVAL PSEUDOSS COMPDEVIATION PSEUDOSS PERFSKINMETHOD PSEUDOSS PERFID PSEUDOSS PERFLENGTH PSEUDOSS PERFSHOTDENSITY PSEUDOSS PERFPHASEANG PSEUDOSS FPSKINMETHOD PSEUDOSS FPFRACHALFLEN PSEUDOSS FPFRACWIDTH PSEUDOSS FPPROPPERM PSEUDOSS FPCOND PSEUDOSS FPFACESKINCALC PSEUDOSS FPDAMAGEDEPTH PSEUDOSS FPDAMPERM PSEUDOSS FPCHOKESKINCALC PSEUDOSS FPCHOKELENGTH PSEUDOSS FPCHOKEPERM PSEUDOSS DZSKINCALC PSEUDOSS GPSKINCALC PSEUDOSS PFSKINCALC PSEUDOSS PPDSKINCALC PSEUDOSS FPSKINCALC Forchheimers Equation specific properties Property name FORCH A FORCH F Hydraulic Fracture specific properties Property name HYDFRACT IPRBASIS HYDFRACT VOGEL HYDFRACT PERMEABILITY HYDFRACT THICKNESS HYDFRACT DRAINRADIUS HYDFRACT WELLBOREID HYDFRACT FRACTLENGTH HYDFRACT FRACTPERM HYDFRACT FRACTWIDTH HYDFRACT TRANSIENT HYDFRACT TIME HYDFRACT POROSITY HYDFRACT COMPRESS Transient specific properties Property name TRANSIENTIPR IPRBASIS TRANSIENTIPR USEPSEUDOPRES TRANSIENTIPR VOGEL TRANSIENTIPR PERMEABILITY

89

Open Link
Completion vertical permeability Completion open interval Completion deviation Perforation skin method (0 for McLeod, 1 for Karakas/Tariq) Perforation diameter Depth of penetration Perforation density Phase angle FracPack skin method (0 for Fracture properties, 1 for conductivity) Fracture half length Fracture width Fracture proppant permeability FracPack conductivity Include Frac Face skin (if set) Frac Face Depth of damage Frac Face Damage permeability Include Choke Fracture skin (if set) Choke length Frac choke permeability Include damaged zone skin (if set) Include gravel pack skin (if set) Include perforation skin (if set) Include partial penetration/deviation skin (if set) Include FracPack skin (if set) Description A (lam) coefficient F (turb) coefficient Description Fluid type for the model (see Fluid Types) Use Vogel below bubble point (for liquid) Reservoir permeability Reservoir thickness Drainage radius Wellbore diameter Fracture half length Fracture permeability Fracture width Use transient parameters (if set) Time Porosity Total compressibility Description Fluid type for the model (see Fluid Types) Use pseudo pressure method (for gas) Use Vogel below bubble point (for liquid) Reservoir permeability

PIPESIM

Schlumberger
TRANSIENTIPR THICKNESS TRANSIENTIPR DRAINRADIUS TRANSIENTIPR WELLBOREID TRANSIENTIPR TIME TRANSIENTIPR POROSITY TRANSIENTIPR COMPRESS TRANSIENTIPR SKIN TRANSIENTIPR RATESKIN GAS TRANSIENTIPR RATESKIN LIQ TRANSIENTIPR CALCSKIN TRANSIENTIPR CALCRATESKIN TRANSIENTIPR COMPOPTIONS TRANSIENTIPR DAMAGEDID TRANSIENTIPR DAMAGEDPERM TRANSIENTIPR COMPACTEDID TRANSIENTIPR COMPACTEDPERM TRANSIENTIPR GRAVELPERM TRANSIENTIPR GRAVELTUNNEL TRANSIENTIPR GRAVELCASINGID TRANSIENTIPR GRAVELSCREENSZ TRANSIENTIPR COMPDEVIATION TRANSIENTIPR PERFSKINMETHOD TRANSIENTIPR COMPINTERVAL TRANSIENTIPR COMPVERTPERM TRANSIENTIPR PERFID TRANSIENTIPR PERFLENGTH TRANSIENTIPR PERFSHOTDENSITY TRANSIENTIPR PERFPHASEANG TRANSIENTIPR DZSKINCALC TRANSIENTIPR GPSKINCALC TRANSIENTIPR PFSKINCALC TRANSIENTIPR PPDSKINCALC FCV properties Property name FCV VALVETYPE FCV GENERICVALVETYPE FCV CHOKEEQUATION FCV EQCHOKEARIA FCV MAXLIQRATE FCV MAXGASRATE FCV LIQCOEFF FCV GASCOEFF FCV PRESSDROP FCV MANUFACTURER FCV TYPE FCV PARTNUMBER FCV VALVEPOSITION FCV VALVEPERSENTOPEN

90

Open Link
Reservoir thickness Drainage radius Wellbore diameter Time Porosity Total compressibility Mechanical skin Rate dependent skin for gas Rate dependent skin for liquid Calculate Mechanical skin (if set) Calculate Rate dependent skin (if set) Completion options type Damaged zone diameter Damaged zone permeability Compacted zone diameter Compacted zone permeability Gravel pack permeability Gravel pack tunnel length Gravel pack casing ID Gravel pack screen diameter Completion deviation Perforation skin method (0 for McLeod, 1 for Karakas/Tariq) Completion open interval Completion vertical permeability Perforation diameter Depth of penetration Perforation density Phase angle Include damaged zone skin (if set) Include gravel pack skin (if set) Include perforation skin (if set) Include partial penetration/deviation skin (if set) Description FCV type: 0 generic, 1-specific (manufactured) Generic FCV type: 0 equivalent choke area, 1 maximum rate through valve Gas choke equation: 0 mechanistic Equivalent choke area Maximum liquid rate through valve Maximum gas rate through valve Liquid flow coefficient Gas flow coefficient Pressure drop ratio factor FCV manufacturer FCV type (munufacturers specific) FCV partnumber Valve postion Valve percent open

PIPESIM

Schlumberger

91

Open Link

Tubing objects properties


Common properties Property name ACTIVATE TUBING MODEL LIFT TYPE KICKOFF ANGLE KICKOFF TVD PERFS MD PERFS TEMPERATURE PERFS TVD SURFACE TEMPERATURE SURFACE TVD COILED TUB MD COILED TUB RATE OPTION Description Make tubing active Tubing model (0: simple, 1 detailed) Artificial Lift type (0: Gas Lift, 1: ESP) Kick Off angle Kick Off TVD Perforation MD Reservoir Temperature Perforation TVD Surface temperature Surface TVD Coiled tubing bottom MD Coiled tubing rate option (0 for gas rate, 1 for GLR) Coiled tubing gas rate Coiled tubing GLR Coiled tubing specific gravity Coiled tubing ID Coiled tubing gas rate surface pressure Coiled tubing OD

COILED TUB RATE COILED TUB GLR COILED TUB SPECIFIC GRAVITY COILED TUB ID COILED TUB SURFACE PRESSURE COILED TUB OD Tubing sub-object properties (accessed by GetPropertyValAtObjectIndex& SetPropertyValAtObjectIndex methods) Property name Description CHOKE CHOKE MD BEAN SIZE Property name PUMP ESP MD ESP STAGES ESP SPEED ESP MANUFACTURER ESP MODEL ESP EFFICIENCY ESP GASSEPARATOR ESP SEPEFFICIENCY ESP MD NODE ESP STAGES NODE ESP SPEED NODE ESP MANUFACTURER NODE ESP MODEL NODE ESP EFFICIENCY NODE ESP GASSEPARATOR NODE ESP SEPEFFICIENCY NODE Choke MD Bean size Description

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

PIPESIM

Schlumberger
Property name INJECTOR GAS LIFT RATE OPTION GAS LIFT RATE GAS LIFT GLR GAS LIFT MD GAS LIFT PORT DIAMETER GAS LIFT PVTFILE GAS LIFT PVTTYPE

92

Open Link
Description Gas lift rate option (0 for gas rate, 1 for GLR) (simple profile) Gas lift gas rate (simple profile) Gas lift tubing GLR (simple profile) Gas lift MD (simple profile) Gas lift port diameter (simple profile) Composition file name (simple profile) Composition type (0 for local composition, 1 for local PVT, 2 for global PVT, 3 for local MFL) (simple profile) Gas lift specific gravity (simple profile) Surface pressure (simple profile) Surface temperature (simple profile) Same as GAS LIFT RATE OPTION but for detailed profile Same as GAS LIFT RATE but for detailed profile Same as GAS LIFT GLR but for detailed profile Same as GAS LIFT MD but for detailed profile Same as GAS LIFT PORT DIAMETER but for detailed profile Same as GAS LIFT PVTFILE but for detailed profile Same as GAS LIFT PVTTYPE but for detailed profile Same as GAS LIFT SPECIFIC GRAVITY but for detailed profile Same as GAS LIFT SURFACE PRESSURE but for detailed profile Same as GAS LIFT SURFACE TEMPERATURE but for detailed profile Description Separator MD Efficiency Type (see Separator Types) Description SSSV MD (simple profile) SSSV ID (simple profile) Same as SSSV MD but for detailed profile Same as SSSV ID but for detailed profile Description Valve MD Valve Ab

GAS LIFT SPECIFIC GRAVITY GAS LIFT SURFACE PRESSURE GAS LIFT SURFACE TEMPERATURE GAS LIFT RATE OPTION NODE GAS LIFT RATE NODE GAS LIFT GLR NODE GAS LIFT MD NODE GAS LIFT PORT DIAMETER NODE GAS LIFT PVTFILE NODE GAS LIFT PVTTYPE NODE GAS LIFT SPECIFIC GRAVITY NODE GAS LIFT SURFACE PRESSURE NODE GAS LIFT SURFACE TEMPERATURE NODE

Property name SEPARATOR SEPARATOR MD EFFICIENCY TYPE Property name SSSV SSSV MD SSSV ID SSSV MD NODE SSSV ID NODE Property name GLValve VALVE MD VALVE AB

PIPESIM

Schlumberger
VALVE AP VALVE CHOKESIZE VALVE CV VALVE PORTSIZE VALVE PTRO VALVE MANUF VALVE SERIES VALVE PORTNAME VALVE TYPE VALVE DPFO Property name Tubing (pipe section) PIPE AMB TEMPERATURE PIPE FLOWTYPE PIPE ID PIPE MD PIPE OD PIPE ROUGHNESS PIPE WT PIPE AMB TEMPERATURE NODE PIPE FLOWTYPE NODE PIPE ID NODE PIPE MD NODE PIPE OD NODE PIPE ROUGHNESS NODE PIPE WT NODE

93 Valve Ap Choke size Valve Cv Port size Valve Ptro Manufacturer name Series name Port name Valve type Valve Dpfo Description

Open Link

Pipe ambient temperature (simple profile) Flow type (see Pipe Flow Types) (simple profile) Pipe ID (simple profile) Pipe MD (simple profile) Pipe OD (simple profile) Pipe roughness (simple profile) Pipe wall thickness (simple profile) Same as PIPE AMB TEMPERATURE but for detailed profile Same as PIPE FLOWTYPE but for detailed profile Same as PIPE ID but for detailed profile Same as PIPE MD but for detailed profile Same as PIPE OD but for detailed profile Same as PIPE ROUGHNESS but for detailed profile Same as PIPE WT but for detailed profile Description No artificial lift Gas lift injection ESP Description None Open hole Perforated Gravel packed and perforated Open hole gravel pack Frac pack Description Well PI Vogel Fetkovitch Jones

Artificial Lift
Lift Value 0 1 2

Completion Options
Type Value 0 1 2 3 4 5

IPR Types (Vertical)


Type Value 0 1 2 3

PIPESIM

Schlumberger
4 5 6 7 8

94 BackPressure PseudoSteadyState Forchheimer Hydraulic Fracture Transient Description Joshi (Oil) Joshi (Gas) Babu & Odeh (Oil) Babu & Odeh (Gas) Distributed PI Description Distributed PI Single Point PI Description Liquid Rate Gas Rate Mass Rate Description Tubing Annular Tubing+Annular Description GLR GOR LGR OGR Description Liquid Gas Water Operation Name

Open Link

IPR Types (Horizontal)


Type Value 0 1 2 3 4

IPR Options (Horizontal)


Type Value 0 1

Fluid Types
Type Value 0 1 2

Pipe Flow Types


Type Value 0 1 2

Rate Types
Type Value 0 1 2 3

Separator Types
Type Value 0 1 2

Single Branch Operations


Operation Value -1 0 1 2 3 4 5 No Operation System Analysis Pressure and Temp Profile Nodal Analysis Injection Gas Vs Casing Head Pressure Horizontal Well Performance Reservoir Tables

PIPESIM

Schlumberger
6 7 8 9 10 11 12 13 14

95

Open Link
Artificial Lift Flow Correlation Profile Match (Reserved) Wax Deposition Well Performance Curves Gas Lift - Diagnostics Gas Lift - Deepest Injection Point Gas Lift - Lift Gas Response Gas Lift - Bracketing

PIPESIM

Schlumberger

96

Open Link

Unit System
Quantity Name ADIM UNITLESS AGASRATE Class Name UNITLESS ACFM *, ft3/min, acm/s ^, m3/s!, m3/min, bbl/min, bbl/d, m3/d , in2 *, mm2 ^, m2 ! , acres ft2 *. m2 ^!, acres, mi2, ha, km2 1/psia *, 1/bara ^, 1/Pa ! Btu/hr/ft/F *, W/m/K !^ Psi *, Bar ^, atm, kPa, kg/cm2, Pa! F *, C! ^, K, R, lb/ft3 *, kg/m3! ^, g/cc, Mmscf/d/psi2/ft *, mmsm3/d/bar2/m ^, msm3/d/kPa2/m, sm3/s/Pa2/m! STB/d/psi/ft *, sm3/d/bar/m ^, sm3/d/kPa/m, sm3/s/Pa/m! Btu/lb *, J/g ^, J/kg! Btu/lb/F *, J/g/K ^, J/kg/K! scf/bbl *, sm3/m3 ^! % *! ^ fract., Mmscf/d/psi2 *, mmscf/d/kPa2, mmsm3/d/bar2 ^, msm3/d/kPa2, 1.E4sm3/d/MPa2, m3/s/Pa2! Defined Unit Names (* def.Engineering, ^ def.SI, ! strict SI)

AREA

AREA

AREAL COMPRESS COMPRESSIBILITY CONDUCTIVITY THERMALCOUCTIVITY DELTAP PRESSUREDROP DELTAT DENSITY

AREA EARTH SURFACE COMPRESSIBILITY

THERMAL CONDUCTIVITY PRESSURE (DELTA) TEMPERATURE (DELTA) DENSITY LIQUID

DISTGASPI DISTRIBUTEDGASPI

DISTLIQPI DISTRIBUTEDLIQPI

ENTHALPY

SPECIFIC PRODUCTIVITY INDEX (GAS PER LENGTH) SPECIFIC PRODUCTIVITY INDEX (LIQ PER LENGTH) ENERGY PER MASS (ENTHALPY) SPECIFIC ENTROPY STD VOLUME PER VOLUME (GLR) RATIO (%) SPECIFIC PRODUCTIVITY INDEX (GAS)

ENTROPY

FLOWGLRATIO FRACTION GASPI

PIPESIM

Schlumberger
GASRATE

97 STD VOLUME GAS RATE

Open Link
Mmscf/d *, Mscf/d, scf/d, mmsm3/d ^, msm3/d, sm3/d, 1.E3sm3/d, 1.E4sm3/d, sm3/s! Mmcf/d *, mcf/d, cf/d, mmm3/d ^, mm3/d, m3/d, 1.E3m3/d, 1.E4m3/d, m3/s! 1/mmscf/d *, 1/mscf/d, 1/scf/d, 1/mmsm3/d, 1/msm3/d, 1/sm3/d, 1/1.E3sm3/d, 1/1.E4sm3/d, 1/sm3/s! Scf/STB *, sm3/sm3! ^ ft-lbf/lbm *, kJ/kg ^, J/kg! (psi/mmscf/d)^2 *, (bar/mmsm3/d)^2 ^, (Pa/sm3/s)^2! (bar/msm3/d)^2 psi2/mmscf/d *, bar2/mmsm3/d ^, Pa2/sm3/s! bar2/msm3/d psi/(STB/d)^2 *, bar/(sm3/d)^2 ^, Pa/(sm3/s)^2! psi/STB/d *, bar/sm3/d ^, Pa/sm3/s! Inches *, ft, miles, mm ^, cm, m!, km, 1/64in, Ft *, Miles, m! ^, km, STB/d/psi *, STB/d/kPa, sm3/d/bar ^, sm3/d/kPa, sm3/d/MPa, sm3/s/Pa! STB/d *, sm3/d ^, sm3/s! bbl/d *, m3/d ^, m3/s! 1/STB/d, 1/sm3/d, 1/sm3/s

GASRATE(FLOWING)

GASRATERECIP

GOR GLR HEAD COMPRESSORHEAD JONESGASA

FLOW RATE VOLUME BASIS (GAS) STD VOLUME GAS RATE (RECIPROCAL) VOLUME PER VOLUME (GLR) ENERGY PER MASS (HEAD) (JONES A GAS)

JONESGASB

(JONES B GAS)

JONESLIQA

(JONES A LIQ)

JONESLIQB

(JONES B LIQ)

LENGTH DIAMETER, ID, OD, WT, LENGTH(SHORT) LENGTHL LENGTH(LONG) LIQPI

LENGTH SHORTRANGE LENGTH MIDRANGE SPECIFIC PRODUCTIVITY INDEX (LIQ) STD VOLUME LIQUID RATE FLOWRATE VOLUME BASIS (LIQ) STD VOLUME LIQUID RATE (RECIPROCAL) MASS FLOWRATE MASS BASIS SPECIFIC VOLUME MOLE VOLUME PER VOLUME (LGR)

LIQRATE

LIQRATE(FLOWING)

LIQRATERECIP

MASS MASSRATE MOLARVOLUME OGR LGR

Lb *, Kg! ^ lb/s *, lb/h, kg/s! ^, kg/h, ft3/mol *, m3/mol! ^ STB/mmscf *, sm3/mmsm3 ^, sm3/msm3, sm3/1.E4sm3, m3/E3m3, sm3/sm3!

PIPESIM

Schlumberger
PERMEABILITY PERMEABILITY

98

Open Link
Md *^, Darcy, nm2, M2 ! Hp *, KW ^, Btu/s, kcal/s, Btu/h, kcal/h, W! Psia *, Psig, bara ^, barg, atma, atmg, kPa a, kPa g, MPa a, MPa g, kg/cm2 a, kg/cm2 g, Pa a!, Pa g, psi/ft *, bar/m ^, atm/m, kPa/m, kg/cm2, Pa/m! Hz *! ^ Rpm, Shots/ft *, Shots/m! ^ Dyne/cm *, N/m! ^ F *, C! ^, K, R, Hr *^, Min, s!, days, years Btu/hr/ft2/F *, W/m2/K! ^

POWER

POWER

PRESSURE

PRESSURE

PRESSUREGRAD PRESSUREGRADIENT ROTVELOCITY FREQUENCY SHOTS SURFTENSION SURFACETENSION TEMPERATURE TIME U HEATTRANSFERCOEFFI CIENT VELOCITY

PRESSURE GRADIENT FREQUENCY PER LENGTH SURFACE TENSION TEMPERATURE TIME HEAT TRANSFER COEFFICIENT 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

También podría gustarte