29
7/27/2019 Server Interface http://slidepdf.com/reader/full/server-interface 1/29  The OLGA Server Interface Prepared by: Reviewed by: Approved by: Technical Note 37.010.008/TN-1,rev.18 March 09, 2010 SPT Group Norway AS P.O. Box 113, N-2027 Kjeller, Norway www.sptgroup.com Lars Hovden Andris Skattebo Kersti Ekeland Bjurstrøm Tel. + 47 64 84 45 50 Senior Principal Consultant Principal Consultant Section manager Fax. + 47 64 84 45 00  

Server Interface

Embed Size (px)

Citation preview

Page 1: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 1/29

 

The OLGA Server Interface

Prepared by: Reviewed by: Approved by: Technical Note 37.010.008/TN-1,rev.18March 09, 2010SPT Group Norway AS

P.O. Box 113, N-2027 Kjeller, Norwaywww.sptgroup.com

Lars Hovden Andris Skattebo Kersti Ekeland Bjurstrøm Tel. + 47 64 84 45 50Senior Principal Consultant Principal Consultant Section manager Fax. + 47 64 84 45 00 

Page 2: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 2/29

37.010.008/TN-1: The OLGA Server Interface Page i

March 09, 2010

TABLE OF CONTENTS 

Page

1.  INTRODUCTION 1 2.  THE METHOD FOR EXCHANGING INFORMATION 2 3.  MESSAGE DEFINITION 3 

3.1  Message Format 3 3.1.1  Byte Ordering 4 

3.2  OLGA server states 4 3.3  Message List 5 3.4  TAG Usage and Labeling System 12 3.5  OLGA Input 12 

3.5.1  General 12 3.5.2  Exchange of pressure and flow sensitivity information 13 3.5.3  Sensitivity information for pressure boundaries 13 3.5.4  Sensitivity information for sources 14 3.5.5  MEG Tracking model input 14 3.5.6  OLGA Server Input keywords 15 3.5.7  Example 18 

3.6  Output 19 3.6.1  General 19 3.6.2   Averaging of flow variables 19 3.6.3  Information regarding the OLGA system‟s flow and pressure sensitivity 20 3.6.4  Compositional information for MEG Tracking model 20 

4. 

COMMAND SEQUENCE 21 

5.  TIME SYNCHRONIZATION 23 APPENDIX A: OUTPUT VARIABLES 25 APPENDIX B: SERVER OUTPUT VARIABLE MAP FOR BACKWARDS COMPATIBILITY

WITH GENERIC VARIABLE NAMES 26 

Page 3: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 3/29

37.010.008/TN-1: The OLGA Server Interface Page 1

March 09, 2010

1. INTRODUCTION

This technical note defines the interface of a general OLGA-Server.

The information flow between the OLGA server and the client will consist of:

- Dynamically changing boundary conditions, i.e. all input keys which are definedas time series may be updated.

- Dynamically changing parameters, i.e. all input keys which usually are fixed, butfor example shall be used for tuning.

- Computational results from OLGA, i.e. variable at selected positions or distributions along the OLGA network branches

This information could be sent at every time step or when an update is required. In

addition information controlling the simulation process may be transmitted.

Page 4: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 4/29

37.010.008/TN-1: The OLGA Server Interface Page 2

March 09, 2010

2. THE METHOD FOR EXCHANGING INFORMATION

In general, a client-server model is regarded to be the most flexible connection. OLGAwill then run as a separate process and exchange information with the other moduledynamically. OLGA is regarded to be the server, providing computational services for the other simulator. This is the client, requesting services from OLGA when needed.The basic means of operation will be that the OLGA server program is started first bythe command:

olga -server <socket-name> [<offset>|<registry path>] [-no_rsw] [-stop3invalid]

There are 4 optional keys:  offset is an integer which increases the socket number related to the socket-name

according to the offset value. This can be used instead of specifying multipleservices/sockets explicitly in a services data file or in the registry.

  registry path can be used instead of  offset and is a text string with the registry

path where the socket-name is defined, e.g., software\\SPT Group (default value).The path must be under HKEY_CURRENT_USER.

  -no_rsw is a flag indicating that a restart file (*.rsw) should not be written during theserver run.

  -stop3invalid is a flag indicating that the server run should stop after 3 invalidnumbers (0/0, square root of negative number, etc) like in a batch run. Whenomitted the server will continue no matter how many invalid numbers. To countinvalid numbers the global trend variable NINVALID can be checked.

The client program must know the name of the computer and the socket that OLGAuses.

The two processes will communicate through the TCP/IP protocol. Regarding theimplementation in interactive simulators, this method will also facilitate good separationof two proprietary programs. When the communication protocol is well defined it ispossible to implement the OLGA part of the software without too much insight into thedetails of the other and vice versa.

The OLGA server will listen for incoming messages on the specified socket, obey andrespond to messages, and continue to do so until receiving a message with atermination request. When loosing an established connection with a client, the OLGAserver will terminate after writing the system state to a restart file.

Page 5: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 5/29

37.010.008/TN-1: The OLGA Server Interface Page 3

March 09, 2010

3. MESSAGE DEFINITION

3.1 Message Format

Each message sent between the OLGA server and the client has a fixed size messageheader. In the C programming language the header may be defined as

typedef struct {

char command[20];int body_size;

} Olga_mess_head;

In FORTRAN, one could for example use

Character*20 command

Integer*4 body_size

placed in a common block

Common/MESS/ command, body_size

The command may have up to 19 significant characters. It is stored as a zero-byteterminated character array (normal C convention). In FORTRAN, to place a text string,for example “OLGA_START” in command, one could use 

command = ‘OLGA_START’//char(0) 

There should be no blanks before or in the command string or between the commandstring and the terminating null-character.

The integer body_size tells the size, in bytes, of the data following the messageheader. This body of the message is interpreted according to the command string. Thebody data types are:

- A file name: A zero-byte terminated character string.

- A name list: A character string with a list of variable names. Each name in the list is a

consecutive sequence of bytes identified by the “isprint” C-function. Each name isseparated by one or more bytes identified by the “isspace” C-function or notrecognised by “isprint”. The search for names in the list terminates when the endof the body data has been reached, or when the first zero byte is encountered.The name list may contain tag information. The practical way of satisfying the“isprint” and “isspace” functions, is to use the regular blank space character asseparator and only printable ASCII characters in names.

- A size list: An array of integers (each 4 bytes). The number of element in the array shouldbe the same as the number of names in the corresponding name list. Each

integer tells the size of the corresponding variable in the name list. Note that a 4byte integer is binary, not formatted.

Page 6: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 6/29

37.010.008/TN-1: The OLGA Server Interface Page 4

March 09, 2010

- A real list: An array of floating point values, each element 4 bytes. The array is theconcatenation of all the values (vectors) for the keywords in theOLGA_INP_NAMES name list, in the same sequence as the names appear inthe list. The number of elements in the array should be equal to the sum of thecorresponding size list.

- An OLGA input keyword: A newline+zero terminated character string. The character string should have thesame syntax as the keyword syntax defined for a standard input file. See theOLGA User's Guide, ch. 3.

3.1.1 Byte Ordering

 All int (long) and float shall in principle go through the conversion function htonl before

