You are on page 1of 9

Available online at www.sciencedirect.

com

ScienceDirect
Procedia Engineering 186 (2017) 388 – 396

XVIII International Conference on Water Distribution Systems Analysis, WDSA2016

Analytical solution of Jacobian matrices of WDS models


Liu Nian-donga, Du Kuna, *, Tu Jia-pengb, Dong Wei-xinc
a
Faculty of Civil Engineering & Mechanics, Kunming University of Science and Technology, Kunming 650500,China.
b
Kunming Municipal Engineering Design Science Research Institute Co.,Ltd, Kuming 650500,China.
c
Yunnan century sunshine Architectural Design Co.,Ltd., Kuming 650500,China.

Abstract

The Jacobian matrices of water distribution system (WDS) models contain the gradient information of input parameters to
observations, which are the key to construct gradient vectors for model calibration via gradient-based methods. In existing studies,
the perturbation method is most often applied to approximate Jacobian matrices, however it is computation expensive for larger
WDSs. Besides, although other methods have also been presented to compute the analytical solution of Jacobian matrices directly,
they fail to provide the explicit expressions of Jacobian matrices leading to the difficulty in application. This paper presents a novel
matrix analysis method to deduce the analytical solution of Jacobian matrices of WDS models, including the nodal demand, pipe
roughness and pipe diameter to nodal pressure and pipe flow, respectively. All solutions are expressed in a concise matrix form
with advantages of being easy to understand. A numerical case is used to detail the construction of the involved matrices.

