+ All Categories
Home > Documents > Pipesim Manual

Pipesim Manual

Date post: 31-Oct-2015
Category:
Upload: ivanovich-yerson-medrano-chavez
View: 1,342 times
Download: 45 times
Share this document with a friend
Popular Tags:

of 103

Transcript
  • PIPESIM

    Open Link

  • Schlumberger 2 Open Link

    Copyright 2008 Schlumberger. All rights reserved.

    No part of this manual may be reproduced, stored in a retrieval system, or translated in any form or by any means, electronic or mechanical, including photocopying and recording, without the prior written permission of Schlumberger Information Solutions, 5599 San Felipe, Suite 1700, Houston, TX 77056-

    2722, USA.

    Use of this product is governed by the License Agreement. Schlumberger makes no warranties, express, implied, or statutory, with respect to the product described herein and disclaims without limitation any

    warranties of merchantability or fitness for a particular purpose. Schlumberger reserves the right to revise the information in this manual at any time without notice.

    PIPESIM

  • Schlumberger 3 Open Link

    Table of Contents Open Link Reference Manual .............................................................................................................................. 5

    Overview ................................................................................................................................................... 5 Modules and Interfaces ........................................................................................................................... 6

    Quick Start Tutorial .............................................................................................................................................. 7 Loading and running an existing model ................................................................................................ 7 Getting results .......................................................................................................................................... 9 Changing BlackOil fluid parameters ...................................................................................................... 9 Changing a choke property ..................................................................................................................... 9 Saving the changes................................................................................................................................... 9

    Case Study 1 Building a Well Model from Excel .......................................................................................... 11 Problem Outline ..................................................................................................................................... 11 Requirements.......................................................................................................................................... 11 Procedure................................................................................................................................................ 11 Step by step tutorial............................................................................................................................... 11

    Case Study 2 - Nodal Analysis............................................................................................................................ 21 Problem Outline ..................................................................................................................................... 21 Requirements.......................................................................................................................................... 21 Procedure................................................................................................................................................ 21 Step by Step Tutorial ............................................................................................................................. 21

    Modules and Interfaces ...................................................................................................................................... 27 ISingleBranchModel Interface.............................................................................................................. 27 IObjectProperties Interface .................................................................................................................. 31 ITubing Interface.................................................................................................................................... 32 IVertCompObj Interface ........................................................................................................................ 34 IFlowlineObj Interface .......................................................................................................................... 35 IHeatTransfer Interface......................................................................................................................... 35 IFluid Interface....................................................................................................................................... 36 IProjectInfo Interface ............................................................................................................................ 37 IErosionCorrosion Interface................................................................................................................. 37 INetModel Interface............................................................................................................................... 38 ModelBuilder object .............................................................................................................................. 43 IBlackOil object...................................................................................................................................... 43 ISinglePointCalib object........................................................................................................................ 44 IMultiPointCalib object ......................................................................................................................... 45 IViscosityData object............................................................................................................................. 46 IThermal object ...................................................................................................................................... 47 ICompositional object ........................................................................................................................... 48 FlowCorrelations Interface................................................................................................................... 51 Single Branch Operations...................................................................................................................... 52 Systems Analysis .................................................................................................................................... 52 Pressure and Temperature Profiles ..................................................................................................... 54 Flow Correlation Matching ................................................................................................................... 55 Nodal Analysis ........................................................................................................................................ 56 Wax Deposition ...................................................................................................................................... 58 Single Branch Operations: Supporting Interfaces.............................................................................. 59 IBoundaryProps Interface..................................................................................................................... 59 IEngineOptions Interface ...................................................................................................................... 59 Gas Lift Diagnostics COM Object......................................................................................................... 59 GLWell Interface and Object................................................................................................................. 59 IGLDesign Object ................................................................................................................................... 66 IDesignParams Object ........................................................................................................................... 69 IDesignBias Object................................................................................................................................. 69 IGLValveSystem Object ......................................................................................................................... 70 Single Branch Output Reader COM ..................................................................................................... 71 PerformCurve Object............................................................................................................................. 75

    PIPESIM

  • Schlumberger 4 Open Link

    PNSReaderCOM ..................................................................................................................................... 77 Inflow Performance Calculator COM .................................................................................................. 83 Units Library ........................................................................................................................................... 85

    Defined constants and strings ........................................................................................................................... 87 Object Type Identifiers .......................................................................................................................... 87 Object Properties ................................................................................................................................... 87 Tubing objects properties .................................................................................................................... 91 Artificial Lift............................................................................................................................................ 93 Completion Options............................................................................................................................... 93 IPR Types (Vertical)............................................................................................................................... 93 IPR Types (Horizontal).......................................................................................................................... 94 IPR Options (Horizontal) ...................................................................................................................... 94 Fluid Types ............................................................................................................................................. 94 Pipe Flow Types..................................................................................................................................... 94 Rate Types............................................................................................................................................... 94 Separator Types ..................................................................................................................................... 94 Single Branch Operations...................................................................................................................... 94

    Unit System.......................................................................................................................................................... 96 Case Studies......................................................................................................................................................... 99

    Detailed explanation of routine............................................................................................................ 99

    PIPESIM

  • Schlumberger 5 Open Link

    Open Link Reference Manual Overview This guide is designed to explain how to use Open Link to interface with PIPESIM from external applications. An overview of the functionality of Open Link is provided along with the necessary interface functions and arguments. This allows you to load both network and single branch PIPESIM models, query them (equipment configuration, gas lift injection, etc.), and perform simulations. Basic Functions The functions described in this document fall into the following categories; Get functions - Get the results after a simulation or query an item for its current data value,

    such as obtaining the choke bean size. Set functions - Set a valve to be used in subsequent simulation, such as setting the reservoir

    pressure. Operation functions - Perform an operation on a model, such as running a simulation. Potential Usage The Open Link functionality could be used in the following cases: Running PIPESIM in batch mode with a number of scenarios Creating custom reports Importing production data from a database and populating the models Running PIPESIM in-conjunction with other Engineering applications. Hyprotech have already

    used this functionality to link Hysys and PIPESIM. Utilizing Open Link The Open Link functions can be called from any of the following: VBA macro. This could be written in Excel, Access, etc. Visual Basic programs. C++ programs Supported Interfaces INetModel: for network models and network operations ISingleBranchModel: for single branch models and operations Dependency MAP Open Link can be used to access PIPESIM functionality from external programs. The programs that can automate PIPESIM simulations are those that are defined as automation clients according to Microsoft standards, and in the same way, Open Link is an automation server. Typical examples of automation clients include VBA (Visual Basic for Applications) macros, which can be written from programs such as Excel or Access, C++ and Visual Basic. Open Link provides therefore an open architecture where you control and automate PIPESIM simulation models through custom programs or macros without having to manually enter the data or view the results using the graphical interface. It is assumed you are familiar with both PIPESIM and the chosen program or programming language in which the automation code is to be written. Those new to VBA are recommended to closely follow the Quick Start Tutorial and the Case Studies. The Open Link functionality is distributed with the PIPESIM installation and is included in a number of library files. The main file is Net32COM.DLL, which normally resides in the programs directory and

    provides the framework and main entry points into both networks and single branch simulation models. Net32COM.DLL must be copied to the PIPESIM programs directory and registered.

    There are other files that support Net32COM, for instance FluidModelCOM.DLL and FlowCorrelationCOM, which provide access to properties defined in the fluid models and flow correlations respectively.

    Each library file, in turn, defines at least one interface, which is a logical entry point into a well-defined area of functionality. Each interface includes a number of public access functions that set or get a specified property or just perform operations (that is run a simulation). As an example the FluidModelCOM library defines two interfaces: IBlackOil, for black oil models and ICompositional, to deal with compositional models. IBlackOil defines property functions

    PIPESIM

  • Schlumberger 6 Open Link

    such as API, Watercut or GasSG. These properties can be set (assigned) to a model prior to a simulation run or they can be get (retrieved) and copied into an Excel cell.

    The Modules and Interfaces section lists the modules and interfaces that are part of Open Link. This document contains further details of the modules and interfaces, together with some code samples. Highlighted items represent information that is new, previously unpublished or amended from the previous PIPESIM release. The present reference guide applies to the release version 2008.

    Modules and Interfaces Module Name Interfaces Remarks Net32COM.DLL INetModel

    ISingleBranchModel IObjectProperties TubingObj InjectorObj VertCompObj FlowlineObj ErosionCorrosion HeatTransfer

    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

    PSOpSystems.DLL IISystemsAnalysis IIPTProfile IICorrMatching

    Systems Analysis operation Pressure/Temp Profiles operation Flow Correlation Matching operation

    NodalOp.DLL IINodalAnal Nodal Analysis Operation FluidModelCOM.DLL IBlackOil

    ICompositional SinglePointCalib MultiPointCalib ViscosityData Thermal

    Black Oil model properties Compositional model properties BO single point calibration properties BO multipoint calibration properties BO viscosity properties BO thermal properties

    FlowCorrelationCOM.DLL CIFlowCorrelation Vertical and horizontal flow correlation properties

    UnitsCOM.DLL IUnitSystem General unit conversions GLDiagn.DLL GLWell Gas lifted well model for diagnostics WaxOp.DLL IWaxOp Wax deposition operation

    PIPESIM

  • Schlumberger 7 Open Link

    Quick Start Tutorial This quick start guide shows macro code written in VBA using Microsoft Excel. Even though each language implements its own particular syntax, the basic logic to write an Open Link code or macro will be identical. A number of case studies along with VBA code using Excel are provided under the ..\Case Studies\Open Link directory. 1. Before you start - you must let VBA know about the Open Link interfaces. To do this, click

    on Tools | References from the main menu in the VBA window. You should now see a dialog box like the one below.

    2. Scroll down the list of available references until you find the Net32COM 1.0 Type Library.

    Check the box to the left of the reference. 3. Now do the same for the FluidModelCOM 1.0 Type Library and for PNSReader 1.0 type library. 4. Click on OK to close the References window. Loading and running an existing model 1. Load the existing network model: Small Network.bpn, which is shipped with the PIPESIM

    installation and normally located in: C:\Program Files\Schlumberger\PIPESIM\Case Studies\Network Analysis\Small Network\

    If the model were opened from the PIPESIM graphical interface it would look like the picture below:

    PIPESIM

  • Schlumberger 8 Open Link

    2. Using the VisualBasic editor (you can quickly open it from Excel using the shortcut Alt+F11)

    create a variable of the type INetModel to perform the basic interaction with the network model. We will call it NetModel: Dim NetModel As New NET32COMLib.INetModel

    3. Open the model: NetModel.OpenModel C:\Program Files\Schlumberger\PIPESIM\Case Studies\Network Analysis\Small Network\Small Network.bpn

    4. Run the model (asynchronously): NetModel.RunNetwork2 False, "-B"

    The first argument, in this case False tells the calculation engine not to use a restart file and the second argument -B is an engine switch that instructs the engine to run in batch mode. For more information on engine commands please refer to the PIPESIM help. When executing this macro you should see the calculation engine running in the background. This process is run asynchronously which means that the macro will continue its execution without waiting for the simulation run to finish. If you want your macro to stop until the engine terminates in order to, say, display a result,

    then you can replace the line above by the following code: NetModel.RunNetwork2 False, "-B" bRunning = NetModel.GetIsModelRunning While bRunning = True bRunning = NetModel.GetIsModelRunning newHour = Hour(Now()) newMinute = Minute(Now()) newSecond = Second(Now()) + 1 waitTime = TimeSerial(newHour, newMinute, newSecond) Application.Wait waitTime Wend MsgBox "Finished..."

    This code will run the simulation synchronously. It starts the simulation and then waits until it is finished. It checks every one second for the engine status through a call to GetIsModelRunning. When GetIsModelRunning it returns False indicating that the simulation run is finished, the macro code displays a message box.

    PIPESIM

  • Schlumberger 9 Open Link

    Getting results We would like to display some results from the simulation. The library that reads the results file is PNSReader and we must create a variable of the type PNSCom in order to extract data from the simulation output. The public access functions available in PNSReader are detailed in PNSReaderCOM. 1. Create a PNSCom variable, lets call it results:

    Dim results As New PNSREADERLib.PNSCom 2. Read the results file. This file is located in the same directory as the model file and has the

    same file name but with the extension .pns: results.ReadPnsFile(C:\Program Files\Schlumberger\PIPESIM\Case Studies\Network Analysis\Small Network\Small Network.pns)

    3. Get the pressure and temperature at the sink Sink_1 (see model picture above) Dim index as Long Dim pressure as Double Dim temperature as Double index = results.GetNodeIndex(Sink_1) pressure = results.GetNodeVariableValue (index, "Pressure") temperature = results.GetNodeVariableValue (index, "Temperature ")

    In the same way variables such as LiquidRate, GasRate, MassRate, GLR or WaterCut can be obtained for Sink_1 or any other node in the network.

    Changing BlackOil fluid parameters So far, we have opened, run and obtained results for a network model as it was originally defined within the PIPESIM graphical interface. In this step, we will change some parameters to the opened model. Here is where the true power of Open Link starts to show, the Excel spreadsheet may define a range of values to be tested in the context of a what if scenario and multiple simulation jobs may be set up to compare results for a range of input values for one or more properties. 1. Create a BlackOil variable:

    Dim BlackOil As New FLUIDMODELCOMLib.IblackOil 2. Get the BlackOil model from the network

    Set BlackOil = NetModel.BlackOilDefault The BlackOil variable has been filled with the values defined in the blackoil model in NetModel. You can corroborate this by adding a watch with the VBA debugging tool and inspecting the different variable fields. 3. Set a Watercut value of 15%:

    BlackOil.Watercut = 15 4. Set an API value of 27.5:

    BlackOil.API = 27.5 5. Set this BlackOil with a modified watercut and API back into the network:

    NetModel.BlackOilDefault = BlackOil 6. You can now re-run the model with this new values, get the new results, display them in an

    Excel cell or plot, etc.

    Changing a choke property 1. The following piece of code sets a new value for the choke bean size in Choke which is

    defined in the single branch model that corresponds to the production well Well_1. NetModel. SetPropertyVal (Choke, Well_1, "Bean Size", 3.5, "inches")

    The above line sets bean size = 3.5 inches to Choke in Well_1. .

    Saving the changes 1. Any changes made to a single branch or network model can be saved simply by calling the

    SaveModel() function. Dim bOK as Boolean bOK = NetModel.SaveModel(C:\MyOpenLinkModels\Network.bpn)

    PIPESIM

  • Schlumberger 10 Open Link

    The argument is the full path to the file where the model will be saved. It can also be re-saved to the original model file. 2. bOK will be TRUE (1) or FALSE (0) depending on whether the save operation succeeded or

    not. As with all Open Link function calls that return a TRUE/FALSE state, a FALSE value indicates that some kind of error condition occurred and an error description can be obtained by calling GetLastError(): Dim Error as String If bOK = False Then NetModel.GetLastError Error MsgBox errorStr End If

    PIPESIM

  • Schlumberger 11 Open Link

    Case Study 1 Building a Well Model from Excel Problem Outline It is often desired to build PIPESIM well models from a corporate database. The problem can be solved by: 1. Pasting the wells data in excel. 2. Using a VBA routine containing Open Link statements to automate the Bps files creation. This case study illustrates the resolution of such a problem.

    Requirements It is assumed that the reader is familiar with the basics of building models in PIPESIM. No prior knowledge of VBA (Visual Basic For Application) is required. VBA is a programming language that is accessed from Microsoft Excel. VBA statements can be used to interact with Microsoft Applications. These statements cannot interact with PIPESIM. Open Link is the name given to a group of statements that can be used in VBA to interact with PIPESIM.

    Procedure 1. Create a Well Model Template. (That is build a well model in PIPESIM but do not fill any of

    the objects that make up the model with values). Save the well model template with the name template.bps.

    2. Organize the wells data in tabular form in Excel. 3. Write the VBA routine that will create a Bps file for each well of the spreadsheet. (The routine

    will make use of the model template.bps as will be shown further down in the text). 4. Run the routine The Bps are created and stored in a directory specified in the routine. Step by step tutorial Create a Well Model Template 1. Open PIPESIM Open a new well performance analysis window as shown below.

    2. Create the following Well Model in the opened window. 3. Save the model with the simple model description selected in both the tubing object and the

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

    PIPESIM

  • Schlumberger 12 Open Link

    4. Save the well model under the name template.bps with the following path:

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

    4. Start the table at the cell $A$4 and finish at the cell $X$7. 5. List of the 24 columns (A to X in order) (The values are given for each column):

    A: General Data:

    Index. (1,2) Field. (Field1, Field2) Well Number (435,436) Gathering Station (Man1,Man2) B: Black Oil Data:

    Gas Gravity (lbs/cu.ft gas sc) /(lbs/cu.ft air sc). (62,62) Oil API (Field1, Field2) GOR scf/bbl (800000,900000) Water Cut % (10,20) C: Completion Data:

    Pws Psia (Static pressure of the reservoir). (1800,3000) Temperature F (200,200) PI mmscf/d/psi2 (1.5053E-08,1.7427E-7) D: Tubing Data:

    Perforation MD m (2104,2104) Perforation TVD m (2104,2102) Tubing 1 MD m (2054,2052) Tubing 1 ID (2.44,2.44)

    PIPESIM

  • Schlumberger 13 Open Link

    Tubing 2 MD (Casing MD) (2104,2104) Tubing 2 ID (Casing TVD) (5.5,5.5) E: Flow line Data:

    Flow line elevation (m) (0,0) Flow line ID (3,3) Flow line Length km (4.305,1.212) F:Choke Data:

    Choke Size 1/64th. (95,95) G: Production Data:

    Gas Rate mmscf/d (0.041,1.39) Well Head Pressure psia (195,250) Pressure at the end of the flow line. psia (150,440)

    6. In cell $A$8 write the template path: D:/OpenLink/template/template.bps 7. In cell $A$9 write the path in which the Bps files are to be stored:

    D:/OpenLink/ 8. In cell $D$11 write the surface temperature: 90 F. 9. Save the current workbook under the name Openlink.xls with the following path:

    D:/OpenLink/Excel/Openlink.xls Preliminary steps 1. Enable Macros in your workbook. 2. Select the Menu tools Sub Menu Macro Security as shown below.

    PIPESIM

  • Schlumberger 14 Open Link

    The following user form should appear:

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

    Toolbox Toolbars.

    PIPESIM

  • Schlumberger 15 Open Link

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

    Design Mode Icon.

    Command Button Icon.

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

    PIPESIM

  • Schlumberger 16 Open Link

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

    7. Click on CommandButton Object Submenu Edit. You can now change the caption of the

    button CommandButton1 to: Create Well Model. 8. Open the VBA Editor Windows. As the design mode is activated, it is possible to open the VBA

    editor windows by double-clicking on the button CommandButton1. The following window should then appear: Private Sub CommandButton1_Click() End Sub

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

    References.

    PIPESIM

  • Schlumberger 17 Open Link

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

    2. Scroll down the list of available references until you find the FluidModelCOM 1.0 Type Library.

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

    PIPESIM

  • Schlumberger 18 Open Link

    PIPESIM

  • Schlumberger 19 Open Link

    PIPESIM

  • Schlumberger 20 Open Link

    Run the routine 1. Go back to Excel and select the two wells with the mouse (by highlighting the corresponding

    rows) you will have created two .bps files corresponding to the two wells of the spreadsheet. The directory Open Link will contain the two .bps Files (shown below).

    PIPESIM

  • Schlumberger 21 Open Link

    Case Study 2 - Nodal Analysis Problem Outline It is required to see if our production data is consistent with what the model predicts the flow rate should be. We will run a nodal analysis on each of the wells. The boundary conditions of the problem are the reservoir static pressure and the outlet pressure of the model (i.e. the downstream end of the flow line). The Stock tank gas flow rate at the operation point will be compared to the Gas flow rate given in the production data.

    Requirements It is assumed that the reader is familiar with the PIPESIM Nodal Analysis User Form.

    Procedure You will write a VBA-Open Link routine that uses the table built in the previous case study. The routine fills in a Nodal Analysis operation interface using the static pressure, tubing ID and Outlet Pressure stored in Excel and then assigns this Nodal Analysis operation interface to the Well Models created in Case study 1. Each of the models is then run. A Nodal Analysis plot (system plot_.plt) is produced for each well. You can then check on the graphs if the stock tank flow rates at the operation points are consistent with the production data.

    Step by Step Tutorial 1. Open the Excel File (OpenLink.xls)

    D:/OpenLink/Excel/Openlink.xls 2. Insert a second button in the Spreadsheet. This is done using the control toolbox as in Case

    Study 1. The default name of the button will be CommandButton2.

    3. Open the VBA editor. This is done as in Case Study 1 by double clicking on the button

    CommandButton2. The code written for the previous case study will be visible. Private Sub CommandButton2_Click() End Sub

    PIPESIM

  • Schlumberger 22 Open Link

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

    Write the VBA routine using Open Link statements 1. Write the routine: The workings of the routine are explained in Case Studies.

    PIPESIM

  • Schlumberger 23 Open Link

    PIPESIM

  • Schlumberger 24 Open Link

    PIPESIM

  • Schlumberger 25 Open Link

    Run the routine 1. Go back to Excel and select the two wells (by highlighting the corresponding rows). 2. Press the button CommandButton_2. This runs a nodal analysis on the two .bps files

    produced in Case Study 1. The contents of folder Open Link after having run the routine is shown below:

    . plt Files.

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

    .

    Plot of Man1_435

    PIPESIM

  • Schlumberger 26 Open Link

    Plot of Man2_436

    PIPESIM

  • Schlumberger 27 Open Link

    Modules and Interfaces NOTE: 1. Values returned as -7777 mean 'UNSET' or could not calculate do to missing data or has not

    been calculated. 2. For all modules and interfaces, where applicable, required methods in are shown in RED and

    those conditionally required in GREEN.

    ISingleBranchModel Interface ISingleBranchModel object - Get Methods GetNameList (ObjectType As Long,

    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

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

    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

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

    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

    GetStartBoundaryObject (ObjectType As Long, ObjectName As String)

    Returns the ObjectType (See GetNameList ()) and its name of the upstream-most object in the single branch model.

    PIPESIM

  • Schlumberger 28 Open Link

    GetCountObjectsInProfile (Count As Long)

    Returns the number of objects in the single branch model

    GetObjectAtIndex (Index As Long, ObjectType As Long, ObjectName As String)

    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.

    GetLastError (ErrorStr As String) Returns the last error message produced by the interface.

    GetIsModelRunning () As Boolean Returns Boolean value True if the simulation process is active

    GetOperationInterface (pIOperation As Object)

    Returns the operation object

    GetOperationType () As Long Returns Long value as the operation defined for the model. See Defined constants and strings

    GetPropertyNames (ObjectName As String, PropNames) as Long

    Returns in PropNames the list of properties defined for the object ObjectName. Returns the number of properties as functions return value

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

    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.

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

    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

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

    The function is similar to GetPropertyValAtObjectIndex but for properties defined as string

    GetPropertyType (ObjectName As String, PropName As String) As Long

    Returns the property type: UNDEFINED -1 REAL 0 (value in strict SI units) INT 1 DOUBLE 2 STR 3

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

    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)

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

    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

    PIPESIM

  • Schlumberger 29 Open Link

    ISingleBranchModel object - Set Methods SetOperationInterface (pIOperation As

    Unknown) pIOperation: The interface instance to an operation object. This function assigns the given operation to the opened single branch model

    SetOperationType (OperationType As Long)

    Sets the operation type for the single branch model. See Defined constants and strings

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

    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.

    SetPropertyStringAtObjectIndex (ObjectName As String, PropName As String, value As String, Index As Long) As Boolean

    As SetPropertyValAtObjectIndex () but for properties defined as string

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

    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.

    SetPVTFile (bstrPVTFilename As String) Sets the compositional file (.pvt) to be used as the main fluid in the simulations

    SetUnitManager (p_VarUnitManager) Sets the Unit Manager object ISingleBranchModel object - Properties BlackOil As Object Gets/sets the Black Oil fluid definition object Composition As Object Gets/sets the fluid composition object FlowCorrelation As Object Gets/sets the Flow Correlation object Fluid As FluidModel Gets/sets the FluidModel object (See

    IFlowlineObj Interface) FluidModelType As Long Gets/sets the fluid type (0: black oil, 1:

    compositional, 2: PVT file, 3: MFL file) GasLiftDesign As Object Gets/sets the Gas Lift Design object GasLiftSystemProps As Object Gets/sets the Gas Lift System Properties object ObjectProperties (ObjectName As String)

    As ProfileObj 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.

    ProjectInfo As ProjectInfo Returns the ProjectInfo object to access project specific data

    ProjectPath As String Sets full path name to the model file FieldSurvey As Object Gets/sets the FieldSurvey object ErosionCorrosion As Object Gets/sets the ErosionCorrosion object Keywords As String Gets/sets the additional engine keywords

    PIPESIM

  • Schlumberger 30 Open Link

    ISingleBranchModel object - Operations ExportEngineFiles () This function generates an ASCII file (.psm) in the

    PIPESIM engine keyword language that corresponds to the opened model. This file can then be used with PIPESIM expert mode.

    ExportEngineFiles2 (operationfile As String) As String

    In addition to ExportEngineFiles (), this function returns the full pathname to the exported file (.psm) and its associated operation file (.inc)

    ExportEngineFiles3 (nExpertMode As Long)

    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

    KillSimulationProcess () Terminates the simulation process NewModel (bstrModelFileName As String,

    ProfileTypesList, ProfileNamesList) As Boolean

    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

    OpenModel (bstrModelFileName As String)

    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.

    RunSingleBranchModel (bRestart As Boolean)

    Runs the currently opened model by calling the calculation engine program as specified in the PIPESIM installation. If bRestart is True the simulation will load any previously restart files (.rst files) as its initial conditions. Return value is True for successful engine start, False otherwise.

    RunSingleBranchModel2 (bRestart As Boolean, EngSwitches As String, DynamicPlot As Boolean)

    Similar to SetOperationInterface, it also accepts one or more switches to be passed to the simulation engine and turns dynamic plotting on/off.

    RunSingleBranchModel3 (bRestart As Boolean, EngSwitches As String, DynamicPlot As Boolean, ExpertExtensions As Boolean)

    Similar to SetOperationInterface2, it also allows using of the Expert extensions

    SaveModel (bstrPathName As String) As Boolean

    Saves the currently opened model to a file given by bstrPathName. Function returns True if model is saved, otherwise the return value is False.

    ValidateTubingConfiguration(MaxInjTVD As Double) As Boolean

    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 31 Open Link

    SetOutpoutUnits(nUnits As Integer) As Boolean

    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 Gets a FluidModel interface object (see

    description below) ProfileObj object - Get Methods GetLastError () As String Returns an error description GetPropertyNames (PropNames) As

    Long Returns in PropNames the array of properties defined for the object. Functions return value is the number of properties

    PIPESIM

  • Schlumberger 32 Open Link

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

    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.

    ProfileObj object - Set Methods SetValue (PropName As String, value,

    UnitStr As String, Index As Long) As Boolean

    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.

    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)

    GetCountTubingSection () As Long Similar to GetCountDownholeEquipment, but specific to tubing sections

    GetDeviationSurvey_SI (Type As Long) As Variant

    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

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

    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.

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

    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

    PIPESIM

  • Schlumberger 33 Open Link

    GetGeothermalSurvey_SI (vbIsTVD As Boolean) As Variant

    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

    GetTubingSection (Index As Long, label As String) As Double

    Similar to GetDownholeEquipment, but specific to tubing sections

    GetMDatTVD_SI (tvd As Double) As Double

    Returns the md given the tvd based on the deviation survey

    GetTVDatMD_SI (md As Double) As Double

    Returns the tvd given the md based on the deviation survey

    GetInputOK (info As String) As Boolean

    Validates the tubing data and returns True if configuration is correct, otherwise the function returns False and info contains the error message

    TubingObj Object -Set Methods SetDeviationSurvey_SI (Type As

    Long, Survey) As Boolean 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).

    SetGeothermalSurvey_SI (vbIsTVD As Boolean, Survey) As Boolean

    Sets a geothermal survey to a detailed tubing model. See GetGeothermalSurvey_SI for definition of Survey and vbIsTVD.

    TubingObj Object -Properties InjectionPointFluid (Index As Long)

    As FluidModel Gets/sets the FluidModel object for the injection point at a given index. This function is only applicable for compositional models. See ISinglePointCalib object.

    RemedialCoiledTubingEnabled As Boolean

    Enables/disables Remedial Coiled Tubing option in configuration

    TubingObj Object - Operations AddDownholeEquipment (Type As

    Long, md_SI As Double, label As String) As Long

    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

    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

    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.

    PIPESIM

  • Schlumberger 34 Open Link

    AddTubingSection (BottomMD_SI As Double, label As String) As Long

    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

    ClearGasLiftValves () Removes all gas lift valves from the tubing RemoveDownholeEquipment (Type

    As Long, Index As Long) 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

    RemoveTubingSection (Index As Long)

    Similar to RemoveDownholeEquipment but applicable to tubing sections

    DisplayDialog (p_VarUnitManager, fluidtype As Integer) As Boolean

    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 Validates the flowline data and returns True if configuration is correct, otherwise the function returns False and info contains the error message

    VertCompObj Object - Set Methods SetMultipoint(value As Long) As

    Boolean Set either multipoint=1 or isochronal=0 type of IPR data table

    SetIPRFluidType(Type As Long) As Boolean

    Set fluid type for IPR: type_liquid=0, type_gas=1

    SetIPRTable_SI(QPPoints) As Boolean Sets the IPR table values. QPPoints is a 3-column array of Doubles, where first column contains Flowrate values, second column contans Pwf values and the third one contains Pws values. All values are in strict SI units

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

    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

    VertCompObj Object - Operations CalculateIPR() As Boolean

    PIPESIM

  • Schlumberger 35 Open Link

    DisplayDialog (p_VarUnitManager) As Boolean

    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 Gets/sets HeatTransfer object FlowlineObj Object - Get Methods GetInputOK (info As String) As

    Boolean Validates the flowline data and returns True if configuration is correct, otherwise the function returns False and info contains the error message

    FlowlineObj Object - Operations AddProfileNode_SI (distance As

    Double, elevation As Double, ambientT As Double, uValue As Double, label As String)

    Adds a node to the flowline detailed node description. All values must be given in strict SI units.

    ClearDetailedProfile () Deletes all nodes in the flowline detailed profile UseDetailedProfile (UseDetailed As

    Boolean) UseDetailed = True: instructs the flowline to use the detailed profile description. UseDetailed = False: use the flowlines simple description, detailed nodes will be generated automatically.

    DisplayDialog (p_VarUnitManager) As Boolean

    Function invokes flowline configuration dialog and returns True if OK button was clicked, False otherwise. Pass a Null variant as the arguments value.

    GetNodesCount () As Long Function returns a number of nodes defined in a detailed profile

    GetPipeOD (od as Double, units as String)

    Function calculates pipes OD based on coating properties

    IHeatTransfer Interface HeatTransfer Object - Properties UValueType As Long Gets/sets U Value type. Possible values are 0 for

    calculated, 1 for insulated, 2 for coated, 3 for bare in air, 4 for bare in water and 5 for user-specified

    IsIFCIncluded As Boolean Gets/sets a Boolean value for inside filem coefficient. True if IFC is included in U Value and False if it is calculated separately.

    AmbientFluidType As Long Gets/sets an ambient fluid type. 0 for air and 1 for water.

    HeatTransfer Object - Get Methods GetUValue (uVal as Double, units as

    String) Returns U Value and units string. Fails if UValueType is set to calculated

    GetPipeConductivity (dblVal as Double, units as String)

    Returns pipe conductivity value and units string. Fails if UValueType is not calculated

    GetAmbientFluidVelosity (dblVal as Double, units as String)

    Returns ambient fluid velocity value and units string. Fails if UValueType is not calculated

    GetBurialDepth (dblVal as Double, units as String)

    Returns pipe burial depth value and units string. Fails if UValueType is not calculated

    GetGroundConductivity (dblVal as Double, units as String)

    Returns ground conductivity value and units string. Fails if UValueType is not calculated

    PIPESIM

  • Schlumberger 36 Open Link

    GetCoatingData_SI (varData) Returns a pipe coating data array. First column containts layer-specific conductivity values and a second column containts layer thicknesses. Fails if UValueType is not calculated

    HeatTransfer Object - Set Methods SetUValue (uVal as Double, units as

    String) Sets U Value in specified units. Fails if UValueType is set to calculated

    SetPipeConductivity (dblVal as Double, units as String)

    Sets pipe conductivity value in specified units. Fails if UValueType is not calculated

    SetAmbientFluidVelosity (dblVal as Double, units as String)

    Sets ambient fluid velocity value in specified units. Fails if UValueType is not calculated

    SetBurialDepth (dblVal as Double, units as String)

    Sets pipe burial depth value in specified units. Fails if UValueType is not calculated

    SetGroundConductivity (dblVal as Double, units as String)

    Sets ground conductivity value in specified units. Fails if UValueType is not calculated

    SetCoatingData_SI (varData) Sets a pipe coating data. Data has to be passed as an array where first column containts layer-specific conductivity values and a second column containts layer thicknesses. Fails if UValueType is not calculated

    IFluid Interface FluidModel Object - Properties Composition As Object Accesses the ICompositional object (See

    ISinglePointCalib object) BlackOil As Object Accesses the IBlackOil object (Ref IBlackOil ) FluidModelType As Long Retrieves the fluid model type: 0: BlackOil, 1:

    Compositional, 2 PVT File, 3 MFL File OverrideValues As Boolean Sets/gets whether Wcut/GOR values are overridden

    from the values defined in the fluid model. WCutoverride_SI As Double Accesses the watercut override value GORoverride_SI As Double Accesses the GOR override value OGRoverride_SI As Double Accesses the OGR override value LGRoverride_SI As Double Accesses the LGR override value GLRoverride_SI As Double Accesses the GLR override value GORoverride_Type As Integer Accesses which GOR type is being overridden

    (0=GLR, 1=GOR, 2=LGR, 3=OGR) IsLocalFluid As Boolean Sets/gets whether the object is using a local fluid

    model CompositionType As Long Sets/gets whether the local composition is a PVT

    file or a defined PIPESIM composition or local MFL file

    FluidName As String Sets/gets a fluid name FluidModel Object - Get Methods GetInputOK (info As String) As

    Boolean Validates the fluid model data and returns True if configuration is correct, otherwise the function returns False and info contains the error message

    FluidModel Object - Operations DisplayDialog (p_VarUnitManager) As

    Boolean Function invokes fluid configuration dialog and returns True if OK button was clicked, False otherwise. Pass a Null variant as the arguments value.

    PIPESIM

  • Schlumberger 37 Open Link

    IProjectInfo Interface ProjectInfo Object - Properties Description As String Gets/sets string property User As String Gets/sets string property Job As String Gets/sets string property Company As String Gets/sets string property Manager As String Gets/sets string property Remarks As String Gets/sets string property Date As String Gets/sets string property Field As String Gets/sets string property WellNumber As String Gets/sets string property Lease As String Gets/sets string property Country As String Gets/sets string property Address As String Gets/sets string property Email As String Gets/sets string property Phone As String Gets/sets string property Fax As String Gets/sets string property IErosionCorrosion Interface ErosionCorrosion Object - Properties CalculatePH As Long Gets/sets value for Actual pH property (1

    calculate value, 0 use user-defined pH value) CorrosionEfficiency As Double Gets/sets corrosion efficiency value CorrosionModel As Long Gets/sets value for Corrosion Model property (0

    none, 1 use de Waard (1995) model ) ErosionEfficiency As Double Gets/sets erosion efficiency value ErosionModel As Long Gets/sets value for Erosion Model property (0

    API 14e model, 1- SALAMA (2000)) ErosionRate_Eng As Double Gets/sets acceptable erosion rate value ErosionVelocityConst As Double Gets/sets erosion velocity constant value GeometryConstant As Double Gets/sets geometry constant value SandGrainSize_Eng As Double Gets/sets sand grain size value SandProdRatio As Double Gets/sets sand production ratio value UserDefinedPH As Double Gets/sets user-defined pH value ProjectInfo Object Example VBA Sample Code Dim SingleBranchObj As New NET32COMLib.ISingleBranchModel Dim equipnames As Variant Dim sensvarnames As Variant Dim objref As Variant Dim count As Long 'Open the model SingleBranchObj.OpenModel C:\Program Files\Schlumberger\PIPESIM\Case Studies\Open Link\Gas Lift Performance.bps 'Export Psm file Dim ExportFile As String Dim OperationFile As String ExportFile = SingleBranchObj.ExportEngineFiles2(OperationFile) 'Get object information

    PIPESIM

  • Schlumberger 38 Open Link

    Dim count As Long Dim objtype As Long Dim objname As String SingleBranchObj.GetCountObjectsInProfile count 'Write to the spreadsheet the list of objects in the single branch model For indx = 0 To count - 1 SingleBranchObj.GetObjectAtIndex indx, objtype, objname Cells(indx + 1, 1) = objname Cells(indx + 1, 2) = objtype Next 'Get Sensitivity Information for the tubing (type = 16) with identifier Tub_1 SingleBranchObj.GetSensitivityInfo 16, Tub_1, sensvarnames, objref 'Write the list of sensitivity variables to the spreadsheet Dim name As Variant For Each name In sensvarnames r.Cells(i, 1) = name i = i + 1 Next INetModel Interface INetModel Interface - Get Methods DoesCustomKeyExists (KeyName

    as String) as Boolean Returns true if custom data has been stored against the KeyName string

    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 of: 1 - Folder 2 - Source 3 - Sink 4 - Junction 5 - Branch 6 - Text Object 7 - Production Well 8 Injection Well

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

    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

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

    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

  • Schlumberger 39 Open Link

    GetLastError (ErrorStr As String) Returns the last error message produced by the interface

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

    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

    GetBoundaryProperties_SI (ObjectName As String, Pressure As Double, Temperature As Double, Fluidrate As Double, fluidtype As Long)

    Similar to GetBoundaryProperties except that this function returns the properties in strict SI units.

    GetBoundaryBlackOil (ObjectName As String, BlackOil As Object) 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

    GetBoundaryComposition (ObjectName As String, Composition As Object) As Boolean

    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

    GetBoundaryCompositionType (ObjectName As String, Type As Long)

    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

    GetBoundaryPVTFile (ObjectName As String, PVTFilename As String) As Boolean

    Gets the PVT file used by the source with identifier ObjectName. Only applicable for Compositional/PVT models

    GetBoundaryType (ObjectName As String, Type As Long, CurveOption As Long)

    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

    GetCountObjectsInProfile (NetObjectName As String) As Long

    Returns the number of objects in the single branch model defined for NetObjectName.

    GetIsModelRunning () As Boolean Returns True if simulation is running GetPropertyNames (ObjectName As

    String, ParentName As String, PropNames) As Long

    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

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

    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

    constants and strings GetPropertyValAtObjectIndex

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

    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

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

    The function is similar to GetPropertyValAtObjectIndex () but for properties defined as string

    GetSingleBranchModel (NetObjectName As String) As ISingleBranchModel

    Returns the ISingleBranchModel object for the NetObjectName specified

    GetNamesInFolder(FolderName As String, 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. All allowed ObjectType values are described for GetNameList function

    GetNodeCooordinates(ObjectName As String, pCoordArray) As Boolean

    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

    GetConnectionInfo(pBranchArray, pSNodeArray, pENodeArray) As Boolean

    Returns the array of all branch names, the array of starting nodes and the array of ending nodes for those branches

    GetBoundaryCurveFile(ObjectName As String) As String

    Returns the offline curve file name for the specified well name

    GetCustomData(KeyName As String, pValue) As Boolean

    Returns a variant byte array of the custom data that has been stored against the supplied KeyName string

    GetCustomKeys(pKeyNameArray) As Boolean

    Returns an array of the KeyNames strings for which custom data has been stored

    GetFlowrateLimits_SI(ObjectName as String) As Variant

    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.

    INetModel Interface - Set Methods SetBoundaryBlackOil (ObjectName

    As String, BlackOil As Object) As Boolean

    Sets a BlackOil object to a given source. The function returns True in case of success and False otherwise

    SetBoundaryComposition (ObjectName As String, Composition As Object) As Boolean

    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

    SetBoundaryCurveFile (ObjectName As String, CurveFileName As String) As Boolean

    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

    PIPESIM

  • Schlumberger 41 Open Link

    object identified by ObjectName must be a Production Well.

    SetBoundaryFluidrate (ObjectName As String, Fluidtype As Long, value As Double, UnitStr As String)

    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

    SetBoundaryPressure (ObjectName As String, value As Double, UnitStr As String)

    Sets the given value in the given units as pressure boundary condition for source object ObjectName.

    SetBoundaryPVTFile (ObjectName As String, PVTFilename As String) As Boolean

    Sets a PVT file to a given source. PVTFilename must contain the full path to a PVT file

    SetBoundarySourcePQPoints (ObjectName As String, PQPoints, fluidtype As Long, PressureUnits As String, FlowrateUnits As String) As Boolean

    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.

    SetBoundaryTemperature (ObjectName As String, value As Double, UnitStr As String)

    Sets the given value in the given units as temperature boundary condition for source object ObjectName.

    SetBoundaryType (ObjectName As String, Type As Long, CurveOption As Long)

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

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

    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.

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

    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.

    SetPropertyStringAtObjectIndex (ObjectName As String, ParentName As String, PropName As String, value As String, Index As Long) As Boolean

    Similar to SetPropertyValAtObjectIndex () except that PropName is a string type property.

    SetPVTFile (bstrPVTFilename As Sets the compositional file (.pvt) to be used as the

    PIPESIM

  • Schlumberger 42 Open Link

    String) main fluid in the simulations SetSingleBranchModel

    (NetObjectName As String, filename As String) As Boolean

    Sets the underlying single branch model by way of its associated .bps file to a network object.

    SetCustomData(KeyName As String, pValue) As Boolean

    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

    SetFlowrateLimits_SI(ObjectName as String, Limits)

    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.

    INetModel Interface - Properties BlackOilDefault As Object Gets/sets the default BlackOil model to/from a

    BlackOil object CompositionDefault As Object Gets/sets the default composition to/from a

    Composition object FlowCorrelation As Object Gets/sets the flow correlation properties to/from a

    FlowCorrelation object FluidModelType As Long 0: BlackOil, 1: Compositional, 2: PVT File, 3: MFL File LocalFluid (ObjectName As String) As

    FluidModel Gets/sets the Fluid object for the specified object (ObjectName)

    ModelFileName As String Returns the file path of the current model ModelBuilder As ModelBuilder Returns a ModelBuilder object - see ModelBuilder ProjectInfo As ProjectInfo Get the ProjectInfo object to access project specific

    data ErosionCorrosion As Object Gets/sets the ErosionCorrosion object UseNetErCorrSettings As Long Gets/sets the flag value to use network erosion &

    corrosion settings over local branches settings (if = 1) or to use local settings overwise

    BottomKeywords As String Gets/sets the network engine keywords to be added at bottom of tnt file

    TopKeywords As String Gets/sets the network engine keywords to be added on top of tnt file

    AppVersion As String Gets the version of PIPESIM INetModel Interface - Operations ExportEngineFiles () This function generates an ASCII file ( .tnt) and a

    number of ASCII files (.pst) in the PIPESIM engine keyword language that is used as input by the calculation engine. This .tnt file can then be used with PIPESIM expert mode.

    KillSimulationProcess () Terminates the simulation process OpenModel (bstrModelFileName As

    String) 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 43 Open Link

    RunNetwork (bRestart As Boolean) Runs the currently opened model by calling the calculation engine program as specified in the PIPESIM installation. If bRestart is True the simulation will load any previously restart files (.rst files) as its initial conditions.

    RunNetwork2 (bRestart As Boolean, EngSwitches As String)

    Similar to RunNetwork and also accepts one or more switches to be passed to the simulation engine.

    SaveModel (bstrPathName As String) As Boolean

    Saves the currently opened model to a file given by bstrPathName

    ResetLocalErCorrSettings() As Boolean

    Overrides all local erosion and corrosion settings with the global ones

    ModelBuilder object SetNodeCoordinates (NodeName As

    String, X As Long, Y As Long) Sets the node coordinates for node object NodeName to X, Y coordinates

    TopLeftCoordinate_X As Long Sets/returns the top left X coordinate of the graphical panel. SetNodeCoordinates values are passed in relation to TopLeftCoordinate_X and TopLeftCoordinate_Y

    TopLeftCoordinate_Y As Long As above for the Y coordinate BottomRightCoordinate_X As Long Returns the bottom right X coordinate of the

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

    String, X As Long, Y As Long) Gets the node X, Y coordinates for node object NodeName

    GetLastError () As String Returns the last error message produced by the object

    IBlackOil object IBlackOil object - Properties API As Double API value ConingEnabled As Boolean True/False ConingGasSG As Double Coning gas specific gravity ConingRateType As Long 0: liquid, 1: gas, 2: mass ConingTable_SI As Variant A 3-column array with rate, gor/glr, wcut values, use

    strict SI units GasSG As Double Black oil specific gravity GLR_SI As Double Gas/Liquid Ratio use strict SI units GOR_SI As Double Gas/Oil Ratio use strict SI units GOR_Type As Integer (0=GLR, 1=GOR, 2=LGR, 3=OGR) LGR_SI As Double Liquid/Gas Ratio use strict SI units OGR_SI As Double Oil/Gas Ratio use strict SI units SolutionGasCorrelation As Long 0 = Lasater, 1 = Standing, 2 = Vazquez and Beggs, 3 =

    Glaso, 4 = Kartoatmodjo Watercut As Double Water Cut WaterSG As Double Water specific gravity Name As String Name of the fluid Comment As String String containing the text in the comments field Calibration As Long Calibration type: 0 no calibration, 1 single point

    and 2 - multipoint SinglePointCalib As Object Single point calibration data object MultiPointCalib As Object Multipoint calibration data object

    PIPESIM

  • Schlumberger 44 Open Link

    Viscosity As Object String containing the text in the comments field ThermalData As Object String containing the text in the comments field Contaminants As Variant Array of Doubles for contaminant values in a

    following order: CO2, H2S, N2, H2 and CO IBlackOil object - Methods SetBubblePointCalibration

    (SatGas_SI As Double, Pressure_SI As Double, Temperature_SI As Double)

    Sets the bubble point data

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

    IBlackOil object - Operations SetBlob (sBlob As String) Sets data for the required fluid

    sBlob = String containing black oil information

    ISinglePointCalib object ISinglePointCalib object Get Methods GetCalibrationAtBubblePoint

    (Pressure_SI As Double, Temperature_SI As Double, SatGas_SI As Double) 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

    GetCalibrationAboveBubblePoint (OFVF As Double, Density_SI as Double, Compressibility_SI as Double, Pressure_SI As Double, Temperature_SI As Double) as Long

    Function gets calibration data above bubble point. The return value is density type: 0 for Density, 1 for OFVF or 3 for Compressibility

    GetCalibrationBelowBubblePoint (OFVF As Double, Density_SI as Double, Pressure_SI As Double, Temperature_SI As Double) as Long

    Function gets calibration data below bubble point. The return value is density type: 0 for Density or 1 for OFVF

    GetLiveOilViscBelowBubblePoint (Pressure_SI As Double, Temperature_SI As Double, LiveOilVisc_SI) as Long

    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

    GetGasViscBelowBubblePoint (Pressure_SI As Double, Temperature_SI As Double) as Double

    Function gets gas viscosity data below bubble point. The return value is gas viscosity.

    GetGasZBelowBubblePoint (GasZ as Double, Pressure_SI As Double, Temperature_SI As Double) as Long

    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.

    ISinglePointCalib object Set Methods SetCalibrationAtBubblePoint

    (SolGasCorr as Long, Pressure_SI As Double, Temperature_SI As Double, SatGas_SI As Double)

    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

    SetCalibrationAboveBubblePoint (DensType as Long, OFVF As Double, Density_SI as Double, Compressibility_SI as Double,

    Function sets calibration data above bubble point. The acceptable values for density type are: 0 for Density, 1 for OFVF or 3 for Compressibility

    PIPESIM

  • Schlumberger 45 Open Link

    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)

    Function sets calibration data above bubble point. The acceptable values for density type are: 0 for Density or 1 for OFVF

    SetLiveOilViscBelowBubblePoint (LiveOilCorr as Long, Pressure_SI As Double, Temperature_SI As Double, LiveOilVisc_SI)

    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

    SetGasViscBelowBubblePoint (Pressure_SI As Double, Temperature_SI As Double, GasVisc_SI as Double)

    Function sets gas viscosity data below bubble point.

    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 True for Oil FVF or False for Oil Density IMultiPointCalib object Get Methods GetCalibUnits (UnitsArray) Function returns an array of Strings containing units

    for Pressure, Solution Gas GOR, Oil Density, Oil Viscosity and Gas Viscosity

    GetCorrelations (CorrArray) Function returns an array of Longs containing correlations for Solution Gas, OFVF, Oil Viscosity, Gas Z factor and Gas Viscosity. Available values for each correlation are the same as for ISinglePointCalib methods

    GetTemperature (Value As Double, Units as String)

    Function returns a calibration temperature and units.

    GetCalibrationAtBubblePoint (CalibData)

    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

    GetCalibrationAboveBubblePoint (CalibData)

    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

    GetCalibrationBelowBubblePoint (CalibData)

    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

    IMultiPointCalib object Set Methods SetCalibUnits (UnitsArray) Function sets units for Pressure, Solution Gas GOR,

    Oil Density, Oil Viscosity and Gas Viscosity supplied as an array of Strings

    PIPESIM

  • Schlumberger 46 Open Link

    SetCorrelations (CorrArray) Function sets correlations for Solution Gas, OFVF, Oil Viscosity, Gas Z factor and Gas Viscosity supplied as an array of Longs. Available values for each correlation are the same as for ISinglePointCalib methods

    SetTemperature (Value As Double Units as String)

    Function sets a calibration temperature in specified units.

    SetCalibrationAtBubblePoint (CalibData)

    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

    SetCalibrationAboveBubblePoint (CalibData)

    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

    SetCalibrationBelowBubblePoint (CalibData)

    Function sets calibration data below bubble point passe


Recommended