Tutorial: Launch Pipesim from Pipe-It

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

Introduction

Objective

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:

Pipesim Model

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.

Getting Started

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".

Files inside the folder "Starting Point"

You can open the Pipe-It project (.ppv file).

Create the Streamz Library

Create the Streamz library by adding the file from the folder "Characterizations".

Now, your Streamz library window should like as follows:

Current status of the STreamz library window

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).

Run a Pipesim Model from Pipe-It

Insert a New Process Element

First, insert a new "Program" process element on the canvas by:

Insert a new process element

At that moment the canvas, should look like this:

Current statuts of the canvas

Configure the Sockets of the Process Element

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...".

Configure the sockets and connections

A new window appears :

Configure the sockets and connections

To edit the socket called "INPUT", select it, then click on "Rename item", enter "VB Script" and click on "Ok".

Configure the sockets and connections

Add a new input socket by:

Configure the sockets and connections

Rename the new input socket "Pipesim Model".

Configure the sockets and connections

now, rename the output socket "PNS File".

Configure the sockets and connections

At that moment, the window should look as follows. Click on "Apply" and then on "Ok".

Configure the sockets and connections

Add the Resource Elements

Add three resource elements on the canvasand link to the following files:

  1. ".\VBS Scripts\Runmodel.vbs"
  1. ".\Pipesim\Pipesim_model.bpn "
  1. ".\Pipesim\Pipesim_model.pns"

The canvas should like :

Current statuts of the canvas

Now, connect the resource files to the process as follows:

  1. Runmodel.vbs as "VB Script";
  1. Pipesim_model.bpn as "Pipesim Model";
  1. Pipesim_model.pns as "PNS file".

The canvas should like :

Current statuts of the canvas

Configure the Scripter

Now, open the program scripter by:

Open Scripter

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:

Configure the scripter

To add a new argument for the CScript executable, click on "Insert New Argument". A new window appears. Click on the first "Choose" button:

Configure the scripter

A new window appears. Click on "I1" and then click on "Insert":

Configure the scripter

Now, the scripter window should look like :

Configure the scripter

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 :

Configure the scripter

Run the Pipe-It Project

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.

Read Pipesim Outputs

Insert a new "Program" process element on the canvas.

Edit the sockets:

The socket configuration window should like this :

Configure the sockets and connections

Insert two new resource elements and link them to the following files:

  1. ".\VBS Scripts\Read_Results.vbs"
  1. ".\OUT.str" (This file does not exist yet, but will be created by Pipe-It.)

The file "OUT.str" being a STR file, it will need a characterization. Set the characetrization to "Rates".

Connect the files as follows:

  1. Read_Results.vbs as "VB Script"
  1. Pipesim_model.pns as "PNS file"
  1. OUT.str as "STR Output file"

Rename the process element "Read Pipesim Results". Now, the canvas should look like:

Current statuts of the canvas

Configure the scripter as shown in the following figure:

Configuration of the scripter for the process "Read Pipesim Results"

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:

STR file "OUT.str"

Compute the Field Production Rates

To compute the field production rates, we are going to use the "Tabulator" process element of Pipe-It:

  1. Insert a new tabulator on the canvas;
  1. Insert a new resource file on the canvas and link it to ".\Field_Rates.str";
  1. Set the characterization of "Field_Rates.str" to "RATES";
  1. Connect "OUT.str" to the tabulator as "INPUT STREAMS" and "Field_Rates.str" as "OUTPUT STREAMS";
  1. Rename the tabulator "Compute Field Production Rates".

Now, the canvas should look like this:

Current statuts of the canvas

Double click on the tabulator element and configure it as follows :

Configure the tabulator

You can now re-run the Pipe-It project.




Copyright © 2008-2013 Petrostreamz