Predictive Control of Gas Injection in Natural Gas Transport Networks

Document Type: Original Article


Chemical Engineering Department, Engineering Faculty, Ferdowsi University of Mashhad, Mashhad, Iran


The present sought to draw a comparison between Model Predictive Control performance and two other controllers named Simple PI and Selective PI in controlling large-scale natural gas transport networks. A nonlinear dynamic model of representative gas pipeline was derived from pipeline governing rules and simulated in SIMULINK® environment of MATLAB®. Control schemes were designed to provide a suitable pressure at consumers’ nodes by varying the refinery production rate and compressor station output pressure in the middle of pipeline. The results showed that the model predictive control significantly outperformed the other two methods in economic controlling of pipeline by using less energy in compressor station and simultaneously rejecting disturbances. Although MPC controller performed better, it had a more complicated structure and difficult design procedure than PI controllers.


Main Subjects

1. Introduction

Gas transport pipelines is one of the most important methods in transporting gas from gas wells to consumers. Since gas pressure is dropping in long distances, compressor stations should be installed in appropriate places. In view of consumption variation of consumers, the producer should inject an appropriate amount of gas in pipeline and control the output pressure of compressor stations. Gas injection flow and compressor stations’ output pressures are two important parameters in gas pipeline operation. For better operation, the consumption rate of all nodes, pipeline dynamics and delay times should be identified. Current pipeline control involves an offline manual control by considering supply and demand all over the gas network. The main objective of researchers is to design a control scheme capable of minimizing the energy consumption while keeping the system in the safe region. The safe region conditions are involved in are critical points such as minimum delivery pressure, minimum and maximum compressor flow rate. (Marques & Morari, 1988).

The first step in designing a model based control scheme is the modeling step. After that, different control schemes could be surveyed to choose the best one. The mathematical model of an unsteady state gas flow includes several partial differential equations that depend on spatial coordinates and time (Ke & Ti, 2000).

An isothermal gas flow was modeled without ignoring any terms in momentum equation (Osiadacz, 1987). Additionally, an unsteady state gas flow in pipeline was modeled assuming a steady state heat transfer term and the constant compressibility factor (Tentis et al., 2003). Their work showed a vital difference between pressure profiles of isothermal and non-isothermal models. In another work in 2009, Gonzales et al. modeled an unsteady state flow in pipeline network with the help of MATLAB®/SIMULINK® software (Herran-Gonzales et al., 2009). They have developed two simplified models and solved equations by using Crank-Nicolson algorithm and the method of characteristics.

The Energy Information Administration of USA reported that nearly half of the natural gas price for residential customers came from transportation costs (EIA, 2007). This created a great motive for researchers for reducing high operational cost of gas transport pipelines. One of the early attempts to develop a rational control policy is represented by (Batey et al., 1961), in which some rules of thumbs are presented for operating the system with low energy consumption. In 1988, Marqués and Morari presented a moving horizon optimization formulation, in which a dynamic simulator computed optimal operating profiles for a single source pipeline network (Marques & Morari, 1988). Moreover, compressor performance was optimized by a dynamic optimization formulation in order to follow a desired line pack profile (Abbaspour et al., 2007).

Since 2001, predictive control has been used in control and optimization of pipeline operation. In this year, a linear predictive control for industrial oxygen distribution pipeline networks was developed (Zhu et al., 2001). In a recent study, a nonlinear predictive control was used for the operation costs of the optimization of transport pipeline network (Gopalakrishnan & Biegler, 2013). In contrast with other set point tracking predictive controllers, their controller had an operation cost function and tried to reduce it. They reported that an economic predictive control could greatly reduce the operational costs of pipeline.

In this article, the pipeline network was over 300 Km long from Khangiran refinery to Farooj compressor station in Iran. This pipeline network, after necessary simplifications, includes 11 consumers, one compressor station in the middle of the line and one refinery at the beginning of the line as a producer. The authors developed a precise dynamic gas pipeline network model based on continuity, momentum and energy balances. Afterwards, three control schemes were designed for this pipeline and their performances were evaluated.

2. Dynamic Modeling of Gas Pipeline Networks

