Skip to content

Commit

Permalink
Merge pull request #207 from RoseauTechnologies/transformer-tests
Browse files Browse the repository at this point in the history
Transformer tests
  • Loading branch information
benoit9126 authored Mar 19, 2024
2 parents 426f16a + 2472c89 commit 1c89a9b
Show file tree
Hide file tree
Showing 8 changed files with 628 additions and 625 deletions.
5 changes: 2 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
hooks:
- id: poetry-check
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
rev: v0.3.3
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
Expand All @@ -28,15 +28,14 @@ repos:
- id: blacken-docs
files: ^doc/.*\.md$
args: [-l 90]
additional_dependencies: [black==24.2.0]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
args: ["--print-width", "120"]
require_serial: true
- repo: https://github.com/cmhughes/latexindent.pl
rev: V3.23.6
rev: V3.23.7
hooks:
- id: latexindent
args: [-l, -m, -s, -wd]
3 changes: 2 additions & 1 deletion doc/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ myst:

# Changelog

## Unreleased
## Version 0.8.0

- Fix a bug in the zig-zag three-phase transformer model that led to incorrect active power flow in the transformer. The bug affected the 50 kVA transformers that have the type `Yzn11` in the catalogue.
- {gh-pr}`206` {gh-issue}`187` Un-deprecate `results_to_dict/json` methods and remove deprecated
`results_from_dict/json` methods.
- {gh-pr}`205` {gh-issue}`200` Fix error when propagating the potentials from a voltage source with fewer phases
Expand Down
866 changes: 433 additions & 433 deletions doc/_static/Line/European_Shunt_Line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
# author = "Benoît Vinot"

# The full version, including alpha/beta/rc tags
version = "0.7"
release = "0.7.0"
version = "0.8"
release = "0.8.0"

# -- General configuration ---------------------------------------------------

Expand Down
7 changes: 4 additions & 3 deletions doc/models/Transformer/Three_Phase_Transformer.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ The following equations are used to model 3-phase transformers:
\begin{aligned}
K_{\mathrm{UXYZ}} \cdot \underline{U_{\mathrm{XYZ}}}
&= K_{\mathrm{VABC}} \cdot \underline{V_{\mathrm{ABC}}} - K_{\mathrm{N}} \cdot \underline{V_{\mathrm{N}}} \\
K_{\mathrm{Uxyz}} \cdot \left( M_{\mathrm{TV}}\cdot \underline{U_{\mathrm{XYZ}}} + \underline{Z_2} \cdot
\underline{I_{\mathrm{xyz}}} \right)
K_{\mathrm{Uxyz}} \cdot M_{\mathrm{TV}}\cdot \underline{U_{\mathrm{XYZ}}} + o_r \cdot \underline{Z_2} \cdot
\underline{I_{\mathrm{xyz}}}
&= K_{\mathrm{Vabc}} \cdot \underline{V_{\mathrm{abc}}} - K_{\mathrm{n}} \cdot \underline{V_{\mathrm{n}}} \\
K_{\mathrm{IABC}} \cdot \underline{I_{\mathrm{ABC}}} &= K_{\mathrm{IXYZ}} \cdot
\left( \underline{Y_{\mathrm{m}}} \cdot \underline{U_{\mathrm{XYZ}}} + M_{\mathrm{TI}} \cdot
Expand All @@ -121,7 +121,8 @@ The following equations are used to model 3-phase transformers:
```

Where $\underline{Z_2}$ is the series impedance and $\underline{Y_{\mathrm{m}}}$ is the magnetizing
admittance of the transformer. The other quantities are the matrices defined below.
admittance of the transformer. $o_r$ is the orientation variable, equal to $1$ for direct windings and $-1$ for
inverse windings. The other quantities are the matrices defined below.

## Matrices

Expand Down
349 changes: 176 additions & 173 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "roseau-load-flow"
version = "0.7.0"
version = "0.8.0"
description = "Highly capable three-phase load flow solver"
authors = [
"Ali Hamdan <ali.hamdan@roseautechnologies.com>",
Expand Down Expand Up @@ -49,7 +49,7 @@ typing-extensions = ">=4.6.2"
pyproj = ">=3.3.0"
certifi = ">=2023.5.7"
platformdirs = ">=4.0.0"
roseau-load-flow-engine = "==0.12.0"
roseau-load-flow-engine = "==0.13.0"

# Optional dependencies
matplotlib = { version = ">=3.7.2", optional = true }
Expand Down
15 changes: 7 additions & 8 deletions roseau/load_flow/models/transformers/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
from roseau.load_flow.units import Q_
from roseau.load_flow_engine.cy_engine import (
CyCenterTransformer,
CyExtendedTransformer,
CyReducedTransformer,
CySingleTransformer,
CyThreePhaseTransformer,
)

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -106,27 +105,27 @@ def __init__(
self._cy_element = CyCenterTransformer(z2=z2, ym=ym, k=k * tap)
else:
if "Y" in parameters.winding1 and "y" in parameters.winding2:
self._cy_element = CyReducedTransformer(
self._cy_element = CyThreePhaseTransformer(
n1=4, n2=4, prim="Y", sec="y", z2=z2, ym=ym, k=k * tap, orientation=orientation
)
elif "D" in parameters.winding1 and "y" in parameters.winding2:
self._cy_element = CyReducedTransformer(
self._cy_element = CyThreePhaseTransformer(
n1=3, n2=4, prim="D", sec="y", z2=z2, ym=ym, k=k * tap, orientation=orientation
)
elif "D" in parameters.winding1 and "d" in parameters.winding2:
self._cy_element = CyReducedTransformer(
self._cy_element = CyThreePhaseTransformer(
n1=3, n2=3, prim="D", sec="d", z2=z2, ym=ym, k=k * tap, orientation=orientation
)
elif "Y" in parameters.winding1 and "d" in parameters.winding2:
self._cy_element = CyReducedTransformer(
self._cy_element = CyThreePhaseTransformer(
n1=4, n2=3, prim="Y", sec="d", z2=z2, ym=ym, k=k * tap, orientation=orientation
)
elif "Y" in parameters.winding1 and "z" in parameters.winding2:
self._cy_element = CyExtendedTransformer(
self._cy_element = CyThreePhaseTransformer(
n1=4, n2=4, prim="Y", sec="z", z2=z2, ym=ym, k=k * tap, orientation=orientation
)
elif "D" in parameters.winding1 and "z" in parameters.winding2:
self._cy_element = CyExtendedTransformer(
self._cy_element = CyThreePhaseTransformer(
n1=3, n2=4, prim="D", sec="z", z2=z2, ym=ym, k=k * tap, orientation=orientation
)
else:
Expand Down

0 comments on commit 1c89a9b

Please sign in to comment.