You are on page 1of 9

EasyChair Preprint

№ 1660

Methods and algorithms for increasing the speed


of computing processes for calculating hydraulic
networks

Elena Kitaytseva

EasyChair preprints are intended for rapid


dissemination of research results and are
integrated with the rest of EasyChair.

October 14, 2019


Methods and algorithms for increasing the speed of
computing processes for calculating hydraulic networks

E Kh Kitaytseva1
1
Moscow State University of Civil Engineering , Yaroslavskoe shosse, 26, Moscow, 129337, Russia

Abstract. The article is devoted to mathematical modeling of flow distribution in hydraulic


networks. Calculations of hydraulic networks are carried out at the stage of their design and
operation. The results of numerical simulation are used to control the operation of the hydraulic
network in real time. The mathematical model of the distribution of flows in the hydraulic
network is a system of nonlinear equations. The nodal pressures method used to solve the
system of equations numerically is the n-dimensional Newton method. To ensure stable and
fast convergence of the iterative process, it is proposed to use the initial approximation taking
into account the network topology and parameters of its objects, use the lower relaxation factor
and optimize the structure of the Maxwell matrix. The algorithms presented in the paper allow
one to significantly reduce the dimension of the system of nonlinear equations being solved.
Keywords: hydraulic network, nodal pressure method, band matrix, equivalenting.

Introduction
In the sixties of the last century the main provisions of the theory of hydraulic networks were laid by
V Ya Khasilev and A P Merenkov [1]. Their ideas are developed in the works of their associates and
students [2-3]. Historically, to solve the problem of the distribution of flows in hydraulic networks,
preference was given to the method of contour flows (MCF). Even for fully open networks, contours
were created artificially. The indisputable advantage of MCF over the method of nodal pressures
(MNP) is the significantly smaller dimension of the system of equations. In MCF the dimension is
equal to the number of base loops, in MNP - to the number of nodes with unknown pressures. The
advantage of MNP over MCF is that the method allows you to simulate the operation of a hydraulic
network of any configuration (with circuits, without circuits, with any number of nodes with a given
pressure) without additional artificial looping of the network [4].
Switching to smart technologies requires real-time simulation of hydraulic networks. This means
that the user must be able to quickly change the operating mode of the network (open / close shut-off
devices, switch pumps, connect / disconnect additional sources, etc.) and quickly obtain simulation
results. These tasks are equivalent in importance. The first task is solved by the program interface. The
user is ready to spend a lot of time and effort on collecting and initial input of information, but at the
same time he wants to correct the data promptly. The second task is the actual modeling of the
hydraulic network. The main requirement is the speed of obtaining the results of modeling networks of
real sizes. The article considers only the second problem.

Methods
With the known topology and parameters of the hydraulic network, its mathematical model is based on
the laws of Kirchhoff:
- the first law of Kirchhoff:
Ax G, (1)
- the second law of Kirchhoff:
By 0 , (2)
and closing rations:
y H S X x , (3)
y  AT P , (4)
where A is the incident matrix; B - matrix of the main contours; S - diagonal matrix of resistances;
X - diagonal matrix of flows; G - vector of drains/tributaries in nodes; H - vector of acting
pressure; x - vector of the flows; y - vector of pressure drops; P - vector of the pressures in the
nodes.
After simplifying the system of equations (1-4), the nodal system of equations takes the form:
Ax G, (5)
A PH S X x .
T (6)
The iterative process is constructed, using the formula:
1
Pk 1  Pk  Mk   (k) , k=0, 1,…. (7)
 
where


Mk  A S X(k) 1 T
A (8)

