Optimal Boundary Control for Water Hammer Suppression in Fluid Transmission Pipelines ·...

24
Optimal Boundary Control for Water Hammer Suppression in Fluid Transmission Pipelines 1 Tehuan Chen a , Chao Xu a2 , Zhigang Ren a , Ryan Loxton b a State Key Laboratory of Industrial Control Technology and Institute of Cyber-Systems & Control, Zhejiang University, Hangzhou, Zhejiang 310027, China. b Department of Mathematics & Statistics, Curtin University, Perth, Western Australia 6845, Australia. Abstract When fluid flow in a pipeline is suddenly halted, a pressure surge or wave is created within the pipeline. This phenomenon, called water hammer, can cause major damage to pipelines, including pipeline ruptures. In this paper, we model the problem of mitigating water hammer during valve closure by an optimal boundary control problem involving a nonlinear hyperbolic PDE system that describes the fluid flow along the pipeline. The control variable in this system represents the valve boundary actuation implemented at the pipeline terminus. To solve the boundary control problem, we first use the method of lines to obtain a finite-dimensional ODE model based on the original PDE system. Then, for the boundary control design, we apply the control parameterization method to obtain an approximate optimal parameter selection problem that can be solved using nonlinear optimization techniques such as Sequential Quadratic Programming (SQP). We conclude the paper with simulation results demonstrating the capability of optimal boundary control to significantly reduce flow fluctuation. Keywords: Water hammer, Optimal boundary control, Method of lines, Hyperbolic partial differential equation, Control parameterization method 1. Introduction Water hammer occurs when fluid moving through a pipeline is forced to suddenly stop or change direction. This sudden change in motion, which could be due to valve closure, pump failure, or unexpected pipeline damage, causes a pressure wave to propagate along the pipeline at high speed [1, 2]. The wave speed can be over 1000m/s, with significant pressure oscillation, often causing loud noises and serious damage [3]. In severe cases, water hammer may even cause the pipeline to rupture, resulting in slurry and water leakage (examples of pipeline rupture are shown in Figure 1) [4]. Fluid pipeline failures due to water hammer effects are described in detail in [5, 6]. The mathematical equations describing water hammer consist of hyperbolic or parabolic partial differential equations. Numerous methods for solving these equations, and thereby 1 This work was partially supported by the National Natural Science Foundation of China through grants F030119-61104048, 2012AA041701 and 61320106009. 2 Correspondence to: Chao Xu, Email: [email protected] Preprint submitted to Computers and Mathematics with Applications October 6, 2018 arXiv:1411.7462v1 [cs.CE] 27 Nov 2014

Transcript of Optimal Boundary Control for Water Hammer Suppression in Fluid Transmission Pipelines ·...

Optimal Boundary Control for Water Hammer Suppression in

Fluid Transmission Pipelines 1

Tehuan Chena, Chao Xua2, Zhigang Rena, Ryan Loxtonb

a State Key Laboratory of Industrial Control Technology and Institute of Cyber-Systems & Control,Zhejiang University, Hangzhou, Zhejiang 310027, China.

b Department of Mathematics & Statistics, Curtin University, Perth, Western Australia 6845,Australia.

Abstract

When fluid flow in a pipeline is suddenly halted, a pressure surge or wave is createdwithin the pipeline. This phenomenon, called water hammer, can cause major damage topipelines, including pipeline ruptures. In this paper, we model the problem of mitigatingwater hammer during valve closure by an optimal boundary control problem involvinga nonlinear hyperbolic PDE system that describes the fluid flow along the pipeline. Thecontrol variable in this system represents the valve boundary actuation implemented atthe pipeline terminus. To solve the boundary control problem, we first use the methodof lines to obtain a finite-dimensional ODE model based on the original PDE system.Then, for the boundary control design, we apply the control parameterization methodto obtain an approximate optimal parameter selection problem that can be solved usingnonlinear optimization techniques such as Sequential Quadratic Programming (SQP).We conclude the paper with simulation results demonstrating the capability of optimalboundary control to significantly reduce flow fluctuation.

Keywords: Water hammer, Optimal boundary control, Method of lines, Hyperbolicpartial differential equation, Control parameterization method

1. Introduction

Water hammer occurs when fluid moving through a pipeline is forced to suddenly stopor change direction. This sudden change in motion, which could be due to valve closure,pump failure, or unexpected pipeline damage, causes a pressure wave to propagate alongthe pipeline at high speed [1, 2]. The wave speed can be over 1000m/s, with significantpressure oscillation, often causing loud noises and serious damage [3]. In severe cases,water hammer may even cause the pipeline to rupture, resulting in slurry and waterleakage (examples of pipeline rupture are shown in Figure 1) [4]. Fluid pipeline failuresdue to water hammer effects are described in detail in [5, 6].

The mathematical equations describing water hammer consist of hyperbolic or parabolicpartial differential equations. Numerous methods for solving these equations, and thereby

1 This work was partially supported by the National Natural Science Foundation of China throughgrants F030119-61104048, 2012AA041701 and 61320106009.

2 Correspondence to: Chao Xu, Email: [email protected]

Preprint submitted to Computers and Mathematics with Applications October 6, 2018

arX

iv:1

411.

7462

v1 [

cs.C

E]

27

Nov

201

4