being sent to the network and through ntohl after being received from the network.Between two HP-computers, this will not be necessary.

3.2 OLGA server states

In order to improve the exception handling in OLGA server, OLGA Server states areintroduced in OLGA2000 version 4.00.

The following OLGA Server states are defined:Startup OLGA Server is started, no input file is loaded etc.

Input file loaded Input file is successfully loaded but the model is notinitialized

Initialized Input file successfully loaded and initialized

In subsequent versions new states may be defined. Some of the OLGA client to server messages introduce a transition from one state to another. In addition some of themessages are not valid in all states. To ensure that OLGA Server is backwardcompatible, strict test on the states for each of the client to server messages is notpossible. But still we are able to detect some of the most common errors when usingOLGA Server.

Page 7: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 7/29

37.010.008/TN-1: The OLGA Server Interface Page 5

March 09, 2010

Figure 3.1. OLGA Server states/modes.

3.3 Message List

In Table 3.1 the client to server message definition is described. The first column givesthe message header command string. All messages headers start with the charactersOLGA_, so that they will not be confused with potential other messages that may beinvented for other purposes, cf. Table 3.1 and Table 3.2. The second column describesthe body of the message. The third column describes what actions the server (OLGA)will take and what the response to the message will be. The fifth column defines which

server state the message is valid in. Any transition to a new state is indicated by ->followed by the new state. A state transition occurs if OLGA_OK is sent back or if OLGA_ERROR is sent back and the body of the OLGA_ERROR message starts with"warning".

Table 3.1 OLGA Client to Server Message Definition

Message Body Actions Response Mode/StateOLGA_READ_INPUT OLGA input filename,

zero terminatedcharacter string

OLGA will read theinput file

The messageOLGA_OK will be sentback when the input fileis read, otherwiseOLGA_ERROR is sentback

Startup->

Input file loaded

OLGA_INITIALIZE - OLGA will performthe initialization

The messageOLGA_OK will be sentback when theinitialization is complete,otherwiseOLGA_ERROR is sentback

Input file loaded->

Initialized

OLGA_START OLGA input filename,zero terminatedcharacter string

OLGA will read theinput file andperform theinitialization. Toobtain better messages, it isrecommended touse the two other commands.

The messageOLGA_OK will be sentback when the input fileis read and theinitialization is complete,otherwiseOLGA_ERROR is sentback.

Startup->

Input file loaded->

Initialized

Initialized

Startup

Input fileloaded

By stopping andrestarting OLGAOLGA_STOP_SERVER

OLGA_READ_INPUT

OLGA_INITIALIZEOLGA_LOAD_SNAP

OLGA_START

Page 8: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 8/29

37.010.008/TN-1: The OLGA Server Interface Page 6

March 09, 2010

Message Body Actions Response Mode/StateOLGA_SIM_STEP - OLGA will simulate

one time step aheadThe messagesOLGA_OUTTR_DATAandOLGA_OUTPR_DATAwill be sent back when

the time step has beensimulated. In addition,OLGA_ERROR may besent back

Initialized

OLGA_GETTR_RESULT - OLGA will send aresponse

The messageOLGA_OUTTR_DATAwill be sent back.

any

OLGA_GETPR_RESULT - OLGA will send aresponse

The messageOLGA_OUTPR_DATAwill be sent back.

any

OLGA_STOP_SERVER - The server will stop,closing allconnections

- any

OLGA_SAVE_SNAP A restart file name A snapshot will bewritten to the restartfile

The messageOLGA_OK will be sentback when writing is

completed, otherwiseOLGA_ERROR is sentback

Initialized

OLGA_LOAD_SNAP A restart file name A snapshot will beloaded from therestart file

The messageOLGA_OK will be sentback when reading iscompleted, otherwiseOLGA_ERROR is sentback

any->

Initialized

OLGA_DELETE_SNAP A restart file name A restart file will bedeleted

The messageOLGA_OK will be sentback when the file isdeleted, otherwiseOLGA_ERROR is sentback

any

OLGA_PRINT - State information willbe printed onOLGA‟s normalOUTPUT plot file

- any state but it isonly in initializedthis message ismeaningful

OLGA_TREND_PLOT - State information willbe written onOLGA‟s TREND plotfile

- any state but it isonly in initializedthis message ismeaningful

OLGA_PROFILE_PLOT - State information willbe written onOLGA‟s PROFILEplot file

- any state but it isonly in initializedthis message ismeaningful

Page 9: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 9/29

37.010.008/TN-1: The OLGA Server Interface Page 7

March 09, 2010

Message Body Actions Response Mode/StateOLGA_KEYWORD_INPUT An OLGA input

keyword. Currently,only the followingkeywords areavailable in the server 

interface:BITNODEBOUNDARYCOMPRESSORCONTROLLERCORROSIONCROSSSECTIONHEATEXCHANGERHEATTRANSFERINITIALCONDITIONSPLUGPOSITIONPUMPSHUTINSLUGTRACKINGSOURCE

TABLETUNINGWELL

OLGA will parse thekeyword statementsand update the caseinformation, similar to the actions

performed when thekeywords are givenin an input file.

TABLE can only bedefined with LABELand one POINT,meaning that theexisting POINT withthe closest x-valuewill be updated.

CONTROLLERdoesn‟t have to haveall subkeys. For anexisting controller 

where TYPE is notchanged, only thegiven subkeys willbe updated and thestate is kept.

The messageOLGA_OK will be sentback if the keywordstatement has beenprocessed successfully,

otherwiseOLGA_ERROR is sentback

Input file loadedor initialized

OLGA_INP_NAMES A name list. Thenames identify thekeywords / keys for which the clientwishes to send valuesto the server.

Remembered by theserver until replacedby the client

The messageOLGA_OK or OLGA_ERROR is sentback

Input file loadedor initialized

OLGA_INP_SIZES A size list. The sizesare for the arrayscorresponding to thename list in theOLGA_INP_NAMES

command.

Remembered by theserver until replacedby the client

The messageOLGA_OK or OLGA_ERROR is sentback

Input file loadedor initialized

OLGA_INP_DATA An array of floatingpoint values, eachelement 4 bytes. Thearray is theconcatenation of allthe values (vectors)corresponding to thekeywords in theOLGA_INP_NAMESname list, in the samesequence as thenames appear in thelist.

Data is stored in thecorrespondinginternal OLGAvariables

- Input file loadedor initialized

OLGA_OUTTR_NAMES A name list. Thenames identify the

variables for which theclient wishes toreceive TRENDvalues from theserver.

Remembered by theserver until modified

by the client

The messageOLGA_OUTTR_SIZES

or OLGA_ERROR issent back

Input file loadedor initialized

OLGA_OUTPR_NAMES A name list. Thenames identify thevariables for which theclient wishes toreceive PROFILEvalues from theserver.

Remembered by theserver until modifiedby the client

The messageOLGA_OUTPR_SIZESor OLGA_ERROR issent back

Input file loadedor initialized

OLGA_SENDTR_NAMES A name list. Thenames identify thevariables for which theclient wishes to

receive values fromthe server immediately.

Response is sent tothe client only once.

The messageOLGA_SENDTR_SIZESand thenOLGA_SENDTR_DATA