- Maxwell’s matrix calculated at the current vector of the flows x(k) ;  (k) - residual in the node.
The nodal pressure method is Newton's method, which, as is known [5], has a high convergence
rate only in the vicinity of the solution point. The choice of the initial approximation for the iterative
process is very important. Recommendations for solving this problem do not exist.
To search for an initial approximation to the solution of the system of equations (5-6), it is
proposed to replace dependence (6) with a linear dependence:
ATP H  Sx . (9)
Then the initial approximation P(0) can be found by solving a system of linear equations:
M(0)P(0) G AS1H , (10)
where M(0)  AS1AT is the Maxwell’s matrix (8), calculated at X  E .
Thus, in calculating the initial approximation, all available information about the network topology
and current object parameters is used. Despite this, in some cases the convergence rate is not high
enough. To ensure stable monotonic convergence, a relaxation factor (k) is introduced into formula
(7), the value of which is calculated at each step of the iteration [6]. This approach significantly
increases the time, spent on one iteration. In [5], it was theoretically substantiated that for a positive
definite Jacobian, to ensure monotonic convergence, it suffices to choose (k) <1. The author’s
practical experience allowed us to establish the following series of values (k) = 0.5 for k <6; (k) =
0.6 for k <8; (k) = 0.7 for k <10; (k) = 1 for k  10.
At each step of the iteration, it is necessary to solve a system of linear equations or invert the
matrix (8). In its structure, the Maxwell’s matrix (8) coincides with the adjacency matrix [7]. The
adjacency matrix is sparse for graphs, modeling hydraulic networks [8]. To reduce the time, spent on
one iteration, the nodes of the graph are renumbered in accordance with the algorithm [8], which
allows you to bring the matrix to band form with a minimum band width. The next step in optimizing
the calculation time is the use of the Cholezki method to solve systems of linear equations with
positive definite band matrices [9].
The dimension of the tasks to be solved has become so large that the proposed methods for
optimizing the calculation time are no longer enough. In [10–18], different methods are proposed for
reducing the dimension of the problem being solved, some of them do not introduce additional error
into the results, while other methods introduce a minimum error. In [10-18], the idea of simplifying
the problem is presented, but algorithms for its solution are not given.
When developing algorithms, data organization is important. In the algorithms described below,
information about the network topology is stored in a two-dimensional array, each row of which
corresponds to a link, and the columns contain the numbers of the endpoints.Please follow these
instructions as carefully as possible so all articles within a conference have the same style to the title
page. This paragraph follows a section title so it should not be indented.

Results
The algorithms presented below make it possible to simplify the design scheme of the hydraulic
network before the iteration process (7) begins.
Algorithm “Connectivity check” – selection of nodes associated with the source (identification of
the connected components of the network graph).
1. Mark the node “Source”.
2. Number of marked nodes = 1.
3. Repeat until Number of marked nodes > 0:
a. Number of marked nodes = 0;
b. For each edge:
• find a link where one of the endpoints is marked;
• mark the adjacent node;
• increase the number of marked nodes by 1.

In the future, only nodes, associated with the node “Source”, are considered in the calculations.
At the second stage, search and removal from consideration of unloaded trees occurs. An unloaded
tree is a acyclic graph, for whose nodes the vector G = 0. A high-level description of the algorithm is
presented below.

Algorithm “Unloaded_trees” - search for unloaded trees.


1. Calculate the degree of all nodes of the graph.
2. Number of marked links = 1.
3. Repeat until Number of marked links > 0:
a. Number of marked links = 0.
b. For each unmarked link:
• If the degree of endpoint is 1, it has no load and is not a node “Source”, then:
 reduce the degree of endpoints by 1;
 mark the link;
 increase Number of marked links by 1.

Further simplification of the calculation scheme occurs due to the isolation and removal of loaded
trees from the network graph. The process begins with terminal nodes. As a result, the flows in all
links and the load of the root node are determined, which increases by the total load of all nodes
included in the tree (Figure 1). The indices of the links and of theirs endpoints, included in the loaded
trees, are equal to 1. After the pressure in the root node is found, the pressures in all nodes belonging
to the tree are found (algorithm “Unfurl”). A high-level description of the algorithms is presented
below.

Figure 1 Sequence of equivalence of the loaded trees of the hydraulic


network a) - the initial state of the network; b) load transfer to nodes 3
and 4; cut-off nodes-1 and 2; c) load transfer to node 4; cut-off node 3;
d) load transfer to node S; cut-off node 4.

Algorithm “Furl” – furling the loaded trees.


1. Calculate the degree of all nodes of the graph.
2. Number marked links = 1.
3. Repeat until Number of marked links> 0:
a. Number marked links = 0;
b. For each unmarked link j (i; k):
• If the degree of one of the endpoints is 1, and it is not a node “Source”, then:
 reduce the degree of both endpoints by 1;
 mark link;
 set index of this node to 1;
 Number of marked links increase by 1;
 If the cut-off node is the head (k) of the link, then:
 assign the value of the flow to the value of the load of the cut-off node
x j  Gk ;
 increase the value of the load of the adjacent node by the value of the load
