PRSG (Primary-Secondary Road-Network Graph Builder)#

The primary concrete graph builder that creates a distribution graph from clustered parcels and road network data.

class shift.PRSG(groups: list[~shift.data_model.GroupModel], source_location: ~shift.data_model.GeoLocation, buffer: ~infrasys.quantities.Distance = <Quantity(20, 'meter')>)#

Bases: OpenStreetGraphBuilder

Class interface for Primary Road and Secondary Grid distribution graph builder.

It searches for available openstreet road network within an area defined by points + buffer. Primary network is build by applying steiner tree algorithm from road network and connecting all nodes closest to the group centers, which will be treated as distribution transformer locations. Secondary network is build by building two dimensional grid within the bouding box formed by individual group points and then building steiner tree from it to connect only the nodes nearest to group points.

Constructor for the class.

Parameters:
  • groups (list[GroupModel]) – List of groups for building a openstreet network.

  • source_location (GeoLocation) – Power source location.

  • buffer (Distance, optional) – Buffer to be applied in a bounding polygon formed by points for searching road network. Defaults to 20m.

build_secondary_network(group: GroupModel) Graph#

Internal method to build secondary network.

Parameters:

group (GroupModel) – Group for which the secondary network is to be built.

Return type:

nx.Graph

build_primary_network() Graph#

Internal method for building primary network.

Return type:

nx.Graph