Routing of branched water distribution networks using fractal geometry and graph theory

The necessity of ensuring precise and rigorous requirements of technical infrastructure elements determines development of software tools which should ease and simplify the process of designing. The routing of water distribution network (WDN) is one of the first steps in the design process of the whole water supply system. Similar design steps can be observed in other linear technical infrastructure systems, such as: electric networks or roads. Despite the fact that WDNs routing problem has been widely explored in scientific literature, the universal and optimal routing method is still being sought after. The following paper presents the exemplary application of an original software tool for the WDNs routing. The hybrid structure software, written in C++ and AutoLISP programming languages, is based on elements of fractal geometry and graph theory. Software allows semi-automatic routing process of single-source, branched networks and support a designer with mathematical substantiation of a selected solution. In the following paper, software was tested in conditions of a model settlement unit. The obtained results revealed potential of further application of software as well as disclosed weaknesses of a program.


Introduction
The process of shaping geometrical structures of distribution networks is one of the basic tasks that determine their further operational reliability, investment and operational costs, as well as comfort and safety of structure users [1]. It is especially important in accordance with network objects of a critical character, such as: water supply, sewage, roads, energy, heat or telecommunication networks [2][3][4]. Shaping geometrical structures of networks directly influences the second basic tasks interrelated with their further operatingspecifying required capacity of elements of these networks. Despite many years of research these aspects are still not fully understand. Shaping geometrical structures of distribution networks and specifying capacity of their elements are considered as separate issues [4]. Objective functions used so far limit criteria to the investment and operational costs, not including reliability aspects, time of medium delivery from source to a consumer or a possibility of potential medium quality worsening [5]. No universal method for describing and representing of network structures is developed as well [6]. Generally, the graph theory is applied most often, in which networks nodes (source, sink, connection and division points) responds to graph nodes, while pipes and connection branches responds to graph edges [7]. That kind of representation allowed to apply, in the process of shaping geometrical structures of networks, many different algorithms for finding the connection route between selected graph nodes (source and sink points) [8][9][10][11][12][13][14][15]. The other, relatively new, way to describe geometrical shape of networks structures is the application of elements of fractal geometry and identifying the process of shaping geometrical structure with iterative duplication and rotation of a basic segment, in accordance to the function's objective such us minimum length or minimum rotation angle [16][17][18][19]. The problematic character of network structures description causes that no method developed so far is universal and possible to apply for any urban territories. That is because of individual character of each urban territory, which is determined by geographical, environmental, social, economic, technical and other factors [20]. Some solutions have been provided for branched WDNs [21,22], while designing of looped or mixed WDNs is not supported sufficiently yet.
Due to the significant importance of proper designing and operating of critical infrastructure elements, the studies are still in question. The aim of this paper is to present the application of an original, designed by authors, software tool for routing distribution networks. Software TRAS, has a hybrid character and was written in AutoLISP and C++ programming languages, based on elements of fractal geometry and graph theory. Its main goal is to ease and simplify the process of designing branched water supply distribution networks.

Materials and methods
TRAS software is composed of 3 modules: Module 01 is design to create a graph reflecting settlement unit plan, Module 02 aims to find the shortest path between selected nodes and Module 03 is design to draw a routed water supply network.

Initial requirements
In order to apply TRAS software for network routing, it is required from the designer to previously properly prepare the map background. The aim of this preparation step is to create a graph network based on the settlement unit plan, by:  creating new layers in AutoCAD Layer Properties Manager for graph nodes, nodes numbers and street axes,  defining water sources, demand points, street intersections, cornering places of streets and start and ends of streets as nodes in nodes layer,  numbering of nodes in nodes_numbers layer,  drawing street axes lines in steet_axes layer in the way where each segment has a start and end in a marked node.

TRAS Module 01
After the proper preparation of a map plan, it is possible to apply the Module 01 of the TRAS program. Module 01 is used to develop a graph reflecting the model settlement unit. It was written in AutoLISP programming language in AutoCAD environment. The TRAS Module 01 allows to:  select and number nodes,  calculate graph edge weight (distance between start and end node of every segment),  save data to a selected external file.
The application of Module 01 requires repeated actions: defining a start node number, selecting a start node on a screen, defining a number of an end node and selecting the end node on the screen. These four actions form a complete cycle of data definition of a single graph edge. In order to develop a complete graph reflecting the settlement unit, it is required to define each segment by four users' actions. On the base of nodes coordinates, TRAS software calculates the distance between nodes. Additionally, Module 01 saves the initial AutoCAD properties, enforces the user-defined properties and after finishing the work restores the initial properties. The result of Module 01 is an external TXT file, in which data are saved in following order: record number, start node number, end node number, edge weight.