of the cut-off node Gi Gi Gk ;
 If the cut-off node is the tail (i) of the link, then:
 assign the inverse value of the flow of the cut-off node to the flow value
x j Gi ;
 reduce the value of the load of the adjacent node by the value of the load
of the cut-off node Gk Gk Gi .

Algorithm “Unfurl” - unwind the furl loaded trees.


1. Number marked links = 1.
2. Repeat until Number of marked links > 0:
a. Number marked links = 0.
b. For each unmarked link j (i; k), belonging to a tree:
• If the index of one of the endpoints is 1 and node is not marked, then:

 
 Calculate the pressure in the adjacent node
Pi  Pk  Hj S j xj xj , if the index of the node k is 1;

Pk  Pi Hj S j xj xj  , if the index of node i is 1;


 mark the adjacent node;
 assign a value of 1 to the link index;
 mark the link;
 increase the number of marked links by 1.

Serial edges are the edges that are incident to the same node, which does not have a load and the
degree of which is 2. When two serial edges are replaced by one (Figure 2 a-b), the number of nodes
decreases and a new edge is added. The hydraulic resistance of the new edge is equal to the sum of the
resistances of the replaced edges.
Multiple edges are the edges that join the same two vertices. The order of listing nodes in a pair
does not matter. When replacing two parallel edges with one, the number of nodes does not change
and a new edge is added. The hydraulic conductivity of new edge is equal to the sum of the
conductivities of the replaced edges and edge connects the same endpoints (Figure 2 c-d).

Figure 2 Equivalenting of edges. a) the serial edges; c) the


multiple edges; a, c) the initial state; b-d) the result of
equivalenting.

The process of simplifying the circuit begins with the search and equivalenting of serial edges, then
the search and equivalenting of multiple edges takes place, then again the search for serial edges, then
multiple edges and so on, until there are no serial and multiple edges. The edges, which incident to
nodes, modeling pumps or regulators, are not equivalented.
The reverse move consists in assigning the values of the flow of the child edges to the values of the
flow of the parent edges for the serial edges and in calculating the values of the flow of the parent
edges for the multiple edges. A high-level description of the algorithms is presented below.

Algorithm “Equivalenting_forward”
1. Calculate the degree of all nodes of the graph.
2. Determine the number of nodes without load, whose degree is 2 (number_serial).
3. Determine the number of multiple links (number_parallel).
4. The number of new link = nl.
5. Repeat while there are the serial and multiple links (number_serial + number_parallel > 0):
a. If there are the serial links (number_serial > 0), then
• For each unmarked node i, whose degree is 2, and which has no load:
 find two unmarked links j1 (i; k1) and j2 (i; k2) that are incident to node i;
 mark found links j1 and j2;
 mark node i;
 create a new link new = new + 1 (k1; k2);
 calculate the hydraulic resistance of the new link Snew  S j1  S j2 ;

 calculate the hydraulic conductivity of the new link Rnew  1 ;


2
Snew
 save the link number (new) as a child for links j1 and j2.
• Determine the number of multiple links (number_parallel).
b. If there are the multiple links (number_parallel > 0), then
• For each unmarked link j (i; k):
 find the parallel unmarked link j1 (i; k);
 mark found links j and j1;
 create a new link new = new + 1 (i; k);
 calculate the hydraulic conductivity of the new link Rnew  Rj  Rj1;
1
 calculate the hydraulic resistance of the new link Snew  ;
Rnew
 save the negative link number new as a child for links j and j1.
• Determine the number of nodes without load whose degree is 2 (number_serial).

Algorithm “Equivalenting_back”
1.For each marked links j, including new ones, starting with a larger number in increments of -1:
a. find the endpoints (i; k) of the link j;
x
b. calculate Pj  j ;
Rj
c. For each unmarked link j1, starting from 1 to j:
 find the endpoints (i1; k1) of the link j1;
 find the parent link (by coincidence of the number of the child link j1 with
number j);
 if number of the child link > 0 (i.e. serial links), then calculate the flows of the
parent links:

x j1  x j , if i = i1 or k = k1, and
x j1 x j , if i = k1 or k = i1.
 If number of the child link < 0 (i.e. parallel links), then

x j1  Rj1 Pj , if i = i1 or k = k1, and


xj1 Rj1 Pj , if i = k1 or k = i1.
x
 Calculate Pj1  j1 ;
Rj1
 mark the link.

