roseau.load_flow.plotting

Plotting functions for roseau.load_flow.

Functions

plot_voltage_phasors(→ matplotlib.axes.Axes)

Plot the voltage phasors of a terminal element or a branch element.

plot_symmetrical_voltages(→ tuple[Axes, Axes, Axes])

Plot the symmetrical voltages of a terminal element or a branch element.

plot_interactive_map(→ folium.Map)

Plot an electrical network on an interactive map.

Module Contents

plot_voltage_phasors(element: AbstractTerminal | AbstractBranch, *, voltage_type: Literal['pp', 'pn', 'auto'] = 'auto', side: Literal[1, 2, 'HV', 'LV'] | None = None, ax: Axes | None = None) Axes

Plot the voltage phasors of a terminal element or a branch element.

Parameters:
  • element – The bus, load, source, line, switch or transformer whose voltages to plot.

  • voltage_type

    The type of the voltages to plot.

    • "auto": Plots the phase-to-neutral voltages if the element has a neutral, otherwise the phase-to-phase voltages. This works for all elements and is the default.

    • "pp": Plots the phase-to-phase voltages. Raises an error if the element has only one phase (e.g. “an”).

    • "pn": Plots the phase-to-neutral voltages. Raises an error if the element has no neutral.

  • side

    The side of the branch element to plot.

    • For transformers: "HV" or "LV"

    • For lines/switches: 1 or 2

    • For buses/loads/sources: ignored

  • ax – The axes to plot on. If None, the currently active axes object is used.

Returns:

The axes with the plot.

plot_symmetrical_voltages(element: AbstractTerminal | AbstractBranch, *, side: Literal[1, 2, 'HV', 'LV'] | None = None, axes: Iterable[Axes] | None = None) tuple[Axes, Axes, Axes]

Plot the symmetrical voltages of a terminal element or a branch element.

Parameters:
  • element – The bus, load, source, line, switch or transformer whose voltages to plot. The element must have 'abc' or 'abcn' phases.

  • side

    The side of the branch element to plot.

    • For transformers: "HV" or "LV"

    • For lines/switches: 1 or 2

    • For buses/loads/sources: ignored

  • axes – The three axes to plot on for the symmetrical components in the order zero, positive, negative. If None, new axes are created.

Returns:

The three axes with the plots of the symmetrical components in the order zero, positive, negative.

plot_interactive_map(network: ElectricalNetwork, *, style_color: str = '#234e83', highlight_color: str = '#cad40e', style_function: Callable[[FeatureMap], StyleDict | None] | None = None, highlight_function: Callable[[FeatureMap], StyleDict | None] | None = None, map_kws: Mapping[str, Any] | None = None) folium.Map

Plot an electrical network on an interactive map.

This function uses the folium library to create an interactive map of the electrical network.

Make sure you have defined the geometry of the buses and lines in the network before using this function. You can do this by setting the geometry attribute of the buses and lines.

Parameters:
  • network – The electrical network to plot. Only the buses and lines are currently plotted.

  • style_color – The color of the default style of an element. Defaults to ■ #234e83.

  • highlight_color – The color of the default style when an element is highlighted. Defaults to ■ #cad40e.

  • style_function – Function mapping a GeoJson Feature to a style dict. If not provided or when it returns None, the default style is used.

  • highlight_function – Function mapping a GeoJson Feature to a style dict for mouse events. If not provided or when it returns None, the default highlight style is used.

  • map_kws – Additional keyword arguments to pass to the folium.Map constructor. By default, location is set to the centroid of the network geometry and zoom_start is calculated based on its bounding box.

Returns:

The folium.Map object with the network plot.