• No results found

Date Handling within MBAL

In document OpenServer Complete (Page 146-151)

5 MBAL and the OpenServer

5.2 Date Handling within MBAL

By default, the dates in MBAL uses date in DD/MM/YYYY format.

As soon as a TIME OpenServer keyword is used, it will refer to that type of numerical format.

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 some times lead 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.3 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.3.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") + """)") for a spreadsheet based file path

MBAL.SaveFile Saves an MBAL file

MBAL.NewFile Resets all the input data and is equivalent to the menu item File New

5.3.2 Material Balance Commands

MBAL.MB.RunPrediction

Runs a material balance prediction MBAL.MB.RunSimulation

Runs a material balance history simulation MBAL.MB.SavePred=<New stream name>

MBAL.MB.SavePred(“PredCopy1”)

Both commands copy the current prediction stream to the specified stream name e.g.:-MBAL.MB.SavePred=No breakthrus

Note that because the ‘=’ character is used in the command, it can not be used in the stream name itself.

MBAL.MB.SaveHist=<New stream name>

MBAL.MB.SaveHist(“HistCopy1”)

Both commands copy the current history simulation stream to the specified stream name

e.g:-MBAL.MB.SavePred=First Match

Note that because the ‘=’ character is used in the command, it can not be used in the stream name itself.

MBAL.MB.IMPORTTPD(<well text string>,”<TPD file name>”) Imports the specified TPD file into the specified well

e.g.:-MBAL.MB.IMPORTTPD(MBAL.MB.PREDWELL[0],”C:\OIL1.TPD”) MBAL.MB.IMPORTMBV(<well text string>,”<MBV file name>”)

Imports the specified MBV file into the specified well

e.g.:-MBAL.MB.IMPORTMBV(MBAL.MB.PREDWELL[0],”C:\OIL1.MBV”) MBAL.MB.ALLOCTANKPRESSRATE(<tank text string>)

Calculates the tank production history pressure and rate from the entered well production history. Equivalent to using the Calc button on the tank production history input dialog.

e.g.:-MBAL.MB.ALLOCTANKPRESSRATE(MBAL.MB.TANK[1]) MBAL.MB.ALLOCTANKRATEONLY(<tank text string>)

Calculates the tank production history rate only from the entered well production history.

Equivalent to using the Calc Rate button on the tank production history input dialog. e.

g.:-MBAL.MB.ALLOCTANKRATEONLY(MBAL.MB.TANK[1]) MBAL.MB.RESETREGRESSTANKHIST(<tank text string>)

Resets the inputs to the history matching regression for the specified tank. It will reset the start values for each regression parameter to the current stored value. This is equivalent to clicking the Reset button in the regression input dialog.

e.g.:-MBAL.MB.RESETREGRESSTANKHIST(MBAL.MB.TANK[{TankLabel}]) MBAL.MB.REGRESSTANKHIST(<tank text string>)

Performs the history matching regression for the for the specified tank. e.g.:-MBAL.MB.REGRESSTANKHIST(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 Open Server. 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 dialog. This functions will autmatically validate all the objects in the material balance tool without having to enter each of the dialogs.

MBAL.MB.LINKITEMS(<object 1 text string>, <object 2 text string>)

This command will link the two specified objects. Depending on the type of objects being connected, the command may also create intermediate objects e.g. if two tanks and connected then a transmissibility will also be created. An example command

is:-MBAL.MB.LINKITEMS(MBAL.MB.TANK[1],MBAL.MB.PREDWELL[2]) MBAL.MB.BREAKLINK(<object 1 text string>, <object 2 text string>)

This command will break the link between two specified objects. An example command

is:-MBAL.MB.BREAKLINK(MBAL.MB.TANK[1],MBAL.MB.LEAK[2]) See also the section below on Material_Balance_Step-by-Step_Prediction

5.3.3 Monte Carlo

MBAL.MC.Calculate

Runs a Monte-Carlo calculation.

5.3.4 1D Model

MBAL.1D.RunSimulation :

Runs a 1D model simulation.

5.3.5 Decline Curve

MBAL.DC.RunPrediction

Runs a decline curve simulation.

5.3.6 Multi-Layer

MBAL.ML.Calculate

Runs a multi-layer calculation.

MBAL.ML.Validate

Performs a validation for the data entered.

Other variables to enter the data can be accessed by using the CTRL + Right Click Option.

5.3.7 Production Allocation

MBAL.PA.RUNALLOCATION Runs a allocation calculation.

MBAL.PA.SavePred=<New stream name>

MBAL.PA.SavePred(“AllocCopy1”)

Both commands copy the current prediction stream to the specified stream name e.g.:-MBAL.PA.SavePred=Case 1

Note that because the ‘=’ character is used in the command, it can not be used in the stream name itself.

See also the section below on Production Allocation Step-by-Step Prediction.

5.3.8 Tight Gas

MBAL.TG.RunPrediction

Runs a tight gas prediction

5.3.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.PVT.INPUT.IMPORT(”<PVT file name>”)

Imports a PVT file into the PVT dataset if general material balance fluid option not used. An example command

is:-MBAL.MB.PVT.INPUT[1].IMPORT(“C:\DOCS\OILWELL.PVT”) MBAL.MB.PVT.INPUT.IMPORT(OIL,”<PVT file name>”)

Imports a PVT file into the oil part of the PVT dataset if general material balance fluid option used.

MBAL.MB.PVT.INPUT.IMPORT(CON,”<PVT file name>”)

Imports a PVT file into the gas/condensate part of the PVT dataset if general material balance fluid option used.

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.

MBAL.MB.PVT.INPUT[1].CALCULATE will calculate the index 1 dataset and

MBAL.MB.PVT.INPUT[{LOWER}].CALCULATE will calculate the dataset called LOWER.

In document OpenServer Complete (Page 146-151)