Level: Intermediate
Required Software : Pipesim
Required Knowledge: Basic Pipe-It knowledge, Scipting in VBS
Keywords: Pipesim Integration, Pipe Flow Calculations
Pipe-It Utilities: Pipe-It Process Elements, Pipe-It Tabulator
The objective of this tutorial is to integrate a simple Pipesim network model within Pipe-It, run it and extract the results from it.
The Pipesim model includes 4 oil wells producing in the same production network:
The first separator pressure is set to 600 psia (pressure in Sink_1).
In this tutorial, we will use Visual Basic to communicate with Pipesim through its COM library (called Openlink). Other object-oriented languages as Python, Java or C++ could be used as well. Note that only a few very basic methods and objects from Pipesim library will be used in this tutorial. The exhaustive list of objects, methods and properties of Pipesim COM library is included in the Open Link manual that you will found in the tutorial folder.
You can download the required input files here. You will need to login to the server using your existing uszername and password or register as new user.
Download the file : "PipeSim_Integration.zip" and un-zip it on your disk.
The folder contains two sub-folder (Starting Point and corrected solution). Open the sub-folder "Starting point".
You can open the Pipe-It project (.ppv file).
Create the Streamz library by adding the file from the folder "Characterizations".
Now, your Streamz library window should like as follows:
Note that this characterization is a dummy characterization as it does not containt any compositional information (no EOS model). However, thsi characterization is needed to be able to used Pipe-It Streamz process elements(copier and tabulator).
First, insert a new "Program" process element on the canvas by:
At that moment the canvas, should look like this:
To edit the sockets (inputs and outputs) of the process elements, select the process element ,right click on it and select "Edit Sockets and Connections...".
A new window appears :
To edit the socket called "INPUT", select it, then click on "Rename item", enter "VB Script" and click on "Ok".
Add a new input socket by:
Rename the new input socket "Pipesim Model".
now, rename the output socket "PNS File".
At that moment, the window should look as follows. Click on "Apply" and then on "Ok".
Add three resource elements on the canvasand link to the following files:
The canvas should like :
Now, connect the resource files to the process as follows:
The canvas should like :
Now, open the program scripter by:
A new window appears. In the section called "Script", write "CScript.exe". This executable will be used to interpret a Visual Basic script (VBS) that will open the Pipe Sim? Model and run it:
To add a new argument for the CScript executable, click on "Insert New Argument". A new window appears. Click on the first "Choose" button:
A new window appears. Click on "I1" and then click on "Insert":
Now, the scripter window should look like :
These operations allow to associate the first argument of the CScript executable to the file path connected to the socket "VB Script".
Re-do the same operations first for the Pipesim model (.bpn file) and then for the PNS file. In the end, the scripter window should look like :
You can now run the Pipe-It project. The VB script will open the Pipesim model and run it. Pipe-It will wait until the end of the Pipesim simulation. The simulation results are written by Pipesim in the PNS file. We will need to read this file.
Insert a new "Program" process element on the canvas.
Edit the sockets:
The socket configuration window should like this :
Insert two new resource elements and link them to the following files:
The file "OUT.str" being a STR file, it will need a characterization. Set the characetrization to "Rates".
Connect the files as follows:
Rename the process element "Read Pipesim Results". Now, the canvas should look like:
Configure the scripter as shown in the following figure:
You can run the Pipe-It project again. The VB script "Read_Results.vbs" will open the PNS file and read the well data (production rates) and then write them in the STR file "OUT.str".
You can now open the file "OUT.str". It should contain the following information extracted from Pipesim PNS file:
To compute the field production rates, we are going to use the "Tabulator" process element of Pipe-It:
Now, the canvas should look like this:
Double click on the tabulator element and configure it as follows :
You can now re-run the Pipe-It project.