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

Available Results

The following results are available for all sources:

Result Accessor

Default Unit

Type

Description

res_potentials

\(V\)

complex array

The potentials of each phase of the source

res_currents

\(A\)

complex array

The line currents flowing into each phase of the source

res_powers

\(V\!A\)

complex array

The line powers flowing into each phase of the source

res_voltages

\(V\)

complex array

The phase-to-neutral voltages if the source has a neutral, the phase-to-phase voltages otherwise

Addionally, the following results are available for sources with a neutral:

Result Accessor

Default Unit

Type

Description

res_voltages_pn

\(V\)

complex array

The phase-to-neutral voltages of the source

And the following results are available for sources with more than one phase:

Result Accessor

Default Unit

Type

Description

res_voltages_pp

\(V\)

complex array

The phase-to-phase voltages of the source

And the following results are available for three-phase sources:

Result Accessor

Default Unit

Type

Description

res_voltage_unbalance()

\(\%\)

number

The voltage unbalance of the source according to the IEC definition

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: ComplexScalarOrArrayLike1D, phases: str | None = None, connect_neutral: bool | None = None)

Bases: roseau.load_flow.models.connectables.AbstractConnectable[roseau.load_flow_engine.cy_engine.CyVoltageSource | roseau.load_flow_engine.cy_engine.CyDeltaVoltageSource]

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.

element_type: Final = 'source'
type: Final = 'voltage'
property voltages: Q_[ComplexArray]

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

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