Professional Documents
Culture Documents
DoGet
Syntax: DoGet(AccessString)
The DoGet command returns the value of a certain variable, identified by the
AccessString. The AccessString must be a string, and thus will normally be enclosed
with double inverted commas. Usually, the value returned is stored in a variable.
Example:
W1PRes = DoGet(GAP.MOD[{PROD}].WELL[{WELL1}].IPR[0].ResPres)
DoSet
DoCmd
Syntax: DoCmd(AccessString)
The DoCmd command performs the command identified by the AccessString. The
complete list of commands and their AccessString is provided in the User Guide for
OpenServer and GAP.
Example: DoCmd(GAP.MOD[{PROD}].WELL[{WELL1}].MASK())
LogMsg
Syntax: LogMsg(Message)
The LogMsg command prints the message in the Script tab of the prediction Log.
Example: LogMsg(Hello World)
1/6
IFM-Solutions
www.ifm-solutions.com
ACCESS STRINGS
Each variable or procedure in GAP has its unique identifier, called the Access String. Thus, when referring to any
particular variable or procedure, the user must identify it using its Access String value.
For example, the access string for a layers Reservoir Pressure is:
GAP.MOD[{PROD}].WELL[{WELL3}].IPR[0].ResPres
To find out the access string that identifies a variable, the usual procedure is to hold Ctrl and right click on the
input box that holds the variable. In GAP, that brings up a screen showing the Access String and the value that
the variable holds, as shown in the screen capture.
Using the GAP model provided, find out the Access String for the following
variables:
Please note that the GAR file provided has been created using IPM 8.0, and
can only be opened with GAP IPM 8.0 and above.
Access String
Variable
Well 3: Reservoir Pressure
Node A: Pressure (From Solver Results)
Trunk Line A: Surrounding Temperature
2/6
IFM-Solutions
www.ifm-solutions.com
In this window you can test the outcome of certain sentences and execute simple statements.
Using the DoGet mode, find the values stored in the following AccessStrings:
Value Stored
Access String
Units
Access String
GAP.MOD[{PROD}].PIPE[{Trunk Line A}].Desc[1].ID
GAP.MOD[{PROD}].WELL[{WELL2}].SolverResults[0].FWHP
GAP.MOD[{PROD}].WELL[{WELL1}].SolverResults[0].GasRate
Using the DoSet mode, change the value of the ID of Well 3 Pipeline from
3.5 to 3 inches.
3/6
IFM-Solutions
www.ifm-solutions.com
This is the scripting window that pops up when the user heads to Prediction | Edit prediction script. In the highlighted comboBox, the user must select when will the prediction script be executed.
For example, certain reporting scripts will usually run after the prediction has ended. On the contrary, certain
initialization routines will generally run before the start of the prediction. Other scripts must be executed in every
time step, and others between the Production and the Injection networks. It is very important to define the
moment in which the particular script will run.
The different placement options of the routines are:
PredProlog
PredEpilog
Subroutine that is executed once at the end of the prediction. This is executed
after all calculations are done.
PredStepProlog
PredStepEpilog
This subroutine is executed at the beginning of each prediction step. The results
of the previous time step can be used to evaluate changes or trigger actions in
this script.
PredStepSolver
Prolog/Epilog
The script described here is run once at the beginning or end of each solver step.
This is particularly useful when there are two networks, (such as Production &
Injection) and the results of one network are used to influence constraints or the
behavior of the other network.
4/6
IFM-Solutions
www.ifm-solutions.com
PredProlog
PredEpilog
TIME
1st step
2nd step
...
nth step
PredStepProlog
PredStepProlog
...
Last step
PredStepEpilog
PredStepEpilog
nth step
PRODUCTION SYSTEM
PredStepSolverProlog
INJECTION SYSTEM
PredStepSolverEpilog
PredStepSolverProlog
From the
PRODUCTION SYSTEM
PredStepSolverEpilog
From the
INJECTION SYSTEM
As you can see, the use of PredStepProlog is redundant with the use of the PredStepSolverProlog for the
Production system, as both instructions are executed at the same time. The same happens with the use of
PredStepEpilog and PredStepSolverEpilog of the Injection system, they are exactly the same moment in time.
However, the use of PredStepSolverEpilog for the Production network can be used to set constraints for the
Injection system.
First, find the Access String that relates to the Pressure drop for the two sections
of the trunk line.
Access String
Variable
5/6
IFM-Solutions
www.ifm-solutions.com
Now write a script that adds the pressure drop of the two parts of the trunk line
and reports it for every time step using a LogMsg statement. Write that routine in
the PredStepSolverEpilog Section.
It is recommended to use the Visual Basic functions CSng or CDbl to store values as numeric
variables before adding the values.
Run the prediction until 1/1/2020 With one month timestep size.
At which time does the pressure drop of all the trunk line falls below 100psi?
When the pressure drop of the total trunk line falls below 100 psi, change the
manifold pressure should be lowered to 1000psi. Add a condition to the script and
run a prediction with the new condition. Report the change made using a LogMsg
statement.
Conditions are generally added using IF THEN statements, just as in Visual Basic.
Set the manifold pressure change using a DoSet command.
The Separator Pressure Access String is GAP.MOD[{PROD}].SEP[{SEPARATOR}].SolverPres[0]
6/6
IFM-Solutions
www.ifm-solutions.com