TRAS Module 02
TRAS software is a test application of a new idea of routing water supply distribution networks with the use of fractal geometry. In accordance to this method [19], every dendritic structure of network can be shaped by tree-like structures, designed as successive transformation of a base segment unit, called axiom. The method assumes that successive bifurcations of a base segment are connected with the end of a previous segment and the base value of the axiom is its length (Lo). The successive bifurcation of the axiom is performed in accordance to formula (1). The described method has following assumptions:  length (a, b, c…) and angle (α', α'', α'''…) parameters of a succeeding segment can have random values, in practice dependent on the street scheme shape,  when any length parameters equal zero, the segment is no longer included in further transformations,  intersection of new branches of network structure creates a new node which can be a start node for a new transformation,  in conditions of multiple water sources, each source segment is an independent axiom. The tree-like structure of design water supply network is created in recurrent way, where every iteration leads to more detailed network structure. After creation of a possible water pipes tree, it is required to determine the water supply path to the demand nodes, with the assumption of shortest path criterion (formula 2). In the case where there is more than one possible water supply path of equal total length, the total rotation angles of axiom should be considered (formula 3).
succeeding segment, a,b,c length parameters of a succeeding segment, α' α'' α'''angles of a succeeding segment in relation to a preceding segment, Ltotal total length of segments from source to demand point, k number of possible water supply paths, m number of nodes of each category, n, t number of bifurcations required to connect the base segment with the demand node, Li lengths of segments in further bifurcations, αtotal total rotation angle of the axiom, z number of possible water supply paths fulfilling the formula (2), αi rotation angle of successive bifurcation. The general process of water supply network routing varies in accordance to nodes category. At first, the water supply network is routed to the nodes of the highest priority (greatest demand -1 st category). Analogically, the water supply network is further routed to the nodes of 2 nd and 3 rd category. In the first bifurcation, the start node is water source point, while in the second and further bifurcations the start nodes are 1 st category nodes or any point of water supply pipeline routed in previous bifurcation. The process of water supply routing in each bifurcation is continued until the moment of reaching the demand node of the required category or until the intersection of segments of the same category.
The realisation of the described method is achieved by dynamic programming TRAS Module 02, which uses Dijkstra's Algorithm (DA) [23] for finding the shortest paths between selected node and all other nodes in the graph. Module 02 of TRAS software was written in C++ programming language and enables to calculate the access paths between selected graph nodes. The DA can be applied for graphs of non-negative weights of edges, and therefore can be used for water supply networks as the weight of graph edges is the distance between nodes. However, in cases where there are two or more possible the shortest access paths between source and demand nodes, the Dijkstra's Algorithm does not solve the problem completely, leaving the decision up to the user.
The Module 02 is run outside AutoCAD environment, in a C++ compiler. Output data file from Module 01 is an input file for Module 02. However, files are not imported automatically, so the user is obliged to input data manually. The first step in Module 02, after its compilation, is to define the source node in the graph. Next, the user defines the total number of edges in the graph. The graph representing the water supply network is an undirected graph, in which every edge is a potential two-direction transfer path (e.g. form node X to Y, and contrariwise). Therefore, the total number of edges is duplication of the last record number in output file from Module 01. Then, it is required to define each edge from the graph by specifying the start node, end node and edge weight. Definition of every edge is doubled, with switched start and end nodes. After defining all edges, the Module 02 computes the shortest path between selected source node to all nodes in the graph and presents the results in a list sequence. In each line, the result data are as follows: number of end path node, numbers of middle nodes, edge weight.

TRAS Module 03
The aim of Module 03 of TRAS software is to draw a routed water supply distribution network on a settlement unit plan. It was written in AutoLISP programming language in AutoCAD environment. It enables to draw a water supply pipeline between nodes of a shortest water supply path calculated in Module 02. The water supply pipeline is drawn as a polyline in water_supply_network layer (if such layer does not exist the Module 03 creates it). The designer is required to select the start node, and later specify the successive nodes of the shortest water supply path. Additionally, the Module 03 saves the initial AutoCAD properties, enforces the user defined properties and after finishing the work restores the initial properties.

Object description
TRAS software was tested in conditions of a model urban settlement unit, which plan is presented in figure  1. The settlement unit is composed of 15 districts, located on the square mesh. The side of each square is 100 m and total area of a model unit is 1 081 ha. The single water source (WS) is located in left bottom corner of the settlement unit. Three categories of demand nodes are specified: 1 st category of main nodes (4 nodes: A, B, C, D) of the highest water demand (15 dm 3 /s), 2 nd category nodes (13 nodes marked 1-13) of 10 dm 3 /s water demand each, and 3 rd nodes category (9 nodes a-i) of the smallest water demand 5 dm 3 /s. The aim of the application of TRAS software is to route the distribution branched network, connecting water source with nodes of respectively 1 st , 2 nd and 3 rd category.