Figure 1 is a schematic of gas pipeline considered in this paper. In this figure nodes 1 and 8 represent refinery and compressor station, respectively. Other nodes are consumers. The pipeline network is divided into two sections: section one consists of node 2 to 7 and their pipelines. The rest of the pipeline network, after node 8, is called section two. The diameter, length and elevation change of each pipe segment is shown in Table 1. The conditions of the inlet gas and the flow rate of each consumer are shown in Table 2.



Figure 1. Pipeline Network

Table 1. Pipe Segments Characteristics

Elevation Change (m)

Length (km)

Pipe Thickness (in)

Outside Diameter (in)

Pipe Segment





























































Table 2. Inlet and Outlet Conditions of Pipeline Network


Pipeline injection pressure (bar)


Pipeline injection temperature (oC)


Consumption flow of node 2 (MMSCMD)


Consumption flow of node 3 (MMSCMD)


Consumption flow of node 4 (MMSCMD)


Consumption flow of node 5 (MMSCMD)


Consumption flow of node 6 (MMSCMD)


Consumption flow of node 7 (MMSCMD)


Consumption f-low of node 9 (MMSCMD)


Consumption flow of node 10 (MMSCMD)


Consumption flow of node 11 (MMSCMD)


Consumption flow of node 12 (MMSCMD)


Outlet flow of pipeline, node 13 (MMSCMD)




2.1. Pipeline Mathematical Model

The main equations of the dynamic model of gas pipeline are equations of mass, momentum and energy balances, which are expressed as follows:

Mass balance equation


Momentum balance equation


Energy balance equation of gas


Energy balance equation of pipe wall



The main assumptions in the above model are a) neglecting the radial changes of variables (radially lumped and axially differential), b) neglecting the conduction terms in momentum and energy equations and c) constant properties of pipe wall (cpw and rw). By solving equations 1 to 4 simultaneously, one can achieve velocity (flow rate), pressure and temperature profiles along the pipeline according to time. Required initial conditions are steady state values of temperature, pressure, and flow rate along the pipeline which are calculated by steady state assumptions in the model equations. Boundary conditions are pressure, flow rate, and temperature changes by time in the boundaries of pipeline (inlet, outlet and consumers). Each pipeline has one inlet and one outlet that needs three boundary conditions on pressure, flow rate, and temperature. For each consumer, one more boundary condition is required. These boundary conditions can be defined at inlet or outlet. In our simulation, pressure and temperature are defined at inlet, and flow rate is defined at outlet and consumers (see Table 2).

Compressor energy consumption is formulated as


Where BHP is isentropic power (hp), Hi is isentropic head (lbf ft/lbm), m is mass flow rate (lbm/s) and ƞc is isentropic efficiency. Hi is calculated continuously with aim of operating conditions and characteristic curve of compressors. The more BHP means the more energy consumed in compressor stations for compressing natural gas. By recording the BHP of compressor stations with time, one could find which control scheme used less energy to deliver naturel gas to consumers and reject disturbances.

2.2. Model Numerical Solution

In order to solve the equations 1 to 3 it was necessary to use numerical solution of partial differential equations methods. To solve equations with method of line (Pregla & Pascher, 1989), they were formed as a set of ordinary differential equations (Kumar, 1987; Chaczykowski, 2010):

for j = 2 to N+1                                                     (6)

    for j = 2 to N+1                                                                     (7)

          for j = 2 to N+1           (8)

where j is the spatial coordinate discretization section index, and Pj, Tj and mjare pressure (psia), temperature (R) and mass flow rate (lbm/s) of gas at j-th discretized section of pipe, respectively. Δx(Pj), Δx(mj) and Δx(Tj) are approximate differentiation formulas based on backward difference method. A step size of 1640 ft (0.5 km) is used for x-coordinate in these approximate differentiation formula. The value of parameters involved in the model equations (Eq. 4-8) or the method used for calculating these parameters are shown in Table 3. The model equations are solved in MATLAB/SIMULINK using integration routine ODE15s (Natick, 1997).

Table 4 shows a comparison between actual and simulated node’s pressure at steady state condition. As seen, most of the node’s simulated pressures are in accordance with actual pressures.

Table 3. Model Parameters and Coefficients



Formula or Value



Energy conversion factor

