OpenServer Complete
OpenServer Complete
OpenServer Complete
User Manual
IPM
OpenServer
June 2018
OpenServer
Communication Protocols to use IPM tools using external commands
by Petroleum Experts Limited
OpenServer is designed to provide an Open Architecture for all the Petroleum Experts IPM
products. This will allow the programs to be directly accessed and be driven by other third party
programs.
Copyright Notice
The copyright in this manual and the associated computer program are the property of Petroleum Experts
Ltd. All rights reserved. Both, this manual and the computer program have been provided pursuant to a
Licence Agreement containing restriction of use.
No part of this manual may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated
into any language, in any form or by any means, electronic, mechanical, magnetic, optical or otherwise, or
disclose to third parties without prior written consent from Petroleum Experts Ltd., Petex House, 10 Logie
Mill, Edinburgh, EH7 4HG, Scotland, UK.
IPM Suite, GAP, PROSPER, MBAL, PVTP, REVEAL, RESOLVE, IFM and OpenServer are trademarks of
Petroleum Experts Ltd.
Microsoft (Windows), Windows (2000) and Windows (XP) are registered trademarks of the Microsoft
Corporation
The software described in this manual is furnished under a licence agreement. The software may be used or
copied only in accordance with the terms of the agreement. It is against the law to copy the software on any
medium except as specifically allowed in the license agreement. No part of this documentation may be
reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying,
recording, or information storage and retrieval systems for any purpose other than the purchaser's personal
use, unless express written consent has been given by Petroleum Experts Limited.
Address:
email: [email protected]
Internet: www.petex.com
Table of Contents
0
Part 2 Support 8
June, 2018
Contents II
II
III OpenServer
Constraints.........................................................................................................................................................
and Potential Calculations 102
Obtaining the..........................................................................................................................................................
Results 103
Solver Results
......................................................................................................................................................... 103
Prediction.........................................................................................................................................................
Results 105
Total System
.........................................................................................................................................................
Results 106
Snapshot.........................................................................................................................................................
Results 107
SubFlow Sheets.......................................................................................................................................................... 107
2 GAP ...................................................................................................................................
OpenServer Functions 107
GAP OpenServer
..........................................................................................................................................................
Functions Overview 109
CALCFLOWASSURANCE
.......................................................................................................................................................... 116
CALCGRADIENT(..........................................................................................................................................................
) 117
CALCCOMPDP ..........................................................................................................................................................
(com p) / CALCPUMPDP (pum p) 117
CALCPIPEDP(pipe)
.......................................................................................................................................................... 119
COPYITEM( EquipDest,
..........................................................................................................................................................
EquipSrc ) 120
DELITEM (node)
.......................................................................................................................................................... 120
ISMEMBEROFGROUP(Group)
.......................................................................................................................................................... 121
LINKITEMS ( equip1,
..........................................................................................................................................................
equip2, linklabel ) 121
NEWFILE( ) .......................................................................................................................................................... 121
NEWITEM( type,
..........................................................................................................................................................
label, iposcode, equip, m odel ) 122
Working w.........................................................................................................................................................
ith Flow sheets 123
OPENFILE( filenam
..........................................................................................................................................................
e) 123
PCCALC (equip,
..........................................................................................................................................................
PcCurve) 124
PCGMAX (equip,
..........................................................................................................................................................
PcCurve) 125
PCGSOLV (equip,
..........................................................................................................................................................
PcCurve) 125
PCPSOLV (equip,
..........................................................................................................................................................
PcCurve) 126
PREDDOSTEP..........................................................................................................................................................
(optim ise, potential) 127
PREDDOSOLVER ..........................................................................................................................................................
(tim estepsize, optim ise, potential, m odel) 129
PREDEND(dorest,
..........................................................................................................................................................
optim ise, potential) 129
PREDINIT (ignore
..........................................................................................................................................................
internal tim estep, ignore internal scheduling) 130
PURGEALLRESULTS
..........................................................................................................................................................
(m odel) 131
PURGEPREDLOG ..........................................................................................................................................................
(m odel) 131
PURGEPREDRESULTS
..........................................................................................................................................................
(m odel) 132
PURGEPREDSNAPSHOT
..........................................................................................................................................................
(m odel) 132
PURGESOLVERLOG
..........................................................................................................................................................
(m odel) 132
PURGESOLVERRESULTS
..........................................................................................................................................................
(m odel) 132
REFITPC(w ell)
.......................................................................................................................................................... 133
RESETSOLVERINPUTS
..........................................................................................................................................................
() 133
SAVEFILE( filenam
..........................................................................................................................................................
e) 133
SHUTDOWN (save)
.......................................................................................................................................................... 134
SOLVENETWORK()
.......................................................................................................................................................... 134
TPD.CALC() .......................................................................................................................................................... 135
TRANSFERPROSPERIPR
..........................................................................................................................................................
(w ell, layernum ber, PVTMethod) 136
UNLINKITEMS..........................................................................................................................................................
(equip1, equip2) 137
VALIDATE (solverorpred)
.......................................................................................................................................................... 137
VLPIMPORT (equip,
..........................................................................................................................................................
filenam e) 138
VLPIPRPCGEN ..........................................................................................................................................................
(w ell, autow hp) 138
WELLCALC (w ..........................................................................................................................................................
ell) 139
MOD[i].CopyControls
..........................................................................................................................................................
(from , to, SkipFNAs) 140
MOD[i].ResetControls
..........................................................................................................................................................
(colum n) 141
MOD[i].RESETSCHEDULE
..........................................................................................................................................................
(type, equiptype) 141
MOD[i].VALIDATE
..........................................................................................................................................................
(solverorpred) 141
GROUPS .......................................................................................................................................................... 142
EQUIP[i].ADDTOGROUP
..........................................................................................................................................................
(group) 143
EQUIP[i].BYPASS
..........................................................................................................................................................
() 143
June, 2018
Contents IV
EQUIP[i].DISABLE
..........................................................................................................................................................
() 143
EQUIP[i].ENABLE
..........................................................................................................................................................
() 144
EQUIP[i].ISMEMBEROFGROUP(group)
.......................................................................................................................................................... 144
EQUIP[i].ISCONNECTEDTO(equip)
.......................................................................................................................................................... 144
EQUIP[i].ISRELATEDTO(equip)
.......................................................................................................................................................... 145
EQUIP[i].MASK..........................................................................................................................................................
() 145
EQUIP[i].REMOVEALLGROUPMEMBERSHIPS
..........................................................................................................................................................
() 146
EQUIP[i].REMOVEFROMGROUP
..........................................................................................................................................................
(group) 146
EQUIP[i].UNBYPASS
..........................................................................................................................................................
() 146
EQUIP[i].UNMASK
..........................................................................................................................................................
() 146
EQUIP[i].VALIDATE
..........................................................................................................................................................
(solverorpred) 146
TANK[i].CalcDCTankCurPres(CurProd)
.......................................................................................................................................................... 147
PIPE[i].DOMATCH
..........................................................................................................................................................
() 147
IPR[i].CONINGMATCH
..........................................................................................................................................................
() 148
IPR[i].DISABLE
..........................................................................................................................................................
() 148
IPR[i].ENABLE..........................................................................................................................................................
() 148
IPR[i].IPRMATCH
..........................................................................................................................................................
() 148
IPR[i].MASK ()
.......................................................................................................................................................... 149
IPR[i].UNMASK..........................................................................................................................................................
() 149
IPR[i].COMPOSITION.IMPORTPRPFILE("FilePath")
.......................................................................................................................................................... 149
3 GAP ...................................................................................................................................
Internal Script 149
IV
V OpenServer
Multi-Layer Tool
.......................................................................................................................................................... 198
PVT .......................................................................................................................................................... 199
Material Balance
.......................................................................................................................................................... 203
Production Allocation
.......................................................................................................................................................... 211
Tight Gas .......................................................................................................................................................... 212
Relative Perm..........................................................................................................................................................
eability Curves 213
June, 2018
Contents VI
VI
VII OpenServer
GDT - Gradient
..........................................................................................................................................................
Test Data 320
PLD - Plot Details
.......................................................................................................................................................... 321
COR - Flow Correlation
..........................................................................................................................................................
Data 323
THR - Correlation
..........................................................................................................................................................
Threshold Data 324
8 Artificial
...................................................................................................................................
Lift Design Input Data 324
GasLift Design
.......................................................................................................................................................... 325
Electical Subm
..........................................................................................................................................................
ersible Pum p Design 329
Hydraulic Drive
..........................................................................................................................................................
Dow nhole Pum p Design 333
Progressive ..........................................................................................................................................................
Cavity Pum p Design 334
Jet Pum p Design
.......................................................................................................................................................... 335
Sucker Rod Pum
..........................................................................................................................................................
p Design 336
9 Calculation
...................................................................................................................................
Results 337
INF - Inflow Sensitivity
..........................................................................................................................................................
Calculations 338
SYS - System..........................................................................................................................................................
Sensitivity Calculations 339
GRD - Gradient ..........................................................................................................................................................
Sensitivity Calculations 343
GRD - Flow.........................................................................................................................................................
Regime Number 345
VLP - VLP Sensitivity
..........................................................................................................................................................
Calculations 349
VLP Export......................................................................................................................................................... 350
QLG - QuickLook..........................................................................................................................................................
– GasLift 351
QLE - QuickLook..........................................................................................................................................................
– ESP 356
QLH - QuickLook..........................................................................................................................................................
– HSP 359
TCC - Tubing..........................................................................................................................................................
Correlation Com parison 363
PCC - Pipeline ..........................................................................................................................................................
Correlation Com parison 366
GMT - Gradient ..........................................................................................................................................................
Matching 370
GEN - Generate ..........................................................................................................................................................
For GAP 374
SPD - Sensitivity
..........................................................................................................................................................
PvD 376
GLN - Gas Lift ..........................................................................................................................................................
Design (New Well) 380
GLE - Gas Lift..........................................................................................................................................................
Design (Existing Well) 383
GLI - Gas Lift..........................................................................................................................................................
Design (Interm ittent) 386
ESP - ESP Design
.......................................................................................................................................................... 387
HSP - HSP Design
.......................................................................................................................................................... 389
10 Commands
................................................................................................................................... 391
11 Functions
................................................................................................................................... 401
12 Code...................................................................................................................................
Samples 403
June, 2018
Contents VIII
Saturation Pressure
..........................................................................................................................................................
at Reference Conditions 449
Recom bination
..........................................................................................................................................................
Calculation 449
Allocate: Blending
..........................................................................................................................................................
to a Target GOR 450
VIII
Chapter
1
Technical Overview 2
1 Technical Overview
OpenServer is a powerful utility that allows other programs (such as Excel, programs
written in Visual Basic) to access public functions in IPM to automate data input and
model calculations.
OpenServer can be used to run the IPM Suite of tools in conjunction with other software
applications and exchange data between them. For example, a Visual Basic program
or batch file could be used to successively initialise all IPRs in GAP from MBAL
simulations then retrieve all current IPR data.
OpenServer provides seamless data transfer to and from the PETEX tools to other
applications and database utilities. Also, the client program can use any technique to
access the values in the database, e.g. ODBC, DAO, SQL and then transfer them with
OpenServer to IPM.
The following OpenServer uses is not an exhaustive list, and illustrates some
OpenServer possibilities:
Batch Runs
Consider a situation where a prediction calculation in MBAL has been set up and it is of
interest to check the final recovery for a range of OOIP values.
A spreadsheet in Excel can be created that lists all the OOIP's to be used in the
prediction.
Custom Reporting
Although PETEX products provide a variety of report formats, it is possible that specific
reporting structures are required. A VBA macro within Excel can be written to query the
required values from a PETEX product and then written in the required format to the
spreadsheet.
Data Import/Export
The OpenServer can be used for transferring data to or from a database and PETEX
programs. The client program can use any technique to access the values in the
database (e.g. ODBC, DAO, and SQL) and then transfer them with OpenServer.
For example, production data may be stored in an Access database, a VBA macro can
be written in Access to query the data from the database and then use OpenServer to
set the data in MBAL for instance.
Please see the GAP OpenServer Example D.GAR file that also contains the completed
drilling queue macro.
It is important to note that dynamic links to industry standards process and numerical
reservoir simulators are now available through RESOLVE.
DoGet
This function allows an external program to query a data value in a PETEX
program. It should be possible to obtain the value of any data item that can
normally be viewed using the user interface of the PETEX programs. Each data
item is defined by a unique text string.
Example:
The example syntax for DoGet function is as follows:
The function retrieves the required parameter and set the variable equal to its
value. The parameter is defined by the tag string specified in the quotation marks,
which is unique for each data value in IPM programs.
DoSet
This function allows an external program to change a data value in a PETEX
program. It should be possible to change the value of any data item that can
normally be viewed using the user interface of the PETEX programs. It should be
possible to build a data set from scratch using the DoSet function.
However, it is recommended that the user interface is still used to build parts of a
data set which do not require any automation. This will allow the normal quality
checking to take place which is a very important aspect of the model building
process.
Example:
The example syntax for DoSet function is as follows:
The function set the value of required parameter equal to variable. Again the tag
string defined in the quotation marks corresponds to a particular input parameter
in IPM program.
DoCmd
This function allows calculations to be performed in a PETEX program.
Only a subset of calculations available via the normal user interface of the PETEX
products are available using the OpenServer.
In particular, the DoCmd function supports those calculations which are applicable
to automated use e.g. a GAP prediction.
However it generally does not support those calculations that require the user
interface for correct use e.g. MBAL graphical matching.
Example:
The example syntax
DoCmd ("tag_string")
NOTE:
Unfortunately, VBA was designed for use with simple functions that take only a few
seconds. If a function is called that takes more than one minute to complete, a
timeout error in Excel may occur depending on operating system, Excel version,
setup etc. This is where the DoSlowCmd would be required to replace the
DoCmd sub function.
The DoSlowCmd will also be required if the license server has high traffic where
the speed of communication from the local PC to obtain a license has been
reduced.
The code for these commands has already been setup in the OpenServer template
provided with the software installation.
This OpenServer template is called OpenServer Template.xls and can be found at the
following location:
The OpenServer template can be used as a starting point when building an Excel
based OpenServer utility. Also, the variety of OpenServer example files that have
been constructed for each IPM tool can also be modified to meet individual needs.
The following sections summarizes how to call the functions, syntax examples are also
provided.
Automation
The OpenServer is an Automation server. This means that the public functions can be
called from any program that can act as an Automation client.
There are many programs that can act as an Automation client and can therefore be
used to call the public functions in the PETEX programs.
These include:
– Any VBA macro. These macros are available in Excel, Access and many other
Microsoft products.
– C++ programs can also be written to act as an Automation client and therefore
call the public functions.
Many other products can act as Automation clients and will be illustrated in their
individual documentation.
Batch File
To avoid dependence on Automation, it is also possible to call the public functions in
the PETEX programs using a simple batch file.
2
Support 8
2 Support
The main strength of the OpenServer is that users are now free to develop their own
applications which utilise the public functions within PETEX products. However this does
mean that a user of the OpenServer will require more computing knowledge than the
rest of the PETEX programs. This is particularly the case where a user writes a client
application in VBA or Visual Basic. The user is expected to have (or be trained in) the
requisite computing skills to write these client applications.
Petroleum Experts will not be able to undertake to train users in these
computing skills.
The boundary of the PETEX products and the user’s applications needs to be defined
with respect to support provided by Petroleum Experts of the OpenServer feature.
Firstly, as with normal support, a maintenance agreement between the user and
Petroleum Experts must be in place.
Similarly Petroleum Experts will be unable to assist in fixing bugs in users VBA macros,
batch files or any other OpenServer client.
Petroleum Experts will undertake to support any user who can demonstrate
(through a simple fragment of a batch file or VBA macro etc) that a public
function call to a PETEX product fails to work correctly.
3
Using OpenServer 10
3 Using OpenServer
This chapter describes in detail how to access the public function in PETEX programs.
The Tag Strings section describes how each data item is defined in the PETEX
programs using a variable text string.
The Automation section describes how to call the public functions using Automation.
We first describe the framework needed to use the OpenServer, then each function is
described in detail.
The Batch File section describes how to call the public functions using a batch file
system. We describe the framework and then describe each function in detail.
This section does not deal with specific issues relating to particular products e.g. GAP
or MBAL.
To use the public function for a particular PETEX program, the tools must be installed on
the local hard disk with access to a valid security authentication e.g. security key or
HARDLOCK.
When the public functions are being called (either using Automation or a batch file), the
appropriate PETEX product must be running. However, it does not need to be visible on
the screen (i.e. it can be minimised). Commands are available to start each of the
programs. Alternatively one can start the programs manually before running a macro/
batch file.
Tag strings describe each data item in the PETEX programs. It is a string of characters
which is broken into a number of subnames separated by full stops. As one moves from
left to right along the string, the definition of the variable becomes more detailed.
The tag string of any data item in MBAL always begins with the subname "MBAL".
Similarly, any data item from GAP, PVTP, REVEAL, RESOLVE or PROSPER will begin
with the subname “GAP”, “PVTP”, “REVEAL”, "RESOLVE" or “PROSPER”
respectively.
The rest of the string depends on the section of the program. There may be several
subnames if the data item is part of a complex hierarchy.
For example, for the start time in the material balance prediction we may have
MBAL.MB.PRED.STARTTIME
All tag strings are case insensitive (i.e. it does not matter if lower or upper case
characters are used).
For specific details of the tag strings for each PETEX program, refer to the program
specific sections below.
It is also possible to capture the OpenServer string details directly from the given IPM
tool using a Ctrl + Right-Click keyboard and mouse work-flow.
Please note, it is not possible to capture an OpenServer string using the above
keyboard and mouse work-flow for a calculation button. For a list of IPM OpenServer
command strings, please review the corresponding OpenServer command reference
information.
3.2 Automation
This section describes how to access the public functions using Automation. This is a
Microsoft Windows standard (formally known as OLE Automation). This method
requires software which can act as an Automation client to call the public functions.
Probably the most commonly used example of such an Automation client that is used in
the engineering industry is the VBA macro language within Excel. We will therefore
demonstrate how the public functions are called by such macros – the same rules should
extend to other Automation clients.
Rather than describing the functions in isolation, an example of an Excel VBA macro is
presented that uses all the available public functions. Each function within this example
will be described including macro error handling.
It is important to note that the OpenServer template already contains the necessary
macro communication error handling already built in.
– Get the first oil rate and display it in the Excel spreadsheet.
Option Explicit
Dim Server As Object
Dim AppName As String
Sub DoAll()
Connect 'Establishes Excel communication
link to IPM
AppName = "MBAL"
DoSlowCmd "MBAL.OPENFILE=C:\PETEX\SAMPLES\OIL.MBI"
'See below for an alternative "file open" approach
DoSet "MBAL.MB.TANK.OOIP", "250.0" 'Set the tank
OOIP value
DoSlowCmd "MBAL.MB.RUNPREDICTION" Run the
prediction
Range("C11") = DoGet("MBAL.MB.TRES[2][0]
[0].OILRATE") 'retrieve the first oil rate
Disconnect 'Closes the server object connection to
IPM
MsgBox "Macro completed"
End Sub
Sub DoCmd(Cmd)
Dim lErr As Long
lErr = Server.DoCommand(Cmd)
Sub DoSlowCmd(Cmd)
Dim StartTime As Single
Dim EndTime As Single
Dim CurrentTime As Single
Dim lErr As Long
Dim bLoop As Boolean
lErr = Server.DoCommandAsync(Cmd)
If lErr > 0 Then
MsgBox Server.GetErrorDescription(lErr)
Set Server = Nothing
End
End If
While Server.IsBusy(AppName) > 0
StartTime = Timer
EndTime = StartTime + 2
Do
CurrentTime = Timer
DoEvents
bLoop = True
Rem Check first for the case where we have
Rem gone over midnight and the number of
Rem seconds will go back to zero
If CurrentTime < StartTime Then
bLoop = False
Rem Now check for the 2 second pause
finishing
ElseIf CurrentTime > EndTime Then
bLoop = False
End If
Loop While bLoop
Wend
lErr = Server.GetLastError(AppName)
If lErr > 0 Then
MsgBox Server.GetErrorDescription(lErr)
Set Server = Nothing
End
End If
End Sub
The template OpenServer macro spreadsheet can be used to develop a macro for any
one of the IPM suite of tools.
There are only a few lines of code that need to be in an Excel macro to use
OpenServer. Before using any of the public functions, an object must be declared to
establish the communication link from the VB macro with the PETEX programs:
Next, the object will be connected to the OpenServer using the line:
Alternatively, the above line can be replaced by the Connect function that has been
implemented in the OpenServer template.
The line then simply becomes:
Connect
Once the server is connected, the Server object can be used to call any number of
functions from any or all of the PETEX programs, i.e.,
Server.DoCommand(Command1)
Server.DoCommand(Command2)
Server.GetValue(Var1)
Once the public functions in the macro have completed, the server object connection can
be closed using:
This line can be replaced by the 'Disconnect' function that has been implemented in the
OpenServer template.
The line then simply becomes:
Disconnect
3.2.3 DoCmd
The DoCmd function is used to perform calculations and other functions such as file
opening and saving in the PETEX programs.
Only a subset of the commands available using the user interface are available. The
commands that are not supported are those that require some graphical interaction
such as graphical history matching in MBAL.
In the above example, DoCmd is used twice. The first time it is used to open the
Oil.MBI data file.
The second time it is used for running a prediction. The text string after the DoCmd
statement describes the command to be performed.
The text string always starts with the name of the program in which the calculation is to
be done. The rest of the text string describes the command – check the following
sections describing each PETEX program for a list of possible calculations.
There is no output to the PXR file for this command. If there is any error, a message will
be written to PXBATCH.LOG.
Note that the abbreviation dc can be used in the batch file instead of DoCmd.
NOTE:
As previously mentioned, VBA was designed for use with simple functions that take only
a few seconds. If a function is called that takes more than one minute to complete, a
timeout error in Excel may occur depending on operating system, Excel version, setup
etc. If this happens, the DoSlowCmd should be used instead of the DoCmd.
3.2.4 DoSet Sub Command
The DoSet command is used to set the value of a data item. It should be possible to
change most of the values that can normally be accessed via the user interface. Each
variable is identified by the unique text string that can be captured using a Ctrl + Right-
Mouse Click keyboard and mouse action.
In the above example, the DoSet function is used in the DoAll() subroutine to change the
value of the initial oil in place to 250.0. The variable to be changed is determined by the
first input text string. The new value for the variable is passed in the second input text
string.
This function expects the value to be in the units currently displayed in the user interface.
It is the responsibility of the user writing the macro to ensure that the second text string
contains a valid number if the data item is numerical.
Unlike the DoCmd public function, the DoSet function does not return an error number.
As can be seen in the example macro subroutine DoSet(), the GetLastError() public
function must be called to check if any error occurred. This will return zero if the last
public function call was successful or an error number if not.
Please also see the main on-line help of PROSPER, as it contains a listing of
OpenServer variables and commands.
3.2.5 DoCommandAsync
This function is a variation of the DoCmd function. It is nearly always used in conjunction
with the IsBusy() function.
When a VBA macro is run, it executes and completes each line before moving onto the
next line. So when the DoCmd function is called for a long prediction, it may take
several minutes (or even hours) before the VBA can move onto the next line in the
macro.
Unfortunately, VBA was designed for use with simple functions that take only a few
seconds. If a function is called that takes more than one minute to complete, a timeout
error in Excel may occur depending on operating system, Excel version, setup etc..
Unfortunately it introduces another problem. What if the next line in the macro was a call
to the GetValue function to get the results of the calculation? The macro is likely to try to
get the calculated value before the calculation is finished! So the VBA still needs some
way of knowing when the calculation has finished.
This VBA code to do this is in the macro subroutine DoSlowCmd() in the example
macro. The code loops round until the IsBusy() function returns a value greater than
zero. The only input argument is the name of the PETEX program in which the calculation
was called. Within the loop the code will wait 2 seconds before looping again. It also
calls the VBA function, DoEvents, which will allow other windows program to work whilst
the VBA is waiting for the calculation to finish.
In the above example, the DoGet function is used in the DoAll() subroutine to get the
value of the first oil rate in the prediction tank results. The variable to be retrieved is
determined by the input text string. The return value of the function call is another text
string containing the value of the data item. If the value is numerical data, the return text
string will contain the formatted number and avoids having different functions for different
data types. The value will be returned in the units currently displayed in the user
interface.
As with the DoSet function, the GetLastError function must be used to check for errors
in the SetValue function. Note that in the macro subroutine DoGet, we use a different
function to get the actual error message using GetLastErrorMessage. This function
returns the error message corresponding to the last public function call for the
application specified by the input argument. If the last public function call was
successful, it will return a blank error message.
This section describes how to access the public functions using a batch file. Each
command is typed into an ASCII file. A program is supplied by Petroleum Experts
which reads this ASCII file and calls the public functions in the PETEX programs and
writes the output to another ASCII file.
The first step to calling the public functions from the batch file is to create the batch file
itself. This is a simple ASCII file which can be created using NOTEPAD.EXE.
The only point to note is that when the batch file is saved it should have the file extension
PXB e.g. TEST.PXB.
Example:
# This is my first batch file
# 1st January 2009
The details of how to list the public functions are shown in the following sections.
Once the batch file has been created and the functions listed in the file, we can run the
batch file:
Steps:
1. Run the latest version of the PETEX program that is going to be used e.g. MBAL
and GAP
2. Copy the file PXBATCH.EXE into the same directory as the PXB batch file
(this file can be found in the latest installation of the PETEX DVD (C:\Program
Files\Petroleum Experts\IPM 9)
3. Run the PXBATCH program with the PXB file name as an argument vai the
DOS Prompt utility
For example, if the batch file is called TEST.PXB, in the DOS prompt type: PXBATCH
–b TEST then Enter to run the batch file
PXBATCH will call each public function in turn and two files will be created by
PXBATCH. The first is called PXBATCH.LOG and will contain any error messages
from the batch run so it is important to examine the file after every batch run to check for
errors.
The second file will have the same file stem as the batch file but will have the extension
PXR.
In the above case, the second output file will be called TEST.PXR. This file will contain
any output from the public functions.
An example batch will be presented which shows calls to all the public functions in the
PETEX products. Then each function used in the example batch file will be described in
turn.
The example batch file is as follows (this file is available in the installed MBAL
examples, MBALTEST.PXB):
The output PXR file from the above batch file is as follows:
250 ! MBAL.MB.TANK.OOIP
First oil rate = 16516.8 bbls/day
End of example batch file output
For example, consider the last three lines of the example batch file.
The first of these PRINT statements prints the text “ bbls/day”. The second PRINT
statement moves the next output onto the next line. The third PRINT statement displays
the text “End of example batch file output” on the next line of the PXR file. Note that if the
second PRINT statement was not included, the output PXR file would look like:
The second formatting command is PRINTTAB. This command simply writes a tab
character to the PXR file.
3.3.3 DoCommand
The DoCmd function is used to perform calculations and other functions such as file
opening and saving in the PETEX programs.
Only a subset of the commands available using the user interface are available. The
commands that are not supported are those that require some graphical interaction
such as graphical history matching in MBAL.
In the above example, DoCmd is used twice. The first time it is used to open the
Oil.MBI data file.
The second time it is used for running a prediction. The text string after the DoCmd
statement describes the command to be performed.
The text string always starts with the name of the program in which the calculation is to
be done. The rest of the text string describes the command – check the following
sections describing each PETEX program for a list of possible calculations.
There is no output to the PXR file for this command. If there is any error, a message will
be written to PXBATCH.LOG.
Note that the abbreviation dc can be used in the batch file instead of DoCmd.
NOTE:
As previously mentioned, VBA was designed for use with simple functions that take only
a few seconds. If a function is called that takes more than one minute to complete, a
timeout error in Excel may occur depending on operating system, Excel version, setup
etc. If this happens, the DoSlowCmd should be used instead of the DoCmd.
3.3.4 SetValue
This function is used to set the value of a data item. It should be possible to change most
of the values that can normally be accessed via the user interface.
In the example we use SetValue once to change the original oil in place to 250.0. The
first text string after SetValue defines the variable to be changed. The second text string
defines the new value of the variable. This function expects the value to be in the units
currently displayed in the user interface.
There is no output to the PXR file for this command. If there is any error, a message will
be written to PXBATCH.LOG.
Note that the abbreviation sv can be used in the batch file instead of SetValue.
GetValPrint is used once in the example batch file to get the value of the original oil in
place – this is to verify that the preceding SetValue worked correctly. The text string
after GetValPrint defines the variable to be written to the output PXR file. If the function
works correctly, the variable is written to the PXR file followed by the variable text string,
separated by an exclamation mark. It also moves the output onto the next line so any
further Print functions will start on the next line. This format can be seen in the example
PXR file above.
GetValue is also used once in the example batch file to output the first oil rate in the
prediction tank results. The function is called as for GetValPrint. The only difference is
that this function simply writes the value of the variable to the output PXR file without any
formatting. This means that other Print commands will be needed to format the output –
as shown in the example batch file.
Note that the abbreviation gvp can be used in the batch file instead of GetValPrint. The
abbreviation gv can be used instead of GetValue.
Example:
For example, if we have three tanks in an MBAL model then we access the OOIP of the
first tank using the following tag string:
MBAL.MB.TANK[0].OOIP
Note that the index is zero based. By this, we mean that the 1st item has an index of 0,
the 2nd item will then have an index of 1, etc.
In some cases, one can identify an item in an array using the label of the item rather than
an index. For example if the label of the 1st tank is Lower05, the OOIP can be
accessed using the following tag string:
MBAL.MB.TANK[{Lower05}].OOIP
One must place {} brackets around the label so the program will not interpret the label as
a numerical index.
NOTE:
The label is the only part of a tag string which is case sensitive.
If there is only one item in the list, then the index is optional. For example, if there is only
one tank, the following tag string can be used:
MBAL.MB.TANK.OOIP
There are also some variables that are arrays with two or more dimensions. These
variables will require two or more indices in the tag string.
For example, consider the prediction results for the material balance tool in MBAL.
These have three indices where the first index indicates the result type, the second index
is the tank and the third index is the row.
MBAL.MB[0].TRES[0][0][3].GASSAT
This section describes a number of special features that can only be used with arrays.
3.4.1.1 COUNT
The COUNT feature returns the number of items that exist in an array. This feature only
works for arrays that have a variable size.
For example, the number of tanks in an MBAL model can be found using the command:
Range("C11") = DoGet("MBAL.MB.TANK.COUNT")
This command can also be used in multi-dimensional arrays to count the number of tank
prediction results for instance using the command:
Range("C11") = DoGet("MBAL.MB.TRES[2][3].COUNT")
3.4.1.2 NDIM
The NDIM feature can only be used for fixed length arrays. It is used to find the number
of dimensions in the array.
Range("C11") = DoGet("MBAL.MB.TANK.PV[1][5][9]")
One can find the number of dimensions by calling the following function:
Range("C11") = DoGet("MBAL.MB.TANK.PV.NDIM")
3.4.1.3 DIMSIZE
The DIMSIZE feature can only be used for fixed length arrays. It is used to find the fixed
number of items for a given dimension of the array.
Range("C11") = DoGet("MBAL.MB.TANK.PV[2][7][19]")
One can find the fixed number of items in the second dimensions by calling the following
function:
Range("C11") = DoGet("MBAL.MB.TANK.PV.DIMSIZE[1]")
3.4.1.4 RESET
The RESET feature can only be used for arrays with a variable number of items. It is
used to delete all the items in the array and thus reduce the number of items in the array
to zero.
For example, to delete all the items in the tank production history for an MBAL model,
use the command:
3.4.1.5 SORT
The SORT feature can only be used for arrays with a variable number of items. It is
used to sort all the items in the array in order. The method of sorting is the same as
used in the corresponding dialog of the program.
For example, the tank production history for an MBAL model is sorted by the date of
each item in the array.
3.4.1.6 ADD
The ADD feature can only be used for arrays with a variable number of items. It is used
to add a new item to the end of an array.
For example, to add two rows to an empty table of tank production history for an MBAL
model, use the commands:
3.4.1.7 DELETE
The DELETE feature can only be used for arrays with a variable number of items. It is
used to delete a particular item in the list and it will reduce the number of items in the list
by one.
For example, the following command will delete the 4th row in the production history
table of an MBAL model:
3.4.1.8 INSERT
The INSERT feature can only be used for arrays with a variable number of items and it
is used to insert a new item at a particular position in the list. All the items at and above
the position to insert will be moved up one position in the list, so the new item can be
inserted.
For example, the following command will insert a new row in the production history table
of an MBAL model. The new row will become the 7th row:
This section describes how the DoSet / DoGet functions are used to retrieve and set
more than one item in an array.
Consider a situation where one wishes to extract tank pressures from a 5-tank MBAL
model.
Range("C1") = DoGet("MBAL.MB.TANK[0].PRESS")
Range("C2") = DoGet("MBAL.MB.TANK[1].PRESS")
Range("C3") = DoGet("MBAL.MB.TANK[2].PRESS")
Range("C4") = DoGet("MBAL.MB.TANK[3].PRESS")
Range("C5") = DoGet("MBAL.MB.TANK[4].PRESS")
A quicker method is to get all the pressures in one DoGet call, and there are two
options to achieve the objective:
– Get the pressures for all the available tanks:
Range("C1") = DoGet("MBAL.MB.TANK[$].PRESS")
– Get the pressures for tank index zero through to tank index four:
Range("C1") = DoGet("MBAL.MB.TANK[0,1,2,3,4].PRESS")
The above example using multiple DoGet calls will return all the tank pressures in the
model.
The values will be returned in a single text variable separated by the ‘|’ character. Note,
the "|" character will also occur at the end of the string. For example:
5132.0|4893.0|4598.3|4882.0|4976.6|
There are several other variations which can be used to extract data from multiple tanks
using the following syntax:
– Return the pressure for tank 0,1,2 and 4:
Range("C1") = DoGet("MBAL.MB.TANK[0:2,4].PRESS")
Range("C1") = DoGet("MBAL.MB.TANK[1,3].PRESS")
For the DoSet function, a text variable is passed to the function which contains a list of
the values to set, separated by the ‘|’ character. For example, the following string can be
used to set multiple OOIP's in a multi-tank system to tank 1, 4 and 5:
The above command will set the OOIP of tank index 1 to 250.0, tank index 4 to 129.0
and tank index 5 to 349.0.
There is an extra feature available with the DoSet function, where all tanks specified in
the indices array [1,4,5] can have the same OOIP assigned using the following DoSet
command:
The above technique can be used to set many items in a list to the same value.
Consider the tag name for accessing the production data for an MBAL tank:
MBAL.MB.TANK[2].PRODHIST[4].CUMOIL
This tag identifies the Np for the 4th index of the production history table for the 2nd index
tank.
We have already seen how we could access more than one production history record or
more than one tank e.g.:
MBAL.MB.TANK[2].PRODHIST[3:7].CUMOIL
MBAL.MB.TANK[$].PRODHIST[4].CUMOIL
However we can also have multiple indices for both the production history records and
the tank in the same tag name.
For example:
DoSet "MBAL.MB.TANK[1,2].PRODHIST[4:6]", "11.2|14.5|16.3|5.2|6.1|7.5"
The above command sets indices 4, 5 and 6 of the production history for both tanks 1
and 2. The data in the values to set is ordered such that the index to the right varies
first.
MBAL.MB.TANK[1].PRODHIST[4].CUMOIL
MBAL.MB.TANK[1].PRODHIST[5].CUMOIL
MBAL.MB.TANK[1].PRODHIST[6].CUMOIL
MBAL.MB.TANK[2].PRODHIST[4].CUMOIL
MBAL.MB.TANK[2].PRODHIST[5].CUMOIL
MBAL.MB.TANK[2].PRODHIST[6].CUMOIL
As before, this method will work equally well for the DoGet function.
The example shown above has two arrays. However, it is possible to use multiple
indices for any number of arrays in a tag string e.g. :
MBAL.MB.WELL[1:3].IPR[4,7].CONEMATCH[$][3,5:8].PRESS
For example:
“GAP.MOD[0].WELL[$].MASK()” would mask all the wells.
Underscore (_)
Underscore (_) refers to the last value.
@ Sign and *
@ Sign and * {@Character*} will match equipment starting by the characters specified.
For example:
“GAP.MOD[0].WELL[{@Res1*}].MASK()”
This would mask all the wells start with the label ‘Res1’. This could be utilised when there
are multiple reservoirs being modelled.
@ Sign and ?
The @Letter? Will match any equipment with a starting with the letter(s) specified, which
are of length = specified string + one character.
For example:
DoGet (“GAP.MOD[0].WELL[{@Well?}].Label”)
Will extract the label of all wells which begin with ‘Well’ and have (only) one character
after this string.
Well1|Well!|WellA
@ Sign and #
The @Digit? Will match any equipment with a starting with the characters(s) specified,
which are of length = specified string + one number (i.e. digit).
For example:
“GAP.MOD[0].WELL[{@Well#}].Label”
Will extract the label of all wells which begin with well and have (only) one number after
this string.
Well1|Well2|Well3
@ Sign and !
The @AlphaCharacter! Will match any equipment with a starting with the
alphacharacters(s) specified, which are of length = specified string + one alpha
character (e.g. ,#?!).
For example:
“GAP.MOD[0].WELL[{@Well!}].Label”
Will extract the label of all wells which begin with well and have (only) one alpha
character after this string.
Well£|Well?|Well.
3.7 Units
Units are handled the same way in all the IPM programs.
Example:
If a GAP model has degrees Celcius selected for the surface temperature variable
of pipes, and the value entered for pipe ‘pipe3’ is 10 degrees C, then performing
DoGet (“GAP.MOD[0].PIPE[{pipe3}].TMPSUR”)
Similarly, when a DoSet function is used, the value passed to the function is interpreted
as being in the current unit displayed in the interface.
The units variable is using can be queried using the UNITNAME(tag) function. This
function will return the units label currently in use for that variable.
Example:
The command
DoGet (“GAP.UNITNAME(MOD[0].PIPE[{pipe3}].TMPSUR)”)
“GAP.MOD[0].PIPE[{pipe3}].TMPSUR.UNITNAME”
Example:
The command
DoGet (“GAP.RAWVAL(GAP.MOD[0].PIPE[{pipe3}].TMPSUR)”)
would return 50, since field units for temperature are degrees F.
"GAP.MOD[0].PIPE[{pipe3}].TMPSUR.RAWVAL"
Similarly, if the RAWVAL modifier is used for a tag name with a DoSet function, the
OpenServer will interpret the passed value as being in Oil Field units.
Unit Conversion
The automatic conversion of variable values from field units to user selected units can
be switched off completely if desired. This is accomplished by setting the global
variable DOUNITCONV, which is 1 by default, to zero. E.g.:
Setting the above flag means all subsequent DoGet and DoSet calls will use Oilfield
units. Note that unit conversion can be switched on again by setting the DOUNITCONV
variable back to 1.
Units System
The currently selected units system can be set using the SETUNITSYS() function.
Example:
Performing the command
will set the input and output units to the Norwegian S.I. system for the current MBAL
model.
To get the minimum value of variable, add UNITMIN to the end of the tag name:
Range("C1") = DoGet("MBAL.MB.TANK[0].PRESS.UNITMIN")
Similarly, the maximum validation range of a unit value can be obtained by appending
the tag with UNITMAX.
Minimum and maximum values of a variable with the same tag can be changed by using
the DoSet function.
Example:
Performing the command
The above syntax is shown for MBAL. Other IPM programs can be started using the
same syntax by replacing “GAP” with the appropriate program name i.e., MBAL, PVTp,
PROSPER, REVEAL and RESOLVE.
The tag for regional setting should be set each time the application is started. It is not
stored on the computer.
NOTE:
It is possible that the application will not use regional setting in full, but the values
exchanged via OpenServer will.
For example, in PROSPER the decimal symbol is always dot (.) regardless of the
regional setting. This means that any real number input in the program should have a dot
as decimal symbol.
However, if regional setting of the computer has decimal symbol as comma (,) and
OpenServer is setup to use this regional setting, then the returned parameter will also
have comma as a decimal symbol.
The program can be started manually e.g. using the Start menu.
Alternatively there are two special commands that can be used to start an IPM program
and to shut down an IPM program.
DoCmd "GAP.START()"
This will start the GAP program that was last installed on the working PC.
Other IPM programs can be started using the same syntax by replacing “GAP” with the
appropriate program name i.e., MBAL, PVTp, PROSPER, REVEAL and RESOLVE.
DoCmd “GAP.START(“C:\PETEXPROGS”)”
This will start the GAP program that has been installed in the directory C:
\PETEXPROGS.
Example:
It is also possible to start a given IPM program with the users own timeout period. This
is particularly useful if the IPM executable and licenses are located on a network where it
takes a long period of time to access them. In such cases, the classic timeout period
might be too short.
To start an IPM program with this timeout option, use the command:
DoCmd "GAP.STARTASYNC()"
It will be possible to check whether the program is ready to use by using the following
command:
DoGet "GAP.ISREADY"
The ISREADY command can also be used with the other applications of IPM.
DoCmd “GAP.SHUTDOWN”
This will shutdown the GAP program. It will close the program without asking if the
current data is to be saved, thus it is necessary to make sure the appropriate command
has been used to save the data file prior to using the SHUTDOWN command. Other
IPM programs can be shut down using the same syntax by replacing “GAP” with the
appropriate program name (MBAL, PVTP, PROSPER, REVEAL, RESOLVE).
4
35 OpenServer
OpenServer also provides the added ability to execute field development decisions
during a GAP prediction from dynamically monitoring results at any level of a given
production system. For example, well drilling schedules can be developed from using
OpenServer to monitor an overall plant capacity, then perform drilling and completion
tasks to open new wells to maintain a given plant capacity.
GAP has also made a set of OpenServer commands available, which in addition to
providing a ‘batch’ mode of working, can also be used to interface GAP to other
applications such as process simulators, external optimisers or reservoir simulators.
GAP has also been given a new prediction mode, the step-by-step mode, which allows
users, via OpenServer, to customise GAP prediction runs.
This section lists the variables available to the OpenServer from GAP. Most variables
in GAP are accessed using a tag string consisting of several levels (sections), each
level identifying a record (structure).
All variables from GAP begin with the string “GAP”. This is to allow OpenServer to
differentiate between the different Petroleum Experts products, and the remaining part
of the string identifies the OpenServer variable.
Example:
If we wish to access the surface temperature of the pipe with label ‘pipe3’ in the currently
loaded GAP model, we would use the string
GAP.MOD[0].PIPE[{pipe3}].TMPSUR.
The first section of the string is “GAP”, which identifies the Petroleum Experts product
taken into account. This level is further defined as Top Level.
The next section is “MOD[0]”, which identifies the currently loaded GAP model. This level
is further defined as MOD Level.
The next section is “PIPE[{pipe3}]”, which identifies the pipe element with label “pipe3”.
This level is further defined as Node Level.
The final section is “TMPSUR”, the name of the field in the pipe record that contains the
surface temperature.
Depending of the type of variable to access, all these OpenServer string sections or
only part of them will be used in specific string.
It is important to notice that all the elements of an OpenServer string expressed in-
between brackets and curly brackets are case sensitive. All the other elements of the
OpenServer strings are not case sensitive.
To get the OpenServer tag of a variable, hold the Control key down and right click on
the variable field (or simply right click in the variable field). GAP display an information
box containing the OpenServer tag of the variable related to the field with, in some
cases, a list of possible keywords (see literal constants below) and the current value of
this variable.
For example, if we consider the previous example, and want to access the surface
temperature of the pipe with the ‘pipe3’ label, the following screen will be displayed,
specifying the access string previously described.
The OpenServer variable accessed through this screen can be directly copied on the
clipboard by clicking on the “Copy” button in the screen. The OpenServer variable can
then be directly pasted into the macro code for instance.
For example, if we consider the interface for a well and we hold the control key down
whilst left clicking the help button, the following screen will be displayed:
Double clicking on any of the items in this list will bring up the corresponding
OpenServer string and variable.
A particular string can be entered by hand or copied from the clipboard. Then, the
“Evaluate” button will do the requested operation of:
- DoGet (i.e. obtain the current value of the variable considered)
- DoSet (i.e. set the value of the variable considered)
- DoCommand (i.e. execute a GAP calculation for instance).
Where all elements are to be redefined at the same time using the wildcard to unique
values, this can be achieved by entering the values in GAP element index order
delimited by a | (vertical line/pole). Please note the maximum number of characters
which can be entered to the Value input section is 1023.
Example:
The string
GAP.MOD[{PROD}].WELL[$].IPR[0].PI
will link to the productivity indexes of all the wells of the system, and can be used to
change the productivity indexes of all the wells of the system in one operation.
Example:
Selecting several wells, then executing the following OpenServer statement
GAP.MOD[{PROD}].WELL[$].IPR[0].PI
To specify input and output Units for the opened GAP model the following commands
can be used:
The argument can either be specified as a string or as a number; the following options
are available:
0 = "OilField"
1 = "NorwegianSI"
2 = "CanadianSI"
3 = "GermanSI"
4 = "FrenchSI"
5 = "LatinSI"
Preferences option allows the user to specify the DEFAULT input and output the Unit
System which will be used as a reference. If in this case the GAP file is opened or
reloaded it will be automatically converted into the specified DEFAULT Unit System.
Example:
The following example of code will define default Units System and reloads the GAP file,
to ensure that the file is successfully converted into the units specified:
The GAP internal values for these variables may have to change in the future, making
existing scripts incompatible.
Since version 5.0, GAP uses keywords rather than numerical indexes to represent such
variables.
For instance, the well type is now defined as OilProducerNoLift for a naturally flowing oil
well, OilProducerGL for a gas lifted oil well, OilProducerESP for an ESP lifted oil well,
etc.
If we use the “Ctrl + Right Click” option in order to obtain the OpenServer access string
defining the well type from the GAP well Summary screen, the screen obtained displays
the access string as well as the literal constants available for each variable.
The DoSet command supports both literal and numerical constants. We highly
recommend to use literal constants instead of numerical constants.
To eliminate the short term incompatibility issue of existing scripts when considering a
DoGet command, a new OpenServer variable called OpenServerUseKeywords has
been added. It allows the script to switch on or off the use of literal constants (see
OpenServerUseKeywords below). The default value for this variable is 1 which means
that GAP will use literal constants whenever possible.
It is highly recommended that new OpenServer scripts use literal constants, and that
existing scripts are upgraded as soon as possible. This will hugely reduce the amount of
maintenance required on these scripts in the future.
In the following descriptions, the variables using literal constants will be marked
by an asterisk *.
4.1.6 Date Handling within GAP
By default, the dates in GAP are refered to using a numerical constant format, with the
reference being 01/01/1900, which corresponds to day 1 and a value of 1 for the date
numerical constant.
As soon as a DATE OpenServer keyword is used, it will refer to that type of numerical
format.
If the suffix DATESTR is added after the suffix DATE, i.e. DATE.DATESTR, then the
date will be converted automatically from a numerical format to a day/month/year format,
If the suffix DATETIMESTR is added after the suffix date, then the date will be
converted automatically from a numerical format to a day/month/year hrs/min/sec format.
If the suffix TIMESTR is added after the suffix date, then the date will be converted
automatically from a numerical format to a hrs/min/sec format.
NOTE:
In some cases when the date is retrieved from GAP into the Excel spreadsheet using
DATE keyword, and then internal Excel conversion is used to translate it from numerical
into dd/mm/yyyy format day and month numbers can be flipped with erroneous date in
result. To avoid this CDate() VBA command can be used for date conversion.
4.1.7 Variables at Top Level
DoSet "GAP.EnableNetworkValidation", 0
Alternatively it is possible to access the network via its name. The table provides the list
of indexes and corresponding keywords for all the networks modelled in GAP:
Example:
The following ways are possible to change the network type depending on whether
indexes or literal constants are used:
DoSet ("GAP.MOD[0].SysType"), 2
Since GAP can have four models, i.e., a production model and three associated
injection models, the fields of the variables at MOD level will be divided in three
categories:
- Model Options
- Solver and Prediction Setup
- System Constraints Setup
- Model Equipment List
TaxRegimeList[i].CostPow Refers to the cost of power fluid in the ith tax regime of the
erFluid tax regime list.
TaxRegimeList[i].CostWat Refers to the cost of water processing in the ith tax regime
er of the tax regime list.
TaxRegimeList[i].Name Contains the name of the tax regime considered.
The index refers to the row index of the tax regime
considered in the tax regime list.
TaxRegimeList[i].Revenue Refers to the gas price in the ith tax regime of the tax
Gas regime list.
TaxRegimeList[i].Revenue Refers to the oil price in the ith tax regime of the tax regime
Oil list.
WINJNAME Contains the filename of the associated water injection
system.
solver optimiser.
SolverStatusList[i].OptBestGuess Returns the optimiser best guess associated with
the ith sensitivity case of the solver.
SolverStatusList[i].Status Returns the status of the last solver run for the ith
solver sensitivity.
The values characterising this variable are as
follows:
0 = the last solver run did not experience
any error
#0 = the last solver run did experience an
error.
SolverStatusList[i].StatusText Returns a text string describing the last solver run
error for the ith solver sensitivity case.
SolverStatusList[i].ViolatedConstrai Returns the number of constraints violated during
nt.count the ith solver run.
SolverStatusList[i].ViolatedConstrai Returns the type of equipment to which the jth
nt[j].EquipType violated constraint message of the ith solver run
refers to.
SolverStatusList[i].ViolatedConstrai Returns the ID of the system equipment to which
nt[j].EquipUniqueID the jth violated constraint message of the ith
solver run refers to.
SolverStatusList[i].ViolatedConstrai Returns the label of the system equipment to
nt[j].EquipLabel which the jth violated constraint message of the ith
solver run refers to.
SolverStatusList[i].ViolatedConstrai Returns the binding status of the jth violated
nt[j].Binding constraint message of the ith solver run:
0 = constraint is not binding
1 = the constraint is binding.
SolverStatusList[i].ViolatedConstrai Returns the calculated value of the jth violated
nt[j].CalcValue constraint message of the ith solver run.
SolverStatusList[i].ViolatedConstrai Returns the constraint value of the jth violated
nt[j].CnstValue constraint message of the ith solver run.
SolverStatusList[i].ViolatedConstrai Returns the description of the type of the jth
nt[j].CnstDesc constraint (e.g. Max Water Rate) violated in the ith
solver run.
SolverStatusList[i].ViolatedConstrai Returns the text message of the solver log related
nt[j].msg to the jth violated constraint message of the ith
solver run.
D days.
PREDINFORESTART.STAR Contains the prediction restart date in a numerical date
T format.
PREDINFORESTART.STEP Contains the prediction restart timestep length.
PREDINFORESTART.STEP Contains the prediction restart timestep length unit.
UNIT
GAP.PREDRESTART Performs the restart prediction calculation
NOTE:
To perform a restart prediction, replace GAP.PREDINIT
with GAP.PREDRESTART
Example:
NumSteps =
DoGAPFunc("GAP.PREDRESTART()")
For more information on macro code structure to perform a prediction, please see
Basic_Code_Structure.
4.1.8.2 Model Equipment List
As described previously, OpenServer strings at the MOD level enable to define the
overall model and calculation procedures setup.
In order to access the parameters related to one specific element of the model i.e., a
well, reservoir, etc., it will be necessary to specify the element using an element tag at
the MOD level.
The MOD variable contains the ‘node lists’, i.e. the lists of wells, tanks etc., that are
defined in the GAP model. Each list contains nodes of the same type, such as TANK,
WELL, PIPE and so on. The EQUIP list contains all the elements defined in the GAP
model regardless of their type
The name of the list taken into account as well as either the numerical index (i.e.
TANK[3]) or the element label of the element considered (i.e. TANK[{T1}]) needs to be
added to the MOD section of the string to be able to access the element. This will
enable to pass from the MOD level to the NODE level of the OpenServer string.
The element lists used in GAP are defined as follows:
GAP.MOD[{PROD}].<equipmenttype>[{<equipmentname>}].Bound.Left
GAP.MOD[{PROD}].<equipmenttype>[{<equipmentname>}].Bound.Top
The centre of coordinate system is set in the middle of the screen. As such it is possible
to use both positive and negative coordinates. The values of coordinates are not limited.
NOTE:
The coordinate system is not fixed. Every time the screen is normalised (View|
Normalise Equipment Icon Position) the view is adjusted such that the entire network
can fit in the window. This is done by placing boundary icons at the edge of the screen.
In this case the coordinate system centre changes. Therefore when setting up the
network layout via OpenServer all the icons should be adjusted at once, then the screen
can be normalised..
Example:
To set the well icon position 1000 coordinate units to the right of the centre the following
syntax can be used
DoSet("GAP.MOD[0].WELL[{Well1}].BOUND.LEFT"), 1000
GAP.MOD[i].TANK[j]
Where the index i refers to the type of model considered (i.e. refers to the Variables at
MOD level, MOD[i] section) and the index j refers to the name or numerical index of the
element considered (i.e. refers to the Model Equipement List, see
Model_Equipment_List).
Example:
To access the MBAL tank ID of a node with label t1, one could use the command
DoGet(“GAP.MOD[0].TANK[{t1}].TANKID”)
or equivalently
DoGet(“GAP.MOD[0].EQUIP[{t1}].MBALNUM”)
NOTE:
These OpenServer variables are also available for both groups preceded by the
following OpenServer string structure:
GAP.MOD[i].GROUP[j]
GAP.MOD[i].GROUP[j].MEMBER[k].
All the following variables will need to be preceded by the following OpenServer string
structure:
GAP.MOD[i].WELL[j]
Where the index i refers to the type of model considered at the MOD level i.e., MOD[i]
section and the index j refers to the name or numerical index of the well considered.
Downtime Section
DOWNTIME Contains the downtime value associated with the well
considered.
dP Control Section
AlqControl * Contains the status of the artificial lift control parameter.
The following keywords are used:
CALCULATED = The artificial lift system is controlled by
the optimiser
FIXEDVALUE = The artificial lift system is not controlled
by the optimiser.
AlqValue Contains the value of the artificial lift parameter used or
calculated from allocation result.
Depending of the type of artificial lift consider, this parameter
will refer to:
– Power Fluid Rate (Diluent Injection Well, HSP Lifted
Well, Jet Pump Lifted Well)
– ESP Frequency (ESP Lifted Well)
– Pump Speed (PCP Lifted Well)
AlqValueMax Contains the maximum value the artificial lift parameter can take
when controlled by the optimiser.
The type of artificial lift parameters considered are listed in the
AlqValue row.
! Does not include gas lifted systems (see MAXQINJ).
AlqValueMin Contains the minimum value the artifial lift parameter can take
when controlled by the optimiser.
The type of artificial lift parameters considered are listed in the
AlqValue row.
! Does not work in gas lifted system (see MINQINJ).
DPControl * Contains the status of the wellhead choke control.
The following keywords are used:
CALCULATED = The wellhead choke (i.e. and therefore
the corresponding pressure drop) is controlled by the GAP
optimiser accordingly to the constraints set on the model.
FIXEDVALUE = A fixed dP is applied at the wellhead.
NONE = The wellhead choke cannot be controlled by the
optimiser.
DPControlValue Contains the value of the wellhead choke generated pressure
drop or the value of the chosen fixed pressure drop at the
wellhead.
InjectedFluidLabel Contains the label of the injection fluid considered.
MAXQINJ Contains the maximum gas lift gas available.
MeasuredAlq Contains the amount of gas lift gas injected in the system.
MINQINJ Contains the minimum gas lift gas available.
PowerFluidMode* Refers to the type of power fluid circulation mode used.
The following keywords are used:
Commingled
ClosedLoop
IPR Section
CurEditLayer Contains the numerical index of the layer considered.
Will return 0 for the first layer, 1 for the second layer and so
on.
IPR[i] Contains the array of the IPR record.
If located before a specific parameter, this string refers to
the value of this specific parameter for the ith IPR description
considered.
Example:
DoGet(“GAP.MOD[0].Well[{Well 1}].IPR[0].ResPres”)
The command will return the reservoir pressure associated
with the oth layer of the well 1.
IPR[i].BrkGasCon Contains the Gas Oil Contact depth at breakthrough
IPR[i].BrkGasSat Contains the Gas Saturation at breakthrough
IPR[i].BrkPerfTop Contains the top depth of the perforated interval
IPR[i].BrkPerfBot Contains the bottom depth of the perforated interval
IPR[i].BrkWatCon Contains the Water Oil Contact depth at breakthrough
IPR[i].BrkWatSat Contains the Water Saturation at breakthrough
IPR[i].C Contains the C factor value used for gas wells IPRs
IPR[i].CGR Contains the CGR of the layer fluid
IPR[i].CORRRELPERM Contains the status of the shift relative permeabilities to
breakthrough facility.
The following numerical indexes are used:
0 = The option is not activated
1 = The option is activated
IPR[i].DarcyCoeff Contains the Darcy coefficient value for gas wells IPRs
IPR[i].DISABLE() Used together with a DoCmd structure, will disable the ith
layer of the well. See IPR[i].MASK()
IPR[i].ENABLE() Used together with a DoCmd structure, will enable the ith
layer of the well
IPR[i].GasGravity Contains the gas specific gravity for the layer fluid
IPR[i].GOR Contains the current GOR of the layer fluid
IPR[i].IPRType * Contains the type of IPR model used to characterize the
inflow performance of the well.
IPR[i].MWGR Contains the layer test WGR (with PI correction for mobility
activated)
IPR[i].N Contains the N value used for gas wells IPRs
IPR[i].NonDarcyCoeff Contains the non-Darcy coefficient used for gas IPRs
IPR[i].OffsetPressure Contains the value of the IPR offset pressure if any
IPR[i].OilGravity Contains the oil specific gravity for the layer fluid
IPR[i].PctCO2 Contains the CO2 mole percentage for the layer fluid
IPR[i].PctH2S Contains the H2S mole percentage for the layer fluid
IPR[i].PctN2 Contains the N2 mole percentage for the layer fluid
IPR[i].PERMCORRN Contains the value of the permeability compaction correction
exponent
IPR[i].PI Contains the Productivity Index value of the layer considered
IPR[i].PICorrRelPerm Contains the status of the PI correction for mobility.
The following numerical indexes are used:
0 = The PI correction for mobility is not activated
1 = The PI correction for mobility is activated
IPR[i].PRODDATA[i][j] Contains an array of production data values. Used only when
the MBAL tank is modeled using decline curve.
The following numerical indexes are used:
i = Refers to the input row considered
j = Refers to the parameters considered (i.e 0 for
cumulative production, 1 for GOR / CGR and 2 for
Water Cut / WGR)
IPR[i].ProdDataInterpolati Refers to the type of interpolation used in the model when
onMode* using a decline curve MBAL tank. The following keywords
are used:
CumProd = Interpolate on Cumulative Production
ResPres = Interpolate on Reservoir Pressure
IPR[i].RELPERM1.EXGA Contains the gas relative permeability exponent value
S described in the Rel Perm1 relative permeability dataset.
NOTE: In all similar variables described below, if
RELPERM2 is used, then it will refer to the Rel Perm 2
relative permeability dataset.
NOTE: In previous versions, the string RELPERM.EXGAS
was used. In terms of backward compatibility, this type of
string will refer to the Rel Perm 1 relative permeability
dataset
IPR[i].RELPERM1.EXOIL Contains the oil relative permeability exponent value
described in the Rel Perm1 relative permeability dataset
IPR[i].RELPERM1.EXW Contains the water relative permeability exponent value
AT described in the Rel Perm1 relative permeability dataset
IPR[i].RELPERM1.SGR Contains the gas residual saturation value described in the
Rel Perm1 relative permeability dataset
VLP Section
AllowLeftVLPIPRIntersect Contains the status of the the type of VLP intersection.
ion The following indexes are used:
0 = Left Hand side VLP/IPR intersection is not
considered
1 = Left Hand side VLP/IPR intersection is considered
ForceVLPIPRIntersection Contains the status of the the type of intersection
considered.
The following indexes are used:
0 = Left Hand side VLP/IPR intersection is not
considered
1 = Left Hand side VLP/IPR intersection is forced
SafeVLPIPRIntersection Contains the status of the the type of intersection
considered.
The following indexes are used:
0 = The safe VLP/IPR intersection routine is not
activated
1 = The safe VLP/IPR intersection routine is activated
TurnOffIfUnstable Contains the status of the the type of intersection
considered.
The following indexes are used:
0 = The Turn off well if unstable VLP/IPR intersection
routine is not activated
1 = The Turn off well if unstable VLP/IPR intersection
routine is activated adn the well will be switched off if a
negative VLP slope is detected intersecting the IPR
VLPFile Contains the name and path of the VLP file used to describe
the outflow performance of the well
Coning Section
CMNUMPOINTS Contains the number of coning match points considered
CVALID Contains the status of the coning input data set.
The following numerical indexes are used:
0 = The dataset required for coning calculation is not
valid
1 = The dataset required for coning calculation is valid
IPR[i].TConeData.Anisotr Contains the reservoir vertical anisotropy value
opy
IPR[i].TConeData.EXP Contains the value of the coning model exponent
IPR[i].TConeData.F2 Contains the value of the coning model F2 parameter
IPR[i].TConeData.F3 Contains the value of the coning model F3 parameter
IPR[i].TConeData.GOC Contains the depth of the tank GOC
IPR[i].TConeData.Match Contains the Liquid Rates corresponding to the ith test
QL[i] measurement used in the coning calculation
IPR[i].TConeData.Match Contains the GOR corresponding to the ith test
GOR[i] measurement used in the coning calculation
IPR[i].TConeData.TestG Contains the depth of the GOC at the test prevailing date
OC
IPR[i].TConeData.TestPr Contains the reservoir pressure at the test prevailing date
es
IPR[i].TConeData.TestW Contains the water cut at the test prevailing date
C
IPR[i].TConeData.Perme Contains the reservoir permeability value
ability
TConeData.LayerEnable Contains the status of the coning calculation in the layer
d considered.
The following numerical indexes are used:
0 = The coning calculation is not activated
1 = The coning calculation is activated
Example:
To access the file name of the VLP File associated with a well labelled w1, one could
use the string “GAP.MOD[0].WELL[{w1}].VLPFILE”, or, equivalently,
“GAP.MOD[0].EQUIP[{w1}].VLPFILE”.
From PROSPER
PC Data Section
IType Refers to the parameter used to describe the amount of gas
considered for each PC dataset.
The following numerical indexes are used:
0 = Gas Lift Gas Injection Rate
1 = Gas Liquid Ratio
MANIPRES[i] Contains the manifold pressure at which the ith set of PC data refers
to.
PCDATA[i][j][k] Contains the different parameters of the PC dataset.
The first index [i] refers to the dataset row and is only valid if more than
one dataset has been entered at one specific manifold pressure, as it
can be the case with gas lifted wells for instance.
The second index [j] refers to the parameter considered. The following
numerical indexes are used:
0 = Either Oil Rate or Liquid Rate depending of the PC Type
choice.
1 = Water Cut
2 = GOR
3 = Flowing Bottom Hole Pressure
4 = Oil Gravity or Condensate Gravity
5 = Gas Gravity
6 = Gas Lift Gas Injected or Gas Liquid Ratio depending of the
IType choice
7 = Temperature
8 = H2S mol. percentage
9 = CO2 mol. percentage
10 = N2 mol. percentage
11 = Gas Rate
12 = Water to Gas Ratio
13 = Water Salinity
14 = Condensate to Gas Ratio
1 = Oil Rates
From VLP/IPR
Coning Section
Similar to the VLP/IPR Well model
IPR Section
Similar to the VLP/IPR Well model
PC Data Section
Similar to the From PROSPER PC Well model
VLP Section
Similar to the VLP/IPR Well model
All the following variables will need to be preceded by the following OpenServer string
structure:
GAP.MOD[i].INFLOW[j]
Where the index i refers to the type of model i.e., refers to the Variables at MOD level,
MOD[i] section) and the index j refers to the name or numerical index of the element.
Coning Section
Similar to the VLP/IPR Well model
Downtime Section
Similar to the VLP/IPR Well model
IPR Section
Similar to the VLP/IPR Well model
RateType Sets the rate type of the inflow model used.
All the following variables will need to be preceded by the following OpenServer string
structure:
GAP.MOD[i].WELL[j]
Where the index i refers to the type of model considered (i.e. refers to the Variables at
MOD level, MOD[i] section) and the index j refers to the name or numerical index of the
well considered.
VLP Section
Similar to the VLP/IPR Well model
GAP.MOD[i].WELL[j].TransientDesc
Where the index i refers to the type of model considered at the MOD level i.e., MOD[i]
section and the index j refers to the name or numerical index of the well considered.
IPR Section
Similar to VLP/IPR model
VLP Section
Similar to VLP/IPR model
Coning Section
Similar to VLP/IPR model
Constraints Section
Similar to VLP/IPR model
Downtime Section
Similar to VLP/IPR model
Coning Section
Similar to VLP/IPR model
Schedule Section
Similar to VLP/IPR model
Description Section
Desc[i].Type Contains the pipe section j type code.
The following codes are used:
0 - Choke
1 - Coated
2 - Fitting
3 - Flexible
4 - Pipe
5 - TransientFitting
Desc[i].Length Contains the length of segment i
Desc[i].TVD Contains the TVD/elevation change of segment i
Desc[i].ID Contains the tubing ID of segment i
Desc[i].Roughness Contains the roughness of segment i
Desc[i].MaxStepLength Contains the max step length of segment i (when specifying
this per segment)
Desc[i].Tubing Contains the tubing OD of segment i
Desc[i].CasingID Contains the casing ID of segment i
Environment Section
TMPSUR Contains the temperature of the surroundings
HTCSUR Contains the heat transfer coefficient of the surroundings
CPO Contains the specific heat capacity of oil
CPG Contains the specific heat capacity of gas
CPW Contains the specific heat capacity of water
Simulation Section
TransientSim.Initialisation Contains the initialisation method of the transient simulation
Method 0 - ReservoirFluid
1 - Static
2 - Steady State
3 - UserSpecified
TransientSim.BoundaryC Contains the calculated boundary condition
alculated 0 - UPSTREAM
1 - DOWNSTREAM
TransientSim.UpstreamP Contains the pressure of the upstream boundary
ressure
TransientSim.Downstrea Contains the pressure of the downstream boundary
mPressure
TransientSim.UpstreamFl Contains the specified upstream fluid
uid
TransientSim.Downstrea Contains the specified downstream fluid
mFluid
TransientSim.LiquidLevel Contains the liquid level
4.1.9.4.7 Equipment Control Section
(i.e. Previously Actual and Production Validation sections)
All the following variables will need to be preceded by the following OpenServer string
structure:
GAP.MOD[i].WELL[j]
Where the index i refers to the type of model considered (i.e. refers to the Variables at
MOD level, MOD[i] section) and the index j refers to the name or numerical index of the
well considered.
When using the PROSPER Online option for wells in GAP, the PROSPER variables
available through OpenServer within PROSPER will also be available from GAP.
The strings used for these variables are similar to the strings used within PROSPER,
replacing the PROSPER prefix by a GAP.MOD[i].WELL[j].PrpData prefix.
The general string structure for accessing PROSPER Online variables through GAP
OpenServer will therefore be the following:
GAP.MOD[i].WELL[j].PrpData.k
Where the index i refers to the type of model considered (i.e. refers to the Variables at
MOD level, MOD[i] section), the index j refers to the name or numerical index of the well
considered (i.e. refers to the Model Equipement List) and the index k refers to the
PROSPER OpenServer string associated with the parameter considered.
Example:
To access the solution GOR input within the PROSPER Online section of a well labeled
Well1, the following string can be used:
GAP.MOD[0].WELL[{Well1}].PrpData.PVT.Input.Solgor
As described previously, this string is exactly similar to the one that is used to refer to
the solution GOR in a PROSPER model i.e., PROSPER.PVT.Input.Solgor, except that the
PROSPER prefix has been replaced by the GAP prefix.
NOTE:
Please note that GAP.MOD[i].EQUIP[j].PrpData prefix is used to read/write the data for
PROSPER Online models. It is not possible to carry out the calculations with this
command.
All the following variables will need to be preceded by the following OpenServer string
structure:
GAP.MOD[i].WELL[j].IPR[k]
Where the index i refers to the type of model considered at the MOD level i.e., MOD[i]
section and the index j refers to the name or numerical index of the well considered.
The following codes may be used to get the information about the Relative Permeability
Curves for Fractional Flow information when the option is set to USE REL PERM 1 or
USE REL PERM 2.
Example:
The following code may be used to extract the Residual Saturation of Water for USE
REL PERM 1 option that is defined for IPR Layer 0 for Well W1 to cell (10,2)
Cells(10, 2) =
DoGet("GAP.MOD[{PROD}].WELL[{W1}].IPR[0].FRACFLOW1.RESSAT.Krw")
The following codes may be used to get the information about the Relative Permeability
Curves for Fractional Flow information when the option is set to FROM TABLE 1 or
FROM TABLE 2.
Example:
The following code may be used to extract the Water Cut for data point number 1 set in
TABLE 1 option that is defined for IPR Layer 0 for Well W1 to cell (10,3)
Cells(10, 3) =
Doget("GAP.MOD[{PROD}].WELL[{Well1}].IPR[0].FRACFLOW1.FFTABLE[0].W
ATCUT")
4.1.9.5 Fields specific to pipelines
All the following variables will need to be preceded by the following OpenServer string
structure:
GAP.MOD[i].PIPE[j]
Where the index i refers to the type of model considered such as production, injection,
etc., and the index j refers to the name or numerical index of the element considered.
pipe.
MAXPRESSURE Contains the maximum pressure constraint applied on the
pipe.
MAXVELOCITY Contains the maximum velocity constraint applied on the
pipe.
GAP Description
UnderModel Contains the sub-model used when using the GAP Lift
curve modelling facilities for pipelines.
The different sub-models are described using the following
numerical indexes:
0 = External
1 = GAP Internal Correlations
2 = PROSPER Online
3 = PROSPER file
External Model
Lift Curves
VLPFile Contains the name and path of the file used to describe
the pipeline lift performance curves.
PROSPER Online
Lift Curves
Similar to the GAP 'Lift Curves' / 'Externa'l model.
PROSPER Data
Refer to PROSPER Online Section
PROSPER File
PROSPER File
File Contains the name and path of the PROSPER file used to
describe the pipeline section.
Lift Curves
Similar to the GAP 'Lift Curves' / GAP 'Internal
Correlations' model
When using the PROSPER Online option for pipelines in GAP, the PROSPER variables
available through OpenServer within PROSPER will also be available from GAP.
The strings used for these variables are similar to the strings used within PROSPER,
replacing the PROSPER prefix by a GAP.MOD[i].PIPE[j] prefix.
The general string structure for accessing PROSPER Online variables through GAP
OpenServer will therefore be the following:
GAP.MOD[i].PIPE[j].k
Where the index i refers to the type of model considered (i.e. refers to the Variables at
MOD level, MOD[i] section), the index j refers to the name or numerical index of the
pipeline considered (i.e. refers to the 'Model Equipement' list) and the index k refers to
the PROSPER OpenServer string associated with the parameter considered.
Example:
To access the overall heat transfer coefficient of a pipeline modeled with GAP Internal
Correlations with labelled 'p1' the following string can be used
GAP.MOD[{PROD}].PIPE[{p1}].SIN.EQP.Surf.Htc
This string is similar to the one for wells setups as PROSPER Online, the only difference
is the 'no PrpData' prefix is required
NOTE:
Again the access strings with GAP.MOD[i].PIPE[j] prefix is used to read/write the data
for PROSPER Online pipeline models. It is not possible to carry out the calculations with
this command.
4.1.9.5.5 Transient Pipeline
Simulation Section
TransientSim.Initialisation Contains the initialisation method of the transient simulation
Method 0 - ReservoirFluid
1 - Static
2 - Steady State
3 - UserSpecified
TransientSim.BoundaryC Contains the calculated boundary condition
alculated 0 - UPSTREAM
1 - DOWNSTREAM
TransientSim.UpstreamP Contains the pressure of the upstream boundary
ressure
TransientSim.Downstrea Contains the pressure of the downstream boundary
mPressure
TransientSim.UpstreamFl Contains the specified upstream fluid
uid
TransientSim.Downstrea Contains the specified downstream fluid
mFluid
TransientSim.LiquidLevel Contains the liquid level
4.1.9.6 Fields specific to joints
All the following variables will need to be preceded by the following OpenServer string
structure:
GAP.MOD[i].JOINT [j]
Where the index i refers to the type of model considered at the MOD level i.e., MOD[i]
and the index j refers to the name or numerical index of the element considered i.e.,
EQUIP[i] section.
Example:
To access the maximum gas rate constraint applied on the node N1, one could use the
string
GAP.MOD[0].JOINT[{N1}].MAXQGAS.
Where the index i refers to the type of model considered at the MOD level i.e., MOD[i]
section and the index j refers to the name or numerical index of the element
considered i.e., EQUIP[i] section.
DELTAP Contains the value of the pressure drop across the compressor
(Fixed Pressure Drop Model).
PEff Contains the compressor overall efficiency (Fixed Power
Model).
PolyEff Contains the compressor polytropic efficiency.
PPower Contains the value of the horsepower by stage developed by the
compressor (Fixed Power Model).
StageData[i].UseCoo Refers to the status of the cooling process for the compressor.
l The index refers to the stage considered:
0 = Before compression process
1 = After compression process
The following indexes are describing the separation status:
0 = No Cooling
1 = A Cooling process exists
StageData[i].CoolDat Contains the description of the cooling process if any.
a[j] The index refers to the stage considered:
0 = Before compression process
1 = After compression process
The following indexes are describing the fluid phases
considered:
0 = Cooler Temperature.
1 = Cooler Efficiency.
UsePoly Contains the use polytropic head facility status.
The following numerical indexes are used:
0 = Do not use the polytropic head facility. Assumes the
head in the performance data used is based on an
isentropic cycle.
1 = Do use the polytropic head facility. Assumes the head
in the performance data used is based on a polytropic
cycle.
Example:
To access the design speed of a node with label c1, one could use the string
GAP.MOD[0].COMP[{c1}].DESSPEED.
All the following variables will need to be preceded by the following OpenServer string
structure:
GAP.MOD[i].SEP[j]
Where the index i refers to the type of model considered (i.e. refers to the Variables at
MOD level, MOD[i] section) and the index j refers to the name or numerical index of the
element considered (i.e. refers to the Model Equipement List, EQUIP[i] section).
Variable Description
Name
SubType * Contains the type of separation node considered:
The following keywords are used:
GASINJMAN = Gas Injection Manifold
PRODSEP = Production Separator
WATINJMAN = Water Injection Manifold
InjFluidLabel Contains the fluid label that refers to the type of fluid used for injection
purposes. The properties of these fluids can be found under the
FluidListSection string.
SolverPres[j] Contains an array of pressures to be used in allocation calculations. Up
to 10 pressure values can be entered.
If the system is gaslifted, only one pressure value can be assigned to the
separator, and therefore only [0] is used.
Temperature Contains the temperature of the injected fluid.
Example:
To set the manifold pressure used for the Solve Network calculation to 200 psig for
instance, the following command will be used:
DoSet(“GAP.MOD[0].SEP[{Sep1}].SolverPres[0]”), 200
When either the Compositional Tracking, Fully Compositional or Black Oil Lumping
Delumping Calculation options are selected, the EOS model used in GAP needs to be
setup, as well as emulsion models if needed (see Model_Options).
The fluid composition will be defined in the wells using a composition table including up
to 30 components and their characteristics.
The following strings can be used at the IPR level to define the fluid composition for each
well and eventually each layer in multilayer wells.
Defining the composition will follow a similar procedure should the model use
Compositional Tracking, Fully Compositional or Black Oil Lumping Delumping
Calculation.
All the following variables will need to be preceded by the following OpenServer string
structure:
GAP.MOD[i].WELL[j].IPR[k].Composition
Where the index i refers to the type of model considered (i.e. refers to the Variables at
MOD level, MOD[i] section), the index j refers to the name or numerical index of the well
considered (i.e. refers to the Model Equipement List, EQUIP[i] section) and the index k
refers to the layer considered in case of multilayer wells.
In case the composition considered does not refer to a well fluid composition but to a
specific fluid from the GAP fluid list, the OpenServer strings associated to this fluid list
are defined in the section 3.2.6.1, the following string will then been used:
GAP.MOD[i].FluidList[j].Composition
Variable Description
Name
In every variable described below, the indes [i] refers to the row of
the composition table considered. Each component described in
the fluid composition table will have a specific table row assigned
using the NAME string described below.
BICOEFF[i][j] Refers to the binary interaction coefficients used.
The first index refers to the composition table row index of the first
component considered.
The second index refers to the composition table row index of the
second component considered.
MOLEPCT[i] Array [30] of mole percentages.
MW[i] Array [30] of molecular weights.
NAME[i] Array [30] of component names.
Valid values for this variable could be for instance:
- N2
- CO2
- NC4
- PS-1 ; PS-2 ; PS-3 for the pseudo-components considered.
NUMCOMP Contains the total number of components used to describe the fluid
composition in the well layer considered.
OMEGA[i] Array [30] of accentric factors (i.e. Ù factors).
OMEGAA[i] Array [30] of Omega A factors.
OMEGAB[i] Array [30] of Omega B factors.
PARACHOR[i] Array [30] of parachors.
Example:
To access the mole percentage of the first component of the input composition for the
first layer of a well labeled w1, the string would be
GAP.MOD[0].WELL[{w1}].IPR[0].Composition.MOLEPCT[0].
The strings used to obtain these results are similar to the one described above, at the
exception that the type of calculation considered should be specified in the OpenServer
string as described below.
GAP.MOD[i].EQUIP[j].SolverResults[k].Composition.NAME[l]
Where the index i refers to the type of model considered (i.e. refers to the Variables at
MOD level, MOD[i] section), the index j refers to the name or numerical index of the node
considered (i.e. refers to the Model Equipement List, EQUIP[i] section) and the index k
refers to the solver sensitivity considered.
The index l refers to the row index or the component name of the component
considered.
GAP.MOD[i].EQUIP[j].PREDRES[{01/01/2000}].Composition.NAME[k]
Where the index i refers to the type of model considered (i.e. refers to the Variables at
MOD level, MOD[i] section), the index j refers to the name or numerical index of the node
considered (i.e. refers to the Model Equipement List, EQUIP[i] section) and the index k
Example:
To access the mole percentage of the first component of the solver result composition
for a node labeled N1, the string to use would be
GAP.MOD[0].NODE[{N1}].SolverResults[0].Composition.MOLEPCT[0].
The above string is exactly the same when using the Black Oil Lumping Delumping
compositional calculation option.
4.1.11 Enabling / Disabling Options
This section provides various OpenServer Commands for 'Enabling' or 'Disabling'
various elements in GAP.
dation")
4.1.12 Scheduling
The user can setup the schedule for any model element for the prediction run.
All the schedule events will need to be preceded by the following OpenServer string
structure:
GAP.MOD[i].EQUIP[j].SCHEDULE[k]
If the schedule event refers to the entire system, i.e., production network or associated
injection network for instance, the following OpenServer string structure can be used:
GAP.MOD[i].SCHEDULE[k]
Where the index i refers to the type of model considered (i.e. refers to the Variables at
MOD level, MOD[i] section), the index j refers to the name or numerical index of the
network element considered (i.e. refers to the Model Equipement List, EQUIP[i] section)
and the index k refers to the row of the schedule event considered in the schedule event
list.
For each record in the schedule, the following fields are considered:
- Date
- Event type
- Constraint type (or OpenServer variable)
- Constraint value
4.1.12.1Schedule Count
The total number of schedule rows assigned to an element can be derived using the
following string:
GAP.MOD[i].EQUIP[j].SCHEDULE.COUNT
4.1.12.2Date
The variable string for the date in the ith model, jth equipment and kth record in the
schedule is the following:
GAP.MOD[i].EQUIP[j].SCHEDULE[k].DATE
The above string refers to the date of the scheduled event as a number, and not as a
day/month/year format date.
To refer to the date as a day/month/year format, the following string can be used:
GAP.MOD[i].EQUIP[j].SCHEDULE[k].DATE.DATESTR
4.1.12.3Event type
The variable string for the event type in the ith model and jth record in the schedule is:
GAP.MOD[i].EQUIP[j].SCHEDULE[k].TYPE
The existing types of event and their availability, depends of the type of element
considered.
4.1.12.4Constraint Type
When the event type considered refers to modification of a model constraint it is also
required to define the type of constraint that needs to be modified (e.g. Maximum Liquid
Rate).
The string referring to the type of constraint in the ith model and kth record in the schedule
is:
GAP.MOD[i]. EQUIP[j].SCHEDULE[k].LPAR[0]
4.1.12.5Constraint Value
When the event type considered refers to the setup of a model parameter value or the
modification of one of the model constraints, the following string will be used:
GAP.MOD[i]. EQUIP[j].SCHEDULE[k].CVAL[0]
When retrieving a value of a scheduled element, the previous string will return both value
and the unit in which it is expressed.
Example:
To setup the maximum liquid constraint to 5000 STB/d on the 01/01/2005 in a well
labeled W1, the following set of strings will be used:
4.1.12.6Schedule Reset
The existing GAP schedule can be reset, either at the production system level,
associated injection system level or at the element level using the following strings:
- At system level:
GAP.MOD[i].SCHEDULE.RESET
- At equipment level:
GAP.MOD[i].EQUIP[j].SCHEDULE.RESET
Both of the above string structures should be used with DoSet command.
Example:
DoSet (GAP.MOD[{PROD}].SCHEDULE.RESET”), 1
DoSet (GAP.MOD[{PROD}].EQUIP[{Separator}].SCHEDULE.RESET”), 1
4.1.12.7Apply Schedule To
The OpenServer commands to access the "Apply Schedule To" section are :
DoCmd ("GAP.APPLYSCHEDULETO({20/04/2012})")
DoCmd ("GAP.CLEARAPPLIEDSCHEDULE()")
4.1.13 Constraints
4.1.13.1Constraint Level and Type
The availability of these constraints on the system element considered (such as a well,
joint, separator, etc.) will depend on the nature of the element.
The string defining the constraint type should always be preceded by a prefix describing
the system level and element on which this constraint should be applied:
GAP.MOD[{PROD}]
Example:
To set the value of the maximum gas rate constraint applied to the system to
1000MMSCF/d, the following string could be used:
DoSet (“GAP.MOD[0].MAXQGAS”),1000
GAP.MOD[{PROD}].NODETYPE
Example: To set the value of the maximum gas rate constraint applied to the well
“WELL 1” to 100MMSCF/d, the following string could be used:
Abandonment Constraints
The well abandonment constraints can be set for each well layer independently using the
following structure:
GAP.MOD[0].WELL[{WELL 1}].IPR[i].ABMAXGOR
4.1.13.2Binding Constraints
Some of the constraints described above can be setup to be either binding or unbinding
constraints.
To access the binding section of each constraint, the constraint original OpenServer
string should be followed by the BINDING keyword.
The following numerical indexes are used to define the status of the constraint regarding
to the binding option:
0 = the constraint is set to non-binding
1 = the constraint is set to binding
Example: To access the binding status of the well “WELL 1” maximum liquid constraint,
the following string can be used:
To access the potential section of each constraint, the constraint original OS string
should be followed by the POTENTIAL keyword, except for the specific constraints
listed below.
The following numerical indexes are used to define the status of the constraint regarding
to the potential calculation:
0 : the constraint is not kept active during the potential calculation
1 : the constraint is kept active during the potential calculation
By default, GAP will keep the constraints that cannot physically be neglected, such as
the separator handling capacities for instance.
Example: To keep the liquid constraint of the well “WELL 1” active during the potential
calculation, the following string can be used:
All the Solver results can be obtained for each node and element in the network using
the following string:
GAP.MOD[i].EQUIP[j].SolverResults[k].l
Where the index i refers to the type of model considered (i.e. refers to the Variables at
MOD level, MOD[i] section), the index j refers to the name or numerical index of the
network element considered (i.e. refers to the Model Equipement List, EQUIP[i] section)
and the index k refers to the index of the Solve Network sensitivity case considered.
l refers to the model parameter considered.
If the element considered is a well, the following string can be used to access the solver
results for a specific layer:
GAP.MOD[i].WELL[j].IPR[k].SolverResults[l].m
Example:
To retrieve the oil rate produced at the node labeled Manifold, the following string can be
used:
GAP.MOD[0].EQUIP[{Manifold}].SolverResults[0].Qoil
In case the compositional tracking or full composition calculation options are used, the
composition related solver results can be obtained as defined in
Fluid_Composition_Results.
4.1.14.2Prediction Results
All the Production Prediction results can be obtained for each node / element in the
network using the following string:
GAP.MOD[i].EQUIP[j].PREDRES[k].l
Where the index i refers to the type of model considered (i.e. refers to the Variables at
MOD level, MOD[i] section), the index j refers to the name or numerical index of the
network element considered (i.e. refers to the Model Equipment List, EQUIP[i] section)
and the index k refers to the date of the prediction time-step considered.
l refers to the model parameter considered.
The integer k in the above mentioned command will vary from 0 to one less than the
number of prediction results. The command to check the number of prediction results is
GAP.MOD[i].EQUIP[j].PREDRES.DATES.COUNT
Similar keywords to the one used for the Solver results are used for prediction results,
except for the following parameters:
format.
DATES[i].TIMESTR Refers to the date of the ith prediction time-step.
Will refer to the date using a day/month/year hrs/min/sec
format.
DOWNTIME Well downtime
GASRATE Instantaneous gas rate
LIQRATE Instantaneous liquid rate
OILRATE Instantaneous oil rate
PWF Bottom hole flowing pressure
REVENUE Revenue generated up to the node considered
WATRATE Instantaneous water rate
If the element considered is a well, the following string can be used to access the solver
results for a specific layer:
GAP.MOD[i].WELL[j].LAYERPREDRES[k][l].m
Where the index i refers to the type of model considered (i.e. refers to the Variables at
MOD level, MOD[i] section), the index j refers to the name or numerical index of the well
considered (i.e. refers to the Model Equipment List, EQUIP[i] section), the index k refers
to the layer considered (i.e. it can either be the layer numerical index or the layer name
expressed between {}) and the index l refers to the prediction time-step considered.
The index m refers to the model parameter considered. The keywords used here are
similar to those used for the Production Prediction results.
Example:
To retrieve the average oil rate produced by the layer labeled Oil of the well labeled
Well1 on the 01/01/2000, the following string can be used:
GAP.MOD[0].WELL[{Well1}].LAYERPREDRES[{Oil}]
[{01/01/2000}].AVGOILRATE
GAP.MOD[i].SystemTotal[j].k
Where the index i refers to the type of model considered (i.e. refers to the Variables at
MOD level, MOD[i] section), the index j refers to solver sensitivity case considered and
the index k refers to the model parameter considered. The keywords used for the model
parameters are similar to the one described for the Solve Network results.
4.1.14.4Snapshot Results
The following table summarizes the OpenServer commands to re-load snapshot data:
Please see Section 2.9.2.4 of the GAP User Guide for information on how to save
prediction snapshot data.
4.1.15 SubFlowSheets
GAP offers the possibility of organizing the system into different flow sheets, this option
is useful when organizing large models.
It is possible to use the OpenServer functionality to retrieve and modify variables being
located in the flow sheets.
The following syntax can be used to access the number of wells located in the flow sheet
with the index i:
GAP.MOD[{PROD}].FLOWSHEET[i].WELL.COUNT
The following syntax can be used to access the label of the well j located in the flow
sheet i:
GAP.MOD[{PROD}].FLOWSHEET[i].WELL[j].LABEL
The above is valid for any variable and any equipment element.
Even if a function does not require any arguments, the brackets are still required.
The recommended way to execute these functions from Visual Basic is to use the
DoGAPFunc subroutine as shown below.
This subroutine works properly with any GAP function, and correctly deals with the case
where a function takes an appreciable amount of time to execute. Some functions may
return a value.
Example:
The function PREDINIT() in GAP is a network level function and performs prediction
initialization and returns the number of time-steps to be performed during the prediction.
Sample Macros:
Please also review the prediction set-up sample code in the provided "GAP Prediction
Template.xls" located in: C:/Program Files/Petroleum Experts/IPM 8/Samples/
OpenServer/Template/.
Please also review the GAP OpenServer examples. The files are in the form of *.GAR
files (archived GAP files). To open a GAR file, from the main menu of GAP select File |
Archive | Extract. Included in the GAR file is the macro that is used to run the
predictions and the code structure can be used as a reference to develop custom
macros, and to be modified to suit individual needs.
4.2.1 GAP OpenServer Functions Overview
The following table summarized the GAP OpenServer functions available, the
arguments associated and their main purpose.
Remark: Non compulsory function arguments will be individualized using a blue font
colour.
model)
OPENFILE (filename) Opens the GAP file specified.
PCCALC (equip, PcCurve) Allows access to well modelled using PC
curve option.
PCGMAX (equip, PcCurve) Calculates the maximum gas lift gas for a
particular performance curve at a specified
manifold pressure.
PCGSOLV (equip, PcCurve) Calculates the gas lift gas required to meet a
particular target value for a particular
performance curve at a specified manifold
pressure.
PCPSOLV (equip, PcCurve) Calculates the manifold pressure required to
meet a particular target value for a particular
performance curve.
PREDDOSTEP (optimise, potential) Performs a production prediction time-step.
PREDDOSOLVER (timestepsize, Performs a solve network in prediction
optimise, potential, model) mode.
PREDEND (dorest, optimise, potential) Stops a production prediction calculation.
PREDINIT (ignore internal timesteps, Performs production prediction initialisation.
ignore internal scheduling)
PURGEALLRESULTS (model) Deletes all the solver and prediction results
of the GAP model considered.
PURGEPREDLOG (model) Deletes the prediction calculation log.
PURGEPREDRESULTS (model) Deletes all the prediction results of the GAP
model considered.
PURGEPREDSNAPSHOT (model) Deletes the prediction snapshots.
PURGESOLVERLOG (model) Deletes the solve network calculation log
PURGESOLVERRESULTS (model) Deletes all the solve network results of the
GAP model considered.
REFITPC (well) Calculates a set of performance curve for the
specified well based on the PC curve input
data.
RESETSOLVERINPUTS () Resets any previously entered solve network
input data (i.e. separator pressure, injection
manifold pressure, gas lift gas available…).
SAVEFILE (filename) Saves the currently loaded GAP modle to the
file specified.
SHUTDOWN (save) Closes GAP.
SOLVENETWORK (optimise, model, Perfoms a solver calculation within GAP.
potential)
START () See Start and Shutdown section
STARTASYNC () See Start and Shutdown section
TPD.Calc() Performs a VLP calculation based on the
("GAP.PREDSNAPSHOT.TIME[X].DateStr")
If snapshot number X corresponds to
01/01/2010 the string "01/01/2010" will be
returned.
PREDSNAPSHOT.TIME[number1 : Returns dates for all the snapshots in the
number2] specified number interval in the format of the
string separated by "|" symbol. Dates are
returned in general format.
Example:
DoGet
("GAP.PREDSNAPSHOT.TIME[0:3]")
If snapshots 0-3 corresponds to dates
01/01/2010, 01/02/2010, 01/03/2010,
01/04/2010 the following string will be
returned "40179|40210|40238|40269|".
PREDSNAPSHOT.TIME[number1 : Returns dates for all the snapshots in the
number2].DateStr specified number interval in the format of the
string separated by "|" symbol. Dates are
returned in DD/MM/YYYY format. For
snapshots 0-3 in this case the following
string will be returned "01/01/2010|
01/02/2010|01/03/2010|01/04/2010|"
PREDSNAPSHOT.LOAD(snapshot_num Loads the snapshot that corresponds to the
ber) specified number (if exist) onto the screen.
Example:
DoCmd
("GAP.PREDSNAPSHOT.LOAD(X)")
PREDSNAPSHOT.LOAD(snapshot_date Loads the snapshot that corresponds to the
) specified date (if exist) onto the screen. The
date should be specified in DD/MM/YYYY
format in curly brackets.
Example:
DoCmd
("GAP.PREDSNAPSHOT.LOAD({01/01/201
0})")
PREDSNAPSHOT.LOAD("Original") Unloads prediction snapshot and returns
original system settings that were specified
before the predictions run.
Example:
DoCmd
("GAP.PREDSNAPSHOT.LOAD("Original")
")
PREDSNAPSHOT.UNLOAD() Unloads prediction snapshot and returns
original system settings that were specified
before the predictions run.
Example:
DoCmd
("GAP.PREDSNAPSHOT.UNLOAD()")
Example:
DoCmd
"GAP.MOD[{PROD}].FLASHOPTIONS.PTS[
0].ADDEQUIPMENT(""Separator"",
""sep1"", 0.33,0.5)"
FLASHOPTIONS.PTS[i].ADDCONNECTI Adds a connection between two pieces of
ON(equip1, label1, output1, equip2, equipment for the i path to surface
label2, input2) Arguments
equip1 - Separator, Joint, Chiller,
Source, Export
label1 - label of equipment
output1 - Liquid, Vapour, Output
equip2 - Same as equip1
label2 - label of equipment
input2 - Liquid, Vapour, Input
Example:
DoCmd
"GAP.MOD[{PROD}].FLASHOPTIONS.PTS[
{osPTS}].ADDCONNECTION(""Source"",
""Source"", ""Output"", ""Separator"",
""sep1"", ""Input"")"
FLASHOPTIONS.PTS[i].REMOVEEQUIP Removes equipment from the i path to
MENT(equip, label) surface object.
Arguments
equip - Separator, Joint, Chiller
label - label of equipment
FLASHOPTIONS.PTS[i].REMOVECONN Removes a connection between two pieces
ECTION(equip1, label1, output1, equip2, of equipment in the i path to surface object.
label2, input2) For argument definitions see adding a
connection above.
FLASHOPTIONS.PTS[i].UPDATEVALID Updates the validation flags used in the
ATION interface. To be used when you build a path
to surface object from the OpenServer
Remark: All the arguments referring to a system node or element and referred as tag in
the following descriptions will be expressed using the following syntax:
MOD[i].EQUIP[j]
Where the index i refers to the index or label (between {}) of the model considered and
the index j refers to the index or label (between {}) of the well considered.
Remark 2: Some of the functions include calculation processes that require the input of
associated variables. The variables associated with the functions can be setup using
the classic DoSet syntax.
These calculation processes will as well output results through output associated
variables. The value of these can be retrieved using a classic DoSet/DoGet syntax:
Where the index i refers to the index or label (between {}) of the model considered, the
index j refers to the index or label (between {}) of the node considered and the index k
refers to the GAP function associated variable considered. The value refers to the value
of this associated variable.
4.2.2 CALCFLOWASSURANCE
ARGUMENTS
none
The calculation must be performed for every timestep where the results are required.
GAP will only store one set of results per item of equipment therefore it is not possible to
extract the results for multiple timesteps. The results are also not saved with the file.
EXAMPLE
An example of its use in a system with a pipe labeled ‘pipe1’, where the objective is to
perform the calculation for the first step of the prediction and the first solver result would
be:
DoGAPFunc("GAP.MOD[{PROD}].PIPE[{pipe1}].PREDRES[0].CALCFLOWASSURA
NCE()")
DoGAPFunc("GAP.MOD[{PROD}].PIPE[{Pipe1}].SolverResults[0].CALCFLOWASSU
RANCE()")
4.2.3 CALCGRADIENT( )
ARGUMENTS
none
The calculation must be performed for every timestep where the results are required.
GAP will only store one set of results per item of equipment therefore it is not possible to
extract the results for multiple timesteps. The results are also not saved with the file.
This function can also be used for pipelines in place of the CALCFLOWASSURANCE()
function.
EXAMPLE
An example of its use in a system with a well labeled ‘well1’, where the objective is to
perform the calculation for the results of a solve network would be:
DoGAPFunc("GAP.MOD[{PROD}].WELL[{well1}].SOLVERRESULTS[0].CALCGRADI
ENT()")
4.2.4 CALCCOMPDP (comp) / CALCPUMPDP (pump)
ARGUMENTS
comp / pump – Refers to the compressor / pump tag.
ASSOCIATED VARIABLES
Input Data
Variable Description
CPDH2S Mole percentage of H2S.
CPDCO2 Mole percentage of CO2.
CPDN2 Mole percentage of N2.
Output Data
Variable Description
CPDEFF Compressor / Pump Efficiency.
CPDFLUIDPWR Power to fluid.
CPDGFRC Gas fraction (pumps).
CPDHEAD Compressor / Pump head.
CPDINGRATE Inlet rate (compressors).
CPDINLRATE Average throughput rate (pumps).
CPDLFRC Liquid fraction (compressors).
CPDOUTPRES Outlet pressure.
CPDOUTTEMP Outlet temperature.
CPDPOWREQ Total power required.
Variable Description
CPDSTGRES[0][j] Pressure at inlet of stage j.
CPDSTGRES[1][j] Temperature at inlet of stage j.
CPDSTGRES[2][j] Temperature at outlet of cooler stage j
(compressor).
CPDSTGRES[3][j] Oil rate at inlet of stage j.
CPDSTGRES[4][j] Gas rate at inlet of stage j.
CPDSTGRES[5][j] Water rate at inlet of stage j.
CPDSTGRES[6][j] Average throughput rate (pumps), Inlet throughput
rate (compressors).
CPDSTGRES[7][j] Head generated by stage j.
CPDSTGRES[8][j] Power required by stage j.
CPDSTGRES[9][j] Efficiency of stage j.
CPDSTGRES[10][j] Gas fraction (pumps) Liquid fraction
(compressors).
4.2.5 CALCPIPEDP(pipe)
ARGUMENTS
Pipe – Refers to the pipe tag.
If the calculation succeeds, the function returns 0. If it fails, the function returns a negative
number.
ASSOCIATED VARIABLES
Input Data
Variable Description
PIPH2S Mole percentage of H2S.
PIPCO2 Mole percentage of CO2.
PIPN2 Mole percentage of N2.
Output Data
Variable Description
PIPP2 Calculated downstream pressure.
PIPT2 Calculated downstream temperature.
EXAMPLE
The associated variables require a syntax as shown in the following examples:
where the index i refers to the index or label (between {}) of the model considered, the
index j refers to the index or label (between {}) of the equipment considered.
ARGUMENTS
The function can only be used if the destination equipment already exists in the network.
To create a new equipment, the 'NEWITEM' command must be used (see section
5.2.9).
EXAMPLE
An example of its use in a system with a well labeled ‘w1’, the contents of which we wish
to copy to a well labeled ‘newwell’, would be:
CPYIND =
DoGAPFunc(“GAP.COPYITEM(MOD[0].WELL[{newwell}], MOD[0].WELL[{w1}])”)
ARGUMENTS
node – Refers to the tag of the node to be deleted
DESCRIPTION
This function deletes the specified node from the system.
EXAMPLE
DoGAPFunc (“GAP.DELITEM(MOD[0].WELL[{w1}])”)
4.2.8 ISMEMBEROFGROUP(Group)
ARGUMENTS
Group - Refers to the OpenServer string defining the group considered.
DESCRIPTION
This function enables to check if a specific element of the GAP network belongs to the
group considered.
The function will return 0 if the element consider does not belong to the group
considered, and 1 if the element considered belongs to the group considered.
EXAMPLE
The example below will enable to check whether the well W1 belongs to the group
Group1:
DoCmd
("GAP.MOD[{PROD}].WELL[{W1}].ISMEMBEROFGROUP(MOD[{PROD}].GROUP[{Gr
oup1}])
4.2.9 LINKITEMS ( equip1, equip2, linklabel )
ARGUMENTS
equip1 – Refers to the tag of the first node considered
equip 2 – Refers to the tag of the second node considered
linklabel (optional) – Refers to the label associated to the link created (if applicable).
Needs to be specified in between quotes.
DESCRIPTION
This function links two items within a GAP model.
If the two items are a joint and another joint, or a joint and a separator, then a pipe node
will be created in order to link them, and in these cases the optional label linklabel, if
supplied, will be used as the pipe label.
EXAMPLE
For instance, the following command will create a link between the joint J1 and the
separator Sep1
DoCmd ("GAP.LINKITEMS(MOD[0].JOINT[{J1}],MOD[0].SEP[{Sep1}])")
4.2.10 NEWFILE( )
ARGUMENTS
None
DESCRIPTION
This function clears any currently loaded GAP model.
Care should be taken with this function, since no check is made of whether the currently
loaded model has changed and requires saving.
EXAMPLE
DoGAPFunc ("GAP.NEWFILE()")
ARGUMENTS
type – A string specifying the type of node to be created.
The string will be one of "WELL", "PIPE", "TANK", "SEP", "PUMP", "COMP", "JOINT",
"SOURCE", "SINK", "VALVE", "INLSEP", "INLCHK", "INLINJ", "INLGEN", "GROUP",
"INFLOW".
label – A string giving the label of the new node. The string should be specified in
between quotes.
iposcode (optional) – A string giving the direction a node will be displaced relative to the
reference node.
The string will be one of “RIGHT”, “LEFT”, “ABOVE” or “BELOW”.
The default value is set to “RIGHT”.
equip (optional) – The tag of a node in the system to use as the reference node.
The reference node is used to calculate the position of the new node.
The default value is set to “NULL”.
model (optional) – The tag of the system in which the new item is to be created.
The default value is set to MOD[0].
DESCRIPTION
This function creates a new node in the system specified. Nodes will always be
positioned such that they do not intersect each other.
EXAMPLE
To create a new well labeled “Well1” in the currently loaded production system located at
the right of the Separator node, the following syntax could be used –
GENERAL SYNTAX
DoCmd "GAP.NEWITEM( type, label, [iPosCode=RIGHT], [node=NULL],
[model=MOD[0]], [flowsheet=MOD[0].FLOWSHEET[{xxx}]] )"
ARGUMENTS
type - A string specifying the type of node to be created:
The string will be one of the "EQUIP", "WELL", "PIPE", "TANK", "SEP", "PUMP",
"COMP", "JOINT", "SOURCE", "SINK", "VALVE", "INLSEP", "INLCHK", "INLINJ",
"INLGEN", "COMPLETION", "GROUP", "INFLOW", "FLOWSHEET"
FLOWSHEET EXAMPLE:
Create a Flowsheet in the main GAP model:
DoCmd "GAP.NEWITEM( "FLOWSHEET", "FlowS1", RIGHT, NULL, MOD[0])"
Create a joint in the flowsheet:
DoCmd "GAP.NEWITEM( "JOINT", "Port1", RIGHT, null, MOD[0],
MOD[0].FLOWSHEET[{FlowS1}])"
The following flag can be used to determine whther a joint is a flowsheet port:
DoGet "GAP.MOD[{PROD}].JOINT[{Port1}].IsFlowsheetPort()"
ARGUMENTS
filename – Refers to the fully qualified (i.e. path included) file name to open.
DESCRIPTION
This function opens the GAP file specified. It should be used with caution since the file
will replace the currently loaded file, whether or not the currently loaded file needs
saving.
EXAMPLE
To open a GAP file labelled “Simple.GAP” and located in the folder “Simple_Model” in
the C: drive, the following syntax can be used –
Alternatively, an Excel spreadsheet located file can be opened using the following
syntax:
ARGUMENTS
equip – Refers to the tag of the node considered, other than a tank node.
PcCurve – Specifies which type of performance curve is to be used.
Can be specified using one of the following keywords:
"QOIL", "QGAS", "QLIQ", "OG", "GG", "FBHP", "TEMP", "H2S", "CO2", "N2", "WSAL",
"GIBACK", “OPTFUN”.
Input Data
Variable Description
PCCGASINJ In a gas lifted system, specifies the gas injected.
PCCMANIPRES The manifold pressure.
Output Data
Variable Description
PCCANS The calculated quantity.
PCCDANSDG In a gas lifted system, the derivative of the calculated
quantity with respect to gas injected.
The Input and Output Data parameters are global variables, and hence do not require
the equipment to be identified when using these variables. An Example for this is given
below.
EXAMPLE
An example of its use with a gas lifted well labeled ‘w1’ would be
ARGUMENTS
equip – Refers to the tag of the node considered, other than a tank node.
"QOIL", "QGAS", "QLIQ", "OG", "GG", "FBHP", "TEMP", "H2S", "CO2", "N2", "WSAL",
"GIBACK", “OPTFUN”.
Input Data
Variable Description
PCOPTMANIPRES The manifold pressure.
Output Data
Variable Description
PCOPTGINJ The calculated optimum gas injection.
PCOPTVAL The calculated quantity at optimum gas injection.
The Input and Output Data parameters are global variables, and hence do not require
the equipment to be identified when using these variables. An Example for this is given
for the PCCALC command.
4.2.15 PCGSOLV (equip, PcCurve)
ARGUMENTS
equip – Refers to the tag of the node considered, other than a tank node.
"QOIL", "QGAS", "QLIQ", "OG", "GG", "FBHP", "TEMP", "H2S", "CO2", "N2", "WSAL",
"GIBACK", “OPTFUN”.
The input conditions are set up in global variables (see below), then the function is called
to calculate the answer.
The function returns 0 if successful, and a negative number if not.
ASSOCIATED VARIABLES
Input Data
Variable Description
PCSOLVMANIPRES The manifold pressure.
PCSOLVTARGVAL The target quantity.
Output Data
Variable Description
PCSOLVGASINJ The calculated gas injection required. The value in
this variable on input is used as a starting value.
The Input and Output Data parameters are global variables, and hence do not require
the equipment to be identified when using these variables. An Example for this is given
for the PCCALC command.
ARGUMENTS
equip – Refers to the tag of the node considered, other than a tank node.
"QOIL", "QGAS", "QLIQ", "OG", "GG", "FBHP", "TEMP", "H2S", "CO2", "N2", "WSAL",
"GIBACK", “OPTFUN”.
The input conditions are set up in global variables (see below), then the function is called
to calculate the answer.
The function returns 0 if successful, and a negative number if not.
Input Data
Variable Description
PCSOLVGASINJ The gas injection. In a non gaslifted node, this
value is ignored.
PCSOLVTARGVAL The target quantity.
Output Data
Variable Description
PCSOLVMANIPRES The calculated manifold pressure. On input, the value
in this variable is used as a starting value.
The Input and Output Data parameters are global variables, and hence do not require
the equipment to be identified when using these variables. An Example for this is given
for the PCCALC command.
4.2.17 PREDDOSTEP (optimise, potential)
ARGUMENTS
optimise (optional) – Refers to the status of the optimiser when the prediction timestep
is performed.
The following options are available:
-1 – GAP uses the optimisation mode and potential calculation settings saved in
the file
0 – No Optimisation
1 – Optimise and Honour Constraints
2 – Optimise, potential constraints only
3 – Optimise with rules
The default value is set to optimise and honour constraints.
potential (optional) – Refers to the status of the network potential calculation. Would only
be used when "Optimise and Honour Constraints" method is selected.
The following options are available:
0 – No potential calculation
1 – Potential calculation
The default value is set to no potential calculation.
DESCRIPTION
This function, together with PREDINIT() and PREDEND(), allows step by step
predictions to be performed.
PREDINIT() performs all the setup required for a prediction run, i.e. the MBAL tanks are
loaded, the well models are initialized, etc. and PREDEND() is called to end the
prediction run. For details regarding these functions, see their associated sections.
Firstly, it totals up the production and injection volumes from the previous timestep and
uses these to calculate the tank pressures for the current time-step.
Secondly, it calculates the network performance using a solve network calculation along
with the current tank pressures and flowing conditions. It then obtain the production rates
for the wells included in the system.
It then calculates the ideal injection required, based on voidage replacement conditions,
etc. If associated injection systems are present, these ideal injection requirements are
used as constraints, and the injection systems are built and allocated to obtain the actual
injection volumes.
When each PREDDOSTEP() call is finished, GAP is left in a state where it can respond
to any set of OpenServer commands. This allows a large amount of flexibility, since
virtually any action can be performed at each timestep. This can range from customised
scheduling through to running GAP in conjunction with a facilities simulator at each
timestep.
EXAMPLE
The following example performs the prediction set up in the GAP file, and on the time-
step 01/03/1980 alters the PI of the first layer of well ‘w1’ to 15. At the end of the
prediction run it saves the GAP file.
'Set up prediction
NSTEPS = DoGAPFunc “GAP.PREDINIT()”
For i = 1 To NSTEPS
'Do production prediction step
RVAL = DoGAPFunc “GAP.PREDDOSTEP()”
'Check return code – should be 1 if step OK
If (RVAL <> 1) Then
Exit For
End If
If (DoGet ("GAP.PREDCURDATE.DATESTR") = "01/03/1980") Then
DoSet "GAP.MOD[0].WELL[{w1}].IPR[0].PI", 15
End If
Next
DoGAPFunc “GAP.PREDEND()”
DoGAPFunc “GAP.SAVEFILE( “”C:\SAMPLES\PREDRUN1.GAP”” )”
ARGUMENTS
Timestepsize – Should always be set to 0
optimise (optional) – Refers to the status of the optimiser when the prediction timestep
is performed.
The following options are available:
-1 – GAP uses the optimisation mode and potential calculation settings saved in
the file
0 – No Optimisation
1 – Optimise and Honour Constraints
2 – Optimise, No constraints
3 – Optimise with rules
The default value is set to optimise and honour constraints.
model (optional) – Refers to the tag of the model considered (i.e. production / water
injection / gas injection).
The default considers the production system.
DESCRIPTION
This function performs a solve network calculation in predictive mode without moving
forward of one prediction step.
It enables to run solve network sensitivities at a specific point during the prediction.
ARGUMENTS
dorest (optional) – Refers to the time-step at which the prediction run ends.
The following options are available:
0 – The prediction forecast is ended as soon as the the function is called.
1 – The prediction forecast is ended at the end of the defined prediction
schedule.
The default value is set to 1.
optimise (optional) – Refers to the status of the optimiser when the prediction time-step
is performed.
The following options are available:
-1 – GAP uses the optimisation mode and potential calculation settings saved in
the file
0 – No Optimisation
1 – Optimise and Honour Constraints
2 – Optimise, No constraints
3 – Optimise with rules
The default value is set to optimise and honour constraints.
DESCRIPTION
This functions ends the prediction run.
See discussion of PREDDOSTEP(), in the previous section.
ARGUMENTS
ignore internal timestep (optional) – Specifies whether the GAP internal timesteps are
ignored or not (mainly used when the GAP / RESOLVE coupling is used).
The following values are possible:
0 – Do not ignore internal timesteps
1 – Ignore internal timesteps
The default value is set to 0.
Ignore internal scheduling (optional) - Enables to specify whether the GAP internal scheduling
events are ignored or not (i.e. mainly used when the GAP / RESOLVE coupling is used).
The following values are possible:
0 – Do not ignore internal scheduling events
1 – Ignore internal scheduling events
The default value is set to 0.
DESCRIPTION
This functions establishes all the setup required for a prediction run, i.e. the MBAL tanks
are loaded, the well models are initialised, etc.
This process leads to the calculation of the number of timestep required in the prediction
run.
EXAMPLE
NumSteps = DoGAPFunc("GAP.PREDINIT()")
The command initialises the GAP prediction and returns the total number of prediction
steps
NOTE
Using of the command will initialise the prediction and define the number of steps
required to perform the prediction. The number of step is defined according to
Prediction Start, Prediction End and Step Size.
The prediction is run through the loop on a step by step basis. In this case GAP is driven
by external application and completes the full number of prediction steps; the 'System
Abandonment Constraints' will be ignored.
The full prediction run will be accomplished even if macro exits the loop and executes
the GAP.PREDEND() command.
ARGUMENTS
model (optional) – Refers to the tag of the model considered (i.e. production / water
injection / gas injection).
The model considered by default is the production system.
DESCRIPTION
This function purges all results saved in the model currently considered.
ARGUMENTS
model (optional) – Refers to the tag of the model considered (i.e. production / water
injection / gas injection).
The model considered by default is the production system.
DESCRIPTION
This function purges the prediction log of the model currently considered.
DESCRIPTION
This function purges the prediction results saved in the model currently considered.
ARGUMENTS
model (optional) – Refers to the tag of the model considered (i.e. production / water
injection / gas injection).
The model considered by default is the production system.
DESCRIPTION
This function purges the prediction snapshots saved in the model currently considered.
ARGUMENTS
model (optional) – Refers to the tag of the model considered (i.e. production / water
injection / gas injection).
The model considered by default is the production system.
DESCRIPTION
This function purges the solver log of the model currently considered.
ARGUMENTS
model (optional) – Refers to the tag of the model considered (i.e. production / water
injection / gas injection).
The model considered by default is the production system.
DESCRIPTION
This function purges the solver results saved in the model currently considered.
4.2.27 REFITPC(well)
ARGUMENTS
well – Refers to the tag of the well considered in the currently loaded model.
DESCRIPTION
This function calculates a set of performance curves for the well based on the input
performance curve data.
EXAMPLE
To do a refit on a well with the name "well2" the following syntax can be used:
DoCmd("GAP.REFITPC(GAP.MOD[{PROD}].WELL[{WELL2}])")
4.2.28 RESETSOLVERINPUTS ()
ARGUMENTS
None
DESCRIPTION
This function resets any previously entered solver inout data (i.e. separator pressure,
injection manifold pressure, gas lift gas available).
ARGUMENTS
filename – Refers to the fully qualified (i.e. path included) file name to open.
DESCRIPTION
This function saves the currently loaded GAP model to the file specified.
It should be used with caution since the file will overwrite a file of the same name if it
exists.
EXAMPLE
To save a GAP file labelled “Simple.gap” and located in the folder “Simple_Model” in
the C:\ drive, the following syntax can be used
ARGUMENTS
save – Enables to specify whether the file needs to be saved before closing down GAP
or not.
The following values are possible:
0 – Do not save the GAP file
1 – Automatically save the GAP file if it has been modified.
The default value is 1.
DESCRIPTION
This function closes down GAP.
4.2.31 SOLVENETWORK()
ARGUMENTS
optimise (optional) – Refers to the status of the solver when the calculation is performed.
The following options are available:
-1 – GAP uses the optimisation mode and potential calculation settings saved in
the file
0 – No Optimisation
1 – Optimise and Honour Constraints
2 – Optimise with potential constraints
3 – Use Rule Based Solver to honour constraints
The default value is set to optimise and honour constraints.
model (optional) – Refers to the tag of the model considered (i.e. production / water
injection / gas injection).
The default considers the production system.
associated gas lift network (optional) - Refers to the inclusion of the gas lift gas network
for gas lifted fields.
The following options are available:
0 - Do not include gas lift gas network
1 - Include gas lift gas network
The default value is set to do not include gas lift gas network.
DESCRIPTION
EXAMPLE
This example assumes a naturally flowing system with two separators labeled ‘s1’ and
‘s2’ is loaded in GAP
'Set up constraints
DoSet “GAP.MOD[0].MAXGAS”, 50
DoSet “GAP.MOD[0].SEP[{s1}].MAXQWAT”, 12000
'Perform Allocation
DoGAPFunc “GAP.SOLVENETWORK(1, MOD[0])”
'Get results
QOILS1 = DoGet(“GAP.MOD[0].SEP[{s1}].SOLVERRESULTS[0].Qoil”)
QWATS2 = DoGet(“GAP.MOD[0].SEP[{s2}].SOLVERRESULTS[0].Qwat”)
4.2.32 TPD.CALC()
ARGUMENTS
None.
DESCRIPTION
This function performs the same calculation as the VLP calculation screen for a well in
GAP (see figure below)
EXAMPLE
The following may be used to input the flowing conditions for the VLP, perform the VLP
calculation and retrieve the results for an oil well.
'Set input data for VLP Calc – this will overwrite the network solver results
DoSet "GAP.MOD[{PROD}].WELL[{Well1A}].TPD.SensVarCalcValue[0]", Liquid
Rate
DoSet "GAP.MOD[{PROD}].WELL[{Well1A}].TPD.SensVarCalcValue[1]", WCT
DoSet "GAP.MOD[{PROD}].WELL[{Well1A}].TPD.SensVarCalcValue[2]", GOR
DoSet "GAP.MOD[{PROD}].WELL[{Well1A}].TPD.SensVarCalcValue[3]", WHP
Note - The Openserver strings returned for the table in the ‘VLP calculation’ dialog are
NOT the same as the ones that are used in this function so the user cannot simply ‘ctrl
+right-click’ on the above dialog and use these.
BEST PRACTICE
If OpenServer is to be used to perform TPD calculations using this function, care needs
to be taken to enter the variables in the correct order (i.e. the integer that the variables,
SensVarCalcValue[i], are defined with can depend on which sensitivity variables are
used when the lift curves are generated).
The order/integer the variables are to be defined with can be obtained visually (i.e.
inspecting the VLP calculation dialogue starting from 0 for the farthest left variable), or
by extracting the order with OpenServer. To extract the order with OpenServer, the
TPD.SensVarTag[$] string can be used:
layer number (optional) – For multilayered wells, the number of the well layer to update.
The valid values for this argument range from 0 to n-1.
The default is set to 0 – first layer.
PVTMethod (optional) – Refers to the set of PVT data used during the IPR transfer.
The following options are available:
DESCRIPTION
This function transfers the IPR from PROSPER for the well node.
This is equivalent to the ‘Transfer Well IPR from PROSPER’ menu option
EXAMPLE
The following syntax can be used to transfer to the GAP system the PROSPER defined
IPR of the well labeled “Well1” –
DESCRIPTION
This function deletes the link between the first node and second node (if one exists). If
only the first node is specified, then the link between that node and its parent node is
deleted.
EXAMPLE
To break the link between a well W1 and a joint J1, the following code can be used.
DESCRIPTION
This functions validates all the input data needed for both solver and prediction
calculations, at network level.
The function returns 0 if all the model considered are valid, and a value # 0 if it is not the
case.
ARGUMENTS
equip – Refers to the tag of the node considered. Here the type of node considered
could be wells, outflows, pump or compressors.
Filename – Refers to the the fully qualified (i.e. path included) TPD file name to open.
EXAMPLE
The following syntax can be used to import the lift curves .TPD file in the well labeled
“W1” from the location C:\TEST
DESCRIPTION
This function generates performance curve data from the VLP and IPR data in the well
node.
The automatic wellhead pressure selection option does not apply to gaslifted wells.
EXAMPLE
For example the following code may be used to calculate the Performance Curve for
Well labelled "W2" where the Manifold Pressures used are defined by the user.
For i = 0 To 19
DoSet ("GAP.MOD[{PROD}].WELL[{W2}].MANIPRES[" + CStr(i) + "]"),
Cells(36 + i, 4)
Next i
DoGAPFunc ("GAP.VLPIPRPCGEN(MOD[0].WELL[{W2}],0)")
For i = 0 To 19
Cells(36+i, 6) = DoGet("GAP.MOD[{PROD}].WELL[{W2}].PCDATA[0][0]
["+ CStr(i)+"]")
Cells(36+i, 7) = DoGet("GAP.MOD[{PROD}].WELL[{W2}].PCDATA[0][1]
["+ CStr(i)+"]")
Cells(36+i, 8) = DoGet("GAP.MOD[{PROD}].WELL[{W2}].PCDATA[0][2]
["+ CStr(i)+"]")
Next i
4.2.38 WELLCALC (well)
ARGUMENTS
well – Refers to the well tag in the currently loaded model.
The structure used to define this argument will be as follow: MOD[i].WELL[j]
Where the index i refers to the index or label of the model considered and the
index j refers to the index or label (i.e. between {}) of the well considered.
DESCRIPTION
This function performs the same calculation than the GAP 'Model Validation' screen.
ASSOCIATED VARIABLES
The function operates on the 'Model Validation' variables in the well.
EXAMPLE
An example of its use with a gaslifted well labelled ‘w1’ would be –
DoGAPFunc "(GAP.WELLCALC(MOD[0].WELL[{W1}])")
QLIQEST = DoGet("(GAP.MOD[0].WELL[{W1}].EstimatedLiqRate"))
QGOREST = DoGet("(GAP.MOD[0].WELL[{W1}].EstimatedGOR"))
QWCEST = DoGet("(GAP.MOD[0].WELL[{W1}].EstimatedWC"))
The syntax for the PACALC and the ACTUALCALC commands is as shown in the
following lines.
DoCmd ("GAP.WELLCALC(MOD[{PROD}].WELL[{W1}])")
DoCmd ("GAP.PACALC(MOD[{PROD}].WELL[{W1}])")
DoCmd ("GAP.ACTUALCALC(MOD[{PROD}].WELL[{W1}])")
Examples:
To – Enables to specify in which column the source column is to be copied. The same
keywords that the from argument keywords are used.
SkipFNAs (optional) – Enables to avoid copying the empty zones. In order to use this
function, an argument value of 1 should be introduced.
DESCRIPTION
This function copies a chosen column of the Equipment control screen into a specified
column in the same screen.
An example will be to copy the Optimised column in the Actual column after a
satisfactory optimised solver run for instance to use the optimised values obtained as
default values for the next runs.
DESCRIPTION
This function resets to zero the values of a specific column in the Equipment control
screen.
equiptype (optional) – Refers to the type of equipment (i.e. “WELL”, “JOINT”, etc…) in
which the scheduling needs to be reset.
If the optional keywords are not used, the entire network schedule will be reset.
DESCRIPTION
This function resets any scheduling data associated with the network elements
specified.
DESCRIPTION
This functions validates all the input data needed for both solver and prediction
calculations, at model level.
The function returns 0 if all the model considered are valid, and a value # 0 if it is not the
case.
4.2.43 GROUPS
The following list of commands would be used to access the group variable via
OpenServer
Command Description
"equip" refers to the tag of the equipment
GROUP[i].ADDMEMBER (equip) and the function adds the node specified to
the given group
GROUP[i].REMOVEALLMEMBERS () This function removes all the members from
the given group
Use this command to remove a given piece
GROUP[i].REMOVEMEMBER (equip) of equipment from the group where: "equip"
refers to the tag of the given piece of
equipment that will be removed
EQUIP[i].ADDTOGROUP (group) This function adds the node considered to
the given group
Variables Description
GAP.MOD. Counts the number of connected elements
[{PROD}].GROUP[{GROUP1}].member.cou to a given group
nt
Returns the label of a given member where
GAP.MOD. 'i' corresponds to the given member index
[{PROD}].GROUP[{GROUP1}].member[ returned using the"GAP.MOD.
i].label [{PROD}].GROUP[{GROUP1}].member.cou
nt" string
GAP.MOD. Returns the "type" of equipment for the
[{PROD}].GROUP[{GROUP1}].member[ given group member index 'i'
i].type
GAP.MOD. Returns the sequential index of the piece of
[{PROD}].GROUP[{GROUP1}].member[ equipment when it was added to the given
i].Index GAP model
DESCRIPTION
This functions adds the node considered to the group specified.
4.2.45 EQUIP[i].BYPASS ()
ARGUMENTS
None.
DESCRIPTION
This function bypasses the node considered.
EXAMPLE
To bypass a compressor called Compr1, the following command can be used:
DoGAPFunc ("GAP.MOD[{PROD}].COMP[{Compr1}].bypass()")
4.2.46 EQUIP[i].DISABLE ()
ARGUMENTS
None
DESCRIPTION
This function disables the node considered.
EXAMPLE
If the well w1 is to be disabled, the function call will be:
DoGAPFunc ("GAP.MOD[0].WELL[{w1}].DISABLE()")
4.2.47 EQUIP[i].ENABLE ()
ARGUMENTS
None
DESCRIPTION
This function enables the node considered.
See node.DISABLE for disabling nodes.
EXAMPLE
If well w1 is to be enabled, the function call is:
DoGAPFunc ("GAP.MOD[0].WELL[{w1}].ENABLE()")
4.2.48 EQUIP[i].ISMEMBEROFGROUP(group)
ARGUMENTS
Group – Refers to the tag of the group considered.
(e.g. GAP.MOD[{PROD}].GROUP[{Group1}] for instance).
DESCRIPTION
This function checks if the equipment considered is included in the group specified.
ASSOCIATED VARIABLES
The function returns the following variables:
- 0 if the equipment considered does not belong to the group specified.
- 1 if the equipment considered does belong to the group specified.
4.2.49 EQUIP[i].ISCONNECTEDTO(equip)
ARGUMENTS
Equipment – Refers to the tag of the equipment verified for connection.
(e.g. GAP.MOD[{PROD}].JOINT[{J1}] for instance).
DESCRIPTION
This function checks if the equipment considered is directly connected to another
equipment, i.e. if equipment unit defined as an argument is located just after the master
equipment. For example, the joint located just after the well is considered as connected
to that well; however, the well is not connected to a separator located further
downstream (i.e. linked via set of pipelines).
ASSOCIATED VARIABLES
The function returns the following variables:
- 0 if the equipment considered is not connected to the equipment in the
argument.
- 1 if the equipment considered is connected to the equipment in the argument.
EXAMPLE
To verify whether the joint J1 is located just after the well W1 the following command will
be used:
DoGAPFunc
("GAP.MOD[0].WELL[{W1}].ISCONNECTEDTO(MOD[0].JOINT[{J1}])")
4.2.50 EQUIP[i].ISRELATEDTO(equip)
ARGUMENTS
Equipment – Refers to the tag of the equipment verified for connection.
(e.g. GAP.MOD[{PROD}].JOINT[{J1}] for instance).
DESCRIPTION
This function checks if the equipment considered is linked to another equipment, i.e. if
equipment unit defined as an argument is located within the same network as the
master equipment. For example, the well is related to a separator to which it is flowing. It
is also considered related to any equipment unit in this network. If equipment is not
linked to another equipment in any way, then is is considered as not related.
ASSOCIATED VARIABLES
The function returns the following variables:
- 0 if the equipment considered is not related to the equipment in the argument.
- 1 if the equipment considered is related to the equipment in the argument.
EXAMPLE
To verify whether the well W1 is flowing to the separator Sep1 the following command
will be used:
DoGAPFunc
("GAP.MOD[0].WELL[{W1}].ISRELATEDTO(MOD[0].SEP[{Sep1}])")
4.2.51 EQUIP[i].MASK ()
ARGUMENTS
None
DESCRIPTION
This function masks the node considered.
See node.UNMASK for unmasking nodes.
EXAMPLES
If well w1 is to be masked, the function call is:
DoGAPFunc ("GAP.MOD[0].WELL[{w1}].MASK()")
4.2.52 EQUIP[i].REMOVEALLGROUPMEMBERSHIPS ()
ARGUMENTS
None
DESCRIPTION
This function removes all the exiting group links of the considered node.
DESCRIPTION
This functions removes the node considered of the group specified.
4.2.54 EQUIP[i].UNBYPASS ()
ARGUMENTS
None
DESCRIPTION
This functions un-bypasses the node considered.
See node.BYPASS for bypassing nodes.
4.2.55 EQUIP[i].UNMASK ()
ARGUMENTS
None
DESCRIPTION
This function unmasks the node considered.
See node.MASK for masking nodes.
EXAMPLE
If well w1 is to be unmasked, the function call is:
DoGAPFunc ("GAP.MOD[0].WELL[{w1}].UNMASK()")
DESCRIPTION
This functions validates all the input data needed for both solver and prediction
calculations, at node level.
The function returns 0 if the model considered is valid, and a value # 0 if it is not the
case.
4.2.57 TANK[i].CalcDCTankCurPres(CurProd)
ARGUMENTS
None
DESCRIPTION
Calculates the Current Pressure for the tank based on the Current Production specified.
This is for Decline Curve Tanks only. The CURPROD must be replaced by the value of
the Current Production for which the calculations need to be performed.
EXAMPLE
The following command will perform the calculation for the calculation for the Current
Reservoir Pressure based upon the value of the Current Production specified in the
string. in the above example the calculation is being performed to determine the
pressure when the cumulative production is 1.22501 units.
DoCmd ("GAP.MOD[{PROD}].TANK[{T1}].CalcDCTankCurPres(1.22501)")
DoGet ("GAP.MOD[{PROD}].TANK[{T1}].TCURRESPRED")
4.2.58 PIPE[i].DOMATCH ()
ARGUMENTS
None
DESCRIPTION
This function matches the available pipeline test data.
4.2.59 IPR[i].CONINGMATCH ()
ARGUMENTS
None
DESCRIPTION
This function matches the available coning data in the selected IPR.
4.2.60 IPR[i].DISABLE ()
ARGUMENTS
None
DESCRIPTION
This function disables the ipr considered.
See ipr.ENABLE for enabling nodes.
EXAMPLE
To disable the Layer 1 of well W1 the following code can be used.
DoCmd ("GAP.MOD[0].WELL[{W1}].IPR[0].DISABLE()")
4.2.61 IPR[i].ENABLE ()
ARGUMENTS
None
DESCRIPTION
This function enables the ipr considered.
See ipr.DISABLE for disabling nodes.
EXAMPLE
To disable the Layer 2 of well W1 the following code can be used.
DoCmd ("GAP.MOD[0].WELL[{W1}].IPR[1].ENABLE()")
4.2.62 IPR[i].IPRMATCH ()
ARGUMENTS
None
DESCRIPTION
This function matches the available ipr dataset.
4.2.63 IPR[i].MASK ()
ARGUMENTS
None
DESCRIPTION
This function masks the ipr considered.
4.2.64 IPR[i].UNMASK ()
ARGUMENTS
None
DESCRIPTION
This function unmasks the ipr considered.
4.2.65 IPR[i].COMPOSITION.IMPORTPRPFILE("FilePath")
ARGUMENTS
File Path of the *.prp file to be imported into the IPR layer.
DESCRIPTION
This function imports a composition (*.prp file) into the IPR layer of a compositional GAP
model. The function is designed to import a new composition into an IPR layer which
already has a composition defined and will not work if the existing data entry is blank.
EXAMPLE
To import a *prp file into layer 0 of well1 from the file path, "C:\Program Files (x86)
\Petroleum Experts\IPM 10\Samples\prosper\Test.prp":
DoCmd
(GAP.MOD[{PROD}].WELL[{Well1}].IPR[0].Composition.importprpfile("C:\Test.prp"))
The script actions can be included at different levels within the prediction process.
The workflow below illustrates the succession of actions that GAP follows during a
prediction process, and illustrates at which stage the different sections of the GAP
internal scripting are taken into account.
Build systems ()
Solve Network ()
Script.DoPredStepSolverEpilog (system)
Destroy systems ()
For more information using GAP script, please see Section 2.12 of the GAP User
Guide.
5
153 OpenServer
5.1 Overview
This section describes OpenServer commands and variables for MBAL.
As with all of the IPM tools, the easiest way to obtain any OpenServer tag is by holding
Ctrl and Right-Clicking the data entry in question.
For reference, all available variables are listed in the Variable Text String section of
the guide. A tool description is also provided, however, it is recommended to use the
above Ctrl + Right-Click keyboard and mouse action to capture the required variable
OpenServer tag.
It is important to note that it is not possible to obtain the OpenServer tag for a
calculation button by holding Ctrl and Right-Clicking. A list of all corresponding
DoCmd functions are listed in the Command section of this guide.
Use of the DoSet and DoGet functions for variables which can take a value from a pre-
defined list e.g. oil, water or gas will also be discussed and Unit handling using the
DoSet and DoGet calls.
First start the MBAL program. Open the sample file OIL.MBI. Open the tank dialog by
selecting Input | Tank Data.
Suppose the objective is to find the OpenServer variable string for the porosity. This
can be achieved by holding Ctrl and Right-Clicking the porosity input, as shown below.
This dialog displays the text string for the porosity variable. This can be used in the
GetValue and SetValue functions. The Copy button can be used to copy the text string
to the clipboard so it can then be pasted into the VBA macro or batch file.
To modify the date format of the tank / well history, the following OpenServer string is
used:
MBAL.DATEUNITINPUT
To modify the date format of the prediction results the following OpenServer string is
used:
MBAL.DATEUNITOUTPUT
Both of the above are implemented with integer values as per the below table
0 Days
1 Weeks
2 Month
3 Year
4 Date (DD/MM/YYYY)
5 Date/Time (DD/MM/YYYY 00:00:00)
6 Hour
7 Minute
8 Seconds
To modify the reference date set in the Options of MBAL, the following OpenServer
string can be used:
MBAL.MB[0].REFDATE
NOTE: When the date is retrieved from MBAL into the Excel spreadsheet using TIME
keyword, Excel uses its internal conversion to translate the date. This sometimes leadS
to erroneous date representation in Excel; more specifically day and month numbers
can be flipped (MM/DD/YYYY would be seen in Excel). To avoid this CDate() VBA
command can be used for date conversion prior to passing the data to Excel.
5.4 Commands
This section describes the possible calculations and other functions that can be called
in MBAL using the DoCmd function. The following are a list of those functions and the
text strings used to call them.
Any commands beginning with MBAL.MB can only be used if the material balance tool
is selected, where the 'MB' portion of the string indicates the material balance tool is
being used.
5.4.1 General
MBAL.ChangeTool=MB Change to the material balance tool
MBAL.ChangeTool=MC Change to the Monte Carlo tool
MBAL.ChangeTool=DC Change to the decline curve tool
MBAL.ChangeTool=1D Change to the 1D tool
MBAL.ChangeTool=ML Change to the multi-layer tool
MBAL.ChangeTool=TG Change to the tight gas model
MBAL.OpenFile Open an MBAL file
Example:
DoCmd ("MBAL.OpenFile(C:\Test\Oil.MBI") for a
macro based file path
DoCmd ("MBAL.OPENFILE=" + Range("a3")) for a
spreadsheet based file path, and:
DoCmd ("MBAL.OPENFILE(""" + Range("a3") +
MBAL.MB.RunSimulation
Runs a material balance history simulation
e.g.:-
MBAL.MB.ALLOCTANKRATEONLY(MBAL.MB.TANK[1])
There are several commands that can be used to build models from scratch. Their use
is demonstrated in the sample spreadsheet BUILD MODEL.XLS.
MBAL.MB.VALIDATE
It is possible to create new tanks, wells etc using the OpenServer. It is also possible to
populate the tank, well etc with the various items of data. However normally the object
will be marked as invalid (shown as red on the MBAL interface) until the user enters the
appropriate dialogue. This function will automatically validate all of the objects in the
material balance tool without having to enter each of the dialogues.
5.4.4 1D Model
MBAL.1D.RunSimulation :
Runs a 1D model simulation.
5.4.6 Multi-Layer
MBAL.ML.Calculate
Runs a multi-layer calculation.
MBAL.ML.Validate
Performs a validation for the data entered.
5.4.9 PVT
All the PVT commands can be used for any tool that has a PVT description i.e., MB,
MC, etc. The commands below are shown for the material balance tool. The strings can
be used for the MC or ML, etc., tools by simply replacing the MB with the corresponding
tool name designation i.e., MC, etc.
MBAL.MB.PVT.INPUT.CALCULATE
Performs a PVT calculation of fluid properties.
MBAL.MB.PVT.INPUT.MATCHCURRENT
Performs a PVT match calculation on the current correlation only.
MBAL.MB.PVT.INPUT.MATCHALL
Performs a PVT match calculation on all the correlations.
MBAL.MB.PVT.INPUT.MATCHCURRENT(OIL)
Performs a PVT match calculation on the current correlation only for the oil part of
a generalised material balance dataset.
MBAL.MB.PVT.INPUT.MATCHCURRENT(CON)
Performs a PVT match calculation on the current correlation only for the
condensate part of a generalised material balance dataset.
MBAL.MB.PVT.INPUT.MATCHALL(OIL)
Performs a PVT match calculation on all the correlations for the oil part of a
generalised material balance dataset.
MBAL.MB.PVT.INPUT.MATCHALL(CON)
Performs a PVT match calculation on all the correlations for the condensate part
of a generalised material balance dataset.
MBAL.MB[0].PVT.SETUP.PTS.ADD("ptsname")
Adds a path to surface object definition
MBAL.MB[0].PVT.SETUP.PTS[i].REMOVE
Removes the i path to surface object. All the indices of the path to surface after
the one being removed are going to change: recommended to use strings.
MBAL.MB[0].PVT.SETUP.PTS[i].IMPORT("filename")
Imports a *.prc file to the i path to surface object
MBAL.MB[0].PVT.SETUP.PTS[i].EXPORT("filename")
Exports the i path to surface to a *.prc file
MBAL.MB[0].PVT.SETUP.PTS[i].RENAME("newname")
Renames the i path to surface object
MBAL.MB[0].PVT.SETUP.PTS[i].REMOVEEQUIPMENT(equip, label)
Removes equipment from the i path to surface object.
Arguments
equip - Separator, Joint, Chiller
label - label of equipment
MBAL.MB[0].PVT.SETUP.PTS[i].UPDATEVALIDATION
Updates the validation flags used in the interface. To be used when you build a
path to surface object from the OpenServer
All of the PVT commands act on a PVT dataset. In the case of MC and ML and MB with
single tank there is only ever one dataset. But for multi-tank MB we can have more than
one dataset. In this case the above commands can be modified to perform the
command on different datasets e.g.
The OpenServer strings were obtained by holding Ctrl and Right-Clicking the
appropriate dialogues as mentioned previously.
The code will be written in the OpenServer template Excel file located in: C:\Program
Files\Petroleum Experts\IPM XX\Samples\openserver\Template\OpenServer
Template.xls.
NOTE: MBAL must already be opened since the code does not specifically initialises
an instance of MBAL.
Macro Code
Sub Macro() 'Macro name
variables
i = 0 'i = 0 is required to capture the first prediction date i.e., MBAL first index =
0
iCount = DoGet("MBAL.MB[0].TRES[{Prediction}][{Prediction}].COUNT")
'counts the number of prediction steps and eliminates the need to have prior knowledge
of the number of prediction steps
Do 'do loop
i=i+1
Loop While (i < iCount) 'Performs the loop to extract the results while the
prediction advances
End Sub
The variable can only take a value from a pre-defined list e.g. oil, water, gas,
condensate.
If it is desired to change the value of this type of variable using DoSet, a predefined text
string must be passed as the Value argument.
For example, if the fluid type is to be changed to either "OIL", "GAS", "CON" or “WAT”.
The list of possible values are listed for each variable below or can be found using the
Ctrl + Right Click technique described above.
Similarly, the DoGet function will return the text string corresponding to the given
variable.
The simplest client code in VBA to preform a step by step prediction will look like:
Server.DoCommand(“MBAL.MB.STARTPRED”)
Do
Server.DoCommand(“MBAL.MB.NEXTSTEPPRED”)
PredFinished = Server.GetValue("MBAL.MB.PREDFINISHED")
CurrentTime = Server.GetValue("MBAL.MB.CURRENTPREDTIME ")
Loop While (PredFinished = False )
Server.DoCommand(“MBAL.MB.ENDPRED”)
The STARTPRED command will initialize the prediction. Then call the
NEXTSTEPPRED command a number of times to do the next prediction step. Each
time the function is called, the latest value of the internal variable
MBAL.MB.PREDFINISHED will indicate if the prediction is finished.
It is possible to change some of the input data to the prediction between calls of the
NEXTSTEPPRED command. But be aware that it is only possible to change a sub-set
of the input data. In general we have endeavored to allow users to change data which is
likely to be altered in the real world situations. As an obvious case, we can not change
the OOIP of a tank in the middle of the prediction. However it is certainly possible that a
well is worked over during its life so it should be possible to change the PI.
If in doubt, the simplest solution is to try changing the data and check if it effects the
results.
NOTE
Note also that any changes to data will only have any effect on the remaining part of the
prediction. This is also true of time based input data such as the drilling schedule. For
example, if a prediction was performed to 2020 and then a new well added starting in
2010, it will have no effect on the prediction results up to 2020.
At any point in the prediction, it is possible to calculate the performance of the wells in
the drilling schedule at the current tank conditions. Before calling the command
NEXTSTEPPRED, the MBAL.MB.CALCWELLS command may be called any
number of times. The results from this calculation are stored in the last row of the well
results.
WARNING:
The rates in the well results are instantaneous rates for one well. This means that if it is
desired to examine field rates, then they must be calculated using the number of wells in
the drilling schedule. Additionally, any imposed downtimes and well start and end times
must also be considered if it is desired to calculate cumulative rates from the well
results.
If the well schedule is changed during a prediction, do NOT delete rows in the table. If it
is desired to stop the entry in the well schedule contributing to the prediction then
change the end date or set the downtime factor to 100%.
A number of examples have been included with the installed samples. These show
details of the above features and show how some simple extensions to the standard
material balance prediction can be implemented. See the following section for a list of
these examples.
The simplest client code in VBA to preform a step by step prediction will look like:
Server.DoCommand(“MBAL.PA.STARTALLOC”)
Do
Server.DoCommand(“MBAL.PA.NEXTSTEPALLOC”)
AllocFinished = Server.GetValue("MBAL.PA.ALLOCFINISHED")
CurrentTime= Server.GetValue("MBAL.PA.CURRENTALLOCTIME")
Loop While (AllocFinished = False )
Server.DoCommand(“MBAL.PA.ENDALLOC”)
The STARTALLOC command will initialize the prediction. Then call the
NEXTSTEPALLOC command a number of times to do the next allocation step. Each
time the function is called, retrieve the latest value of the internal variable
MBAL.PA.ALLOCFINISHED which will indicate if the prediction is finished.
If in doubt, the simplest solution is to try changing the data and check if it effects the
results.
NOTE
Note also that any changes to the data will only have any effect on the remaining part of
the allocation. This is also true of time based input data such as the layer production
schedule. For example, if an allocation was performed to 2020 and then a new layer is
added at 2010, the new layer will have no impact on the allocation results up to 2020.
A number of examples have been included with the installed samples and show details
of the above features and show how to implement simple extensions to the standard
production allocation.
5.6.1 Overview
A material balance model is made up of several objects. These include tanks, wells and
inflows. There are also some control data such as manifold pressure, time steps etc.
The production prediction method in MBAL uses these objects plus the control data to
perform its calculations using the same set of smaller calculations.
For each prediction time step, and for each well the following parameters are
considered:
- Calculate the GOR, WCT, CGR, WGR for each layer given the current
saturations and relative permeabilities.
- Calculate the PVT for each layer
- Calculate the well performance given production constraints and common
manifold pressure
- Remove the well production from the appropriate tanks
- Calculate the pressure at the end of the time step
In these situations it is now possible to write customised predictions since direct access
to the objects and low-level calculations has been provided. Macros can be written that
create the objects and call the low-level calculations in whatever form the user requires
to perform a specific type of prediction. The macro can also provide the control data
used to define manifold pressure, time steps etc.
Since we are working at a much lower level in the calculations, the commands given to
access to the temporary calculation variables as well as the input variables can be read
and change the cumulative rates in the tanks as well as being able to change the relative
permeabilities.
There are two levels of functions: The lower level functions provide the highest level of
flexibility and the higher level functions collect a number of lower level functions into a
single function to perform a common task.
High and low level functions can be called together in the same macro. So the higher
level functions can be used for the majority of the prediction macro and low level
functions can be called if any specialist behaviour is required.
Unlike the other uses of OpenServer, these functions do not operate on the data shown
in the MBAL interface. One still needs to run MBAL to use the functions, and the data
loaded by these function are not visible anywhere in the interface. Any data loaded in
MBAL whilst running a macro using these functions is unaffected by the macro.
We supply two example macros which are described in detail in the following sections
and recommend reviewing the code structures prior to writing a custom macro.
5.6.2 Summary
All commands and data tags used for the Direct Access OpenServer start with the
following prefix
MBAL.RL
The low-level commands work slightly differently from the standard OpenServer
commands. The commands are split into a number of sections with different sub-tags for
each command. and include:
Many of the commands need large amounts of data to be passed to MBAL. For
example the WELLDATA command, used to read all the IPR data, needs to pass more
than 10 variables. To pass this data, there is a data block associated with each
command. One of the items in the data block is a command ID which determines which
command is to be called. The data block can be accessed using the normal DoGet and
DoSet commands.
For example, consider the situation where we wish to update a tank with new cumulative
rates. The first step is to read the current conditions and to do this we set the command
ID and tank number in the data block associated with the RESCALC command and
then call the command to read the data into the data block as per the following:
All the tank data will be in the SMBRESDATA data block and now the cumulative rates
in the data block can be changed. To write the data back to the tank, we now load the
Write Tank Data command ID into the data block and call the RESCALC command as
per the following:
Note that there are many other data items belonging to the tank which are retrieved and
set by the two DoCmd calls in the SMBRESDATA data block. If we are doing a Get
and Set a pair as above, we only need to set the items we want to change as the other
values in the data block will still be the same as from the read command.
This example is a VBA macro in an Excel spreadsheet called DA1.XLS is installed with
the program in the samples directory.
The purpose of the macro is to run a prediction similar to the standard macro except that
it uses different manifold pressures for each well.
The first command MBAL.RL.ALLREST should be called at the start of all macros as it
deletes any objects that might not have been cleaned up when running a previous
macro.
DoCmd "MBAL.RL.ALLRESET"
The next step is to create and initialize the data objects i.e., tanks, wells, layers and the
connections between them. In most cases, the simplest way to do this is to read the
objects from an existing *.MBI file. Low level functions do exist, which allow the objects
to be created without reference to a *. MBI file, and the MBAL interface is obviously the
most convenient way to set up the objects.
The MBAL.RL.INITIALISE function will read the objects from the *.MBI file specified in
the command tag and create objects matching those in the file and connect them
together as in the given *.MBI file. All the objects are now initialized and ready for
calculations to be performed. MBAL will then run the history simulation up to the time
specified in the ENDHISTORY data item, and if a value of -1 is used then MBAL will
automatically run the history to the end of the production history in the tanks.
The USESUBSTEP data item must be set to indicate if sub-steps should be used in the
history simulation, and if the value is set to zero, MBAL will only calculate at the times
specified in the production history. Alternatively, if the value is set to one, then MBAL
will also calculate sub-steps between the entered times.
After the INITIALISE function, we read and store the handle that MBAL gave to the file
we just read in a VBA variable. This is needed in various commands used later in the
macro.
In the last command we asked MBAL to run the history simulation to the end of the tanks
production history, but we do not know what that time was and therefore where to start
the prediction. So the next code fragment gets the data of the 1st tank in the
corresponding *.MBI file - the CUMTIM variable from the data block will indicate the
start of the prediction. We can simply use the 1st tank as the value that will be the same
for all of the tanks. We have to set the *.MBI file handle stored above, and the command
ID=8 to get the tank data. Also, set the tank number to zero to indicate that we want the
data from the 1st tank. After calling the RESCALC function, store the CUMTIM
variable in the dEndHistory VBA variable.
The macro defined the WellName() VBA variable at the top of the macro which lists the
names of the wells in the MBI file.
WellName(0) = "OilWell"
WellName(1) = "GasLift"
WellName(2) = "WatInj"
WellName(3) = "GasWell"
The next section of the code finds the well model handle of the corresponding well object
in MBAL for each of the wells in the VBA WellName() variable. It saves the well model
handles in the VBA variable iWellModel() in the same order as the WellName() variable.
If the macro is to do any special manipulation of wells such as using a particular WHP
for WELLA-3, etc., then the calling macro has to know the handle of each well.
The first stage is to get the number of wells loaded in MBAL and set the Command ID=4
to get the number of well models. After calling the WELLDATA command, we can then
get the number of well models from the INTDATA variable in the data block.
The next step is to loop round each well model in MBAL and find the name of each well.
When we find the matching name, we store the well handle. To find the name, we load
the stored MBI file handle in the MBIHANDLE variable, and use the command ID=10 to
get the well model name and the HANDLE variable with the MBI well model handle.
After the WELLDATA command the WELLNAME variable contains the name.
Next j
Next i
By default, the well model is created assuming there is one instance of the well model.
This next fragment shows how to model more than one well being drilled of the same
type:
- Load the MBI handle as usual
- Load 2nd well model handle in the HANDLE variable as we wish to modify the
Gas Lift well
- Load the number of wells to drill in NUMWELL
- Load –1 in the variable IPRNUM (this indicates that the command is not specific
to a particular layer)
The next sub-section shows how to set a downtime factor for the 1st well, the Oil Well. A
downtime of zero means that the well is always producing, where a downtime of 1.0
means that the well is never producing. The method is much the same as for setting the
number of wells.
This next section shows how to set a start and end time for a well model. This code
fragment also shows an important point concerning the use of times. In the Direct
Access OpenServer, times are in internal units which are the number of days since
1900. Obviously these are not very convenient units, and if calendar dates i.e.,
01/01/1994 aare being used a command to convert calendar dates to internal times
(and back again) is provided. To do this set the DATE variable to the calendar date
required, then call the DATETOTIME command. The answer can then be retrieved
from the TIME variable. To do the reverse calculation use the command
TIMETODATE.
We first convert the two calendar dates required to internal times, and then set the
STARTTIME and ENDTIME variables to these two internal time values. We set the
HANDLE to the well model handle for the third well (Gas Well) and finally set the
Command ID=14 to set the start and end times.
We have now completed the initialization and are ready to go into the prediction loop.
The rest of the source code listings are within the main prediction loop which does a
time step for each time through the loop.
The first fragment from within the loop is used to update the layers to the current tank
conditions. The UPDATELAYERS command only needs the well model handle. The
command will loop through each layer in the specifed well model and for each layer it will
update the PVT properties from the tank calculated at the current pressure. It then
calculates the WCT, GOR, CGR, and WGR for each layer from the relative
permeabilities and breakthroughs.
NOTE: This command must be called, or the initial tank conditions will always
be used! No command ID is needed.
The next section is used to calculate the performance of the wells using the IPR/VLP
intersection calculation. In this macro we apply a different FWHP for each well. Much of
this part of the macro is repeated for each well so only a relevant fragment for the gas lift
well is shown.
The first step is to set the well model handle. The next variable to set (TOL) is used to
control if intersections are allowed on the negative slope section of the lift curve. The
normal situation is where they are not allowed in which case use 0.0. If negative VLP
intersections are allowed, the value will be set to a large value i.e., a value of -1e10 will
allow any size of negative slope solution.
We then set the extrapolation flag. This specifies whether the lift curves should be
extrapolated beyond the upper and lower values of the sensitivity variables. In general,
the lift curves should be calculated over all the expected ranges of sensitivity variables.
However limited extrapolation will broaden the range of the lift curves.
The next step is setting the sensitivity variables for the lift curves, and the required
variables will depend on the well type and include:
The results of the calculation are the total rate, GOR, WCT etc., which can be retrieved
from the data block.
Note that the total rate is liquid rate for oil or water wells and gas rate for gas or
condensate wells.
This fragment also shows the use of special error codes. The commands already use
the standard OpenServer error handling, such as asking for data for a tank handle that
does not exist. However, there are also some less serious errors that should not halt the
macro but that may require special processing. An example of this is if no solution point
could be found for an IPRVLPCALC command. These error codes are stored in the
SMBERRORDATA data block as shown above.
The next step is to calculate the individual layer rates and FBHP pressure for the total
rate found by the IPRVLPCALC command. This is done for each well with the following
code:-
The next code fragment shows how the fluid properties can be queried for the well given
the different rates and properties of each layer.
Load the IPRNUM variable with –1 that will indicate the well properties will be queried.
If IPRNUM is set to a particular layer, then the command retrieves the values for that
layer only.
At the end of the initialization process we set various attributes of the wells to mimic a
well schedule. For example, we set a start and end time for the Gas Well, a downtime
factor for the Oil Well and the number of gas lift wells was set to two. The next command
is used to factor the well and layer rates to take these into account.
Set the well model as usual and the IPRNUM to –1 to indicate all layers should be
factored. If start and end times have been used on the well, then also set the
STEPSTARTTIME and STEPENDTIME variables with the times of the start and end
of the step. If well multipliers, downtime factors or start and end times have not been set
then there is no need to call this command.
Now that we have the correct layer rates we must calculate how much oil, water and gas
is taken out of each tank for this time step. Load the well handle and the DELTIM
variable with the length of the time step. MBAL will loop through each layer in the well
and update the attached tank with the layer rate*DELTIM. Remember that MBAL knows
which layer is attached to which tank.
The final command for each time step is to perform the material balance for all the tanks
in the MBI file. This will calculate the new tank conditions at the end of the time step,
including pressure and saturations.
We now need to set the MBI handle, and if more than one MBI file is loaded, then this
command must be called more than once. Set the CUMTIM variable to the time at the
end of the time step. Set the USESUBSTEP flag to one if it is desired to split the step
into a number of sub-steps, otherwise leave the value at zero.
There are two commands that are called just before completing the macro. The first
command saves the tank conditions in an MBR file. This file can be read by MBAL.
The second is called to delete all the data created in the macro, ready for another
prediction to be performed.
The purpose of the macro is to run a prediction similar to the standard macro except that
it uses different manifold pressures for each well.
Some of the parts of the code are the same as the high level example. However, the
explanation is repeated for clarity.
The first command M B A L .RL.ALLRESET should be called at the start of all macros.
As the name suggests, it deletes any objects that might not have been cleaned up when
running a previous macro.
We now load an MBI file. This will read the tanks from the MBAL file and create
corresponding tank models for each tank in the file, and also reads the wells and layers
from the file but it does NOT create the corresponding well and layer models which is
done later in the macro.
NOTE: We store the MBI file handle created by the OPENFILE command.
FilePath = Environ("IPM_Samples")
FilePath = FilePath & "\mbal\Material Balance Examples
\Reference Examples\detailed2.mbi"
DoCmd "MBAL.RL.OPENFILE=" + FilePath
iMBIHandle = DoGet(" M B A L .RL.SMBDATA.HANDLE")
The next section reads the number of tanks read from the file. Load the MBI file handle
and command ID=11. The number of tanks is returned in the INTDATA variable. Now
loop round the tanks and get the name of the tank. Load the tank index and the
command ID=5. The name is returned in the STRING variable.
We now have to initialize the tanks to the end of the production history, however, each
tank may have production history data up to different dates. In this case we have
decided to run the simulation up to the earliest end of history data of all the tanks. So we
next query the end of the tank history and use the earliest date. As with the tank names,
load the tank index and the command ID=8. The end of the history for the tank is
returned in DOUBLEDATA.
Now that we have the date to run the history to, we can initialize the tanks which is done
in two steps. The command ID=0 will initialize the model and the command ID=1 will run
the history simulation to the specified date. We load the USESUBSTEP flag to indicate
if the simulation should only calculate at the entered production history points or if it
should also use sub-steps between the entered points.
DoCmd "MBAL.RL.RESCALC"
The next stage in the initialization is to create the well models. It is possible to create
well models from scratch, however, it is significantly easier to create the well models
from wells read in directly from the MBAL file which is the method illustrated in the
macro.
There are no commands to find the number of wells in the MBI file. Instead we use an
iteration method where we loop through the indices for the MBI file wells until we get an
error code indicating that we have read all the wells. The principal for layers within each
well is the same, after successfully reading a well or layer, we create an equivalent well
or layer model.
The first step is to set the MBI file handle and tank number.
Now start looping through the wells read in the MBI file handle. The loop will stop when
there are no more wells to read.
Set the HANDLE variable to the next well in the MBI file to read. The well index starts at
zero and is incremented by one at the end of the loop. Also, set the IPRNUM to zero to
read the first layer in the well. If the well index does not exist in the file the command will
return an error code of 214. For this case, set the flag to stop the loop, otherwise no well
and layer data is read into the SMBWELLDATA data block.
At the top of the macro, we defined a VBA variable WellNames() in which the name of
the wells were stored which we expect to find in the MBI file.
The next fragment checks which well we have just read from MBAL by comparing with
WellName = DoGet("MBAL.RL.SMBWELLDATA.WELLNAME")
For i = 0 To iNumWells - 1
If (WellNames(i) = WellName) Then
iWellIndex = i
End If
Next I
We now create a well model from the data read from the MBI file. Load the command
ID=1. The other data required in the SMBWELLDATA data block will have been setup
by the last call to the get well data command. After creating the well model, we read
back the handle of the well model and store it in the iWellModel() VBA variable.
iCommand = 1 ' Create a well command
DoSet "MBAL.RL.SMBWELLDATA.MBIHANDLE",
iMBIHandle
DoSet "MBAL.RL.SMBWELLDATA.COMMAND", iCommand
DoCmd "MBAL.RL.WELLDATA"
iWellModel(iWellIndex) =
DoGet("MBAL.RL.SMBWELLDATA.HANDLE")
iNumWellModels = iNumWellModels + 1
The next stage is to create the layers for this well. We use the same principal of reading
through the layer indices until we get an error message warning that no more layers are
left.
iIprFound = 1
iIPRNo = 0
Do
Call the command to read the well from the MBI file again. This time we are interested
in the layer data so we set the IPRNUM to read the next layer (starting at layer zero).
Check if a layer was found. If we have got to the end of the layer list we get an error
code=216. Otherwise the command will have successfully loaded the next layer data
into the SMBWELLDATA data block.
Before creating the layer model, we have to find the index of the tank to which the layer
is connected. Now the last command will return the name of the connected tank in the
TANKNAME variable. Just after reading the tanks from the MBI file we read and stored
the names of the tank in the szTankNames VBA variable for each tank index. So by
searching through the szTankNames list we can find the index of the connected tank.
szTankName =
DoGet("MBAL.RL.SMBWELLDATA.TANKNAME")
For i = 0 To iNumTanks - 1
If (szTankName = szTankNames(i)) Then
DoSet "MBAL.RL.SMBWELLDATA.TANKNUM", i
End If
Next I
Finally we call the command to create an IPR/layer model and connect it to the well
model. The data used to initialize the IPR model is taken from the SMBWELLDATA
data block. This is the same data that was loaded with the layer data by the last
command, so we are simply transferring it from the layer in the MBI file to the layer
model just created.
DoSet "MBAL.RL.SMBWELLDATA.MBIHANDLE",
iMBIHandle
DoSet "MBAL.RL.SMBWELLDATA.HANDLE",
iWellModel(iWellIndex)
DoSet "MBAL.RL.SMBWELLDATA.IPRNUM",
iIPRNo
iCommand = 35 ' Add an IPR command
DoSet "MBAL.RL.SMBWELLDATA.COMMAND",
iCommand
DoCmd "MBAL.RL.WELLDATA"
End If
iIPRNo = iIPRNo + 1
Loop While (iIprFound)
End If
iWellNo = iWellNo + 1
Loop While (iWellFound)
We have now created the tank, well and layer/IPR models that mirror the objects in the
MBI file.
By default, the well model is created assuming there is one instance of the well model.
This next fragment shows how it is possible to model more than one well being drilled of
the same type. Load the MBI handle as usual. Load 2nd well model handle in the
HANDLE variable as we wish to modify the Gas Lift well. Load the number of wells to
drill in NUMWELL. Load –1 in the variable IPRNUM, as this indicates that the
command is not specific to a particular layer.
The next sub-section shows how to set a downtime factor for the 1st well, the Oil Well. A
downtime of zero means that the well is always producing. A downtime of 1.0 means
that the well is never producing, and the method is much the same as for setting the
number of wells.
This next section shows how to set a start and end time for a well model. This code
fragment also shows an important point concerning the use of times. In the Direct
Access OpenServer, times are in internal units which are the number of days since
1900. Obviously these are not very convenient units, and if calendar dates e.g.
01/01/1994 are being used, we provide a command to convert calendar dates to
internal times (and back again). To do this set the DATE variable to the calender date
required, then call the DATETOTIME command. The answer can then be retrieved from
the TIME variable. To do the reverse calculation ,use the command TIMETODATE.
We first convert the two calendar dates required to internal times, and then set the
STARTTIME and ENDTIME variables to these two internal time values. We set the
HANDLE to the well model handle for the third well (Gas Well), and finally set the
Command ID=14 to set the start and end times.
We have now completed the initialization and are ready to go into the prediction loop.
The rest of the source code listings are within the main prediction loop which does a
time step for each time through the loop.
The first code fragment from within the loop is used to display the current time on the
sheet. It shows how to convert an internal time (in number of days since 1900) to a
calendar date, note that it will use the current international date settings on the
PC.
The first main task in the prediction step is to initialize the layers to the current tank
conditions. First, update the PVT properties with those calculated in the tanks at the
current pressure. Then calculate the breakthroughs i.e., GOR, WCT, CGR, and WGR,
etc., using the current fluid properties and saturations.
We can update the PVT properties with a single command for each well. Load the MBI
file handle, the well model index and set the layer number to –1 to indicate all layers
should be recalculated. If a specific layer number is specified, then only that layer is
calculated.
iIPRNo = -1
DoSet " M B A L .RL.SMBWELLDATA.IPRNUM", iIPRNo
DoSet " M B A L .RL.SMBWELLDATA.MBIHANDLE",
iMBIHandle
DoSet " M B A L .RL.SMBWELLDATA.HANDLE",
iWellModel(iWellNo)
iCommand = 23 ' Update PVT from tank command
DoSet " M B A L .RL.SMBWELLDATA.COMMAND", iCommand
DoCmd " M B A L .RL.WELLDATA"
In this example we calculate the GOR, etc., layer by layer. This is partly as
demonstration, but also because we wish to read the pressure of each layer. We again
use the technique of iterating through the layers until we get an error message that no
more layers are available. First set up the IPR number to the next layer and call the
command with command ID=6 to calculate the breakthroughs. If the layer/IPR index is
not valid, an error code=216 will be reported.
iIPRNo = 0
iIprFound = 1
Do
DoSet " M B A L .RL.SMBWELLDATA.MBIHANDLE",
iMBIHandle
DoSet " M B A L .RL.SMBWELLDATA.HANDLE",
iWellModel(iWellNo)
DoSet " M B A L .RL.SMBWELLDATA.IPRNUM", iIPRNo
iCommand = 6 ' Calculate breakthroughs
command
DoSet " M B A L .RL.SMBWELLDATA.COMMAND",
iCommand
DoCmd " M B A L .RL.WELLDATA"
iErrorCode =
DoGet(" M B A L .RL.SMBERRORDATA.CODE")
If (iErrorCode = 216) Then ' IPR not found
iIprFound = 0
Else
As with the PVT calculations above, we could have done this in one step by using a
layer number of –1. The layer index was valid so it has calculated the breakthroughs
successfully. We next perform a layer read command which reads all the current IPR
data into the SMBWELLDATA data object. In this case, we only read back the current
connected tank pressure and display it on the sheet.
DoGet(" M B A L .RL.SMBWELLDATA.RESPRESS")
End If
End If
iIPRNo = iIPRNo + 1
Loop While (iIprFound)
The next section is used to calculate the performance of the wells using the IPR/VLP
intersection calculation. In this macro we apply a different FWHP for each well. Much of
this part of the macro is repeated for each well so only a relevant fragment for the gas lift
well is shown.
The first step is to set the well model handle. The next variable to set (TOL) is used to
control if intersections are allowed on the negative slope section of the lift curve. The
normal situation is where they are not allowed in which case use 0.0. To allow large
negative lift curve intersections, apply a large negative value. To allow any size of
negative slope, use a value of -1e10.
The next step is setting the sensitivity variables for the lift curves and will depend on the
type of well being specified, such as:
The next step is to call the command IPRVLPCALC. No command ID is needed. The
results of the calculation are the total rate, GOR, WCT, etc., which can be retrieved from
the data block. Note that the total rate is liquid rate for oil or water wells and gas rate for
gas or condensate wells. If an error code=120 is returned then no solution was found.
DoGet(" M B A L .RL.SMBIPRVLPCALC.QTOT")
Range("I" + CStr(17 + iStep)) =
DoGet(" M B A L .RL.SMBIPRVLPCALC.GOR")
Range("J" + CStr(17 + iStep)) =
DoGet(" M B A L .RL.SMBIPRVLPCALC.WC")
End If
Else
Now we transform the well rates into cumulative rates taken out of each tank. This is
done for each well in turn.
First we calculate the FBHP for the well using the following steps:
- Set the well model index and MBI file handle as usual
- Set the IPR number to –1 as the calculation is for the well rather than an
individual layer
- Set the command ID=27 to calculate the FBHP
- After the command is called, we can retrieve the calculated FBHP from the
FBHP variable in the SMBWELLDATA data block.
iIPRNo = -1
DoSet " M B A L .RL.SMBWELLDATA.IPRNUM", iIPRNo
DoSet " M B A L .RL.SMBWELLDATA.MBIHANDLE", iMBIHandle
DoSet " M B A L .RL.SMBWELLDATA.HANDLE", iWellModel(iWellNo)
iCommand = 27 ' Calculate FBHP command
DoSet " M B A L .RL.SMBWELLDATA.COMMAND", iCommand
DoSet " M B A L .RL.SMBWELLDATA.QTOT", Qtot
DoCmd " M B A L .RL.WELLDATA"
FBHP = DoGet(" M B A L .RL.SMBWELLDATA.FBHP")
Now we have the bottom hole pressure, we can calculate the corresponding individual
layer rates. This command can be performed on individual layers if desired, however in
this macro, we calculate all the layers at once by setting the IPR number to –1.
The input FBHP is taken from the FBHP variable in the SMBWELLDATA data block.
For this macro, this variable was set up by the last command shown above so we do not
actually need to set it up again, however, it is shown again for clarity. The individual
phase rates are calculated by this command given the total rate and the GOR, WCT, etc.
iIPRNo = -1
DoSet " M B A L .RL.SMBWELLDATA.IPRNUM", iIPRNo
DoSet " M B A L .RL.SMBWELLDATA.FBHP", FBHP
DoSet " M B A L .RL.SMBWELLDATA.MBIHANDLE",
iMBIHandle
DoSet " M B A L .RL.SMBWELLDATA.HANDLE",
iWellModel(iWellNo)
iCommand = 26 ' Calculate rates from FBHP
command
DoSet " M B A L .RL.SMBWELLDATA.COMMAND", iCommand
DoCmd " M B A L .RL.WELLDATA"
At the end of the initialization process we set various attributes of the wells to mimic a
well schedule. For example, we set a start and end time for the Gas Well, a downtime
factor for the Oil Well and the number of gas lift wells was set to two. The next
commands are used to factor the well and layer rates to take these into account.
Set the well model as usual and the IPRNUM to –1 to indicate all layers should be
factored. If start and end times have been imposed on the well, the STEPSTARTTIME
and STEPENDTIME variables with the times of the start and end of the step must also
be set. If well multipliers, downtime factors or start and end times for a well have not bee
set there is no need to call this command.
iIPRNo = -1
DoSet " M B A L .RL.SMBWELLDATA.IPRNUM", iIPRNo
DoSet " M B A L .RL.SMBWELLDATA.MBIHANDLE",
iMBIHandle
DoSet " M B A L .RL.SMBWELLDATA.HANDLE",
iWellModel(iWellNo)
DoSet " M B A L .RL.SMBWELLDATA.STEPSTARTTIME",
CUMTIM - DELTIM
DoSet " M B A L .RL.SMBWELLDATA.STEPENDTIME", CUMTIM
iCommand = 36 ' Correct rates for well schedule
command
DoSet " M B A L .RL.SMBWELLDATA.COMMAND", iCommand
DoCmd " M B A L .RL.WELLDATA"
At this point, we show how to read the PVT data for the total well fluid given the different
rates and fluid properties in each layer. As done previously, we set the MBI file handle
and the well model index. Since we want the well fluid properties, we set the IPR
number to –1.
If fluid properties for an individual layer are required then set a particular index in the IPR
number. There is no special command to get the fluid properties as the standard read
IPR data command will calculate and return the fluid properties for the well. After calling
the read IPR, the required values are loaded in the SMBWELLDATA data block. See
the following section (Datablock Variable Names) for a list of all the fluid properties that
can be read.
The next step is to read the calculated rates from the layers and use them to update the
total cumulative rates removed from the tank at the end of the time step. This will then
allow us to calculate the pressure at the end of the step. As done previously, we use the
technique of reading each layer in turn until we get an error message that there are no
more layers.
iIPRNo = 0
iIprFound = 1
Do
DoSet " M B A L .RL.SMBWELLDATA.MBIHANDLE",
iMBIHandle
DoSet " M B A L .RL.SMBWELLDATA.HANDLE",
iWellModel(iWellNo)
DoSet " M B A L .RL.SMBWELLDATA.IPRNUM", iIPRNo
iCommand = 22 ' Read IPR data command
DoSet " M B A L .RL.SMBWELLDATA.COMMAND",
iCommand
DoCmd " M B A L .RL.WELLDATA"
iErrorCode =
DoGet(" M B A L .RL.SMBERRORDATA.CODE")
If (iErrorCode = 216) Then ' IPR not found
iIprFound = 0
Else
The SMBWELLDATA block should now have the rates read from the layer. Note that
the rates are in the units of STB/day and scf/day for oil/water and gas respectively. If any
correction was made for downtimes, number of wells and start and end times then these
effects will be factored into these rates. We also query the tank index of the tank to
which the layer is connected and the handle of the MBI file that the connected tank
belongs. If all the tanks are in one MBI file (as recommended), then this handle will
always be zero.
Qtot =
DoGet(" M B A L .RL.SMBWELLDATA.QTOT")
Qo = DoGet(" M B A L .RL.SMBWELLDATA.QO")
Qg = DoGet(" M B A L .RL.SMBWELLDATA.QG")
Qw = DoGet(" M B A L .RL.SMBWELLDATA.QW")
iTankNo =
DoGet(" M B A L .RL.SMBWELLDATA.TANKNUM")
iMBIHandleOfTank =
DoGet(" M B A L .RL.SMBWELLDATA.MBIHANDLE")
We now want to update the cumulative rate in the tanks. The first step is to read the
data currently in the connected tank, then set the tank number and MBI file handle from
the last step and the command ID=8 to read the tank data. Note that we use the
SMBRESDATA data block for tank commands.
Now we read back the current cumulative rates for each phase (plus injected phases).
These are the cumulative rates to the beginning of the time step including any production
history. Calculate the delta cumulative rates for this time step. Note that the cumulative
rates are in units of MMSTB or MMscf, hence the division by 1.0e6 and then add them to
the current cumulative rates to give the cumulative rates to the end of the time step.
It is important to check for injectors at this point as the well rates are passed
back as Qw regardless if it is a producer or injector.
CUMOIL =
DoGet(" M B A L .RL.SMBRESDATA.CUMOIL")
CUMGAS =
DoGet(" M B A L .RL.SMBRESDATA.CUMGAS")
CUMWAT =
DoGet(" M B A L .RL.SMBRESDATA.CUMWAT")
CUMGASINJ =
DoGet(" M B A L .RL.SMBRESDATA.CUMGIN")
CUMWATINJ =
DoGet(" M B A L .RL.SMBRESDATA.CUMWIN")
If (iWellNo = 2) Then
CUMWATINJ = CUMWATINJ + DELTIM * (Qw
/ 1000000#)
Else
CUMOIL = CUMOIL + DELTIM * (Qo /
1000000#)
Finally, set the new cumulative rates back into the tank. There are other data items
written back to the tank which we do not update, however, they will have been set by the
read tank command above.
We have now transferred the required data from the wells to the tanks and are now
ready to perform the material balance calculations to find the pressure and saturations
at the end of the time step.
The first step is to setup the calculation control variables for each tank. We must read
the data from the tank, modify the required data in the SMBRESDATA data block and
then write it back and set the CUMTIM variable to the end of the time step. The
USESUBSTEP variable indicates if substeps should be used over the time step and
this will increase accuracy, particularly if large aquifers are used.
Set the MODE to zero which should always be used for material balance, then set the
PRESSURE variable to 1.0e38 to indicate that the pressure at the start of the step
should be taken from the end of the last step and should always be used. Finally, set the
injected gas gravity flag to –1 to indicate that the injection gas gravity should be taken
from the tank PVT model.
For i = 0 To iNumTanks - 1
' First do a read data
DoSet " M B A L .RL.SMBRESDATA.HANDLE", iMBIHandle
iCommand = 8 ' Set tank prediction data command
DoSet " M B A L .RL.SMBRESDATA.COMMAND", iCommand
DoSet " M B A L .RL.SMBRESDATA.TANKNUM", i
DoCmd " M B A L .RL.RESCALC"
DoSet " M B A L .RL.SMBRESDATA.HANDLE", iMBIHandle
iCommand = 9 ' Set tank prediction data command
DoSet " M B A L .RL.SMBRESDATA.COMMANDID", iCommand
DoSet " M B A L .RL.SMBRESDATA.TANKNUM", i
DoSet " M B A L .RL.SMBRESDATA.CUMTIM", CUMTIM
DoSet " M B A L .RL.SMBRESDATA.USESUBSTEP", 0
DoSet " M B A L .RL.SMBRESDATA.MODE", 0
DoSet " M B A L .RL.SMBRESDATA.PRESSURE", 1E+38 '
Use the value already stored
DoSet " M B A L .RL.SMBRESDATA.INJGASGRAV", -1# '
indicates not used
DoCmd " M B A L .RL.RESCALC"
Next I
Now we can calculate the actual material balance. The commands for this works on all
the tanks in the MBI file at once as we need to solve all tanks simultaneously to
understand if there is any communication between the tanks. Load the MBI file handle
and set the command ID=2 to perform the material balance. Then call the RESCALC
command again with command ID=4 which is used to confirm that we wish to keep the
results from this step as we are not going to repeat the step.
This completes all the code within a prediction time step. Before finishing the macro,
we save the tank results in a file and then clean up the data.
The following line saves the tank results over time in an MBR file which can be read in
MBAL. This is the same file as is written by GAP.
FilePath_s = Environ("IPM_Samples")
FilePath_s = FilePath_s & "\mbal\Material Balance
Examples\Reference Examples\detailed2res.mbr"
DoCmd "MBAL.RL.SAVEFILE=" + FilePath_s
Finally clean up the data that we created in the macro. First delete the well models and
their associated layer models, this does not delete the tanks. We then use the RESET
command with the MBI file handle appended to the command tag.
SMBWELLDATA
DOWNTIME Well downtime
NUMWELL Number of wells
STARTTIME Start time
ENDTIME End time
STEPSTARTTIM Start of timestep
E
SMBRESDATA
HANDLE MBI file handle
COMMANDID Command ID
USESUBSTEP Flag to indicate if calculation step size should be used
CUMTIM Time simulation/prediction has been run to
CUMAQU Cumulative aquifer well production
CUMCAP Cumulative gas cap production
CUMGAS Cumulative gas production
CUMGIN Cumulative gas injection
CUMOIL Cumulative oil production
CUMWAT Cumulative water production
CUMWIN Cumulative water injection
CUMWIX Cumulative water influx from aquifer
PERM Permeability (for gas coning only)
ANISOTROPY Anisotropy (for gas coning only)
PRESSURE pressure
FLUID Fluid type
SOLGOR Initial Rs
RS Current solution GOR
OILAPI Oil API
GRVGAS Gas gravity
WATSAL Water salinity
GRVOIL Oil gravity
PB Bubble point
FACTOZ Z Factor
SMBIPRVLPCALC
HANDLE Well handle
TOL Defines how large a negative slope of the lift curve is allowed in
solutions
WHP Wellhead pressure
GLRINJ Gas lift to liquid ratio
FREQ ESP frequency
QTOT Total rate (liquid for oil/water, gas for gas/condensate)
GOR Produced GOR
CGR Produced CGR
WC Produced Wc
WGR Produced WGR
ALL variable text strings in the MBAL program start with “MBAL” The next part of the
text string defines the section of the program to which the variable belongs. This will
make the first part of the text string:
MBAL.1D – 1D model
MBAL.MC – Monte Carlo
MBAL.DC – Decline curve
MBAL.PVT – PVT or composition input
The rest of the string depends on the exact variable. The following lists the sub-names
to add for each variable. The variables are listed grouped into each of the above
sections.
Within each group, the variables are ordered into function groups e.g. tanks, constraints
etc.
There is a separate section for relative permeabilities as they are used by more than
one tool.
Each sub-name is indented from its parent. So as an example, the string for the tank
porosity from the following list will be:
MB
TANK
PRESSURE
POROSITY
would be MBAL.MB.TANK.POROSITY.
5.7.1 1D Model
All the following variables will need to be preceded by the following OpenServer string
structure:
MBAL.1D
THICKNESS Thickness
STARTINJ Time of start of injection
CONTACT Oil/Gas/Water contact
CUTOFFWC Water cut cut-off
CUTOFFGOR GOR cut-off
POR Porosity
CONWAT Connate water
CUTOFFGOR GOR cut-off
NUMCELLS Number of cells
RELPERM Relative permeability curves
(See Relative Permeability section below)
RESULT[i]. Results table
TIME Time
etc.
MBAL.MC
MBAL.DC
MBAL.ML
TIME Time
Etc.
RES[ ].MATCHED. Matched layer - see end of section (**) for more
information
THICK Thickness
POR Porosity
PERM Permeability
GASBRKSAT Gas breakthrough saturation
WATBRKSAT Water breakthrough saturation
RELPERM Relative permeability curves
(See relative perm section below)
* RES is the sub-string used for the calculation results. This is the data that can be
viewed in the Calculation-Run Calculation dialog or the Production Prediction-Run
Prediction dialog.
There are three indices to be used with RES.
The first index defines the stream. There are always four streams by default which
correspond to each of the four calculation types. Index 0 is the Buckley Leveret stream,
index 1 is the Stiles stream, index 2 is the communicating stream and index 3 is the
simple stream. Other indices will refer to any saved streams. Stream names can be
used instead of the index e.g. RES[{STILES}][0][0]. and the name can be sued for any
saved streams.
The second index defines the sheet within the stream. The first stream is the
consolidated results for the whole reservoir. The next N sheets contain results for each of
the N layers. The layer description can also be used instead of the index e.g.
RES[{STILES}][{LAYER 1}][0].
The third index defines the row in the sheet (where each row is for a different time).
** RES[].MATCHED is the layer calculated for each folder. The RELPERM is the relative
permeability curve calculated by the Fw/Fg matching process. The index defines the
stream as for the first index of the RES[][][] sub-string above. For example the thickness
of the calculated Stiles stream is RES[{STILES}].THICK.
5.7.5 PVT
All the following variables will need to be preceded by the following OpenServer string
structure:
MBAL.MB[0].PVT
The following will be under INPUT for a simple PVT model or LAYER[ ] if a variable
PVT model. If using Generalised Material Balance then the oil, gas and water models
will be preceeded by OIL, GAS and WATER respectively.
SOLGOR Solution GOR
PBCORR Pb, Rs, Bo correlation - one of { GLASO, STANDING,
LASATER, VAZBEGGS, PETROSKY }
µo CORR µo correlation - one of { BEAL, BEGGS, PETROSKY }
µg CORR µg correlation - one of { LEE, CARR }
SEP Separator type - one of { SINGLE, TWO }
USETABLES Use tables - one of { YES, NO }
USEMATCH Use match - one of { YES, NO }
SOLGOR Solution GOR
OILGRAV Oil gravity
GASGRAV Gas gravity
WATSAL Water salinity
H2S Mole percent H2S
CO2 Mole percent CO2
N2 Mole percent N2
TESTPRES Test separator pressure
TESTTEMP Test separator temperature
TESTGOR Test separator GOR
TESTGGRAV Test separator gas gravity
TANKGOR Tank separator GOR
TANKGGRAV Tank separator gas gravity
CGR CGR
DEWPOINT Dew point at reservoir temperature
RESTEMP Reservoir temperature
RESPRESS Reservoir pressure
DEPTH Depth
OILCOMP. Oil composition
NUMCOMP Number of components
USEVOLSHI Use volume shifts - one of { YES, NO }
FTS
COMPONEN.
T[i]
FRACTI Mole fraction
ON
CRITTE Critical temperature
MP
CRITPR Critical pressure
ESS
SETUP.
PTS.NUM_PTS Returns the number of path to surface objects defined
_OBJ
PTS[i].LABEL Returns the label of the i path to surface object
PTS[i].IS_VALI Validation flag for the i path to surface object
D 1 - valid
0 - invalid
PTS[i].IS_VALI Validation flag for the i path to surface object when criteria is oil
D_OILGAS and gas outlets ONLY
1 - valid
0 - invalid
PTS[i].PROCE For the path to surface object i, accesses the pressure of
SSDATA.SEPARATORseparator j.
[j].PRESSURE
PTS[i]..PROCE For the path to surface object i, accesses the temperature of
SSDATA.SEPARATORseparator j.
[j].TEMPERATURE
PTS[i]..PROCE For the path to surface object i, accesses the pressure of chiller
SSDATA.CHILLER[J].P j.
RESSURE
PTS[i]..PROCE For the path to surface object i, accesses the temperature of
SSDATA.CHILLER[j].T chiller j.
EMPERATURE
MBAL.MB
J
CUMWATIN Cumulative water injection
J
CUMGOR Cumulative GOR
RECOFF 0 if record enabled, 1 if the record is disabled
TANK[I]. Tanks
MONCON Monitor contacts - one of {YES,NO}
GASCAPPROD Gas Cap production - one of {YES,NO}
TOTSAT Total Saturations - one of {YES,NO}
GASSTORAGE Gas storage - one of {YES,NO}
NAME Name
TYPE Type - one of {OIL,GAS,CON,WATER}
TEMP Temperature
PRESS Initial Pressure
POROSITY Porosity
OOIP Original oil in place
OGIP Original gas in place
OWIP Original water in place
INITGASCAP Initial gas cap
GASSTOREPV Gas storage pore volume
WATCOMPRESS Water Compressibility (3.4e38 for Use Correlations)
ROCKCOMPRES Rock Compressibility
S
PRODSTART Start of production
AQUIFTYPE Aquifer type - one of { NONE, SMALLPOT, SCHILTHUIS,
HURSTSIMPL, HURSTODEH, HURSTDAKE, VOGT,
FETKOSTEADY, FETKOUNSTEADY, HURSTMODIF ,
CARTERTRACY }
SYSTEM Type - one of { RADIAL, LINEAR, BOTTOMDRIVE }
RESTHICK Reservoir thickness
RESRADIUS Reservoir radius
CONWATER Connate water saturation
RESWIDTH Reservoir width
ANISOTROPY Anisotropy
PERMEABILITY Permeability
AQUIF. Aquifer parameter
RD Outer/Inner radius ratio
ANGLE Encroachement Angle
PERM Aquifer Permeability
VOLUME Aquifer volume
DIFFUSIV Aquifer diffusivity
TD TD constant
MODEL Type - one of { CONSTPRESS, SEALBOUND, INFINITE} -
string
TIME Time
PRESS Pressure
DELPRESS Delta Pressure
CUMOIL Cumulative oil production
CUMGAS Cumulative gas production
CUMWAT Cumulative water production
RECOFF 0 if record enabled, 1 if the record is disabled
TIME Time
ATE
MINOILRATE Minimum oil rate
MAXOILRATE Maximum oil rate
GASVOIDREPL Gas voidage replacement
WATVOIDREPL Water voidage replacement
WATINJMANPRE Water injection manifold pressure
SS
MININJWATRAT Minimum injection water rate
E
MAXINJWATRAT Maximum injection water rate
E
MAX_GASLIFT Maximum gas lift rate
GASRECYL Gas recycling
GASRECCUTOF Gas recycling cutoff
F
YPE
ABANREC Allow recovery after abandonment - one of {YES,NO}
OV
IPR[I].
TYPE Inflow performance type - one of {CN, FORCH,
PSEUDOFORCH, STRLINE_VOGEL}
PI Productivity index
CROSSPI Crossflow Injectivity index
DARCY Darcy
CROSSDA Crossflow Injectivity Darcy
RCY
NONDARCYNon-Darcy
PERMCOR Permeability correction
R
CVALUE C
CROSSCV Crossflow Injectivity C
ALUE
NVALUE n
PERF_TOP Top of perforations
PERF_BOT Bottom of perforations
TOM
IPR_SHIFT IPR dP Shift
USE_RELP Use relative permeability flag
ERMS
TESTRESP Test reservoir pressure
RESS
TESTWATC Test water cut
UT
USEOWN_ Use own rel perms flag - one of {YES,NO}
RELPERMS
RELPERM Relative permeability curves (See rel perm section below)
USEGASC Gas coning flag - one of {YES,NO}
ONING
GASCONE Gas coning match data
MATCH.
F2 F2 tuning parameter
F3 F3 tuning parameter
EXPON Exponent tuning parameter
ENT
GOC Gas-oil contact
TESTD Test points
ATA.
PR Producing GOR
OD_GOR
LIQ Liquid rate
RATE
TRES[ ][ ][ ]. Tank results - see end of section (*) for more information
TIME Time
Etc.
WRES[ ][ ][ ]. Well results - see end of section (**) for more information
TIME Time
Etc.
* TRES is the sub-string used for the tank (and leak) results. This is the data that can be
viewed in the History Matching-Run Simulation dialog or the Production Prediction-Run
Prediction dialog.
The third index defines the row in the sheet, where each row is for a different time.
**WRES is the sub-string used for the well results. This is the data that can be viewed in
the Production Prediction-Well Results dialog.
The third index defines the row in the sheet, where each row is for a different time.
MBAL.PA
Most of the production allocation data is the same as the data for the material balance
tool. Therefore the variable names are mostly the same as the material balance tool.
The additional variables used by the production allocation tool are listed below:
ALLOCINP.
MBAL.TG
Most of the tight gas data is the same as the data for the material balance tool.
Therefore the variable names are mostly the same as the material balance tool. The
additional variables used by the tight gas model are listed below:
Production History
TIME Time
FBHP Flowing bottom hole pressure
CUMGAS Cumulative gas produced
Run Prediction
ENDHIST Start the prediction at the end of the production history
STARTPROD Start the prediction at the start of the production history
USER Start the prediction from a user defined value
Prediction End
AUTO Prediction end determined by MBAL
ENDHIST Prediction will end at the last production history time
USER Prediction will end determined by the User
MBAL.MB[0].TANK[{tank_name}].RELPERM
PERM Permeability
DIPANGLE Dip angle
WATSWEEP Water sweep efficiency
GASSWEEP Gas sweep efficiency
FROM Type - one of {TABLES,COREY}
MODIFIED Type - one of {NO,STONE1,STONE2}
The next section is used for rel perms tables
WATER[i]. Water rel perm table
SW Water saturation
KRW Water rel perm
OIL[i]. Oil rel perm table
SO Oil saturation
KRO Oil rel perm
KROG Oil to gas rel perm
KROW Oil to water rel perm
GAS[i]. Gas rel perm table
SG Gas saturation
KRG Gas rel perm
KRW water
KRO oil
KROW oil to water
KROG oil to gas
KRG gas
6
PROSPER and OpenServer 216
6.1 Overview
The aim of this section is to provide a reference for the OpenServer variable names
corresponding to the data variable names encountered in PROSPER and also the open
functions used to execute commands. Where there are multiple instances of a given
variable, e.g. in a table, the range of rows in the table is given as i = m:n where i is an
indexing variable and m and n are the lower and upper limits of the range. The range
expression is placed above the documentation of the block of variables to which it
applies. In some cases, the range upper limit is itself a variable, such as the multilateral
well data and the method of finding this is also shown. Other refinements are multiple
dimensionalities of tables (a table within a table) and the ability to access multilateral
network items by their label rather than an index whose value is not available to the user
in the Windows interface.
At the end of this chapter there is a section with some code fragments written for VBA in
conjunction with an Excel spreadsheet. Note that only the DoGet functionality is
illustrated here since the DoSet function is trivially implemented by swapping the DoGet
and DoSet sub-routine calls.
PROSPER.PVT
PROSPER.SIN
PROSPER.ANL
PROSPER.OUT
In PROSPER there are some commands which are general (such as extracting units or
counting rows of data), irrespective of the section they are used in. The following
sections describe how these can be used.
Although a listing of all the OpenServer commands are available in the sections that
follow, an easy way of extracting these is by simultaneously using the Ctrl and Right
Click keyboard and mouse action on the desired variable.
For example, by placing the mouse cursor on top of the 'Solution GOR' box in the PVT
screen and selecting Ctrl + Right Click, the screen with the Access String for this
variable will appear. The String can then be copied on the clipboard for use in the
macro.
PROSPER Version 12.0 includes the feature which allows the user to see all the
OpenServer variables available in any particular file. Access to these lists is achieved
from the 'Wizard' option:
In this screen, a particular wizard macro can be selected or a new one created:
In the screen where the wizard macro can be written, the user has access to a menu with
all the commands available in the file as shown below:
The “Variables” button gives access to all the variables available in this particular file:
Also, the on-line help system that can be accessed directly from the main PROSPER
screen contains a majority of the currently available OpenServer commands, variables
and functions. The utility also includes a search feature, providing quick access to the
desired OpenServer string.
The 'Evaluate OpenServer Statement' enables the user to analyse the effect of one
specific OpenServer operation and get an estimation of the value of one parameter of
the model, set a specific value to one parameter of the model or launch a calculation
through a calculation command.
This section can be accessed through the File | Evaluate OpenServer Statement
section in the PROSPER main menu bar.
A particular string can be entered by hand or copied from the clipboard. Then, the
“Evaluate” button will do the requested operation of:
- DoGet (i.e. obtain the current value of the variable considered)
- DoSet (i.e. set the value of the variable considered)
- DoCommand (i.e. execute a GAP calculation for instance).
The Commands, Variables and Functions buttons enable access to the list of the
commands, variables and functions accessible through PROSPER OpenServer.
For example the following command will set the unit system to Norwegian SI:
On the other hand, if the intent is to extract the unit name of a particular variable in the
program, then the UNITNAME extension can be used at the end of the root defining the
variable. For example, if one would like to extract the unit in the program associated
with the solution GOR entry box in the PVT section, then the following command will
return the unit name:
AA = DoGet("PROSPER.PVT.Input.Solgor.Unitname")
The same goes for all variables. As another example, the top node pressure entry in the
system calculation will return it’s unit name with the following line:
AA = DoGet (“PROSPER.ANL.SYS.Pres.Unitname”)
NOTE
1. The Unitname commands will return strings, so please make sure the variables (like
AA above) are defined correctly.
2. The units of single variables can only be extracted, not set (DoGet will work on the
examples above but DoSet will not).
It is also possible to use OpenServer to change validation limits; this can be done by
adding .UNITMIN and .UNITMAX statement to corresponding tag string.
For example the following command can be used to change minimum pressure limit
One element to consider is that when changing the limits through OpenServer is that tag
strings for different parameters can access the same limit in the unit section.
For instance, two following tag strings will both access the lower pressure limit in the
units section
PROSPER.SIN.IPR.Single.Pres.UNITMIN
PROSPER.ANL.SYS.Pres.UNITMIN
When writing macros for use with the OpenServer, one of the practical requirements is
to know how many rows of data have been calculated when executing a calculation (like
a gradient calculation for instance):
There are several commands that allow the user to extract the number of results and
many are listed in the description of roots available for every section. However the
.COUNT or .NUM commands can generally be used at the end of a string to extract the
number of rows.
Example:
For example, the pressure values in the gradient calculation results can be obtained
using the following OpenServer string:
PROSPER.OUT.GRD.Results[0][0][0].Pres[0]
In this case the total number of rows in the table can be obtained by counting the number
pressure values. This can be done by adding .COUNT to the above string (without the
index in the square brackets). The syntax is as follows:
Similarly in the PVT calculator screen, the number of rows can be extracted using:
NOTE:
The .COUNT is not designed to work for every screen in the program, and alternative
commands are given in the relevant sections, such as the .NUM-1.
6.3 Preferences
The below section will describe how the user can retrieve or set preferences values
using open server string:
All parameters in PROSPER preferences can be access and edited using the below
OpenServer Function: PROSPER.PREFERENCES
6.3.1 iType
iType value are: -2, -1, 0, 1, 2. The details of each one are in the below table:
IType
Description
value
iType = -2 This will return the number of preferences that can be changed
Syntax: DoGet(PROSPER.PREFERENCES (-2))
This will display the list of the preferences with the associated Icommand
iType = -1 that will be used if needed to retrieve the preference value or change its
current value for instance.
Syntax: DoGet(PROSPER.PREFERENCES (-1))
This with the Icommand as Ipref will return the name of the preference.
iType = 0 Syntax: DoGet(PROSPER.PREFERENCES (0, 511)) will return:
VLPMaxRates (VLP Maximum Number Of Rates)
This with the Icommand as Ipref of the preference will return the value of the
iType = 1 current value set of the preference.
Syntax: DoGet(PROSPER.PREFERENCES (1, 511)) will return: 20
( current value of VLP Maximum Number Of Rates)
To set a new value of a preference, this can be achieved by using the
value of 2 as itype, with the preference Icommand as Ipref and the value to
iType = 2 be set.
Syntax: DoGet(PROSPER.PREFERENCES (2, 511, 30)) will set the
value of VLP Maximum Number Of Rates to 30.
6.3.2 iPref
iPref represent the parameter iCommand that needed to retrieve the value of that
parameter or change its value. List of all the iPref with its associated iCommand is in
the below tabs, each tab represent the tab in the preferences screen:
Tab 1
0 = DialogFont iCommand = 100
Tab 2
2 = LastFileLoadedOnStartUp iCommand
= 202
Tab 3
Tab 4
Tab 5
0 = AOFMaxOil iCommand = 500
6.3.3 sValue
The svalue is the values desired to be set for any preferences based on the iType and
iPref.
6.3.4 Examples
Example 1: Retrieve the current value of VLP Maximum Number Of Rates
ELPACK 0 - None
1 - Gravel pack
2 - Pre-packed screen
3 - Wire wrapped screen
4 - Slotted liner
PROSPER.SIN.SUM.COMP
ANY
PROSPER.SIN.SUM.FIELD
PROSPER.SIN.SUM.LOCAT
ION
PROSPER.SIN.SUM.WELL
PROSPER.SIN.SUM.PLATF
ORM
PROSPER.SIN.SUM.ANALY
ST
PROSPER.SIN.SUM.DATE In order to export in date format (either dd/mm/yyyy or mm/
dd/yyyy depending on local settings) this must be
converted into a date string. i.e.
CDate(DoGet("PROSPER.SIN.SUM.DATE"))
PROSPER.SIN.SUM.COMM
ENTS
PROSPER.PVT.INPUT
PROSPER.PVT.CORREL
PROSPER.PVT.MATCH
PROSPER.PVT.TABLE
PROSPER.PVT.CALC
PROSPER.PVT.EOS
PROSPER.PVT.DLL
PROSPER.PVT.EMULS
PROSPER.PVT.VISC
PROSPER.PVT.HYD
5 = Al Marhoun
Example:
DoSet “PROSPER.PVT.Input.PBcorr”, 1
The string will set the correlation to “Standing”.
PROSPER.PVT.INPUT.UOCORR Oil Viscosity Correlation
0 = Beal
1 = Beggs
2 = Petrosky
3 = Egbogah et al (heavy oil)
4 = Bergman-Sutton
PROSPER.PVT.INPUT.UGCORR Gas Viscosity Correlation
0 = Lee
1 = Carr
PROSPER.PVT.INPUT.SOLGOR Solution GOR
PROSPER.PVT.INPUT.API Oil Gravity
PROSPER.PVT.INPUT.GRVGAS Gas Gravity
PROSPER.PVT.INPUT.WATSAL Water Salinity
PROSPER.PVT.INPUT.PSEP Separator Pressure
PROSPER.PVT.INPUT.TSEP Serarator Temperature
PROSPER.PVT.INPUT.GORSEP Separator GOR
PROSPER.PVT.INPUT.GRVSEP Separator Gravity
PROSPER.PVT.INPUT.GORTNK Tank GOR
PROSPER.PVT.INPUT.GRVTNK Tank Gravity
PROSPER.PVT.INPUT.CGR Condensate to Gas Ratio
PROSPER.PVT.INPUT.WGR Water to Gas Ratio
PROSPER.PVT.INPUT.H2S Mole Percent H2S
PROSPER.PVT.INPUT.CO2 Mole Percent CO2
PROSPER.PVT.INPUT.N2 Mole Percent N2
PROSPER.PVT.INPUT.DEWPNT Saturation Pressure at Reservoir Temperature
(for Black Oil Condensate Model)
PROSPER.PVT.INPUT.TRES Reservoir Temperature
PROSPER.PVT.INPUT.PRES Reservoir Pressure
k= 0 Temperature
k= 1 Pressure
k= 2 Bubble Point
k= 3 Dew Point
k= 4 Oil FVF
k= 5 Oil Viscosity
k= 6 Oil Density
k= 7 Gas FVF
k= 8 Gas Viscosity
k= 9 Gas Density
k = 10 Z Factor
k = 11 Gas Oil Ratio
k = 12 Produced CGR
k = 13 Liquid Dropout
T
DoSet "PROSPER.PVT.MATCH.Data[i][j][2]",
PB
k= 0 Temperature
k= 1 Pressure
k= 2 Bubble Point
k= 3 Dew Point
k= 4 Oil FVF
k= 5 Oil Viscosity
k= 6 Oil Density
k= 7 Gas FVF
k= 8 Gas Viscosity
k= 9 Gas Density
k=10 Z Factor
k=11 Gas Oil Ratio
k=12 Produced CGR
k=13 Liquid Dropout
k=14 Water Fvf
k=15 Water Viscosity
k=16 Water Compressibility
Entering data into these tables follows the same logic as entering the PVT Match Data.
This was described in the previous section. The variable i refers to the table that is
defined by a unique temperature, the value j refers to the row, defined by a pressure,
and the value of k refers to the entry column, defined by the variable it corresponds to.
i = 0:4
0 = Glaso
1 = Standing
2 = Lasater
3 = Vazquez-Beggs
4 = Petrosky et al
PROSPER.PVT.CORREL.OILBUBPN Pb Number of available match point entries in
T[i].NUM-1 the 'Match Data' screen. This will return 10 (as
there are 10 rows of match data in every table).
j=0:NUM-1
PROSPER.PVT.CORREL.OILBUBPN Pb ith Match parameter
T[i].F[j] Example: The line:
DoGet("PROSPER.PVT.CORREL.OILBUBP
NT[0].F[1]")
will return the Parameter 2 of Glaso Correlation
when matched to the bubble point number
entered in the 'Match Data' table.
PROSPER.PVT.CORREL.OILBUBPN Pb Correlation standard deviation
T[i].STD
i = 0:2
0 = Beggs et al
1 = Beal et al
2 = Petrosky
PROSPER.PVT.CORREL.OILOILVIS[i] µo Number of match data entries. Just like the
.NUM-1 command relating to the bubble point , this will
return the number 10.
j=0:NUM-1
PROSPER.PVT.CORREL.OILOILVIS[i] µ ith Match parameter
o
.F[j]
PROSPER.PVT.CORREL.OILOILVIS[i] µo Correlation standard deviation
.STD
i = 0:1
0 = Lee et al
1 = Carr et al
PROSPER.PVT.CORREL.GASGASVIS[i].NUM µg Number of match parameters
-1
j=0:NUM-1
PROSPER.PVT.CORREL.GASGASVIS[i].F[j] µg ith Match parameter
PROSPER.PVT.CORREL.GASGASVIS[i].STD µg Correlation standard deviation
i = 0:1
0 = Lee et al
1 = Carr et al
PROSPER.PVT.CORREL.CONGASVIS[i].NU µg Number of match parameters
M-1
j = 0:NUM-1
PROSPER.PVT.CORREL.CONGASVIS[i].F[j]µg ith Match parameter
PROSPER.PVT.CORREL.CONGASVIS[i].STD µg Correlation standard deviation
i = 0:10
PROSPER..PVT.CALC.PRESUSER[i] Pressure Values (USER ENTERED)
PROSPER..PVT.CALC.TEMPUSER[i] Temperature Values (USER
ENTERED)
PROSPER.PVT.EOS.GENDATA[i].DENSITY[j] Density
PROSPER.PVT.EOS.GENDATA[i].VISCOSITY Viscosity
[j]
PROSPER.PVT.EOS.GENDATA[i].FVF[j] Formation Volume Factor
PROSPER.PVT.EOS.GENDATA[i].ENTHALPY Enthalpy
[j]
PROSPER.PVT.EOS.GENDATA[i].ENTROPY[j Entropy
]
PROSPER.PVT.EOS.GENDATA[i].CP[j] Specific Heat Capacity (P)
PROSPER.PVT.EOS.GENDATA[i].CV[j] Specific Heat Capacity (V)
PROSPER.PVT.EOS.GENDATA[i].JT[j] Joules Thompson Coefficient
PROSPER.PVT.EOS.GENDATA[i].IFT Interfacial Tension
PROSPER.PVT.EOS.GENDATA[i].SOLGOR GOR
PROSPER.PVT.EOS.EOS.SepCalcMode Separator calc method.
0 - flash to stock tank
1 - use separator train
2 - use K values
3 - use path to surface object
PROSPER.PVT.EOS.EOS.PTS.NUM_PTS_O Returns the number of path to surface
BJ objects defined
PROSPER.PVT.EOS.EOS.PTS[i].LABEL Returns the label of the i path to surface
object
PROSPER.PVT.EOS.EOS.PTS[i].IS_VALID Validation flag for the i path to surface
object
1 - valid
0 - invalid
PROSPER.PVT.EOS.EOS.PTS[i].IS_VALID_O Validation flag for the i path to surface
ILGAS object when the criteria is oil and gas
outlets ONLY.
1 - valid
0 - invalid
PROSPER.PVT.Eos.EOS.PTS[i].PROCESSD For the path to surface object i,
ATA.SEPARATOR[j].PRESSURE accesses the pressure of separator j.
PROSPER.PVT.Eos.EOS.PTS[i].PROCESSD For the path to surface object i,
ATA.SEPARATOR[j].TEMPERATURE accesses the temperature of separator
j.
PROSPER.PVT.Eos.EOS.PTS[i].PROCESSD For the path to surface object i,
ATA.CHILLER[j].PRESSURE accesses the pressure of chiller j.
PROSPER.PVT.Eos.EOS.PTS[i].PROCESSD For the path to surface object i,
ATA.CHILLER[j].TEMPERATURE accesses the temperature of chiller j.
i = 0:4
0 = Viscosity
1 = Head
2 = Capacity
3 = Power
4 = Efficiency
j = 0:NUM-1
PROSPER.PVT.VISC.DATA[i][j] Viscosity Correction Data
PROSPER.SIN.SUM
PROSPER.SIN.IPR
PROSPER.SIN.EQP
PROSPER.SIN.GLF
PROSPER.SIN.GLI
PROSPER.SIN.ESP
PROSPER.SIN.HSP
PROSPER.SIN.UNT
6.6.1.1 Overview
The IPR data is accessed using the root name PROSPER.SIN.IPR and is split up into two
sections as listed below.
The single branch data has the root name PROSPER.SIN.IPR.SINGLE. The
organisation of the following tables follows that of the IPR data screens i.e. the display
choices are made using buttons and tabs as well as list box selection. However, the
division does not extend to every possible model choice as it is convenient to regard
‘Darcy-like’ models as using a sub-set of the same group of parameters.
PROSPER.SIN.IPR.SINGLE.PERFDI
Perforation diameter
A
PROSPER.SIN.IPR.SINGLE.SPF Shot density
PROSPER.SIN.IPR.SINGLE.PERFE
FF Perforation efficiency
PROSPER.SIN.IPR.SINGLE.PERFIN Perforation interval (production interval in open
T hole)
PROSPER.SIN.IPR.SINGLE.WBR Well-bore radius
PROSPER.SIN.IPR.SINGLE.SWC Connate water saturation (residual saturation for
relative permeability screen)
6.6.1.2.2 Model Selection and PVT Screen
These parameters are explicitly or implicitly involved in the functionality of the model
selection IPR screen, which includes the selection of PVT parameters that affect all
models. The first six flags are normally set from the 'System Summary' screen (menu
item Options), so it is recommended that they are used on a read-only basis here and
set using the PROSPER.SIN.SUM root.
The last three variables, however, are distinct from those set on the PVT screen and are
intended for local manipulation within the IPR section.
Example:
The following command:
Will set the number 2000 in the rate box of the test data screen in the IPR plot shown
below:
The following commands can be used to read/write the test data for the multirate IPR
models available in PROSPER. The commands are the same for all of the models.
Example:
The following command:
Will set the number 2000 in the rate box of the test data screen in the IPR plot shown
below:
This section describes the OpenServer variables to extract the variables calculated by
the Multirate models viz: 'Multirate Jones', 'Multirate C & n',' 'Multirate Forcheimer with
Pseudo Pressure' models.
Darcy based IPR models include models such as hydraulic fracture and horizontal IPR
models that apply a correcting skin to the Darcy calculated PI. In common with the rest
of the structure of the data, parameters applied specifically to gas/condensate models
are listed with ones for oil and/or all fluids.
i = 0:19
PROSPER.SIN.IPR.SINGLE.EXTENTRY[i].RATE External entry rate
j = 0:4
PROSPER.SIN.IPR.SINGLE.EXTENTRY[i].PRESSUR
E[j] Pressure responses
i = 0:4
PROSPER.SIN.IPR.SINGLE.SENVAR[i] Curve IDs
PROSPER.SIN.IPR.SINGLE.SENVAL Selected curve
PROSPER.SIN.IPR.SINGLE.IESKIN Additional skin flag
0 - no skin to add, 1 - skin to
add
PROSPER.SIN.IPR.SINGLE.EXTLABEL Curve label
PROSPER.SIN.IPR.SINGLE.EXTUNITS Curve units
PROSPER.SIN.IPR.SINGLE.NCURV Number of IPR curves
PROSPER.SIN.IPR.SINGLE.NSENSP Number of valid rate data points
i = 0:4
PROSPER.SIN.IPR.SINGLE.MLAYER[i].TYPE Layer type (e.g. disabled, Darcy,
multi-rate, PI). Zero-based
PROSPER.SIN.IPR.SINGLE.MLAYER[i].IGRAV Gravel pack enable 0 = no, 1 = yes
PROSPER.SIN.IPR.SINGLE.MLAYER[i].PRESSU Layer pressure
RE
PROSPER.SIN.IPR.SINGLE.MLAYER[i].HEIGHT Layer height
PROSPER.SIN.IPR.SINGLE.MLAYER[i].SKIN Layer skin
PROSPER.SIN.IPR.SINGLE.MLAYER[i].PERM Layer horizontal permeability
PROSPER.SIN.IPR.SINGLE.MLAYER[i].DAREA Layer area
PROSPER.SIN.IPR.SINGLE.MLAYER[i].DIETZ Layer shape factor
PROSPER.SIN.IPR.SINGLE.MLAYER[i].WBR Well-bore radius in layer
PROSPER.SIN.IPR.SINGLE.MLAYER[i].PILAY Productivity index
PROSPER.SIN.IPR.SINGLE.MLAYER[i].GOR Formation GOR/CGR/separator
GOR
6.6.1.2.8 Horizontal Well with dP Friction Loss Table, Including Coning Screen
i = 0:19
PROSPER.SIN.IPR.SINGLE.MLAYDP[i].TYPE Type of layer:
0 = disabled,
1 = blank,
2 = perforated,
3 = open
PROSPER.SIN.IPR.SINGLE.MLAYDP[i].MODEL IPR model:
0 = Darcy, 1 = Multi-rate, 2 = PI
PROSPER.SIN.IPR.SINGLE.MLAYDP[i].ISKIN Skin model:
0 = by hand, 1 = Karakas & Tariq
PROSPER.SIN.IPR.SINGLE.MLAYDP[i].IGPACK Gravel pack: 0 = off, 1 = on
PROSPER.SIN.IPR.SINGLE.MLAYDP[i].MD Measured depth to layer end
PROSPER.SIN.IPR.SINGLE.MLAYDP[i].TVD Vertical depth to layer end
PROSPER.SIN.IPR.SINGLE.MLAYDP[i].PRESSUR
E Layer pressure
PROSPER.SIN.IPR.SINGLE.MLAYDP[i].FLOWRA
D Flowing radius
PROSPER.SIN.IPR.SINGLE.MLAYDP[i].ROUGH Tubing roughness
PROSPER.SIN.IPR.SINGLE.MLAYDP[i].GOR Total GOR
PROSPER.SIN.IPR.SINGLE.MLAYDP[i].API Oil gravity
RATE
There are nine groups of these. Firstly there are the calculation choice flags
manipulated by the drop-down list boxes on the main screen. The other eight groups
comprise the data sets for the eight different screens that can be brought up. Note that if
in the 'System Summary' screen, the cased completion and gravel pack options are
enabled then seven buttons are present on the main Skin Aide screen. The eighth
screen comes from switching the perforation model list box (PERFMOD variable)
between 0 (in situ geometry) and 1 or 2 (API perforation models).
Geometrical Skin
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PETRO4
Porosity
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PETRO5
Turbulence Coefficient
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PETRO6
Permeability Exponent
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PETRO7
Porosity Exponent
PROSPER.SIN.IPR.SINGLE.SKINAIDE.DAMAGE1
Damaged Zone Thickness
PROSPER.SIN.IPR.SINGLE.SKINAIDE.DAMAGE2
Permeability
PROSPER.SIN.IPR.SINGLE.SKINAIDE.DAMAGE3
Porosity
PROSPER.SIN.IPR.SINGLE.SKINAIDE.CASING1
External Casing Diameter
PROSPER.SIN.IPR.SINGLE.SKINAIDE.CASING2
Casing Weight
PROSPER.SIN.IPR.SINGLE.SKINAIDE.CRUSHED
1 Crushed Zone Thickness
PROSPER.SIN.IPR.SINGLE.SKINAIDE.CRUSHED
2 Crushed Zone Permeability
PROSPER.SIN.IPR.SINGLE.SKINAIDE.CRUSHED
3 Crushed Zone Porosity
PROSPER.SIN.IPR.SINGLE.SKINAIDE.CRUSHED Crushed & Damaged Zone
4 Permeability
PROSPER.SIN.IPR.SINGLE.SKINAIDE.CRUSHED Crushed & Damaged Zone
5 Porosity
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFINSIT
U1 Perforation Efficiency
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFINSIT
U2 Shot Density
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFINSIT
U3 Gun Phasing
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFINSIT Angle Between Well Vertical Plane
U4 And Perforations
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFINSIT
U5 Tunnel Length
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFINSIT
U6 Tunnel Diameter
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFINSIT
U7 Cavity Entrance Diameter
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFINSIT
U8 Cavity Tip Diameter
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFAPI1 Perforation Efficiency
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFAPI2 Shot Density
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFAPI3
Gun Phasing
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFAPI4 Angle Between Well Vertical Plane
And Perforations
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFAPI5 TTP : API RP43/2 Penetration Of
Perforations
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFAPI6 EH : API RP43/1 Diameter Of
Perforations
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFAPI7
Gun Diameter
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFAPI8 Reservoir Uni-axial Compressive
Strength
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFAPI9
Rock Density
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFAPI1
0 Casing Elastic Limit
PROSPER.SIN.IPR.SINGLE.SKINAIDE.PERFAPI1
1 Reservoir Stress
PROSPER.SIN.IPR.SINGLE.SKINAIDE.GPACK1
Screen Outside Diameter
PROSPER.SIN.IPR.SINGLE.SKINAIDE.GPACK2
Annulus Gravel Permeability
PROSPER.SIN.IPR.SINGLE.SKINAIDE.GPACK3
Annulus Gravel Porosity
PROSPER.SIN.IPR.SINGLE.SKINAIDE.GPACK4
Tunnel Gravel Permeability
PROSPER.SIN.IPR.SINGLE.SKINAIDE.GPACK5 Tunnel Gravel Porosity
6.6.1.2.13 SPOT
Options
PROSPER.SIN.IPR.Single.SPOTMain.CORREL Lp correlation type:
ATIONTYPE 0 - Conventional
1 - Synthetic
PROSPER.SIN.IPR.Single.SPOTMain.EXTFLO Calculate non-Darcy:
W 0 - No
1 - Yes
PROSPER.SIN.IPR.Single.SPOTMain.ACTIVIT Activity:
Y 0 - New well
1 - Workover / re-perf
PROSPER.SIN.IPR.Single.SPOTMain.IPRMOD Inflow equation:
EL 0 - Fetkovich
1 - Vogel
PROSPER Thickness
.SIN.IPR.Single.SPOTMain.CRUSHZONETHIC
KNESS
Layers
PROSPER.SIN.IPR.Single.WBR Well radius
PROSPER Drainage radius
.SIN.IPR.Single.SPOTMain.DRAINRADIUS
PROSPER.SIN.EQP.Env.Msl Mean sea-level wrt to origin
PROSPER.SIN.EQP.Env.Seabed Seabed depth wrt to origin
PROSPER Top MD
.SIN.IPR.Single.SPOTMain.LAYERS[0].TOP
PROSPER Bottom MD
.SIN.IPR.Single.SPOTMain.LAYERS[0].BOTT
OM
PROSPER Layer pressure
.SIN.IPR.Single.SPOTMain.LAYERS[0].LAYER
PRESS
PROSPER Under balance pressure
.SIN.IPR.Single.SPOTMain.LAYERS[0].UNDE
RBALANCE
PROSPER Overburden pressure gradient
.SIN.IPR.Single.SPOTMain.LAYERS[0].OVER
BURDEN
Gun Details
PROSPER Shot density
.SIN.IPR.Single.SPOTMain.LAYERS[0].GUN.S
HOTDENSITYACTUAL
Relative Permeability
PROSPER Oil residual saturation
.SIN.IPR.Single.SPOTMain.LAYERS[0].SRO
PROSPER Oil end-point relative permeability
.SIN.IPR.Single.SPOTMain.LAYERS[0].OILEN
DPOINT
PROSPER Oil Corey exponent
.SIN.IPR.Single.SPOTMain.LAYERS[0].OILEX
P
PROSPER Gas residual saturation
.SIN.IPR.Single.SPOTMain.LAYERS[0].SRG
PROSPER Gas end-point relative permeability
.SIN.IPR.Single.SPOTMain.LAYERS[0].GASE
NDPOINT
PROSPER Gas Corey exponent
.SIN.IPR.Single.SPOTMain.LAYERS[0].GASE
XP
PROSPER Water residual saturation
.SIN.IPR.Single.SPOTMain.LAYERS[0].SWC
PROSPER Water end-point relative permeability
.SIN.IPR.Single.SPOTMain.LAYERS[0].WATE
NDPOINT
PROSPER Water Corey exponent
.SIN.IPR.Single.SPOTMain.LAYERS[0].WATE
XP
Log Data
PROSPER i = 0 to 49
.SIN.IPR.Single.SPOTMain.LOGDATA[0].AHD Measured depth
PROSPER i = 0 to 49
.SIN.IPR.Single.SPOTMain.LOGDATA[0].POR Porosity
OSITY
PROSPER i = 0 to 49
.SIN.IPR.Single.SPOTMain.LOGDATA[0].PER Permeability
MEABILITY
PROSPER i = 0 to 49
.SIN.IPR.Single.SPOTMain.LOGDATA[0].UCS UCS
PROSPER i = 0 to 49
.SIN.IPR.Single.SPOTMain.LOGDATA[0].TWC TWC
Completion
PROSPER Type:
.SIN.IPR.Single.SPOTMain.COMPLETION[0].T 0 - Casing
YPE 1 - Tubing
PROSPER i = 0 to 49
.SIN.IPR.Single.SPOTMain.COMPLETION[0]. Outer diameter
OD
PROSPER i = 0 to 49
.SIN.IPR.Single.SPOTMain.COMPLETION[0]. Weight
WEIGHT
PROSPER i = 0 to 49
.SIN.IPR.Single.SPOTMain.COMPLETION[0].T Top MD
OP
PROSPER i = 0 to 49
.SIN.IPR.Single.SPOTMain.COMPLETION[0].B Bottom MD
OTTOM
NOTE: The first four parameters on the Wong-Clifford screen come from the common
or Darcy reservoir model sections (THICKNESS, WBR, DRAINAGE and DIETZ).
Cinco / Martin-Bronz
PROSPER.SIN.IPR.Single.Deviation Deviation
PROSPER.SIN.IPR.Single.Penetration Penetration
PROSPER.SIN.IPR.Single.VertPerm Vertical permeability
Wong-Clifford
PROSPER.SIN.IPR.Single.WONGTP Formation vertical permeability ratio
PROSPER.SIN.IPR.Single.WONGLP Local vertical permeability ratio
PROSPER.SIN.IPR.Single.WONGXW Horizontal distance from well to
reservoir edge
PROSPER.SIN.IPR.Single.WONGTD Vertical depth to top of reservoir
PROSPER.SIN.IPR.Single.PerfInts[0].MDSTART Perforation interval (MD) start
PROSPER.SIN.IPR.Single.PerfInts[0].MDEND Perforation interval (MD) end
PROSPER.SIN.IPR.Single.PerfInts[0].TVDSTART Perforation interval (TVD) start
PROSPER.SIN.IPR.Single.PerfInts[0].TVDEND Perforation interval (TVD) end
Gravel Pack
PROSPER.SIN.IPR.SINGLE.GPPERM Gravel pack permeability
PROSPER.SIN.IPR.SINGLE.GPLEN Gravel pack length
Pre-Packed Screen
PROSPER.SIN.IPR.Single.SCIRAD Screen inner radius
PROSPER.SIN.IPR.Single.SCORAD Screen outer radius
PROSPER.SIN.IPR.Single.SCPERM Screen permeability
PROSPER.SIN.IPR.Single.SCBETA Screen Beta (turbulence)
PROSPER.SIN.IPR.Single.OTPERM Outside permeability
PROSPER.SIN.IPR.Single.OTBETA Outside (turbulence)
Slotted Liner
PROSPER.SIN.IPR.Single.SLOTIR Liner inner radius
PROSPER.SIN.IPR.Single.SLOTOR Liner outer radius
PROSPER.SIN.IPR.Single.SLOTHT Slot height
PROSPER.SIN.IPR.Single.SLOTDN Slot density
PROSPER.SIN.IPR.Single.SCORAD Screen outer radius
PROSPER.SIN.IPR.Single.OTPERM Screen outer permeability
PROSPER.SIN.IPR.Single.OTBETA Outside (turbulence)
PROSPER.SIN.IPR.SINGLE.CONEHT
Height between first and last perf.
PROSPER.SIN.IPR.SINGLE.CONEGOC Gas Coning Distance to GOC (gas-oil
contact)
i = 0:9
PROSPER.SIN.IPR.SINGLE.CONEMATCH[
i].RATE Cone test rate
PROSPER.SIN.IPR.SINGLE.CONEMATCH[ Cone test GOR
i].GOR
1. Associated state data and physical data for each multi-lateral network. These data
have root PROSPER.SIN.IPR.MULTILAT.NETWORK. Note that a network item
can be a node i.e., a tie-point, junction, completion, reservoir or a link between
nodes. In the latter case a network item does not carry physical data unless it is
blank tubing, in which case a box for mouse-clicking and data entry is drawn in the
middle of the link. In all cases a network item carries state data e.g. validity. Two
methods of accessing the network item data are available; they can be enumerated
up to the number of network items (available as a data item), which implies access
via an index, or accessed via their label. In this section all the data items will be
listed as if accessed via their indices. Sample code for both methods is outlined in
the next section.
2. The calculation details available by choosing Analyse | Calculate | Details from the
multi-lateral main screen. In place of NETWORK these are referenced from roots,
namely: BRANCH, LAYER and SEGMENT. For BRANCH and LAYER there are a
variable number of nodes from model to model but the correspondence between the
table rows and data server arrays is one to one. In the case of the SEGMENT data
the outer loop corresponds to the branches listed in the drop-down list box, and the
inner loop to the rows in the table.
3. The visualisation window data, represented by the root VIEW. These data are
generated from the network items so it is recommended that they are only read and
not altered by the data server. These data are enumerated according to type in an
outer loop (0 = reservoir, 1 = tubing segment, 2 = perforation, 3 = junction, 4 = tie-
point) and by number of each type in an inner loop. Note that the latter number is not
fixed and the correspondence between a visualisation object and a network item is
many to one. For instance, a completion item can contain many tubing segments
and perforations.
Note that the index i below is used to index NETWORK for the rest of this sub-section
variable listings. The LABEL , TYPE and HASDATA variables can be used for
accessing data items or controlling the way the accessing is done e.g. trying to extract
any physical data from a link results in a data server error.
If (TYPE = 0) or (TYPE = 1) then the item is a tie-point or junction. The following physical
data items can be extracted.
If (TYPE = 2) or (TYPE = 4 and HASDATA = 1) then the item has tubing physical data
i.e. model selection, deviation survey and equipment information. The following physical
data items can be extracted.
DEVCOUNT =
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].
DEV.COUNT No. of deviation survey records
j = 0:DEVCOUNT-1
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].DEV[j].
MD Measured depth
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].DEV[j].T
VD Vertical depth
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].DEV[j].
AZIMUTH Azimuth
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].DEV[j].
DISP Cumulative displacement
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].DEV[j].
ANGLE Deviation angle
EQCOUNT =
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].EQUIP.
COUNT No. of equipment records
j = 0:EQCOUNT-1
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].EQUIP[j]
.TUBTYPE Tubing type
1 = tubing
2 = choke
3 = casing
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].EQUIP[j]
.TUBDEPTH Measured depth
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].EQUIP[j]
.TUBID Tubing inside diameter
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].EQUIP[j]
.TUBROUGH Tubing inside roughness
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].EQUIP[j]
.TUBTOD Tubing outside diameter
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].EQUIP[j]
.TUBTOR Tubing outside roughness
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].EQUIP[j]
.TUBCID Casing inside diameter
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].EQUIP[j]
.TUBCIR Casing inside roughness
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].EQUIP[j]
.TUBMULT Flow multiplier
If (TYPE = 2) then the item is a completion node and has perforation physical data. The
following physical data items can be extracted.
j].SKINFLAG
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Non-Darcy factor entered (0) or
j].NDARCYFLAG calculated (0)
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Gravel pack skin disabled (0),
j].GPACKFLAG entered (1), cased (2) or open
hole (3)
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Record enabled (1)/disabled (0)
j].ENABLE
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Reservoir permeability
j].RESPERM
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Perforation diameter
j].PERFDIA
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Shot density
j].SPF
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Perforation length
j].PERFLEN
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Shot phasing
j].PHASING
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Damaged zone thickness
j].DZTHICKNESS
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Crushed zone thickness
j].CZTHICKNESS
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Damaged zone perm.
j].DZPERM
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Crushed zone perm.
j].CZPERM
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Vertical permeability
j].VERTPERM
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Gravel pack permeability
j].GPPERM
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[ Gravel pack length
j].GPLEN
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].PERFS[j].P Perforation efficiency
ERFEFF
If (TYPE = 3) then the item is a reservoir node and the following physical data can be
extracted.
PROSPER.SIN.IPR.MULTILAT.NETWORK[i].FLUID Fluid
0 = oil
1 = gas
2 = condensate
NLAYERS =
PROSPER.SIN.IPR.MULTILAT.LAYER.COUNT Number of layers
i = 0:NLAYERS-1 Composite PI for layer
(including interference from all
branches)
PROSPER.SIN.IPR.MULTILAT.LAYER[i].PI Composite skin for layer
PROSPER.SIN.IPR.MULTILAT.LAYER[i].SKIN Layer i top
PROSPER.SIN.IPR.MULTILAT.LAYER[i].TOP Layer i bottom
PROSPER.SIN.IPR.MULTILAT.LAYER[i].BOTTOM Number of layers
PROSPER.SIN.IPR.MULTILAT.VIEW[i][j].STARTPT.Z
Start z point
PROSPER.SIN.IPR.MULTILAT.VIEW[i][j].ENDPT.X End x point
PROSPER.SIN.IPR.MULTILAT.VIEW[i][j].ENDPT.Y End y point
PROSPER.SIN.IPR.MULTILAT.VIEW[i][j].ENDPT.Z End z point
To access the results of the multilateral calculations, the following codes can be used.
Example:
If there are 20 points for which the IPR is calculated and there are 3 layers in the model
then the following code can be set up to extract the results for the production of each
layer.
For i = 0 To 19
For j = 0 To 2
Cells(2 + i, 4 + j) = DoGet ("PROSPER.SIN.IPR.SINGLE.MRQLAY["
+ CStr(i) + "][" + CStr(j) + "]")
Next j
Next i
This is the data associated with the equipment data entry screens in PROSPER.
6.6.2.1 Overview
The equipment data is accessed using the root name PROSPER.SIN.EQP and is split
up into several sections as listed below:
i = 0:19
PROSPER.SIN.EQP.Devn.Data[0].Md Measured depth
PROSPER.SIN.EQP.Devn.Data[0].Tvd True vertical depth
i = 0:COUNT-1
PROSPER.SIN.EQP.DOWN.DATA[i].LABEL Label
PROSPER.SIN.EQP.DOWN.DATA[i].TYPE Type
PROSPER.SIN.EQP.DOWN.DATA[i].DEPTH Measured Depth
PROSPER.SIN.EQP.DOWN.DATA[i].TID Tubing Inside Diameter
PROSPER.SIN.EQP.DOWN.DATA[i].TIR Tubing Inside Roughness
PROSPER.SIN.EQP.DOWN.DATA[i].TOD Tubing Outside Diameter
PROSPER.SIN.EQP.DOWN.DATA[i].TOR Tubing Outside Roughness
PROSPER.SIN.EQP.DOWN.DATA[i].CID Casing Inside Diameter
PROSPER.SIN.EQP.DOWN.DATA[i].CIR Casing Inside Roughness
PROSPER.SIN.EQP.DOWN.DATA[i].COD Casing Outside Diameter
PROSPER.SIN.EQP.DOWN.DATA[i].COR Casing Outside Roughness
PROSPER.SIN.EQP.DOWN.DATA[i].CID2 Casing#2 Inside Diameter
PROSPER.SIN.EQP.DOWN.DATA[i].CIR2 Casing#2 Inside Roughness
PROSPER.SIN.EQP.DOWN.DATA[i].MULT Rate Multiplier
NOTE:
If an OpenServer macro is used to build a model from scratch, it will be important to
make sure that ALL the input variables needed in the downhole equipment are
specified via the OpenServer macro.
Effectively, if for instance the roughness is left to the default value and not specified via
the OpenServer macro, the downhole equipment section will not be validated, causing
an error when trying to perform a calculation.
The following commands are used to define the temperature survey when Calculate ->
"Pressure only" options is selected in the 'System Summary'
i = 0:9
PROSPER.SIN.EQP.Gauge.Data[i].Depth Gauge Depth
PROSPER.SIN.EQP.Gauge.Data[i].Label Gauge Label
Example:
The following OpenServer string illustrates how to set the gas lift method using the 0 to
2 indices:
DoSet ("PROSPER.SIN.GLF.Method"), 0
The above string will set the gas lift method to fixed depth of injection.
The same rules apply for all other DoSet strings that depend on an option index.
6.6.3.2 Electircal Submersible Pump
Example:
The following OpenServer string illustrates how to set the number of pumps using the 0
to 5 indices:
DoSet ("PROSPER.SIN.FRM.NumPumps"), 1
The same rules apply for all other DoSet strings that depend on an option index.
Gas Anchor
PROSPER.SIN.SRP.Input[75] Gas anchor:
0 = Entered
1 = Calculated
PROSPER.SIN.SRP.Input[77] Efficiency
PROSPER.SIN.SRP.Input[76] Type:
0 = Cup type
1 = Packer type
2 = Poor boy
PROSPER.SIN.SRP.Input[78] Annulus area
Example:
The following OpenServer string illustrates how to set the tubing anchor option using the
0 to 1 indices:
DoSet ("PROSPER.SIN.SRP.Input[10]"), 0
The above string will set the tubing anchor option to Yes.
The same rules apply for all other DoSet strings that depend on an option index.
6.6.3.9 Gas Lift (Intermittent)
PROSPER.ANL.INF
PROSPER.ANL.SYS
PROSPER.ANL.GRD
PROSPER.ANL.VLP
PROSPER.ANL.CHK
PROSPER.ANL.QLG
PROSPER.ANL.QLE
PROSPER.ANL.QLH
PROSPER.ANL.TCC
PROSPER.ANL.PCC
PROSPER.ANL.GMT
PROSPER.ANL.VMT
PROSPER.ANL.PMT
PROSPER.ANL.GLD
PROSPER.ANL.GLA
PROSPER.ANL.GEN
PROSPER.ANL.WHP
PROSPER.ANL.GDT
PROSPER.ANL.PLD
PROSPER.ANL.COR
PROSPER.ANL.THR
Example:
For example, selecting the PE2 correlation when performing a system calculation would
be done with the string:
DoSet “PROSPER.ANL.SYS.Tubing”, 10
NOTE:
It is generally recommended to use correlation names, as correlation indexes may vary
between different sections of PROSPER and also can change when user defined
correlations are introduced into the system. In this case using names, as opposed to
indexes, will make the macro generic and independent of those changes. The following
syntax can be used to access the correlations via their names:
The indexes for variables available in the sensitivity screens (such as the inflow and
system sensitivity calculation) are:
Indexes Relating to the SkinAide Model, API Test Data editions 4 and 5
i = 0:49
PROSPER.ANL.INF.RATES.COUNT Retrieve the number of IPR rates
PROSPER.ANL.INF.RATES[i] Set user defined rate value
i = 0:23
PROSPER.ANL.SYS.PIPE, i Defines pipeline correlation by its
index. Please refer to Sensitivity
Variables and Indexes for the list
of indexes.
PROSPER.ANL.SYS.PipeLabel, "Name" Defines pipeline correlation by its
name (label). Please refer to
Sensitivity Variables and Indexes
for the list of names.
PROSPER.ANL.SYS.TUBING, i Defines tubing correlation by its
index. Please refer to Sensitivity
Variables and Indexes for the list
of indexes.
PROSPER.ANL.SYS.TubingLabel, "Name" Defines tubing correlation by its
name (label). Please refer to
Sensitivity Variables and Indexes
for the list of names.
i = 0:19
PROSPER.ANL.SYS.RATES.COUNT Retrieve the number of rate values
PROSPER.ANL.SYS.RATES[i] Set user defined rate value
1 = Oil rates
2 = Gas Rate
3 = Hydrocarbon Mass flow rate
PROSPER.ANL.GRD.FIRSTNODE First Node
PROSPER.ANL.GRD.LASTNODE Last Node
i = 0:23
PROSPER.ANL.GRD.PIPE, i Defines pipeline correlation by its
index. Please refer to Sensitivity
Variables and Indexes for the list of
indexes.
PROSPER.ANL.GRD.PipeLabel, "Name" Defines pipeline correlation by its
name (label). Please refer to
Sensitivity Variables and Indexes for
the list of names.
PROSPER.ANL.GRD.TUBING, i Defines tubing correlation by its
index. Please refer to Sensitivity
Variables and Indexes for the list of
indexes.
PROSPER.ANL.GRD.TubingLabel, "Name" Defines tubing correlation by its
name (label). Please refer to
Sensitivity Variables and Indexes for
the list of names.
i = 0:23
PROSPER.ANL.VLP.PIPE, i Defines pipeline correlation by its index.
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.ANL.VLP.PipeLabel, "Name" Defines pipeline correlation by its name
(label). Please refer to Sensitivity
Variables and Indexes for the list of
names.
i = 0:50
PROSPER.ANL.VLP.RATES.COUNT Retrieve the number of rate values
PROSPER.ANL.VLP.RATES[i] Set user defined rate value
Input Data
PROSPER.ANL.CHK.DATA[16] Total GOR
Calculated Data
PROSPER.ANL.CHK.DATA[5] Liquid Rate
PROSPER.ANL.CHK.DATA[6] Gas Rate
PROSPER.ANL.CHK.DATA[21] Mass Flowrate
PROSPER.ANL.CHK.DATA[3] Outlet Temperature
PROSPER.ANL.CHK.DATA[22] Critical Pressure
PROSPER.ANL.CHK.DATA[23] Critical Rate
PROSPER.ANL.CHK.Data[24] Critical Temperature
Surface Measurements
i = 0:6
j = 0:1
Input Data
PROSPER.ANL.QLG.GASLIFT[0] Orifice Diameter
PROSPER.ANL.QLG.GASLIFT[1] Gas Injection Depth
i = 0:23
PROSPER.ANL.QLG.Tubing, i Defines tubing correlation by its index.
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.ANL.QLG.TubingLable, Defines tubing correlation by its name (label).
"name" Please refer to Sensitivity Variables and
Indexes for the list of names.
PROSPER.ANL.QLG.Dome Dome Pressure Correction flag
0 = No
1 = Yes
Flowing Measurements
i = 0:19
j = 0:2
PROSPER.ANL.QLG.FLOWING.COUNT Number of Flowing Measurements
PROSPER.ANL.QLG.FLOWING[i][0] Measured Depth
PROSPER.ANL.QLG.FLOWING[i][1] Minimum Pressure
PROSPER.ANL.QLG.FLOWING[i][2] Maximum Pressure
Static Measurements
i = 0:19
j = 0:1
PROSPER.ANL.QLG.STATIC.COUNT Number of Static Measurements
PROSPER.ANL.QLG.STATIC[i][0] Measured Depth
Valve Details
i = 0:29
PROSPER.ANL.QLG.MAND.COUNT Number of Mandrels
PROSPER.ANL.QLG.MAND[i].TYPE Valve Type
PROSPER.ANL.QLG.MAND[i].DEPTH Measured Depth
PROSPER.ANL.QLG.MAND[i].PORT Port Size
PROSPER.ANL.QLG.MAND[i].RVAL R Value
PROSPER.ANL.QLG.MAND[i].DOME Dome Pressure
Input Data
PROSPER.ANL.QLE.QUICK[0] Tubing head pressure
PROSPER.ANL.QLE.QUICK[1] Liquid rate
PROSPER.ANL.QLE.QUICK[2] Water cut
PROSPER.ANL.QLE.QUICK[3] GOR
PROSPER.ANL.QLE.QUICK[4] Static Bottom Hole Pressure
PROSPER.ANL.QLE.QUICK[5] Pump Depth
PROSPER.ANL.QLE.QUICK[6] Operating Frequency
PROSPER.ANL.QLE.QUICK[7] Length Of Cable
PROSPER.ANL.QLE.QUICK[8] Gas Separation Efficiency
PROSPER.ANL.QLE.QUICK[9] Number Of Stages
PROSPER.ANL.QLE.QUICK[10] Pump Wear Factor
PROSPER.ANL.QLE.EMULSION Emulsion Flag
Surface Data
PROSPER.ANL.QLE.SURF[0] Current
PROSPER.ANL.QLE.SURF[1] Surface Voltage
PROSPER.ANL.QLE.SURF[2] Power
Downhole Data
i = 0:19
Correlation
i = 0:23
PROSPER.ANL.QLE.Tubing, i Defines tubing correlation by its index.
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.ANL.QLE.TubingLable, Defines tubing correlation by its name (label).
"name" Please refer to Sensitivity Variables and
Indexes for the list of names.
Input Data
PROSPER.ANL.QLH.QUICK[0] Tubing Head Pressure
PROSPER.ANL.QLH.QUICK[1] Liquid Rate
PROSPER.ANL.QLH.QUICK[2] Water Cut
PROSPER.ANL.QLH.QUICK[3] Produced GOR
PROSPER.ANL.QLH.QUICK[4] Static Bottom Hole Pressure
PROSPER.ANL.QLH.QUICK[5] Pump Depth
PROSPER.ANL.QLH.QUICK[6] Pump Speed
PROSPER.ANL.QLH.QUICK[7] % Power Fluid Of Reservoir Fluid
PROSPER.ANL.QLH.QUICK[8] Pump Stages
PROSPER.ANL.QLH.QUICK[9] Pump Wear Factor
PROSPER.ANL.QLH.QUICK[10] Turbine Stages
PROSPER.ANL.QLH.EMULSION Emulsion Flag
Downhole Data
i = 0:19
PROSPER.ANL.QLH.DOWN.COUNT Number of Downhole Data Points
PROSPER.ANL.QLH.DOWN[i][0] Measured Depth
PROSPER.ANL.QLH.DOWN[i][1] Pressure
Correlation
i = 0:23
PROSPER.ANL.QLH.Tubing, i Defines tubing correlation by its index.
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.ANL.QLE.TubingLable, "name" Defines tubing correlation by its name
(label). Please refer to Sensitivity
Variables and Indexes for the list of
names.
GasLIft Wells
PROSPER.ANL.TCC.GLRate GasLIft Gas Injection Rate
PROSPER.ANL.TCC.GLDepth GasLift Injection Depth
i = 0:9
PROSPER.ANL.TCC.Comp[i].Msd Measured Depth
PROSPER.ANL.TCC.Comp[i].Prs Measured Pressure
i = 0:23
PROSPER.ANL.TCC.CORR[i], 1 Tubing correlation selection using the
correlation Index [i]:
0 = Deselect
1 = Select
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.ANL.TCC.CorrLabel[{name}], Tubing correlation selection using the
1 correlation {name}.
0 = Deselect
1 = Select
Please refer to Sensitivity Variables and
Indexes for the list of names.
PROSPER.ANL.TCC.CORR.COUNT Number of Tubing Correlations. Will return the
total number of correlations if a DoGet()
function is performed.
GasLift Wells
PROSPER.ANL.PCC.GLRate GasLIft Gas Injection Rate
i= 0:9
PROSPER.ANL.PCC.Comp[i].Node Node along the pipeline (according to surface
equipment)
PROSPER.ANL.PCC.Comp[0].Prs Measured Pressure
PROSPER.ANL.PCC.COMP.COUNT Number of Comparison Points. This refers to
the number of available points in the list of
Pressure vs Depth. A DoGet() command will
return the number 10.
i= 0:23
PROSPER.ANL.PCC.CORR[i], 1 Tubing correlation selection using the
correlation Index [i]:
0 = Deselect
1 = Select
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.ANL.PCC.CorrLabel[{name}], Tubing correlation selection using the
1 correlation {name}.
0 = Deselect
1 = Select
Please refer to Sensitivity Variables and
Indexes for the list of names.
PROSPER.ANL.TCC.CORR.COUNT Number of Tubing Correlations. Will return the
total number of correlations if a DoGet()
function is performed.
i = 0:9
PROSPER.ANL.GMT.Match[i].Msd Match data depth (MD)
PROSPER.ANL.GMT.Match[i].Prs Match data pressure
PROSPERR.ANL.GMT.MATCH.COUNT Number of Comparison Points. This refers to
the number of available points in the list of
Pressure vs Depth. A DoGet() command will
return the number 10.
i = 0:23
PROSPER.ANL.GMT.Corr[i], 1 Tubing correlation selection using the
correlation Index [i]:
0 = Deselect
1 = Select
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.ANL.GMT.CorrLabel[{name}], Tubing correlation selection using the
1 correlation {name}.
0 = Deselect
1 = Select
Please refer to Sensitivity Variables and
Indexes for the list of names.
PROSPER.ANL.GMT.CORR.COUNT Number of Tubing Correlations. Will return the
total number of correlations if a DoGet()
function is performed.
i = 0:999
PROSPER.ANL.VMT.DATA.COUNT Returns the number of well test Data (Match)
Points
PROSPER.ANL.VMT.DATA[i].ENABLE Enable test data:
1 = Disable
0 = Enable
PROSPER.ANL.VMT.Data[i].Date Test point date
PROSPER.ANL.VMT.DATA[i].DATEST Returns the date as a date string
RING
PROSPER.ANL.VMT.Data[i].Label Test point comment
PROSPER.ANL.VMT.DATA[i].THPRES Tubing Head Pressure
PROSPER.ANL.VMT.DATA[i].THTEMP Tubing Head Temperature
PROSPER.ANL.VMT.DATA[i].WC Water Cut
PROSPER.ANL.VMT.Data[i].Rate Gas rate
PROSPER.ANL.VMT.DATA[i].GDEPTH Gauge depth
PROSPER.ANL.VMT.DATA[i].GPRES Gauge pressure
PROSPER.ANL.VMT.Data[0].Pres Reservoir pressure
PROSPER.ANL.VMT.DATA[i].GOR GOR
PROSPER.ANL.VMT.DATA[i].GORFRE Free GOR
E
PROSPER.ANL.VMT.DATA[i].WGR Water gas ratio
PROSPER.ANL.VMT.DATA[i].CGR Condensate gas ratio
PROSPER.ANL.VMT.DATA[i].SGOR Separator GOR
Gas Lift
PROSPER.ANL.VMT.Data[i].Irate Gas lift gas rate
PROSPER.ANL.VMT.Data[i].Idepth Injection depth - measured
ESP
PROSPER.ANL.VMT.Data[i].Freq Operating frequency
PROSPER.ANL.VMT.Data[i].Wear Pump wear factor
i = 0:23
PROSPER.ANL.VMT.Corr[i], 1 Tubing correlation selection using the
correlation Index [i]:
0 = Deselect
1 = Select
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
i = 0:999
PROSPER.ANL.PMT.DATA.COUNT Number of Data (Match) Points
PROSPER.ANL.PMT.DATA[i].ENABLE Enable test data:
0 = Disable
1 = Enable
PROSPER.ANL.PMT.Data[i].Date Match point date
PROSPER.ANL.PMT.Data[i].Label Match point comment
PROSPER.ANL.PMT.Data[i].THpres Manifold pressure
PROSPER.ANL.PMT.Data[i].WC Water cut
PROSPER.ANL.PMT.Data[i].WGR WGR
PROSPER.ANL.PMT.Data[i].Rate Liquid rate
PROSPER.ANL.PMT.Data[i].Gpres Tubing head match pressure
PROSPER.ANL.PMT.Data[i].GOR GOR
PROSPER.ANL.PMT.Data[i].GORfree GOR free
PROSPER.ANL.PMT.Data[i].CGR Condensate gas ratio
PROSPER.ANL.PMT.Data[i].SGOR Separator GOR
GasLift Wells
PROSPER.ANL.PMT.Data[i].Irate GasLift Gas Injection Rate
i = 0:23
i = 0:23
PROSPER.ANL.GEN.PIPE, i Defines pipeline correlation by its
index. Please refer to Sensitivity
Variables and Indexes for the list of
indexes.
PROSPER.ANL.GEN.PipeLable, "name" Defines pipeline correlation by its
name (label). Please refer to Sensitivity
Variables and Indexes for the list of
names.
PROSPER.ANL.GEN.TUBING, i Defines tubing correlation by its index.
Please refer to Sensitivity Variables
and Indexes for the list of indexes.
PROSPER.ANL.GEN.TubingLable, "name" Defines tubing correlation by its name
i = 0:9
PROSPER.ANL.GEN.MANPRES.COUNT Number of Manifold Pressures
PROSPER.ANL.GEN.MANPRES[i] Manifold Pressures
i = 0:23
PROSPER.ANL.WHP.Tubing, i Defines tubing correlation by its index.
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.ANL.WHP.TubingLable, Defines tubing correlation by its name.
"name" Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.ANL.WHP.Pipe, i Defines pipeline correlation by its index.
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.ANL.WHP.PipeLable, "name" Defines pipeline correlation by its name.
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.ANL.WHP.FNode First node:
0 = Wellhead
1 = Manifold
PROSPER.ANL.WHP.Rate Rate Type:
0 = Liquid Rate
1 = Oil Rate
PROSPER.ANL.WHP.GFlag Gas Fraction:
0 = Gas Oil Ratio
1 = Gas Rate
PROSPER.ANL.WHP.WFlag Water Farction:
0 = Water Cut
1 = Water Rate
i = 0:499
PROSPER.ANL.WHP.DATA.COUNT Number of Records
GasLift Wells
PROSPER.ANL.WHP.DATA[i].GLIFT Injected Gaslift Gas rate
ESP Wells
PROSPER.ANL.WHP.DATA[i].Freq Pump Frequency
i = 0:19
PROSPER.ANL.GDT.DATA.COUNT Number of Test Points
PROSPER.ANL.GDT.DATA[i].TVD True Vertical Depth
PROSPER.ANL.GDT.DATA[i].MD Measured Depth
PROSPER.ANL.GDT.DATA[i].PRES Pressure
PROSPER.ANL.GDT.DATA[i].TEMP Temperature
i = 0:COUNT-1
PROSPER.ANL.PLD.DET[i].USED Used Flag
PROSPER.ANL.PLD.DET[i].TITLE Graph Title
PROSPER.ANL.PLD.DET[i].XAXIS X axis Label
PROSPER.ANL.PLD.DET[i].YAXIS Y axis Label
PROSPER.ANL.PLD.DET[i].XMIN Minimum X Value
PROSPER.ANL.PLD.DET[i].XMAX Maximum X Value
PROSPER.ANL.PLD.DET[i].XSTEP X axis Step Value
PROSPER.ANL.PLD.DET[i].YMIN Minimum Y Value
PROSPER.ANL.PLD.DET[i].YMAX Maximum Y Value
PROSPER.ANL.PLD.DET[i].YSTEP Y axis Step Value
PROSPER.ANL.PLD.DET[i].TMIN Minimum X Value (2nd X Axis)
PROSPER.ANL.PLD.DET[i].TMAX Maximum X Value (2nd X
Axis)
PROSPER.ANL.PLD.DET[i].TSTEP X axis Step Value (2nd X Axis)
PROSPER.ANL.PLD.DET[i].XEXTENT X axis Extent
PROSPER.ANL.PLD.DET[i].YEXTENT Y axis EXtent
PROSPER.ANL.PLD.DET[i].XBLKS Number of X axis Grid Blocks
PROSPER.ANL.PLD.DET[i].YBLKS Number of Y axis Grid Blocks
PROSPER.ANL.PLD.DET[i].THICK Line Thickness
PROSPER.ANL.PLD.DET[i].METHOD Scaling Method
PROSPER.ANL.PLD.DET[i].SCALE Plot Scales Flag
PROSPER.ANL.PLD.DET[i].LABEL Plot Labels Flag
PROSPER.ANL.PLD.DET[i].GRID Plot Grid FLag
PROSPER.ANL.PLD.DET[i].STAMP Date Stamp Title Flag
PROSPER.ANL.PLD.DET[i].LEGEND Draw LEgendds Flag
PROSPER.ANL.PLD.DET[i].MOUSE Show Mouse Position Flag
PROSPER.ANL.PLD.DET[i].HORIZ.HEIGHT Horizontal Font Details
PROSPER.ANL.PLD.DET[i].HORIZ.WIDTH
PROSPER.ANL.PLD.DET[i].HORIZ.ESCAPEMENT
PROSPER.ANL.PLD.DET[i].HORIZ.ORIENTATION
PROSPER.ANL.PLD.DET[i].HORIZ.WEIGHT
PROSPER.ANL.PLD.DET[i].HORIZ.ITALIC
PROSPER.ANL.PLD.DET[i].HORIZ.UNDERLINE
PROSPER.ANL.PLD.DET[i].HORIZ.STRIKEOUT
PROSPER.ANL.PLD.DET[i].HORIZ.CHARSET
PROSPER.ANL.PLD.DET[i].HORIZ.OUTPRECISION
PROSPER.ANL.PLD.DET[i].HORIZ.CLIPPRECISION
PROSPER.ANL.PLD.DET[i].HORIZ.QUALITY
PROSPER.ANL.PLD.DET[i].HORIZ.PITCHANDFAMILY
PROSPER.ANL.PLD.DET[i].HORIZ.FACENAME
PROSPER.ANL.PLD.DET[i].VERT.HEIGHT Vertical Font Details
PROSPER.ANL.PLD.DET[i].VERT.WIDTH
PROSPER.ANL.PLD.DET[i].VERT.ESCAPEMENT
PROSPER.ANL.PLD.DET[i].VERT.ORIENTATION
PROSPER.ANL.PLD.DET[i].VERT.WEIGHT
PROSPER.ANL.PLD.DET[i].VERT.ITALIC
PROSPER.ANL.PLD.DET[i].VERT.UNDERLINE
PROSPER.ANL.PLD.DET[i].VERT.STRIKEOUT
PROSPER.ANL.PLD.DET[i].VERT.CHARSET
PROSPER.ANL.PLD.DET[i].VERT.OUTPRECISION
PROSPER.ANL.PLD.DET[i].VERT.CLIPPRECISION
PROSPER.ANL.PLD.DET[i].VERT.QUALITY
PROSPER.ANL.PLD.DET[i].VERT.PITCHANDFAMILY
PROSPER.ANL.PLD.DET[i].VERT.FACENAME
PROSPER.ANL.PLD.DET[i].COLOR.COUNT Number of Colour Records
j = 0:COUNT-1
PROSPER.ANL.PLD.DET[i].COLOR[j].BAW Black And White Setting
PROSPER.ANL.PLD.DET[i].COLOR[j].GRY Grey Scale Setting
PROSPER.ANL.PLD.DET[i].COLOR[j].COL Colour Setting
PROSPER.ANL.PLD.DET[i].ANN.COUNT Number of Annotation Records
j = 0:COUNT-1
PROSPER.ANL.PLD.DET[i].ANN[j].TEXT Annotation Text
PROSPER.ANL.PLD.DET[i].ANN[j].RECT Bounding Rectangle
PROSPER.ANL.PLD.DET[i].ANN[j].SHOW Show Flag
PROSPER.ANL.PLD.DET[i].ANN[j].FILL Background Fill Flag
PROSPER.ANL.PLD.DET[i].ANN[j].VERTICAL Text alignment flag
i = 0:23
PROSPER.ANL.COR.CORR.COUNT Number of Correlations
PROSPER.ANL.COR.CORR[i].DLL DLL Index
PROSPER.ANL.COR.CORR[i].NAME Correlations Name
PROSPER.ANL.COR.CORR[i].INDEX Correlations Index
PROSPER.ANL.COR.CORR[i].PIPE Valid for PipeLine
PROSPER.ANL.COR.CORR[i].TUBE Valid for Tubing
PROSPER.ANL.COR.CORR[i].OIL Valid for Oil
PROSPER.ANL.COR.CORR[i].GAS Valid for Gas
PROSPER.ANL.COR.CORR[i].CON Valid for Condensate
PROSPER.ANL.COR.CORR[i].SELTUBE Selected as Tubing Correlation
PROSPER.ANL.COR.CORR[i].SELPIPE Selected as Pipeline Correlation
j = 0:1
PROSPER.ANL.COR.CORR[i].A[j] Matching Parameters for Tubing
PROSPER.ANL.COR.CORR[i].A[j] Matching Parameters for PipeLine
PROSPER.ANL.GLD
PROSPER.ANL.GLA
PROSPER.ANL.ESP
PROSPER.ANL.HSP
PROSPER.ANL.PCP
PROSPER.ANL.JET
PROSPER.ANL.SRP
The following commands are valid for both DoSet and DoGet functions:
Input Parameters
PROSPER.ANL.GLD.MAXGAS Maximum gas available
PROSPER.ANL.GLD.MAXGASUL Maximum gas during unloading
PROSPER.ANL.GLD.FWHP Flowing top node pressure
PROSPER.ANL.GLD.UWHP Unloading top node pressure
PROSPER.ANL.GLD.OPINJPRES Operating injection pressure
PROSPER.ANL.GLD.KOINJPRES Kick-off injection pressure
PROSPER.ANL.GLD.DPVALVE Desired dP across valve
i = 0:23
PROSPER.ANL.GLD.Tubing, i Defines tubing correlation by its index.
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.ANL.GLD.TubingLabel, Defines tubing correlation by its name (label).
"name" Please refer to Sensitivity Variables and
Indexes for the list of names.
Thornhill-Craver DeRating
PROSPER.ANL.GLD.ThornV De-rating percentage for valves
PROSPER.ANL.GLD.ThornO De-rating percentage for orifice
i = 0:23
PROSPER.ANL.GLA.Corr, i Defines vertical lift correlation by its index.
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.ANL.GLA.CorrLabel, "name" Defines vertical lift correlation by its name
(label). Please refer to Sensitivity Variables
and Indexes for the list of names.
The following commands are valid for both DoSet and DoGet functions:
Input Data
PROSPER.SIN.ESP.Depth Pump depth (measured)
PROSPER.SIN.ESP.Frequency Operating frequency
PROSPER.SIN.ESP.MaxPumpOD Pump maximum O.D.
PROSPER.SIN.ESP.CableLength Length of cable
i = 0:23
PROSPER.SIN.ESP.PIPE, i Defines pipeline correlation by its index.
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.SIN.ESP.PipeLabel, "name" Defines pipeline correlation by its name
(label). Please refer to Sensitivity Variables
and Indexes for the list of names.
PROSPER.SIN.ESP.TUBING Defines tubing correlation by its index. Please
refer to Sensitivity Variables and Indexes for
the list of indexes.
PROSPER.SIN.ESP.TubingLabel, Defines tubing correlation by its name (label).
"name" Please refer to Sensitivity Variables and
Indexes for the list of names.
Design Results
PROSPER.SIN.ESP.DesPump Selects the pump from database
PROSPER.SIN.ESP.DesMotor Selects the motor from database
PROSPER.SIN.ESP.DesHP Selects the motor power option from database
PROSPER.SIN.ESP.DesCable Selects the cable from database
Example:
The following examples outlines OpenServer commands and sequence of their
execution when designing an ESP well.
The following commands are valid for both DoSet and DoGet functions:
Input Data
PROSPER.SIN.HSP.PumpDepth Pump depth (measured)
PROSPER.SIN.HSP.PumpMaxOD Pump maximum O.D.
PROSPER.SIN.HSP.TurbMaxOD Turbine maximum O.D.
PROSPER.SIN.HSP.Rate Design liquid rate
PROSPER.SIN.HSP.WC Water cut
PROSPER.SIN.HSP.Pres Top node pressure
PROSPER.SIN.HSP.PumpSpeed Pump speed
PROSPER.SIN.HSP.TotalGOR Total GOR
PROSPER.SIN.HSP.PowerPC % Power fluid of reservoir fluid
PROSPER.SIN.HSP.Wear Pump wear factor
i = 0:23
PROSPER.SIN.HSP.Pipe, i Defines pipeline correlation by its index.
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.SIN.HSP.PipeLabel, "name" Defines pipeline correlation by its name
(label). Please refer to Sensitivity Variables
and Indexes for the list of names.
PROSPER.SIN.HSP.Tubing, i Defines tubing correlation by its index. Please
refer to Sensitivity Variables and Indexes for
the list of indexes.
PROSPER.SIN.HSP.TubingLabel, Defines tubing correlation by its name (label).
"name" Please refer to Sensitivity Variables and
Indexes for the list of names.
Design Results
The following commands are valid for both DoSet and DoGet functions:
i = 0:23
PROSPER.SIN.PCP.Pipe Defines pipeline correlation by its index.
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.SIN.PCP.PipeLabel Defines pipeline correlation by its name
(label). Please refer to Sensitivity
Variables and Indexes for the list of
names.
PROSPER.SIN.PCP.Tubing Defines tubing correlation by its index.
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.SIN.PCP.TubingLabel Defines tubing correlation by its name
(label). Please refer to Sensitivity
Variables and Indexes for the list of
names.
Design Results
PROSPER.SIN.PCP.DesPump Selects the pump from database
PROSPER.SIN.PCP.DesMotor Selects the motor from database
PROSPER.SIN.PCP.DesCable Selects the cable from database
The following commands are valid for both DoSet and DoGet functions:
Input Data
PROSPER.SIN.JET.Input[0] Pump depth (measured)
PROSPER.SIN.JET.Input[1] Pump maximum O.D.
PROSPER.SIN.JET.Input[4] Design liquid rate
PROSPER.SIN.JET.Input[5] Water cut
PROSPER.SIN.JET.Input[6] Total GOR
PROSPER.SIN.JET.Input[7] Top node pressure
PROSPER.SIN.JET.Input[8] Surface injection rate
PROSPER.SIN.JET.Input[9] Surface injection pressure
PROSPER.SIN.JET.LossCoef[0] Nozzle loss coefficient
PROSPER.SIN.JET.LossCoef[1] Suction loss coefficient
PROSPER.SIN.JET.LossCoef[2] Throat loss coefficient
PROSPER.SIN.JET.LossCoef[3] Diffuser loss coefficient
i = 0:23
PROSPER.SIN.PCP.Pipe, i Defines pipeline correlation by its index.
Please refer to Sensitivity Variables and
Indexes for the list of indexes.
PROSPER.SIN.PCP.PipeLabel, "name" Defines pipeline correlation by its name
(label). Please refer to Sensitivity Variables
and Indexes for the list of names.
PROSPER.SIN.PCP.Tubing, i Defines tubing correlation by its index. Please
refer to Sensitivity Variables and Indexes for
the list of indexes.
PROSPER.SIN.PCP.TubingLabel, Defines tubing correlation by its name (label).
"name" Please refer to Sensitivity Variables and
Indexes for the list of names.
The following commands are valid for both DoSet and DoGet functions:
PVT Data
PROSPER.SIN.SRP.Input[80] Oil gravity
PROSPER.SIN.SRP.Input[81] Gas gravity
PROSPER.SIN.SRP.Input[82] Water salinity
PROSPER.SIN.SRP.Input[83] Water cut
PROSPER.SIN.SRP.Input[84] GOR
Calculation Mode
PROSPER.SIN.SRP.Input[35] Calculation mode
0 = Enter stroke rate - calculate production rate
1 = Enter production rate - estimate stroke rate
PROSPER.SIN.SRP.Input[17] Pump Speed
PROSPER.SIN.SRP.Input[22] Target Production Rate
Rod Selection
PROSPER.SIN.SRP.Input[26] Rod type
PROSPER.SIN.SRP.Input[27] Rod number
PROSPER.SIN.SRP.Input[29] Rod grade
0=K
1=C
2=D
3=E
PROSPER.SIN.SRP.Input[86] Plunger Diameter (read only)
PROSPER.SIN.SRP.Input[36] Service factor
0 = Non-corrosive
1 = salty water
2 = Hydrogen sulphide
0 = Entered Value
1 = Calculated From IPR
2 = Calculated From Fluid Level
PROSPER.SIN.SRP.Input[34] Intake Pressure
PROSPER.SIN.SRP.Input[15] MidPoint Perforation Depth
Design Input
PROSPER.SIN.SRP.Input[9] Unit type:
0 = Conventional clockwise
1 = Conventional anticlockwise
2 = Type II
3 = Air balanced
PROSPER.SIN.SRP.Input[10] Anchored tubing
0 = Yes
1 = No
PROSPER.SIN.SRP.Input[15] Midpoint perforation depth
PROSPER.SIN.SRP.Input[16] Pump depth
PROSPER.SIN.SRP.Input[20] Pump volumetric efficiency
PROSPER.SIN.SRP.Input[21] Unit efficiency
PROSPER.SIN.SRP.Input[12] Pump diameter
0 = 1.062-in
1 = 1.25-in
2 = 1.50-in
3 = 1.75-in
4 = 1.87-in
5 = 2.00-in
6 = 2.25-in
7 = 2.50-in
8 = 2.75-in
9 = 3.75-in
10 = 4.75-in
PROSPER.SIN.SRP.Input[13] Surface stroke length
PROSPER.SIN.SRP.Input[23] Bottom hole temperature
PROSPER.SIN.SRP.Input[24] Wellhead temperature
PROSPER.SIN.SRP.Input[25] Wellhead pressure
PROSPER.OUT.INF
PROSPER.OUT.SYS
PROSPER.OUT.GRD
PROSPER.OUT.VLP
PROSPER.OUT.QLG
PROSPER.OUT.QLE
PROSPER.OUT.QLH
PROSPER.OUT.TCC
PROSPER.OUT.PCC
PROSPER.OUT.GMT
PROSPER.OUT.GEN
PROSPER.OUT.SPD
PROSPER.OUT.GLN
PROSPER.OUT.GLE
PROSPER.OUT.GLI
PROSPER.OUT.ESP
PROSPER.OUT.HSP
(m)
PROSPER.OUT.INF.Results[i].COUNT Returns the number of rate values used
for calculations (m)
Calculation Results
i = 0:n-1 Sensitivity case Index
j = 0:m-1 Row index in the results table
PROSPER.OUT.INF.RESULTS[i].LiqRate[j] Liquid rate
PROSPER.OUT.INF.RESULTS[i].OilRate[j] Oil rate
PROSPER.OUT.INF.RESULTS[i].WatRate[j] Water rate
PROSPER.OUT.INF.RESULTS[i].GasRate[j] Gas rate
PROSPER.OUT.INF.RESULTS[i].IPRPres[j] Inflow pressure
PROSPER.OUT.INF.RESULTS[i].DPTotal[j] Total dP skin
PROSPER.OUT.INF.RESULTS[i].DPPerf[j] Perforation dP skin
PROSPER.OUT.INF.RESULTS[i].DPDam[j] Damage dP skin
PROSPER.OUT.INF.RESULTS[i].DPComp[j] Completion dP skin
PROSPER.OUT.INF.RESULTS[i].SKTotal[j] Total skin
PROSPER.OUT.INF.RESULTS[i].SKComp[j] Completion skin
PROSPER.OUT.INF.RESULTS[i].DPGrav[j] Gravel pack dP skin
PROSPER.OUT.INF.RESULTS[i].SKGrav[j] Gravel pack skin
PROSPER.OUT.INF.Results[i].vcGrav[j] Gravel Pack Casing Velocity
PROSPER.OUT.INF.RESULTS[i].SKLam[j] Laminar skin (SkinAide)
PROSPER.OUT.INF.RESULTS[i].SKTurb[j] Turbulence skin (SkinAide)
PROSPER.OUT.INF.RESULTS[i].DPLam[j] Laminar dP skin (SkinAide)
PROSPER.OUT.INF.RESULTS[i].DPTurb[j] Turbulence dP skin (SkinAide)
Calculation Results
i = 0:n-1 Sensitivity Case Index
j = 0:m-1 Row index in the results table
Solutions Results
PROSPER.OUT.SYS.Results[0].Sol.LiqRate Liquid Rate
PROSPER.OUT.SYS.Results[0].Sol.OilRate Oil Rate
PROSPER.OUT.SYS.Results[0].Sol.WatRate Water Rate
PROSPER.OUT.SYS.Results[0].Sol.GasRate Gas Rate
PROSPER.OUT.SYS.Results[0].Sol.BHP Solution Node Pressure
PROSPER.OUT.SYS.Results[0].Sol.PRFRIC dP Friction
PROSPER.OUT.SYS.Results[0].Sol.PRSTAT dP Gravity
PROSPER.OUT.SYS.Results[0].Sol.dPTotalSkin dP Total Skin
PROSPER.OUT.SYS.Results[0].Sol.dPPerforation dP Perforation
PROSPER.OUT.SYS.Results[0].Sol.dPDamage dP Damage
PROSPER.OUT.SYS.Results[0].Sol.dPCompletio dP Completion
n
PROSPER.OUT.SYS.Results[0].Sol.CompletionSk Completions Skin
in
PROSPER.OUT.SYS.Results[0].Sol.TotalSkin Total Skin
PROSPER.OUT.SYS.Results[0].Sol.dpGravel dP Sand Control
PROSPER.OUT.SYS.Results[0].Sol.GravelPackS Sand Control Skin
kin
PROSPER.OUT.SYS.Results[0].Sol.DIlRate Gravel Pack Casing Velocity
PROSPER.OUT.SYS.Results[0].Sol.WHDenLiquid Wellhead Liquid Density
PROSPER.OUT.SYS.Results[0].Sol.WHDenGas Wellhead Gas Density
PROSPER.OUT.SYS.Results[0].Sol.WHVisLiquid Wellhead Liquid Viscosity
PROSPER.OUT.SYS.Results[0].Sol.WHVisGas Wellhead Gas Viscosity
PROSPER.OUT.SYS.Results[0].Sol.WHVelLiquid Wellhead Superficial Liquid Velocity
PROSPER.OUT.SYS.Results[0].Sol.WHVelGas Wellhead Superficial Gas Velocity
PROSPER.OUT.SYS.Results[0].Sol.WHZFactor Wellhead Z-factor
PROSPER.OUT.SYS.Results[0].Sol.WHSurfaceTe Wellhead Interfacial Tension
nsion
PROSPER.OUT.SYS.Results[0].Sol.WHPressure Wellhead Pressure
PROSPER.OUT.SYS.Results[0].Sol.WHTemperat Wellhead Temperature
ure
PROSPER.OUT.SYS.Results[0].Sol.FNDenLiquid First Node Liquid Density
PROSPER.OUT.SYS.Results[0].Sol.FNDenGas First Node Gas Density
PROSPER.OUT.SYS.Results[0].Sol.FNVisLiquid First Node Liquid Viscosity
PROSPER.OUT.SYS.Results[0].Sol.FNVisGas First Node Gas Viscosity
PROSPER.OUT.SYS.Results[0].Sol.FNVelLiquid First Node Superficial Liquid
Velocity
PROSPER.OUT.SYS.Results[0].Sol.FNVelGas First Node Superficial Gas Velocity
PROSPER.OUT.SYS.Results[0].Sol.FNZFactor First Node Z-factor
PROSPER.OUT.SYS.Results[0].Sol.FNSurfaceTe First Node Interfacial Tension
nsion
PROSPER.OUT.SYS.Results[0].Sol.FNPressure First Node Pressure
PROSPER.OUT.SYS.Results[0].Sol.FNTemperatu First Node Temperature
re
l = 0:n-1
PROSPER.OUT.GRD.RESULTS[i][j][k].LABEL[l] Label Number
PROSPER.OUT.GRD.RESULTS[i][j][k].MSD[l] Measured Depth
PROSPER.OUT.GRD.RESULTS[i][j][k].TVD[l] True Vertical Depth
PROSPER.OUT.GRD.RESULTS[i][j][k].PRES[l] Pressure
PROSPER.OUT.GRD.RESULTS[i][j][k].TEMP[l] Fluid Temperature
PROSPER.OUT.GRD.RESULTS[i][j][k].GRAD[l] Gradient
PROSPER.OUT.GRD.RESULTS[i][j][k].HOLDUP[l] Holdup
PROSPER.OUT.GRD.RESULTS[i][j][k].REGIME[l] Flow Regime Number. See Flow
Regime Number for further
information
PROSPER.OUT.GRD.RESULTS[i][j][k].HTC[l] Heat Transfer Coefficient
PROSPER.OUT.GRD.RESULTS[i][j][k].TFO[l] Formation Temperature
PROSPER.OUT.GRD.RESULTS[i][j][k].GRSTAT[l] Static Gradient
PROSPER.OUT.GRD.RESULTS[i][j][k].GRFRIC[l] Friction Gradient
PROSPER.OUT.GRD.RESULTS[i][j][k].VLSLIP[l] Slip Liquid Velocity
PROSPER.OUT.GRD.RESULTS[i][j][k].VLNSLP[l] NoSlip Liquid Velocity
PROSPER.OUT.GRD.RESULTS[i][j][k].VGSLIP[l] Slip Gas Velocity
PROSPER.OUT.GRD.RESULTS[i][j][k].VGNSLP[l] NoSlip Gas Velocity
PROSPER.OUT.GRD.RESULTS[i][j][k].AVRHSL[l] Mixture Density
PROSPER.OUT.GRD.RESULTS[i][j][k].PRSTAT[l] Pressure due to friction
PROSPER.OUT.GRD.RESULTS[i][j][k].PRFRIC[l] Pressure due to gravity
PROSPER.OUT.GRD.RESULTS[i][j][k].CASTEM[l] Casing temperature
PROSPER.OUT.GRD.RESULTS[i][j][k].ANNTEM[l] Average annulus temperature
PROSPER.OUT.GRD.RESULTS[i][j][k].RHOOIL[l] Gas density
PROSPER.OUT.GRD.RESULTS[i][j] Oil density
[k].RHOGAS[l]
PROSPER.OUT.GRD.RESULTS[i][j] Water density
[k].RHOWAT[l]
PROSPER.OUT.GRD.RESULTS[i][j][k].DIAINT[l] Diameter
PROSPER.OUT.GRD.RESULTS[i][j][k].ANGLE[l] Angle
PROSPER.OUT.GRD.RESULTS[i][j][k].DSTEP[l] Section length
PROSPER.OUT.GRD.RESULTS[i][j][k].FMULIQ[l] Liquid viscosity
PROSPER.OUT.GRD.RESULTS[i][j] Gas viscosity
[k].FMUGAS[l]
PROSPER.OUT.GRD.RESULTS[i][j][k].SIGLIQ[l] Gas-Liquid IFT
PROSPER.OUT.GRD.RESULTS[i][j][k].SIGWAT[l] Gas-Water IFT
PROSPER.OUT.GRD.RESULTS[i][j][k].SIGOIL[l] Gas-Oil IFT
PROSPER.OUT.GRD.RESULTS[i][j][k].SIGOW[l] Oil-Water IFT
PROSPER.OUT.GRD.RESULTS[i][j][k].SLUGLM[l] Mean Slug Length
PROSPER.OUT.GRD.RESULTS[i][j][k].SLUGLX[l] 1/000 Slug Length
PROSPER.OUT.GRD.RESULTS[i][j][k].BUBLNM[l] Mean Bubble Length
PROSPER.OUT.GRD.RESULTS[i][j][k].BUBLNX[l] 1/1000 Bubble Length
PROSPER.OUT.GRD.RESULTS[i][j][k].SLUGQL[l] Mean Slug Liquid Rate
PROSPER.OUT.GRD.RESULTS[i][j][k].SLUGQG[l] Mean Slug Gas Rate
PROSPER.OUT.GRD.RESULTS[i][j][k].BUBLQL[l] Mean Bubble Liquid Rate
PROSPER.OUT.GRD.RESULTS[i][j][k].BUBLQG[l] Mean Bubble Gas Rate
PROSPER.OUT.GRD.RESULTS[i][j][k].SLGFRM[l] Mean Slug Frequency
PROSPER.OUT.GRD.RESULTS[i][j][k].SLGFRX[l] 1/1000 Slug Frequency
PROSPER.OUT.GRD.RESULTS[i][j][k].SLGHLS[l] Slug Holdup (HLS)
PROSPER.OUT.GRD.RESULTS[i][j][k].SLGHLE[l] Equilibrium Holdup (HLE)
PROSPER.OUT.GRD.RESULTS[i][j][k].CFACTR[l] C Factor (Erosional Velocity)
PROSPER.OUT.GRD.RESULTS[i][j][k].SANDDI[l] Max Transportable Grain Diameter
PROSPER.OUT.GRD.RESULTS[i][j][k].CORR[l] Correlation Index
PROSPER.OUT.GRD.RESULTS[i][j] Hydrates Formation Flag
[k].HYDRATE[l]
l = 0:n-1
PROSPER.OUT.GRD.RESULTS[i][j] Depth
[k].GASGRAD.DEPTH[l]
PROSPER.OUT.GRD.RESULTS[i][j] Pressure
[k].GASGRAD.PRES[l]
PROSPER.OUT.GRD.RESULTS[i][j][k].REGIME[l]
can be used to retrieve the predicted flow regime index for the selected multiphase flow
correlation.
NOTE:
The flow regime numeric value in PROSPER is returned with prefix '10'. Thus, for
Petroleum Experts 5 predicting Annular Flow, the value of 105 will be returned.
The following table summarises the flow regime associated with the returned value for
each multiphase flow correlation:
Returned
Vertical Flow Correlation Flow Regime
Index Value
Duns and Ros Modified 1 Bubble
2 Plug
3 Bubble / Slug
4 Heading
5 Sklug
6 Froth
7 Transition
8 Mist
9 Gas
10 Liquid
Orkiszewski 1 Bubble
2 Slug
3 Transition
4 Mist
5 Gas
6 Froth
7 Transition
8 Mist
9 Gas
10 Liquid
2 Gas
3 Strat. Smooth
4 Strat. Wavy
5 Annular
6 Slug (normal)
7 Slug (induced)
8 Disp. Bubble
4 Strat. Wavy
5 Annular
6 Slug (normal)
7 Slug (induced)
8 Disp. Bubble
Calculation Results
i = 0:n-1 Sensitivity Case Index
j = 0:m-1 Row index in the results table
PROSPER.OUT.VLP.RESULTS[i].LiqRate[j] Liquid rate
PROSPER.OUT.VLP.RESULTS[i].OilRate[j] Oil rate
PROSPER.OUT.VLP.RESULTS[i].WatRate[j] Water rate
PROSPER.OUT.VLP.RESULTS[i].GasRate[j] Gas rate
PROSPER.OUT.VLP.Results[i].VLPpres[j] VLP Pressure
PROSPER.OUT.VLP.RESULTS[i].DPTotal[j] Total dP skin
PROSPER.OUT.VLP.RESULTS[i].DPPerf[j] Perforation dP skin
PROSPER.OUT.VLP.RESULTS[i].DPDam[j] Damage dP skin
PROSPER.OUT.VLP.RESULTS[i].DPComp[j] Completion dP skin
PROSPER.OUT.VLP.RESULTS[i].SKTotal[j] Total skin
PROSPER.OUT.VLP.RESULTS[i].SKComp[j] Completion skin
PROSPER.OUT.VLP.RESULTS[i].DPGrav[j] Gravel pack dP skin
PROSPER.OUT.VLP.RESULTS[i].SKGrav[j] Gravel pack skin
PROSPER.OUT.VLP.Results[i].vcGrav[j] Gravel Pack Casing Velocity
PROSPER.OUT.VLP.Results[i].WHpres[j] Wellhead Pressure
PROSPER.OUT.VLP.Results[i].WHtemp[j] Wellhead Temperature
PROSPER.OUT.VLP.Results[i].FNtemp[j] First Node Temperature
PROSPER.OUT.VLP.Results[i].PrFric[j] dP Friction
PROSPER.OUT.VLP.Results[i].PrStat[j] dP Gravity
PROSPER.OUT.VLP.Results[i].MixVel[j] Total No Slip Velocity
PROSPER.OUT.VLP.Results[i].EroVel[j] Erosional Velocity
PROSPER.OUT.VLP.Results[i].CFactr[j] C Factor
PROSPER.ANL.VLP.EXPORT
NOTE:
The command "PROSPER.ANL.VLP.EXPORT" will not export any file if the exported file
name and file path have not been specified before hand. The export parameters (type of
VLP format, units, name of the file, etc) can be entered through OpenServer using the
following variables:
The following table provides the list of formats that are available in PROSPER for VLP
export. For OpenServer export the formats can be selected via the corresponding index
or string.
10 Franlab - ATHOS
11 BP - GCOMP
12 ChevronTexaco - CHEARS
13 ExxonMobil - EMPOWER
14 ConocoPhillips - Psim
15 CMG - IMEX / GEM (old Format)
16 CMG - IMEX / GEM (Release 2009.10)
17 Saudi Aramco - Powers
Example:
For example, the three following OpenServer statements would export an ECLIPSE
formatted VLP file called "test.ecl" under the C:\ drive:
NOTE: If well type is changed to gas lift for example, then not all tpd formats will be
accessible for export, and the tpd index value will also change. To avoid tpd index
changes, the tpd file extension can be used, i.e., *.TPD (Petex), *.ecl (Eclipse), etc.
Input Data
PROSPER.OUT.QLG.Output[20] Tubing Head Pressure
PROSPER.OUT.QLG.Output[21] Tubing Head Temperature
PROSPER.OUT.QLG.Output[22] Liquid Rate
Results
PROSPER.OUT.QLG.Output[13] Flowing BottomHole Pressure
PROSPER.OUT.QLG.Output[12] Static BottomHole Pressure
PROSPER.OUT.QLG.Output[0] Tubing Pressure At Valve
PROSPER.OUT.QLG.Output[11] Casing Pressure At Valve
PROSPER.OUT.QLG.Output[1] Temperature At Valve
PROSPER.OUT.QLG.Output[2] Gas Oil Ratio
PROSPER.OUT.QLG.Output[3] GOR Free
PROSPER.OUT.QLG.Output[4] dP Across Valve
PROSPER.OUT.QLG.Output[5] Calculated Casing Head Pressure
PROSPER.OUT.QLG.Output[6] Draw Down
PROSPER.OUT.QLG.Output[7] Equivalent Calculated PI
PROSPER.OUT.QLG.Output[8] Calculated Critical Flow Rate
PROSPER.OUT.QLG.Output[9] Percentage of Criotical Flow Rate
PROSPER.OUT.QLG.Output[10] Fitted Thermal Coefficient
j = 0:n-1
PROSPER.OUT.QLG.Results[i].Label[j] Label
PROSPER.OUT.QLG.Results[i].MSD[j] Bottom Measured Depth
PROSPER.OUT.QLG.Results[i].TVD[j] True Vertical Depth
PROSPER.OUT.QLG.Results[i].Pres[j] Pressure
PROSPER.OUT.QLG.Results[i].Temp[j] Temperature
PROSPER.OUT.QLG.Results[i].Grad[j] Gradient
PROSPER.OUT.QLG.Results[i].Holdup[j] Holdup
PROSPER.OUT.QLG.Results[i].Regime[j] Regime
PROSPER.OUT.QLG.Results[i].HTC[j] Heat Transfer Coefficient
PROSPER.OUT.QLG.Results[i].HydFlag[j] Hydrates Formation Flag
PROSPER.OUT.QLG.Results[i].Grstat[j] Static Gradient
PROSPER.OUT.QLG.Results[i].Grfric[j] Friction Gradient
PROSPER.OUT.QLG.Results[i].PrFric[j] Friction Pressure Loss
PROSPER.OUT.QLG.Results[i].PrStat[j] Gravity Pressure Loss
PROSPER.OUT.QLG.Results[i].Vlslip[j] Slip Liquid Velocity
PROSPER.OUT.QLG.Results[i].Vgslip[j] Slip Gas Velocity
PROSPER.OUT.QLG.Results[i].Vwslip[j] Slip Water Velocity
PROSPER.OUT.QLG.Results[i].Vlnslp[j] Superficial Liquid Velocity
PROSPER.OUT.QLG.Results[i].Vgnslp[j] Superficial Gas Velocity
PROSPER.OUT.QLG.Results[i].Vwnslp[j] Superficial Water Velocity
PROSPER.OUT.QLG.Results[i].VlTurn[j] Turner Velocity
PROSPER.OUT.QLG.Results[i].VlTotl[j] Total NoSlip Velocity
PROSPER.OUT.QLG.Results[i].VlEros[j] Erosional Velocity
PROSPER.OUT.QLG.Results[i].CFactr[j] C Factor
PROSPER.OUT.QLG.Results[i].SandDi[j] Maximum Garin Diameter
PROSPER.OUT.QLG.Results[i].RhoOil[j] Oil Density
PROSPER.OUT.QLG.Results[i].RhoGas[j] Gas Density
PROSPER.OUT.QLG.Results[i].RhoWat[j] Water Density
PROSPER.OUT.QLG.Results[i].RhoLiq[j] Liquid Density
PROSPER.OUT.QLG.Results[i].RhoMix[j] Mixture Density
PROSPER.OUT.QLG.Results[i].FmuOil[j] Oil Viscosity
PROSPER.OUT.QLG.Results[i].FmuWat[j] Water Viscosity
PROSPER.OUT.QLG.Results[i].FmuGas[j] Gas Viscosity
PROSPER.OUT.QLG.Results[i].FmuLiq[j] Liquid Viscosity
PROSPER.OUT.QLG.Results[i].SigLiq[j] Gas-Liquid Interfacial Tension
PROSPER.OUT.QLG.Results[i].SigWat[j] Gas-Water Interfacial Tension
PROSPER.OUT.QLG.Results[i].SigOil[j] Gas-Oil Interfacial Tension
PROSPER.OUT.QLG.Results[i].SigOW[j] Oil-Water Interfacial Tension
PROSPER.OUT.QLG.Results[i].OilFvf[j] Oil FVF
PROSPER.OUT.QLG.Results[i].GasFvf[j] Gas FVF
PROSPER.OUT.QLG.Results[i].WatFvf[j] Water FVF
PROSPER.OUT.QLG.Results[i].EntOil[j] Oil Enthalpy
PROSPER.OUT.QLG.Results[i].EntWat[j] Water Enthalpy
PROSPER.OUT.QLG.Results[i].EntGas[j] Gas Enthalpy
j = 0:n
PROSPER.OUT.QLG.RESULTS[i].GASGRAD[j].DE Depth
PTH
PROSPER.OUT.QLG.RESULTS[i].GASGRAD[j].PR Pressure
ES
Results
PROSPER.OUT.QLE.Output[0] Pump Power Requirement
PROSPER.OUT.QLE.Output[1] Motor Power Requirement
PROSPER.OUT.QLE.Output[2] Motor Efficiency
PROSPER.OUT.QLE.Output[3] Surface Voltage
PROSPER.OUT.QLE.Output[4] Pump Intake Pressure
PROSPER.OUT.QLE.Output[5] Pump Discharge Pressure
PROSPER.OUT.QLE.Output[6] Doqnhole Rate
PROSPER.OUT.QLE.Output[7] Free Gas In Pump
PROSPER.OUT.QLE.Output[8] Surface KVA
PROSPER.OUT.QLE.Output[9] Torque On Shaft
PROSPER.OUT.QLE.Output[10] Delta T across Pump
j = 0:n-1
PROSPER.OUT.QLE.Results[i].Label[j] Label
PROSPER.OUT.QLE.Results[i].MSD[j] Bottom Measured Depth
PROSPER.OUT.QLE.Results[i].TVD[j] True Vertical Depth
PROSPER.OUT.QLE.Results[i].Pres[j] Pressure
PROSPER.OUT.QLE.Results[i].Temp[j] Temperature
PROSPER.OUT.QLE.Results[i].Grad[j] Gradient
PROSPER.OUT.QLE.Results[i].Holdup[j] Holdup
PROSPER.OUT.QLE.Results[i].Regime[j] Regime
PROSPER.OUT.QLE.Results[i].HTC[j] Heat Transfer Coefficient
PROSPER.OUT.QLE.Results[i].HydFlag[j] Hydrates Formation Flag
PROSPER.OUT.QLE.Results[i].Grstat[j] Static Gradient
PROSPER.OUT.QLE.Results[i].Grfric[j] Friction Gradient
PROSPER.OUT.QLE.Results[i].PrFric[j] Friction Pressure Loss
PROSPER.OUT.QLE.Results[i].PrStat[j] Gravity Pressure Loss
PROSPER.OUT.QLE.Results[i].Vlslip[j] Slip Liquid Velocity
PROSPER.OUT.QLE.Results[i].Vgslip[j] Slip Gas Velocity
PROSPER.OUT.QLE.Results[i].Vwslip[j] Slip Water Velocity
PROSPER.OUT.QLE.Results[i].Vlnslp[j] Superficial Liquid Velocity
PROSPER.OUT.QLE.Results[i].Vgnslp[j] Superficial Gas Velocity
PROSPER.OUT.QLE.Results[i].Vwnslp[j] Superficial Water Velocity
PROSPER.OUT.QLE.Results[i].VlTurn[j] Turner Velocity
PROSPER.OUT.QLE.Results[i].VlTotl[j] Total NoSlip Velocity
PROSPER.OUT.QLE.Results[i].VlEros[j] Erosional Velocity
PROSPER.OUT.QLE.Results[i].CFactr[j] C Factor
PROSPER.OUT.QLE.Results[i].SandDi[j] Maximum Garin Diameter
PROSPER.OUT.QLE.Results[i].RhoOil[j] Oil Density
PROSPER.OUT.QLE.Results[i].RhoGas[j] Gas Density
PROSPER.OUT.QLE.Results[i].RhoWat[j] Water Density
PROSPER.OUT.QLE.Results[i].RhoLiq[j] Liquid Density
PROSPER.OUT.QLE.Results[i].RhoMix[j] Mixture Density
PROSPER.OUT.QLE.Results[i].FmuOil[j] Oil Viscosity
PROSPER.OUT.QLE.Results[i].FmuWat[j] Water Viscosity
PROSPER.OUT.QLE.Results[i].FmuGas[j] Gas Viscosity
PROSPER.OUT.QLE.Results[i].FmuLiq[j] Liquid Viscosity
PROSPER.OUT.QLE.Results[i].SigLiq[j] Gas-Liquid Interfacial Tension
PROSPER.OUT.QLE.Results[i].SigWat[j] Gas-Water Interfacial Tension
PROSPER.OUT.QLE.Results[i].SigOil[j] Gas-Oil Interfacial Tension
PROSPER.OUT.QLE.Results[i].SigOW[j] Oil-Water Interfacial Tension
PROSPER.OUT.QLE.Results[i].OilFvf[j] Oil FVF
PROSPER.OUT.QLE.Results[i].GasFvf[j] Gas FVF
PROSPER.OUT.QLE.Results[i].WatFvf[j] Water FVF
PROSPER.OUT.QLE.Results[i].EntOil[j] Oil Enthalpy
PROSPER.OUT.QLE.Results[i].EntWat[j] Water Enthalpy
Results
PROSPER.OUT.QLH.Output[0] Pump Power Required
PROSPER.OUT.QLH.Output[1] Turbine Power Generated
PROSPER.OUT.QLH.Output[2] Turbine Efficiency
j = 0:n-1
PROSPER.OUT.QLH.Results[i].Label[j] Label
PROSPER.OUT.QLH.Results[i].MSD[j] Bottom Measured Depth
PROSPER.OUT.QLH.Results[i].TVD[j] True Vertical Depth
PROSPER.OUT.QLH.Results[i].Pres[j] Pressure
PROSPER.OUT.QLH.Results[i].Temp[j] Temperature
PROSPER.OUT.QLH.Results[i].Grad[j] Gradient
PROSPER.OUT.QLH.Results[i].Holdup[j] Holdup
PROSPER.OUT.QLH.Results[i].Regime[j] Regime
PROSPER.OUT.QLH.Results[i].HTC[j] Heat Transfer Coefficient
PROSPER.OUT.QLH.Results[i].HydFlag[j] Hydrates Formation Flag
PROSPER.OUT.QLH.Results[i].Grstat[j] Static Gradient
PROSPER.OUT.QLH.Results[i].Grfric[j] Friction Gradient
PROSPER.OUT.QLH.Results[i].PrFric[j] Friction Pressure Loss
PROSPER.OUT.QLH.Results[i].PrStat[j] Gravity Pressure Loss
PROSPER.OUT.QLH.Results[i].Vlslip[j] Slip Liquid Velocity
PROSPER.OUT.QLH.Results[i].Vgslip[j] Slip Gas Velocity
PROSPER.OUT.QLH.Results[i].Vwslip[j] Slip Water Velocity
j = 0:n-1
PROSPER.OUT.TCC.Results[i].Label[j] Label
PROSPER.OUT.TCC.Results[i].MSD[j] Bottom Measured Depth
PROSPER.OUT.TCC.Results[i].TVD[j] True Vertical Depth
PROSPER.OUT.TCC.Results[i].Pres[j] Pressure
PROSPER.OUT.TCC.Results[i].Temp[j] Temperature
PROSPER.OUT.TCC.Results[i].Grad[j] Gradient
PROSPER.OUT.TCC.Results[i].Holdup[j] Holdup
PROSPER.OUT.TCC.Results[i].Regime[j] Regime
PROSPER.OUT.TCC.Results[i].HTC[j] Heat Transfer Coefficient
PROSPER.OUT.TCC.Results[i].HydFlag[j] Hydrates Formation Flag
PROSPER.OUT.TCC.Results[i].Grstat[j] Static Gradient
PROSPER.OUT.TCC.Results[i].Grfric[j] Friction Gradient
PROSPER.OUT.TCC.Results[i].PrFric[j] Friction Pressure Loss
PROSPER.OUT.TCC.Results[i].PrStat[j] Gravity Pressure Loss
PROSPER.OUT.TCC.Results[i].Vlslip[j] Slip Liquid Velocity
PROSPER.OUT.TCC.Results[i].Vgslip[j] Slip Gas Velocity
PROSPER.OUT.TCC.Results[i].Vwslip[j] Slip Water Velocity
PROSPER.OUT.TCC.Results[i].Vlnslp[j] Superficial Liquid Velocity
PROSPER.OUT.TCC.Results[i].Vgnslp[j] Superficial Gas Velocity
PROSPER.OUT.TCC.Results[i].Vwnslp[j] Superficial Water Velocity
PROSPER.OUT.TCC.Results[i].VlTurn[j] Turner Velocity
PROSPER.OUT.TCC.Results[i].VlTotl[j] Total NoSlip Velocity
PROSPER.OUT.TCC.Results[i].VlEros[j] Erosional Velocity
PROSPER.OUT.TCC.Results[i].CFactr[j] C Factor
PROSPER.OUT.TCC.Results[i].SandDi[j] Maximum Garin Diameter
PROSPER.OUT.TCC.Results[i].RhoOil[j] Oil Density
PROSPER.OUT.TCC.Results[i].RhoGas[j] Gas Density
PROSPER.OUT.TCC.Results[i].RhoWat[j] Water Density
PROSPER.OUT.TCC.Results[i].RhoLiq[j] Liquid Density
PROSPER.OUT.TCC.Results[i].RhoMix[j] Mixture Density
PROSPER.OUT.TCC.Results[i].FmuOil[j] Oil Viscosity
PROSPER.OUT.TCC.Results[i].FmuWat[j] Water Viscosity
PROSPER.OUT.TCC.Results[i].FmuGas[j] Gas Viscosity
PROSPER.OUT.TCC.Results[i].FmuLiq[j] Liquid Viscosity
PROSPER.OUT.TCC.Results[i].SigLiq[j] Gas-Liquid Interfacial Tension
PROSPER.OUT.TCC.Results[i].SigWat[j] Gas-Water Interfacial Tension
PROSPER.OUT.TCC.Results[i].SigOil[j] Gas-Oil Interfacial Tension
PROSPER.OUT.TCC.Results[i].SigOW[j] Oil-Water Interfacial Tension
PROSPER.OUT.TCC.Results[i].OilFvf[j] Oil FVF
PROSPER.OUT.TCC.Results[i].GasFvf[j] Gas FVF
Example:
If "Petroleum Experts 5" correlation is
selected for analysis the results for it will
be published under index 20:
PROSPER.OUT.PCC.Results[20]
PROSPER.OUT.PCC.Results.COUNT Returns the number of the last
correlations selected for analysis. This
number is equal to the correlation index
plus 1.
PROSPER.OUT.PCC.Results[i].COUNT Number of calculation results (n) for
selected correlation
j = 0:n-1
PROSPER.OUT.PCC.Results[i].Label[j] Label
PROSPER.OUT.PCC.Results[i].MSD[j] Bottom Measured Depth
PROSPER.OUT.PCC.Results[i].TVD[j] True Vertical Depth
PROSPER.OUT.PCC.Results[i].Pres[j] Pressure
PROSPER.OUT.PCC.Results[i].Temp[j] Temperature
PROSPER.OUT.PCC.Results[i].Grad[j] Gradient
PROSPER.OUT.PCC.Results[i].Holdup[j] Holdup
PROSPER.OUT.PCC.Results[i].Regime[j] Regime
PROSPER.OUT.PCC.Results[i].HTC[j] Heat Transfer Coefficient
PROSPER.OUT.PCC.Results[i].HydFlag[j] Hydrates Formation Flag
PROSPER.OUT.PCC.Results[i].Grstat[j] Static Gradient
PROSPER.OUT.PCC.Results[i].Grfric[j] Friction Gradient
PROSPER.OUT.PCC.Results[i].PrFric[j] Friction Pressure Loss
PROSPER.OUT.PCC.Results[i].PrStat[j] Gravity Pressure Loss
PROSPER.OUT.PCC.Results[i].Vlslip[j] Slip Liquid Velocity
PROSPER.OUT.PCC.Results[i].Vgslip[j] Slip Gas Velocity
PROSPER.OUT.PCC.Results[i].Vwslip[j] Slip Water Velocity
PROSPER.OUT.PCC.Results[i].Vlnslp[j] Superficial Liquid Velocity
PROSPER.OUT.PCC.Results[i].Vgnslp[j] Superficial Gas Velocity
PROSPER.OUT.PCC.Results[i].Vwnslp[j] Superficial Water Velocity
PROSPER.OUT.PCC.Results[i].VlTurn[j] Turner Velocity
PROSPER.OUT.PCC.Results[i].VlTotl[j] Total NoSlip Velocity
PROSPER.OUT.PCC.Results[i].VlEros[j] Erosional Velocity
PROSPER.OUT.PCC.Results[i].CFactr[j] C Factor
PROSPER.OUT.PCC.Results[i].SandDi[j] Maximum Garin Diameter
j = 0:n-1
PROSPER.OUT.GMT.Results[i].Label[j] Label
PROSPER.OUT.GMT.Results[i].MSD[j] Bottom Measured Depth
PROSPER.OUT.GMT.Results[i].TVD[j] True Vertical Depth
PROSPER.OUT.GMT.Results[i].Pres[j] Pressure
PROSPER.OUT.GMT.Results[i].Temp[j] Temperature
PROSPER.OUT.GMT.Results[i].Grad[j] Gradient
PROSPER.OUT.GMT.Results[i].Holdup[j] Holdup
PROSPER.OUT.GMT.Results[i].Regime[j] Regime
PROSPER.OUT.GMT.Results[i].HTC[j] Heat Transfer Coefficient
PROSPER.OUT.GMT.Results[i].HydFlag[j] Hydrates Formation Flag
PROSPER.OUT.GMT.Results[i].Grstat[j] Static Gradient
j = 0:n
PROSPER.OUT.GMT.RESULTS[i].GASGRA Depth
D.Depth[j]
PROSPER.OUT.GMT.RESULTS[i].GASGRA Pressure
D.Pres[j]
i = 0:n-1
PROSPER.ANL.GEN.GENGLR[i].COUNT Returns the number of generated
GLR values for selected manifold
pressure (m). For non-GasLift wells
i=0
j = 0:m-1
PROSPER.ANL.GEN.Rates.COUNT Returns the number of rate values
used for calculations (f)
k = 0:f-1
Calculation Results
PROSPER.OUT.GEN.Results[i][j].LiqRate[k] Liquid rate
PROSPER.OUT.GEN.Results[i][j].OilRate[k] Oil rate
PROSPER.OUT.GEN.Results[i][j].WatRate[k] Water rate
PROSPER.OUT.GEN.Results[i][j].GasRate[k] Gas rate
PROSPER.OUT.GEN.Results[i][j].VLPpres[k] VLP Pressure
PROSPER.OUT.GEN.Results[i][j].IPRPres[k] IPR Pressure
PROSPER.OUT.GEN.Results[i][j].DPTotal[k] Total dP skin
PROSPER.OUT.GEN.Results[i][j].DPPerf[k] Perforation dP skin
PROSPER.OUT.GEN.Results[i][j].DPDam[k] Damage dP skin
PROSPER.OUT.GEN.Results[i][j].DPComp[k] Completion dP skin
PROSPER.OUT.GEN.Results[i][j].SKTotal[k] Total skin
PROSPER.OUT.GEN.Results[i][j].SKComp[k] Completion skin
PROSPER.OUT.GEN.Results[i][j].DPGrav[k] Gravel pack dP skin
PROSPER.OUT.GEN.Results[i][j].SKGrav[k] Gravel pack skin
PROSPER.OUT.GEN.Results[i][j].vcGrav[k] Gravel Pack Casing Velocity
Solutions Results
PROSPER.OUT.GEN.Results[i][j].Sol.LiqRate Liquid Rate
PROSPER.OUT.GEN.Results[i][j].Sol.OilRate Oil Rate
Velocity
PROSPER.OUT.GEN.Results[i][j].Sol.FNVelGas First Node Superficial Gas Velocity
PROSPER.OUT.GEN.Results[i][j].Sol.FNZFactor First Node Z-factor
PROSPER.OUT.GEN.Results[i] First Node Interfacial Tension
[j].Sol.FNSurfaceTension
PROSPER.OUT.GEN.Results[i][j].Sol.FNPressure First Node Pressure
PROSPER.OUT.GEN.Results[i] First Node Temperature
[j].Sol.FNTemperature
i = 0:n-1
PROSPER.OUT.SPD.Results[i].COUNT Number of calculation results (m)
j = 0:m-1
PROSPER.OUT.SPD.Results[i].Label[j] Label
PROSPER.OUT.SPD.Results[i].MSD[j] Bottom Measured Depth
PROSPER.OUT.SPD.Results[i].TVD[j] True Vertical Depth
PROSPER.OUT.SPD.Results[i].Pres[j] Pressure
PROSPER.OUT.SPD.Results[i].Temp[j] Temperature
PROSPER.OUT.SPD.Results[i].Grad[j] Gradient
PROSPER.OUT.SPD.Results[i].Holdup[j] Holdup
PROSPER.OUT.SPD.Results[i].Regime[j] Regime
PROSPER.OUT.SPD.Results[i].HTC[j] Heat Transfer Coefficient
PROSPER.OUT.SPD.Results[i].HydFlag[j] Hydrates Formation Flag
PROSPER.OUT.SPD.Results[i].Grstat[j] Static Gradient
PROSPER.OUT.SPD.Results[i].Grfric[j] Friction Gradient
PROSPER.OUT.SPD.Results[i].PrFric[j] Friction Pressure Loss
PROSPER.OUT.SPD.Results[i].PrStat[j] Gravity Pressure Loss
PROSPER.OUT.SPD.Results[i].Vlslip[j] Slip Liquid Velocity
PROSPER.OUT.SPD.Results[i].Vgslip[j] Slip Gas Velocity
PROSPER.OUT.SPD.Results[i].Vwslip[j] Slip Water Velocity
PROSPER.OUT.SPD.Results[i].Vlnslp[j] Superficial Liquid Velocity
PROSPER.OUT.SPD.Results[i].Vgnslp[j] Superficial Gas Velocity
PROSPER.OUT.SPD.Results[i].Vwnslp[j] Superficial Water Velocity
PROSPER.OUT.SPD.Results[i].VlTurn[j] Turner Velocity
PROSPER.OUT.SPD.Results[i].VlTotl[j] Total NoSlip Velocity
PROSPER.OUT.SPD.Results[i].VlEros[j] Erosional Velocity
PROSPER.OUT.SPD.Results[i].CFactr[j] C Factor
PROSPER.OUT.SPD.Results[i].SandDi[j] Maximum Garin Diameter
PROSPER.OUT.SPD.Results[i].RhoOil[j] Oil Density
PROSPER.OUT.SPD.Results[i].RhoGas[j] Gas Density
PROSPER.OUT.SPD.Results[i].RhoWat[j] Water Density
PROSPER.OUT.SPD.Results[i].RhoLiq[j] Liquid Density
PROSPER.OUT.SPD.Results[i].RhoMix[j] Mixture Density
PROSPER.OUT.SPD.Results[i].FmuOil[j] Oil Viscosity
PROSPER.OUT.SPD.Results[i].FmuWat[j] Water Viscosity
PROSPER.OUT.SPD.Results[i].FmuGas[j] Gas Viscosity
PROSPER.OUT.SPD.Results[i].FmuLiq[j] Liquid Viscosity
PROSPER.OUT.SPD.Results[i].SigLiq[j] Gas-Liquid Interfacial Tension
PROSPER.OUT.SPD.Results[i].SigWat[j] Gas-Water Interfacial Tension
j = 0:m-1
PROSPER.OUT.SPD.RESULTS[i].GasGrad. Depth
Depth[j]
PROSPER.OUT.SPD.RESULTS[i].GasGrad. Pressure
Pres[j]
i = 0:7
PROSPER.OUT.GLN.MATCHL[i] Match Parameters for Liquid Rate
PROSPER.OUT.GLN.MATCHR[i] Match Parameters for Revenue
Objective Gradient
PROSPER.OUT.GLN.MSD Measured Depth of Injection
PROSPER.OUT.GLN.TVD True Vertical Depth of Injection
PROSPER.OUT.GLN.PRS Pressure
PROSPER.OUT.GLN.TMP Temperature
PROSPER.OUT.GLN.GAS Gas Injection Pressure
Results
PROSPER.OUT.GLN.LEGEND[0] Maximum Gas Available
PROSPER.OUT.GLN.LEGEND[1] Flowing Top Node Pressure
PROSPER.OUT.GLN.LEGEND[2] Operating Injection Pressure
PROSPER.OUT.GLN.LEGEND[3] Water Cut
PROSPER.OUT.GLN.LEGEND[4] ACTUAL Liquid Rate
PROSPER.OUT.GLN.LEGEND[5] ACTUAL Oil Rate
PROSPER.OUT.GLN.LEGEND[6] ACTUAL Gas Injection Rate
PROSPER.OUT.GLN.LEGEND[7] ACTUAL Injection Pressure
j = 0:n-1
PROSPER.OUT.GLN.RESULTS[0].REGIME[j] Flow Regime Number
PROSPER.OUT.GLN.RESULTS[0].LABEL[j] Label Number
PROSPER.OUT.GLN.RESULTS[0].PRES[j] Pressure
PROSPER.OUT.GLN.RESULTS[0].TEMP[j] Fluid Temperature
PROSPER.OUT.GLN.RESULTS[0].TVD[j] True Vertical Depth
PROSPER.OUT.GLN.RESULTS[0].MSD[j] Measured Depth
PROSPER.OUT.GLN.RESULTS[0].GRAD[j] Gradient
PROSPER.OUT.GLN.RESULTS[0].HOLDUP[j] Holdup
i = 0:n-1
PROSPER.OUT.GLN.RESULTS[0].GasGrad.Dept Depth
h[i]
PROSPER.OUT.GLN.RESULTS[0].GasGrad.Pres Pressure
[i]
i = 0:7
PROSPER.OUT.GLE.MATCHL[i] Match Parameters for Liquid Rate
PROSPER.OUT.GLE.MATCHR[i] Match Parameters for Revenue
Objective Gradient
Results
PROSPER.OUT.GLE.LEGEND[0] Maximum Gas Available
PROSPER.OUT.GLE.LEGEND[1] Flowing Top Node Pressure
PROSPER.OUT.GLE.LEGEND[2] Operating Injection Pressure
PROSPER.OUT.GLE.LEGEND[3] Water Cut
PROSPER.OUT.GLE.LEGEND[4] ACTUAL Liquid Rate
PROSPER.OUT.GLE.LEGEND[5] ACTUAL Oil Rate
PROSPER.OUT.GLE.LEGEND[6] ACTUAL Gas Injection Rate
PROSPER.OUT.GLE.LEGEND[7] ACTUAL Injection Pressure
j = 0:n-1
PROSPER.OUT.GLE.RESULTS[0].REGIME[j] Flow Regime Number
PROSPER.OUT.GLE.RESULTS[0].LABEL[j] Label Number
PROSPER.OUT.GLE.RESULTS[0].PRES[j] Pressure
PROSPER.OUT.GLE.RESULTS[0].TEMP[j] Fluid Temperature
PROSPER.OUT.GLE.RESULTS[0].TVD[j] True Vertical Depth
PROSPER.OUT.GLE.RESULTS[0].MSD[j] Measured Depth
PROSPER.OUT.GLE.RESULTS[0].GRAD[j] Gradient
PROSPER.OUT.GLE.RESULTS[0].HOLDUP[j] Holdup
PROSPER.OUT.GLE.RESULTS[0].HTC[j] Heat Transfer Coefficient
PROSPER.OUT.GLE.RESULTS[0].TFO[j] Formation Temperature
PROSPER.OUT.GLE.RESULTS[0].GRSTAT[j] Static Gradient
PROSPER.OUT.GLE.RESULTS[0].GRFRIC[j] Friction Gradient
PROSPER.OUT.GLE.RESULTS[0].VLSLIP[j] Slip Liquid Velocity
PROSPER.OUT.GLE.RESULTS[0].VLNSLP[j] NoSlip Liquid Velocity
PROSPER.OUT.GLE.RESULTS[0].VGSLIP[j] Slip Gas Velocity
PROSPER.OUT.GLE.RESULTS[0].VGNSLP[j] NoSlip Gas Velocity
PROSPER.OUT.GLE.RESULTS[0].AVRHSL[j] Mixture Density
PROSPER.OUT.GLE.RESULTS[0].PRSTAT[j] Pressure due to friction
PROSPER.OUT.GLE.RESULTS[0].PRFRIC[j] Pressure due to gravity
PROSPER.OUT.GLE.RESULTS[0].CASTEM[j] Casing temperature
PROSPER.OUT.GLE.RESULTS[0].ANNTEM[j] Average annulus temperature
PROSPER.OUT.GLE.RESULTS[0].RHOOIL[j] Gas density
PROSPER.OUT.GLE.RESULTS[0].RHOGAS[j] Oil density
PROSPER.OUT.GLE.RESULTS[0].RHOWAT[j] Water density
PROSPER.OUT.GLE.RESULTS[0].DIAINT[j] Diameter
PROSPER.OUT.GLE.RESULTS[0].ANGLE[j] Angle
PROSPER.OUT.GLE.RESULTS[0].DSTEP[j] Section length
PROSPER.OUT.GLE.RESULTS[0].FMULIQ[j] Liquid viscosity
PROSPER.OUT.GLE.RESULTS[0].FMUGAS[j] Gas viscosity
PROSPER.OUT.GLE.RESULTS[0].SIGLIQ[j] Gas-Liquid IFT
PROSPER.OUT.GLE.RESULTS[0].SIGWAT[j] Gas-Water IFT
PROSPER.OUT.GLE.RESULTS[0].SIGOIL[j] Gas-Oil IFT
PROSPER.OUT.GLE.RESULTS[0].SIGOW[j] Oil-Water IFT
PROSPER.OUT.GLE.RESULTS[0].SLUGLM[j] Mean Slug Length
PROSPER.OUT.GLE.RESULTS[0].SLUGLX[j] 1/000 Slug Length
i = 0:n-1
PROSPER.OUT.GLE.RESULTS[0].GasGrad.Dept Depth
h[i]
PROSPER.OUT.GLE.RESULTS[0].GasGrad.Pres Pressure
[i]
Input Data
PROSPER.SIN.GLI.Input[0] Surface Injection Pressure
PROSPER.SIN.GLI.Input[1] Injection Depth
PROSPER.SIN.GLI.Input[2] Gaslift Gas Gravity
PROSPER.SIN.GLI.Input[3] Wellhead Pressure
PROSPER.SIN.GLI.Input[4] Valve Port Size
PROSPER.SIN.GLI.Input[5] Water Cut
PROSPER.SIN.GLI.Input[6] Tubing Liquid Level
Results
i = 0:19
PROSPER.OUT.ESP.ESPPRS[i] Test curve pressures
j = 0:9
PROSPER.OUT.ESP.ESPGLR[i][j] i=0:19
j=0:9
i = 0:9
PROSPER.OUT.ESP.ESPDBX[i] Dunbar curve GLR
PROSPER.OUT.ESP.ESPDBY[i] Dunbar curve pressure
Input Data
PROSPER.OUT.HSP.Sol[0] Head Required
PROSPER.OUT.HSP.Sol[1] Average Downhole Rate
PROSPER.OUT.HSP.Sol[2] Total Fluid Gravity
PROSPER.OUT.HSP.Sol[3] Free GOR Below Pump
PROSPER.OUT.HSP.Sol[4] Total GOR Above Pump
PROSPER.OUT.HSP.Sol[5] Pump Inlet Temperature
PROSPER.OUT.HSP.Sol[6] Pump Intake Pressure
PROSPER.OUT.HSP.Sol[7] Pump Intake Rate
PROSPER.OUT.HSP.Sol[8] Pump Discharge Pressure
PROSPER.OUT.HSP.Sol[9] Pump Discharge Rate
PROSPER.OUT.HSP.Sol[10] Pump Mass Flow Rate
PROSPER.SIN.HSP.PumpSpeed Pump Speed
Results
PROSPER.OUT.HSP.Sol[11] Number Of Pump Stages
PROSPER.OUT.HSP.Sol[12] Pump Power Required
PROSPER.OUT.HSP.Sol[13] Pump Efficiency
PROSPER.OUT.HSP.Sol[14] Pump Outlet Temperature
PROSPER.OUT.HSP.Sol[15] Number Of Turbine Stages
PROSPER.OUT.HSP.Sol[16] Turbine Power Generated
PROSPER.OUT.HSP.Sol[17] Delta P Across Turbine
PROSPER.OUT.HSP.Sol[18] Head Loss Across Turbine
PROSPER.OUT.HSP.Sol[19] Pressure @ Surface
PROSPER.OUT.HSP.Sol[20] % Power Fluid Of Reservoir Fluid
PROSPER.OUT.HSP.Sol[21] Balance Supply Rate
6.10 Commands
File Management
PROSPER.SHUTDOWN Exit the PROSPER program
PROSPER.OPENFILE Open an existing file
Example:
DoCmd ("PROSPER.OPENFILE(""C:
\test.Out"")") - opens a macro code based
PROSPER file.
DoCmd ("PROSPER.OPENFILE=""" +
Range("a3") + """") - opens an Excel
spreadsheet based PROSPER file.
DoCmd ("PROSPER.OPENFILE(" +
Range("a3")) - alternative method to open an
Excel spreadsheet based PROSPER file.
PROSPER.SAVEFILE Save the current data set to file. The file path
should be provided in the same way as for
.OPENFILE command.
PROSPER.NEWFILE Reset the current data set to initial conditions. If
the file is not saved the changes will be lost.
PROSPER.REFRESH Redraw the font screen to update any changes
Units
PROSPER.MENU.UNITS.OILFIELD Select Oil Field units
PROSPER.MENU.UNITS.NORSI Select Norwegian SI units
PROSPER.MENU.UNITS.CANSI Select Canadian SI units
PROSPER.MENU.UNITS.GERSI Select German SI units
PROSPER.MENU.UNITS.FRESI Select French SI units
PROSPER.MENU.UNITS.LATSI Select Latin SI units
PROSPER.UNITS.RESET Resets the unit system to default (oil field units)
PVT Section
PROSPER.PVT.CALC Perform the calculation command in the PVT
section
PROSPER.PVT.MATCH Perform the PVT matching regression
PROSPER.PVT.MATCHALL Perform the PVT matching for ALL variables
and correlations
PROSPER.PVT.INPUT.WGRMIN Calculate minimum free WGR
PROSPER.EOS.INT EOS - interpolate
PROSPER.EOS.GEN EOS - generate
Example:
DoCmd
"PROSPER.EOS.PTS[0].ADDEQUIPMENT(""
Separator"", ""sep1"", 0.33,0.5)"
PROSPER.EOS.PTS(i).ADDCONNEC Adds a connection between two pieces of
TION(equip1, label1, output1, equip2, equipment for the i path to surface
label2, input2) Arguments
equip1 - Separator, Joint, Chiller, Source,
Export
label1 - label of equipment
output1 - Liquid, Vapour, Output
equip2 - Same as equip1
label2 - label of equipment
input2 - Liquid, Vapour, Input
Example:
DoCmd
"GAP.MOD[{PROD}].FLASHOPTIONS.PTS[0].
ADDCONNECTION(""Source"", ""Source"",
""Output"", ""Separator"", ""sep1"", ""Input"")"
PROSPER.EOS.PTS(i).REMOVEEQUI Removes equipment from the i path to surface
PMENT(equip, label) object.
Arguments
equip - Separator, Joint, Chiller
label - label of equipment
PROSPER.EOS.PTS(i).REMOVECON Removes a connection between two pieces of
NECTION(equip1, label1, output1, equipment in the i path to surface object. For
equip2, label2, input2) argument definitions see adding a connection
above.
PROSPER.EOS.PTS.UPDATEVALID Updates the validation flags used in the
ATION interface. To be used when you build a path to
surface object from the OpenServer
Inflow Section
PROSPER.IPR.CALC Perform the inflow calculation
PROSPER.IPR.API43 Perform the API RP43 calculation
PROSPER.ANL.INF.CALC Perfoms the inflow sensitivity calculation
PROSPER.ANL.INF.GENRATES Generate rates for the inflow sensitivity
calculation
System Calculations
PROSPER.ANL.SYS.CALC Performs the system calculation
PROSPER.ANL.SYS.GENRATES Generates rates for the system calculation
PROSPER.ANL.SYS.EXPORT Export lift curves generated by the system 3-
variable calculation
Gradient Calculations
PROSPER.ANL.GMT.CALC Performs the gradient matching calculation
PROSPER.ANL.GRD.CALC Performs the gradient sensitivity calculation
VLP Calculations
PROSPER.ANL.VLP.CALC Performs the VLP calculation
PROSPER.ANL.VLP.GENRATES Generate rates for the VLP calculation
PROSPER.ANL.VLP.EXPORT Export lift curves generated by the VLP
calculation
Choke Performance
PROSPER.ANL.CHK.CALC Performs the choke performance
Pipeline Matching
LES
PROSPER.MENU.HELP_OS_HELP OpenServer help
PROSPER.MENU.HELP_ABOUT About PROSPER
PROSPER.MENU.HELP_WEB_HOME Web home page
PROSPER.MENU.HELP_WEB_USER Web user area
Calculation Plots
PROSPER.PLOT.1 IPR
PROSPER.PLOT.2 VLP matching IPR
PROSPER.PLOT.3 Inflow
PROSPER.PLOT.4 System
PROSPER.PLOT.5 System (selected curves)
PROSPER.PLOT.6 Gas lift design
PROSPER.PLOT.7 Gas lift design (selected curves)
PROSPER.PLOT.8 ESP pump plot
PROSPER.PLOT.9 ESP solution pump plot
PROSPER.PLOT.10 ESP design pump plot
PROSPER.PLOT.11 Sensitivity
PROSPER.PLOT.12 Sensitivity PvD
PROSPER.PLOT.13 Sensitivity PvD (selected curves)
PROSPER.PLOT.14 Deviation survey
PROSPER.PLOT.15 Constrained VLP
PROSPER.PLOT.16 Unconstrained system
PROSPER.PLOT.17 Unconstrained VLP
PROSPER.PLOT.18 Generate for GAP
PROSPER.PLOT.19 Gas lift design performance curve
PROSPER.PLOT.20 PVT calculations
PROSPER.PLOT.21 Tubing correlation comparison
PROSPER.PLOT.22 Gradient matching
PROSPER.PLOT.23 Gradient
PROSPER.PLOT.24 Gradient (selected curves)
PROSPER.PLOT.25 VLP
PROSPER.PLOT.27 ESP motor
PROSPER.PLOT.28 EOS phase envelope
PROSPER.PLOT.29 EOS (generated data)
PROSPER.PLOT.30 EOS (calculated data)
PROSPER.PLOT.31 GAP performance curve
PROSPER.PLOT.32 Quick-look
PROSPER.PLOT.33 VLP mataching
PROSPER.PLOT.34 IPR relative permeability
PROSPER.PLOT.35 Downhole equipment drawing
PROSPER.PLOT.36 Surface equipment drawing
PROSPER.PLOT.37 Pipe elevation
PROSPER.PLOT.38 Horizontal IPR
PROSPER.PLOT.39 ESP gas separation sensitivity (Dunbar plot)
PROSPER.PLOT.40 GLA mandrel performance
PROSPER.PLOT.41 GLA static gradient
PROSPER.PLOT.42 GLA flowing gradient
PROSPER.PLOT.43 Emulsion
PROSPER.PLOT.44 ESP quick-look
PROSPER.PLOT.45 Pipeline correlation comparison
PROSPER.PLOT.46 WHP to BHP
PROSPER.PLOT.47 Flow map
PROSPER.PLOT.48 HSP pump plot
PROSPER.PLOT.49 HSP design pump plot
PROSPER.PLOT.50 HSP system solution pump plot
PROSPER.PLOT.51 HSP turbine plot
PROSPER.PLOT.52 HSP design turbine plot
PROSPER.PLOT.53 Curve fit plot
PROSPER.PLOT.54 HSP quick-look
PROSPER.PLOT.55 Downhole temperature gradient (downhole
equipment section)
PROSPER.PLOT.56 PVT table
PROSPER.PLOT.57 PVT match data
PROSPER.PLOT.58 IPR multi-lateral
PROSPER.PLOT.59 IPR multi-lateral details
PROSPER.PLOT.60 Sea temperature gradient
PROSPER.PLOT.61 Customised completion fluid
PROSPER.PLOT.62 Hydrates data
PROSPER.PLOT.63 Water vapour
PROSPER.PLOT.64 Rheological parameters
PROSPER.PLOT.65 PCP pump
PROSPER.PLOT.66 HSP power fluid data
PROSPER.PLOT.67 Isochronal inflow performance curve
6.11 Functions
The following are functions that can be retrieved using the DOGET statement.
Example:
DoGet "PROSPER.GETTVD(1500)"
i = 0:n-1
PROSPER.ANL.NODES.TYPE[i] Returns The Equipment Type Of The ith Node
PROSPER.ANL.NODES.MSD[i] Returns The Measured Depth Of The ith Node
PROSPER.ANL.NODES.TVD[i] Returns The True Vertical Depth Of The ith Node
Cells(1, 2) = DoGet("PROSPER.INTERACT(0)")
This will set the PROSPER instance to be in NON-
i = 0:n-1
PROSPER.ESP.DESIGNMOTOR Returns number and list of suitable motors after
S ESP Design Calculation has been done (m).
j = 0:m-1
PROSPER.ESP.DESIGNCABLES Returns number and list of suitable cables after
ESP Design Calculation has been done (f).
k = 0:f-1
PROSPER.ESP.SELECTPUMP(i) Selects desired pump after ESP Design
Calculation has been done and calculates design
parameters.
Example:
ret = PROSPER.ESP.SELECTPUMP(i)
PROSPER.ESP.SELECTMOTOR( Selects desired motor after ESP Design
j) Calculation has been done and calculates design
The folder contains the PROSPER file (HORWELDP.OUT) and the OpenServer
Macro.xls file.
The objective of the macro is to perform sensitivities on the well length and completion
zone length and automatically retrieve and plot the results from a system 3-variable
VLP / IPR calculation.
The example illustrates the use of DoSet, DoGet and DoCmd functions.
OpenServer Example 1:
The following code structure will be observed when reviewing the macro code
(Macro.xls file) via the Visual Basic editor:
DoSet ("PROSPER.SIN.IPR.Single.WellLen"),
Cells(Row, 4) 'Sets the Excel data as
the well length in PROSPER
DoSet
("PROSPER.SIN.IPR.Single.HorizdP[0].ZONLEN"),
Cells(Row, 4) 'Sets the Excel data as the
zone length in PROSPER
DoCmd ("PROSPER.ANL.SYS.CALC") 'Performs the
system 3-variable calculation
Cells(Row, 5) = DoGet("PROSPER.OUT.SYS.Results[0]
[0][0].Sol.LiqRate") 'Extracts the system
calculation liquid rate result and passes the
value to the defined cell reference in Excel
i.e., Row, Column.
Scrolling further down the OpenServer template sample code (and in the OpenServer
sample macro template), it can be observed that error handling code has already been
entered.
The error handling code structure that follows, illustrates the necessary error handling
code that needs to be included in macros, ensuring that correct communication between
Excel and the tools is established.
The following error handling code structures are to be used when developing
OpenServer macros when not using the provided template that already includes the
error handling macro code:
Dim Pos
Pos = InStr(Strval, ".")
If Pos < 2 Then
MsgBox "Badly formed tag string"
End
End If
GetAppName = Left(Strval, Pos - 1)
If StrComp(GetAppName, "PROSPER", 1) <> 0 Then
MsgBox "Unrecognised application name in tag
string"
End
End If
End Function
DoGet = Server.GetValue(Gv)
AppName = GetAppName(Gv)
lErr = Server.GetLastError(AppName)
If lErr > 0 Then
MsgBox Server.GetErrorDescription(lErr)
Set Server = Nothing
End
End If
End Function
for errors
Dim lErr As Long
Dim AppName As String
OpenServer Example 2:
The objective of the following code samples show how to establish connection between
Excel and the tools using a different structure and use the DoSet, DoGet and DoCmd
functions.
Other code samples will also illustrate how to open a PROSPER file and set up macro
code structures to manage data arrays.
The following code skeleton should wrap around all code fragments. This simply
initialises a data-server object and provides a sub-routine that can be called as a macro
from an action push-button for instance.
Option Explicit
Dim Server As Object
Sub DoStuff()
Set Server = CreateObject("PX32.OpenServer.1")
'This complete string can be replaced with Connect
if desired (as above), and establishes the link
between Excel and the tools
End Sub
Given the above functions, the first code fragment in the following example shows how to
open a file by name either from being hard-coded in the macro or obtained from an
Excel cell reference.
The above macro code can be modified to perform the following calls if desired:
The code below obtains a single variable. This variable can also be from a table as
shown in the third and fourth lines – the first layer pressure from the multi-layer IPR
model.
We can achieve the objective by setting up a loop that will sequentially interrogate each
layer and retrieve the layer pressure and GOR.
Dim i, k As Integer
i = 0
k = 0
For k = 0 To 2
For i = 0 To 1
Cells(10, 1 + k) =
DoGet("PROSPER.SIN.IPR.Single.MLayer[" + CStr(k)
+ "].PRESSURE")
'The above string cell reference tells Excel that
the layer pressure data for the 3-layer IPR model
will be placed in row 10 and column 1, 2 and 3
respectively (cell references are row, column).
Excel will increase the column by '1' since the
column counter k = 1.
Cells(11, 1 + k) =
DoGet("PROSPER.SIN.IPR.Single.MLayer[" + CStr(k)
+ "].GOR")
'The syntax to retrieve (or set) the GOR is the
same as above.
Next i 'Closes the 'i' loop
Next k 'Closes the 'k' loop
End Sub
The above code illustrates one of many possible methods to retrieve (or set) multiple
data sets.
The code below tabulates the variables from a multi-layer model using a slightly different
approach:
Dim i As Integer
Dim j As Integer
Dim StringRoot As String 'The below StringRoot call
defines the following section of a given OpenServer
string, and enables having to paste repeated OpenServer
strings to set or retrieve common string variables. For
example, the StringRoot of:
PROSPER.SIN.IPR.SINGLE.MLAYER.PRESSURE is:
Note that the multi-rate models within the multi-layer constitute a table within a table:
i = 0
Do While i < 5
StringRoot = "PROSPER.SIN.IPR.SINGLE.MLAYER[" &
Format(i) & "]"
Cells(16, 2 + 3 * i) = StringRoot
j = 0
Do While j < 10
StringOut = StringRoot & ".MRATE[" & Format(j) &
"].PRESSURE"
Cells(16 + j, 3 + (3 * i)) = DoGet(StringOut)
StringOut = StringRoot & ".MRATE[" & Format(j) &
"].RATE"
Cells(16 + j, 4 + (3 * i)) = DoGet(StringOut)
j = j + 1
Loop
i = i + 1
Loop
Now a variable length data structure is dealt with in the multi-lateral network. Some of
the ‘state’ variables for each item are printed out.
Cells(8, 2) = "PROSPER.SIN.IPR.MULTILAT.NETWORK.COUNT"
StringRoot =
DoGet("PROSPER.SIN.IPR.MULTILAT.NETWORK.COUNT")
Cells(8, 3) = StringRoot
Dim Count As Integer
Count = Val(StringRoot)
StringRoot = "PROSPER.SIN.IPR.MULTILAT.NETWORK["
i = 0
Do While i < Count
String1 = StringRoot & Format(i) & "]"
String3 = String1 & ".LABEL"
Cells(i * 10 + 11, 2) = String3
Cells(i * 10 + 11, 3) = DoGet(String3)
String3 = String1 & ".Type"
Cells(i * 10 + 12, 2) = String3
Cells(i * 10 + 12, 3) = DoGet(String3)
String3 = String1 & ".Node"
Cells(i * 10 + 13, 2) = String3
Cells(i * 10 + 13, 3) = DoGet(String3)
String3 = String1 & ".Mask"
Cells(i * 10 + 14, 2) = String3
Cells(i * 10 + 14, 3) = DoGet(String3)
String3 = String1 & ".HasData"
Cells(i * 10 + 16, 2) = String3
Cells(i * 10 + 16, 3) = DoGet(String3)
String3 = String1 & ".ID"
Cells(i * 10 + 17, 2) = String3
Cells(i * 10 + 17, 3) = DoGet(String3)
String3 = String1 & ".Valid"
Cells(i * 10 + 18, 2) = String3
Cells(i * 10 + 18, 3) = DoGet(String3)
i = i + 1
Loop
Now, get all tie-point or junction data. Note the use of a line-count variable for
formatting.
i = 0
Do While i < Count
String1 = StringRoot & Format(i) & "]"
String3 = String1 & ".Type"
iType = Val(DoGet(String3))
If (iType = 0) Or (iType = 1) Then
iLineCount = iLineCount + 1
Cells(iLineCount, 2) = "Junction/Tiepoint"
iLineCount = iLineCount + 1
String3 = String1 & ".MD"
Cells(iLineCount, 2) = String3
Cells(iLineCount, 3) = DoGet(String3)
iLineCount = iLineCount + 1
String3 = String1 & ".TVD"
Cells(iLineCount, 2) = String3
Cells(iLineCount, 3) = DoGet(String3)
iLineCount = iLineCount + 2
End If
Continuing the loop, get all tubing model and deviation survey items, whether in a tubing
network item or a completion node.
Cells(iLineCount, 2) = String3
Cells(iLineCount, 3) = DoGet(String3)
iLineCount = iLineCount + 1
String3 = String1 & ".Threshold"
Cells(iLineCount, 2) = String3
Cells(iLineCount, 3) = DoGet(String3)
iLineCount = iLineCount + 1
String3 = String1 & ".FlowType"
Cells(iLineCount, 2) = String3
Cells(iLineCount, 3) = DoGet(String3)
iLineCount = iLineCount + 1
String3 = String1 & ".Angle"
Cells(iLineCount, 2) = String3
Cells(iLineCount, 3) = DoGet(String3)
iLineCount = iLineCount + 1
String3 = String1 & ".WBR"
Cells(iLineCount, 2) = String3
Cells(iLineCount, 3) = DoGet(String3)
iLineCount = iLineCount + 1
String3 = String1 & ".Dietz"
Cells(iLineCount, 2) = String3
Cells(iLineCount, 3) = DoGet(String3)
iLineCount = iLineCount + 2
End If
j = 0
Do While j < iDevCount
String2 = String1 & ".Dev[" & Format(j) & "]"
Cells(iLineCount, 2) = String2
String3 = String2 & ".MD"
Cells(iLineCount, 3) = DoGet(String3)
String3 = String2 & ".TVD"
Cells(iLineCount, 4) = DoGet(String3)
String3 = String2 & ".Azimuth"
Cells(iLineCount, 5) = DoGet(String3)
String3 = String2 & ".Disp"
Cells(iLineCount, 6) = DoGet(String3)
String3 = String2 & ".Angle"
Cells(iLineCount, 7) = DoGet(String3)
iLineCount = iLineCount + 1
j = j + 1
Loop
iLineCount = iLineCount + 3
i = i + 1
Loop
Finally, a method of obtaining the unique identifier (ID) of a node called ‘Comp1’ is
illustrated. The node label is placed within braces ‘{}’ to differentiate it generically from
an index.
StringRoot = "{Comp1}"
StringOut = " .SIN.IPR.MULTILAT.NETWORK[" & StringRoot
& "].ID"
Cells(10, 2) = StringOut
Cells(10, 3) = DoGet(StringOut)
7
415 OpenServer
A comprehensive series of Excel spreadsheets are distributed with PVTP. All major
labels, methods and calculations are illustrated within these files.
PVT.BLACKOIL
PVT.OPTIONS
PVT.STREAMBASE[stream no. or stream name]
PVT.STREAMRUN[stream no. or stream name]
PVT.LABDATA[stream no. or stream name]
PVT.CALCUL[stream no. or stream name]
NOTE:
At present, no access is given to matching data within the Black Oil models.
For example, by placing the mouse cursor on top of the Critical Temperature for the first
component in the composition and selecting Ctrl + Right Click, the screen with the
Access String for this variable will appear. The String can then be copied on the
clipboard for use in the macro.
The file commands are demonstrated in the OPENPVT.XLS sample Excel file.
Each file can contain multiple streams. Each stream contains Base, Runtime and
Calculation data. Individual streams can be accessed by way of a zero-based index or
the stream name.
Example:
PVT.STREAMBASE[{WellStream}].COMPOSITION[1]
This accesses the composition of the second component within the stream called
WellStream. Details of stream contents are described in Sections 7.6 and 7.7.
The stream commands are demonstrated in the OPENPVT.XLS sample Excel file.
7.4 BLACKOIL
This section deals with access to the input data and calculations within the Blackoil
model of the PVTP program.
The setting of the file to a BlackOil model is done within the options section with the
DoSet command.
"PVT.OPTIONS.METHOD” with value BLACKOIL"
There is only one set of blackoil data per file so no stream indication is required. To
obtain a piece of blackoil data the command string would be:
"PVT.BLACKOIL.SEPPRESS".
7.5 OPTIONS
This section deals with access to common options within the active PVTP file. The
options deal with many aspects of how and where models are used, which calculations
are carried out etc.
The Options sheet within the OPENPVT.XLS sample Excel file, gives an indication of
how these data points can be accessed.
Example:
A typical DoSet command would be
OIL,GAS or CONDENSATE
SEPARATORTYPE Defines the number of separators within a blackoil
model i.e. SINGLE to TWO
EOSTYPE Defines the equation to be used for the EoS model
i.e. PENGROB or SRK
COMPANY Gives access to the Company string within the
Options Dialog
FIELD Gives access to the Field string within the Options
Dialog
LOCATION Gives access to the Location string within the
Options Dialog
PLATFROM Gives access to the Platform string within the
Options Dialog
ANALYST Gives access to the Analyst string within the
Options Dialog
COMMENT Gives access to the Comment string within the
Options Dialog
CALC_TYPE Sets the active calculation. The keyword is
replaced with appropriate command (see
Calculations Section 8.7 for more details)
CALC_TYPE Sets the flash type for mixtures with water or solids
to MULTIPHASE or TWOPHASE
VISCMETHOD Sets the viscosity model for EoS calculations
USE_VOLSHIFT Switches volume shift on and off during EoS
calculations
CALC_PSAT_IN_CMPGRAD Flag to calculate Saturation Pressure during
compositional gradient calculation
CALC_PSAT_IN_CCE Flag to calculate Saturation Pressure during CCE
calculation
CALC_THERMALCOND_IN_CC Flag to calculate Thermal Conductivity during CCE
E calculation
USE_ADV_PHASE_DETECTION Preferences|Calc Tolerances: Use advanced
phase detection flag
SHOW_CALCS Preferences|Calc Tolerances: Show calculated
values during calculation flag
OPTIMISE_REGRESSION Preferences|Calc Tolerances: Optimise
calculations during regression flag
OPTIMISE_CVD_REGRESSION Preferences|Calc Tolerances: Optimise CVD
calculation during regression flag
REGRESS_MAXSTEPS Preferences|Calc Tolerances: Maximum number of
iterations during regression
PHASE_CALC_MAXITER Preferences|Calc Tolerances: Maximum number of
hydrate calculations
SLIMTUBE_TEST_RECOVERY Slimtube calculation test value for recovery
SLIMTUBE_TEST_POREVOL Slimtube calculation test value for pore volume
PHASE_ENV_THETA_VALUES Phase Envelope Calculation: vapour fractions that
are to be calculated
CREATE_MAX_ITERATIONS Create Streams to target GOR and
PSAT:maximum number of iterations
CREATE_GOR_END_TEST Create Streams to target GOR:test of target value
being found
CREATE_PSAT_END_TEST Create Streams to target PSAT:test of target value
being found
CREATE_PSAT_PHASE Create Streams to target PSAT:phase to be
produced
7.6 STREAMBASE
This structure is the main depository for defining a stream. It contains component
definitions, properties, reference data etc. Unlike the STREAMRUN version below, this
data is saved with the file. The command COPYSTREAMRUN_TO_STREAMBASE
will put runtime data into the base structure for saving.
See the distributed Excel File OPENPVT.XLS for the main set of variables and calls
which manipulate streams etc.
Example:
A typical string to get a piece of stream data would be:
PVT.STREAMBASE[{WellStream}].CRITTEMP[8]
This accesses the critical temperature of the ninth component within the stream called
WellStream.
index)
MELTPT[x] Accesses melting point of component x (zero based
index)
HEATFUSION[x] Accesses heat of fusion of component x (zero based
index)
SOLPAR[x] Accesses solubility parameter of component x (zero
based index)
SOLPARSOLID[x] Accesses solid solubility parameter of component x
(zero based index)
AROMATIC_PERCENT[x] Accesses aromatic content of pseudo component x
(zero based index)
BINARY_INT_COMPS [x][y] Accesses binary interaction coefficient between
component x and y (zero based indices)
BINARY_INT_COMPS [x][y] Accesses binary interaction coefficient between
component x and y (zero based indices)
RECOM_RESULT_COMP [x] Recombination: resulting composition of component x
(zero based index)
RECOM_STOCKOIL_COMP [x] Recombination: stock tank oil composition of
component x (zero based index)
RECOM_STOCKGAS_COMP Recombination: stock tank gas composition of
[x] component x (zero based index)
RECOM_GAS_SEP_COMP Recombination: sep gas composition of component x
[sep][x] in separator sep(zero based indices)
RECOM_SEP_GOR [sep] Recombination: GOR in separator sep(zero based
index)
RECOM_SEP_TEMP[sep] Recombination: Temperature of separator sep(zero
based index)
RECOM_STOCKOIL_DENSITY Recombination: Stock tank oil density
RECOM_GAS_DENSITY Recombination: gas density
RECOM_GAS_GRAVITY Recombination: gas gravity
RECOM_STOCKTANK_GOR Recombination: Stock tank GOR
RECOM_STOCKTANK_TEMP Recombination: Stock tank temperature
PSEUD_ARCH_COMPONENT Pseudo Component Archive: name of pseudo x (zero
[x] based index)
PSEUD_ARCH_COMPOSITIO Pseudo Component Archive: composition of pseudo
N[x] x (zero based index)
PSEUD_ARCH_MWT[x] Pseudo Component Archive: mole weight of pseudo x
(zero based index)
PSEUD_ARCH_TCRIT[x] Pseudo Component Archive: critical temperature of
pseudo x (zero based index)
PSEUD_ARCH_PCRIT[x] Pseudo Component Archive: critical pressure of
pseudo x (zero based index)
7.7 STREAMRUN
This structure is the temporary description of a stream which is used in calculations. It is
similar to STREAMBASE and contains component definitions, properties, reference
data etc. Unlike the STREAMBASE version above, this data is not saved with the file.
The command COPYSTREAMBASE_TO_STREAMRUN will put base data into the
runtime structure prior to calculations.
See the distributed Excel File OPENPVT.XLS for more details and examples. Of
particular interest is the example of the Flash calculation within this file, as it
demonstrates how the runtime input data and the runtime calculation results can be
utilised.
Example:
A typical string to get a piece of runtime data would be:
PVT.STREAMRUN[{WellStream}].CRITPRESS[0]
This accesses the critical pressure of the first component within the stream called
WellStream.
7.8 CALCUL
This structure controls the calculations. It contains the values of calculation ranges,
intermediate values results and analysis.
The following list of examples is provided in the PVTP/Samples folder of IPM installation
directory:
Spreadsheet Name
OPENPVT.XLS FLASH calculation specifically packaged up
for use with OpenServer
OPEN_CRITPOINT_PHASE_ENV_CAL Mixture Critical Point and Phase Envelope
C.XLS
OPEN_CCE_PSAT_CALC.XLS Single point and ranged saturation pressure
plus constant composition expansion
OPEN_CVD_DEPL_CALC.XLS Constant volume depletion and depletion
study
OPEN_DIFF_COMPOS_CALC.XLS Differential liberation and composite
differential
OPEN_SEP_CALC.XLS Small and full separator calculations
OPEN_COMPGRAD_SWELL_CALC.X Compositional gradient and Swelling Test
LS
Example:
A typical DoGet string to return a segment of runtime data would be:
This accesses the fifth user-defined temperature input value for the CCE calculation
within the stream called WellStream.
EnthalpyPerMole[j]
EntropyPerMole[j]
Enthalpy[j]
Entropy[j]
Cp[j]
Cv[j]
JTCoeff[j]
SpeedOfSound[j]
MolecularWeight[j]
MolarVolume[j]
IFT
CostaldOilDensity
StandingKatzOilDensity
VapourToLiquidFraction
VolumeVapourToLiquidFraction
WaterInGasFraction
WaterInOilFraction
HCInWaterFraction
TotalEnthalpy
TotalCp
PTS.PROCESSDATA.SEPARATOR[i Extracts liquid composition properties of
].VAPOURCOMPOSITION. vapour separator i. The following composition
properties are accessible:
NumComponents
MoleFraction[j]
AverageMolecularWeight
ResidualAmount
ResidualWeight
StartCalcWeight
PTS.PROCESSDATA.SEPARATOR[i Extracts vapour flash results of separator i. The
].VAPOURFLASHRESULTS. following flash results are accessible:
VapourFraction
VolumeVapourFraction
LiquidDropout
Zfactor[j]
Density[j]
Viscosity[j]
EnthalpyPerMole[j]
EntropyPerMole[j]
Enthalpy[j]
Entropy[j]
Cp[j]
Cv[j]
JTCoeff[j]
SpeedOfSound[j]
MolecularWeight[j]
MolarVolume[j]
IFT
CostaldOilDensity
StandingKatzOilDensity
VapourToLiquidFraction
VolumeVapourToLiquidFraction
WaterInGasFraction
WaterInOilFraction
HCInWaterFraction
TotalEnthalpy
TotalCp
PTS.PROCESSDATA.CHILLER[i]. Same as separator variables above
PTS.PROCESSDATA.JOINT[i].CONN Counts number of connections from joint i
ECTSFROMCOUNT
PTS.PROCESSDATA.JOINT[i].CONN Extracts where connection j is from for joint i
ECTSFROM[j]
PTS.PROCESSDATA.JOINT[i].CONN Counts number of connections to joint i
ECTSTOCOUNT
PTS.PROCESSDATA.JOINT[i].CONN Extracts where connection j is to for joint i
ECTSTO[j]
PTS.PROCESSDATA.JOINT[i].LABE Label of joint i
L
PTS.PROCESSDATA.JOINT[i].EOSP Extracts EOS properties of joint i. The following
ROPERTIES. EOS properties are accessible:
NumComponents
Tcrit[j]
Pcrit[j]
Vcrit[j]
Acentric[j]
MW[j]
SpGrav[j]
Vs[j]
Tboil[j]
Parachor[j]
OmegaA[j]
OmegaB[j]
PTS.PROCESSDATA.JOINT[i].OUTP Extracts liquid composition properties of joint i.
UTCOMPOSITION. The following composition properties are
accessible:
NumComponents
MoleFraction[j]
AverageMolecularWeight
ResidualAmount
ResidualWeight
StartCalcWeight
K.HASGAS
PTS.PROCESSDATA.EXPORTBLOC Checks for connection and non-zero mole rate
K.HASLNG
PTS.PROCESSDATA.EXPORTBLOC Checks for connection and non-zero mole rate
K.HASLPG
PTS.PROCESSDATA.EXPORTBLOC Checks for connection and non-zero mole rate
K.HASCONDENSATE
PTS.PROCESSDATA.EXPORTBLOC Checks for connection and non-zero mole rate
K.HASOIL
PTS.PROCESSDATA.EXPORTBLOC Extracts liquid composition properties of
K.CONDENSATECOMPOSITION. condensate export block. The following
composition properties are accessible:
NumComponents
MoleFraction[j]
AverageMolecularWeight
ResidualAmount
ResidualWeight
StartCalcWeight
PTS.PROCESSDATA.EXPORTBLOC Extracts EOS properties of the condensate
K.CONDENSATEEOSPROPERTIES. export block. The following EOS properties are
accessible:
NumComponents
Tcrit[j]
Pcrit[j]
Vcrit[j]
Acentric[j]
MW[j]
SpGrav[j]
Vs[j]
Tboil[j]
Parachor[j]
OmegaA[j]
OmegaB[j]
PTS.PROCESSDATA.EXPORTBLOC Extracts condensate export block flash results.
K.CONDENSATERESULTS. The following flash results are accessible:
VapourFraction
VolumeVapourFraction
LiquidDropout
Zfactor[j]
Density[j]
Viscosity[j]
EnthalpyPerMole[j]
EntropyPerMole[j]
Enthalpy[j]
Entropy[j]
Cp[j]
Cv[j]
JTCoeff[j]
SpeedOfSound[j]
MolecularWeight[j]
MolarVolume[j]
IFT
CostaldOilDensity
StandingKatzOilDensity
VapourToLiquidFraction
VolumeVapourToLiquidFraction
WaterInGasFraction
WaterInOilFraction
HCInWaterFraction
TotalEnthalpy
TotalCp
PTS.PROCESSDATA.EXPORTBLOC Extracts composition properties of LNG export
K.LNGCOMPOSITION. block. See condensate composition above.
PTS.PROCESSDATA.EXPORTBLOC Extracts EOS properties of the LNG export
K.LNGEOSPROPERTIES. block. See condensate EOS properties above.
PTS.PROCESSDATA.EXPORTBLOC Extracts LNG export block flash results. See
K.LNGRESULTS. condensate results above.
PTS.PROCESSDATA.EXPORTBLOC Extracts composition properties of LPG export
K.LPGCOMPOSITION. block. See condensate composition above.
PTS.PROCESSDATA.EXPORTBLOC Extracts EOS properties of the LPG export
K.LPGEOSPROPERTIES. block. See condensate EOS properties above.
PTS.PROCESSDATA.EXPORTBLOC Extracts LPG export block flash results. See
K.LPGRESULTS. condensate results above.
PTS.PROCESSDATA.EXPORTBLOC Extracts composition properties of the gas
K.GASCOMPOSITION. export block. See condensate composition
above.
PTS.PROCESSDATA.EXPORTBLOC Extracts EOS properties of the gas export
K.GASEOSPROPERTIES. block. See condensate EOS properties above.
PTS.PROCESSDATA.EXPORTBLOC Extracts gas export block flash results. See
K.GASRESULTS. condensate results above.
PTS.PROCESSDATA.EXPORTBLOC Extracts composition properties of the oil
K.OILCOMPOSITION. export block. See condensate composition
above.
PTS.PROCESSDATA.EXPORTBLOC Extracts EOS properties of the oil export block.
K.OILEOSPROPERTIES. See condensate EOS properties above.
PTS.PROCESSDATA.EXPORTBLOC Extracts oil export block flash results. See
K.OILRESULTS. condensate results above.
PTS.PROCESSDATA.EXPORTBLOC Export pressure of the condensate export
K.CONDENSATEEXPORTPRESSUR block.
E
PTS.PROCESSDATA.EXPORTBLOC Export temperature of the condensate export
K.CONDENSATEEXPORTTEMPERA block.
TURE
PTS.PROCESSDATA.EXPORTBLOC Export pressure of the LNG export block.
K.LNGEXPORTPRESSURE
PTS.PROCESSDATA.EXPORTBLOC Export temperature of the LNG export block.
K.LNGEXPORTTEMPERATURE
PTS.PROCESSDATA.EXPORTBLOC Export pressure of the LPG export block.
K.LPGEXPORTPRESSURE
PTS.PROCESSDATA.EXPORTBLOC Export temperature of the LPG export block.
K.LPGEXPORTTEMPERATURE
PTS.PROCESSDATA.EXPORTBLOC Molecular weight upper limit of LNG export
K.LNGMOLECULARWEIGHTUP
PTS.PROCESSDATA.EXPORTBLOC Molecular weight upper limit of LPG export
K.LPGMOLECULARWEIGHTUP
PTS.PROCESSDATA.EXPORTBLOC Standard pressure for export
K.STANDARDPRESSURE
PTS.PROCESSDATA.EXPORTBLOC Standard temperature for export
K.STANDARDTEMPERATURE
PTS.PROCESSDATA.FIXEDPOINT.C Counts number of connections from fixed point
ONNECTSFROMCOUNT
PTS.PROCESSDATA.FIXEDPOINT.C Extracts where connection j is from
ONNECTSFROM[j]
PTS.PROCESSDATA.FIXEDPOINT.C Counts number of connections to fixed point
ONNECTSTOCOUNT
PTS.PROCESSDATA.FIXEDPOINT.C Extracts where connection j is to
ONNECTSTO[j]
PTS.PROCESSDATA.FIXEDPOINT.L Extracts label of fixed point
ABEL
PTS.PROCESSDATA.FIXEDPOINT.F 0 - Gas
IXEDPOINTDATA.FIXEDQUANTITYTY 1 - Liquid
PE 2 - Mass
PTS.PROCESSDATA.FIXEDPOINT.F Extracts actual rate value
IXEDPOINTDATA.FIXEDQUANTITY
PTS.PROCESSDATA.FIXEDPOINT.F 0 - Use upstream
IXEDPOINTDATA.MEASUREMENTC 1 - Use export
ONDITIONSMETHOD 2 - Use user values
PTS.PROCESSDATA.FIXEDPOINT.F 0 - Not set
IXEDPOINTDATA.OUTLETPHASE 1 - Liquid
2 - Vapour
PTS.PROCESSDATA.FIXEDPOINT.F Pressure of fixed point
IXEDPOINTDATA.PRESSURE
GASRESIDUALVOLUME
LIQUIDRESIDUALVOLUME
SPECIFICVOLUME
VISCOSITY
WEIGHT
ZFACTOR
PTS.SURFACERESULTS.LNGRESU Extracts the LNG surface results. See export
LTS.SURFACERESULTS. results above for all parameters which are
accessible.
PTS.SURFACERESULTS.LNGRESU Extracts composition properties of LNG
LTS.COMPOSITION. surface results. See condensate composition
above.
PTS.SURFACERESULTS.LPGRESU Extracts the LPG export results.See export
LTS.EXPORTRESULTS. results above for all parameters which are
accessible.
PTS.SURFACERESULTS.LPGRESU Extracts the LPG surface results. See export
LTS.SURFACERESULTS. results above for all parameters which are
accessible.
PTS.SURFACERESULTS.LPGRESU Extracts composition properties of LPG
LTS.COMPOSITION. surface results. See condensate composition
above.
PTS.SURFACERESULTS.CONDENS Extracts the condensate export results.See
ATERESULTS.EXPORTRESULTS. export results above for all parameters which
are accessible.
PTS.SURFACERESULTS.CONDENS Extracts the condensate surface results. See
ATERESULTS.SURFACERESULTS. export results above for all parameters which
are accessible.
PTS.SURFACERESULTS.CONDENS Extracts composition properties of condensate
ATERESULTS.COMPOSITION. surface results. See condensate composition
above.
PTS.INPUTCOMPOSITION. Extracts input composition. See condensate
composition above.
PTS.INPUTEOSPROPERTIES. Extracts input EOS properties. See
condensate EOS properties above.
PVT.CALCUL[i].PTS[j] Access to all the PTS results of a given
[k].SURFACERESULTS etc… calculation (as per the strings above)
i: stream name or index
j: row index
k: 0 for feed PTS, 1 for liquid, 2 for vapour.
The value of 0 for the feed is only valid in
the CCE. Value returned is -1 if there is no
vapour or liquid present
CALC_PSAT_MIN_TEMP PSAT Calculation auto minimum temperature
CALC_PSAT_MAX_TEMP PSAT Calculation auto maximum temperature
R_PRESSURES pressures
CALC_SMALL_SEP_OILDENSITY[n] Small Separator Calc: oil density result array
CALC_SMALL_SEP_OILAPI[n] Small Separator Calc: oil API result array
CALC_SMALL_SEP_GOR[n] Small Separator Calc: GOR result array
CALC_SMALL_SEP_GASGRAVITY[n Small Separator Calc: gas gravity result array
]
SLIMTUBE_NUMCELLS Slimtube calculation: Number of cells
SLIMTUBE_CELL_DELTAX[n] Slimtube calculation: Delta X value for cell n
SLIMTUBE_CELL_DELTAY[n] Slimtube calculation: Delta Y value for cell n
SLIMTUBE_CELL_DELTAZ[n] Slimtube calculation: Delta Z value for cell n
SLIMTUBE_CELL_DEPTH[n] Slimtube calculation: Depth value for cell n
SLIMTUBE_CELL_PRESSURE[n] Slimtube calculation: Pressure value for cell n
SLIMTUBE_CELL_PERM[n] Slimtube calculation: Permeability value for cell
n
SLIMTUBE_CELL_POROSITY[n] Slimtube calculation: Porosity value for cell n
SLIMTUBE_PRESSGRADIENT Slimtube calculation: Pressure gradient
SLIMTUBE_RESOILSATN Slimtube calculation: Residual Oil saturation
SLIMTUBE_GASSATN Slimtube calculation: Gas saturation
SLIMTUBE_ROCKCOMP Slimtube calculation: Rock Compressibility
SLIMTUBE_TEMPERATURE Slimtube calculation: Temperature
SLIMTUBE_PERM_NUMINTABLE Slimtube calculation: Number of perms in table
SLIMTUBE_PERM_NUMINTABLE Slimtube calculation: Number of perms in table
SLIMTUBE_CELL_TABLE_SOIL[n] Slimtube calculation: Table SOIL value n
SLIMTUBE_CELL_TABLE_KRO[n] Slimtube calculation: Table KRO value n
SLIMTUBE_CELL_TABLE_KRG[n] Slimtube calculation: Table KRG value n
SLIMTUBE_CELL_TABLE_PCGO[n] Slimtube calculation: Table PCGO value n
SLIMTUBE_PRODRATE Slimtube calculation: Production rate
SLIMTUBE_STARTPRESSURE Slimtube calculation: Start Pressure
SLIMTUBE_INJRATE Slimtube calculation: Injection rate
SLIMTUBE_INJRATEPPI Slimtube calculation: Injection rate PPI
SLIMTUBE_INJPPI Slimtube calculation: Injection PPI
SLIMTUBE_TIMESTEP[n] Slimtube calculation: Time step number n
SLIMTUBE_NUM_TIMESTEPS Slimtube calculation: Number of time steps
SLIMTUBE_CELLDATA_VALUES Slimtube calculation: Number of cell data
values
SLIMTUBE_PRODCELL Slimtube calculation: Producing Cell
SLIMTUBE_INJCELL Slimtube calculation: Producing Cell
SLIMTUBE_PRESSURES[n] Slimtube calculation: user-defined tube
pressures
Additional Calculations:
FLASH – Section 8.9
Small Separator Calculation – Section 8.10
Saturation Pressure at Reference Conditions – Section 8.11
Recombination Calculations – Section 8.12
Allocation: Blending to a target GOR – Section 8.13
Important Calls:
RESET_STREAM_IN_CALC_FLAGS resets stream calculation flags prior to
calculation
DoCmd Do calculation identified by keyword on stream
"PVT.KEYWORD[{Wellstream}]" index or name
CALC_COLUMN_TOTAL Find number of columns calculated
CALC_NUM_RESULTS Find lines of results calculated
CALC_COLUMN_NAME[n] Get name of column n (zero based index)
CALC_COLUMN_UNIT[n] Get unit string of column n (zero based index)
CALC_COLUMN_VALUE[l][n] Get value calculated for line l and column n
(zero based indices)
Example:
The code fragment below is taken from the OPEN_CCE_PSAT_CALC.XLS file and
shows the basics of setting up and initiating a calculation.
The first section reflects the CCE input dialog, sending the mode the calculation is to
operate with and the temperatures and pressures to be used. All that is required then is
to clear any existing calculation flags and to initiate the command using the keyword
from the list above
Note that the calculation has been set up to do one stream at a time. To do multiple
streams, call the command again with a different stream and index name.
Once the calculation is complete, any of the columns calculated can be accessed as
shown in the code fragment below:
Next
Next
The calculation results form a table which is normally displayed in PVTP results dialog.
The first step is to find the number of lines calculated using CALC_NUM_RESULTS.
The number of columns available for this calculation can then be retrieved using
CALC_COLUMN_TOTAL. Individual column names and units are found by calls to
CALC_COLUMN_NAME and CALC_COLUMN_UNIT with a zero-based index for
the column number. Repeated calls to CALC_COLUMN_VALUE is then used to fill in
the table.
7.9.1 Analysis
Analysis is available with most of the calculations. This data can be retrieved using code
segments illustrated below:
The individual analysis blocks are accessed via the label CALC_ANALYSIS[n] where n
is a zero-based index. Data is divided into identification, e.g. STAGE_TEMP or
STAGE_DEPTH component data such as vapour composition K values etc. or extra
data such as Oil_GRAVITY , TOTAL_GOR etc.
Example:
The core of the flash commands is given in the code segment below, which is taken
from the Excel spreadsheet OPENPVT.XLS.
All the work of flash is done within the STREAMRUN structure and as such is done with
a temporary, intermediate type of data. The sequence followed is as follows.
Read the other calculated data eg. Vapour fraction, z factors phase densities etc.
from STREAMRUN .
A Visual Basic file (FlashDemo.*) which gives illustrates doing a flash is also distributed
with PVTP.
For iCalc = 0 To 9
DoSetStr iLine, 1, "PVT.CALCUL[" + CStr(iStream) +
"].CALC_SEP_TEMPERATURES[" + CStr(iCalc) + "]", False
DoSetStr iLine, 2, "PVT.CALCUL[" + CStr(iStream) +
"].CALC_SEP_PRESSURES[" + CStr(iCalc) + "]", False
iLine = iLine + 1
Next
iLine = iLine + 1
DoCmd "PVT.SMALL_SEP[" + CStr(iStream) + "]"
iLine = 26
'Worksheets(Sheet).Range("A27:z39").ClearContents
iErr = DisplayCellData("Number of Stages", DoGetCheck("PVT.CALCUL[" +
CStr(iStream) + "].CALC_SEPTEMPVALUES"))
iNumRes = DoGetCheck("PVT.CALCUL[" + CStr(iStream) +
"].CALC_SEPTEMPVALUES")
iLine = iLine + 1
Worksheets(Sheet).Cells(iLine, 1) = "Temperature"
Worksheets(Sheet).Cells(iLine, 2) = "Pressure"
Worksheets(Sheet).Cells(iLine, 3) = "Oil Density"
Worksheets(Sheet).Cells(iLine, 4) = "Oil API"
Worksheets(Sheet).Cells(iLine, 5) = "GOR"
Worksheets(Sheet).Cells(iLine, 6) = "Gas Gravity"
iLine = iLine + 1
For iRes = 0 To iNumRes - 1
Worksheets(Sheet).Cells(iLine + iRes, 1) = DoGet("PVT.CALCUL[" +
CStr(iStream) + "].CALC_SEP_TEMPERATURES[" + CStr(iRes) + "]")
Worksheets(Sheet).Cells(iLine + iRes, 2) = DoGet("PVT.CALCUL[" +
CStr(iStream) + "].CALC_SEP_PRESSURES[" + CStr(iRes) + "]")
Worksheets(Sheet).Cells(iLine + iRes, 3) = DoGet("PVT.CALCUL[" +
CStr(iStream) + "].CALC_SMALL_SEP_OILDENSITY[" + CStr(iRes) + "]")
Worksheets(Sheet).Cells(iLine + iRes, 4) = DoGet("PVT.CALCUL[" +
CStr(iStream) + "].CALC_SMALL_SEP_OILAPI[" + CStr(iRes) + "]")
The use of this calculation is very straightforward. Place the temperature required in
RUNTEMP. Then call the calculation using the SINGLE_PSAT command. The resulting
saturation pressure will be placed in the RUNPRESS variable.
7.9.5 Recombination Calculation
The PVTP program contains 2 recombination calculations which are accessed via the
Data|Select Components dialog. The 2 modes available are:
Both modes can be run via the open server using the following commands.
It should be noted that the recombination data is held within the STREAMBASE
structure. If the composition is to be used, it must be transferred to the STREAMRUN
area. An example of how the recombine data is read and set is distributed in the
OPEN_RECOMBINATION.XLS sample file. The code segment below is taken from this
file:
Worksheets("Allocate").Cells(3, 4) = DoGet("PVT.STREAMBASE[" +
CStr(iStream) + "].STREAMNAME[0]")
Worksheets("Allocate").Cells(4, 4) = DoGet("PVT.STREAMBASE[" +
CStr(iStream2) + "].STREAMNAME[0]")
iLine = 10
SendCellData "PVT.CALCUL[" + CStr(iStream) + "].UTILS_TARGETGOR"
DoSet "PVT.CALCUL[" + CStr(iStream) + "].CALC_SECOND_STREAM",
iStream2
iLine = 12
SendCellData "PVT.OPTIONS.CREATE_MAX_ITERATIONS"
SendCellData "PVT.OPTIONS.CREATE_GOR_END_TEST"
DoCmd "PVT.CALCULATE_BLEND_GOR[" + CStr(iStream) + "]"
DoCmd "PVT.UPDATEDISPLAY"
iLine = 31
iErr = DisplayCellData("Mole Percent Blend Stream 1",
DoGet("PVT.STREAMRUN[" + CStr(iStream) +
"].MOLE_PERCENT1_BLEND_GOR"))
iErr = DisplayCellData("Mole Percent Blend Stream 2",
DoGet("PVT.STREAMRUN[" + CStr(iStream) +
"].MOLE_PERCENT2_BLEND_GOR"))
iErr = DisplayCellData("Weight Percent Blend Stream 1",
DoGet("PVT.STREAMRUN[" + CStr(iStream) +
"].WEIGHT_PERCENT1_BLEND_GOR"))
iErr = DisplayCellData("Weight Percent Blend Stream 2",
DoGet("PVT.STREAMRUN[" + CStr(iStream) +
"].WEIGHT_PERCENT2_BLEND_GOR"))
8
453 OpenServer
8.1 Overview
This section is designed to complement the Petroleum Experts IPM OpenServer
Manual, providing REVEAL specific implementation information.
The following sections describe OpenServer commands specific to REVEAL, and the
data structures that may be accessed. The data structures fall into three categories,
Script Data, Results Data and Runtime Variables.
All of the data exchanged via OpenServer will by default be in oilfield units. See the
main OpenServer documentation to see how data may be transferred in alternative unit
systems.
8.2 Commands
The REVEAL specific function commands are given below. The commands are used
under DoCmd statement
Example: "REVEAL.Restart(0)"
ONE_STEP() Take one tim-estep for the simulation
Example: "REVEAL.One_Step()"
STOP() Stop a simulation
Example: "REVEAL.Stop()"
PAUSE() Pause a simulation
Example: "REVEAL.Pause()"
SWITCH_GRID(grid_numbe Switch between refinement scripts in the input and is only
r) used to access data in the input script for refinements.
Each grid has an integer, with the first main grid being
zero and refined grids starting from one
Example: "REVEAL.Switch_Grid(1)"
OPEN_DATABLOCK Open a datablock for data read or write in the input script
(datablock_label) and is the label (name) associated with a datablock (red
font) in the input script
Example: "REVEAL.Open_Datablock(_xperm)"
SCRIPT_WRITE() Rewrite the script following changes to the input, required
for changes to the script to be registered for subsequent
simulation runs.
Example: "REVEAL.Script_Write()"
The refinement grid (if present) should be selected using the Switch_Grid command.
If the data to be read/written is within a datablock, then the datablock should be opened
using the Open_Datablock command.
The OpenServer data strings can be obtaoined using <CTRL> + mouse right click
within input wizard. This should always be used to identify the OpenServer string.
Once changes have been made to the input data, the "REVEAL.Script_Write()"
command should be run to register the changes.
Example:
The following syntax can be sued to set a transmissibility multiplier barrier for a
horizontal layer when the data is input as a range; the second range (index 1) is being
modified
SetValue ("REVEAL.Script.Reservoir.Data[11][1].Value",0.0)
DoCommand ("REVEAL.Script_Write()")
Example:
The following script is used to set the porosity in refinement grid 1 when the data is
entered as a datablock array for block (3,2,1) to 0.2 - note the indexing starts at zero
and cycles (Z,Y,X)
DoCommand ("REVEAL.Switch_Grid(1)")
DoCommand ("REVEAL.Open_Datablock(_porosity)")
SetValue ("REVEAL.Block._porosity.Tab[0].Data[0][1][2]",0.2)
DoCommand ("REVEAL.Script_Write()")
The OpenServer data strings can be obtaoined using <CTRL> + mouse right click
within output data results.
The well and average reservoir results data OpenServer strings have the following form:
REVEAL.WellRes[{stream_label}][{well_lablel}][timestep].Variable
REVEAL.AveRes[{stream_label}][{region_lablel}][timestep].Variable
n_timesteps = GetValue("REVEAL.WellRes[0][0].Count")
Example:
Total cummulative oil for current stream at the 10th recorded timestep
CO = GetValue("REVEAL.WellRes[{Well Results}][{Total}][9].CumOilProduced")
Example:
Bottom hole temperature for first saved stream, second well, at the 6th recorded
timestep
BHT = GetValue("REVEAL.WellRes[1][2][5].REVEAL.BottomHoleTemperature")
Example:
Initial total pore volume for current stream
PV = GetValue("REVEAL.AveRes[{Average Results}][{Total}][0].PoreVolume")
All of the internal REVEAL data are available during a simulation. This data is not
available once a simulation has been stopped. Since this data is extremely large and
most of it of no interest only some variable will be specified. Great care should be taken
setting internal calculation variables to the point where it is not recommended for most
variables, with the exception of well control variables.
The data in REVEAL is organised into two main groups called Master and Run. The
Master data contains everything that is not grid specific, while the Run data contains all
of the grid specific data for the main grid and all refinement grids. For example the well
control data is contained in the Master data structures, while grid pressures are
contained in the Run data structures. The Run variables are indexed by their grid
number, with zero corresponding to the main grid and subsequent integers
corresponding to refined grids.
All of the runtime variables are indexed from 0. However, if the returned value is an
index, then the returned value is indexed from 1 (see ACTIND and KWM).
The following is a list of some of the useful Master variables that may be accessed. The
variables listed are those associated with timestep and well control.
Master Variables
"REVEAL.IsRun" Flag if simulation is still running: 0-still running, 1-run
finished
"REVEAL.Master.T" Current time
"REVEAL.Master.DT" Current time-step - may be modified during the next
solve
"REVEAL.Master.DTMAX" Maximum time-step allowed for next solve
"REVEAL.Master.LSHUTIN[we If true then well is not included in solver calculations: 1-
true, 0-false,
l the well_number is in the order it appears
in the well lsection, indexed starting from zero
_
n
u
m
b
e
r
]
"
"REVEAL.Master.LNOFLOW[ If true then well rate is zero (no VLP/IPR intersection),
cross flowwmay still occur and Pwf is calculated :1-true,
0-false e
l
l
_
n
u
m
b
e
r
]
"
"REVEAL.Master.IFLAG[well_ Well type flag: 1-fixed Pwf injector, 2-fixed Pwf
producer, n3-fixed rate injector, 4-fixed rate producer, 5-
fixed THP uinjector, 6-fixed THP producer
m
b
e
r
]
"
"REVEAL.Master.IVOLR[well_ Rate type for producer: 1-liquid, 2-oil, 3-water, 4-gas
n
u
m
b
e
r
]
"
"REVEAL.Master.INJTYPE[wel Rate type for injector: 1-water, 2-gas
l
_
n
u
m
b
e
r
]
"
"REVEAL.Master.LTINJ[well_n If true then injection temperature calculated from VLP:
1-true, 0-false
u
m
b
e
r
]
"
"REVEAL.Master.CTOTW[0] Injection water mass fraction: 1 for water injector, 0 for
gas injector
[
w
e
l
l
_
n
u
m
b
e
r
]
"
"REVEAL.Master.CTOTW[1] Injection oil mass fraction: 0 for water injector, 0 for gas
injector [
w
e
l
l
_
n
u
m
b
e
r
]
"
"REVEAL.Master.CTOTW[2] Injection gas mass fraction: 0 for water injector, 1 for
gas injector
[
w
e
l
l
_
n
u
m
b
e
r
]
"
The following is a list of some of the useful Run variables that may be accessed.
Contact Petroleum Experts for details of additional Run time variables if required.
Run Time Variables
"REVEAL.Run[0].NX" X direction dimension of main grid
"REVEAL.Run[0].NY" Y direction dimension of main grid
"REVEAL.Run[0].NZ" Z direction dimension of main grid
"REVEAL.Run[0].IJKD" Total number of active blocks in main grid
"REVEAL.Run[0].ACTIND[99 Active block number (indexed from 1) corresponding to
]" global grid block 100 in main grid - global grid block =
(IZ-1)*NX*NY + (IY-1)*NX + IX, where NX, NY and NZ are
the grid dimensions and IX, IY and IZ are the indices in
the global grid. If the global grid block specified is
inactive, then the value returned is zero.
"REVEAL.Run[0].P[0][99]" Main grid water phase pressure for active block 100
"REVEAL.Run[1].P[1][99]" First refinement grid oil phase pressure for active block
100
"REVEAL.Run[0].P[2][99]" Main grid gas phase pressure for active block 100
"REVEAL.Run[0].S[0][99]" Main grid water phase saturation for active block 100
"REVEAL.Run[0].S[1][99]" Main grid oil phase saturation for active block 100
"REVEAL.Run[0].S[2][99]" Main grid gas phase saturation for active block 100
"REVEAL.Run[0].TT[99]" Main grid temperature for active block 100
"REVEAL.Run[0].RSSOL[99] Main grid solution RS (scf/STB) for active block 100
"
"REVEAL.Run[0].GRIDV[99]" Main grid total block volume for active block 100
"REVEAL.Run[0].POR[99]" Main grid porosity for active block 100
"REVEAL.Run[0].IPERF[grid Main grid perforation flag of first perforated block for well
_well_number][0] grid_well_number: 0-not perforated, 1-perforated - the
grid_well_number corresponds to the well number in the
specified grid (e.g. main grid). The grid_well_number
may be found from the global well_number using the
KWM variable. Perforations must have been specified
in the input script if they are to be activated or
deactivated by OpenServer
"REVEAL.Run[0].KWM[well_ Main grid grid_well_number (indexed from 1)
number]" corresponding to the global well_number variable
Example:
Set well 2 to be a fixed liquid rate producer with a rate of 1000 STB/d
SetValue("REVEAL.Master.LSHUTIN[1]",0)
SetValue("REVEAL.Master.LNOFLOW[1]",0)
SetValue("REVEAL.Master.IFLAG[1]",4)
SetValue("REVEAL.Master.IVOLR[1]",1)
SetValue("REVEAL.Master.QI[1]",Cstr(-1000*5.615))
Example:
Set well 3 to be a fixed THP water injector with a THP of 100 psig and injection
temperature of 50F
SetValue("REVEAL.Master.LSHUTIN[2]",0)
SetValue("REVEAL.Master.LNOFLOW[2]",0)
SetValue("REVEAL.Master.IFLAG[2]",5)
SetValue("REVEAL.Master.INJTYPE[2]",1)
SetValue("REVEAL.Master.LTINJ[2]",0)
SetValue("REVEAL.Master.PWS[2]",100)
SetValue("REVEAL.Master.TTI[2]",50)
SetValue("REVEAL.Master.CTOTW[0][2]",1)
SetValue("REVEAL.Master.CTOTW[1][2]",0)
SetValue("REVEAL.Master.CTOTW[2][2]",0)
Example:
Find the oil phase saturation for block IX,IY,IZ = (10,20,5) in the main grid
NX = GetValue("REVEAL.Run[0].NX")
NY = GetValue("REVEAL.Run[0].NY")
NZ = GetValue("REVEAL.Run[0].NZ")
IJK0 = (NZ-1)*NX*NY+(IY-1)*NX+IX
IJK = GetValue("REVEAL.Run[0].ACTIND["+Cstr(IJK0-1)+"]")
SO = GetValue("REVEAL.Run[0].S[1]["+Cstr(IJK-1)+"]")
Example:
Perforate blocks 5-10 for well 3 in refinement 1
KW = GetValue("REVEAL.Run[1].KWM[2]")
SetValue ("REVEAL.Run[0].IPERF["+Cstr(KW-1)+"][4],1)
SetValue ("REVEAL.Run[0].IPERF["+Cstr(KW-1)+"][5],1)
SetValue ("REVEAL.Run[0].IPERF["+Cstr(KW-1)+"][6],1)
SetValue ("REVEAL.Run[0].IPERF["+Cstr(KW-1)+"][7],1)
SetValue ("REVEAL.Run[0].IPERF["+Cstr(KW-1)+"][8],1)
SetValue ("REVEAL.Run[0].IPERF["+Cstr(KW-1)+"][9],1)
9
463 OpenServer
OpenServer is the mechanism by which external applications can interact and control
all the programs in the IPM suite (Prosper, GAP, Reveal, PVTP, MBAL, and RESOLVE).
For example a VBA macro in Excel can be used to open, interrogate, and run IPM
programs.
External OpenServer macros can be written to control RESOLVE. These macros can be
written in any langauge that supports automation, for example: Visual Basic, VBA,
VBScript, C++, Java, Matlab. Most typically they are written as VBA macros in an Excel
spreadsheet; the OpenServer example macros are in this form. An OpenServer macro
can call three different functions/subroutines on the program (RESOLVE) it is controlling.
These are:
retval = DoGet("tagstring")
DoSet("tagstring"), "value"
DoCmd("tagstring")
The first of these interrogates a variable in the application (for example, the schedule
start date). The second sets a variable to the value 'value'. The third performs a
command (for example, load a file, perform a run). In each case, tagstring is a '.'
delimited string that refers to the variable or command in question. For example, to get
the start date in RESOLVE:
retval = DoGet("Resolve.Schedule.StartDate.DateStr")
will return the date in the form of dd/mm/yy (depending on the international settings). To
execute a prediction run, use:
DoCmd("Resolve.Run")
In each case, the tagstring starts with the application name (in this case, Resolve).
When getting or setting a variable, the rest of the string is a delimited list of child
variables until we get to the required variable (DateStr is a 'child' variable of the
'StartDate' property, which is a child of the Schedule data, and so on). The variables
supported by RESOLVE are documented here. When executing a command, the string
simply refers to the command to be executed: these are documented here.
There is a quick way to find an OpenServer tagstring if the variable is part of the user
interface. In this case, go to the required screen and press <Ctrl> and RClick over the
variable in question. A screen will appear with the variable tagstring which can then be
copied to the clipboard.
Empty variables
Variables that are not set (or are blank) in RESOLVE return a large number (3.4e35)
when the OpenServer queries them.
9.2 Commands
The following list describes the OpenServer commands with their arguments. Some of
these arguments may be optional - if this is the case they will be specified by "arg =
(default value)".
NOTE:
The date variables return a double-precision number which is the number of days since
01/01/1900. To get a date string, the DateStr can be appended to the tag strings.
Example:
DoGet("RESOLVE.CurrentTime") may return 36525.0, while as
DoGet("RESOLVE.CurrentTime.DateStr") will return 01/01/2000.
Module Collection
There are no variables specific to this collection. Index individual items by number
(Module[0]) or label (Module[{Network}]).
XPos / YPos The position of the module icon on the main screen.
Alias The label/alias given to the module when it was created
Driver Data pertaining to the registration information of the driver
(see Driver variables).
SrcSnk A collection of source/sink child data for the module (see
SrcSnk variables).
OptCtrl A collection of optimisation control variables specific to this
module (see Module Optimisation variables).
OptConstraint A collection of optimisation constraint equations specific to
this module (see Module Optimisation variables).
OptObjFn The objective function (if present) for this module (see Module
Optimisation variables).
RESOLVE.Module[{GAP}].XPos
Example:
RESOLVE.Module[{GAP}].CaseDetails.FileName
The tag string does not represent a variable in RESOLVE, and so the string
'CaseDetails.FileName' is passed on to the GAP driver, where it is recognised as
referring to the GAP filename.
In the case of IPM products (REVEAL/GAP), the string will be passed on to the
OpenServer of the connected applications if it is not processed by the driver.
Example:
RESOLVE.Module[{GAP}].MOD[{PROD}].INFLOW[{comp1}].IPR[0].ResTemp
The tag string will refer to an internal variable of GAP (a well layer temperature).
The following is a list of the variables that are supported by the GAP, REVEAL, and
Hysys drivers.
GAP
CaseDetails.FileName Sets the GAP filename to open
CaseDetails.HostName The host machine on which to run GAP
CaseDetails.System 0 - main system
1 - associated water injection
REVEAL
CaseDetails.FileName Sets the REVEAL filename to open
CaseDetails.HostName The host machine on which to run REVEAL
CaseDetails.RestartFrom The index of the restart file from which REVEAL
should be restarted. 0 represents no restart -
perform equilibration
CaseDetails.GlobalControlMode The global control mode for all the wells in
REVEAL. Values are:
0 - fixed bottom hole pressure
1 - fixed rate
2 - fixed THP
3 - 'system response'
CaseDetails.LoadCompletionData Specifies whether completion data should be
loaded as children under the individual wells
Hysys
CaseDetails.FileName Sets the Hysys filename to open
CaseDetails.HostName The host machine on which to run Hysys
NOTE:
In addition, all the plant equipment and the variables that can be scheduled for each
piece of equipment can be obtained. These can then be added to a schedule.
An example of how this is done is in the OpenServer example macro:
HysysOpenServer.xls.
Any module within RESOLVE may have an objective function, constraints, and/or control
variables set up. These elements can all be accessed through the OpenServer.
Enabled
Enables or disables the element in the optimisation. This might be useful to automate
runs with and without certain control variables or constraint equations, or to switch
between objective functions. If this fag is used when performing a forecast, the control
(or whatever) will be enabled or disabled for the entire forecast.
Name
Unit
The measurement unit of the quantity for the optimisation element.
LowerBound
The lower bound of the control (if applicable through BoundsMask)
UpperBound
The upper bound of the control (if applicable through BoundsMask)
Perturbation
The perturbation to apply to the control, in the appropriate unit (note that this changes
dynamically during the run depending on the current trust region of the SLP: this quantity
is the first pertubation).
InitialBound
The initial 'trust' bound to apply to the control, in the appropriate unit. As with the
perturbation, this changes dynamically during the course of the run.
CentrePerturbation
Flag to tell Resolve whether to perform a centre-based perturbation on the control (rather
than the usual, default, forward perturbation). See the RESOLVE Optimisation pages for
more information.
MinimumPerturbation
The minimum perturbation that the control can use. The perturbation is adapted to the
current 'trust region'; this prevents the perturbation becoming too small.
LimitType
The type of the constraint:
0 - less than
1 - equal to
2 - greater than
The SrcSnk variables correspond to the sources and sinks exposed by a parent
module.
SrcSnk collection
There are no variables specific to this collection. Index individual items by number
(SrcSnk[0]) or label (SrcSnk[{Well1}]).
SrcSnk Item:
All the following variables will need to be preceded by the following OpenServer string
structure:
1 - water
2 - liquid
3 - oil
4 - gas
5 - condensate
IsConnected (read only) Return whether this item is connected to another item in
RESOLVE.
Connection Return connection data if IsConnected is true. Possible data
is:
Label The label of the item to which this item is connected.
SrcSnk A further collection of children of this item (as described on
this page).
Example:
The following syntax can be used to retrieve the position of Well1 child icon exposed by
GAP module {Network}:
RESOLVE.Module[{Network}].SrcSnk[{Well1}].XPos
Driver Collection:
There are no variables specific to this collection. Index individual items by number
(Driver[0]) or application (Driver[{GAP}]).
Driver Item:
All the following variables will need to be preceded by the following OpenServer string
structure:
InterfaceVersion (read only) The interface version of RESOLVE that this driver
was built with
Application (read only) The application implemented with this driver
NeedsComposition (read only) Whether the application implemented here is purely
EOS and requires compositional data to function.
ProvidesComposition (read only) Whether the application can provide EOS data
AppType (read only) The application type (for informational purposes):
0 - unknown
1 - reservoir simulator
2 - nodal analysis
3 - process simulator
Description (read only) A description string describing the application.
Example:
The following syntax can be used to retrieve the information regarding GAP module
DoGet ("RESOLVE.Driver[{Production}].Description")
ModLink Collection:
There are no variables specific to this collection. Index individual items by number
(ModLink[0]). There is one entry in this collection for every connection between modules.
For example, if module A is connected to module B and module C, there will be two
entries in this collection: A-B and A-C.
This collection is used to hold the calculation order data as well as some adaptive time-
stepping data.
ModLink Item
All the following variables will need to be preceded by the following OpenServer string
structure:
RESOLVE.ModLink[index].
CalcOrder This is the order of calculation for this module pair. It is the number that is
entered on the Calculations Order screen.
Mod1 This is the name of the first module in the pair (the order is arbitrary).
Mod2 This is the name of the second module in the pair.
The following variables are part of the data required to set up adaptive time-stepping in
a RESOLVE prediction.
TargetRMS This is an array of RMS targets for the target variable (see below). It is an
array over all schedule records.
Example: The tag string:
RESOLVE.ModLink[2].TargetRMS[1]
will obtain the second (zero indexed) schedule record RMS target for the
third module link object.
TargetVar Similarly, this is an array of target variables over all schedule records for
this module link, e.g. water cut, THP.
Schedule Collection:
All the following variables will need to be preceded by the following OpenServer string
structure:
RESOLVE.Schedule.
Schedule Item:
Individual items of the schedule data are indexed by number. The individual items listed
below are preceded with the following structure:
RESOLVE.ScheduleList[index].
All the following variables will need to be preceded by the following string structures
depending upon the the Schedule type (Start, Pre-Solve or Post-Solve) being used:
RESOLVE.AdvancedScheduleStart[i][j].
RESOLVE.AdvancedSchedulePreSolve[i][j].
RESOLVE.AdvancedSchedulePostSolve[i][j].
Actions collection:
All the following variables will need to be preceded by the following string structures
depending upon the the Schedule type (Start, Pre-Solve or Post-Solve) being used:
RESOLVE.AdvancedScheduleStart[i].Action.
RESOLVE.AdvancedSchedulePreSolve[i].Action.
RESOLVE.AdvancedSchedulePostSolve[i].Action.
Scenario Index
It is possible to retrieve a zero based index of scenario currently running in RESOLVE.
i = RESOLVE.Scenario
The scenario number will be assigned to variable i and can later be used in Prediction
Script to determine some other logic. This makes RESOLVE script adjustable to
scenarios.
NOTE:
Please note that scenario number is only accessible through RESOLVE Prediction
Script
Scenario Item
Individual items of scenarios can be indexed by number (RESOLVE.Scenario[0]) or by
name (RESOLVE.Scenario[{Scenario1}])
Connection Collection:
There are no variables specific to this collection. Index individual items by number only
(Connection[0]).
The collection is read only. Items can be connected by calling an appropriate command.
Connection Item:
All the following variables will need to be preceded by the following OpenServer string
structure:
RESOLVE.Connection[index].
NOTE:
The source is considered to be the 'data provider' and the sink is the 'data acceptor', i.e.
the source/sink status is determined by the data flow direction, and not necessarily the
fluid flow. A case where the fluid flow is different to the data flow direction is that of
injector coupling between a reservoir simulator and a surface network: in this case fluid
is passing from the network to the simulator, but it is the simulator that supplies the
network with IPR data.
The data providers have small dots at the top left hand corner of their icon on the
RESOLVE screen.
Properties variables listed below used to define system properties in RESOLVE. All the
commands are preceded with the following string structure:
RESOLVE.Properties.
Run properties
ForecastMode Forecast mode: 0 - Full forecast;
1 - Full forecast with global
optimisation;
2 - Single solve/optimisation only.
EnableScript Visual Basic scripting : 0 - Disable; 1 - Enable
ReloadOnStart Run initialisation: 0 - Do not reload client modules;
1 - Reload client modules
RunInParallel Parallelisation:
0 - Perform all calculations in series;
1 - Perform timestep calculations in parallel
NonFatalErrorDisplay Valiadation:
0 - Ignore non-fatal validation errors;
1 - Report non-fatal errors and terminate run
DebugFlag Debug logging:
0 - Disable debug logging;
1 - Enable debug logging
UseOldReporting Reporting:
0 - Use upgraded reporting structure (IPM 7)
1 - Use old reporting structure (pre-IPM 7)
StopOnTargetOrOptimiserErro Optimiser/target solver failure:
r 0 - Continue forecast with existing solution;
1 - Terminate forecast with error
ConnectionPopup Connection popup windows:
0 - Current data;
1 - Chart;
2 - Pie
System view
SystemTitle The title displayed at the top of the main window
DisplaySystemTitle Toggle the display of the system title at the top of the
main window
The optimiser parameter variables relate to the quantities listed on the Optimisation
Parameters screen.
RESOLVE.OptimiserData.
RESOLVE.OptimiserData[index].Parameters.
The index in square brackets corresponds to the optimisation level: 0 - Top level; 1 -
Second level.
All the following commands should be preceded with the following string structure:
RESOLVE.OptimiserData[i].Schedule.
RESOLVE.OptimiserData[i].Schedule.List[j].
RESOLVE.OptimiserData[i].Schedule.Advanced.List[j].
Count Returns the number of sub-schedules in the list (read only). The index after
List keyword should be removed.
Example: RESOLVE.OptimiserData[i].Schedule.Advanced.List.Count
Date The end date for the schedule entry
DisableAll Disable optimiser for the current entry: 0 - on; 1 - off
Enable This is an array over all control variables, constraints, and objective
functions, determining whether these individual elements are active or
inactive in the sub-schedule. They are ordered as follows:
The OpenServer examples (example1.gar) are distributed as GAP archive files (.gar).
These archives contain the required Excel spreadsheet that implements the macro, as
well as any other associated files. For instructions on how to extract the archives, see
the GAP documentation.
example1.gar
This example performs the following tasks:
a. Creates a new (empty) system and interrogates the driver list to check that
REVEAL and GAP drivers are available
b. Puts the current driver versions on the spreadsheet
c. Creates an instance of GAP and REVEAL on the main window and loads cases
into these modules
d. Links the module wells together
e. Interrogates the RESOLVE connections variables and outputs these to the
spreadsheet
f. Sets a schedule in RESOLVE
g. Runs the prediction
h Gets the results from RESOLVE and puts them into the spreadsheet. These are
then plotted by Excel.
10
483 OpenServer
10 OpenServer Examples
10.1 OpenServer VBA Template
OpenServer Template.xls
This spreadsheet contains the skeleton code required to use the OpenServer (i.e.
initialisation, utility routines) but does not actually do anything. It can be use as starting
point for a new macro.
The main advantage of using this templates is that they contain a debugging routine
executed after the DoGet, DoSet and DoCmd commands which may help identifying
any error in the code.
Initialisation
In this section the GAP model initial setup is performed and the spreadsheet previous
results (if any) can be automatically cleared using:
NOTE: After the Connect sub command, wells, etc., can be masked at this point prior
to running a prediction. For example, this would be the approach taken if setting up a
drilling queue.
Example:
DoGapFunc (“GAP.MOD[{PROD}].WELL[{WellY}].MASK()”) ‘Command masking well
WellY prior to performing the prediction. The code will show how to automatically open
(UnMask) well WellY during the prediction by monitoring well WellX liquid rate
Also, prior to starting a prediction, flow rate limits, etc., can be set that can be
dynamically monitored during a given prediction. Based on the macro structure, field
development actions will be taken if the monitored rate has been violated, e.g. open
other wells if the a threshold separator rate can no longer be achieved.
Example:
Min_LiqRate = 6000
The above approach hard-codes the pre-defined and declared variable Min_LiqRate
value directly in the macro code (use of the Min_LiqRate variable will be illustrated
later).
It is more convenient to supply a spreadsheet cell reference for the control rate using the
following approach:
Min_LiqRate = Cells(x, y)
NOTE: When using Strings, they must be converted in the OpenServer string from a
numeric value using ‘Cstr’ as per the following example:
The command return well WellY rates during the prediction to a defined variable
WellY_LiqRate. The ‘j’ is a counter that corresponds to the current time step; it can
also be used to automatically index to the next Excel row to place the next time-step
Prediction Run
For j = 0 To NumSteps - 1 'Loop executed at each prediction step where ‘j’ is the
counter using the information obtained via the PREDINIT() call.
Cells(x, y) = WellX_LiqRate 'Well WellX liquid rate from the Solver results that will be
displayed in the defined cell reference
Cells(x + j, y) = PredDate 'Prediction date results from the Prediction results
Cells(x + j, y) = WellX_LiqRate 'Well WellX liquid rate results from the Prediction results
NOTE: The ‘j’ inclusion in the above cell reference tells Excel to automatically index to
the next row to place the following time-step results until all prediction steps have been
completed.
If WellY_Active_Flag = 1 Then 'If Well WellY is active based on the returned FLAG
value, the rate will be reported in the following cell reference if the well is active
Cells(x, y) = WellY_LiqRate ‘Well WellY liquid rate from the Solver results that will be
displayed in the defined cell reference
Cells(x + j, y) = WellY_LiqRate ‘Prediction results using the ‘j’ loop counter to index to
the next row after each network solve during the prediction
End If
Cells(x, y) = "Well WellY Active" ‘Reports the above message in quotation marks to the
corresponding cell reference
End If
Cells(xn + j, yn) = Cells(x1 + j, y1) + Cells(x2 + j, y2) 'Total prediction rate results cell
reference from adding the previously defined cell references. the same could easily be
achieved by simply capturing the separator liquid rate for instance
Next j
Finalisation
DoSlowCmd "GAP.PREDEND(0)" 'Finalises the Prediction run in GAP restoring initial
values in the model
Call Disconnect 'Breaks connection between Excel and the IPM tools
End Sub
This example involves a VBA macro. The VBA macro, the Excel file, and the GAP
model have been prepared in advance and the code structure will be a useful resource
to further modify the macro or use as a basis to develop further macros.
We are not going into the explanation of how to write the VB macro because the user is
expected to have (or be trained in) the required computing knowledge.
To execute the macro, extract the GAP archive file and open the main *.gap file. Also,
open the corresponding Excel macro file that has also been included in the GAR file.
Please ensure that the macro security has been set to enable macros.
To run the macro, simply select the Run Macro button located on the Excel
spreadsheet.
The files for this example and the final model are in the following directory.
~\samples\OpenServer\GAP\
OpenServer Example A.GAR
This is a GAP Archive file that also contains the macro. To extract a GAP
archive file (GAR file), from the main GAP menu select File | Archive |
Extract
Macro Explanation:
The macro controls the GAP prediction run and extracts Well 1 liquid rate as the
prediction advances.
When the liquid rate is less than a pre-set minimum liquid rate then the second well (W2)
is enabled, simulating the well coming on-stream.
OpenServer macros are ideal when events need to be triggered by results during the
prediction run where they cannot be scheduled in the component itself where a fixed
date for the event is required.
In this section the GAP model initial setup is performed and the spreadsheet previous
results (if any) are cleared.
Prediction Run
Finalisation
This section finalises the GAP model (original model values are restored) and the
connection between Excel and the IPM tools is ended.
This example provides the basis for the users who wish to set different events triggered
by the step prediction results. The user can use this VBA macro as a starting point and
modify it to suit individual needs.
For further details on macro structure please see Basic_Code_Structure for more
information.
In brief, the ‘Model Validation’ feature in GAP uses production test conditions jointly with
the well model IPR and VLPs to calculate the well production rate. These rates are then
displayed against the measured test rates.
The only functionality that the macro adds is the capability of matching the IPR
parameters (Reservoir Pressure or Productivity Index) to match the well models in case
there is a discrepancy with the production test data. This could still be done within GAP
interface but would be manually.
As in the previous examples, the excel file and the GAP model have been prepared.
The files required to run this particular model are:
The files for this example and the final model are in the following directory.
~\samples\OpenServer\GAP\
OpenServer Example B.GAR
This is a GAP Archive file and needs to be extracted. To extract a GAP archive
file (GAR file), from the main GAP menu select File | Archive | Extract
Setup
Before running the macro, GAP needs to be opened and the required files extracted
from the GAR file ‘OpenServer-Example B.GAR’
Open the Excel file ‘OpenServer-IPR Matching’ and follow the instruction described
below.
The VBA Macro is designed to follow a stepwise procedure which is described below:
1) Initialisation.
This step opens a given GAP file and retrieves well models data such as Label, WC,
GOR, Reservoir Pressure, PI (as per the IPR data screen)
4) Calculate Rates
This step calculates the production rates based on the well models in GAP for those
production test conditions.
If the difference between these calculated rates and the production test rates is larger
than the tolerance value entered in the spreadsheet they will be highlighted red.
Otherwise they will be highlighted green. The error will also be reported.
5) IPR Matching
This step will regress on either reservoir pressure or productivity index until the
production test rate is honoured by the well models in GAP.
Both original values and matched values will be reported in a separate table for
inspection.
After doing the regression, the original values can be restored (by using the ‘Revert’
button) before regressing on the other variable.
This example uses OpenServer to run several GAP models in a batch mode (one after
the other) without requiring the user to save/open the different files.
This allows running different models/scenarios (e.g. overnight) keeping the results in
each model so they can be inspected later.
The Excel file is called ‘OpenServer Example C - Batch Predictions.xls’ and is located
in ~\samples\OpenServer\GAP\
The spreadsheet is set up for up to ten GAP models but can easily be extended to as
many as required.
This example involves a VBA macro. The VBA macro, the Excel file, and the GAP model
have been prepared in advance. We are not going into the explanation of how to write
the VB macro because the user is expected to have (or be trained in) the required
computing knowledge.
The actual time required to perform the example is short since all of the files have been
prepared. The exercise is simple, just press a button in the Excel file provided. However,
the purpose of this example is providing an introduction to OpenServer capabilities and
providing a template which can be used for developing other macros.
The files for this example and the final model are in the following
directory.
~\samples\OpenServer\GAP\
OpenServer Example D.GAR
This is a GAP Archive file and needs to be extracted. To extract a GAP
archive file (GAR file), from the main GAP menu select File | Archive |
Extract
Figure 10.17:
Gas Sample
The objective of this macro is to provide the required well drilling scheduling such that a
target gas rate is met.
The target rate, initial number of wells and maximum number of wells can be modified.
The macro controls GAP prediction run extracting the total gas rate at each prediction
step and comparing this to the target gas rate. If this target rate is not met, more wells
are enabled.
OpenServer macros are ideal when events need to be triggered by results during the
prediction run and hence they cannot be scheduled in the component itself where a fix
date for the event is required.
Initialisation
In this section the GAP model initial setup is performed and the spreadsheet previous
results (if any) are cleared.
Prediction Run
Finalisation
This section finalises the GAP model (original model values are restored) and the
connection between Excel and IPM tools is ended.
This example provides the basis for the users who wish to set different events triggered
by the step prediction results. The user can use this VBA macro as a starting point and
modify it to suit individual needs.
This section describes the example files that are provided with OpenServer installation
related to MBAL. These files may be used as a starting point to develop additional VBA
macros for MBAL application. Please note that some of these examples will not run
without some modification – this is due to the different date formats in different
countries.
OPENSERV.XLS
This is the simple spreadsheet used as an example in section 3.5 of MBAL User Guide.
CALCWELL.XLS
This is an advanced spreadsheet macro that is used to calculate the well schedule
required to meet a fixed production rate. The user may specify a single well type and the
maximum number of wells available. The macro will then calculate at each step the
minimum number of wells required to meet the required rate. The well schedule dialogue
will contain the required wells on completion of the macro.
MBSAMPLES.XLS
This example runs two predictions with different OOIP and displays a summary of results
for both runs.
SENSITIV.XLS
This example runs a prediction for a number of OOIP and RDs. It runs a prediction for
each combination of values and displays the final cumulative rate and pressure for each
run – it also saves a prediction stream for each run.
OPENSERV.MDB
This is an Access database example that is used to transfer data from the database to
MBAL. Measured rates and pressures are stored in the database. The macro converts
these to cumulative rates and transfers them to the MBAL tank production history.
NOTE: Please check the MBAL file path, which is implicitly specified in the macro.
MBALTEST.PXB
This is the example of the batch file method used in section 4.3 in the MBAL User Guide
STEP1.XLS
In this example we calculate a manifold pressure schedule to keep the rate above a
target rate. At each time step the macro checks the current rate. If the rate falls below the
target rate, the macro will add a new row to the table of production and constraints to
decrease the manifold pressure by a fixed amount. After running the macro, the
production and constraints dialogue will contain the calculated manifold pressure
schedule.
STEP2.XLS
In this example we increase the PI of the well by a fixed percentage every n year – the
percentage and number of year’s n is read from the spreadsheet.
STEP3.XLS
In this example we calculate a well schedule that will achieve an entered rate for the
duration of the prediction. The well schedule is initialised with 10 wells each of the two
well definitions. We then run the prediction step by step and check if the specified rate is
produced. If not, we add new rows to the well schedule until the rate is produced. The
two well definitions are added alternatively. On completion of the prediction, the
calculated well schedule can be viewed in the well schedule dialogue.
PASTEP1.XLS
In this example we perform a production allocation calculation. However one of the
layers has work-overs performed during the history. So at two different dates we
increase the PI.
FRACT_FLOW_MATCH_1.XLS
In this example we do a prediction where we calculate the tank pressure from production
rates defined for each well. In addition we calculate the GOR, Wc etc for each well at
each step in the prediction. This particular form of the prediction can be used to check
that the prediction matches the WC and GOR from the production history for single layer
case.
FRACT_FLOW_MATCH_2.XLS
In this example we do a prediction where we calculate the tank pressure from a manifold
pressure for each well rather than a common manifold pressure for all wells. It also uses
the input production schedule as a maximum well rate constraint. This particular form of
the prediction can be used to check that the prediction matches the WC and GOR from
the production history for multi-layer cases.
DA1.XLS
This file contains the macro described in detail in the previous section concerning the
high level direct access OpenServer.
DA2.XLS
This file contains the macro described in detail in the previous section concerning the
low level direct access OpenServer.
Step 2: Access the VBA script utility of the spreadsheet from the following path
Step 3: Open the PROSPER file to work with. In this case it is the
T02_SIMPLEOILWELL.OUT sample file installed in the samples directory or PROSPER:
Creating this OpenServer macro will revolve around the same steps as doing the
calculation manually. So, the commands to be used can be accessed using the Ctrl and
Right Click functionality.
Step 4: Access the system calculation screen and get the string that controls the well
head pressure
This line will set the fist node pressure to be 150psi. Note that OpenServer only
transfers values, not units. So the number 150 will be taken regardless of the units set in
the PROSPER file.
Step 8: Use the list of commands to find the right command to perform the system
calculation in PROSPER. The list of commands can be accessed from OpenServer
function of Help menu and then selecting Commands. To find the command type
"system" in the search string and then select the 'Find' button, the necessary string will
be highlighted in the list.
Step 10: From the PROSPER file get the string that extracts the results of the system
calculation by selecting Ctrl + Right Click on the calculated parameter
Notice that the DoGet function will send the result to cell A20 of Excel.
Once this is done (by selecting the 'Run' button on the Excel spreadsheet), the rate result
can be seen in cell A20 of the active Excel sheet as shown below:
Just to check that the result extracted is the same as the one given by PROSPER, the
system calculation screen shows the same number as the rate result: