Voltage source#

Definition#

It represents an ideal voltage source that maintains a fixed voltage independently of the load resistance or the output current.

Connections#

A voltage source can be either star-connected or delta-connected depending on whether its phases include a neutral or not.

Star (wye) connection#

The diagram of the star voltage source is:

Star voltage source diagram
Star voltage source diagram

The equations that model a star voltage source are:

\[\begin{split}\left\{ \begin{split} \underline{V_{\mathrm{a}}}-\underline{V_{\mathrm{n}}} &= \underline{U_{\mathrm{an}}} \\ \underline{V_{\mathrm{b}}}-\underline{V_{\mathrm{n}}} &= \underline{U_{\mathrm{bn}}} \\ \underline{V_{\mathrm{c}}}-\underline{V_{\mathrm{n}}} &= \underline{U_{\mathrm{cn}}} \end{split} \right.\end{split}\]

Where \(\underline{U}\in\mathbb{C}^3\) is the voltage vector (user defined parameter) and \(\underline{V}\in\mathbb{C}^4\) is the node potentials vector (variable).

Delta connection#

The diagram of the delta voltage source is:

Delta voltage source diagram
Delta voltage source diagram

The equations that model a delta voltage source are:

\[\begin{split}\left\{ \begin{split} \underline{V_{\mathrm{a}}}-\underline{V_{\mathrm{b}}} &= \underline{U_{\mathrm{ab}}} \\ \underline{V_{\mathrm{b}}}-\underline{V_{\mathrm{c}}} &= \underline{U_{\mathrm{bc}}} \\ \underline{V_{\mathrm{c}}}-\underline{V_{\mathrm{a}}} &= \underline{U_{\mathrm{ca}}} \end{split} \right.\end{split}\]

Where \(\underline{U}\in\mathbb{C}^3\) is the voltage vector (user defined parameter) and \(\underline{V}\in\mathbb{C}^3\) is the node potentials vector (variable).

Usage#

A voltage source defined with a neutral phase is a star voltage source, otherwise it is a delta voltage source. The voltage vector must have the same size as the number of the phase-to-phase or phase-to-neutral connections of the source.

import numpy as np
from roseau.load_flow import Bus, VoltageSource

bus = Bus(id="bus", phases="abcn")

# Star connection
un = 400 / np.sqrt(3)  # 400V phase-to-phase -> 230V phase-to-neutral
voltages = un * np.exp([0, -2j * np.pi / 3, 2j * np.pi / 3])
VoltageSource(
    id="vs", bus=bus, phases="abcn", voltages=voltages
)  # Voltages are considered phase-to-neutral because phases="abcn"

# Delta connection
un = 400  # 400V phase-to-phase
voltages = un * np.exp([0, -2j * np.pi / 3, 2j * np.pi / 3])
VoltageSource(
    id="vs", bus=bus, phases="abc", voltages=voltages
)  # Voltages are considered phase-to-phase because phases="abc"

# Incorrect voltage vector
un = 400
voltages = un * np.exp([0, -2j * np.pi / 3])  # Only two elements!!
VoltageSource(id="vs", bus=bus, phases="abc", voltages=voltages)  # Error

API Reference#

class VoltageSource(id: int | str, bus: Bus, *, voltages: ndarray[Any, dtype[complex128]] | Quantity[ndarray[Any, dtype[complex128]]] | Quantity[Sequence[complex]] | Sequence[complex | Quantity[complex]], phases: str | None = None)

Bases: Element

A voltage source.

Voltage source constructor.

Parameters:
  • id – A unique ID of the voltage source in the network sources.

  • bus – The bus of the voltage source.

  • voltages – An array-like of the voltages of the source. They will be set on the connected bus. If the source has a neutral connection, the voltages are considered phase-to-neutral voltages, otherwise they are the phase-to-phase voltages. Either complex values (V) or a Quantity of complex values.

  • phases – The phases of the source. A string like "abc" or "an" etc. The order of the phases is important. For a full list of supported phases, see the class attribute allowed_phases. All phases of the source, except "n", must be present in the phases of the connected bus. By default, the phases of the bus are used.

allowed_phases: Final = frozenset({'ab', 'abc', 'abcn', 'abn', 'an', 'bc', 'bcn', 'bn', 'ca', 'can', 'cn'})

The allowed phases for a voltage source are the same as for a bus.

property phases: str

The phases of the source.

property bus: Bus

The bus of the source.

property voltages: Quantity[ndarray[Any, dtype[complex128]]]

The voltages of the source (V).

property voltage_phases: list[str]

The phases of the source voltages.

property res_currents: Quantity[ndarray[Any, dtype[complex128]]]

The load flow result of the source currents (A).

property res_potentials: Quantity[ndarray[Any, dtype[complex128]]]

The load flow result of the source potentials (V).

property res_powers: Quantity[ndarray[Any, dtype[complex128]]]

The load flow result of the source powers (VA).

disconnect() None

Disconnect this voltage source from the network. It cannot be used afterwards.

classmethod from_dict(data: dict[str, Any], *, include_results: bool = True) Self

Create an element from a dictionary created with to_dict().

Note

This method does not work on all classes that define it as some of them require additional information to be constructed. It can only be safely used on the ElectricNetwork, LineParameters and TransformerParameters classes.

Parameters:
  • data – The dictionary containing the element’s data.

  • include_results – If True (default) and the results of the load flow are included in the dictionary, the results are also loaded into the element.

Returns:

The constructed element.