Graham W. GriffithsSAST Ltd.

London

Denis J. WillsWoodside Offshore Petroleum Pty. Ltd.

Karratha, Australia

Wouter J. MeiringKoninklijke/Shell Laboratorium

Amsterdam

A real time dynamic two-phase model of the pipeline system and relevant portions of shore facilities is being installed for Woodside Offshore Petroleum Pty. Ltd.'s North West Shelf gas project.

The trunkline management system (TMS) which utilizes dynamic pipeline and plant process simulation is scheduled to start up near the end of the first quarter of 1994 at Woodside Offshore's plant at Karratha, Western Australia.

The TMS is a real time dynamic two phase model of the pipeline system and relevant portions of the onshore facilities. Its budget was approximately $4 million (Australian).

This concluding of two articles describes the models incorporated in the system. Part 1 (OGJ, Jan. 3, p. 42) described the operating conditions that prompted the system's installation.

In the system, a dynamic model is continuously synchronized to actual plant data by use of reconciled measurement data. The model is used for rapid "look ahead" to examine control actions before they are implemented in the plant.

This is achieved by use of rigorous first principle modeling techniques to describe the two phase flow pipelines and associated process equipment. With dynamic mass and energy, balances maintained throughout the model, composition tracking can be included.

Rigorous multicomponent thermodynamic and physical property calculations are also included throughout, enabling mass transfer between vapor and liquid phases along the pipeline to be predicted by means of flash calculations.

The TMS project is demonstrating that modeling technology, based upon advanced fluid mechanics, can now accurately predict the dynamic behavior of two-phase pipelines.

Additionally, parameter estimation and data reconciliation techniques can be used to make the "shadow-model" concept practical for providing inferential measurements.

### MANAGEMENT SYSTEM

The trunkline management system consists of hardware, software, and communications.

Fig. 1 shows its major items and their inter relationships.

### DATA HANDLING

Data handling and validation are performed by Gensym Corp's G2 system using statistical and nonstatistical techniques. It validates up to 170 live process variables from the offshore and onshore facilities.

It is also used for context checking, for example, comparing flowmeter readings against flow control valve positions, in order to detect inconsistencies.

The basic data validation scheme looks at single data points without consideration of their relationships with other data points. The enhanced data validation scheme, however, is able to take into account relationships with other variables.

The consistent accuracy of certain critical data is crucial to proper implementation of the "shadow model" (described presently) which, in turn, is central to the success of the entire TMS.

The best way of ensuring consistent accuracy of data and avoiding accumulation of measurement error is to use a good data reconciliation scheme. For this project, the data reconciliation scheme is model based, and it is used to determine the most likely values of certain, highly critical process variables such as pipeline inlet flow measurements.

The system uses the Otiss optimizer (Special Analysis and Simulation Technology Ltd., London) which employs the Isope (integrated system optimization and parameter estimation) technique for combined parameter estimation and optimization.1 3

A data reconciliation objective function (J) has been designed to reflect the physical nature of the problem and includes an appropriate weighting factor matrix.

When the objective function is minimized, the set of reconciled data is considered to represent the optimum; that is, it represents the best estimate of corresponding real data, as shown in Equation 1 in the accompanying equations box.

The flow reconciliation scheme is not based solely on simple arithmetic massflow calculations but includes flash correction, that is, mass transfer.

At present, a steady state reconciliation criterion is being used.

Experiments are also being performed with a dynamic objective function which explicitly includes time.4 Gains in data tracking performance under transient conditions are expected.

### SHADOW, LOOK-AHEAD MODELS

The real time "shadow model" continuously models the actual real time conditions in the pipeline system and slug catcher, together with appropriate parts of the offshore and onshore processing facilities (Fig. 1).

It is the cornerstone of all the TMS facilities.

A physically based model is used which is continuously synchronized to measured data from the real plant that are considered to be highly accurate or which have been reconciled by the system (as described previously).

The shadow model can be likened to a comprehensive dynamic inferential measurement system because it provides control systems and operators with measurements and parameters not measured on the actual plant, including stream compositions. It also enables comparisons to be made between real and expected plant behavior. This enables degradation or failure of items on the real plant to be detected.

