This is the classical and simple example of predicting production in a reservoir given an OOIP.

Start OpenServer

The MBAL server is started the same way as in Prosper and GAP.

Get the model

We use a simple function to get the MBAl model filename. This function can be later generalized to retrieve any model type.

get_mbal_model <- function(model) {
    # get the well model
    models_dir <- system.file("models", package = "rOpenserver")
    model_file <- file.path(models_dir, model)
    if (!file.exists(model_file)) stop("Model not found ...") else
        return(model_file)

}

Open the model

Now, we open the MBAL model using the function shown above.

Let’s keep in mind that MBAL opens files a little bit different. The filename needs to be surrounded with double quotes ", not single quotes ' as in Prosper or GAP. We make that slight change and open the model.

Set the input data

Enter the OOIP and write to MBAL.

ooip <- 300
DoSet(mbal_server, "MBAL.MB.TANK.OOIP", ooip)

Run the model

Run the prediction.

DoSlowCmd(mbal_server, "MBAL.MB.RUNPREDICTION")

Extract the results

And extract the first row of the table generated by the prediction.

# we get the oil rate from the first in the results table
DoGet(mbal_server, "MBAL.MB.TRES[2][0][0].OILRATE")