Figure 1: Examples of pipeline damage caused by water hammer (Source:http://traction.armintl.com/traction#/single& proj=Docs&rec=403&brief=n)

simulating water hammer, have been developed over the past forty years. These meth-ods can be divided into three groups: analytical methods [7], graphical methods [8] andnumerical methods [9]. The graphical and analytical methods are only applicable undervarious simplifying assumptions, and thus their value is limited in practical scenarios. Inparticular, the graphical and analytical methods cannot deal with the cavitation causedby negative pressure [10]. Numerical methods for simulating water hammer includethe fluid-structure interaction method [11], the method of characteristics [12, 13], theheterogenous multiscale method [14], the finite volume method [15], and the wave planmethod [16]. In this paper, we apply the method of lines [17, 18] to approximate the wa-ter hammer PDEs by a system of ODEs. This approach enables the application of ODEoptimal control techniques, for which there are many existing high-quality numericalalgorithms, to determine optimal valve closure strategies to mitigate water hammer.

To protect a pipeline system from water hammer effects, various passive protec-tion strategies can be employed. These include using special materials to reinforce thepipeline and installing special devices such as relief valves, air chambers, and surge tanks[19]. However, the success of these strategies depends heavily on the characteristics ofthe pipeline system and on the experience of the designer/operator [20]. Moreover,although passive protection strategies can act as a guard against water hammer, it isusually better to try and prevent water hammer from occurring in the first place. Hence,effective control strategies for valve closure are required to avoid the worst effects of waterhammer, such as hazardous pipeline collapse.

The water hammer process involves nonlinearities and is non-uniform in space and

2

time. Therefore, optimal flow control requires a forecasting model capable of predictingthe non-uniform and unsteady water flow in space and time. Furthermore, due to flownonlinearities, it is difficult to establish the relationship between the control action andthe corresponding response in the hydrodynamic variables. Thus, effective valve controlstrategies are essential. Cao [21] used functional extremum theory and the Ritz methodto design optimal rules for both velocity change and valve closure to minimize the peakpressure at the valve. Axworthy [22] developed a valve closure algorithm for node-based, graph-theoretic models that can be applied within a slow transient (rigid watercolumn) pipeline network. Tian [23] investigated the optimum design of parallel pumpfeedwater systems in nuclear power plants to mitigate the potential damage caused byvalve-induced water hammer. Feng [24] proposed an optimal control method for theregulation of multiple valves, focusing on the active causes of water hammer. Now, withthe rapid development of modern control theory and numerical methodologies, advancesin nonlinear optimization have made the solution of nonlinear flow control problemspossible. Accordingly, in this paper, we propose an effective numerical approach todetermine optimal boundary controls for valve closure in fluid pipelines.

The paper is organized as follows. In Section 2, we introduce a hyperbolic PDEsystem to describe the fluid flow dynamics in the pipeline, after which we propose anoptimal control problem for water hammer suppression during valve closure. In Sec-tion 3, we use the method of lines to approximate the hyperbolic PDE system by anon-stationary state space ODE model. Then, in Section 4, we use the control param-eterization method, with both piecewise-linear and piecewise-quadratic basis functions,to solve the optimal control problem by designing the boundary controller to minimizepressure fluctuation. Finally, in Section 5, we give numerical results to demonstrate thesuperiority of the optimal boundary control strategy compared with the non-optimal(but widely-used) strategy of abruptly shutting off the valve.

2. Problem Formulation

2.1. Mathematical Model

We consider the situation shown in Figure 2, where a pipeline of length L is usedto transport fluid from a reservoir to a terminus connected to a larger pipeline network.Let l ∈ [0, L] denote the spatial variable along the pipeline, and let t ∈ [0, T ] denotethe time variable. By neglecting the effects of viscosity, turbulence, and temperaturevariation, the flow along the pipeline can be described by the following hyperbolic PDEsystem [25, 26, 27], which consists of a momentum equation and a continuity equation:

∂v(l, t)

∂t= −1

ρ

∂p(l, t)

∂l− fv(l, t) |v(l, t)|

2D, (1a)

∂p(l, t)

∂t= −ρc2∂v(l, t)

∂l, (1b)

where v is the flow velocity, p is the edge pressure drop, D is the diameter of the pipeline,c is the wave velocity, f is the Darcy-Weisbach friction factor and ρ is the flow density.The boundary conditions for system (1) are

p(0, t) = P, v(L, t) = u(t), t ∈ [0, T ], (2)

3

Figure 2: General layout of the pipeline system described in Section 2.1

where P is the pressure generated by the reservoir (a given constant), and u(t) is aboundary control variable that models actuation from a valve situated at the pipelineterminus. Our interest is in modeling the fluid flow during the valve closure period, whichbegins at t = 0 and ends at t = T . The boundary control, which must be manipulatedto implement the valve closure, is required to satisfy the following bound constraint:

0 ≤ u(t) ≤ umax, t ∈ [0, T ], (3)

where umax denotes the maximum velocity. The rate of change in the boundary controlis also subject to lower and upper bounds:

−umax ≤ u(t) ≤ umax, t ∈ [0, T ], (4)

where umax is a given constant. Since we require the valve to be completely closed atthe terminal time,

u(T ) = 0. (5)

Any continuous function u : [0, T ] → R that is differentiable almost everywhere andsatisfies (3)-(5) is called an admissible boundary control policy.

The initial conditions for system (1) are

p(l, 0) = p0(l), v(l, 0) = v0(l), l ∈ [0, L], (6)

where p0(l) and v0(l) are given functions describing the initial state of the pipeline.

2.2. The Optimal Boundary Control Problem

Since closing the valve suddenly could cause severe water hammer effects, the bound-ary control u(t) must be manipulated carefully to minimize pressure fluctuation. To thisend, we consider the following objective function as proposed in references [28, 29]:

J = (p(L, T )− p(L))2γ +1

T

∫ T

0

(p(L, t)− p(L))2γdt

+1

LT

∫ T

0

∫ L

0

(p(l, t)− p(l))2γdxdt,

(7)

where γ is a positive integer and p(l) is a given function expressing the target pressureprofile along the pipeline. The objective function (7) penalizes deviation between the

4

1Nv

Np1p0p1v Nv

. . .2p

2v

-1Np

1( )p t1( )v t

. . .0 ( )v t0( )p t

2 ( )v t2 ( )p t

3( )v t3( )p t

4 ( )v t4 ( )p t

5( )v t5( )p t

6( )v t6 ( )p t

( )Nv t1( )Np t ( )Np t1( )Nv t

0l 1l 2l 3l 4l 5l 6l 1Nl Nl

Figure 3: Pipeline spatial discretization using the method of lines

actual pressure in the pipeline and the target pressure profile: the first term in (7) pe-nalizes pressure deviation at the valve at the terminal time, the second term penalizespressure deviation at the valve across the entire time horizon, and the third term pe-nalizes global pressure deviation over the entire pipeline length and time horizon. Thereason for placing special emphasis in (7) at the valve location is that the valve willnormally contain sensitive electrical components that must be protected. Our optimalboundary control problem is now defined as follows.

Problem P0. Given the system (1) with boundary conditions (2) and initial conditions(6), choose the boundary control u : [0, T ] → R to minimize the objective function (7)subject to the bound constraints (3) and (4) and the terminal control constraint (5).

3. Spatial Discretization

To simplify Problem P0, we will use the method of lines to approximate the PDEmodel by a state space ODE model. First, we decompose the pipeline into equally-spacedintervals [li−1, li] , i = 1, . . . , N , where N is an even integer and l0 = 0 and lN = L. Define

vi(t) = v(li, t), i = 0, . . . , N,

andpi(t) = p(li, t), i = 0, . . . , N.

These definitions, along with the spatial node points, are shown in Figure 3.Based on the definitions of vi and pi, we obtain the following finite difference approx-

imations:

∂p(li, t)

∂l=pi+1(t)− pi(t)

∆l, i = 0, . . . , N − 1, (8a)

∂v(li, t)

∂l=vi(t)− vi−1(t)

∆l, i = 1, . . . , N, (8b)

where ∆l = L/N . Substituting the finite difference approximations (8a) and (8b) intothe PDE model (1a) and (1b) yields

vi(t) =1

ρ∆l(pi(t)− pi+1(t))− fvi(t) |vi(t)|

2D, i = 0, . . . , N − 1, (9a)

pi(t) =ρc2

∆l(vi−1(t)− vi(t)), i = 1, . . . , N. (9b)

By virtue of the definitions of vi and pi, the boundary conditions (2) become

p0(t) = P, vN(t) = u(t), t ∈ [0, T ]. (10)

5

To simplify the notation, let

x(t) =[p1(t) · · · pN(t) v0(t) · · · vN−1(t)

]T ∈ R2N ,

|x(t)| =[|p1(t)| · · · |pN(t)| |v0(t)| · · · |vN−1(t)|

]T ∈ R2N .

Then, by using the boundary conditions (10), equations (9a) and (9b) can be written incompact form as

x(t) = Ax(t) + u(t)a + Pb +Bx(t) ◦ |x(t)| , (11)

where ◦ denotes the Hadamard product, and

A =

[0 A12

A21 0

]∈ R2N×2N ,

A12 =ρc2

∆l

1 −1 0 · · · 0 00 1 −1 · · · 0 00 0 1 · · · 0 0...

......

. . ....

...0 0 0 · · · 1 −10 0 0 · · · 0 1

∈ RN×N ,

A21 =1

ρ∆l

−1 0 0 · · · 0 01 −1 0 · · · 0 00 1 −1 · · · 0 0...

......

. . ....

...0 0 0 · · · −1 00 0 0 · · · 1 −1

∈ RN×N ,

a = [ 0 · · · −ρc2

∆l0 · · · 0 ]T ∈ R2N ,

b = [ 0 · · · 0 1ρ∆l

· · · 0 ]T ∈ R2N ,

B = − f

2D

[0 00 I

]∈ R2N ,

and I is the N ×N identity matrix. The initial conditions (6) become

x(0) =[p0(l1) · · · p0(lN) v0(l0) · · · v0(lN−1)

]T ∈ R2N . (12)

Furthermore, using Simpson’s rule [30], the objective function (7) becomes

J = (xN(T )− p(L))2γ +

∫ T

0

{3N + 1

3NT(xN(t)− p(L))2γ

+1

3TN(P − p(0))2γ +

4

3TN

N/2∑j=1

(x2j−1(t)− p(l2j−1))2γ

+2

3TN

N/2−1∑j=1

(x2j(t)− p(l2j))2γ

}dt.

(13)

6

Note that the term (P−p(0))2γ in the integral is a constant. Hence, instead of minimizing(13), we can equivalently minimize the following modified objective function:

J = (xN(T )− p(L))2γ +

∫ T

0

{3N + 1

3NT(xN(t)− p(L))2γ

+4

3TN

N/2∑j=1

(x2j−1(t)− p(l2j−1))2γ +2

3TN

N/2−1∑j=1

(x2j(t)− p(l2j))2γ

}dt.

(14)

Our approximate problem is now stated as follows.

Problem PN . Given the system (11) with initial condition (12), choose the optimalcontrol u : [0, T ] → R to minimize the objective function (14) subject to the boundconstraints (3) and (4) and the terminal control constraint (5).

4. Control Parameterization

Problem PN is a conventional optimal control problem governed by ODEs. To solveProblem PN numerically, we will use the control parameterization method [31], whichinvolves approximating the control by a linear combination of basis functions, where thecoefficients in the linear combination are decision variables to be optimized. Then, byexploiting special formulae for the gradient of the objective function, the resulting ap-proximate problem can be solved using standard gradient-based optimization techniques[32].

Control parameterization is normally applied with piecewise-constant basis functions[32]. However, piecewise-constant control approximation is not suitable for Problem PN

because the boundary controller in Problem PN is required to be continuous. Thus, weinstead develop two continuous approximation schemes: one with piecewise-linear basisfunctions, the other with piecewise-quadratic basis functions.

4.1. Piecewise-Linear Control Parameterization

For piecewise-linear control parameterization [33], we approximate the derivative ofthe boundary control as follows:

u(t) ≈ σk, t ∈ [tk−1, tk), k = 1, . . . , r, (15)

where r > 1 is the number of approximation subintervals, [tk−1, tk) is the kth approxi-mation subinterval, and σk is the rate of change of the control on the kth subinterval.Moreover, tk, k = 0, . . . , r, are fixed knot points such that

0 = t0 < t1 < t2 < · · · < tr−1 < tr = T. (16)

We can write equation (15) as

u(t) ≈r∑

k=1

σkχ[tk−1,tk)(t), (17)

7

where χ[tk−1,tk)(t) is the indicator function defined by

χ[tk−1,tk)(t) =

{1, if t ∈ [tk−1, tk),

0, otherwise.(18)

With u(t) approximated by a piecewise-constant function according to (17), u(t) ispiecewise-linear with jumps in the derivative at t = t1, t2, . . . , tr−1. Let x2N+1(t) = u(t)be a new state variable. Then x2N+1(t) is governed by the following dynamics:

x2N+1(t) =r∑

k=1

σkχ[tk−1,tk)(t), t ∈ [0, T ], (19a)

x2N+1(0) = u0, (19b)

where u0 = umax is the initial value of u(t). In view of (3), we require the followingcontinuous state inequality constraint:

0 ≤ x2N+1(t) ≤ umax, t ∈ [0, T ]. (20)

Clearly, since x2N+1(t) is piecewise-linear with break points at t = t1, t2, . . . , tr−1, thiscontinuous state inequality constraint is equivalent to the following constraints:

0 ≤ x2N+1(tk) ≤ umax, k = 1, . . . , r. (21)

Such constraints are known as canonical constraints in the optimal control literature[32].

Under the piecewise-linear control parameterization scheme (17), the constraints (4)become

−umax ≤ σk ≤ umax, k = 1, . . . , r. (22)

In addition, the dynamic system (11) becomes

x(t) = Ax(t) + x2N+1(t)a + Pb +Bx(t) ◦ |x(t)| , t ∈ [0, T ]. (23)

Furthermore, the terminal control constraint (5) becomes the following terminal stateconstraint:

x2N+1(T ) = 0. (24)

Our approximate problem is defined as follows.

Problem PrN . Given the system defined by (19), (23), and (12), choose the control

parameter vector σ =[σ1 · · · σr

]∈ Rr to minimize the objective function (14)

subject to the bound constraints (22) and the state constraints (21) and (24).

4.2. Solving Problem PrN

The approximate problem defined in Section 4.1 is a nonlinear optimization problemin which a finite number of decision variables need to be chosen to minimize an objectivefunction subject to a set of constraints. For this approximate problem, the objectivefunction is an implicit—rather than explicit—function of the decision variables. Thus,computing the gradient of the objective function, as required to solve the approximate

8

problem using gradient-based optimization methods such as SQP, is a non-trivial task.Nevertheless, we will now show that this gradient can be computed using the sensitivityapproach described in [34, 35]. Then, the SQP method can be applied to generate searchdirections that lead to profitable areas of the search space [36].

First, let xr(·|σ) and xr2N+1(·|σ) denote the solution of the enlarged system defined by(19), (23), and (12) corresponding to the control parameter vector σ =

[σ1 · · · σr

].

Then we have the following result.

Theorem 1. For each m = 1, . . . , r, the state variation of xr2N+1(·|σ) on the interval[tm−1, tm] is given by

∂xr2N+1(t|σ)

∂σk=

t− tm−1, if k = m,

tk − tk−1, if k < m,

0, if k > m.

(25)

Proof. The proof is by induction. For m = 1, it follows from (19) that

xr2N+1(t|σ) = umax + σ1(t− t0) = umax + σ1t, t ∈ [0, t1]. (26)

Then clearly, for all t ∈ [0, t1],

∂xr2N+1(t|σ)

∂σk=

{t, if k = 1,

0, if k > 1,(27)

which shows that (25) is satisfied for m = 1. Now, suppose that (25) holds for m = q.Then for all t ∈ [tq−1, tq],

∂xr2N+1(t|σ)

∂σk=

t− tq−1, if k = q,

tk − tk−1, if k < q,

0, if k > q.

(28)

For m = q + 1, equation (19a) implies

xr2N+1(t|σ) = xr2N+1(tq|σ) + σq+1(t− tq), t ∈ [tq, tq+1]. (29)

Hence, for all t ∈ [tq, tq+1],

∂xr2N+1(t|σ)

∂σk=

t− tq, if k = q + 1,∂xr2N+1(tq |σ)

∂σk , if k < q + 1,

0, if k > q + 1.

(30)

Applying the inductive hypothesis yields

∂xr2N+1(t|σ)

∂σk=

t− tq, if k = q + 1,

tk − tk−1, if k < q + 1,

0, if k > q + 1.

(31)

This shows that (25) holds for m = q + 1. Thus, the result follows from mathematicalinduction.

9

Clearly,∂xr(t|σ)

∂σk= 0, t ∈ [0, tk−1]. (32)

Moreover, for each m = k, k + 1, . . . , r,

xr(t|σ) = xr(tm−1|σ) +

∫ t

tm−1

{Axr(s|σ) + axr2N+1(s|σ)

+ bP +Bxr(s|σ) ◦ |xr(s|σ)|}ds, t ∈ [tm−1, tm].

(33)

Differentiating (33) with respect to σk gives

∂xr(t|σ)

∂σk=∂xr(tm−1|σ)

∂σk+

∫ t

tm−1

{A∂xr(s|σ)

∂σk+ a

∂xr2N+1(s|σ)

∂σk

+2B |xr(s|σ) | ◦ ∂xr(s|σ)

∂σk

}ds, t ∈ [tm−1, tm), m = k, k + 1, . . . , r.

(34)

Thus, differentiating (34) with respect to time t, we obtain

d

dt

{∂xr(t|σ)

∂σk

}= A

∂xr(t|σ)

∂σk+ a

∂xr2N+1(t|σ)

∂σk

+ 2B |xr(t|σ) | ◦ ∂xr(t|σ)

∂σk, t ∈ [tm−1, tm), m = k, k + 1, . . . , r.

(35)

Based on (32) and (35), we have the following result.

Theorem 2. The state variation of xr(·|σ) with respect to σk is the solution Γk(·|σ) ofthe following sensitivity system:

Γk(t) = AΓk(t) + a∂xr2N+1(t|σ)

∂σk+ 2B |xr(t|σ) | ◦ Γk(t),

t ∈ [tm−1, tm), m = k, k + 1, . . . , r,(36)

where Γk(t) = 0, t ∈ [0, tk−1) and∂xr2N+1(t|σ)

∂σk is given by the formula in Theorem 1.

Clearly, the gradients of constraints (21) and (24) can be computed using Theorem 1.For the objective function, the gradient can be obtained by differentiating (14) usingthe chain rule:

∂J(σ)

∂σk= 2γ(xN(T )− p(L))2γ−1ΓkN(T |σ )

+

∫ T

0

{2γ(3N + 1)

3NT(xN(t)− p(L))2γ−1ΓkN(t |σ )

+8γ

3NT

N/2∑j=1

(x2j−1(t)− p(l2j−1))2γ−1Γk2j−1(t |σ )

+4γ

3NT

N/2−1∑j=1

(x2j(t)− p(l2j))2γ−1Γk2j(t |σ )

}dt.

By incorporating these gradient formulae with a nonlinear programming algorithm suchas SQP, Problem Pr

N can be solved efficiently. The gradient-based optimization frame-work is illustrated in Figure 4. Convergence results showing that the solution of Prob-lem Pr

N converges to the solution of Problem PN are derived in [37, 38, 39].

10

Choose initial guesses for the control parameters

Solve the state and sensitivity systems

Compute the objective and constraint gradients

Use the gradient information to perform an optimality test

Optimal?

Use the gradient information to calculate a search direction

Finish

No

Yes

Perform a line search along the search direction

Update the control parameter values

Op

tim

izati

onalg

ori

thm

(e.g

.,S

QP

)

Figure 4: Gradient-based optimization framework for solving Problem PrN

4.3. Piecewise-Quadratic Control Parameterization

For piecewise-quadratic control parameterization, we approximate the second deriva-tive of the control instead of the first derivative:

u(t) ≈r∑

k=1

σkχ[tk−1,tk)(t), t ∈ [0, T ]. (37)

Then, we introduce two new state variables x2N+1(t) and x2N+2(t) governed by thefollowing dynamics:

x2N+1(t) = x2N+2(t), t ∈ [0, T ], (38a)

x2N+1(0) = u0, (38b)

x2N+2(t) =r∑

k=1

σkχ[tk−1,tk)(t), t ∈ [0, T ], (38c)

x2N+2(0) = u0, (38d)

where u0 and u0 are given constants. Here, x2N+2(t) represents u(t) (a piecewise-linearfunction) and x2N+1(t) represents u(t) (a piecewise-quadratic function). Thus, u0 = umax

(the valve is initially fully open) and u0 is the initial value of u(t). In view of (3) and(4), we have the following continuous state inequality constraints:

0 ≤ x2N+1(t) ≤ umax, t ∈ [0, T ], (39)

11

and−umax ≤ x2N+2(t) ≤ umax, t ∈ [0, T ]. (40)

Since x2N+2(t) is piecewise-linear, the continuous state inequality constraint (40) is equiv-alent to:

−umax ≤ x2N+2(tk) ≤ umax, k = 1, . . . , r. (41)

After applying the piecewise-quadratic control parameterization scheme, the dynamicsystem (11) becomes

x(t) = Ax(t) + x2N+1(t)a + Pb +Bx(t) ◦ |x(t)| , t ∈ [0, T ]. (42)

Furthermore, the terminal control constraint (5) becomes the following terminal stateconstraint:

x2N+1(T ) = 0. (43)

Our approximate problem is defined as follows.

Problem QrN . Given the system defined by (38), (42), and (12), choose the control

parameter vector σ =[σ1 · · · σr

]∈ Rr to minimize the objective function (14)

subject to the state constraints (39), (41) and (43).

4.4. Solving Problem QrN

Like Problem PrN , Problem Qr

N is a nonlinear optimization problem. The only signifi-cant difference is that Problem Qr

N contains a continuous inequality state constraint (39)that cannot be converted into a finite number of conventional constraints. To addressthis difficulty, we first note that (39) is equivalent to the following non-smooth integralconstraints:∫ T

0

max{−x2N+1(t), 0}dt = 0,

∫ T

0

max{x2N+1(t)− umax, 0}dt = 0. (44)

Since the max{·, 0} function is non-smooth, we use the following smooth approximationscheme defined in [39]:

max{y, 0} ≈ φα(y) =1

2

√y2 + 4α2 +

1

2y, (45)

where α > 0 is a smoothing parameter. Note that φα(y) ≥ 0 for all y. Based on thisapproximation scheme, we append constraints (44) to the objective (14) to obtain thefollowing penalty function:

Gα,ω(σ) = J(σ) + ω

{∫ T

0

φα(−x2N+1(t))dt+

∫ T

0

φα(x2N+1(t)− umax)dt

}, (46)

where ω > 0 is a penalty parameter. We now define an approximation of Problem QrN

as follows.

Problem QrN,α,ω. Given the system defined by (38), (42), and (12), choose the control

parameter vector σ =[σ1 · · · σr

]∈ Rr to minimize the penalty function (46) subject

to the state constraints (41) and (43).

12

Note that when α is small, φα(y) is a good approximation of max{y, 0}, and thusProblem Qr

N,α,ω is a good approximation of Problem QrN . Formal convergence results

are given in [39].Let xr(·|σ), xr2N+1(·|σ), and xr2N+2(·|σ) denote the solution of the enlarged sys-

tem defined by (38), (42), and (12) corresponding to the control parameter vectorσ =

[σ1 · · · σr

]. Based on Theorem 1, for t ∈ [tm−1, tm],

∂xr2N+2(t|σ)

∂σk=

t− tm−1, if k = m,

tk − tk−1, if k < m,

0, if k > m.

(47)

The derivative of xr2N+1(t|σ) is given in the following theorem.

Theorem 3. For each m = 1, . . . , r, the state variation of xr2N+1(·|σ) on the interval[tm−1, tm] is given by

∂xr2N+1(t|σ)

∂σk=

12t2 − tm−1t+ 1

2t2m−1, if k = m,

(tk − tk−1)t+ 12t2k−1 − 1

2t2k, if k < m,

0, if k > m.

(48)

Proof. The proof is by induction on m. For m = 1,

xr2N+1(t|σ) = u0 +

∫ t

0

xr2N+2(s|σ)ds, t ∈ [0, t1]. (49)

Thus, using (47), for all t ∈ [0, t1],

∂xr2N+1(t|σ)

∂σk=

∫ t

0

∂xr2N+2(s|σ)

∂σkds =

{12t2, if k = 1,

0, if k > 1.(50)

This shows that (48) is satisfied for m = 1. Now, suppose that (48) holds for m = q.Then for all t ∈ [tq−1, tq],

∂xr2N+1(t|σ)

∂σk=

12t2 − tq−1t+ 1

2t2q−1, if k = q,

(tk − tk−1)t+ 12t2k−1 − 1

2t2k, if k < q,

0, if k > q.

(51)

For t ∈ [tq, tq+1],

xr2N+1(t|σ) = xr2N+1(tq|σ) +

∫ t

tq

xr2N+2(s|σ)ds. (52)

Differentiating (52) with respect to σk gives

∂xr2N+1(t|σ)

∂σk=∂xr2N+1(tq|σ)

∂σk+

∫ t

tq

∂xr2N+2(s|σ)

∂σkds. (53)

13

Thus, if k > q + 1, then clearly

∂xr2N+1(t|σ)

∂σk= 0. (54)

If k = q + 1, then by using (47) and (51) to simplify (53), we obtain

∂xr2N+1(t|σ)

∂σk=

∫ t

tq

(s− tq)ds =1

2t2 − tqt+

1

2t2q. (55)

Finally, if k < q + 1, then the inductive hypothesis (51) implies

∂xr2N+1(tq|σ)

∂σk=

{12t2q − tqtq−1 + 1

2t2q−1, if k = q,

(tk − tk−1)tq + 12t2k−1 − 1

2t2k, if k < q,

= (tk − tk−1)tq +1

2t2k−1 −

1

2t2k.

Thus, (53) becomes

∂xr2N+1(t|σ)

∂σk= (tk − tk−1)tq +

1

2t2k−1 −

1

2t2k +

∫ t

tq

(tk − tk−1)ds

= (tk − tk−1)t+1

2t2k−1 −

1

2t2k.

(56)

Equations (54), (55) and (56) show that (48) holds for m = q + 1. Thus, the resultfollows from mathematical induction.

The state variation of xr(·|σ) in Problem QrN,α,ω can be computed in the same manner

as for Problem PrN . This leads to the following theorem (see Theorem 2).

Theorem 4. The state variation of xr(·|σ) with respect to σk is the solution Ψk(·|σ) ofthe following sensitivity system:

Ψk(t) = AΨk(t) + a∂xr2N+1(t|σ)

∂σk+ 2B |xr(t|σ) | ◦Ψk(t),

t ∈ [tm−1, tm), m = k, k + 1, . . . , r,(57)

where Ψk(t) = 0, t ∈ [0, tk−1) and∂xr2N+1(t|σ)

∂σk is given by the formula in Theorem 3.

Clearly, the gradients of constraints (41) and (43) can be computed using equations(47) and (48). For the penalty function (46), the gradient can be obtained using thechain rule of differentiation:

∂Gα,ω(σ)

∂σk= 2γ(xN(T )− p(L))2γ−1Ψk

N(T |σ ) +

∫ T

0

{2γ(3N + 1)

3NT(xN(t)− p(L))2γ−1Ψk

N(t |σ )

+8γ

3NT

N/2∑j=1

(x2j−1(t)− p(l2j−1))2γ−1Ψk2j−1(t |σ )

+4γ

3NT

N/2−1∑j=1

(x2j(t)− p(l2j))2γ−1Ψk2j(t |σ )

}dt

+ ω

∫ T

0

{dφα(x2N+1(t)− umax)

dy

∂x2N+1(t|σ)

∂σk− dφα(−x2N+1(t))

dy

∂x2N+1(t|σ)

∂σk

}dt,

14

where ∂x2N+1(t|σ)

∂σk is given by the formula in Theorem 3. By incorporating these gradientformulae into a nonlinear programming algorithm such as SQP, Problem Qr

N,α,ω can besolved efficiently. When α is small and ω is large, the solution of Problem Qr

N,α,ω is agood approximation of the solution of Problem Qr

N . See the convergence results in [39]for more details.

5. Numerical Simulations

For the numerical simulations, we consider a stainless steel pipeline of length L =20 meters and diameter D = 100 millimeters. The flow density is taken as ρ =1000 kg/m3. Since the Darcy-Weisbach friction factor f for stainless steel pipelinesis normally contained in the range [0.02, 0.04] (see reference [40]), we choose f = 0.03.Moreover, as in [41], we choose c = 1200 m/s for the wave speed. The reservoir pressureis set at P = 2 × 105 Pa, which corresponds to the pressure exerted by a fluid towerapproximately 20 meters high. We assume that the pipeline fluid flow is initially in thesteady state with constant velocity v0(l) = 2 m/s. It then follows from (1a) that

0 = −1

ρ

∂p0(l)

∂l− 2f

D,

and thus∂p0(l)

∂l= −2ρf

D.

Integrating for p0(l) yields

p0(l) = P − 2ρf

Dl.

We choose γ = 2 in the objective function (14). In our numerical experience, largervalues of γ have little effect on the results—this is consistent with the observations inreference [28], which advocates γ = 2 as the best choice. For the control bounds, we setumax = 2 and umax = 10, and for the terminal time, we set T = 10 seconds. Moreover,we define p(l) = P = 2 × 105 Pa as the target pressure profile, since when the valveis completely closed the pressure will be constant across the pipeline (and equal to thereservoir pressure) in steady state.

Our numerical simulation study was carried out within the MATLAB programmingenvironment (version R2010b) running on a personal computer with the following config-uration: Intel Core i5-2320 3.00GHz CPU, 4.00GB RAM, 64-bit Windows 7 OperatingSystem. Our MATLAB code implements the gradient-based optimization procedure inFigure 4 by combining FMINCON with the sensitivity method for gradient computation.

5.1. Piecewise-Linear Control Parameterization

Using the piecewise-linear control parameterization method with r = 10 subintervals,we solved Problem Pr

N for N = 16, 18, 20, 22, 24. Our MATLAB program uses the in-built differential equation solver ODE23 to solve the state system (23) and the sensitivitysystems (36) and (57).

The optimal objective function values are given in Table 1. Moreover, the optimalcontrol parameters for N = 24 are given in Table 2. According to equation (19a), theoptimal values in Table 2 are the slopes of the optimal piecewise-linear control, which is

15

0 1 2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

velo

city

(m

/s)

t (s)

Figure 5: Optimal piecewise-linear control for N = 24

Table 1: Optimal objective values for Section 5.1 (piecewise-linear control parameterization)

N 16 18 20 22 24

J(σ) 64831 60913 37934 29243 25201

plotted in Figure 5. In comparison, the objective values corresponding to the “immediateclosure” strategy (in which the valve is closed abruptly) and the “constant closure rate”strategy (in which the valve is closed steadily at a constant rate) are 1.4069× 1015 and7.5321× 104, respectively—both much higher than the objective values in Table 1.

5.2. Piecewise-Quadratic Control Parameterization

We set α = 10−6 as the smoothing parameter and ω = 1 as the penalty parame-ter. We observed that ODE23 in MATLAB performs poorly in the piecewise-quadraticcase. Thus, we changed the code to use ODE15s instead of ODE23 to solve the stateand sensitivity systems. To determine good initial values for σk, we constructed aninitial piecewise-quadratic function (with smooth derivative) to approximate the opti-mal piecewise-linear control. This piecewise-quadratic function interpolates the optimal

Table 2: Optimal control parameters for Section 5.1 with N = 24 (piecewise-linear control parameteri-zation)

k 1 2 3 4 5

σk −0.3582 −0.3214 −0.2771 −0.1700 −0.1405

k 6 7 8 9 10

σk −0.1923 −0.1702 −0.1533 −0.3750 −0.0795

16

Table 3: Optimal objective values for Section 5.2 (piecewise-quadratic control parameterization)

N 16 18 20 22 24

J(σ) 15262 13911 10192 10190 10187

Table 4: Optimal control parameters for Section 5.2 with N = 24 (piecewise-quadratic control param-eterization)

k 1 2 3 4 5

σk −0.0577 −0.1220 −0.0096 0.0551 −0.0614

k 6 7 8 9 10

σk −0.0172 −0.0191 −0.0032 −0.0324 0.0943

piecewise-linear control at the temporal knot points, and their derivatives are equalat the initial time. After constructing the initial piecewise-quadratic control, the corre-sponding initial values of σk were subsequently obtained. The optimal objective functionvalues for r = 10 and N = 16, 18, 20, 22, 24 are given in Table 3. The optimal controlparameters for N = 24 are given in Table 4 and the corresponding optimal piecewise-quadratic control is shown in Figure 6. The pressure profiles at the pipeline terminus forthe optimal piecewise-quadratic control, the optimal piecewise-linear control, and theconstant closure rate control strategy are compared in Figure 7. It is clearly apparentfrom the figure that the piecewise-quadratic strategy results in the smoothest pressureprofile with the least fluctuation. Figure 8 gives another comparison between the dif-ferent control strategies for the pressure profile along the pipeline at the terminal timet = 10s. Moreover, Figures 9-12 show the evolution of the pressure profile over the timeand space domains, for each of the four control strategies: immediate closure, constantclosure rate, optimal piecewise-linear, and optimal piecewise-quadratic. As expected,the pressure profile for the immediate closure strategy is the most volatile.

6. Conclusions and Future Work

This paper has presented an effective computational method for solving a finite-timeoptimal control problem for water hammer suppression during valve closure in fluidpipelines. The method is based on a combination of the method of lines (for discretiz-ing the fluid flow PDEs) and the control parameterization method (for discretizing theboundary control function). By applying these two methods in conjunction, the opti-mal control problem is reduced to an optimal parameter selection problem that can besolved using numerical optimization algorithms. Simulation results demonstrate thatthis approach is highly effective at mitigating water hammer. Note that our proposedapproach involves first discretizing the PDEs to obtain a set of ODEs, and then applyingODE optimal control techniques to determine the optimal valve actuation strategy. Analternative approach would be to apply PDE optimal control techniques directly to thefluid flow model. This will be considered in future work. We also plan to investigatevarious modifications of the objective function (14). For example, the different terms in

17

0 1 2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2

velo

city

(m

/s)

t (s)

Figure 6: Optimal piecewise-quadratic control for N = 24

0 1 2 3 4 5 6 7 8 9 101.86

1.88

1.9

1.92

1.94

1.96

1.98

2

2.02

2.04

2.06x 10

5

t (s)

pres

sure

(P

a)

piecewise−quadraticpiecewise−linearconstant closure rate

Figure 7: Pressure at the pipeline terminus corresponding to the optimal piecewise-quadratic strategy,the optimal piecewise-linear strategy and the constant closure rate strategy (all for N = 24)

18

0 2 4 6 8 10 12 14 16 18 201.995

2

2.005

2.01

2.015

2.02

2.025

2.03

2.035x 10

5

pres

sure

(P

a)

l (m)

constant closure ratepiecewise−linearpiecewise−quadratic

Figure 8: Pressure along the pipeline at the terminal time t = 10s corresponding to the optimalpiecewise-quadratic strategy, the optimal piecewise-linear strategy and the constant closure rate strategy(all for N = 24)

Figure 9: Pressure profile corresponding to the immediate closure strategy

19

0

5

10

15

20 0 2 4 6 8 10

1.9

1.95

2

2.05

2.1

x 105

t (s)

l (m)

pres

sure

(P

a)

Figure 10: Pressure profile corresponding to the constant closure rate strategy

0

5

10

15

200 2 4 6 8 10

1.9

1.95

2

2.05

2.1

x 105

t (s)

l (m)

pres

sure

(P

a)

Figure 11: Pressure profile corresponding to the optimal piecewise-linear strategy

20

0

5

10

15

200 2 4 6 8 10

1.9

1.95

2

2.05

2.1

x 105

t (s)

l (m)

pres

sure

(P

a)

Figure 12: Pressure profile corresponding to the optimal piecewise-quadratic strategy

(14) can be assigned different weights, or the objective can be changed to track a givenvelocity profile rather than a pressure profile.

References

References

[1] A. Bergnt, A. R. Simpson, and E. Sijamhodzic. Water hammer analysis of pump-ing systems for control of water in underground mines. In Proceedings of the 4thInternational Mine Water Association Congress, pages 9–20, 1991.

[2] D. Sciamarella and G. Artana. A water hammer analysis of pressure and flow inthe voice production system. Speech Communication, 51(4):344–351, 2009.

[3] K. H. Asli, F. B. O. Naghiyev, and A. K. Haghi. Some aspects of physical andnumerical modeling of water hammer in pipelines. Nonlinear Dynamics, 60(4):677–701, 2010.

[4] W. Erath, B. Nowotny, and J. Maetz. Modelling the fluid structure interactionproduced by a water hammer during shutdown of high-pressure pumps. NuclearEngineering and Design, 193(3):283–296, 1999.

[5] C. Schmitt, G. Pluvinage, E. Hadj-Taieb, and R. Akid. Water pipeline failure dueto water hammer effects. Fatigue & Fracture of Engineering Materials & Structures,29(12):1075–1082, 2006.

21

[6] S. Jallouf, C. Schmitt, G. Pluvinage, E. Hadj-Taıeb, and M. Lebienvenu. A proba-bilistic safety factor for defect assessment of water pipes subjected to water hammer.The Journal of Strain Analysis for Engineering Design, 46(1):14–26, 2011.

[7] Y. G. Cai. Fluid Dynamics in Pipeline Transport. Zhejiang University Press,Hangzhou, 1990.

[8] M. D. Saikia and A. K. Sarma. Simulation of water hammer flows with unsteadyfriction factor. ARPN Journal of Engineering and Applied Sciences, 1(4):35–40,2006.

[9] B. Pierre and J. S. Gudmundsson. Coincidental match of numerical simulation andphysics. In IOP Conference Series: Earth and Environment, 2010.

[10] Y. K. Qiu, B. R. Li, X. Y. Fu, G. Yang, and J. H. Hu. Suppressing water hammerof ship steering systems with hydraulic accumulator. Proceedings of the Institutionof Mechanical Engineers: Part E – Journal of Process Mechanical Engineering,228(2):136–148, 2014.

[11] C. S. W. Lavooij and A. S. Tusseling. Fluid-structure interaction in liquid-filledpiping systems. Journal of Fluids and Structures, 5(5):573–595, 1991.

[12] A. E. Vardy and K. L. Hwang. A characteristics model of transient friction in pipes.Journal of Hydraulic Research, 29(5):669–684, 1991.

[13] M. A. Bouaziz, M. A. Guidara, C. Schmitt, E. Hadj-Taıeb, and Z. Azari. Waterhammer effects on a gray cast iron water network after adding pumps. EngineeringFailure Analysis, 44:1–16, 2014.

[14] S. Blazic, G. Geiger, and D. Matko. Application of a heterogenous multiscalemethod to multi-batch driven pipeline. Applied Mathematical Modelling, 38(3):864–877, 2014.

[15] M. Zhao and M. S. Ghidaoui. Godunov-type solutions for water hammer flows.Journal of Hydraulic Engineering, 130(4):341–348, 2004.

[16] M. S. Ghidaoui, M. Zhao, D. A. Mcinnis, and D. H. Axworthy. A review of waterhammer theory and practice. Applied Mechanics Reviews, 58(1):49–76, 2005.

[17] W. E. Schiesser. The Numerical Method of Lines: Integration of Partial DifferentialEquations. Academic Press, Waltham, 1991.

[18] W. E. Schiesser and G. W. Griffiths. A Compendium of Partial Differential Equa-tion Models: Method of Lines Analysis with Matlab. Cambridge University Press,Cambridge, 2009.

[19] N. Marian. Model of the water-hammer effect considering a spring safety valve.Archives of Hydro-Engineering and Environmental Mechanics, 51(1):25–40, 2004.

22

[20] B. S. Jung and B. W. Karney. Optimum selection of hydraulic devices for waterhammer control in the pipeline systems using genetic algorithm. In Proceedings ofthe 4th Joint Fluids Summer Engineering Conference, pages 2877–2883, 2003.

[21] H. Z. Cao, Z. H. He, and Z. Y. He. The analytic research on the wave process andoptimal control of water hammer in pipes. Engineering Mechanics, 25(6):22–26,2008.

[22] D. H. Axworthy and B. W. Karney. Valve closure in graph-theoretical models forslow transient network analysis. Journal of Hydraulic Engineering, 126(4):304–309,2000.

[23] W. X. Tian, G. Su, G. P. Wang, S. Z. Qiu, and Z. J. Xiao. Numerical simulationand optimization on valve-induced water hammer characteristics for parallel pumpfeedwater system. Annals of Nuclear Energy, 35(12):2280–2287, 2008.

[24] W. M. Feng and X. X. Zheng. Research on optimal control of transient multiplevalves regulation for fluid transient. Journal of Wuhan University of Hydraulic andElectric Engineering, 36(2):130–133, 2003.

[25] E. B. Wylie, V. L. Streeter, and L. Suo. Fluid Transients in Systems. Prentice Hall,New Jersey, 1993.

[26] M. S. Ghidaoui. On the fundamental equations of water hammer. Urban WaterJournal, 1(2):71–83, 2004.

[27] S. Blazic, D. Matko, and G. Geiger. Simple model of a multi-batch driven pipeline.Mathematics and Computers in Simulation, 64(6):617–630, 2004.

[28] G. A. Atanov, E. G. Evseeva, and P. A. Work. Variational problem of water-levelstabilization in open channels. Journal of Hydraulic Engineering, 124(1):50–54,1998.

[29] Y. Ding and S. S. Wang. Optimal control of open-channel flow using adjoint sensi-tivity analysis. Journal of Hydraulic Engineering, 132(11):1215–1228, 2006.

[30] C. F. Gerald and P. O. Wheatley. Applied Numerical Analysis. Pearson, New York,2003.

[31] K. L. Teo, C. J. Goh, and K. H. Wong. A Unified Computational Approach toOptimal Control Problems. Longman Scientific and Technical, Essex, 1991.

[32] Q. Lin, R. C. Loxton, and K. L. Teo. The control parameterization method fornonlinear optimal control: A survey. Journal of Industrial and Management Opti-mization, 10(1):275–309, 2014.

[33] Q. Lin, R. C. Loxton, K. L. Teo, and Y. H. Wu. Optimal control computation fornonlinear systems with state-dependent stopping criteria. Automatica, 48(9):2116–2129, 2012.

23

[34] R. C. Loxton, K. L. Teo, and V. Rehbock. Optimal control problems with mul-tiple characteristic time points in the objective and constraints. Automatica,44(11):2923–2929, 2008.

[35] C. Y. Kaya and J. L. Noakes. Computational method for time-optimal switchingcontrol. Journal of Optimization Theory and Applications, 117(1):69–92, 2003.

[36] D. G. Luenberger. Linear and Nonlinear Programming. Springer, New York, 2003.

[37] R. C. Loxton, K. L. Teo, V. Rehbock, and K. F. C. Yiu. Optimal control problemswith a continuous inequality constraint on the state and the control. Automatica,45(10):2250–2257, 2009.

[38] R. C. Loxton, Q. Lin, V. Rehbock, and K. L. Teo. Control parameterization foroptimal control problems with continuous inequality constraints: New convergenceresults. Numerical Algebra, Control and Optimization, 2(3):571–599, 2012.

[39] X. G. Liu, Y. Q. Hu, J. H. Feng, and K. Liu. A novel penalty approach for nonlineardynamic optimization problems with inequality path constraints. IEEE Transac-tions on Automatic Control, Accepted, 2014.

[40] X. Zhao, X. Y. Zhang, M. D. Zhao, and H. Y. Dong. Hydraulics. China ElectricPower Press, Beijing, 2009.

[41] D. F. Yan. Design and Management of Oil Pipeline. Petroleum Industry Press,Beijing, 1986.

24