Data trending is carried out to provide an historical measurement data base which is available on demand.

Output from the real time shadow model is used by the rapid look ahead model to predict such parameters as pressure profile in the pipeline system, slug catcher level, liquid arrival rate, or any other measured or simulated process variable up to 12 hr in advance of the real time values.

The model is started automatically at regular intervals and provides rapid look ahead pipeline and process data on the basis of constant platform well flow rates and shore gas demand flow until completion of the look-ahead simulation run.

Ultimately, it is intended to achieve a model speed of 144 X real time.

Comprehensive display and alarm facilities are provided to enable operators to be kept fully informed of the anticipated TMS operational situation over the next 12 hr.

The predictive model allows rapid "what if... ?" scenarios to be run by the operator.

While the shadow model and the look ahead model are constrained to operate in the same manner as the real plant, the predictive model is allowed to operate in response to different set points and plant duty commands, with different parameters, in fast, real, or slow time.

It is this tool which enables the operator to optimize pipeline operation and decide on corrective action should a serious transient upset be detected in the pipeline system.

This model will also be capable of predicting plant operation up to 12 hr in advance and will operate at the same speed as the look-ahead model.

### LPG MODEL; MM

IThe LPG balance model which is a part of the look-ahead and predictive models, advises the operator when LPG excess due to processing a liquid transient will occur and the magnitude of the excess.

By using the predictive model, the operator can determine how best to avoid or control such an excess. It will also advise if there is a shortage of LPG to meet LNG and domestic gas higher heating value specifications.

The LPG model carries out a back calculation in order to determine the input requirements to meet the desired product specifications.

The LPG balance model performs two functions - look ahead and predictive; each requires the use of a steady state multivariable controller to determine the set points of nine control loops.

The optimization technique used for data reconciliation has also been adopted for this system.

The LPG balance model's look ahead function involves two control problems: forecasting future LPG imbalance over a 12 hr period and calculating the maximum handling capacity during the same period.

The model's predictive function involves only one control problem: calculation of required inputs to the LPG system for a given product specification and demand.

The extensive interaction between the LPG system and the production and pipeline system makes achieving long term stability over varying operational conditions difficult.

An extensive man machine interface (MMI) has been developed to enable quick and efficient access to and manipulation of TMS data. The system chosen for implementation of the MMI was G2 which has comprehensive facilities for creating customized displays for presenting data from remote machines in a variety of ways.

A study was carried out into the best way of presenting data, and a complete set of screen displays was designed before any, software was developed.

This study involved assessing how various data types should be displayed, which variables should be trended, and how alarms should be handled, together with many other issues relating to the ergonomics of the operator interface.

One crucial aspect was the display hierarchy, that is, in what order screens could be called and how the operator would navigate around the system without getting lost or overwhelmed with data.

### PIPELINE MODELING

In recent years, Koninklijke/Shell Laboratorium, Amsterdam (KSLA), has developed Traflow, a general purpose pipeline modeling program used by Shell for transient studies of a range of multiphase applications.

### MODELS' BASIS

KSLA developed physical models for steady state, two phase flow as a firm basis for developing Traflow.5 These models were based upon experiments carried out on an 8 in., high pressure, two phase test facility at Bacton and tested against the Shell data base of controlled field tests in large-size wet pipelines.6

The models are implemented in Two-phase, a computer program used within Shell for predicting pressure loss and liquid hold up in multiphase lines.

In Traflow, a flow pattern-dependent approach has been adopted. This means that each pipe segment has its own constitutive equations: two mass balances, one for each phase; one momentum balance; and one total energy balance (Equations 2 11 in accompanying equations box).

It is assumed that both phases are in thermodynamic equilibrium and have the same temperature. The model is completed by an algebraic slip relation describing the slippage between phases, together with several empirical closure relations.

These closure relations describe the slip between the vapor and liquid film, the slip between the vapor and droplets, the fraction of entrained liquid, and the interphasial mass transfer.

They depend upon the prevailing flow regime as determined by the same models as used in Two-phase.

Traflow also includes the capability to account for mass transfer between phases, heat transfer through the pipe wall, and the entrainment of liquid droplets in the gas phase.