Discussion
During operation of the hydraulic network, the gate valves overlap. As a result, some parts of the
network may be disconnected from the source. Identification of such situations must be done
automatically (algorithm “Connectivity check”).
The effectiveness of using the algorithms “Furl” and “Unfurl” depends on the type of network and
the task at hand. For example, the adjustment calculation of heat supply systems is carried out at a
given heat load of subscribers, which is recalculated into the estimated flows of the coolant. In this
case, most of the network, and in some cases the entire network, can be "collapsed".
The graphs, modeling the design schemes of hydraulic networks, can contain a large number of
serial and multiple edges. Equivalenting of such edges allows one to significantly reduce the
dimension of the system of equations being solved.

Conclusion
1. Analysis of the state of hydraulic networks requires real-time calculations. This fact increases the
requirements for reliability and speed of computing processes.
2. Equivalent network transformations can significantly reduce the dimension of systems of nonlinear
equations, and in some cases eliminate the iterative process, replacing it with sequential calculations.
3. The use of the lower relaxation factor in the nodal pressure method provides fast and monotonous
convergence of the iterative process.
4. Bringing the Maxwell’s matrix to band form and optimizing the width of the band reduce the time it
takes to perform one iteration.

References
[1] Merenkov A P and Khasilev V Ya 1985 Theory of hydraulic circuits (Moscow: Nauka) p 294
[2] Novitsky N N, Shalaginova Z I and Mikhailovsky 2017 Object-oriented models of heat supply
system thermal point elements Vestnik IrGTU 21(9) 157-72
[3] Shalaginova Z I, Novitsky N N, Tokarev V V and Grebneva O A 2015 Multilevel modeling of
thermohydraulic regimes of large heat supply systems. Energy of Russia in the XXI century.
Innovative Development and Management Irkutsk 389-98
[4] Kitaytseva E Kh 1995 Generalized methods for calculating the air regime of buildings and
factors affecting the quality of internal air. Abstract of the candidate of technical sciences
(Moscow: MGSU) p 18
[5] Ortega J M and Rheinboldt W C 1975 Iterative solution of nonlinear equations in several
variables (Moscow: Mir) p 558
[6] Ortiga J, Bruno J C, Coronas A and Grossman I E 2007 Review of optimization models for the
design of polygeneration systems in district heating and cooling networks 17th European
symposium on Computer Aided Process Engineering ESCAPE 17 Elsevier
[7] Swamy M N and Thulasiraman K 1984 Graphs, Networks and Algorithms (Moscow: Mir) p 455
[8] Tewarson R P 1977 Sparce matrices (Moscow: Mir) p 189
[9] Wilkinson J H and Reinsch C 1976 Handbook for automatic computation Linear Algebra
(Moscow: Мashinostroyeniye) p 389
[10] Loginov K V 2004 Equivalenting hydraulic circuits for modeling large areas of heating
networks Mathematical structures and modeling 13 62-71
[11] Yakshin S V 2018 Application of graph splittance method when optimizing heating network
parameters Vestnik IrGTU 22(10) 129-40
[12] Schcherbakov V I and Nguyen H C 2016 The energy equivalence principle for calculation of
water supply networks with many areas Vestnik RUDN 4 27-34
[13] Yakshin S V 2017 The method of graph splitting and the principle of heating network additivity
Vestnik IrGTU 21(4) 127-38
[14] Sidorova V T and Karchin V V 2016 Power flow redistribution in 10 kV complex closed-circuit
air networks to reduce losses and improve power quality J Energy Prob 11 51-4
[15] Todini E and PIlati S 2003A gradient algorithm for the analysis of pipe network computer
applications in water supply (London: John Wiley & Sons) 1 1-20
[16] Wang Jinda, ZhouZhigang and Zhau Jianing 2016 A method for the steady-state thermal
simulation of district heating systems and model parameters calibration Energy Conversion and
Management 120 294-305
[17] Mauna Kuosa, Kaisa Kontu, Tapio Makila, Markku Lampinen and Risto Lahdelma 2013 Static
study of traditional and ring networks and use of mass flow control in district heating
applications Applied Thermal Engineering 54(2) 450-9
[18] Lipovka A Y and Lipovka Y L 2013 Application of “Gradient” algorithm to modeling thermal
pipeline networks with pumping stations J Siberian Federal Universit Engineering and
Technologies 6 28-35

You might also like