Skip to content

Commit 9118949

Browse files
authored
Add missing information and improve performance (#306)
- Add the following missing information to `results_to_dict` with `full=True`: - `loading` for lines and transformers - `voltage_levels` for buses - `voltages` for loads and sources - Add the following missing information to network dataframes: - `tap` for `en.transformers_frame`. - `element_type` for `potential_refs_frame` (can be `ground` or `bus`) - Improve the performance of `res_violated` of buses, lines and transformers by not using quantity.m internally - Improve the performance of network frames by avoiding creating two dataframes - Improve the error message when trying to connect a load with the same ID as an existing one. We now show the type of the old load in the message.
1 parent 2c01df3 commit 9118949

29 files changed

+685
-606
lines changed

doc/Changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ og:description: See what's new in the latest release of Roseau Load Flow !
1919

2020
## Unreleased
2121

22+
- {gh-pr}`305` Add missing `tap` column to `en.transformers_frame`.
23+
- {gh-pr}`305` Add `element_type` column to `en.potential_refs_frame` to indicate if the potential
24+
reference is connected to a bus or a ground.
25+
- {gh-pr}`305` Add missing information to `results_to_dict` with `full=True`. This adds `loading` to
26+
lines and transformers, `voltage_levels` to buses, and `voltages` to loads and sources.
27+
- {gh-pr}`305` Improve the performance of `res_violated` of buses, lines and transformers.
2228
- {gh-pr}`304` Add top-level modules `rlf.constants` and `rlf.types`. The old modules in the `utils`
2329
package are deprecated and will be removed in a future release. The `utils` package is for internal
2430
use only and should not be considered stable.

doc/models/Bus.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ lp = rlf.LineParameters(id="lp", z_line=rlf.Q_((0.3 + 0.35j) * np.eye(4), "ohm/k
8080
line = rlf.Line(id="line", bus1=bus1, bus2=bus2, parameters=lp, length=rlf.Q_(1, "km"))
8181

8282
# A voltage source on the first bus
83-
un = 400 / np.sqrt(3)
83+
un = 400 / rlf.SQRT3
8484
vs = rlf.VoltageSource(id="source", bus=bus1, voltages=rlf.Q_(un, "V"))
8585

8686
# The neutral of bus1 is fixed at potential 0

doc/models/Line/ShuntLine.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ line = rlf.Line(
121121
)
122122

123123
# A voltage source on the first bus
124-
un = 400 / np.sqrt(3)
124+
un = 400 / rlf.SQRT3
125125
vs = rlf.VoltageSource(id="source", bus=bus1, voltages=rlf.Q_(un, "V"))
126126

127127

doc/models/Line/SimplifiedLine.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ lp = rlf.LineParameters(id="lp", z_line=rlf.Q_(0.35 * np.eye(4), "ohm/km"))
6666
line = rlf.Line(id="line", bus1=bus1, bus2=bus2, parameters=lp, length=rlf.Q_(1, "km"))
6767

6868
# A voltage source on the first bus
69-
un = 400 / np.sqrt(3)
69+
un = 400 / rlf.SQRT3
7070
vs = rlf.VoltageSource(id="source", bus=bus1, voltages=rlf.Q_(un, "V"))
7171

7272
# The potential of the neutral of bus1 is fixed at 0V

doc/models/Load/CurrentLoad.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ lp = rlf.LineParameters(id="lp", z_line=rlf.Q_(0.35 * np.eye(4), "ohm/km"))
6464
line = rlf.Line(id="line", bus1=bus1, bus2=bus2, parameters=lp, length=rlf.Q_(1, "km"))
6565

6666
# A voltage source on the first bus
67-
un = 400 / np.sqrt(3)
67+
un = 400 / rlf.SQRT3
6868
vs = rlf.VoltageSource(id="source", bus=bus1, voltages=rlf.Q_(un, "V"))
6969

7070
# The potential of the neutral of bus1 is fixed at 0V

doc/models/Load/FlexibleLoad/FeasibleDomain.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import roseau.load_flow as rlf
4242

4343
# A voltage source
4444
bus = rlf.Bus(id="bus", phases="abcn")
45-
un = 400 / np.sqrt(3)
45+
un = 400 / rlf.SQRT3
4646
vs = rlf.VoltageSource(id="source", bus=bus, voltages=rlf.Q_(un, "V"))
4747

4848
# A potential ref

doc/models/Load/ImpedanceLoad.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ lp = rlf.LineParameters(id="lp", z_line=rlf.Q_(0.35 * np.eye(4), "ohm/km"))
6161
line = rlf.Line(id="line", bus1=bus1, bus2=bus2, parameters=lp, length=rlf.Q_(1, "km"))
6262

6363
# A voltage source on the first bus
64-
un = 400 / np.sqrt(3)
64+
un = 400 / rlf.SQRT3
6565
vs = rlf.VoltageSource(id="source", bus=bus1, voltages=rlf.Q_(un, "V"))
6666

6767
# The potential of the neutral of bus1 is fixed at 0V

doc/models/Load/PowerLoad.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ lp = rlf.LineParameters(id="lp", z_line=rlf.Q_(0.35 * np.eye(4), "ohm/km"))
6464
line = rlf.Line(id="line", bus1=bus1, bus2=bus2, parameters=lp, length=rlf.Q_(1, "km"))
6565

6666
# A voltage source on the first bus
67-
un = 400 / np.sqrt(3)
67+
un = 400 / rlf.SQRT3
6868
vs = rlf.VoltageSource(id="source", bus=bus1, voltages=rlf.Q_(un, "V"))
6969

7070
# The potential of the neutral of bus1 is fixed at 0V

doc/models/Switch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ bus2 = rlf.Bus(id="bus2", phases="abcn")
5252
switch = rlf.Switch(id="switch", bus1=bus1, bus2=bus2)
5353

5454
# A voltage source on the first bus
55-
vs = rlf.VoltageSource(id="source", bus=bus1, voltages=400 / np.sqrt(3))
55+
vs = rlf.VoltageSource(id="source", bus=bus1, voltages=400 / rlf.SQRT3)
5656

5757
# The potential of the neutral of bus1 is fixed at 0V
5858
pref = rlf.PotentialRef(id="pref", element=bus1)

doc/models/Transformer/Single_Phase_Transformer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ import roseau.load_flow as rlf
7575
bus1 = rlf.Bus(id="bus1", phases="abcn")
7676
pref1 = rlf.PotentialRef(id="pref1", element=bus1)
7777

78-
vs = rlf.VoltageSource(id="vs", bus=bus1, voltages=400 / np.sqrt(3))
78+
vs = rlf.VoltageSource(id="vs", bus=bus1, voltages=400 / rlf.SQRT3)
7979

8080
# Create the load bus and the load
8181
bus2 = rlf.Bus(id="bus2", phases="an")

0 commit comments

Comments
 (0)