©©2016
2016TheTheAuthors.
Authors. Published
Published by Elsevier
by Elsevier Ltd. Ltd.
This is an open access article under the CC BY-NC-ND license
Peer-review under responsibility of the organizing committee of the XVIII International Conference on Water Distribution
(http://creativecommons.org/licenses/by-nc-nd/4.0/).
Systems. under responsibility of the organizing committee of the XVIII International Conference on Water Distribution Systems
Peer-review

Keywords: Water distribution system; Jacobian matrix; Analytical solution; Matrix analysis;

1. Introduction

As a key component of critical municipal infrastructure, water distribution systems (WDSs) not only provide daily
water to people for potable household consumption, commercial and industrial activities, but also sustain fire
protection. Numerous studies related to WDSs have been conducted for different purposes in recent years, including

* Corresponding author. Tel.: 18788405417.


E-mail address: dukun_cq@foxmail.com

1877-7058 © 2016 The Authors. Published by Elsevier Ltd. This is an open access article under the CC BY-NC-ND license
(http://creativecommons.org/licenses/by-nc-nd/4.0/).
Peer-review under responsibility of the organizing committee of the XVIII International Conference on Water Distribution Systems
doi:10.1016/j.proeng.2017.03.236
Liu Nian-dong et al. / Procedia Engineering 186 (2017) 388 – 396 389

the model calibration[1-3], the optimal placement of sensors for calibration or leakage detection [4-6], the uncertainty
quantification[7] and sensitive analysis. When to calibrate the model using gradient-based methods or conduct the
sensitive analysis via first-order second-moment (FOSM) method, a common and critical problem faced by engineers
is to compute the Jacobian matrices of water distribution models which contain the gradient information of the input
parameter to observations, such as the nodal demand to nodal pressure, the pipe roughness to pipe flow, and the pipe
diameter to nodal pressure.
The method used to compute the Jacobian matrices can be divided roughly into two main categories: the
perturbation method and the analytical method. The perturbation method is also known as the finite difference method
by which the derivatives are approximated by executing the forward calculation repeatedly. Although the perturbation
method is easy to understand and apply to obtain the Jacobian matrices, it needs to solve network equations hundreds
or thousands of times if a WDS model contains hundreds or thousands of nodes or pipes thus leading to time
consuming tasks. By contrast, the analytical method attempts to compute the Jacobian matrices directly through
theoretical derivation based on the partial differential equations operation, which is much more efficient than the
perturbation method.
Two kinds of analytical methods have been presented to compute Jacobian matrices: the sensitivity equation
method and the adjoin method. The sensitivity equation method was first applied in water engineering for groundwater
models calibration[8] and later on, for the WDS sampling design[1-3]and the adjoint method was first used by Liggett
& Chen[10]to compute sensitivities for inverse transient analysis of WDS. Although these two methods are capable of
computing the Jacobian matrices of WDSs directly, however, so far none of them has been adopted by other researches
in available literatures. It may be because they fail to deduce the explicit expressions of Jacobian matrices in a concise
form that can be easy to understand and use.
For example, Lansey et al. [11], Kang and Lansey [12-13] still used the perturbation method to approximate the
Jacobian matrices for model calibration and real-time demand estimation, as well as the parameter uncertainty
analysis. Besides, Perez et al. [14] presented a methodology for leakage detection based on the pressure sensitivity
matrix of WDS model and they stated that “the sensitivity analysis using analytical tools is not a trivial job in a real
network”. More recently, Méndez et al. [15] applied the Parameter ESTimator (PEST), a nonlinear parameter estimation
package, in conjunction with EPANET toolkit for model calibration and sensitivity analysis, in which the derivatives
can be computed automatically by the PEST. However, the PEST also utilized the perturbation method to approximate
the Jacobian matrices thus leading to huge computational effort for larger system calibration. Therefore, it is still
significant to develop an efficient method to calculate the Jacobian matrices of WDS.
In this paper, a matrix analysis method is presented to deduce the analytical solution of Jacobian matrices of WDSs,
including the nodal demand, pipe roughness and pipe diameter to nodal pressure and pipe flow, respectively.
Comparing to the existing deducing methods, the whole derivation procedure of the proposed method is based on the
basic continuity and energy equations, and all explicit expressions of Jacobian matrices are obtained and expressed in
a concise matrix form, with the advantages of being easier to understand and implement. To validate the derived
Jacobian matrices, a numerical case is used to show how to construct the involved matrices. All computational
operations can be realized conveniently in the Matlab environment by calling the EPANET toolkit with a few lines of
code, which is useful to help engineers for model calibration and sensitive analysis, as well as solving other calculating
problem associated in their studies.

2. Methodology

Considering the nodal demand, pipe roughness and pipe diameter are the three most uncertain parameters in a
network model, the Jacobian matrices regarding them to nodal pressure and pipe flow are deduced. For pressurized
water steadily flowing through a network, the continuity and energy equations can be expressed as

­ Aq  Q 0 (1)
® T
¯ A H  h  A 10 H 0 0
where A is the incidence matrix with a size of n×m describing the topological information of the network; n and m
390 Liu Nian-dong et al. / Procedia Engineering 186 (2017) 388 – 396

are the number of demand nodes and pipes (including pumps), respectively, and the elements in matrix A can be
determined as:

­  1if node i is the initial node to element j


°
A(i, j ) ®0if node i is not connected to element j
°  1if node i is the final node of element j
¯
(2)

The elements in A10 are determined using the same method used for A describing the relationship of fixed head node
(elevated reservoir or tank) to nodal demand; q and Q are the vectors of pipe flow and the vector of nodal demand; H
is the vector of unknown heads; H0 is the vector of known head (elevated reservoir); h is the vector of pipe head loss,
which varies as a nonlinear function of pipe flow that makes Eq.(1) a nonlinear system. To deduce the analytical
solution of Jacobian matrices, the perturbations are added into the system. Then the perturbation equations of
continuity and energy can be obtained:

­
° A q + Δq  Q  ΔQ = 0 ­ AΔq  ΔQ = 0
® T Ÿ® T
¯A H + ΔH + h + Δh + A10 H 0 = 0 ¯A ΔH + Δh = 0
°
(3)

Note that the added perturbations have no influence on the water level of elevated reservoirs under steady state
conditions. In WDSs, the pipe head loss is commonly computed using Hazen-Williams equation

1.852
§ q · L
h K u ¨¨ ¸¸ 4.871
© C H W ¹ d
(4)

Where Ku is the unit constant and d, L, q, and CH-W are the diameter, length, flow and Hazen-Williams roughness
coefficient of the pipe, respectively. For a single pipe, the partial differential equations regarding pipe head loss to
pipe flow rate, pipe roughness CH-W and diameter are:

1.852
wh
wq
§q·
Ku ¨ ¸
L

˜ 1.852 q 1 1.852 ˜
h
©C ¹ d 4.871 q
(5)

1.852
wh
wC
§q·
Ku ¨ ¸
L

˜ 1.852 ˜ C 1 1.852
h
©C ¹ d 4.871 C
(6)

1.852
wh
wd
§q·
K u ¨ ¸
L

˜ 4.871 ˜ d 1 4.871
h
©C ¹ d 4.871 d
(7)

Besides, rewriting the Hazen-Williams equation, Eq.(7) can be get:


Liu Nian-dong et al. / Procedia Engineering 186 (2017) 388 – 396 391

1
§ hd 4.871 · 1.852
q C ¨¨ ¸¸
© Ku L ¹
(8)

Based on Eq.(7), the partial differential equations regarding pipe flow to pipe roughness C and diameter d are:

1
wq § hd 4.871 · 1.852 q
¨¨ ¸¸
wC © Ku L ¹ C
(9)

1
wq 4.871 § hd 4.871 · 1.852 1 4.871 q
C¨ ¸ d
wd 1.852 ¨© K u L ¸¹ 1.852 d
(10)

1
wq 1 § hd 4.871 · 1.852 1 q
C ¨¨ ¸ h
wh 1.852 © K u L ¸¹ 1.852 h
(11)

For deduction purpose, let

1
wh § wq · § wq · h
¨ ¸ ¨ ¸ 1.852
wC © wh ¹ © wC ¹ C
(12)

1
wh § wq · § wq · h
¨ ¸ ¨ ¸ 4.871
wd © wh ¹ © wd ¹ d
(13)

Based on formula (11) and (12), for individual pipe, the total differential equation of pipe head loss is

1 1 1
wh wh wh § wq · § wq · § wq · § wq · § wq ·
'h 'C  'q  'd ¨ ¸ ˜ ¨ ¸'C  ¨ ¸ 'q  ¨ ¸ ˜ ¨ ¸'d
wC wq wd © wh ¹ © wC ¹ © wh ¹ © wh ¹ © wd ¹
(14)

For pipe head loss vector, the total differential equation can be expressed in a matrix form as:

∆h=−B−1S∆C+B−1∆q−B−1D∆d
(15)

Where
§ wq1 · § wq1 · § wq1 ·
¨ ¸ ¨ ¸ ¨ ¸
¨ wh1 ¸ ¨ wC1 ¸, ¨ wd1 ¸
¨ wq2 ¸, ¨ wq2 ¸ ¨ wq2 ¸
¨ wh2 ¸ S ¨ ¸ D ¨ wd 2 ¸
B
¨ ¸ wC2 ¨ ¸
¨ ¸
¨  ¸ ¨  ¸ ¨  ¸
¨ wqm ¸ ¨ wqm ¸ ¨ wqm ¸
¨ whm ¸¹ ¨ wCm ¸¹ ¨ wd m ¸¹
© © ©
392 Liu Nian-dong et al. / Procedia Engineering 186 (2017) 388 – 396

Note that the elements to pumps in matrix B, S and D are

wq 1
c 1
wh cb q
(16)

wq
0
wC
(17)

wq
0
wd
(18)

Here, the pump curve is assumed as

h pum p a  bqc
(19)

where a, b, and c are constants describing the pump performance.


Because ∆h=−AT∆H
So, AT∆H=B−1S∆C−B−1∆q+B−1D∆d (20)
And so, BAT∆H=S∆C−∆q+D∆d (21)
Because, A∆q=∆Q
Then, ABAT∆H=AS∆C−A∆q+AD∆d (22)
And, ABAT∆H=AS∆C−∆Q+AD∆d (23)
Then, ∆H=(ABAT)−1AS∆C−(ABAT)−1∆Q+(ABAT)−1AD∆d (24)
Similarly, the total differential equation for pipe flow vector can be expressed in a matrix form as:
∆q=S∆C+D∆d+B∆h (25)
Because, ∆h=−AT∆H
So, ∆q=S∆C+D∆d−BAT∆H (26)
And because, ∆H=(ABAT)−1AS∆C−(ABAT)−1∆Q+(ABAT)−1AD∆d
Finally,∆q=S∆C−BAT(ABAT)−1AS∆C+BAT(ABAT)−1∆Q+D∆d−BAT(ABAT)−1AD∆d (27)
Based on formula (23) and (26), the Jacobian matrices can be obtained

­ wH
°
° wQ
 ABA T
1

® wq
°
° w
BA T ABA T
1

¯ Q
(28)

­
°
wH
wC
1
ABA T AS
® wq
°
¯ wC
1
S  BA T ABA T AS
(29)
Liu Nian-dong et al. / Procedia Engineering 186 (2017) 388 – 396 393

­
°
wH
wd
1
ABA T AD
® wq
°
¯ wd
1
D  BA T ABA T AD
(30)

To make the derivations easier to implement, Fig.1 presents the flowchart of computing the Jacobian matrices
based on the EPANET [16-17].

Step 1: create the network in EPANET and construct


the incidence matrix based on the .inp file.

Step 2: run the EPANET and record the solved pipe


flow (containing the plus-minus sign) and pipe head
loss vector to compute the diagonal matrix (S, B, D).

Step 3: compute the Jacobian matrices based


on formula (27), (28), (29).

Fig. 1. The flowchart of computing the Jacobian matrices

3. Demonstration

For illustrative purposes, a small network shown in Fig.2 is selected to show how to build the basic matrices based
on the network file and the EPANET solver, where the elevation of all demand nodes is 0 m. It is noteworthy that all
computation and solutions have been validated in larger systems with more pumps and different pump performance
curves.

Elevated reservoir
[500,200,90] H=20m

(32.08, 5.57)
[500,200,90]
1 2 2
(-7.62, -0.39)
Q1=20L/s Q2=20L/s
[500,200,90]
(12.38, 0.96)
[500,200,90]

(4.45, 0.14)

5 3

[500,200,90] (52.92, -15.00)


3 4 4
(-10.55, -0.71)
Q3=15L/s Q4=30L/s
note:[length(m),diameter(mm),roughness]
(pipe flow vector, pipe head loss vector)
hpump=26.67-0.004167q2

Fig. 2. Example network

As indicated by the flowchart, the incidence matrix A should be first constructed based on the network (.inp) file.

Table 1. Pipe information copied from the .inp file

Pipe Initial node Final node


1 5 (reservoir) 1
394 Liu Nian-dong et al. / Procedia Engineering 186 (2017) 388 – 396

2 2 1
3 4 2
4 3 4
5 1 3
6 (Pump) 6(reservoir) 4

Table 1 shows the pipe information copied from the .inp file of the network, and based on it, the incidence matrix A
shown in Table 2 can be constructed conveniently. Besides, the diagonal matrix (S, B, D) shown in Table 3 to 5 can
also be constructed readily and then used for computing the Jacobian matrices based on formula (27), (28), (29). The
analytical solutions of the Jacobian matrices have been confirmed by comparing to the finite difference solution. Due
to space limitation, only the Jacobian matrixes [(ABAT)-1(AS)] is listed in Table 6 for explanation purposes.

Table 2. Incidence Matrix A

Pipe 1 Pipe 2 Pipe 3 Pipe 4 Pipe 5 pump


Node 1 1 1 0 0 -1 0
Node 2 0 -1 1 0 0 0
Node 3 0 0 0 -1 1 0
Node 4 0 0 -1 1 0 1

Table 3. Matrix B (q/1.852h )

Pipe 1 Pipe 2 Pipe3 Pipe 4 Pipe 5 pump


Pipe 1 3.1094 0 0 0 0 0
Pipe 2 0 10.5785 0 0 0 0
Pipe 3 0 0 6.9982 0 0 0
Pipe 4 0 0 0 8.0216 0 0
Pipe 5 0 0 0 0 16.7184 0
Pump 0 0 0 0 0 2.2667

Table 4. Matrix S (q/C )

Pipe 1 Pipe 2 Pipe3 Pipe 4 Pipe 5 pump


Pipe 1 0.3564 0 0 0 0 0
Pipe 2 0 -0.0847 0 0 0 0
Pipe 3 0 0 0.1375 0 0 0
Pipe 4 0 0 0 -0.1172 0 0
Pipe 5 0 0 0 0 0.0495 0
Pump 0 0 0 0 0 0

Table 5. Matrix D (4.871q/1.852d )

Pipe 1 Pipe 2 Pipe3 Pipe 4 Pipe 5 pump


Pipe 1 0.4218 0 0 0 0 0
Liu Nian-dong et al. / Procedia Engineering 186 (2017) 388 – 396 395

Pipe 2 0 -0.1002 0 0 0 0
Pipe 3 0 0 0.1628 0 0 0
Pipe 4 0 0 0 -0.1387 0 0
Pipe 5 0 0 0 0 0.0586 0
Pump 0 0 0 0 0 0

Table 6. Jacobian matrix [(ABAT)-1(AS)]

Pipe 1 Pipe 2 Pipe 3 Pipe 4 Pipe 5


Node 1 0.0721 -0.0013 0.0032 0.0031 -0.0006
Node 2 0.0666 0.0047 0.0080 0.0002 0.0000
Node 3 0.0676 -0.0003 0.0007 0.0054 0.0019
Node 4 0.0584 0.0018 -0.0044 -0.0042 0.0008

4. Conclusions

A matrix analysis method have been presented to deduce the analytical solutions of Jacobian matrices of water
distribution systems, including the nodal demand, pipe roughness and pipe diameter to nodal pressure and pipe flow,
respectively. All analytical solutions are expressed in a concise matrix form and can be computed efficiently, thus
providing great convenience for model calibration, as well as for solving other associated problems. A numerical case
has been used to show how to construct the involved matrices based on the basic network file.

Acknowledgements

This work is supported by the “National Nature Science Fundation”(No.51608242). “Personnel training program
of Yunnan Province” (No.14118943).“Kunming University of Science and Technology, 2016 university students
extracurricular academic science and Technology Innovation Fund ”(NO.2015YB025).

References

[1] Kapelan, Z., Savic, D., and Walters, G, Calibration of Water Distribution Hydraulic Models Using a Bayesian-Type Procedure. J. Hydraul. Eng.
133(2007)927–936.
[2] Savic, D. A., Kapelan, Z. & Jonkergouw, P, Quo vad is water distribution model calibration. Urban Water J. 6(2009)3-22.
[3] Giustolisi, O. & Berardi, Water distribution network calibration using enhanced GGA and topological analysis. J. Hydroinf. 13(2011) 621-641.
[4] Bush, C.&Uber, J, Sampling Design Methods for Water Distribution Model Calibration. J. Water Resour. Plann. Manage. 124(1998) 334–344.
[5] Perez, R., Puig, V., Pascual, J., Peralta, A., Landeros, E., & Jordanas, L, Pressure sensor distribution for leak detection in Barcelona water
distribution network. Water Sci. Technol.: water supply. 9(2009) 715-721.
[6 ] Farley, B., Mounce, S., & Boxall, J, Field testing of an optimal sensor placement methodology for event detection in an urban water distribution
network. Urban Water J. 7(2010) 345-356.
[7] Alvisi, S. & Franchini, M, Pipe roughness calibration in water distribution systems using grey numbers. J. Hydroinf. 12(2010) 424-445.
[8] Yeh, W.W.G, Review of Parameter Identification Procedures in Groundwater Hydrology: The Inverse Problem. Water Resour Res, 22(1986)95-
108.
[9] Liggett, J. A., & Chen, L.C, Inverse Transient Analysis in Pipe Networks. J. Hydraul. Eng. 120(1994)934-955.
[10] Lansey, K. E., El-Shorbagy, W., Ahmed, I., Araujo, J., & Haan, C. T, Calibration assessment and data collection for water distribution networks.
J. Hydraul. Eng. 127(2001) 270–279.
[11] Lansey, K. E., & Basnet, C, Parameter estimation for water distribution networks. J. Water Resour. Plann. Manage. 117(1991)126-144.
[12] Kang, D. & Lansey, K, Real-Time Demand Estimation and Confidence Limit Analysis for Water Distribution System. J. Hydraul. Eng.
135(2009)825–837.
[13] Kang, D. & Lansey, K, Demand and Roughness Estimation in Water Distribution Systems. J. Water Resour. Plann. Manage. 137(2011) 20–
30.
[14] Perez, R., Puig, V., Pascual, J., Peralta, A., Landeros, E., Jordanas, L. & A, Peraltd Methodology for leakage isolation using pressure sensitivity
analysis in water distribution networks. Control Eng Pract. 19 (2011)1157–1167.
[15] Méndez M., José A. A & Luís D. S, Automated parameter optimization of a water distribution system. J. Hydroinf. 15(2013) 71–85.
[16] Rossman, L.A, Epanet2 User Manual. National Risk Management Research Laboratory, Office of Research and Development. US
Environmental Protection Agency, Cincinnati, Ohio, USA, 2000.
396 Liu Nian-dong et al. / Procedia Engineering 186 (2017) 388 – 396

[17] Walski,T.M. ,Case study: pipe network model calibration issues. J. Water Res. Plann. Manage. 112(1986) 238-249.

You might also like