sent back to the client

Initialized

Page 10: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 10/29

37.010.008/TN-1: The OLGA Server Interface Page 8

March 09, 2010

Message Body Actions Response Mode/StateOLGA_SENDPR_NAMES A name list. The

names identify thevariables for which theclient wishes toreceive values from

the server immediately.

Response is sent tothe client only once.

The messageOLGA_SENDPR_SIZESand thenOLGA_SENDPR_DATAsent back to the client

Initialized

OLGA_NEW_OUTFILES New output file rootname (common namefor tabulated , trendplot and profile plotoutput files)

Closing former output files.Renaming outputfiles - Adding/replacing extensions(tabulated output:.out, trend output:.tpl, profile output:.ppl) Standardheader is written tonew .tpl and .pplfiles.

The messageOLGA_OK or OLGA_ERROR is sentback.

any

OLGA_SET_TIME A floating pointnumber, 4 bytes,

giving the simulationtime.

Sets OLGA‟sintegration time

variable T.

- any

OLGA_GET_TIME - A response is sentback to the client.

The messageOLGA_OUT_TIME issent back

any

OLGA_SET_TEND A floating pointnumber, 4 bytes,giving the simulationend time.

Sets OLGA‟s endtime variable. Thenext OLGA_ SIM_STEPcommand will thenintegrate exactly upto the specified time.

The messageOLGA_OK or OLGA_ERROR withwarning is sent back

any

OLGA_RESET_TEND A floating pointnumber, 4 bytes,giving the simulationend time or nothing at

all

Sets OLGA‟s endtime variable. Thenext OLGA_ SIM_STEP

command will thenintegrate exactly upto the specified time.If the end integrationtime is not sent fromthe client, that is thebody_size is 0 thenend integration timeis set equal to TIME

The messageOLGA_OK is sent back

The difference between

OLGA_RESET TENDand OLGA_SET_TENDis:

1) accepts a bodyof size zero

2) No warning issent back if TEND <=TIME

any

OLGA_GET_STEP - A response is sentback to the client.

The messageOLGA_OUT_STEP issent back

any

OLGA_PIG_LAUNCH Empty body, that is anempty string body size= 0 or a defined PLUGlabel as a zero

terminated character string

If the body is empty.The first pig in thedefined piglist, whichis available for 

launching or re-launch, is launched.

If the body specifiesan PLUG label andthe PLUG is notlaunched then it islaunched

The messageOLGA_OK or OLGA_ERROR is sentback

any

OLGA_PING - A response is sentback to the client

The OLGA_PONGmessage is sent back

any

Page 11: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 11/29

37.010.008/TN-1: The OLGA Server Interface Page 9

March 09, 2010

Message Body Actions Response Mode/StateOLGA_ENABLE_HALT A floating point

number, 4 bytes,giving the number of OLGA timesteps thatshould be taken

between each time theprogram listens for theOLGA_HALTmessage

Sets OLGA variableHALT whichindicates that OLGAshould listen for OLGA_HALT

message. NHALT isset to the number of time steps takenbetween each timethe program listensfor the OLGA_HALTmessage. HALT isreset at the first exitfrom the OLGAintegration

The messageOLGA_OK or OLGA_ERROR is sentback.

any

OLGA_HALT - Sets OLGA‟s endtime variable equalto the present time.The program willreturn to listenstatus.

- any

OLGA_INPUT_LOG_ON OLGA log file name,zero terminatedcharacter string

OLGA will write allincoming messagesto an log file

If OLGA is able to openthe log file the messageOLGA_OK will be sentback, otherwiseOLGA_ERROR is sentback

any

OLGA_INPUT_LOG_OFF - OLGA will stoplogging inputmessages and closethe input log

OLGA_OK will be sentback if input logging ison and the input log fileis closed correctlyotherwiseOLGA_ERROR is sentback

any

OLGA_TEST_ON - OLGA will startprinting debuginformation to

terminal window

- any

OLGA_TEST_ON - OLGA will stopprinting debuginformation toterminal window

- any

OLGA_GET_LABEL_LIST OLGA keyword aszero terminatedcharacter string. Thefollowing keywordsare implementedBRANCHCHECKVALVECOMPONENTCOMPRESSORCONTROLLERFEED_SOURCE

FEED_BOUNDARYHEATEXCHANGERMATERIALNODEPOSITIONPOSITION_BOUPOSITION_VOLPUMPSEPARATORSOURCEVALVEWALLWELL

OLGA will send azero terminated ASCII string thatcontain the labels for the desired keyword.The labels areseparated by space.

FEED_SOURCEandFEED_BOUNDARY

will send SOURCEand BOUNDARYlabels ($”label”)respectively, with therelated FEED labelsfollowing eachSOURCE or BOUNDARY label.

OLGA_LABEL_LIST or OLGA_ERROR will besent back

Input file loadedor initialized

OLGA_LOCAL_DERIV - OLGA will calculatethe derivativeswithout including the

influence of derivatives from theclient

The messageOLGA_OK or OLGA_ERROR is sent

back

any

Page 12: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 12/29

37.010.008/TN-1: The OLGA Server Interface Page 10

March 09, 2010

Message Body Actions Response Mode/StateOLGA_GLOBAL_DERIV - OLGA will calculate

the derivativesincluding theinfluence of derivatives from the

client

The messageOLGA_OK or OLGA_ERROR is sentback

any

OLGA_GET_HYD_CURVE X $<branch or positionlabel>, where X canbe omitted, a MEGfraction (between 0and 1), or equal PT or TM.

Ex.:0.1 $BRANCH-1$BRANCH-1PT $BRANCH-1$POSITION-1

OLGA will calculatethe hydrate curve for a given/calculatedMEG fraction, andalso calculate MEGfraction, PT, TM,MDTHYDC /MDPHYDC,MDTPOSC /MDPPOSCdepending on body.

If position label isgiven then thebranch where this

position is placed isused, for all other body types thanwhen X is omitted.

The messagesOLGA_HYD_SIZES andOLGA_HYD_CURVE issent back.

OLGA will return withhydrate curve (PT andTM) for the MEGfraction, and the MEGfraction for all bodytypes.

The MEG fraction isgiven if X is a number,and calculated as

average in branch or found in the position if omitted. If X equals PTor TM it is found in thesection whereMDPHYDC or MDTHYDC is found,respectively.

If X equals PT or TM, PTand TM are found whereMDPHYDC or MDTHYDC is found, andreturned. Also,MDPHYDC or MDTHYDC and

MDPPOSC or MDTPOSC is calculatedand returned.

Input file loadedor initialized

Table 3.2 OLGA Server to Client Message Definition

Message Body Actions Initiated by

OLGA_OUTTR_SIZES A size list. The sizes arefor the variables in thename list in theOLGA_OUTTR_NAMEScommand.

- - OLGA_OUTTR_NAMES

OLGA_OUTTR_DATA An array of floating pointvalues, each element 4bytes. The array is theconcatenation of all thevalues (vectors) for thevariables in theOLGA_OUTTR_NAMESname list, in the samesequence as the namesappear in the list.

- - OLGA_OUTTR_NAMES

OLGA_OUTPR_SIZES A size list. The sizes arefor the variables in thename list in theOLGA_OUTPR_NAMEScommand.

