wntr.network.layer module

The wntr.network.layer module includes methods to generate network layers (information that is not stored in the water network model or the graph).

Contents

generate_valve_layer(wn[, placement_type, ...])

Generate valve layer data, which can be used in valve segmentation analysis.

wntr.network.layer.generate_valve_layer(wn, placement_type='strategic', n=1, seed=None)[source]

Generate valve layer data, which can be used in valve segmentation analysis.

Parameters
  • wn (wntr WaterNetworkModel) – A WaterNetworkModel object

  • placement_type (string) –

    Options include ‘strategic’ and ‘random’.

    • If ‘strategic’, n is the number of pipes from each node that do not contain a valve. In this case, n is generally 0, 1 or 2 (i.e. N, N-1, N-2 valve placement).

    • If ‘random’, then n randomly placed valves are used to define the valve layer.

  • n (int) –

    • If ‘strategic’, n is the number of pipes from each node that do not contain a valve.

    • If ‘random’, n is the number of number of randomly placed valves.

  • seed (int or float) – Random seed

Returns

valve_layer (pandas DataFrame) – Valve layer, defined by node and link pairs (for example, valve 0 is on link A and protects node B). The valve_layer DataFrame is indexed by valve number, with columns named ‘node’ and ‘link’.