Btu / (psia ft3)




Force conversion factor

lbm ft / (lbf s2)




Acceleration of gravity (ft/s)




Mass universal gas constant

psia ft3 / (lbm R)




Specific heat of gas

Btu / (lbm R)

Based on the method described in chapter 3

(Kumar, 1987)


Compressibilty factor of gas

Standing and Katz’s chart

(Kumar, 1987)


Inside cross sectional area of pipe (ft2)




Moody friction factor


(Swamee & Jain, 1976)


Inside heat transfer coefficient, Btu / (s ft2 R)


(Perry & Green, 1997)


Outside heat transfer coefficient, Btu / (s ft2 R)

1/(Rpipe + Rsoil)     where



(Mokhatab et al., 2006)


Inside diameter of pipe, ft

2.932 or 2.437



Outside diameter of pipe, ft

3 or 2.5



Depth from top of soil to pipe centerline, ft

4.781 or 4.531



Thermal conductivity of soil, Btu / (s ft R)


(Perry & Green, 1997), Table 2-382


Thermal conductivity of pipe

(mild steel), Btu / (s ft R)




Heat capacity of pipe (mild steel), Btu / (lbm R)


(Perry & Green, 1997), Table 2-219


Mass density of pipe (mild steel), lbm / ft3


(Perry & Green, 1997), Table 2-118


Thermal conductivity of gas

Btu / (s ft R)




Temperature of soil (R)



Table 4. Comparison between Actual and Simulated Node’s Pressure

Relative Error (%)

Actual Pressure (bar)

Simulated pressure (bar)










































3. Control Scheme Design

Pipeline pressure control is required for supplying the consumers’ gas needs. In this article, three control schemes, model predictive control, simple PI, and selective PI are surveyed. The control schemes regulate pipeline pressures near their set points for better consumers’ supply. All three schemes try to control pressure and supply consumers in an economic way without violating physical constrains of production and distribution tools.

3.1 Simple PI Controller Scheme

In this scheme, two simple PI controllers were used to regulate pressures of nodes 7 and 12 at the end of each section of pipeline. Changing the consumption rate of a node will result in the pressure change of that node. This pressure change will be sensed in the controlled node with a dynamic that depends on the node distance to the end of pipe section. The controller regulates output pressure of compressor station or refinery to reject this disturbance. This scheme showed in Figure 2.

3.2. Selective PI Controller Scheme

There are only two PI controllers in the simple PI scheme for pressure control. In that scheme, if a disturbance occurs in the middle of pipeline, its effects reach the controlled node by a long dynamic and the controller responds with a huge delay accordingly. The other problem of that scheme is that if the consumption rate of an important node in the middle of the pipeline is disturbed, its pressure will change dramatically before the controller can respond. These reasons establish a motive to put some controllers in the middle of the line to avoid these problems. In the selective controller scheme, nodes 3 and 7 assign refinery injection pressure and nodes 10 and 12 assign the output pressure of compressor station. It should be noticed that consumers in the second section of pipeline indirectly control the refinery injection pressure. When a disturbance occurs in the second section, the controller regulates the output pressure of compressor station which leads to a change in the inlet pressure of compressor station. This change measured is in node 7 and following that, the controller changes the refinery injection pressure. This scheme showed in Figure 3.



Figure 2. Simple PI Controller Scheme


Figure 3. Selective PI Controller Scheme. HS: High Selector


In simple and selective PI schemes SIMC (Skogestad, 2003) method was used for PI controllers design. By considering PI controller in equation 9, controller parameters are shown in Table 5. It should be noticed that controllers for node 7 and 12 are common between simple and selective PI schemes.


Table 5. PI Controller Parameters


KC (%/%)

KI ((%/%)/s)













3.3. Model Predictive Control Scheme

Model predictive control (MPC) refers to a class of controllers that compute a manipulated variable profile with the help of a process model to optimize controller performance and avoid constrains violation over a future time horizon (Muske & Rawlings, 1993).

The main idea of model predictive controllers can be summarized as

  • Predict the future behavior of the process over the finite time horizon
  • Compute the future input signals on line at each step by minimizing a cost function under equal and unequal constraints on the manipulated and controlled variables
  • Apply on the plant only the first element of the control variable vector and repeat the previous step with new measured output variables (Zheng, 2011)