- - OLGA_OUTPR_NAMES

Page 13: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 13/29

37.010.008/TN-1: The OLGA Server Interface Page 11

March 09, 2010

Message Body Actions Initiated by

OLGA_OUTPR_DATA An array of floating pointvalues, each element 4bytes. The array is theconcatenation of all the

values (vectors) for thevariables in theOLGA_OUTPR_NAMESname list, in the samesequence as the namesappear in the list.

- OLGA_OUTPR_NAMES

OLGA_SENDTR_SIZES A size list. The sizes arefor the variables in thename list in theOLGA_SENDTR_NAMES command.

- - OLGA_SENDTR_NAMES

OLGA_SENDTR_DATA An array of floating pointvalues, each element 4bytes. The array is theconcatenation of all thevalues (vectors) for thevariables in theOLGA_SENDTR_NAMES name list, in the samesequence as the namesappear in the list.

- - OLGA_SENDTR_NAMES

OLGA_SENDPR_SIZES A size list. The sizes arefor the variables in thename list in theOLGA_SENDPR_NAMES command.

- - OLGA_SENDPR_NAMES

OLGA_SENDPR_DATA An array of floating pointvalues, each element 4bytes. The array is the

concatenation of all thevalues (vectors) for thevariables in theOLGA_SENDPR_NAMES name list, in the samesequence as the namesappear in the list.

- - OLGA_SENDPR_NAMES

OLGA_OUT_TIME A floating point number, 4bytes, giving thesimulation time for theserver.

- - OLGA_GET_TIME

OLGA_OUT_STEP A floating point number, 4bytes, giving thesimulation time step that

will be used by theserver.

- - OLGA_GET_STEP

OLGA_PONG - - - OLGA_PINGOLGA_ERROR Zero-byte terminated

character string with theerror message. The firstline of the body containsthe error type, i.e. thestring warning: or error:. 

- - Most of the clientmessages can returnOLGA_ERROR

OLGA_OK - - - Most of the clientmessages can returnOLGA_OK

OLGA_LABEL_LIST Zero-byte terminatedcharacter string

containing the definedlabels for the requestedkeyword

- OLGA_GET_LABEL_LIST

Page 14: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 14/29

37.010.008/TN-1: The OLGA Server Interface Page 12

March 09, 2010

Message Body Actions Initiated by

OLGA_HYD_SIZES A size list (3 or 7integers). The sizes arefor the variables in thename list in the

OLGA_GET_HYD_CURVE command. The twofirst are n (number of points in hydrate curve),while the rest is 1.

- - OLGA_GET_HYD_CURVE

OLGA_HYD_CURVE An array of floating pointvalues, each element 4bytes. The array is theconcatenation of all thevalues initiated byOLGA_GET_HYD_DURVE. 1 to n: hydratepressures, n+1 to 2*n:hydrate temperatures,2*n+1: MEG fraction,2*n+2: pressure, 2*n+3:temperature, 2*n+4:MDPHYDC or MDTHYDC, 2*n+5:MDPPOSC or MDTPOSC. “n” isnumber of points inhydrate curve.

- - OLGA_GET_HYD_CURVE

3.4 TAG Usage and Labeling System

For messages where the body consists of a name list a tag and labeling system isavailable. This may be used for identification of nodes, pipeline branches, boundaryconditions, mass sources, controllers, etc. A character string can be assigned to aname list item by inserting $ followed by the string or label in front of the name list item.The label may not contain blanks as the label is separated from the name by blanks. If there is no label in front of a name, it will inherit the label given earlier in the name list.

3.5 OLGA Input

3.5.1 General

In addition to information controlling the simulation process, dynamically changing

boundary conditions and several other pipeline system parameters may be transmittedto the OLGA server. This means that input keys which are defined through a timeseries may also change dynamically through the communication protocol. Additionally,the boundary conditions at a terminal node may be changed from PRESSURE (1.0) toCLOSED (2.0) and vice versa and a plug may be launched.

The body of the message OLGA_INP_NAMES consist of a name list with labeled itemswhich equal OLGA input keywords. An overview is given in Table 3.3. The input keysdefine the sequence in the OLGA_INP_DATA message, which consists of theconcatenation of all the values for the input keys corresponding to the keywords in theOLGA_INP_NAMES name list. The keys and their default units are explained in theOLGA User's Manual. The initial values for the keys are given in the OLGA input file.

In addition, input for flow-pressure sensitivity for the client model and a set of tuningparameters are defined, which may be of interest especially for on-line applications.

Page 15: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 15/29

37.010.008/TN-1: The OLGA Server Interface Page 13

March 09, 2010

The use of flow-pressure sensitivity information from the client model are described insections 3.5.2, 3.5.3, 3.5.4 and Table 3.3. The tuning parameters are given in Table3.3. 

When using the message OLGA_KEYWORD_INPUT, the body should contain akeyword statement according to the syntax rules described in the OLGA User'sManual. Please note that a keyword statement must be given as a single line(continuation marks (\) are not allowed). The keywords available through this messageare listed in Table 3.1

3.5.2 Exchange of pressure and flow sensitivity information

The OLGA server and the client simulators are explicitly coupled for pressureboundaries and sources. Sudden jumps in coupled boundary conditions whenupdating/synchronizing the simulators might cause numerical instabilities.

 Additional information regarding the sensitivity of flow with respect to boundarypressure changes and vice versa can be exchanged between OLGA and the client atevery synchronization time (See Chapter 5 for more information about synchronizationtime). The information, in form of derivatives, is used when integrating in time. This canimprove the numerical stability in case of transients at the coupled boundaries, as theeffects of changes in the boundary conditions on the OLGA and the client systems areseen by the client and OLGA, respectively.

The client sensitivity information is sent through special input keywords describedbelow.

The client may obtain the sensitivity information from OLGA by using standard outputrequest messages, see section 3.6.3 and App. A.

3.5.3 Sensitivity information for pressure boundaries

For coupled pressure boundaries (BOUNDARY TYPE=1.0), OLGA may receive thederivative of pressure with respect to flow for gas, oil and water, P/Gg (DPDGG),P/Glthl (DPDGLTHL), P/Gltwt (DPDGLTWT). The information is given through theitem/keyword BOUNDARY_DERIV (see Table 3.3).

The derivatives are taken to be zero when not given.