Results
In accordance to the initial requirements of TRAS software, the model settlement unit plan was prepared by numbering nodes and drawing street axes. The graph representing the model settlement unit is presented in figure 2. Nodes are located in every demand point and places where the street ends, begins or corners. The total number of nodes equals 62 and total number of edges is 77. The water source is marked as node number W25.
Next, TRAS software was tested in condition of the model urban settlement unit. The Module 01 enabled to create an input file for searching for shortest water supply path in Module 02. 154 directed edges of the graph were further specified in Module 02, including start and end node as well as edge weight. The process of water supply distribution network routing was divided into 3 steps, accordingly to 3 category of demand nodes. Firstly, water supplies shortest paths between start node (W25) and 1 st category nodes (W9, W23, W41, W52) were analysed. The results of the first routing step are presented in table 1. Considering the connection paths between water source WS (W25) and node A (W23) there is only one the shortest path of total length 150m and total rotation angle equal to 90°. During connecting WS with node B (W9) two shortest paths were analysed, of total length equal to 270 m. To decide which path should be considered in further bifurcation, the total rotation angle should be compared. However, in accordance do adopted routing method [19], nodes of the same category are also treated as potential start nodes for further transformations. Therefore, an additional connection path was analysed between node A and B. The total length of this path was 220 m and it was the shortest path in this case. Analogically, the connection paths to node C was searched for, considering water source WS, as well as node A and B as start nodes. In such case, the shortest path was between A and C nodes of total length equal to 260 m. However, there was also possibility to connect an existing 1 st category pipeline with node C. The additional start node was specified in node W26 and total length of the shortest path from this node to node C was equal to 210 m. The shortest path to node D was from node C and was equal to 130 m with total rotation angle 180°.

Fig. 2.
Model settlement unit plan with water source and demand nodes.
Analogically, the 2 nd and 3 rd category pipelines were routed. The results of routing 2 nd category nodes are given in table 2. 2 nd category nodes were connected with 1 st category pipes, starting in water source WS (node 1), 1 st category nodes (nodes 3, 7), nodes of the same category (nodes 2,4,5,9,11,12,13) as well as with existing 1 st category pipes (nodes 6, 8, 10). In both 1 st and 2 nd category routing only the shortest path criterion was used. There were no two or more possible water supply paths of the same length, so there was no need to apply the minimum total rotation angle criterion. Such situation happens in routing 3 rd category nodes. During routing water pipelines to the nodes of the smallest water demand category, two potential water supply paths were calculated to node d. Both paths had total length equal to 60 m. Start nodes in these paths were 1 st category node (B) and 2 nd category node (6). In such case the minimum rotation angle was examined. One of the paths has αtotal equal to 0, and the other equal to 90°. Therefore, the path from node B was accepted as water supply connection with node d. Visualisation of both possible water supply paths is presented in figure 3.   Fig. 3. Two possible water supply paths to node d.
During routing 3 rd category water supply pipes of the branched distribution network, an unexpected situation occurred. The connections to node b and e were of the same total length and the same total rotation angle. In such cases, in accordance to routing formula, it is impossible to decide which water supply path should be accepted. Therefore, both connections were used and created two loops in design water supply network. It is also possible, that a designer should decide which connection may be accepted, maintaining the branched character of a routed water supply network. The final supply network routed with the application of TRAS software is presented in figure 4. The 1 st category pipelines are marked with the thickest line, 2 nd category pipelines with normal thickness line and 3 rd category pipelines with a dashed line. The process of routing water supply network has an essential meaning for further operation of the whole water supply system. Therefore, tools which aims to ease and simplify this process are continuously developed and improved. The example of such software is the TRAS program. This software allows semi-automatic routing process of single-source, branched networks. After testing TRAS software in conditions of model urban settlement unit, following observations were made:  The routed network is supported with the mathematical substantiation of a selected solution (criteria of shortest path and minimum rotation angle). The designer no longer has to rely only on his knowledge and experience.  TRAS software enables to approximate the locations of water supply pipelines. The routed network is applied on the settlement unit plan, which ease the final routing decisions.  The application of TRAS software does not require from designers any special preparation or knowledge.  The operation of software requires precise data entering without editing possibility. Moreover, the designer is obligated to prepare the settlement unit map in required manner.  The TRAS software has a hybrid character, which can make its operation burdensome.
To sum up, TRAS software is the original supporting tool for water supply network routing. However, this software needs further amendments in order to make its operation more automatic and user friendly, make calculation less memory resources consuming and to allow used to indicate modifications in the resulting figure.