-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support star and zigzag transformers with non brought out neutrals (#310
) Fixes #308
- Loading branch information
Showing
10 changed files
with
654 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
"""This script generates a version 2 JSON file. | ||
Run with roseau-load-flow==0.11.0, NOT WITH THE CURRENT VERSION:: | ||
uv run --no-project --script roseau/load_flow/io/tests/data/generators/v3.py | ||
""" | ||
|
||
# Script metadata generated by `uv` | ||
# /// script | ||
# requires-python = ">=3.10,<3.14" | ||
# dependencies = [ | ||
# "roseau-load-flow==0.11.0", | ||
# ] | ||
# /// | ||
import cmath | ||
from pathlib import Path | ||
|
||
import numpy as np | ||
from shapely import LineString, Point | ||
|
||
import roseau.load_flow as rlf | ||
from roseau.load_flow.io.dict import NETWORK_JSON_VERSION | ||
|
||
if NETWORK_JSON_VERSION != 3: | ||
raise ValueError( | ||
f"This script is meant to generate version 3 JSON files, current version: {NETWORK_JSON_VERSION}" | ||
f"\nExecute with `uv run --no-project --script roseau/load_flow/io/tests/data/generators/v3.py`" | ||
) | ||
|
||
OUTPUT = Path(__file__).parent.parent / f"network_json_v{NETWORK_JSON_VERSION}.json" | ||
|
||
bus1 = rlf.Bus( | ||
id=1, phases="abcn", geometry=Point(0.0, 0.0), nominal_voltage=66e3, min_voltage_level=0.98, max_voltage_level=1.02 | ||
) | ||
bus2 = rlf.Bus( | ||
id=2, phases="abcn", geometry=Point(0.0, 1.0), nominal_voltage=66e3, min_voltage_level=0.98, max_voltage_level=1.02 | ||
) | ||
bus3 = rlf.Bus( | ||
id=3, phases="abc", geometry=Point(0.0, 1.0), nominal_voltage=20e3, min_voltage_level=0.95, max_voltage_level=1.10 | ||
) | ||
bus4 = rlf.Bus( | ||
id=4, phases="abc", geometry=Point(0.0, 2.0), nominal_voltage=20e3, min_voltage_level=0.95, max_voltage_level=1.10 | ||
) | ||
|
||
ground = rlf.Ground(id="gnd") | ||
ground.connect(bus1, phase="n") | ||
rlf.PotentialRef(id="pref", element=ground) | ||
rlf.PotentialRef(id="pref2", element=bus3) | ||
|
||
vs = rlf.VoltageSource(id=1, bus=bus1, voltages=66e3, phases="abc") | ||
power = cmath.rect(40e3, np.acos(0.95)) | ||
rlf.PowerLoad(id=1, bus=bus2, phases="abcn", powers=[power, power, power]) | ||
|
||
lp_66kv = rlf.LineParameters( | ||
id=1, | ||
z_line=0.35 * np.eye(4, dtype=complex), | ||
y_shunt=1e-6j * np.eye(4, dtype=complex), | ||
line_type=rlf.LineType.OVERHEAD, | ||
materials=rlf.Material.CU, | ||
insulators=None, | ||
sections=rlf.Q_(240, "mm^2"), | ||
ampacities=250, | ||
) | ||
lp_20kv = rlf.LineParameters( | ||
id=2, | ||
z_line=0.35 * np.eye(3, dtype=complex), | ||
line_type=rlf.LineType.UNDERGROUND, | ||
materials=rlf.Material.AL, | ||
insulators=rlf.Insulator.PVC, | ||
sections=rlf.Q_(150, "mm^2"), | ||
ampacities=160, | ||
) | ||
rlf.Line( | ||
id=1, bus1=bus1, bus2=bus2, parameters=lp_66kv, length=10.0, geometry=LineString([(0, 0), (1, 0)]), ground=ground | ||
) | ||
rlf.Line(id=2, bus1=bus3, bus2=bus4, parameters=lp_20kv, length=1.0, geometry=LineString([(0, 1), (0, 2)])) | ||
|
||
tp = rlf.TransformerParameters.from_open_and_short_circuit_tests( | ||
id="1", vg="Yd11", uhv=20000.0, ulv=400.0, sn=160000.0, p0=460.0, i0=0.023, psc=2350.0, vsc=0.04 | ||
) | ||
rlf.Transformer( | ||
id=1, | ||
bus1=bus2, | ||
bus2=bus3, | ||
phases1="abcn", | ||
phases2="abc", | ||
parameters=tp, | ||
geometry=Point(0.0, 1.0), | ||
tap=1.025, | ||
max_loading=0.9, | ||
) | ||
rlf.PowerLoad(id=3, bus=bus3, phases="ab", powers=[1000 + 200j]) | ||
rlf.CurrentLoad(id=4, bus=bus4, phases="bc", currents=[2 + 1j]) | ||
rlf.ImpedanceLoad(id=5, bus=bus4, phases="ca", impedances=[100 + 200j]) | ||
|
||
en = rlf.ElectricalNetwork.from_element(bus1) | ||
en.solve_load_flow() | ||
|
||
en.to_json(OUTPUT, include_results=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.