The derivatives will be used in the integration of the boundary pressure in OLGA ateach OLGA time step:

},,{;)( 11 ltwt lthl  g  jGGG

 P  P  P 

i j

n

 j

n

 j

 j

n

i

n

i

 

 

 

 

 

where:

P is instantaneous value for pressure [Pa] G is either average or instantaneous flowrate [kg/s]. Averaging is controlled by

switch in BOUNDARY_DERIV keyword, see Table 3.3

Superscript indicates internal OLGA time step number 

Subscript i indicates boundary number  Subscript j indicates phase (g: gas, lthl: oil, ltwt: water)

Page 16: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 16/29

37.010.008/TN-1: The OLGA Server Interface Page 14

March 09, 2010

When used in the momentum and volume equations in OLGA, the flow is expressedas: G j

n+1 = m jn U j

n+1 A ; j = {g,lthl,ltwt}, where m is specific mass, U is velocity(instantaneous value) and A is cross-sectional area. Instantaneous values are used inthe momentum and volume equations, as average values for the solved variables (Uand P) are not available.

The oil and water mass flows are treated separately as droplet and liquid film flows.The gas velocity is used instead of droplet velocity when estimating the change indroplet mass flow. The mixture liquid film velocity is used when estimating the changein oil and water liquid film mass flow. This is done to incorporate the pressure changeterms in the existing set of transient momentum and volume/pressure equations, whichare solved for gas and liquid mixture velocities and pressure.

3.5.4 Sensitivity information for sources

The same principle as described for coupled pressure boundaries are applied to

coupled sources. OLGA may receive derivatives of gas, oil and water flow with respectto pressure for coupled sources, Gg/P (DGGDP), Glthl/P (DGLTHLDP) and Gltwt/P(DGLTWTDP). The information is given through the item/keyword SOURCE_DERIV(see Table 3.3).

The derivatives are taken to be zero when not given.

The derivatives will be used in the integration of the source mass flows in OLGA:

},,{);( 1,

,

1

, ltwt lthl  g  j P  P  P 

GGG n

i

n

i

i

 jin

 ji

n

 ji

 

3.5.5 MEG Tracking model input

The input keywords BOUNDARY_MEG and SOURCE_MEG allow the client to specifythe MEG content in the water phase. Note that:

1. The WATERFRACTION specified by the BOUNDARY and SOURCE keywords areignored

2. The sequence should not matter 3. The TOTALWATERFRACTION and the TOTALMEGFRACTION must be specified

Example:

Message BodyOLGA_INP_NAMES $MEG_1 SOURCE $MEG_1 SOURCE_MEGOLGA_INP_SIZES 5 2OLGA_INP_DATA 0 5.0 1e5 14 0.5 1.0 0.3

THE OLGA_INP_NAMES and OLGA_INP_SIZES is used to address the variables inthe source labeled MEG_1. The message OLGA_INP_DATA is used to send the data,i.e. specifying:

1. GASFRACTION2. MASSFLOW3. PRESSURE (only used if DIAMETER is specified).4. TEMPERATURE5. WATERFRACTION (ignored when SOURCE_MEG is used once)

Page 17: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 17/29

37.010.008/TN-1: The OLGA Server Interface Page 15

March 09, 2010

6. TOTALWATERFRACTION (water + MEG)7. TOTALMEGFRACTION

Note that the water fraction of 0.5 (the fifth input number) is replaced byTOTALWATERFRACTION equal to 1.0 specified by the SOURCE_MEG group.

3.5.6 OLGA Server Input keywords

Table 3.3 OLGA Server Input Keyword

Name list item /Input keyword

Tag Input keys Comment

BOUNDARY terminal nodelabel

TYPEGASFRACTIONPRESSURETEMPERATUREWATERFRACTION

to be given in floating point (1.0 or 2.0)keyword only for TYPE = 1.0keyword only for TYPE = 1.0keyword only for TYPE = 1.0keyword only for TYPE = 1.0NOTE ! BOUNDARY will be ignored if OPTION COMPTRACK = ON. UseBOUNDARY_COMP in this case.

BOUNDARY_MEG terminal nodelabel

TOTALWATERFRACTIONTOTALMEGFRACTION

WATERFRACTION from BOUNDARYwill be ignored.

BOUNDARY_COMP terminal nodelabel

TYPEPRESSURETEMPERATUREGASFRAQEQOILFRACEQWATERFRACEQMASS_MOLFEEDFRAC(1)MOLEFRACTION(1,1).

.MOLEFRACTION (1,NC)..FEEDFRAC(NF) )MOLEFRACTION (NF,1)..MOLEFRACTION (NF,NC)

1.0: PRESSURE, 2.0: CLOSEDkeyword only for TYPE = 1.0keyword only for TYPE = 1.0keyword only for TYPE = 1.0keyword only for TYPE = 1.0keyword only for TYPE = 1.0keyword only for TYPE = 1.0keyword only for TYPE = 1.0

NF: Number of feeds at boundary

NC: Number of components

FEEDFRAC:= FEEDMASSFRAC;MASS_MOL = 0 or 2= FEEDMOLFRAC;MASS_MOL = 1 or 3

MOLEFRACTION: Component molefraction in feed

NOTE! MOLEFRACTION can only begiven if MASS_MOL=2 or 3. If MASS_MOL is changed during a

simulation, make sure thatOLGA_INP_SIZES is consistent withMASS_MOLE setting.

NOTE 2! If any MOLEFRACTION < 0 itis set to 0. If all mole fractions aregiven as zero or negative, eachcomponent is given the same molefraction.

Page 18: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 18/29

37.010.008/TN-1: The OLGA Server Interface Page 16

March 09, 2010

Name list item /Input keyword

Tag Input keys Comment

BOUNDARY_COMP_PHASE

Terminal nodelabel

PRESSURETEMPERATUREGASCOMPMASS(1)

..GASCOMPMASS(NC)OILCOMPMASS(1)..OILCOMPMASS(NC)WATCOMPMASS(1)..WATCOMPMASS(NC)

Only for Compositional Tracking. Dataonly used for NODE TYPE =PRESSURE.

NC: Number of components

GASCOMPMASS(i): Specific mass of component i in gas phaseOILCOMPMASS(i): Specific mass of component i in oil phaseWATCOMPMASS(i): Specific mass of component i in water phase

The specific masses are for a controlvolume adjacent to the pressureboundary, but outside the OLGAmodel. Negative masses are set to 0.

BOUNDARY_DERIV terminal node

label

 AVERAGE_FLOW

DPDGGDPDGLTHLDPDGLTWT

 AVERAGE_FLOW = 0.0: No averaging

 AVERAGE_FLOW /= 0.0: Averagingflow variables used in client/server interface

COMPRESSOR compressor label

TEMPERATURE Only for COOLER = ON

CONTROLLER controller referencename

SETPOINT[AMPLIFICATION][INTEGRALCONST][DERIVATIVECONST]

Only for TYPE = MANUAL or TYPE =PIDFor type PID: Either only SETPOINT or all input keys must be given.

CONTROLLER_MODE controller referencename

MODE (1-5)[MANUALSETPOINT][EXTSIGNCONTROLLER][EXTSETPCONTROLLER]

Only the first key is required. All keysmust be given if EXTSETPCONTROLLER is used, thefirst 2 keys must be given if 

MANUALSETPOINT is used, etc.For MODE = 2 (MANUAL) and MODE= 3 (EXTERNALSIGNAL),MANUALSETPOINT andEXTSIGNCONTROLLER are ignoredfor TYPE = ESD and PSV.

HEATEXCHANGER heatexchanger label

TEMPERATURECAPACITY

Only the first key is required.TEMPERATURE must be given if CAPACITY is to be specified.

INTEGRATION - MINDTMAXDT

--

LEAK leak label BACKPRESSURE -

MATERIAL material label CONDUCTIVITYCAPACITY

DENSITY

 Affects the properties for all PIPEs,LINEs, BUNDLEs and

CROSSSECTIONs using the specifiedMATERIAL

PLUG plug label launch indicator, 1 or 0[LEAKAGEFACTOR]

