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:

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).

Note

You can create star connected sources even on buses that don’t have a neutral. In this case, the source’s neutral will be floating and its potential can be accessed similar to normal star sources.

Delta connection

The diagram of the delta voltage source is:

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-connected voltage source, otherwise it is a delta-connected voltage source. The phases of the source must be a subset of the phases of the bus it is connected to. A voltage source takes the same phases as the bus by default.

import numpy as np
import roseau.load_flow as rlf

bus = rlf.Bus(id="bus", phases="abcn")
# The phases of the source are the same as the bus by default
vs1 = rlf.VoltageSource("vs1", bus=bus, voltages=230)  # phases="abcn" implied
vs1.phases  # "abcn"
vs1.voltage_phases  # ["an", "bn", "cn"]

# Explicitly define the phases of the source (star connection)
vs2 = rlf.VoltageSource("vs2", bus=bus, phases="abcn", voltages=230)  # Same as vs1
vs2.phases  # "abcn"
vs2.voltage_phases  # ["an", "bn", "cn"]

# Explicitly define the phases of the source (delta connection)
vs3 = rlf.VoltageSource("vs3", bus=bus, phases="abc", voltages=400)
vs3.phases  # "abc"
vs3.voltage_phases  # ["ab", "bc", "ca"]

# Incorrect phases: the source's phases must be a subset of the bus's phases
bus2 = rlf.Bus(id="bus2", phases="an")
rlf.VoltageSource("vs4", bus=bus2, phases="bn", voltages=230)  # Error

A scalar (potentially complex) voltage value can be used to define the source’s balanced voltages. For a single-phase source, the scalar value is used as the voltage of the source’s phase. For a two-phase source, the second voltage value is the negative of the first value (180° phase shift). For a three-phase source, the second and third values are calculated by rotating the first value by -120° and 120°, respectively (120° phase shift clockwise).

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

# Three-phase connection (star)
# -----------------------------
rlf.VoltageSource("vs1", bus=bus, phases="abcn", voltages=230)
# {'an': (230+0j), 'bn': (-115-199.18584287042083j), 'cn': (-115+199.1858428704209j)}

# Three-phase connection (delta)
# ------------------------------
rlf.VoltageSource("vs2", bus=bus, phases="abc", voltages=400)
# {'ab': (400+0j), 'bc': (-200-346.41016151377534j), 'ca': (-200+346.4101615137755j)}

# Two-phase connection
# --------------------
rlf.VoltageSource("vs3", bus=bus, phases="abn", voltages=230)
# {'an': (230+0j), 'bn': (-230+0j)}

# Single-phase connection
# -----------------------
rlf.VoltageSource("vs4", bus=bus, phases="an", voltages=230)
# {'an': (230+0j)}

# Unbalanced source, explicit voltage vector
# ------------------------------------------
rlf.VoltageSource(
    "vs5",
    bus=bus,
    phases="abcn",
    voltages=[230, 115 * np.exp(1j * np.pi / 2), 115 * np.exp(-1j * np.pi / 2)],
)
# {'an': (230+0j), 'bn': (115j), 'cn': (-115j)}

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

A voltage vector (list or numpy array) can be used to create an unbalanced voltage source if needed. The voltage vector must have the same size as the number of the phase-to-phase or phase-to-neutral connections of the source.

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

# Unbalanced source, explicit voltage vector
# ------------------------------------------
rlf.VoltageSource(
    "vs1",
    bus=bus,
    phases="abcn",
    voltages=[230, 115 * np.exp(1j * np.pi / 2), 115 * np.exp(-1j * np.pi / 2)],
)
# {'an': (230+0j), 'bn': (115j), 'cn': (-115j)}

# Incorrect voltage vector: only two voltage values!!
rlf.VoltageSource(
    id="vs2", bus=bus, phases="abc", voltages=400 * np.exp([0, -2j * np.pi / 3])
)  # Error

API Reference

class VoltageSource(id: Id, bus: roseau.load_flow.models.buses.Bus, *, voltages: roseau.load_flow.typing.ComplexScalarOrArrayLike1D, phases: str | None = None, connect_neutral: bool | None = None)

Bases: roseau.load_flow.models.core.Element

A voltage source fixes the voltages on the phases of the bus it is connected to.

The source can be connected in a wye or star configuration (i.e with a neutral) or in a delta configuration (i.e without a neutral).

See also

The Voltage source documentation page for example usage.

Voltage source constructor.

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

  • bus – The bus of the voltage source.

  • voltages

    A single voltage value or an array-like of the voltages of the source to be fixed on the connected bus phases. If the source has a neutral connection, the voltages are considered phase-to-neutral voltages, otherwise they are the phase-to-phase voltages. Either pass complex values (V) or a Quantity of complex values.

    When a scalar value is passed, it is interpreted as the first value of the source voltages vector. The other values are calculated based on the number of phases of the source. For a single-phase source, the passed scalar value is used. For a two- phase source, the second voltage value is the negative of the first value (180° phase shift). For a three-phase source, the second and third values are calculated based on the first value and the phase shift of -120° and 120°, respectively (120° phase shift clockwise).

  • phases – The phases of the source. A string like "abc" or "an" etc. The bus phases are used by default. 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 must be present in the phases of the connected bus. Multiphase sources are allowed to be connected to buses that don’t have a neutral if connect_neutral is not set to True.

  • connect_neutral – Specifies whether the source’s neutral should be connected to the bus’s neutral or left floating. By default, the source’s neutral is connected when the bus has a neutral. If the bus does not have a neutral, the source’s neutral is left floating by default. To override the default behavior, pass an explicit True or False.

allowed_phases

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

property voltages

The complex voltages of the source (V).

Setting the voltages will update the source voltages and invalidate the network results.

Note

Setting a scalar value updates the complex voltages of all phases of the source, not just their magnitudes. The phase angles are calculated based on the number of phases of the source. For a single-phase source, the phase angle is 0°. For a two-phase source, the phase angle of the second phase is 180°. For a three-phase source, the phase angles of the second and third phases are -120° and 120°, respectively (120° phase shift clockwise).

property phases

The phases of the source.

property bus

The bus of the source.

property has_floating_neutral

Does this source have a floating neutral?

property voltage_phases

The phases of the source voltages.

property res_currents

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

property res_potentials

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

property res_voltages

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

property res_powers

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

disconnect()

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

classmethod from_dict(data: JsonDict, *, include_results: bool = True)

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.