In MPC, the vector of control variable is obtained by solving an optimization problem at current time k (MATLAB®, 2010):


w.r.t                 Duj (k + i|k)


process model (Eqs. 4-8) is satisfied

55.15 bar < refinery injection pressure <72.4 bar

55.15 bar < compression station outlet pressure <72.4 bar

refinery injection flow rate < 45.32 MMSCMD

Where subscript j denotes the j-thcomponent of a vector, (k+i|k)denotes the value predicted for time k+i based on the information available at time k and r(k)is the current sampled value of setpoint. wi+1y and wiDuare nonnegative weights for the corresponding variable. The smaller w, the less important is the behavior of the corresponding variable to the overall performance. In our work, the MPC toolbox of MATLAB® (R2011a) was used.

MPC is a centralized controller in which controlled variables, set points, and flow rates of four nodes are inputs and manipulated variables are outputs. MPC controller calculates manipulated variables, which are refinery injection pressure and compressor station output pressure, to reject the node’s pressure disturbances. The MPC scheme is shown in Figure 4 and the value of its parameters are presented in Table 6.



Figure 4. MPC Controller Scheme

Table 6. MPC Designed Parameters

Control Interval (Sampling time)

50 s

Prediction Horizon

600 sampling number

Control Horizon

5 sampling number

Node 3 weight


Node 7 weight


Node 10 weight


Node 12 weight


The MPC toolbox in MATLAB software supports linear time invariant model formats such as transfer function and state space models. These models can be imported by user or could be calculated by MATLAB linearization function based on the simulated nonlinear model. In the current work, the second method was used.

4. Results and Discussion

Three designed control schemes were applied to the simulated gas pipeline network. To compare the controller’s performance, three experiments were performed. In these experiments, the controller’s responses to reject known disturbances were monitured. Known disturbances were consumption rate changes in controlled and uncontrolled nodes (nodes 2 to 12). Since the distances between uncontrolled nodes and controlled nodes were not much, the closed-loop responses were approximately identical and responses of uncontrolled nodes were not shown. To decide which performance was the best, the Integral of the Square of the Error (ISE) for all nodes and the consumption of energy in compressor station were considered. In addition for safe gas distribution a minimum pressure must be guaranteed at all nodes. This minimum was selected equal to 590 bar. This means that the pressure of all nodes in all times must be greater than 590 bar.

In the first experiment, an increase of 60% was applied to the consumption rate of node 3 by a dynamic with the time constant of 1.38 hour. Figure 5 shows the controllers responses. As can be seen, the MPC controller rejected this disturbance quite effectively. Simple PI and selective PI had 9600% and 5700% more ISE than MPC, respectively. They also consumed more energy in compressor station, which was 105% for simple PI and 62% for selective PI more than the required energy for MPC. In addition, the overshoot, undershoot and the settling time in the case of using MPC is obviously lower than other schemes.


Figure 5. Node 3 Consumption Increased by 60%


In the second experiment, an increase of 60% was applied to the consumption rate of node 7 by a dynamic with the time constant of 1.38 hour. Figure 6 shows the controllers responses. As can be seen, the MPC controller has sligthly better performace than simple PI controller, the performance of selective PI controller was the worst case. Simple PI and selective PI had 37% and 209% more ISE than MPC, respectively. They also consumed more energy in compressor station which was 3% for simple PI and 20% for selective PI more than required the energy for MPC. In addition, the overshoot and undershoot in the case of using MPC was obviously lower than other schemes, but the settling time was almost higher than other schemes.

In the third experiment, an increase of 30% was applied to the outlet flow rate of gas pipeline (node 13) by a dynamic with the time constant of 1.38 hour. This node was at the end of pipeline and its flow rate was relativtely high (see Table 2). Figure 7 shows the controllers responses. As can be seen, in this experiment the selective PI had better perfomaces than other schemes. Unlike the previous two expriments, the overshoot, undershoot, and the settling time in the case of using MPC were obviously higher than other schemes. This means that the selected structure and constraints for MPC were not suitable for this huge disturbance.


Figure 6. Node 7 Consumption Increased by 60%


