valve_segment_attributes#

module wntr.metrics.topographic

valve_segment_attributes(valve_layer, node_segments, link_segments, demand=None, length=None)[source]#

Valve segment attributes include 1) the number of valves surrounding each valve and (optionally) the increase in segment demand if a given valve is removed and the increase in segment pipe length if a given valve is removed.

The increase in segment demand is expressed as a fraction of the max segment demand associated with that valve. Likewise, the increase in segment pipe length is expressed as a fraction of the max segment pipe length associated with that valve.

Parameters:
  • 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’.

  • node_segments (pandas Series) – Segment number for each node, indexed by node name. node_segments can be computed using wntr.metrics.topographic.valve_segments

  • link_segments (pandas Series) – Segment number for each link, indexed by link name. link_segments can be computed using wntr.metrics.topographic.valve_segments

  • demands (pandas Series, optional) – Node demand, the average expected node demand can be computed using wntr.metrics.average_expected_demand(wn). Demand from simulation results can also be used.

  • lengths (pandas Series, optional) – A list of ‘length’ attributes for each link in the network. The output from wn.query_link_attribute(‘length’)

Returns:

Valve segement attributes, indexed by valve number, that contains:

  • num_surround: number of valves surrounding each valve

  • demand_increase: increase in segment demand if a given valve is removed, expressed as a fraction

  • length_increase: increase in segment pipe length if a given valve is removed, expressed as a fraction

Return type:

pandas DataFrame