roseau.load_flow.converters

This module provides helper functions to convert from one representation to another.

Available functions:

  • convert potentials to voltages

  • perform Kron reduction on nxn matrices

Functions

calculate_voltages(...)

Calculate the voltages between phases given the potentials of each phase.

calculate_voltage_phases(→ list[str])

Calculate the composite phases of the voltages given the phases of an element.

kron_reduction(→ numpy.ndarray[tuple[int, int], D])

Perform Kron's reduction on a square matrix to reduce it by one dimension.

Module Contents

calculate_voltages(potentials: ComplexArrayLike1D, phases: str) Q_[ComplexArray]

Calculate the voltages between phases given the potentials of each phase.

Parameters:
  • potentials – Array-like of the complex potentials of each phase.

  • phases – String of the phases in order. Can be one of: “ab”, “bc”, “ca”, “an”, “bn”, “cn”, “abn”, “bcn”, “can”, “abc”, “abcn”.

Returns:

Array of the voltages between phases. If a neutral exists, the voltages are Phase-To-Neutral. Otherwise, the voltages are Phase-To-Phase.

Example

>>> potentials = 230 * np.array([1, np.exp(-2j * np.pi / 3), np.exp(2j * np.pi / 3), 0], dtype=np.complex128)
>>> calculate_voltages(potentials, "abcn")
array([ 230.  +0.j        , -115.-199.18584287j, -115.+199.18584287j]) <Unit('volt')>
>>> potentials = np.array([230, 230 * np.exp(-2j * np.pi / 3)], dtype=np.complex128)
>>> calculate_voltages(potentials, "ab")
array([345.+199.18584287j]) <Unit('volt')>
>>> calculate_voltages(np.array([230, 0], dtype=np.complex128), "an")
array([230.+0.j]) <Unit('volt')>
calculate_voltage_phases(phases: str) list[str]

Calculate the composite phases of the voltages given the phases of an element.

Parameters:

phases – String of the phases in order. If a neutral exists, it must be the last.

Returns:

List of the composite phases of the voltages.

Example

>>> calculate_voltage_phases("an")
['an']
>>> calculate_voltage_phases("ab")
['ab']
>>> calculate_voltage_phases("abc")
['ab', 'bc', 'ca']
>>> calculate_voltage_phases("abcn")
['an', 'bn', 'cn']
kron_reduction[D: dtype](matrix: ndarray[tuple[int, int], D]) ndarray[tuple[int, int], D]

Perform Kron’s reduction on a square matrix to reduce it by one dimension.

Let \(M\) be a \(n \times n\) matrix and \(M_{ij}\) be the element at row \(i\) and column \(j\) of \(M\). Kron’s reduction of \(M\), denoted \(M'\) is a \((n-1) \times (n-1)\) matrix with elements \(M'_{ij}\) defined as:

\[M'_{ij} = M_{ij} - (M_{in} * M_{nj}) / M_{nn} \text{ for } i, j \in \{1, 2, ..., n-1\}\]