Upload
erick-cruz
View
220
Download
1
Embed Size (px)
Citation preview
7/24/2019 Open Link Reference Manual
1/161
PIPESIM* production system analysis software
Version 2011.1
Open Link Reference Manual
7/24/2019 Open Link Reference Manual
2/161
Copyright 2011 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.
Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
3/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Contents
Overview ....................................................................................................................... 7
Modules and Interfaces .............................................................................................. 8
Quick Start Tutorial .................................................................................................... 10
Case Study 1 Building a Well Model from Excel ...................................................... 15
Problem Outline ....................................................................................................... 15
Requirements .......................................................................................................... 15
Procedure ................................................................................................................ 15
Step by step tutorial ................................................................................................. 16
Case Study 2 - Nodal Analysis .................................................................................... 28
Problem Outline ....................................................................................................... 28
Requirements .......................................................................................................... 28
Procedure ................................................................................................................ 28
Step by Step Tutorial ............................................................................................... 29
Modules and Interfaces .............................................................................................. 35
ISingleBranchModel Interface ................................................................................... 36
IObjectProperties Interface ....................................................................................... 43
ITubing Interface ..................................................................................................... 44
IVertCompObj Interface ........................................................................................... 47
IFlowlineObj Interface .............................................................................................. 48
IHeatTransfer Interface ............................................................................................ 49
IFluid Interface ........................................................................................................ 50
IProjectInfo Interface ............................................................................................... 51
IErosionCorrosion Interface ...................................................................................... 51
INetModel Interface ................................................................................................. 53
ModelBuilder object ................................................................................................. 60
IBlackOil object ........................................................................................................ 60
ISinglePointCalib object ............................................................................................ 62
IMultiPointCalib object .............................................................................................. 63
IViscosityData object ................................................................................................ 65
IThermal object ....................................................................................................... 67
Page 3
7/24/2019 Open Link Reference Manual
4/161
PIPESIMVersion2011.1OpenLinkReferenceManual
ICompositional object ............................................................................................... 68
ICompositional2 object ............................................................................................. 72
FlowCorrelations Interface ........................................................................................ 72
ICFlowCorrelations2 Interface ................................................................................... 74
Single Branch Operations ......................................................................................... 74
Systems Analysis ..................................................................................................... 74
Pressure and Temperature Profiles ............................................................................ 77
Flow Correlation Comparison .................................................................................... 79
Data Matching ......................................................................................................... 80
Nodal Analysis ......................................................................................................... 82
Wax Deposition ....................................................................................................... 85
Gas Lift Rate vs Casing Head Pressure ...................................................................... 86
Single Branch Operations: Supporting Interfaces ....................................................... 88
IBoundaryProps Interface ......................................................................................... 88
IEngineOptions Interface .......................................................................................... 89
IFactorRange Interface ............................................................................................ 89
Gas Lift Diagnostics COM Object ............................................................................... 90
GLWell Interface and Object ..................................................................................... 90
IGLDesign Object ..................................................................................................... 98
IDesignParams Object ............................................................................................ 102
IDesignBias Object ................................................................................................. 103
IGLValveSystem Object .......................................................................................... 104
Single Branch Output Reader COM .......................................................................... 106
PerformCurve Object .............................................................................................. 111
PNSReaderCOM ..................................................................................................... 114
Inflow Performance Calculator COM ........................................................................ 123
Units Library .......................................................................................................... 125
Reservoir Table ...................................................................................................... 127
Defined constants and strings .................................................................................. 132
Object Type Identifiers ........................................................................................... 132
Object Properties ................................................................................................... 133
Tubing objects properties ...................................................................................... 140
Generic Source ...................................................................................................... 147
Page 4Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
5/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Network Separator (reinjector) ............................................................................... 147
Artificial Lift ........................................................................................................... 147
Completion Options ................................................................................................ 148
IPR Types (Vertical) ............................................................................................... 149
IPR Types (Horizontal) ........................................................................................... 149
IPR Options (Horizontal) ......................................................................................... 149
Fluid Types ............................................................................................................ 149
Pipe Flow Types ..................................................................................................... 150
Rate Types ............................................................................................................ 150
Separator Types .................................................................................................... 150
Single Branch Operations ....................................................................................... 150
Equations of State ................................................................................................. 151
Viscosity Types ...................................................................................................... 151
BIP Sets ................................................................................................................ 151
Emulsion Types ..................................................................................................... 152
Case Studies ............................................................................................................. 157
Detailed explanation of routine ............................................................................... 157
Page 5
7/24/2019 Open Link Reference Manual
6/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Page 6Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
7/161
PIPESIMVersion2011.1OpenLinkReferenceManual
OverviewThisguideexplainshowtouseOpenLinktointerfacewithPIPESIMfromexternalapplications.
AnoverviewofthefunctionalityofOpenLinkisprovided,alongwiththenecessaryinterfacefunctionsand
arguments.ThisallowsyoutoloadbothnetworkandsinglebranchPIPESIMmodels,querythem
(equipmentconfiguration,
gas
lift
injection,
etc.),
and
perform
simulations.
Basic Functions
Thefunctionsdescribedinthisdocumentfallintothefollowingcategories;
Getfunctions Gettheresultsafterasimulationorqueryanitemforitscurrentdatavalue,suchas
obtainingthechokebeansize.
Setfunctions Setavalvetobeusedinsubsequentsimulation,suchassettingthereservoirpressure.
Operationfunctions Performanoperationonamodel,suchasrunningasimulation.
Potential Usage
TheOpenLinkfunctionalitycanbeusedinthefollowingcases:
RunningPIPESIMinbatchmodewithanumberofscenarios.
Creatingcustomreports.
Importingproductiondatafromadatabaseandpopulatingthemodels.
RunningPIPESIMinconjunctionwithotherEngineeringapplications.Hyprotechhavealreadyusedthis
functionalitytolinkHysysandPIPESIM.
Utilizing Open Link
TheOpenLinkfunctionscanbecalledfromanyofthefollowing:
VBAmacro.ThiscouldbewritteninExcel,Access,etc.
VisualBasicprograms.
C++programs
Supported Interfaces
INetModel:fornetworkmodelsandnetworkoperations
ISingleBranchModel:forsinglebranchmodelsandoperations
Dependency MAP
OpenLinkcanbeusedtoaccessPIPESIMfunctionalityfromexternalprograms.Theprogramsthatcan
automatePIPESIMsimulationsarethosethataredefinedasautomationclientsaccordingtoMicrosoft
standards,andinthesameway,OpenLinkisanautomationserver.Typicalexamplesofautomationclients
includeVBA(VisualBasicforApplications)macros,whichcanbewrittenfromprogramssuchasExcelor
Access,C++andVisualBasic.OpenLinkprovidesthereforeanopenarchitecturewhereyoucontroland
Page 7
7/24/2019 Open Link Reference Manual
8/161
PIPESIMVersion2011.1OpenLinkReferenceManual
automatePIPESIMsimulationmodelsthroughcustomprogramsormacroswithouthavingtomanually
enterthedataorviewtheresultsusingthegraphicalinterface. Itisassumedyouarefamiliarwithboth
PIPESIMandthechosenprogramorprogramminglanguageinwhichtheautomationcodeistobewritten.
ThosenewtoVBAarerecommendedtocloselyfollowtheQuickStartTutorialandtheCaseStudies.
TheOpenLinkfunctionalityisdistributedwiththePIPESIMinstallationandisincludedinanumberoflibrary
files.
ThemainfileisNet32COM.DLL,whichnormallyresidesintheprogramsdirectoryandprovidesthe
frameworkandmainentrypointsintobothnetworksandsinglebranchsimulationmodels.
Net32COM.DLLmustbecopiedtothePIPESIMprogramsdirectoryandregistered.
ThereareotherfilesthatsupportNet32COM,forinstanceFluidModelCOM.DLLand
FlowCorrelationCOM,whichprovideaccesstopropertiesdefinedinthefluidmodelsandflow
correlationsrespectively.
Eachlibraryfile,inturn,definesatleastoneinterface,whichisalogicalentrypointintoawelldefined
areaoffunctionality.Eachinterfaceincludesanumberofpublicaccessfunctionsthatsetorgeta
specifiedpropertyorjustperformoperations(thatisrunasimulation).Asanexamplethe
FluidModelCOM
library
defines
two
interfaces:
IBlackOil,
for
black
oil
models
and
ICompositional,
to
dealwithcompositionalmodels.IBlackOildefinespropertyfunctionssuchasAPI,WatercutorGasSG.
Thesepropertiescanbeset(assigned)toamodelpriortoasimulationrunortheycanbeget
(retrieved)andcopiedintoanExcelcell.
TheModulesandInterfacessectionliststhemodulesandinterfacesthatarepartofOpenLink.This
documentcontainsfurtherdetailsofthemodulesandinterfaces,togetherwithsomecodesamples.
Highlighteditemsrepresentinformationthatisnew,previouslyunpublishedoramendedfromtheprevious
PIPESIMrelease.Thepresentreferenceguideappliestothereleaseversion2010.
Modules and Interfaces
Module Name Interfaces Remarks
Net32COM.DLL INetModel
ISingleBranchModel
IISingleBranchModel2
IObjectProperties
TubingObj
InjectorObj
VertCompObj
FlowlineObj
ErosionCorrosion
HeatTransfer
Networkmodelsandoperations
Singlebranchmodelsandoperations
Genericequipmentproperties
Tubingspecificpropertiesandoperations
Injectorspecificproperties
Vertical
completion
specific
properties
Flowlinespecificpropertiesandoperations
Erosionandcorrosionsettings
Heattransferproperties
PSOpSystems.DLL IISystemsAnalysis
IIPTProfile
IICorrMatching
SystemsAnalysisoperation
Pressure/TempProfilesoperation
FlowCorrelationMatchingoperation
Page 8Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
9/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Module Name Interfaces Remarks
NodalOp.DLL IINodalAnal NodalAnalysisOperation
FluidModelCOM.DLL IBlackOil
ICompositional
SinglePointCalib
MultiPointCalib
ViscosityData
Thermal
BlackOilmodelproperties
Compositionalmodelproperties
BO
single
point
calibration
properties
BOmultipointcalibrationproperties
BOviscosityproperties
BOthermalproperties
FlowCorrelationCOM.
DLL
CIFlowCorrelation
ICIFlowCorrelation2
Verticalandhorizontalflowcorrelationproperties
UnitsCOM.DLL IUnitSystem Generalunitconversions
GLDiagn.DLL GLWell Gasliftedwellmodelfordiagnostics
WaxOp.DLL IWaxOp Waxdepositionoperation
DataMatching.DLL
IDataMatchingOp
Datamatching
operation
QgiChpOp.dll.DLL IPlotQgiVsChp GasLiftRatevsCasingHeadPressureoperation
Page 9
7/24/2019 Open Link Reference Manual
10/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Quick Start TutorialThisquickstartguideshowsmacrocodewritteninVBAusingMicrosoftExcel.Eventhougheachlanguage
implementsitsownparticularsyntax,thebasiclogictowriteanOpenLinkcodeormacrowillbeidentical.A
numberofcasestudiesalongwithVBAcodeusingExcelareprovidedunderthe..\CaseStudies\OpenLink
directory.
1. Beforeyoustart youmustletVBAknowabouttheOpenLinkinterfaces.Todothis,clickonTools|
ReferencesfromthemainmenuintheVBAwindow.Youshouldnowseeadialogboxlikethis:
2.
ScrolldownthelistofavailablereferencesuntilyoufindtheNet32COM1.0TypeLibrary.Checkthebox
totheleftofthereference.
3. NowdothesamefortheFluidModelCOM1.0TypeLibraryandforPNSReader1.0typelibrary.
4.
ClickonOKtoclosetheReferenceswindow.
Page 10Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
11/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Loading and running an existing model
1. Loadtheexistingnetworkmodel:SmallNetwork.bpn,whichisshippedwiththePIPESIMinstallation
andnormally
located
in:
C: \ Pr ogr am Fi l es\ Schl umber ger \ PI PESI M\ Case St udi es\ Net wor k Anal ysi s\ Smal lNet wor k\
IfthemodelwereopenedfromthePIPESIMgraphicalinterfaceitwouldlooklikethepicturebelow:
2.
UsingtheVisualBasiceditor(youcanquicklyopenitfromExcelusingtheshortcutAlt+F11)createa
variableofthetypeINetModeltoperformthebasicinteractionwiththenetworkmodel.Wewillcallit
NetModel:
Di m Net Model As New NET32COMLi b. I Net Model
3. Openthemodel:
Net Model . OpenModel C: \ Progr am Fi l es\ Schl umber ger \ PI PESI M\ CaseSt udi es\ Net work Anal ysi s\ Smal l Net work\ Smal l Network. bpn
4. Runthemodel(asynchronously):
NetModel . RunNetwork2 Fal se, " - B"
Page 11
7/24/2019 Open Link Reference Manual
12/161
7/24/2019 Open Link Reference Manual
13/161
PIPESIMVersion2011.1OpenLinkReferenceManual
3. GetthepressureandtemperatureatthesinkSink_1(seemodelpictureabove)
Di m i ndex as LongDi m pr essur e as Doubl eDi m t emper at ure as Doubl ei ndex = r esul t s. GetNodeI ndex( Si nk_1)pr essur e = r esul t s. Get NodeVar i abl eVal ue ( i ndex, "Pr essur e" )
t emper atur e = r esul t s. Get NodeVar i abl eVal ue ( i ndex, "Temper atur e " )
InthesamewayvariablessuchasLiquidRate,GasRate,MassRate,GLRorWaterCutcanbe
obtainedforSink_1oranyothernodeinthenetwork.
Changing BlackOil fluid parameters
Sofar,wehaveopened,runandobtainedresultsforanetworkmodelasitwasoriginallydefinedwithinthe
PIPESIMgraphicalinterface.Inthisstep,wewillchangesomeparameterstotheopenedmodel.Hereis
wherethetruepowerofOpenLinkstartstoshow,theExcelspreadsheetmaydefinearangeofvaluestobe
testedinthecontextofawhatifscenarioandmultiplesimulationjobsmaybesetuptocompareresults
forarange
of
input
values
for
one
or
more
properties.
1. CreateaBlackOilvariable:
Di m Bl ackOi l As New FLUI DMODELCOMLi b. I bl ackOi l
2.
GettheBlackOilmodelfromthenetwork
Set Bl ackOi l = Net Model . Bl ackOi l Def aul t
TheBlackOilvariablehasbeenfilledwiththevaluesdefinedintheblackoilmodelinNetModel.You
cancorroboratethisbyaddingawatchwiththeVBAdebuggingtoolandinspectingthedifferent
variablefields.
3. SetaWatercutvalueof15%:
Bl ackOi l . Watercut = 15
4. SetanAPIvalueof27.5:
Bl ackOi l . API = 27. 5
5. SetthisBlackOilwithamodifiedwatercutandAPIbackintothenetwork:
Net Model . Bl ackOi l Def aul t = Bl ackOi l
6. Youcannowrerunthemodelwiththenewvalues,getthenewresults,displaytheminanExcelcellor
plot,etc.
Page 13
7/24/2019 Open Link Reference Manual
14/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Changing a choke property
ThefollowingpieceofcodesetsanewvalueforthechokebeansizeinChokewhichisdefinedinthe
singlebranchmodelthatcorrespondstotheproductionwellWell_1.
Net Model . Set Pr oper t yVal ( Choke, Wel l _1, "Bean Si ze", 3. 5,
"i nches")
Theabovelinesetsbeansize=3.5inchestoChokeinWell_1..
Saving the changes
1. Anychangesmadetoasinglebranchornetworkmodelcanbesavedsimplybycallingthe
SaveModel()function.
Di m bOK as Bool eanbOK = Net Model . SaveModel ( C: \ MyOpenLi nkModel s\ Net wor k. bpn)
Theargumentisthefullpathtothefilewherethemodelwillbesaved.Itcanalsoberesavedtothe
originalmodelfile.
2.
bOKwillbeTRUE(1)orFALSE(0)dependingonwhetherthesaveoperationsucceededornot.Aswith
allOpenLinkfunctioncallsthatreturnaTRUE/FALSEstate,aFALSEvalueindicatesthatsomekindof
errorconditionoccurredandanerrordescriptioncanbeobtainedbycallingGetLastError():
Di m Er r or as St r i ngI f bOK = Fal se Then
Net Model . Get Last Er r or Er r orMsgBox err orSt r
End I f
Page 14Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
15/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Case Study 1 Building a Well Model from Excel
Problem Outline
Itis
often
desired
to
build
PIPESIM
well
models
from
acorporate
database.
The
problem
can
be
solved
by:
1. Pastingthewellsdatainexcel.
2. UsingaVBAroutinecontainingOpenLinkstatementstoautomatetheBpsfilescreation.
Thiscasestudyillustratestheresolutionofsuchaproblem.
Requirements
ItisassumedthatthereaderisfamiliarwiththebasicsofbuildingmodelsinPIPESIM.
NopriorknowledgeofVBA(VisualBasicForApplication)isrequired. VBAisaprogramminglanguagethatis
accessedfrom
Microsoft
Excel.
VBA
statements
can
be
used
to
interact
with
Microsoft
Applications.
These
statementscannotinteractwithPIPESIM. OpenLinkisthenamegiventoagroupofstatementsthatcanbe
usedinVBAtointeractwithPIPESIM.
Procedure
1.
CreateaWellModelTemplate. (ThatisbuildawellmodelinPIPESIMbutdonotfillanyoftheobjects
thatmakeupthemodelwithvalues). Savethewellmodeltemplatewiththenametemplate.bps.
2. OrganizethewellsdataintabularforminExcel.
3.
WritetheVBAroutinethatwillcreateaBpsfileforeachwellofthespreadsheet. (Theroutinewillmake
useofthemodeltemplate.bpsaswillbeshownfurtherdowninthetext).
4. RuntheroutineTheBpsarecreatedandstoredinadirectoryspecifiedintheroutine.
Page 15
7/24/2019 Open Link Reference Manual
16/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Step by step tutorial
To Create a Well Model Template
1. OpenPIPESIMOpenanewwellperformanceanalysiswindowasshownbelow.
2. CreatethefollowingWellModelintheopenedwindow.
3. Savethemodelwiththesimplemodeldescriptionselectedinboththetubingobjectandtheflowline
object.
Thisis
done
by
double
clicking
on
both
the
flowline_1
and
tubing_1
object,
selecting
simple
model
in
eachuserformandpressingonthebuttonOK.
4. Savethewellmodelunderthenametemplate.bpswiththefollowingpath:
D: / OpenLi nk/ t empl ate/ t empl ate. bps
Page 16Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
17/161
PIPESIMVersion2011.1OpenLinkReferenceManual
To Create a table of wells data in Excel (2 vertical gas wells)
1.
OpenExcel.
2. IntheOpenedworkbook,selectsheet1(thesheetshouldbeselectedbydefault).
3.
CreatethefollowingtableinExcel(4Rows24Columns).
4. Startthetableatthecell$A$4andfinishatthecell$X$7.
5.
Listof
the
24
columns
(A
to
Xin
order)
(The
values
are
given
for
each
column):
A: General Data:
Index. (1,2)
Field. (Field1,Field2)
WellNumber (435,436)
GatheringStation (Man1,Man2)
B: Black Oil Data:
GasGravity(lbs/cu.ftgassc)/(lbs/cu.ftairsc). (62,62)
OilAPI (Field1,Field2)
GORscf/bbl (800000,900000)
Water Cut %(10,20)
C: Completion Data:
PwsPsia
(Static
pressure
of
the
reservoir).
(1800,3000)
TemperatureF (200,200)
PImmscf/d/psi2 (1.5053E08,1.7427E7)
D: Tubing Data:
PerforationMDm (2104,2104)
Page 17
7/24/2019 Open Link Reference Manual
18/161
PIPESIMVersion2011.1OpenLinkReferenceManual
PerforationTVDm (2104,2102)
Tubing1MDm (2054,2052)
Tubing1ID (2.44,2.44)
Tubing2MD
(Casing
MD)
(2104,2104)
Tubing2ID(CasingTVD) (5.5,5.5)
E: Flow line Data:
Flowlineelevation(m) (0,0)
FlowlineID (3,3)
FlowlineLengthkm (4.305,1.212)
F:Choke Data:
ChokeSize1/64th. (95,95)
G: Production Data:
GasRatemmscf/d (0.041,1.39)
WellHeadPressurepsia (195,250)
Pressureattheendoftheflowline.psia (150,440)
6.
Incell
$A$8
write
the
template
path:
D:/OpenLink/template/template.bps
7. Incell$A$9writethepathinwhichtheBpsfilesaretobestored:
D: / OpenLi nk/
8. Incell$D$11writethesurfacetemperature:90F.
9. SavethecurrentworkbookunderthenameOpenlink.xlswiththefollowingpath:
D: / OpenLi nk/ Excel / Openl i nk. xl s
Page 18Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
19/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Preliminary steps
1. EnableMacrosinyourworkbook.
2. SelecttheMenutoolsSubMenuMacroSecurityasshownbelow.
Thefollowinguserformshouldappear:
3.
SelectMedium. HighdoesnotlettheuserrunanyunsignedMacros.
4. InsertaButtonintheworkbookthatwilllaunchtheroutine.
Page 19
7/24/2019 Open Link Reference Manual
20/161
PIPESIMVersion2011.1OpenLinkReferenceManual
First,displaytheControlToolboxToolbars.
5.
Theninsert
abutton
in
the
spreadsheet
by
clicking
on
the
Command
Button
Icon
in
the
Control
Toolbox;
andclickinganddraggingthebuttoninthespreadsheet. Thisisshownbelow:
Design
Mode
CommandButton
Icon.
Page 20Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
21/161
PIPESIMVersion2011.1OpenLinkReferenceManual
ThedefaultnameofthebuttonisCommandButton1.
Note:ClickingontheCommandButtoniconactivatesthedesignmodethatallowsyoutoplacebuttons
andothertypesofcontrolsinthespreadsheet. Youwillneedtodeactivatethedesignmodemanually
whenyouwanttheroutineassociatedwiththebuttontobeexecutedwhenyouclickonit.
6. NextchangethenameofthebuttonbyrightclickingonthebuttonCommandButton1thefollowing
menushouldappear:
7. ClickonCommandButtonObjectSubmenuEdit. Youcannowchangethecaptionofthebutton
CommandButton1to:CreateWellModel.
Page 21
7/24/2019 Open Link Reference Manual
22/161
7/24/2019 Open Link Reference Manual
23/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Youshouldnowseeadialogboxliketheonebelow:
2. ScrolldownthelistofavailablereferencesuntilyoufindtheFluidModelCOM1.0TypeLibrary. Check
theboxtotheleftofthereference.
3. NowdothesameforNet32COM1.0TypeLibraryandNODALOPLib.INodalAnal.
4. ClickonOKtoclosethereferencewindow.
EachofthethreelibraryactivatedisagroupofOpenLinkstatementsthatcanbeusedinVBAto
communicatewithPIPESIM. TheselibrarieswillbeavailablefromExcelafterhavinginstalledPIPESIM.
Theyneedtobeactivatedbeforetheycanbeusedwhileprogramming.
Note: Ifaroutineispassedfromonecomputertoanother,anditdoesnotworkonthereceiving
computer,itisbecausetheOpenLinkLibrarieshavenotbeenactivated.
Page 23
7/24/2019 Open Link Reference Manual
24/161
PIPESIMVersion2011.1OpenLinkReferenceManual
To write the VBA routine using Open Link Statements
1. Writethefollowingroutine:
TheactualworkingsoftheroutinewillbeexplainedinCaseStudies.
Page 24Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
25/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Page 25
7/24/2019 Open Link Reference Manual
26/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Page 26Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
27/161
PIPESIMVersion2011.1OpenLinkReferenceManual
To Run the routine
1. GobacktoExcelandselectthetwowellswiththemouse(byhighlightingthecorrespondingrows)you
willhavecreatedtwo.bpsfilescorrespondingtothetwowellsofthespreadsheet.ThedirectoryOpen
Linkwillcontainthetwo.bpsFiles(shownbelow).
Page 27
7/24/2019 Open Link Reference Manual
28/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Case Study 2 - Nodal Analysis
Problem Outline
Itis
required
to
see
if
our
production
data
is
consistent
with
what
the
model
predicts
the
flow
rate
should
be.Wewillrunanodalanalysisoneachofthewells. Theboundaryconditionsoftheproblemarethe
reservoirstaticpressureandtheoutletpressureofthemodel(i.e.thedownstreamendoftheflowline).
TheStocktankgasflowrateattheoperationpointwillbecomparedtotheGasflowrategiveninthe
productiondata.
Requirements
ItisassumedthatthereaderisfamiliarwiththePIPESIMNodalAnalysisUserForm.
ProcedureYouwillwriteaVBAOpenLinkroutinethatusesthetablebuiltinthepreviouscasestudy. Theroutinefills
inaNodalAnalysisoperationinterfaceusingthestaticpressure,tubingIDandOutletPressurestoredin
ExcelandthenassignsthisNodalAnalysisoperationinterfacetotheWellModelscreatedinCasestudy1.
Eachofthemodelsisthenrun. ANodalAnalysisplot(systemplot_.plt)isproducedforeachwell. Youcan
thencheckonthegraphsifthestocktankflowratesattheoperationpointsareconsistentwiththe
productiondata.
Page 28Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
29/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Step by Step Tutorial
1.
OpentheExcelFile(OpenLink.xls)
D: / OpenLi nk/ Excel / Openl i nk. xl s
2. InsertasecondbuttonintheSpreadsheet.ThisisdoneusingthecontroltoolboxasinCaseStudy1.
ThedefaultnameofthebuttonwillbeCommandButton2.
3. OpentheVBAeditor.ThisisdoneasinCaseStudy1bydoubleclickingonthebuttonCommandButton2.
Thecode
written
for
the
previous
case
study
will
be
visible.
Pr i vate Sub CommandBut t on2_Cl i ck( )End Sub
Attheendofthecode,fromthepreviouscasestudy,thestatementsarevisible.
Page 29
7/24/2019 Open Link Reference Manual
30/161
PIPESIMVersion2011.1OpenLinkReferenceManual
To Write the VBA routine using Open Link statements
1.
Writetheroutine:
TheworkingsoftheroutineareexplainedinCaseStudies.
Page 30Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
31/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Page 31
7/24/2019 Open Link Reference Manual
32/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Page 32Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
33/161
PIPESIMVersion2011.1OpenLinkReferenceManual
To Run the routine
1. GobacktoExcelandselectthetwowells(byhighlightingthecorrespondingrows).
2.
PressthebuttonCommandButton_2. Thisrunsanodalanalysisonthetwo.bpsfilesproducedinCase
Study1. ThecontentsoffolderOpenLinkafterhavingruntheroutineisshownbelow:
.plt
Files.
3. Clickingonthe.pltfileswilldisplaythefollowinggraphs:
.
Plot of Man1_435
Page 33
7/24/2019 Open Link Reference Manual
34/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Plot of Man2_436
Page 34Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
35/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Modules and Interfaces
1. Valuesreturnedas7777mean'UNSET'orcouldnotcalculatedotomissingdataorhasnotbeen
calculated.
2.
Forall
modules
and
interfaces,
required
methods
are
shown
in
RED,
and
conditionally
required
in
GREEN.
Page 35
7/24/2019 Open Link Reference Manual
36/161
PIPESIMVersion2011.1OpenLinkReferenceManual
ISingleBranchModel Interface
ISingleBranchModel object - Get Methods
GetNameList(ObjectTypeAs
Long,pNameArray,
Count
As
Long)
ReturnsinpNameArrayanarrayofStringwiththenamesof
objectsof
the
given
type
(ObjectType).
The
number
of
objects
foundisreturnedinCount.ObjectTypecanbeanyvalueof:
1Fold
2Source
3Sink
4Junction
5Branch
6Text
7ProductionWell
8InjectionWell
9EndMark
10Generic
Source
11 VerticalCompletion
12 HorizontalCompletion
13Flowline
14Riser
15 Zerolengthconnector
16Tubing
17 GenericNode
18Choke
19Compressor
20Expander
21Heat
Exchanger
22ESP
23 MultiphaseBooster
24GasLift
25Separator
26 Reporttool
27 Adder/Multiplier
28 NodalAnalysisPoint
29 EngineKeywordTool
30Reinjector
31WellConnector
32SSSV
33
Gas
Lift
Valve
34BlackBox
35CoilTubing
36PCP
GetEquipmentInfo
(EquipmentTypeAsLong,
ParentTypeAsLong,ParentObject
AsString,EquipmentNames,
IfParentObjectstringisempty,thefunctionisthesameas
TGetNameList()T. SeeTGetNameList()Tforamapto
EquipmentTypeoptions.Otherwiseitreturnsin
EquipmentNamesarrayofStringwiththenamesofchildobjects
Page 36Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
37/161
PIPESIMVersion2011.1OpenLinkReferenceManual
CountAsLong) ofthegiventype(ObjectType)forspecifiedParentObjectof
ParentType
GetHasArtificialLift(ObjectType
AsLong,ObjectNameAsString,
LiftAsLong)
Returns0:noartificiallift
1:gasliftinjection
2:ESP
1:Objectnotfound
ObjectTypemustbeTubingtype(16)
ObjectNamethenameofthetubing
GetStartBoundaryObject
(ObjectTypeAsLong,ObjectName
AsString)
ReturnstheObjectType(SeeTGetNameList()T)anditsnameof
theupstreammostobjectinthesinglebranchmodel.The
upstreammostobjectinabranchisdeterminedbythedrawing
directionwhenauserinitiallycreatesthebranch.
GetCountObjectsInProfile(Count
AsLong)
Returnsthenumberofobjectsinthesinglebranchmodel
GetObjectAtIndex(Index
As
Long,
ObjectTypeAsLong,ObjectName
AsString)
Returnsthe
object's
type
and
name
at
the
specified
zero
based
index.Indexmustbetweenzeroandthenumberreturnedby
GetCountObjectsInProfile()minus1.
GetLastError(ErrorStrAsString) Returnsthelasterrormessageproducedbytheinterface.
GetIsModelRunning()AsBoolean ReturnsBooleanvalueTrueifthesimulationprocessisactive
GetOperationInterface
(pIOperationAsObject)
Returnstheoperationobject
GetOperationType()AsLong ReturnsLongvalueastheoperationdefinedforthemodel.See
XDefinedconstantsandstringsX
GetPropertyNames(ObjectName
AsString,PropNames)asLong
ReturnsinPropNamesthelistofpropertiesdefinedfortheobject
ObjectName.Returnsthenumberofpropertiesasfunctionsreturnvalue
GetPropertyVal(ObjectNameAs
String,PropNameAsString,
pValueAsDouble,pUnitStrAs
String)AsBoolean
Forspecifiedproperty(PropName)inthespecifiedobject
(ObjectName)functiongetsapropertyvalueinValueandthe
unitsinUnitStr.ReturnvalueisTrueifthepropertywasretrieved
successfully,otherwiseFalse. ForimplementedPropNamessee
XDefinedconstantsandstringsX.
GetPropertyValAtObjectIndex
(ObjectNameAsString,PropName
AsString,pValueAsDouble,
pUnitStrAs
String,
SubObjectType
AsLong,IndexAsLong)As
Boolean
Getsaspecifiedpropertyvalue.
ThisfunctionextendsthefunctionalityofTGetPropertyValTby
allowingyoutoretrieveapropertyfromaspecifiedsub
componentwithin
an
object.
A
typical
use
of
this
is
when
for
instanceitisrequiredtogetagasliftflowrate(PropName)from
thetop(Index=0)gasliftinjectionpoint(SubObjectType)inthe
tubingTubing_1(ObjectName).Foravailableoptionssee
XDefinedconstantsandstringsX
Page 37
7/24/2019 Open Link Reference Manual
38/161
PIPESIMVersion2011.1OpenLinkReferenceManual
GetPropertyStringAtObjectIndex
(ObjectNameAsString,PropName
AsString,pValueAsString,Index
AsLong)AsBoolean
ThefunctionissimilartoTGetPropertyValAtObjectIndexTbutfor
propertiesdefinedasstring
GetPropertyType(ObjectNameAs
String,PropName
As
String)
As
Long
Returnsthepropertytype:
UNDEFINED 1
REAL 0(valueinstrictSIunits)
INT 1
DOUBLE 2
STR 3
GetSensitivityInfo(ObjectTypeAs
Long,ObjectNameAsString,
VariableNames,ItemReference)
Returnsthelistofvariablenamesuponwhichasensitivity
analysiscanbeperformedforthegivenobject(definedbyits
typeandname).SeeTGetNameList()Tforobjecttypevalues.
ItemReferenceholdsadditionalbinaryinformationaboutthe
sensitivitythatisrequiredbysomeoperationmoduleinterfaces
(suchas
the
Artificial
Lift
COM
interface)
GetSensitivityVariables
(ObjectNameAsString,
VariableNames,StdQtyNames)As
Long
Requeststhelistofvariablenamesandtheirmeasurementsupon
whichasensitivityanalysiscanbeperformedforthegivenobject
(definedbyname).Thereturnvalueholdsnumberofthe
variables
ISingleBranchModel object - Set Methods
SetOperationInterface
(pIOperationAsUnknown)
pIOperation:Theinterfaceinstancetoanoperationobject. This
functionassignsthegivenoperationtotheopenedsingle
branchmodel
SetOperationType
(OperationTypeAsLong)
Setstheoperationtypeforthesinglebranchmodel.See
Definedconstantsandstrings
SetPropertyVal(ObjectNameAs
String,PropNameAsString,value
AsDouble,UnitStrAsString)As
Boolean
Setsthespecifiedproperty(PropName)inthespecifiedobject
(ObjectName)tothevaluegiveninValueinthegivenunits
(UnitStr).FunctionreturnsTrueifthepropertywasset
successfully,otherwiseFalse. ImplementedPropNames:see
Definedconstantsandstrings.
SetPropertyStringAtObjectIndex
(ObjectNameAsString,PropName
AsString,
value
As
String,
Index
As
Long)AsBoolean
AsSetPropertyValAtObjectIndex()butforpropertiesdefined
asstring
Page 38Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
39/161
PIPESIMVersion2011.1OpenLinkReferenceManual
SetPropertyValAtObjectIndex
(ObjectNameAsString,PropName
AsString,valueAsDouble,UnitStr
AsString,SubObjectTypeAsLong,
IndexAsLong)AsBoolean
ThisfunctionextendsthefunctionalityofSetPropertyValby
allowingyoutosetapropertytoaspecifiedsubcomponent
withinanobject.Atypicaluseofthisiswhenforinstanceitis
requiredtosetagasliftflowrate(PropName)throughthetop
(Index=0)gasliftinjectionpoint(SubObjectType)inthetubing
Tubing_1(ObjectName).ForavailableoptionsseeDefined
constantsandstrings.
SetPVTFile(bstrPVTFilenameAs
String)
Setsthecompositionalfile(.pvt)tobeusedasthemainfluidin
thesimulations
SetUnitManager
(p_VarUnitManager)
SetstheUnitManagerobject
ISingleBranchModel object - Properties
BlackOilAsObject Gets/setstheBlackOilfluiddefinitionobject
CompositionAs
Object
Gets/sets
the
fluid
composition
object
FlowCorrelationAsObject Gets/setstheFlowCorrelationobject
FluidAsFluidModel Gets/setstheFluidModelobject(SeeIFlowlineObj
Interface)
FluidModelTypeAsLong Gets/setsthefluidtype(0:blackoil,1:compositional,2:
PVTfile,3:MFLfile)
GasLiftDesignAsObject Gets/setstheGasLiftDesignobject
GasLiftSystemPropsAsObject Gets/setstheGasLiftSystemPropertiesobject
ObjectProperties(ObjectNameAs
String)As
ProfileObj
Sets/returnsaProfileObject(SeeIObjectProperties
Interface).Depending
on
the
object
type
of
ObjectName
thisinterfacecanbesettothespecificobjecttype
interface.Forinstanceatubingobjectreturnsa
ProfileObject,whichcanbesettoaTubingObjobject.The
TubingObj(SeeITubingInterface)containspropertiesand
methodstodefineorobtaininformationfromadetailed
tubingobject.
ProjectInfoAsProjectInfo ReturnstheProjectInfoobjecttoaccessprojectspecific
data
ProjectPathAsString Setsfullpathnametothemodelfile
FieldSurvey
As
Object
Gets/sets
the
FieldSurvey
object
ErosionCorrosionAsObject Gets/setstheErosionCorrosionobject
KeywordsAsString Gets/setstheadditionalenginekeywords
HeatTransferOptionsPipeBurialMethod
Aslong
Gets/setstheflagvalueforheattransferoptionspipe
burialmethod:
1983:1983method
2000:2000method(settothisvalueifgivenvalueisnot
Page 39
7/24/2019 Open Link Reference Manual
40/161
PIPESIMVersion2011.1OpenLinkReferenceManual
1983,2000,or2009)
2009:2009method
HeatTransferOptionsIFCMethodAslong Gets/setstheflagvalueforheattransferoptionsinside
filmcoefficientmethod:
1:Kaminsky
2:KreithSeparateReynoldsnumber(settothisvalueif
givenvalueisnot1,or2)
HeatTransferOptionsUValueMultiplier
Asdouble
Gets/setsthevalueforheattransferoptionsUvalue
multiplier
EnableHydrateSubcoolingCalculationAs
long
Gets/setstheflagvalueforheattransferoptionshydrate
subcoolingcalculation:
0:disable
1:enable(settothisvalueifgivenvalueisnot0,or1)
Note:Propertyisforcompositionalmodelsonly
ISingleBranchModel object - Operations
ExportEngineFiles() ThisfunctiongeneratesanASCIIfile(.psm)inthePIPESIM
enginekeywordlanguagethatcorrespondstotheopened
model. ThisfilecanthenbeusedwithPIPESIMexpert
mode.
ExportEngineFiles2(operationfileAs
String)AsString
InadditiontoExportEngineFiles(),thisfunctionreturns
thefullpathnametotheexportedfile(.psm)andits
associatedoperationfile(.inc)
ExportEngineFiles3(nExpertMode
As
Long)This
function
is
similar
to
ExportEngineFiles
function
but
itallowstospecifytheformatforexportedfilesin
nExpertModeparameter:
0defaultformat,
1withexpertextensions
2forESPdesign
3sameasfor1butwarningisdisplayediffilesexist
KillSimulationProcess() Terminatesthesimulationprocess
NewModel(bstrModelFileNameAs
String,
ProfileTypesList,
ProfileNamesList)AsBoolean
CreatesanewPIPESIMmodel. bstrModelFileName:full
path
to
the
file
where
the
new
model
is
to
be
saved.
ProfileTypesList:alistofobjecttypeidentifiers(integer
numbers)thatdescribetheobjectconnectivityinthe
modelseeDefinedconstantsandstringsforidsmap.
ProfileNamesList:alistofobjectnamesforeachoneof
theelementsofProfileTypesList.Thisvariantmaybe
emptyinwhichcasedefaultnameswillbeassigned.The
methodreturnsTrueifoperationwassuccessful,False
otherwise
Page 40Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
41/161
PIPESIMVersion2011.1OpenLinkReferenceManual
OpenModel(bstrModelFileNameAs
String)
Opensthegivensinglebranchmodel.Filenamemustbea
validPIPESIMsinglebranchmodelfile(.bps).
Thisfunctionmustbecalledfirstwhenusingthis
interface.
Note:Willreturnfalsealsoifthenumberofcomponent
inany
composition
or
in
the
model
in
general
is
more
than50.
RunSingleBranchModel(bRestartAs
Boolean)
Runsthecurrentlyopenedmodelbycallingthe
calculationengineprogramasspecifiedinthePIPESIM
installation.IfbRestartisTruethesimulationwillloadany
previouslyrestartfiles(.rstfiles)asitsinitialconditions.
ReturnvalueisTrueforsuccessfulenginestart,False
otherwise.
RunSingleBranchModel2(bRestartAs
Boolean,EngSwitchesAsString,
DynamicPlotAsBoolean)
SimilartoSetOperationInterface,italsoacceptsoneor
moreswitchestobepassedtothesimulationengineand
turnsdynamicplottingon/off.
RunSingleBranchModel3(bRestartAs
Boolean,EngSwitchesAsString,
DynamicPlotAsBoolean,
ExpertExtensionsAsBoolean)
SimilartoSetOperationInterface2,italsoallowsusingof
theExpertextensions
SaveModel(bstrPathNameAsString)As
Boolean
Savesthecurrentlyopenedmodeltoafilegivenby
bstrPathName.FunctionreturnsTrueifmodelissaved,
otherwisethereturnvalueisFalse.
ValidateTubingConfiguration(MaxInjTV
DAsDouble)AsBoolean
Thisfunctionchecksthetubingconfigurationabovethe
injectionpointto verifythatalldimensionsareproperly
set. Iffunctionfailstheerrormessageisavailableusing
theGetLastError
function.
SetOutpoutUnits(nUnitsAsInteger)As
Boolean
Thisfunctionforcestheoutputtobewritteninspecified
units(0modelsdefaultunits,1Engunitsand2SI
units).
Page 41
7/24/2019 Open Link Reference Manual
42/161
PIPESIMVersion2011.1OpenLinkReferenceManual
ISingleBranchModel object Examples
VBA Sample Code
Di m Si ngl eBr anchObj As New NET32COMLi b. I Si ngl eBr anchModelDi m equi pnames As Var i ant
Di m sensvar names As Var i antDi m obj r ef As Var i ant
Di m count As Long
' Open t he modelSi ngl eBr anchObj . OpenModel C: \ Progr amFi l es\ Schl umber ger \ Pi pesi m\ CaseSt udi es\ Open Li nk\ Gas Li f t Per f ormance. bps
' Export Psmf i l eDi m Expor t Fi l e As St r i ngDi m Oper at i onFi l e As St r i ngExpor t Fi l e = Si ngl eBr anchObj . Expor t Engi neFi l es2( Oper ati onFi l e)
' Get obj ect i nf or mat i on
Di m count As LongDi m obj t ype As LongDi m obj name As St r i ng
Si ngl eBr anchObj . Get Count Obj ect sI nProf i l e count
' Wr i t e t o the spr eadsheet t he l i st of obj ect s i n t he si ngl e br anch modelFor i ndx = 0 To count - 1
Si ngl eBr anchObj . Get Obj ect At I ndex i ndx, obj t ype, obj nameCel l s( i ndx + 1, 1) = obj nameCel l s( i ndx + 1, 2) = obj t ype
Next
' Get Sensi t i vi t y I nf or mat i on f or t he t ubi ng ( t ype = 16) wi t h i dent i f i er Tub_1Si ngl eBr anchObj . Get Sensi t i vi t yI nf o 16, Tub_1, sensvar names, obj r ef
' Wr i t e t he l i st of sensi t i vi t y var i abl es t o t he spr eadsheet Di m name As Var i antFor Each name I n sensvar namesr . Cel l s( i , 1) = namei = i + 1Next
Page 42Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
43/161
PIPESIMVersion2011.1OpenLinkReferenceManual
IISingleBranchModel2Interface
IISingleBranchModel2 object - Properties
UFactorMultiplierAsDouble Gets/setstheufactormultiplierforasinglebranchmodel
VBA Sample Code
Di m Si ngl eBr anchObj As New NET32COMLi b. I Si ngl eBr anchModelDi m Si ngl eBr anchObj Lnk As NET32COMLi b. I I Si ngl eBr anchModel 2Si ngl eBr anchObj . OpenModel C: \ Progr amFi l es\ Schl umber ger \ Pi pesi m\ CaseSt udi es\ Wel l Desi gn and Per f ormance\ Fl ow Corr el at i on Match. bpsSet Si ngl eBr anchObj Lnk = Si ngl eBr anchObjDi m st r val ue As St r i ngst r val ue = "Pr evi ous U- Fact or mul t i pl i er val ue f or t he model " +CSt r ( Si ngl eBr anchObj Lnk. UFact or Mul t i pl i er )MsgBox st r val ue' set new u- f act or mul pl i er val ue f or t he model
Si ngl eBr anchObj Lnk. UFact orMul t i pl i er = 2
IObjectProperties Interface
ProfileObj object - Properties
FluidAsFluidModel GetsaFluidModelinterfaceobject (seedescriptionbelow)
ProfileObj object - Get Methods
GetLastError()AsString Returnsanerrordescription
GetPropertyNames(PropNames)As
Long
ReturnsinPropNamesthearrayofpropertiesdefinedfor
theobject.Functionsreturnvalueisthenumberof
properties
GetValue(PropNameAsString,
pValue,pUnitStrAsString,IndexAs
Long)AsBoolean
Getsthespecifiedproperty(PropName)valueinValueinthe
givenunits(UnitStr).ReturnvalueisTrueifthepropertywas
setsuccessfully,otherwiseFalse. ImplementedPropNames:
seeDefinedconstantsandstrings.Indexisareserved
argument,setitto1.
ProfileObj object - Set Methods
SetValue(PropNameAsString,value,
UnitStrAsString,IndexAsLong)As
Boolean
Setsthespecifiedproperty(PropName)valueinValueinthe
givenunits(UnitStr).ReturnvalueisTrueifthepropertywas
setsuccessfully,otherwiseFalse. ImplementedPropNames:
seeDefinedconstantsandstrings.Indexisareserved
argument,setitto1.
Page 43
7/24/2019 Open Link Reference Manual
44/161
PIPESIMVersion2011.1OpenLinkReferenceManual
ITubing Interface
TubingObj Object - Get Methods
GetCountDownholeEquipment(Type
AsLong)
As
Long
Returnsthenumberofitemsspecifiedinthedetailedtubing
modelof
agiven
type
of
equipment
Type:anyof
16Tubingsection
18 Choke
22 CentrifugalPump
24 InjectionPoint
25 Separator
32SSSV
33GasLiftValve
(See ObjectTypeIdentifiers)
GetCountTubingSection()AsLong SimilartoGetCountDownholeEquipment,butspecificto
tubingsections
GetDeviationSurvey_SI(TypeAs
Long)AsVariant
ReturnsinaVariantthematrixofdoublesdefinedastwo
columnsandavariablenumberofrows.Thevariableineach
columndependsintherequestedType.
Type:0=mdvs.tvd,1=mdvs.angle,2=tvdvs.angle
AllvaluesareinstrictSIunits
GetDownholeEquipment(TypeAs
Long,Index
As
Long,
label
As
String)
AsDouble
Returnsthemd(asfunctionsreturnvalue)andthelabelofa
givenType
of
downhole
equipment
and
at
given
Index.
Type:anyof
16Tubingsection
18 Choke
22 CentrifugalPump
24 InjectionPoint
25 Separator
32SSSV
33GasLiftValve
Index:the
0based
positional
index
of
the
item.
Index
=0
referstothetopmostitemclosesttothewellhead.
GetDownholeEquipmentAtIndex
(IndexAsLong,TypeAsLong,labelAs
String)AsDouble
Returnstheequipmenttype,labelandmd(asfunctions
returnvalue)instrictSIunitsatagivenIndex.See
GetDownholeEquipmentfordefinitionofIndex
Page 44Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
45/161
PIPESIMVersion2011.1OpenLinkReferenceManual
GetGeothermalSurvey_SI(vbIsTVD
AsBoolean)AsVariant
ReturnsthegeothermalsurveyinVariantmatrixofdoubles
definedasthreecolumnsandavariablenumberofrows.
ThecolumnsaredefinedasDepthvs.AmbientTemperature
vs.Uvalue.DepthisTVDifvbIsTVD=true,otherwiseMD
GetTubingSection(IndexAsLong,
labelAs
String)
As
Double
SimilartoGetDownholeEquipment,butspecifictotubing
sections
GetMDatTVD_SI(tvdAsDouble)As
Double
Returnsthemdgiventhetvdbasedonthedeviationsurvey
GetTVDatMD_SI(mdAsDouble)As
Double
Returnsthetvdgiventhemdbasedonthedeviationsurvey
GetInputOK(infoAsString)As
Boolean
ValidatesthetubingdataandreturnsTrueifconfigurationis
correct,otherwisethefunctionreturnsFalseandinfo
containstheerrormessage
TubingObj Object -Set Methods
SetDeviationSurvey_SI(TypeAs
Long,Survey)AsBoolean
Setsadeviationsurveytoadetailedtubingmodel.
SeeGetDeviationSurvey_SIforavailabletypes. Surveymust
beavariantmatrixofdoublevaluesspecifiedasatwo
columntablewithanynumberofrows(minimum2).
SetGeothermalSurvey_SI (vbIsTVD
AsBoolean,Survey)AsBoolean
Setsageothermalsurveytoadetailedtubingmodel.
SeeGetGeothermalSurvey_SIfordefinitionofSurveyand
vbIsTVD.
TubingObj Object -Properties
InjectionPointFluid(IndexAsLong)
AsFluidModel
Gets/setstheFluidModelobjectfortheinjectionpointata
givenindex.Thisfunctionisonlyapplicablefor
compositionalmodels.SeeISinglePointCalibobject.
RemedialCoiledTubingEnabledAs
Boolean
Enables/disablesRemedialCoiledTubingoptionin
configuration
TubingObj Object - Operations
AddDownholeEquipment
(Type
As
Long,md_SIAsDouble,labelAs
String)AsLong
Adds
an
equipment
item
to
the
detailed
tubing
Type:anyof
22 CentrifugalPump
24 InjectionPoint
25 Separator
32SSSV
33GasLiftValve
Page 45
7/24/2019 Open Link Reference Manual
46/161
PIPESIMVersion2011.1OpenLinkReferenceManual
label:theitemslabel
Functionreturnsthe0basedpositionalindexoftheadded
item.Index=0referstothetopmostitemclosesttothe
wellhead
AddGasLiftValve_SI(mdAsDouble,
manufAs
String,
series
As
String,
portNameAsString,portSizeAs
Double,modeAsString,ptroAs
Double,ApAsDouble,AbAsDouble,
nomODAsDouble,cvAsDouble,
dpfoAsDouble)AsLong
Addsagasliftvalvetothetubingobject.Returnsthezero
basedindex
corresponding
to
the
valve
position
with
index
ofthetopmostvalveequalto0.
AddTubingSection(BottomMD_SIAs
Double,labelAsString)AsLong
Addsasectionoftubing
BottomMD_SI:thebottommdofthesectioninstrictSIunits
label:theitemslabel
Functionreturnsthe0basedpositionalindexoftheadded
section
ClearGasLiftValves() Removesallgasliftvalvesfromthetubing
RemoveDownholeEquipment(Type
AsLong,IndexAsLong)
Removesapieceofequipmentofagiventypeandatthe
givenIndex.
Type:anyof
22 CentrifugalPump
24 InjectionPoint
25 Separator
32SSSV
33
Gas
Lift
Valve
Index:the0basedpositionalindexoftheitem.Index=0
referstothetopmostitemclosesttothewellhead
RemoveTubingSection(IndexAs
Long)
SimilartoRemoveDownholeEquipmentbutapplicableto
tubingsections
DisplayDialog(p_VarUnitManager,
fluidtypeAsInteger)AsBoolean
Functioninvokestubingconfigurationdialogandreturns
TrueifOKbuttonwasclicked,Falseotherwise.
p_VarUnitManagerisaUnitsManagerobjectandfluidtype
canbeoneofthefollowingvalues:
0:blackoil
1:composition
2: PVTfile
3: MFLfile
Page 46Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
47/161
PIPESIMVersion2011.1OpenLinkReferenceManual
IVertCompObj Interface
VertCompObj Object - Get Methods
GetInputOK(infoAsString)As
Boolean
ValidatestheflowlinedataandreturnsTrueifconfiguration
iscorrect,
otherwise
the
function
returns
False
and
info
containstheerrormessage
VertCompObj Object - Set Methods
SetMultipoint(valueAsLong)As
Boolean
Seteithermultipoint=1 orisochronal=0typeof IPRdata
table
SetIPRFluidType(TypeAsLong)As
Boolean
SetfluidtypeforIPR:type_liquid=0,type_gas=1
SetIPRTable_SI(QPPoints)AsBoolean SetstheIPRtablevalues. QPPointsisa3columnarrayof
Doubles,wherefirstcolumncontainsFlowratevalues,
secondcolumncontainsPwfvaluesandthethirdone
containsPwsvalues. AllvaluesareinstrictSIunits
GetConingTableData(IsUsedAs
Boolean,ConedGasSGAsDouble,
Flowrate,GOR,WCut)AsBoolean
Returnstheconingtabledatafortheverticalcompletion.
IsUsedisTRUEifitissetandFALSEotherwise,ConedGasSG
containsavalueforconedgasspecificgravity,Flowrate,
GORandWCutaretheonecolumnarraysofDoubles
containingflowrate,GORandwatercutvaluesrespectively.
AllvaluesareinEngunits
GetPSSRelPermTableData(WaterSat,
RelPermOil,RelPermWater)
As
Boolean
Returnstherelativepermeabilitytabledataforthevertical
completionwith
pseudo
steady
state
model.
WaterSat,
RelPermOilandRelPermWateraretheonecolumnarraysof
Doublescontainingwatersatuation,relativepermeabilityfor
oilandrelativepermeabilityforwater,respectively. All
valuesareinEngunits
VertCompObj Object - Operations
CalculateIPR()AsBoolean
DisplayDialog(p_VarUnitManager)
AsBoolean
FunctioninvokesVerticalCompletionconfigurationdialog
and
returns
True
if
OK
button
was
clicked,
False
otherwise.
PassaNullvariantastheargumentsvalue.
Page 47
7/24/2019 Open Link Reference Manual
48/161
PIPESIMVersion2011.1OpenLinkReferenceManual
IFlowlineObj Interface
FlowlineObj Object - Properties
HeatTransferAsObject Gets/setsHeatTransferobject
FlowlineObj Object - Get Methods
GetInputOK(infoAsString)As
Boolean
ValidatestheflowlinedataandreturnsTrueifconfiguration
iscorrect,otherwisethefunctionreturnsFalseandinfo
containstheerrormessage
FlowlineObj Object - Operations
AddProfileNode_SI
(distance
As
Double,elevationAsDouble,
ambientTAsDouble,uValueAs
Double,labelAsString)
Adds
a
node
to
the
flowline
detailed
node
description.
All
valuesmustbegiveninstrictSIunits.
ClearDetailedProfile() Deletesallnodesintheflowlinedetailedprofile
UseDetailedProfile(UseDetailedAs
Boolean)
UseDetailed=True:instructstheflowlinetousethedetailed
profiledescription.
UseDetailed=False:usetheflowlinessimpledescription,
detailednodeswillbegeneratedautomatically.
DisplayDialog(p_VarUnitManager)
As
Boolean
Functioninvokesflowlineconfigurationdialogandreturns
True
if
OK
button
was
clicked,
False
otherwise.
Pass
a
Null
variantastheargumentsvalue.
GetNodesCount()AsLong Functionreturnsanumberofnodesdefinedinadetailed
profile
GetPipeOD(odasDouble,unitsas
String)
FunctioncalculatespipesODbasedoncoatingproperties
Page 48Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
49/161
PIPESIMVersion2011.1OpenLinkReferenceManual
IHeatTransfer Interface
HeatTransfer Object - Properties
UValueTypeAsLong Gets/setsUValuetype.Possiblevaluesare0forcalculated,
1forinsulated,2forcoated,3forbareinair,4forbarein
waterand5foruserspecified
IsIFCIncludedAsBoolean Gets/setsaBooleanvalueforinsidefilemcoefficient.Trueif
IFCisincludedinUValueandFalseifitiscalculated
separately.
AmbientFluidTypeAsLong Gets/setsanambientfluidtype.0forairand1forwater.
HeatTransfer Object - Get Methods
GetUValue(uValasDouble,unitsas
String)
ReturnsUValueandunitsstring.FailsifUValueTypeissetto
calculated
GetPipeConductivity(dblValas
Double,unitsasString)
Returnspipeconductivityvalueandunitsstring.Failsif
UValueTypeisnotcalculated
GetAmbientFluidVelosity(dblValas
Double,unitsasString)
Returnsambientfluidvelocityvalueandunitsstring.Failsif
UValueTypeisnotcalculated
GetBurialDepth(dblValasDouble,
unitsasString)
Returnspipeburialdepthvalueandunitsstring.Failsif
UValueTypeisnotcalculated
GetGroundConductivity(dblVal
as
Double,unitsasString)Returns
ground
conductivity
value
and
units
string.
Fails
if
UValueTypeisnotcalculated
GetCoatingData_SI(varData) Returnsapipecoatingdataarray. Firstcolumncontaints
layerspecificconductivityvaluesandasecondcolumn
containtslayerthicknesses.FailsifUValueTypeisnot
calculated
HeatTransfer Object - Set Methods
SetUValue(uValasDouble,unitsas
String)
SetsUValueinspecifiedunits.FailsifUValueTypeissetto
calculated
SetPipeConductivity(dblValas
Double,unitsasString)
Setspipeconductivityvalueinspecifiedunits.Failsif
UValueTypeisnotcalculated
SetAmbientFluidVelosity(dblValas
Double,unitsasString)
Setsambientfluidvelocityvalueinspecifiedunits.Failsif
UValueTypeisnotcalculated
SetBurialDepth(dblValasDouble,
unitsasString)
Setspipeburialdepthvalueinspecifiedunits.Failsif
UValueTypeisnotcalculated
Page 49
7/24/2019 Open Link Reference Manual
50/161
PIPESIMVersion2011.1OpenLinkReferenceManual
SetGroundConductivity(dblValas
Double,unitsasString)
Setsgroundconductivityvalueinspecifiedunits.Failsif
UValueTypeisnotcalculated
SetCoatingData_SI(varData) Setsapipecoatingdata.Datahastobepassedasanarray
wherefirstcolumncontaintslayerspecificconductivity
valuesandasecondcolumncontaintslayerthicknesses.Fails
ifUValueType
is
not
calculated
IFluid Interface
FluidModel Object - Properties
CompositionAsObject AccessestheICompositionalobject(SeeISinglePointCalib
object)
BlackOilAsObject AccessestheIBlackOilobject(RefIBlackOil)
FluidModelTypeAs
Long
Retrieves
the
fluid
model
type:
0:
BlackOil,
1:
Compositional,
2PVTFile,3MFLFile
OverrideValuesAsBoolean Sets/getswhetherWcut/GORvaluesareoverriddenfrom
thevaluesdefinedinthefluidmodel.
WCutoverride_SIAsDouble Accessesthewatercutoverridevalue
GORoverride_SIAsDouble AccessestheGORoverridevalue
OGRoverride_SIAsDouble AccessestheOGRoverridevalue
LGRoverride_SIAsDouble AccessestheLGRoverridevalue
GLRoverride_SIAsDouble AccessestheGLRoverridevalue
GORoverride_TypeAs
Integer
Accesses
which
GOR
type
is
being
overridden
(0=GLR,
1=GOR,2=LGR,3=OGR)
IsLocalFluidAsBoolean Sets/getswhethertheobjectisusingalocalfluidmodel
CompositionTypeAsLong Sets/getswhetherthelocalcompositionisaPVTfileora
definedPIPESIMcompositionorlocalMFLfile
FluidNameAsString Sets/getsafluidname
FluidModel Object - Get Methods
GetInputOK(infoAsString)As
Boolean
ValidatesthefluidmodeldataandreturnsTrueif
configurationis
correct,
otherwise
the
function
returns
False
andinfocontainstheerrormessage
Page 50Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
51/161
PIPESIMVersion2011.1OpenLinkReferenceManual
FluidModel Object - Operations
DisplayDialog(p_VarUnitManager)
AsBoolean
FunctioninvokesfluidconfigurationdialogandreturnsTrue
ifOKbuttonwasclicked,Falseotherwise. PassaNullvariant
astheargumentsvalue.
IProjectInfo Interface
ProjectInfo Object - Properties
DescriptionAsString Gets/setsstringproperty
UserAsString Gets/setsstringproperty
JobAsString Gets/setsstringproperty
CompanyAsString Gets/setsstringproperty
ManagerAs
String
Gets/sets
string
property
RemarksAsString Gets/setsstringproperty
DateAsString Gets/setsstringproperty
FieldAsString Gets/setsstringproperty
WellNumberAsString Gets/setsstringproperty
LeaseAsString Gets/setsstringproperty
CountryAsString Gets/setsstringproperty
AddressAsString Gets/setsstringproperty
EmailAs
String
Gets/sets
string
property
PhoneAsString Gets/setsstringproperty
FaxAsString Gets/setsstringproperty
IErosionCorrosion Interface
ErosionCorrosion Object - Properties
CalculatePHAsLong Gets/setsvalueforActualpHproperty(1calculatevalue,0
use
user
defined
pH
value)
CorrosionEfficiencyAsDouble Gets/setscorrosionefficiencyvalue
CorrosionModelAsLong Gets/setsvalueforCorrosionModelproperty(0none,1
usedeWaard(1995)model)
ErosionEfficiencyAsDouble Gets/setserosionefficiencyvalue
ErosionModelAsLong Gets/setsvalueforErosionModelproperty(0API14e
model,1 SALAMA(2000))
Page 51
7/24/2019 Open Link Reference Manual
52/161
PIPESIMVersion2011.1OpenLinkReferenceManual
ErosionRate_EngAsDouble Gets/setsacceptableerosionratevalue
ErosionVelocityConstAsDouble Gets/setserosionvelocityconstantvalue
GeometryConstantAsDouble Gets/setsgeometryconstantvalue
SandGrainSize_EngAsDouble Gets/setssandgrainsizevalue
SandProdRatioAs
Double
Gets/sets
sand
production
ratio
value
UserDefinedPHAsDouble Gets/setsuserdefinedpHvalue
ProjectInfo Object Example
VBA Sample Code
Di m Si ngl eBr anchObj As New NET32COMLi b. I Si ngl eBr anchModelDi m equi pnames As Var i antDi m sensvar names As Var i ant
Di m obj r ef As Var i ant
Di m count As Long
' Open t he modelSi ngl eBr anchObj . OpenModel C: \ Progr am Fi l es\ Schl umberger \ PI PESI M\ Case Studi es\ OpenLi nk\ Gas Li f t Per f or mance. bps
' Export Psmf i l eDi m Expor t Fi l e As St r i ngDi m Oper at i onFi l e As St r i ngExpor t Fi l e = Si ngl eBr anchObj . Expor t Engi neFi l es2( Oper ati onFi l e)
' Get obj ect i nf or mat i on
Di m count As LongDi m obj t ype As LongDi m obj name As St r i ng
Si ngl eBr anchObj . Get Count Obj ect sI nProf i l e count
' Wr i t e t o the spr eadsheet t he l i st of obj ect s i n t he si ngl e br anch modelFor i ndx = 0 To count - 1
Si ngl eBr anchObj . Get Obj ect At I ndex i ndx, obj t ype, obj nameCel l s( i ndx + 1, 1) = obj nameCel l s( i ndx + 1, 2) = obj t ype
Next
' Get Sensi t i vi t y I nf or mat i on f or t he t ubi ng ( t ype = 16) wi t h i dent i f i er Tub_1Si ngl eBr anchObj . Get Sensi t i vi t yI nf o 16, Tub_1, sensvar names, obj r ef
' Wr i t e t he l i st of sensi t i vi t y var i abl es t o t he spr eadsheet Di m name As Var i antFor Each name I n sensvar namesr . Cel l s( i , 1) = namei = i + 1Next
Page 52Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
53/161
PIPESIMVersion2011.1OpenLinkReferenceManual
INetModel Interface
INetModel Interface - Get Methods
DoesCustomKeyExists(KeyNameas
String)as
Boolean
Returnstrueifcustomdatahasbeenstoredagainstthe
KeyNamestring
GetNameList(ObjectTypeAsLong,
pNameArray,CountAsLong)
ReturnsinpNameArrayanarrayofStringwiththe
namesofobjectsofthegiventype(ObjectType).The
numberofobjectsfoundisreturnedinCount.
ObjectTypecanbeanyof:
1 Folder
2 Source
3 Sink
4Junction
5 Branch
6 TextObject
7 ProductionWell
8InjectionWell
GetHasArtificialLift(ObjectTypeAsLong,
ObjectNameAsString,LiftAsLong)
Returns:
0:noartificiallift
1:gasliftinjection
2:ESP
1:
Object
not
found
ObjectTypemustbeTubingtype(16)
ObjectNamethenameofthetubing
GetEquipmentInfo(EquipmentTypeAs
Long,ParentTypeAsLong,ParentObject
AsString,EquipmentNames,CountAs
Long)
ReturnsthenamesofequipmentoftypeEquipmentType
(SeeGetNameList()fortheISingleBranchobjectfor
availabletypes),whicharepartofthesinglebranch
modelofobjectParentObjectoftypeParentType.
ParentTypeshouldbeProductionWell(7),InjectionWell
(8),orBranch(5)
GetLastError(ErrorStrAsString) Returnsthelasterrormessageproducedbythe
interface
GetBoundaryProperties(ObjectNameAs
String,PressureAsDouble,Temperature
AsDouble,FluidrateAsDouble,Fluidtype
AsLong)
Returnstheboundarypropertiessetinthemodelfor
objectwithidentifierObjectName.ObjectNamemustbe
aboundaryobject(Source,Sink,ProductionWellor
InjectionWell)
Pressuresinpsia
TemperaturesinF
Page 53
7/24/2019 Open Link Reference Manual
54/161
PIPESIMVersion2011.1OpenLinkReferenceManual
Fluidtype=0(liquidrate),FluidrateinSTB/D
Fluidtype =1(gasrate),Fluidrateinmmscf/d
Fluidtype=2(massrate),Fluidrateinlb/s
GetBoundaryProperties_SI
(ObjectNameAsString,PressureAs
Double,TemperatureAsDouble,
FluidrateAsDouble,fluidtypeAsLong)
SimilartoGetBoundaryPropertiesexceptthatthis
functionreturnsthepropertiesinstrictSIunits.
GetBoundaryBlackOil(ObjectNameAs
String,BlackOilAsObject)AsBoolean
GetstheBlackOilobjectusedbythesourcewith
identifierObjectName. OnlyapplicableforBlackOil
models.ThefunctionreturnsTrueincaseofsuccessand
Falseotherwise
GetBoundaryComposition(ObjectName
AsString,CompositionAsObject)As
Boolean
GetstheCompositionalobjectusedbythesourcewith
identifierObjectName.Onlyapplicableforcompositional
models,ThefunctionreturnsTrueincaseofsuccessand
Falseotherwise
GetBoundaryCompositionType
(ObjectNameAsString,TypeAsLong)Returns
the
composition
model
location
used
by
the
ObjectNamesourceobject:
0:objectisusingalocallydefinedcomposition
1:objectisusingalocallydefinedPVTfile
2: objectisusingthemodelsgloballydefined
compositionorPVTfile
3:objectisusingalocallydefinedMFLfile
GetBoundaryPVTFile(ObjectNameAs
String,PVTFilenameAsString)AsBoolean
GetsthePVTfileusedbythesourcewithidentifier
ObjectName.OnlyapplicableforCompositional/PVT
models
GetBoundaryType(ObjectNameAs
String,TypeAsLong,CurveOptionAs
Long)
Returnstheboundaryconditiontypespecifiedforthe
ObjectNamesource:
Type=0pressureand/orflowratespecified
Type=1PQcurvespecified
IfType=1thenCurveOptionreturns:
CurveOption=0createcurvewhenrequired
CurveOption=1createcurveateveryenginerun
CurveOption=2useaspecifiedPQcurvefile
GetCountObjectsInProfile
(NetObjectNameAs
String)
As
Long
Returnsthenumberofobjectsinthesinglebranch
modeldefined
for
NetObjectName.
GetIsModelRunning()AsBoolean ReturnsTrueifsimulationisrunning
GetPropertyNames(ObjectNameAs
String,ParentNameAsString,
PropNames)AsLong
ReturnsinPropNamesthelistofpropertiesdefinedfor
theobjectObjectName.IfObjectNameisdefinedatthe
singlebranchlevelthenParentNamemustbethe
identifierforitsparentNetworkobject.Returnvalueis
thenumberofproperties
Page 54Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
55/161
PIPESIMVersion2011.1OpenLinkReferenceManual
GetPropertyVal(ObjectNameAsString,
ParentNameAsString,PropNameAs
String,pValueAsDouble,pUnitStrAs
String)AsBoolean
Forspecifiedproperty(PropName)inthespecified
object(ObjectName)functiongetsapropertyvaluein
ValueandtheunitsinUnitStr.ReturnvalueisTrueifthe
propertywasretrievedsuccessfully,otherwiseFalse.
ParentNameistheobjectatthenetworkleveland
shoulddefineObjectNameinitssinglebranchmodel.To
getpropertiesofanobjectatnetworklevel,then
ObjectNameneedstobetheobjectnameatnetwork
levelandParentNameneedstobeempty.Implemented
PropNames:seeDefinedconstantsandstrings
GetPropertyValAtObjectIndex
(ObjectNameAsString,ParentNameAs
String,PropNameAsString,pValueAs
Double,pUnitStrAsString,
SubObjectTypeAsLong,IndexAsLong)
AsBoolean
Getsaspecifiedpropertyvalue.
Thisfunctionextendsthefunctionalityof
GetPropertyValbyallowingyoutoretrieveaproperty
fromaspecifiedsubcomponentwithinanobject.A
typicaluseofthisiswhenforinstanceitisrequiredto
getagasliftflowrate(PropName)fromthetop(Index=
0)gas
lift
injection
point
(SubObjectType)
in
the
tubing
Tubing_1(ObjectName). ParentNameistheobjectat
thenetworklevelandshoulddefineObjectNameinits
singlebranchmodel.ForavailableoptionsseeDefined
constantsandstrings
GetPropertyStringAtObjectIndex
(ObjectNameAsString,ParentNameAs
String,PropNameAsString,pValueAs
String,IndexAsLong)AsBoolean
ThefunctionissimilartoGetPropertyValAtObjectIndex
()butforpropertiesdefinedasstring
GetSingleBranchModel(NetObjectName
AsString)AsISingleBranchModel
ReturnstheISingleBranchModelobjectforthe
NetObjectNamespecified
GetNamesInFolder(FolderNameAs
String,ObjectTypeAsLong,pNameArray,
CountAsLong)
ReturnsinpNameArrayanarrayofStringwiththenamesofobjectsofthegiventype(ObjectType).The
numberofobjectsfoundisreturnedinCount.
AllallowedObjectTypevaluesaredescribedfor
GetNameListfunction
GetNodeCooordinates(ObjectNameAs
String,pCoordArray)AsBoolean
ReturnsthearrayofcoordinatesforGUIelementwith
nameinObjectNameparameter.Valuesarecentral
pointX,centralpointY,left,top,right,andbottom
GetConnectionInfo(pBranchArray,
pSNodeArray,pENodeArray)AsBoolean
Returnsthearrayofallbranchnames,thearrayof
startingnodesandthearrayofendingnodesforthose
branches.
Note:Thestartandendnodesaredeterminedbythe
branchgeometry(e.g.,forflowline,itisconsistentwith
thearrowicondirection)
GetBoundaryCurveFile(ObjectNameAs
String)AsString
Returnstheofflinecurvefilenameforthespecifiedwell
name
Page 55
7/24/2019 Open Link Reference Manual
56/161
PIPESIMVersion2011.1OpenLinkReferenceManual
GetCustomData(KeyNameAsString,
pValue)AsBoolean
Returnsavariantbytearrayofthecustomdatathathas
beenstoredagainstthesuppliedKeyNamestring
GetCustomKeys(pKeyNameArray)As
Boolean
ReturnsanarrayoftheKeyNamesstringsforwhich
customdatahasbeenstored
GetFlowrateLimits_SI(ObjectNameas
String)As
Variant
ReturnsatwocolumnarrayofDoublesforspecified
branch.First
column
contains
lower
limits
for
mass
flowrate,liquidflowrate,waterflowrate,oilflowrate
andgasflowrate.Thesecondonecontainsupperlimits
forthesamerates.
Notethatthesupportoflowerlimitshasbeen
discontinuedbuttheinterfacehasnotchanged.
Therefore,thelowerlimitsvaluesreturnedareallunset.
IsLocalFlowCorrelationUsed(ObjectName
asString)AsBoolean
ReturnsTrueisabranchorwelluseslocallydefinedflow
correlationandFalseotherwise
INetModel Interface - Set Methods
SetBoundaryBlackOil(ObjectName
AsString,BlackOilAsObject)As
Boolean
SetsaBlackOilobjecttoagivensource.Thefunction
returnsTrueincaseofsuccessandFalseotherwise
SetBoundaryComposition
(ObjectNameAsString,Composition
AsObject)AsBoolean
Setsacompositionalobjecttoasourcewithidentifier
ObjectName.Onlyapplicableforcompositionalmodels.The
functionreturnsTrueincaseofsuccessandFalseotherwise
SetBoundaryCurveFile(ObjectName
AsString,CurveFileNameAsString)
AsBoolean
Setsthesourceboundaryconditionasdefinedbythecurve
infileCurveFileName.Theformatofthefilemustbethatof
aplot
file
revision
C
or
later.
One
way
to
generate
aboundaryfileisusingtheWellPerformanceCurves
operationinPIPESIM. TheobjectidentifiedbyObjectName
mustbeaProductionWell.
SetBoundaryFluidrate(ObjectName
AsString,FluidtypeAsLong,value
AsDouble,UnitStrAsString)
Setsthegivenvalueinthegivenunitsasfluidrateboundary
conditionforsourceobjectObjectName. Fluidtypecanbe
anyof:
0=liquidrate,1=gasrate,2=massrate
SetBoundaryPressure(ObjectName
AsString,valueAsDouble,UnitStr
AsString)
Setsthegivenvalueinthegivenunitsaspressureboundary
conditionforsourceobjectObjectName.Theboundary
pressurecouldbethepressureofagenericsourcein
network,or
ageneric
source
in
awell
branch,
or
a
completion(bottommostifmultiple)inawellbranch.
SetBoundaryPVTFile(ObjectName
AsString,PVTFilenameAsString)As
Boolean
SetsaPVTfiletoagivensource.PVTFilenamemustcontain
thefullpathtoaPVTfile
Page 56Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
57/161
PIPESIMVersion2011.1OpenLinkReferenceManual
SetBoundarySourcePQPoints
(ObjectNameAsString,PQPoints,
fluidtypeAsLong,PressureUnitsAs
String,FlowrateUnitsAsString)As
Boolean
Setsanumberofpressureandflowratepairsasaboundary
conditiontothereferredObjectName.PQPointsisa2
dimensionalarrayofpressure/flowratevalues.Theobject
mustbeofthetypegenericsource.Numberofdatapoints
cannotexceed30.
SetBoundaryTemperature
(ObjectNameAsString,valueAs
Double,UnitStrAsString)
Setsthe
given
value
in
the
given
units
as
temperature
boundaryconditionforsourceobjectObjectName.The
boundarytemperaturecouldbethetemperatureofa
genericsourceinnetwork,oragenericsourceinawell
branch,oracompletion(bottommostifmultiple)inawell
branch.
SetBoundaryType(ObjectNameAs
String,TypeAsLong,CurveOption
AsLong)
Setsthetypeofboundaryconditionforsourceobject
ObjectName.
Type=0forpressureandflowrateboundarycondition
Type=1forcurve
Ifthe
Type
is
curve
(1)
AND
the
source
object
is
aProductionWellthenCurveOptioncontrolshowthewells
offlinefileiscreatedorused:
CurveOption=0createautomaticallywhenrequired
CurveOption=1createautomaticallyeverytimeengineis
run
CurveOption=2usefile(SeeSetBoundaryCurveFile())
SetPropertyVal(ObjectNameAs
String,ParentNameAsString,
PropNameAsString,valueAs
Double,
UnitStr
As
String)
As
Boolean
Setsthespecifiedproperty(PropName)inthespecified
object(ObjectName)tothevaluegiveninValueinthe
givenunits(UnitStr).FunctionreturnsTrueiftheproperty
was
set
successfully,
otherwise
False.
ParentName
is
the
objectatthenetworklevelandshoulddefineObjectName
initssinglebranchmodel.Ifpropertiesofanobjectat
networklevelneedstobeset,thenObjectNameneedsto
betheobjectnameatnetworklevelandParentName
needstobeempty.ImplementedPropNames:seeDefined
constantsandstrings.
SetPropertyValAtObjectIndex
(ObjectNameAsString,ParentName
AsString,PropNameAsString,value
AsDouble,UnitStrAsString,
SubObjectType
As
Long,
Index
As
Long)AsBoolean
ThisfunctionextendsthefunctionalityofSetPropertyVal
byallowingyoutosetapropertytoaspecifiedsub
componentwithinanobject.Atypicaluseofthisiswhen
forinstanceitisrequiredtosetagasliftflowrate
(PropName)throughthetop(Index=0)gasliftinjection
point(SubObjectType)inthetubingTubing_1
(ObjectName)whichisdefinedforWell_1(ParentName).
ForavailableoptionsseeDefinedconstantsandstrings.
SetPropertyStringAtObjectIndex
(ObjectNameAsString,ParentName
AsString,PropNameAsString,value
AsString,IndexAsLong)AsBoolean
SimilartoSetPropertyValAtObjectIndex()exceptthat
PropNameisastringtypeproperty.
Page 57
7/24/2019 Open Link Reference Manual
58/161
PIPESIMVersion2011.1OpenLinkReferenceManual
SetPVTFile(bstrPVTFilenameAs
String)
Setsthecompositionalfile(.pvt)tobeusedasthemain
fluidinthesimulations
SetSingleBranchModel
(NetObjectNameAsString,filename
AsString)AsBoolean
Setstheunderlyingsinglebranchmodelbywayofits
associated.bpsfiletoanetworkobject.
SetCustomData(KeyNameAs
String,
pValue)AsBoolean
Storesavariant
array
of
byte
data
against
aKeyName
string.Thiscanbeusedtopersistadditionalcustomdata,
andcanlaterberetrievedbyspecifyingtheKeyName
SetFlowrateLimits_SI(ObjectName
asString,Limits)
Setsflowratelimitsforspecifiedbranchpassingatwo
columnarrayofDoubles. Firstcolumncontainslowerlimits
formassflowrate,liquidflowrate,waterflowrate,oil
flowrateandgasflowrate.Thesecondonecontainsupper
limitsforthesamerates.
Note:Thesupportoflowerlimitshasbeendiscontinued
buttheinterfacehasnotchanged.Therefore,thelower
limitsvaluesprovidedarenotstored,norusedandwillbe
overriddenbythedefaultunsetvaluesforflowlimits.
INetModel Interface - Properties
BlackOilDefaultAsObject Gets/setsthedefaultBlackOilmodelto/fromaBlackOil
object
CompositionDefaultAsObject Gets/setsthedefaultcompositionto/fromaComposition
object
FlowCorrelationAsObject Gets/setstheflowcorrelationpropertiesto/froma
FlowCorrelation
object
UseNetworkFlowCorrelationOption
sControlAsLong
Gets/setstheflagvaluetousenetworkflowcorrelation
optionscontrol(if=1)ortouselocalbranchoptions(if=0)
FluidModelTypeAsLong 0:BlackOil,1:Compositional,2:PVTFile,3:MFLFile
LocalFluid(ObjectNameAsString)
AsFluidModel
Gets/setstheFluidobjectforthespecifiedobject
(ObjectName)
ModelFileNameAsString Returnsthefilepathofthecurrentmodel
ModelBuilderAsModelBuilder ReturnsaModelBuilderobject seeModelBuilder
ProjectInfoAsProjectInfo GettheProjectInfoobjecttoaccessprojectspecificdata
ErosionCorrosionAs
Object
Gets/sets
the
ErosionCorrosion
object
UseNetErCorrSettingsAsLong Gets/setstheflagvaluetousenetworkerosion&corrosion
settingsoverlocalbranchessettings(if=1)ortouselocal
settingsotherwise
BottomKeywordsAsString Gets/setsthenetworkenginekeywordstobeaddedat
bottomoftntfile
TopKeywordsAsString Gets/setsthenetworkenginekeywordstobeaddedontop
Page 58Schlumberger Private - Customer Use
7/24/2019 Open Link Reference Manual
59/161
PIPESIMVersion2011.1OpenLinkReferenceManual
oftntfile
AppVersionAsString GetstheversionofPIPESIM
IsLocalFluidUsed(ObjectNameAs
String)AsBoolean
ReturnsTrueifaspecifiedbranchornetworksourceareset
tousealocalydefinedfluidorifaproductionwellis
multilayered. otherwiseapropertyissettoFalse(network
defaultfluid
is
used)
Note:Propertyisreadonly
HeatTransferOptionsPipeBurialMet
hodAslong
Gets/setstheflagvalueforheattransferoptionspipeburial
method:
1983:1983method
2000:2000method(settothisvalueifgivenvalueisnot
1983,2000,or2009)
2009:2009method
HeatTransferOptionsIFCMethodAs
long
Gets/setstheflagvalueforheattransferoptionsinsidefilm
coefficient
method:
1:Kaminsky
2:KreithSeparateReynoldsnumber(settothisvalueifgiven
valueisnot1,or2)
HeatTransferOptionsUValueMultipl
ierAsdouble
Gets/setsthevalueforheattransferoptionsUvalue
multiplier
EnableHydrateSubcoolingCalculatio
nAslong
Gets/setstheflagvalueforheattransferoptionshydrate
subcoolingcalculation:
0:disable
1:enable(settothisvalueifgivenvalueisnot0,or1)
Note:Propertyisforcompositionalmodelsonly
UseNetworkHeatTransferOptions
Aslong
Gets/setstheflagvaluetousenetworkheattransferoptions
(if=1)ortouselocalbranchoptions(if=0)
INetModel Interface - Operations
ExportEngineFiles() ThisfunctiongeneratesanASCIIfile(.tnt)andanumberof
ASCIIfiles(.pst)inthePIPESIMenginekeywordlanguagethat
isusedasinputbythecalculationengine.This.tntfilecan
thenbeusedwithPIPESIMexpertmode.
KillSimulationProcess() Terminatesthesimulationprocess
OpenModel(bstrModelFileNameAs
String)
Opensthegivennetworkmodel.Filenamemustbeavalid
PIPESIMnetworkmodelfile(.bpn)
Thisfunctionmustbecalledfirstwhenusingthisobject.
Note:Willreturnfalsealsoifthenumberofcomponentin
anycompositionorinthemodelingeneralismorethan50.
Page 59
7/24/2019 Open Link Reference Manual
60/161
7/24/2019 Open Link Reference Manual
61/161
7/24/2019 Open Link Reference Manual
62/161
PIPESIMVersion2011.1OpenLinkReferenceManual
ISinglePointCalib object
ISinglePointCalib object Get Methods
GetCalibrationAtBubblePoint
(Pressure_SIAs
Double,
Temperature_SIAsDouble,
SatGas_SIAsDouble)asLong
Functiongetscalibrationdataatbubblepoint. Thereturn
valueis
Saturation
Gas
correlation:
0for
Lasater,
1for
Standing,2forVazquezandBeggs,3forGlaso,4for
Kartoatmodjo,5forDeGhettoetal.or6forPetroskyFarshad
GetCalibrationAboveBubblePoint
(OFVFAsDouble,Density_SIas
Double,Compressibility_SIas
Double,Pressure_SIAsDouble,
Temperature_SIAsDouble)asLong
Functiongetscalibrationdataabovebubblepoint. The
returnvalueisdensitytype:0forDensity,1forOFVFor 3for
Compressibility
GetCalibrationBelowBubblePoint
(OFVFAsDouble,Density_SIas
Double,
Pressure_SI
As
Double,