Phase Mappers#

class shift.BasePhaseMapper(graph: DistributionGraph)#

Abstract class for getting phase mappings for nodes and assets.

Subclasses must implement following methods. * node_phase_mapping * asset_phase_mapping

Parameters:

graph (DistributionGraph) – Instance of DistributionGraph for which to implement phase mapping.

abstract property node_phase_mapping: dict[str, set[Phase]]#

Returns node to phase mapping dictionary.

Returns:

Dictionary mapping node name to set of phases.

Return type:

dict[str, set[Phase]]

abstract property asset_phase_mapping: dict[str, dict[Annotated[Type[DistributionLoad] | Type[DistributionSolar] | Type[DistributionCapacitor] | Type[DistributionVoltageSource], FieldInfo(annotation=NoneType, required=True, description='Possible node types.')], set[Phase]]]#

Returns asset to phase mapping.

Returns:

Dict of dicts mapping nodename to asset type to list of phases.

Return type:

dict[str, dict[VALID_NODE_TYPES, set[Phase]]]

abstract property transformer_phase_mapping: dict[str, set[Phase]]#

Returns transformer phase mapping.

Return type:

dict[str, set[Phase]]

class shift.BalancedPhaseMapper(graph: DistributionGraph, mapper: list[TransformerPhaseMapperModel], method: Literal['kmean', 'greedy', 'agglomerative'] = 'agglomerative')#

Bases: BasePhaseMapper

Class interface for balanced phase mapper.

Parameters:
  • graph (DistributionGraph) – Instance of the distribution graph.

  • mapper (list[TransformerPhaseMapperModel]) – List of phase mapper models.

  • method (Literal["kmean", "greedy"]) – Method used for allocation, optional, defaults to “kmeans”.

property node_phase_mapping: dict[str, set[Phase]]#

Returns node to phase mapping dictionary.

Returns:

Dictionary mapping node name to set of phases.

Return type:

dict[str, set[Phase]]

property asset_phase_mapping: dict[str, dict[Annotated[Type[DistributionLoad] | Type[DistributionSolar] | Type[DistributionCapacitor] | Type[DistributionVoltageSource], FieldInfo(annotation=NoneType, required=True, description='Possible node types.')], set[Phase]]]#

Returns asset to phase mapping.

Returns:

Dict of dicts mapping nodename to asset type to list of phases.

Return type:

dict[str, dict[VALID_NODE_TYPES, set[Phase]]]

property transformer_phase_mapping: dict[str, set[Phase]]#

Returns transformer phase mapping.

Return type:

dict[str, set[Phase]]