Skip to content
Anas BELFADIL edited this page May 5, 2020 · 1 revision

Welcome to the RWDN wiki!

create a RandomWaterDistributionNetwork object:

Arguments:

  • gmap_key(str): key for google maps API for downloading the elevation values for the nodes

  • world_cities(pd.DataFrame): pandas DataFrame from the free csv file in: https://simplemaps.com/data/world-cities , it is used for extracting the coordinates of the cities.

  • min_population(int): the minimal population for the cities to be used for the generation of the Virtual Water Network

  • distance(int): is the distance of the nodes from the center point that are going to be kept for constructing the graph

  • demand_values(dict): a dictionnary where the keys are the type of soil occupation, and values are peak hour demands in m3/h/hectar

  • roughness_values(list): is a list of roughness values that will be assigned randomly to pipes

  • reservoir_heads(list): is a list of heads that will be assigned randomly to the reservoirs

  • pipe_diameters(list): list of possible diameters of pipes in the networks (in m)

rd = RandomWaterDistributionNetwork(gmap_key, world_cities, min_population, distance, demand_values, roughness_values, reservoir_heads, pipes_diameters, sf)

Generate the layout from street network data:

Returns a random networkx graph using the osmnx module

G = rd.generate_random_graph()

Add elevation values to the nodes:

G = ox.project_graph(G)

Clean the graph from clustered nodes, self loops and parallel edges:

Merges the clustered nodes that are less than tol apart and deletes self loops and parallel edges from the input graph. partial(bool): True if used for cleaning the main network subgraph.

G = rd.clean_graph(G, tol=15)

Add demands to nodes

rd.add_node_demands(G)

Create main distribution network:

subG = rd.main_network(G)

Clean the main network from double lines:

Cleans the input graph G from double lines, in these steps:

1- small cycles where the nodes are aligned 2- parallel edges and self loops 3- small cycles that are inside bigger cycles

subG = rd.clean_cycles(subG)

Add reservoirs as nodes and connecting them to the graph:

subG = rd.add_reservoirs(subG) subG = rd.connect_reservoirs(G, subG)

Merge the main network(subG) and the network(G):

F = nx.compose(G, subG)

Add edge roughness:

rd.add_edge_roughness(F)

Create WaterNetworkModel object for wntr:

wn = rd.create_wn(F, subG)

Run simulation for pipe sizing:

wn = rd.pipe_sizing(wn)

Divide the network to sectors and add valves between sectors:

wn = rd.add_valves(wn, subG, n_sectors=8)

Get a dictionary containing all the relevant information about the created network:

 {'Number of nodes': n_nodes, 'Number of edges': n_edges, 'Number of reservoirs':self.number_of_reservoirs, 
  'Velocity' : self.velocity, 'Pressure' : self.pressure, 'Lengths': lengths, 'Diameters': pipes_diameters, 
  'Degrees': degrees, 'Main valves': self.main_valves, 'Valves per sector': self.valves_per_sect}
  • Number of nodes, Number of edges, Number of reservoirs: (int).
  • Velocity, Pressure, Lengths, Diameters, Degrees: (list) containing that characteristic for all the elements of the network.
  • Main valves: are the valves on the main network (the control valves)
  • Valves per sector: the rest of the valves distributed per sector, the valve on pipe number 190 is in sector one is named S1_190.

stats = rd.stats(wn)