Figure 7. Node 13 Consumption Increased by 30%

5. Conclusions

Safety and profitability are necessary for the effective control of large scale natural gas transport pipeline. Although pipeline networks were a characteristic feature of the gas transport industry, the application of advanced control to such a system was not common. In this paper, a dynamic model based on continuity, momentum, and energy balances were selected for gas pipeline network from Khangiran refinery to Farooj compressor station (in Iran). A comparison between the simulated and actual pressures at steady state conditions did not show a considerable difference. Next, three controller schemes, MPC, simple PI, and selective PI were applied to the simulated pipeline. All schemes tried to control the pressure and supply consumers in an economic way without violating the physical constrains of production and distribution facilities. The withdrawal rate changes of controlled and uncontrolled nodes showed that the MPC scheme had better performances than other schemes in disturbance rejecting of all nodes except the last node (outlet flow rate of gas pipeline). However, it should be noticed that the MPC controller had a more complicated structure and difficult design procedure than PI controllers.

bbaspour, M., Krishnaswami, P., & Chapman, K. S. (2007). Transient optimization in natural gas compressor stations for linepack operation. Journal of Energy Resources Technology, 129, 314–324.

Batey, E. H., Courts, H. R., & Hannah, K. W. (1961). Dynamic approach to gas-pipeline analysis. Oil and Gas Journal, 59, 65-78.

Chaczykowski, M. (2010). Transient flow in natural gas pipeline – The effect of pipeline thermal model. Applied Mathematical Modelling, 34, 1051–1067.

EIA, (Office of oil and gas Energy Information Administration) (2007). Residential natural gas prices: What consumers should know. Retrieved November, from portal/ groups/ public/ documents/ pdffiles/ 011724.pdf.

Gopalakrishnan, A., & Biegler, L. T. (2013). Economic nonlinear model Ppredictive control for periodic optimal operation of gas pipeline networks. Computers and Chemical Engineering, 52, 90– 99.

Herran-Gonzales, A., De La Cruz, J. M., De Andres-Toro, B., & Risco-Martin, J. L. (2009). Modeling and simulation of a gas distribution pipeline network. Applied Mathematical Modeling, 33, 1584–1600.

Ke, S. L., & Ti, H. C. (2000). Transient analysis of isothermal gas flow in pipeline network. Chemical Engineering Journal, 76, 169–177.

Kumar, S. (1987). Gas production engineering. Gulf publishing company.

Marques, D., & Morari, M. (1988). On-line optimization of gas pipeline networks. Automatica, 24, 455-469.

MATLAB® (2010). Help of model predictive control toolbox. Version 7.12 (R2011a), Mathworks, Inc.

Mokhatab, S., Poe, W. A., & Speight, J. G. (2006). Handbook of natural gas transmission and processing. Elsevier Inc.

Muske, K. R., & Rawlings, J. B. (1993). Model predictive control with linear models. AIChE Journal, 39, 262-287.

Natick, M. A. (1997). Simulink: dynamic system simulation for MATLAB®. Mathworks Inc.

Osiadacz, A. J. (1987). Simulation and analysis of gas networks. Gulf publishing company.

Perry, R. H., & Green, D. W. (1997). Perry’s chemical engineers’ handbook. 7th edition, McGraw-Hill.

Pregla, R., & Pascher, W. (1989). Numerical techniques for microwave and millimeter-wave passive structures. Wiley-Interscience.

Skogestad, S. (2003). Simple analytic rules for model reduction and PID controller tuning. Journal of Process Control, 13, 291–309.

Swamee, P. K., & Jain, A. K. (1976). Explicit equations for pipe-flow problems division. Journal of the Hydraulics, 102, 657-664.

Tentis, E. S., Margaris, D. P., & Papanikas, D. G. (2003). Transient simulation of large scale gas transmission networks using an adaptive method of lines. Proceedings of the international conference of computational methods in sciences and engineering (ICCMSE), 631–632.

Zheng, T. (2011). Advanced model predictive control. In-Tech.

Zhu, G. Y., Henson, M. A., & Megan, L. (2001). Dynamic modeling and linear model predictive control of gas pipeline networks. Journal of Process Control, 11, 129–148