Diameter variations, multiple injection points and risers, downcomers, and wells can also be handled by the code. In addition, the model can describe such special effects as the Joule Thomson effect and handle adiabatic and isothermal cases.

Liquid sphering volumes are also provided as an output.

### METHODS, ACCURACY

The numerical solver is an implicit Newton Raphson iterator especially dedicated to the fluid mechanics problem.

In Traflow, the physical model and the numerical solver are contained in separate computational modules. This feature renders the code more flexible to modifications of the underlying physical basis of the model and also for the incorporation of a third phase (water) or modifications to the closure relations.

This flexibility was found to be particularly useful during integration of Traflow into TMS.

With regard to accuracy, in the steady state Traflow is comparable to Two-phase because of the use of similar models. Under transient conditions, the code has been validated against several laboratory and field experiments, including depressurizations, pipeline ruptures, and severe slugging.

Typical applications are start up, shut in, cool-down, and depressurization of the line, fluctuations in production rates, temperature transients, pipeline ruptures, and severe and hilly terrain slugging.

Following are the current accuracy figures:

- Steady state: deltaP friction, +/- 2%; deltaP static head, +/- 20%; liquid holdup volume, +/- 20%; and thermodynamics, +/ 1%
- Transient: peak liquid flow, +/ 20%; liquid transient arrival time, +/ 20%.

Following installation of the TMS, a tuning phase allowed for improving overall accuracies. The TMS project has also included for adding to the program the capability to handle "low flow" and "reverse flow."

An example of an operating circumstance when the TMS will be of use is the situation following a recycle compressor trip at GWA.

Under this scenario, mentioned earlier, GWA changes from recycle to depletion mode. The production at NRA is then reduced by 25%, causing part of the liquid inventory in the interplatform line to be pushed into the main trunkline to arrive later onshore.

The results of a Traflow simulation of this scenario are shown in Fig., 2. From this it is seen that the slug arrives onshore after about 9 hr with a peak flow rate of four times the normal flow rate.

The gas flow rate onshore remains constant during the transient, except during arrival of the liquid surge.

### PROCESS PLANT MODELING

For modeling the shore process plant, TMS incorporates Otiss, an object orient ed, data driven, process dynamic simulation system de signed to be used for modeling the transient performance of chemical engineering processes.

### UNIX BASED

Written in the C language, Otiss runs under the UNIX operating system. SAST began developing the program in 1985. Inter processor communication facilities will utilize Ethernet.

Interactive graphics are provided which utilize the X Window system. Extensive facilities are provided to enable the user to control, monitor, and change the simulation as it proceeds.

Central to the system is the data base which enables a wide range of user facilities to be provided and large-scale simulations to be performed. It has been designed so that when a plant model is built, modified, or expanded, no recompilation is required.

The system consists of a set of process unit algorithms interconnected by streams. These, together with the necessary instrumentation and control functions, form a simulation.

Units are selected from a range of algorithms contained within the standard model library. The system is designed to facilitate addition of user defined algorithms and interfacing to external third party systems.

The individual algorithms are all physical based and use fundamental first principles of chemical and mechanical engineering.7 Dynamic mass, energy, and momentum balances are used throughout, together with rigorous thermodynamic and physical property predictions and vapor liquid equilibrium (VLE) calculations.

Accurate calculations are performed for inventory, pressure, level, flow, heat transfer, and thermal and mechanical inertia as appropriate for all process items and units from, for example' a simple valve to a complex distillation column.

### THERMODYNAMICS; SOLUTIONS

The program incorporates a powerful and flexible thermodynamic and physical property system which provides a central data base and a set of standard algorithms that permit a wide variety of thermodynamic and physical properties to be used.

Although an object oriented, sequential modular system, Otiss nonetheless can employ equation solving techniques where appropriate. It uses a mixture of explicit and implicit solution techniques in order to optimize the efficiency of calculation.

SAST has used Otiss to simulate many different processes in more than 400 projects. In all cases, steady-state verification is carried out by comparing stream data with that produced by design engineers using steady state simulators such as Simulation Sciences Inc's PRO/II.

### INTEGRATION

At the project's start, Otiss was chosen to provide the dynamic modeling environment for the complete TMS.

For this scheme, basic TMS functions were allocated as follows:

- Process plant modeling by Otiss library models, based upon rigorous chemical engineering first principles modeling based on dynamic mass and energy balances.
- Multiphase pipeline modeling by Traflow based upon rigorous fluid mechanics solutions used to predict vapor and liquid mass flows, flow regime, and so forth.
- Fully integrated modeling system by incorporating Traflow into Otiss to make a single, homogeneous system.
- Comprehensive communications by including special two way interfaces to enable high speed communications between Otiss, Honeywell TDC control system, and Gensym's G2 expert system. Also, extensive communications between offshore equipment and between offshore and onshore installations.

Traflow uses fixed composition fluid properties in its calculations and, consequently, could not take into account the effects of a changing feed composition as it propagates down the pipeline.

Because the requirement for component tracking is fundamental to TMS, it was decided to form a close coupled system between Otiss and Traflow whereby Traflow would perform the fluid mechanics calculations with Otiss performing all other calculations.

Following are the special system enhancements:

- Tight coupling of Otiss and Traflow by addition o data base interfaces.
- Multicomponent tracking capability by carrying multicomponent mass and energy balances throughout pipeline in order to predict the water and LPG content of fluids arriving onshore.

This meant extending the fluid mechanics to include a uni-dimensional equation of the form of Equation 12.

- Rigorous multicomponent thermodynamics facilitated by tight coupling and including for each phase density, temperature, enthalpy, viscosity, surface tension, and molecular weight.
- Mass transfer prediction by including rigorous VLE flash calculations along the complete length of the pipeline to aid prediction of mass transfer between phases.

This means solving phase-equilibrium calculations (Equation 13) subject to vapor mole fraction normalization (Equation 14).

### THE FUTURE

The first stage in the development of TMS has been described here. The next stage will include the following:

- Development of a knowledge based expert system further to enhance its use as an operational tool for managing and optimizing pipeline and shore facility operation.
- Extension of data reconciliation capability to include a leak detection capability.
- Development of model-based fault detection and isolation. This is a computer based technique which is used to ascertain whether a plant or system is operating correctly and safely.

If not, the faulty area of the system is identified and isolated so that safe operation can be maintained.

Further into the future is the potential for the TMS to be linked directly to the process control systems of the offshore production platforms in a closed loop control system. Such control would be aimed at meeting production targets. onshore while staying within the pipeline system and shore facility operating constraints, and at controlling pipeline transients optimally.

### REFERENCES

- Roberts, P.D., "An Algorithm For Steady State System Optimization And Parameter Estimation," Int. J. Systems Science, Vol. 10 (1979), pp. 719 734.
- Lin, J., Han, C., Roberts, P.D., and Wan, B., "New Approach To Stochastic Optimizing Control Of Steady State Systems Using Dynamic Information," Int. J. Systems Science, Vol. 50, No. 6 (1989), pp. 2205 2235.
- Lin, J., and Griffiths, G.W., "An Application Study Of Integrated System Optimization And Parameter Estimation (ISOPE) Algorithms Using The OTISS Dynamic Simulator," IEE Colloquium on Plant Optimization For Profit, Jan. 28, 1993, London.
- Roberts, P.D., "An Algorithm For Optimal Control Of Nonlinear Systems With Model Reality Differences," submitted for presentation at IFAC 93, 1993 World Congress, Sydney.
- Oliemans, R.V.A., Pots, B.F.M., and Wu, H.L., "Design Accuracy of Offshore Gas Pipelines Operated in the Two Phase Flow Mode," Proceedings of the 7th International OMAE Conference, Houston, Feb. 7 12, 1988, pp. 187 191.
- Wu, H.L., Pots, B.F.M., Hollenberg, J.F., and Meerhof, R., "Flow Pattern Transitions in Two Phase Gas/Condensate Flow at High Pressure in an 8-inch Horizontal Pipe," Proceedings of the 3rd International Conference on Multiphase Flow, The Hague, May 18 20, 1987, pp. 1321.
- Griffiths, G.W., "Process Dynamic Simulation An Introduction To The Fundamental Equations," SAST Technical Bulletin No. 6 (1992), SAST Ltd.

*Copyright 1994 Oil & Gas Journal. All Rights Reserved.*