Launch plug if launch indicator =1,otherwise: launch indicator =0

REROUTE branch label TO -

SEPARATOR separator label GASBACKPRESSUREOILBACKPRESSUREWATBACKPRESSURE

Only for TRAIN = OILOnly for TRAIN = GASOnly for PHASE = THREE

SOURCE source label GASFRACTIONMASSFLOWPRESSURETEMPERATUREWATERFRACTION

MASSFLOW unused if DIAMETER isgiven for this source in the input file.NOTE ! SOURCE will be ignored if OPTION COMPTRACK = ON. UseSOURCE_COMP in this case.

SOURCE _MEG source label TOTALWATERFRACTIONTOTALMEGFRACTION WATERFRACTION from SOURCE willbe ignored.

Page 19: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 19/29

37.010.008/TN-1: The OLGA Server Interface Page 17

March 09, 2010

Name list item /Input keyword

Tag Input keys Comment

SOURCE_COMP source label TEMPERATUREGASFRAQEQOILFRACEQ

WATERFRACEQMASS_MOLFEEDFLOW(1)MOLEFRACTION (1,1)..MOLEFRACTION (1,NC)..FEEDFLOW(NF)MOLEFRACTION (NF,1)..MOLEFRACTION (NF,NC)

Cannot be used for source with valve(DIAMETER or TABLE given)

NF: Number of feeds at sourceNC: Number of components

FEEDFLOW:= FEEDMASSFLOW;MASS_MOL = 0 or 2= FEEDMOLFLOW;MASS_MOL = 1 or 3

MOLEFRACTION: Component molefraction in feed

NOTE! MOLEFRACTION can only begiven if MASS_MOL=2 or 3. If MASS_MOL is changed during a

simulation, make sure thatOLGA_INP_SIZES is consistent withMASS_MOLE setting.

NOTE 2! If any MOLEFRACTION < 0 itis set to 0. If all mole fractions aregiven as zero or negative, eachcomponent is given the same molefraction.

SOURCE_COMP_PHASE

source label PRESSURETEMPERATUREPHASECOMPMF(1).

.COMPMF(NC)

Only for Compositional Tracking.Cannot be used for source with valve(DIAMETER or TABLE given)

NC: Number of components

PHASE: 1 (gas), 2 (oil), 3 (water)

COMPMF(i): Massflow of component iin given phase. All massflows mustnegative or 0, or positive or 0. If bothpositive and negative values thecommand is ignored.

SOURCE_DERIV source label DGGDPDGLTHLDPDGLTWTDP

-

SOVA_COMP source label PRESSURETEMPERATUREGASFRAQEQOILFRACEQ

WATERFRACEQMOLEFRACTION (1)..MOLEFRACTION (NC)

Only for Compositional Tracking andsource with valve (DIAMETER or TABLE given)

NC: Number of components

MOLEFRACTION (i): Molefractions of component i.

NOTE! The molefractions must begiven in the component sequence asgiven by the messageOLGA_GET_LABEL_LIST.

NOTE 2! If any MOLEFRACTION < 0 itis set to 0. If all mole fractions aregiven as zero or negative, eachcomponent is given the same molefraction.

TEND - ENDTIME Sets the end time (s)

TIME - TIME Sets the time (s) of the simulation

Page 20: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 20/29

37.010.008/TN-1: The OLGA Server Interface Page 18

March 09, 2010

Name list item /Input keyword

Tag Input keys Comment

TRACESOURCE tracesourcelabel

MASSFLOW AGERESIDENCETIME

-

TUNE_DIAMETERTUNE_ENTRAINMENTTUNE_LAM_LGITUNE_LAM_WOITUNE_OIL_DENSTUNE_LIQ_VISCTUNE_MASSTRANSTUNE_ROUGHNESSTUNE_TEMP_AMBTUNE_TAMB_ABSTUNE_WAT_DENS

branch label“ “ “ “ “ “ “ “ “ “ 

Tuning factor, default 1“ “ “ “ “ “ “ “ “ “ 

pipe diameter entrainment rateliquid-gas interfacial friction factor water-oil interfacial friction factor oil density in liquid phasetotal liquid viscositymass transfer ratepipe wall roughnessambient temperature, Celsius scaleambient temperature, Kelvin scalewater density

VALVE valve label OPENING -

WELL well label AINJ APROD

BINJBPRODGASFRACTIONRESPRESSURERESTEMPERATUREWATERFRACTION

-

3.5.7 Example

To specify that you want to send to OLGA the boundary condition at terminal nodeoutlet , and the mass flow at the inlet where you have defined a source inlet , in thatsequence, use the following name list in the OLGA_INP_NAMES message:

$outlet BOUNDARY $inlet SOURCE

This will be followed by sending the message OLGA_INP_SIZES with the body

5 5

The actual data may be sent repeatedly during the simulation, usingOLGA_INP_DATA. The body will consist of an array of 10 floating point elementscontaining values for the keys TYPE, GASFRACTION, PRESSURE, TEMPERATURE,WATERFRACTION, GASFRACTION, MASSFLOW, PRESSURE, TEMPERATURE,WATERFRACTION, in that sequence. For positive flow at the outlet , the values for GASFRACTION, TEMPERATURE and WATERFRACTION will be ignored.

Page 21: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 21/29

37.010.008/TN-1: The OLGA Server Interface Page 19

March 09, 2010

3.6 Output

3.6.1 General

OLGA results can be transferred in two different ways:

- At specific locations defined by the POSITION keyword, at specific nodes(terminal, merge or split) defined by the NODE label or for specific equipmentidentified by its label. This is analogous to the TREND plot command. Globalvariables do not require a tag.

- As distributions for whole branches, similar to the PROFILE plot command. Allvariables available for PROFILE plotting can be requested. For volume variablesthe number of elements in the vector is equal to the number of computationalvolumes in the branch, for boundary variables it is equal to the number of boundaries, i.e. increased by 1.

Nearly all variables listed in Appendix A of the OLGA User‟s Manual are available for output. Exceptions and special cases are described in Appendix A and B of this note.

For output at two specific locations ( position-1 and position-2 ) and for the valve valve-1 the name list of the OLGA_OUTTR_NAMES or OLGA_SENDTR_NAMES may for example contain:

$position-1 AL PT $position-2 WG WLT $valve-1 PVALVE ...

For distributions along two branches, the name list of the OLGA_OUTPR_NAMES or OLGA_SENDPR_NAMES may show:

$branch-1 AL PT $branch-2 WG WLT ...

For output at two nodes (OUTLET  and MERGE ) name list of theOLGA_OUTTR_NAMES or OLGA_SENDTR_NAMES may for example contain:

$OUTLET GG GT $MERGE HOL TM ...

3.6.2 Averaging of flow variables

 As OLGA may use smaller time steps than the client, the instantaneous values might

not be representative for the coupled system if the OLGA system exhibits fluctuationsat high frequencies.

When averaging is activated through the BOUNDARY_DERIV keyword, OLGA will besending averaged flow values for the sync interval when requested through themessage OLGA_OUTTR_NAMES. The sync interval is the time interval between eachtime OLGA and the client are synchronous, i.e. the time interval between eachexchange of information between OLGA and the client. See also Chapter 5.

