Controlling the pressure of hydrogen-natural gas mixture in an inclined pipeline

This paper discusses the optimal control of pressure using the zero-gradient control (ZGC) approach. It is applied for the first time in the study to control the optimal pressure of hydrogen natural gas mixture in an inclined pipeline. The solution to the flow problem is first validated with existing results using the Taylor series approximation, regression analysis and the Runge-Kutta method combined. The optimal pressure is then determined using ZGC where the optimal set points are calculated without having to solve the non-linear system of equations associated with the standard optimization problem. It is shown that the mass ratio is the more effective parameter compared to the initial pressure in controlling the maximum variation of pressure in a gas pipeline.


Introduction
The existing natural gas pipeline networks is using by many petroleum companies to transport hydrogen and natural gas in the same pipeline to deduct transportation cost [1]. Gas pipeline networks work at high pressure and use compression stations to supply gas over long distances [2]. Gas velocity, valve closure time, and arrangement of the closing valve cause pressure change in pipelines [3]. Maximum pressure can occur during valve closure at the end of the pipeline. Therefore, Short times during valve closure are important in reducing the maximum pressure. However, because of the damage is not always visible until long after the event this transient pressure is tough to control. Therefore, controlling transient pressure in a pipeline with respect to certain efficient parameters such as initial pressure and mass ratio are very important [4,5].
The transient flow in hydrogen-natural gas mixtures has been studied by [2,[6][7][8][9]. Isothermal flow and horizontally pipeline is assumed in these papers. However, in reality most gas pipelines are not horizontal [10] studied to transport the gas flow of hydrogen-natural gas mixture with high pressure in an inclined pipeline. Since the gas properties cannot be assumed to be constant, a one-dimensional, non-isothermal gas flow model was solved to simulate the slow and fast fluid transients, such as those typically found in high pressure gas transmission pipelines in [2]. PLOS  Analysis on mass ratio and pressure variation by developing numerical models and computer algorithms in paper [11,12]. In the paper [13], studied the control of transient gas flows in complex pipeline intersections using a linear approximation of the equations describing the physics of gas flow in pipelines and formulated the optimization problem as a mixed-integer program. A computer control algorithm has been used to study optimization of gas networks under transient conditions in the paper [14]. In the paper [15], a model is proposed to predict the decompression wave speed of high-pressure hydrogen-natural gas mixtures in pipelines. In the papers [11][12][13][14][15], controlling the high pressure and transient pressure have been studied using modified computer algorithms and numerical methods.
In paper [16] a method called Zero Gradient Control (ZGC) was proposed for controlling transient pressure, which is used to control the heat rejection pressure and the rotational speed of the fans of the gas cooler of R-744 refrigeration cycles nearly energy optimal. It combines ideas of Extremum Seeking Control (ESC) [17] and the online algorithms [18][19][20].
In the present paper, the Taylor series, regression analysis and zero gradient control have been applied to control the pressure. This is the first time, ZGC method is applied in hydrogen natural gas mixture in an inclined pipeline to control pressure. The basic idea of ZGC is to not to have to calculate set points but to use controllers bringing the gradient to zero to solve the non-linear system of equations associated with the standard optimization problem.
Remind that, solving the equations of hydrogen-natural gas mixtures in pipelines without assuming the celerity pressure wave as constant is more complicated and cannot be solved very easily [9]. To overcome these difficulties, one can use the Taylor series of celerity pressure wave. In the following, approximations for the density and celerity pressure will be proposed. The zero gradient will be applied to approximated series to control the transient pressure. We will study the effect of initial pressure and mass ratio on the maximum values of transient pressure. Effect of initial pressure and transient pressure on the optimal values of mass ratio will be considered for the control of the pressure.

Mathematical formulation
Fig 1 describes an inclined pipeline with a reservoir at upstream and a valve downstream. The governing equations included three coupled non-linear hyperbolic partial differential equations. The flow was assumed as one dimensional, non-isothermal, compressible and covering transient condition. The fluid was assumed to be a homogeneous hydrogen and natural gas mixture [2,6].

Governing equations
From references [6] the principle of conservation of mass and momentum laws, the governing equations and the initial and boundary conditions for the transportation of hydrogen-natural gas mixture in an inclined pipeline and using the relation, can be written as, with the boundary conditions as follows, Pð0; tÞ ¼ P 0 ðtÞ; uð0; tÞ ¼ u 0 ðtÞ; ðat the initial point; x ¼ 0Þ; PðL; tÞ ¼ PðtÞ; uðL; tÞ ¼ u L ðtÞ; ðat the initial point; x ¼ LÞ; with u 0 = Q 0 /A and A = πD 2 /4, where ρ is density, u is defined as gas velocity where the modulus sign is to ensure that the frictional force shall always act opposite to the direction of motion, P is the pressure, e is the gas internal energy per unit mass, f is the coefficient of friction, D is the diameter of the pipeline, g is the gravitational force and θ is an angle between the friction force and the x direction. The equation of state for perfect gas, which is commonly used in the gas industry, is given by, P = ρRT, where R is the specific gas constant and T is the temperature. For compressible flow, the relation of equation of state with the celerity pressure wave c is denoted as, P = c 2 ρ. From relation of ideal gas, the specific heat at constant volume C v , the specific heat at constant pressure C P , the specific gas constant R, pressure P and flow process index γ are defined as, Hydrogen-natural gas mixture equation The mass ratio and the density of hydrogen-natural gas mixture are defined as, with Therefore, the expression of the average density of the gas mixture is given by, Controlling the pressure of hydrogen-natural gas mixture in an inclined pipeline The celerity pressure wave for compressible flow is defined as, where the subscript s is defined the constant entropy condition. The derivative of Eq (8) with respect to P, and substituting into Eq (9), then the celerity pressure wave yields, The properties of hydrogen and natural gas used in the calculations are shown in the Table 1. For the simulation, the parameters are assumed as Table 2.

Approximate series for density and celerity
In this section, we use the Taylor series expansion as presented in the reference [21] for finding the approximate series of Eqs (8) and (10).

Approximate series for density
Because of the singularity point P = 0, to find the Taylor series of Eq (8) is not possible, to overcome this problem we can use e P instead of P, then the Taylor series of Eq (11) around point P = 0 from order 2 is given as follows, with A 1 , A 2 , . . ., A 7 as defined as follows now the function ρ(e P ) is converted to function ρ(P), in Eq (15) by replacing P with ln(P), Fig 2 shows a comparison of the density evolution with pressure between exact solution (8) and approximation series (15), for different values of the hydrogen mass fraction ϕ, by assuming an initial pressure P 0 = 35 bar and T 0 = 15˚C = 288 K.

Approximate series for celerity pressure wave
To find the Taylor series of Eq (10) we follow the presented method in the previous Sections, then the Taylor series of Eq (16) around point P = 0 from order 2 is given as follows, after replacing the derivatives ½cðe P ÞÞ 0 P¼0 and ½cðe P ÞÞ @ P¼0 we have with C 1 , C 2 , . . ., C 13 as defined as follows C 10 ¼ ½2n 1 2 þ 2n 1 À 2�n 2 3 þ ½n 1 3 À 10n 1 2 þ 6n 1 �n 2 2 þ ½2n 1 3 À 2n 1 2 �n 2 þ n 1 3 ; in Eq (18) the function ρ(e P ) can be converted to function ρ(P), by replacing P with ln(P), Controlling the pressure of hydrogen-natural gas mixture in an inclined pipeline Fig 3 shows a comparison of the density evolution with pressure between exact solution (10) and approximation series (19) for different values of the hydrogen mass fraction ϕ by assuming an initial pressure P 0 = 35 bar and T 0 = 15˚C = 288 K.

Solution of hydrogen-natural gas mixture equations
In this section, we use the Runge-Kutta method [22] to solve the steady state equations. Regression analysis will be applied to find the regression polynomials for pressure P and velocity u from the numerical results. Regression polynomials can be used to solve hydrogen-natural gas mixture equations.

Solving steady state equations
Steady state equations can be obtained from Eqs (2) and (3) for t = 0 as follows, with the boundary conditions The Runge-Kutta method can be used to solve Eqs (20) and (21) as numerically. Next we use the regression analysis to find the regression polynomials for pressure P and velocity u as The polynomials P(x) and u(x) will be used as initial conditions for solving Eqs (2) and (3). The unknown parameters a 0 , a 1 , a 2 and b 0 , b 1 , b 2 are found using the error function defined as where, f(x i ) = P(x i ) or f(x i ) = u(x i ) and m is the number of partitions for the pipeline L.
Here the values x i are the pipeline partition points and y i = y P,i (pressure) or y i = y u,i (celerity) are generated data from solving Eqs (20) and (21). With replacing the polynomials P(x i ) and u(x i ) in the error function (24) we have We minimize the error functions E P and E u to find the unknown parameters a 0 , a 1 , a 2 and b 0 , b 1 , b 2 for different values of mass ration ϕ = 0, 0.5, 1 (see Table 3).

Solving Eqs (2) and (3)
Now, by using the approximation series (19) and regression polynomials (23) and (24) with coefficients from Table 3, we can solve the Eqs (2) [7] and the method of characteristics (MOC) presented by Elaoud at al. in the paper [23].
The transient pressure distribution for the rapid closure valve at the downstream end of the pipe for different values of θ = 0, π/6, π/4, π/3 and mass ratio ϕ = 0.5 is presented in Fig 6a. The minimum and maximum transient pressures will happen in the values of ϕ = 0 and θ = π/3, respectively. With increasing the mass ratio from 0 to 1, transient pressure is increasing.

Zero gradient control for controlling the pressure
To find the optimum values of pressure P, we need to bring the gradient of Eq (8) to zero with respect to the pressure P. But using the basic equation of ρ as proposed in the Eq (8) cannot guarantee the proper optimization for the transient pressure (see reference [24]). To overcome this problem, we will use the Taylor series as shown in the Eq (15). To find the optimal values of the function ρ(P) with respect to the transient pressure P (optimal values of pressure), we look for the zeros gradient of the series (15) as follows, where B 1 , B 2 , B 3 are, Controlling the pressure of hydrogen-natural gas mixture in an inclined pipeline Now, to find the optimum values of c(P) with respect to pressure P we look for the zeros gradient of the series (18), and by solving equation @c @P ¼ 0 we obtain the explicit formula for the optimal values of transient pressure as follows, P optimal; c ' e 2n 1 n 2 C 7 C 12 C 13 ; ð30Þ Controlling the pressure of hydrogen-natural gas mixture in an inclined pipeline with C 7 , C 12 and C 13 are defined as follows, :   Fig 7a and 7b show the optimum values of the pressure P as a function of the initial pressure P 0 and as a function of the mass ratio ϕ, respectively; by using the Eq (29) for = 0.5 and P 0 = 35. As seen in Fig 7a, the optimum values of the pressure P decrease ϕ from 0.00091710 to 0.00091700 with increasing the initial pressure P 0 from 30 to 60.
The results of Fig 7b show that with increasing mass ratio ϕ from 0 to 1, the optimal values of the transient pressure P decrease from 0.00110 to 0.00090. Therefore, the variation of optimum pressure (rP optimal ) with respect to the parameters initial pressure P 0 and mass ratio ϕ respectively are, rP optimal (P 0 ) = 1 × 10 −7 and rP optimal (ϕ) = 2 × 10 −4 . The values of the optimal pressure variations show that sensitivity of the optimal values [25][26][27] of the transient pressure P with respect to the mass ratio ϕ is rP optimal ð�Þ rP optimal ðP 0 Þ ¼ 2�10 À 4 1�10 À 7 ¼ 2000 times more than the sensitivity with respect to the initial pressure P 0 (see Fig 6b and 6c). Fig 8a and 8b shows the optimal values of the pressure P as a function of the initial pressure P 0 and as a function of the mass ratio ϕ, respectively; by using the Eq (29) for ϕ = 0.5 and P 0 = 35. As seen in Fig 8a, the optimal values of the pressure P increases from 0.2465425 (bar) to 0.2465450 (bar) with increasing initial pressure P 0 from 30 to 60. The results from Fig 8b shows that with increasing the mass ratio ϕ from 0 to 1, the optimum values of the pressure P increases from 0.2425 to 0.2470. For Fig 8a and 8b we have, rP optimal (P 0 ) = 2.5 × 10 −6 , rP optimal (ϕ) = 4.5 × 10 −3 and rP optimal ð�Þ rP optimal ðP 0 Þ ¼ 2�10 À 3 1�10 À 6 ¼ 1800. According to Figs 7a and 8b, ratio of the minimum and maximum optimal pressures is, ' 1:011 and ' 0:99, respectively. This means that the initial value ' 0:9943. This means that the mass ratio is very important parameter for controlling the optimum pressure in the pipeline (see Fig 10). The Figs 7(a), 7(b), 8(a) and 8(b) show that the mass ratio is important case for controlling the optimum pressure in the pipeline . Fig 6b and 6c show the validation of the results showed in the Figs 7 and 8.
In statistics, a confidence interval (CI) is a type of interval estimate, computed from the statistics of the observed data, that might contain the true value of an unknown parameter [28][29][30]. Therefore, the confidence interval for the optimum values of the pressure P is defined as ½min P 0 ; � P optimal ; max P 0 ; � P optimal Þ, where min P 0 ; � P optimal and max P 0 ; � P optimal are given by, with max P 0 ½ðP optimal Þ c Þ ¼ 0:246545; min P 0 ½ðP optimal Þ r Þ ¼ 0:0009170 and max ϕ [(P optimal ) c ] = 0.2470, min ϕ [(P optimal ) ρ ] = 0.00090.

Pressure control by reining mass ratio
Taylor series and Zero Gradient Control are used here to control the mass ratio for obtaining efficient transient pressure. The optimum values for the mass ratio ϕ cannot be obtained using Eqs (8) and (10). To overcome this problem, we use the Taylor series of those equations with respect to the parameter ϕ of order n as follows (see references [24,30]), for n = 2, cð�Þ ¼ 1 ffi ffi ffi ffi ffi ffi ffi ffi with H 4 , and L 1 , L 2 , L 3 and H 1 , H 2 , H 3 are defined as, To find the optimal values of ρ(ϕ) and c(ϕ) with respect to the parameter mass ratio ϕ, we look for the zeros of the gradient of the functions ρ(ϕ) and c(ϕ) as follows (see reference [24]), @c @� ¼ À 1 2 H 1 n 1 r h 0 À 2H 2 n 1 r g 0 þ H 2 n 2 r g 0 H 1 n 1 r h 0 : 1 ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi ffi with H 5 defined as follows, and by solving the equations @r @� ¼ 0 and @c @� ¼ 0 we can obtain the optimal values of the mass ratio ϕ explicitly as follows, � optimal;c ¼ À 2½H 1 n 1 r h 0 À 2H 2 n 1 r g 0 þ H 2 n 2 r g 0 �H 1 n 1 r h 0 with H 6 defined as follows, Fig 9 presents the variation of optimal mass ratio ϕ as a function of the pressures P and P 0 by using the Eqs (35) and (36) . Fig 9a and 9b show that the maximum and minimum values for the optimum mass ratio variations respectively are as, min ρ ϕ optimal = 0.0708, max ρ ϕ optimal = 0.0725 and min c ϕ optimal = 0.288, max c ϕ optimal = 0.295. As seen from the results with increasing the initial pressure P 0 from 30 up to 90, the variation optimum mass ratio increases. For P = 60, and different values of initial pressure P 0 = 30, 60, 90 we have the max mass ratio variations as Δϕ optimal,ρ = 0.07222, 0.07113, 0.07132 Δϕ optimal,c = 0.2915, 0.2892, 0.2882. This means that for controlling the optimal pressure we must decrease rϕ or increase rP 0 (see Fig 10).

Conclusion
The Taylor series approximation coupled with regression analysis was used to solve the flow equations of hydrogen natural gas mixture in an inclined pipeline. To validate the approximation series, Fig 3 shows   Controlling the pressure of hydrogen-natural gas mixture in an inclined pipeline in Figs 5 and 6 show that the obtained results using proposed method are in good agreement with those of reduced order modelling (ROM) and the method of characteristics (MOC). Then, our method is working as well as other methods and give the smoother results.
A method called Zero Gradient Control (ZGC) was applied to control the optimal transient pressure. The basic concept ZGC is to develop algebraic terms of density and celerity pressure wave equations for the partial derivatives with respect to initial pressure, mass ratio and transient pressure. The great advantage of ZGC is to not to have to solve a nonlinear system of equations which would allow to determine equations for the optimal set points that are not coupled. The equations derived for density and celerity pressure wave can be applied to many systems in different fields. According to the results of the proposed method the ratio of pressure with respect to the mass ratio ϕ and initial pressure P 0 are 1.22 and 1.011, respectively (see Figs 7 and 8). The results show that the mass ratio is important for controlling the optimal pressure in an inclined pipeline. Fig 9 shows that for P = 60, and different values of initial pressure P 0 = 30, 60, 90 we have the optimal mass ratio variations as Δϕ optimal,ρ = 0.07222, 0.07113, 0.07132 and Δϕ optimal,c = 0.2915, 0.2892, 0.2882. This means that for controlling the optimal pressure we must decrease rϕ or increase rP 0 (see Fig 10). As seen from