The averaging procedure will also ensure that mass flow values will reflect the massflow over the whole sync interval. Due to this, it will be possible to obtain massconservation over the server/client coupling for longer sync intervals.

Page 22: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 22/29

37.010.008/TN-1: The OLGA Server Interface Page 20

March 09, 2010

3.6.3 Information regarding the OLGA system’s flow and pressure sensitivity

OLGA may send to the client calculated instantaneous derivatives of gas, oil and water flow with respect to pressure for each coupled pressure boundary, Gg/P (DGGDP),

Glthl

/P (DGLTHLDP) and Gltwt

/P (DGLTWTDP). Also the calculated derivatives of pressure with respect to gas, oil and water flow for each coupled source are available,P/Gg (DPDGG), P/Glthl (DPDGLTHL), P/Gltwt (DPDGLTWT).

The derivatives at pressure boundary couplings and sources are calculated by thefollowing procedure:

The boundary pressures and source flows are perturbed one at a time. The flow andpressure changes at the perturbed coupling locations are then found by solving thelinearized momentum and volume balance equations for the total system for eachperturbation.

The derivatives received from the client are included when perturbing the system. Theinput derivatives (calculated by client), source mass flows (SRCGG, SRCGLTHL,SRCGLTWT) and boundary pressure (PTBOU) for coupled sources and pressureboundaries are also available at the relevant locations.

See appendix A for further information.

3.6.4 Compositional information for MEG Tracking model

The following variables are available for each of the components (HC, H20 and MEG)in the MEG tracking model:

XG mole fraction in gas phaseXH mole fraction in oil phaseXW mole fraction in aqueous phaseCMG kg/m3* mass in gas phaseCMHL kg/m3 mass in oil filmCMHD kg/m3 mass in oil dropletsCMWL kg/m3 mass in water filmCMWD kg/m3 mass in water dropletsCMTOT kg total mass in branchCGG kg/s mass flowrate in gas phaseCGHL kg/s mass flowrate in oil phaseCGWT kg/s mass flowrate in water phase

* CMG multiplied by section volume gives mass in gas phase in the section.

To access these variables for output and profiles in server applications, the componentnames must be attached to BRANCH tag.

Ex: $BRANCH-1 CGG CGHL CGWT

For trend variables in server applications the component names must be attached toPOSITION tag.

Ex: $OUTLET CGG CGHL CGWT$BRANCH-1 CMTOT

Page 23: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 23/29

37.010.008/TN-1: The OLGA Server Interface Page 21

March 09, 2010

The values will be given for all the three components

4. COMMAND SEQUENCE

The OLGA server will be prepared to receive messages in almost any sequence,although not all sequences will be very meaningful. It is basically up to the client tosend messages in a sequence needed to achieve the desired result, and to beprepared to receive answers from OLGA.

Below is an example of a very basic command sequence as seen from the client. Theterm "body:" refers to information in the messages:

OLGA_READ_INPUT body: <casename>

to tell the server a case name and ask it to read its input file.

OLGA_INITIALIZE body:

to ask the server to perform initialization.

OLGA_START body: <casename>

to ask the server to read its input file and perform initialization. This is equivalentto the messages OLGA_READ_INPUT and OLGA_INITIALIZE.

This command is not recommended because it sends back OLGA_ERROR to theclient if table exceptions occurs in the fluid file. Use OLGA_READ_INPUT and

OLGA_INITIALIZE instead if possible.

OLGA_INP_NAMES body: $node-1 BOUNDARY $node-2 BOUNDARY

to inform the server about which data the client will send.

OLGA_INP_SIZES body: 5 5

to inform about the lengths of these data.

OLGA_OUTTR_NAMES body: HT $inlet WG WLT $outlet WG WLT <and so on>

to tell the server which TREND data the client wants back.Be prepared to receive a OLGA_OUTTR_SIZES message as a response to thiscommand.

OLGA_OUTPR_NAMES body: $branch-1 AL PT $branch-2 WG WLT <and so on>

to tell the server which PROFILE data the client wants back.Be prepared to receive a OLGA_OUTPR_SIZES message as a response to thiscommand.

OLGA_LOAD_SNAP body: <filename>

to initiate the server in an earlier saved state.OLGA_GETTR_RESULT

Page 24: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 24/29

37.010.008/TN-1: The OLGA Server Interface Page 22

March 09, 2010

to get the information about the OLGA TREND variables and the planned timestep.Be prepared to receive the OLGA_OUTTR_DATA message as a response to thiscommand.

OLGA_INP_DATA body: <boundary conditions>

to set desired boundary conditions for OLGA.

OLGA_SIM_STEP

 Asks the server to simulate one time step ahead.Be prepared to receive an OLGA_OUTTR_DATA and OLGA_OUTPR_DATAmessage as a response to this command.

OLGA_ENABLE_HALT body: <number of time steps between each

time OLGA listens for OLGA_HALT>

to switch on the „‟pseudo‟‟-batch simulation mode. This switch will be reset thefirst time the program exits the OLGA integration.

OLGA_SET_TEND body: <end time for simulation>

to set OLGA end time.

OLGA_SIM_STEP

to start simulation which will run to TEND if OLGA_HALT is not sent.

OLGA_HALT

will stop simulation even if TEND has not been reached. OLGA returns to listenstatus. All other messages received before TEND has been reached will producean OLGA_ERROR message and will be ignored.

Repeat the OLGA_INP_DATA and OLGA_SIM_STEP command (and treat the answer)any number of times.

OLGA_SAVE_SNAP body: <filename>

to save the current state.

OLGA_STOP_SERVER

to terminate the whole thing.

Page 25: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 25/29

37.010.008/TN-1: The OLGA Server Interface Page 23

March 09, 2010

5. TIME SYNCHRONIZATION

The OLGA model has a built-in method for determining the time step needed tointegrate the dynamic differential equations. The methods is important for a smoothand stable operation of the model, and should be disturbed as little as possibly by theClient-Server modification.

OLGA maintains a variable named HT, which contains the time step length that OLGAis using, and which can be sent to the client just like any other variable. It is thereforepossible and necessary that the client uses this time step information to maintain asynchronous operation with OLGA. It must be noted that if two or more OLGAinstances are used in the same simulation, they will use different time steps.

The basic method for synchronisation could be as follows:

It must be noted that during strong transients it may happen that the time step HT usedby OLGA becomes shorter than the time step used by the client.

The important exception mentioned in the illustration is the following:

During the integration of the planned time step, HT, OLGA could discover that thetransients in the pipeline are so strong that the time step must be reduced, not only for the next time steps, but for the current one. It will then do so, and use several smaller 

time steps to catch up with the planned longer time step, HT. This internal feature of OLGA is not visible to the client, except that OLGA will spend more time in doing itscalculations, and that there could be some strong transients. But the client can assumethat the time step is always the planned HT, and compute in parallel with OLGA.

Two concerns about this method has been mentioned:

- The modification of the last of the smaller OLGA time steps may cause someartificial transients, due to the numerical scheme.

- If TEND is set, the time step will be reduced or increased in a way that OLGAreaches TEND exactly.

OLGA may use one

single time step to integrate upto this point. However, see theimportant exception discussedbelow.

OLGA has completed a time

step, and has paused at thispoint. The value HT of the nexttime step has been determinedand sent to the client.

The client may use several timesteps to integrate up to thispoint, and will then communi-cate with OLGA again.

The client has integrated up tothis point, and have then com-municated with OLGA.

Time axisHT

 

Page 26: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 26/29

37.010.008/TN-1: The OLGA Server Interface Page 24

March 09, 2010

- It would improve stability and accuracy if boundary conditions were exchangedalso for each of the smaller time steps, not only at the end of the longer HT. Thiswill, however, usually increase the computational time substantially. Alternatively, exchanging sensitivity information as described in sec. 3.4 and 3.5will for many cases improve the stability and accuracy without any significantincrease in computational time.

Page 27: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 27/29

37.010.008/TN-1: The OLGA Server Interface Page 25

March 09, 2010

APPENDIX A: OUTPUT VARIABLES

 All variables in Appendix A in the OLGA User‟s Manual are available with theexceptions or special treatment listed below:

Variables listed in Appendix A in the OLGA User‟s Manual that are unavailable for output through the server interface are:

bundle variables soil variables

Certain variables are handled in a special way through the server:

Name Description NoteTW Wall layer temperature Trend: Returns an array of temperatures for all wall layers

at the given position, starting from the innermost layer.Profile: Returns an array containing the temperature of theinnermost wall layer for all sections in the given branch.

Useful output variables at pressure boundary nodes:

Name Units Definition

PTBOU Pa Boundary node pressure

GGBOU kg/s Boundary node gas mass flow

GLTHLBOU kg/s Boundary node oil mass flowGLTWTBOU kg/s Boundary node water mass flow

TMBOU °C Boundary node temperature

DGGDPB kg/(s Pa)* Gas mass flow derivative w.r.t. pressure

DGLTHLDPB kg/(s Pa)* Oil mass flow derivative w.r.t. pressure

DGLTWTDPB kg/(s Pa)* Water mass flow derivative w.r.t. pressure

DPBDGG (Pa s)/kg* Pressure derivative w.r.t. gas mass flow

DPBDGLTHL (Pa s)/kg* Pressure derivative w.r.t. oil mass flow

DPBDGLTWT (Pa s)/kg* Pressure derivative w.r.t. water mass flow

*: Dimension not possible to convert for derivatives. Only SI units applied.

Variable location:

PTBOU: Taken from dummy section. Value as given in BOUNDARY, PRESSUREkeyword.

TMBOU: Upstream temperature at section boundary adjacent to node. E.g.: If positiveinflow at inlet, TMBOU is as given in BOUNDARY, TEMPERATURE. If negative flow atinlet, TMBOU is set to TM in the first real (user defined) section adjacent to the node,as calculated by OLGA.

 All the volume and the boundary variables including the drilling variables listed in 

 Appendix A in the OLGA User‟s Manual are available for NODE label.

Page 28: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 28/29

37.010.008/TN-1: The OLGA Server Interface Page 26

March 09, 2010

Flow related variables are taken from the section boundary closest to the node,regardless of whether it is an inlet or outlet.

Useful output variables at sources: 

Name Units Definition

GGSOUR kg/s Gas mass flow rate of a mass source

GGSVEX* kg/s Gas mass flow rate downstream of a source

GLHLMA kg/s Oil mass flow rate of a mass source

GLSOUR kg/s Liquid mass flow rate of a mass source

GLSVEX* kg/s Total liquid mass flow downstream of a source

GLWTMA kg/s Water mass flow of a mass source

GOSVEX* kg/s Oil mass flow downstream of a source

GTSOUR kg/s Total mass flow rate of a mass source

GWSVEX kg/s Water mass flow downstream of a source

HSOURC W Enthalpy source of a mass sourcePTSOUR* N/m Pressure outside a section with a source

TMSOUR °C Source temperature

USGSOU m/s Superficial gas velocity of a mass source

DGGSDP kg/(s Pa)** Gas mass flow derivative w.r.t. pressure

DGLTHLSDP kg/(s Pa)** Oil mass flow derivative w.r.t. pressure

DGLTWTSDP kg/(s Pa)** Water mass flow derivative w.r.t. pressure

DPDGGS (Pa s)/kg** Pressure derivative w.r.t. gas mass flow

DPDGLTHLS (Pa s)/kg** Pressure derivative w.r.t. oil mass flow

DPDGLTWTS (Pa s)/kg** Pressure derivative w.r.t. water mass flow

* : Only available for sources with valves.

** : Dimension not possible to convert for derivatives. Used for server interface with only SI unitsapplied 

Variable location:

PTSOUR: Backpressure as given in SOURCE, PRESSURE keywordTMSOUR: Temperature as given in SOURCE, TEMPERATURE keyword

APPENDIX B: SERVER OUTPUT VARIABLE MAP FOR BACKWARDSCOMPATIBILITY WITH GENERIC VARIABLE NAMES

The following is recommended to avoid confusion regarding where values are retrieved:

When using generic variable names, use unique labels for each item If using identical labels on several items, use the variable names related to a specific

item type whenever possible

Requested genericvariable name

Label refering to itemtype

Mapped to variable name

DGGDP NODE

SOURCE

DGGDPB A) 

DGGSDPDGLTHLDP NODESOURCE

DGLTHLDPB A) DGLTHLSDP

Page 29: Server Interface

7/27/2019 Server Interface

http://slidepdf.com/reader/full/server-interface 29/29

37.010.008/TN-1: The OLGA Server Interface Page 27

Requested genericvariable name

Label refering to itemtype

Mapped to variable name

DGLTWTDP NODESOURCE

DGLTWTDPB A) DGLTWTSDP

DPDGG NODE

SOURCE

DPBDGG A) 

DPDGGSDPDGLTHL NODE

SOURCEDPBDGLTHL 

DPDGLTHLSDPDGLTWT NODE

SOURCEDPBDGLTWT A) DPDGLTWTS

GG NODEPOSITIONSOURCE

GGBOU A) GGGGSOUR

GLTHL NODEPOSITIONSOURCE

GLTHLBOU A) GLTHLGLHLMA

GLTWT NODEPOSITIONSOURCE

GLTWTBOU A) GLTWTGLWTMA

PT POSITIONSOURCE

PT B) 

TM POSITIONSOURCE

TM B) 

 A) If identical labels are used for more than one of the items listed in column two, asearch for a matching label is done in the sequence as listed. For identical labels, thefollowing search logics apply:- If a match is found at a NODE or POSITION and there is a pressure boundary typedefined at this position, the first match is applied.- If a match is found at a NODE or POSITION, but the boundary type is closed, thecode will go on searching in the SOURCE list.

B) The code will search for a label match in the sequence given in column two. The codewill retrieve the value from one of the following locations:- The section where the position is defined- The section where the source is located.

NOTE! When using generic variable names with non-unique labels, theOLGA_OUT*_NAMES messages should be re-sent after any change in the related boundaryconditions. This is necessary in order to re-map the output variables according to the newboundary conditions. E.g. : When changing a closed boundary to type pressure or vice versa

and there is a source with the same label in the related inlet or outlet section, theOLGA_OUT*_NAMES should be re-sent afterwards.