Skip to content

Commit eba1aab

Browse files
committed
Merge branch 'bd-dev' into smarter_solver
2 parents 950a835 + 835df5a commit eba1aab

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,3 +275,6 @@ test.txt
275275
test_output.txt
276276
test_pypower_fdpf.py
277277
lightsim2grid/tests/_grid2op_for_test/
278+
bug_sparselu
279+
bug_sparselu_eigen.cpp
280+
test_segfault.sh

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ Change Log
2020

2121
[0.7.6] 2023-xx-yy
2222
--------------------
23+
- [BREAKING] now able to retrieve `dcSbus` with a dedicated method (and not with the old `get_Sbus`).
24+
If you previously used `gridmodel.get_Subus()` to retrieve the Sbus used for DC powerflow, please use
25+
`gridmodel.get_dcSbus()` instead.
2326
- [FIXED] now voltage is properly set to 0. when shunts are disconnected
2427
- [FIXED] now voltage is properly set to 0. when storage units are disconnected
2528
- [FIXED] a bug where non connected grid were not spotted in DC
@@ -31,6 +34,7 @@ Change Log
3134
one.
3235
- [ADDED] possibility to set / retrieve the names of each elements of the grid.
3336
- [ADDED] embed in the generator models the "non pv" behaviour. (TODO need to be able to change Q from python side)
37+
- [ADDED] computation of PTPF (Power Transfer Distribution Factor) is now possible
3438
- [IMPROVED] now performing the new grid2op `create_test_suite`
3539
- [IMPROVED] now lightsim2grid properly throw `BackendError`
3640

lightsim2grid/tests/test_SameResPP.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ def _aux_test(self, pn_net):
219219
Vdc = backend._grid.dc_pf(Vinit, max_iter, tol_this)
220220
backend._grid.reactivate_result_computation()
221221
backend._grid.tell_topo_changed()
222-
Ydc_me = copy.deepcopy(backend._grid.get_Ybus())
223-
Sdc_me = copy.deepcopy(backend._grid.get_Sbus())
222+
Ydc_me = copy.deepcopy(backend._grid.get_dcYbus())
223+
Sdc_me = copy.deepcopy(backend._grid.get_dcSbus())
224224
assert np.max(np.abs(V_init_ref[pp_vect_converter] - Vdc[:nb_sub])) <= 100.*self.tol,\
225225
f"\t Error for the DC approximation: resulting voltages are different " \
226226
f"{np.max(np.abs(V_init_ref[pp_vect_converter] - Vdc[:nb_sub])):.5f}pu"

lightsim2grid/tests/test_init_from_pypowsybl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ def test_compare_pp(self):
125125
mat_pp = self.ref_samecase.get_dcYbus().todense()
126126
assert max_ <= self.tol_eq, f"error for dcYbus: {max_:.2e}"
127127
# check Sbus without slack
128-
Sbus_ordered = self.gridmodel.get_Sbus()[reorder].reshape(-1)
128+
Sbus_ordered = self.gridmodel.get_dcSbus()[reorder].reshape(-1)
129129
if slack_id > 0:
130-
max_ = np.abs(Sbus_ordered[:slack_id] - self.ref_samecase.get_Sbus()[:slack_id]).max()
130+
max_ = np.abs(Sbus_ordered[:slack_id] - self.ref_samecase.get_dcSbus()[:slack_id]).max()
131131
assert max_ <= self.tol_eq, f"error for dc Sbus: {max_:.2e}"
132-
if slack_id != self.gridmodel.get_Sbus().shape[0] - 1:
133-
max_ = np.abs(Sbus_ordered[(slack_id+1):] - self.ref_samecase.get_Sbus()[(slack_id+1):]).max()
132+
if slack_id != self.gridmodel.get_dcSbus().shape[0] - 1:
133+
max_ = np.abs(Sbus_ordered[(slack_id+1):] - self.ref_samecase.get_dcSbus()[(slack_id+1):]).max()
134134
assert max_ <= self.tol_eq, f"error for dc Sbus: {max_:.2e}"
135135

136136
# same in AC

lightsim2grid/tests/test_ptdf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ def setUp(self) -> None:
3232
warnings.filterwarnings("ignore")
3333
self.gridmodel = init(self.case)
3434
self.V_init = 1. * self.gridmodel.get_bus_vn_kv()
35-
self.gridmodel.change_solver(self.get_solver_type())
35+
solver_type = self.get_solver_type()
36+
if solver_type not in self.gridmodel.available_solvers():
37+
self.skipTest("Solver type not supported on this platform")
38+
self.gridmodel.change_solver(solver_type)
3639
self.gridmodel.dc_pf(self.V_init, 1, 1e-8)
3740
self.dcYbus = 1.0 * self.gridmodel.get_dcYbus()
3841
self.dcSbus = 1.0 * self.gridmodel.get_dcSbus().real

0 commit comments

Comments
 (0)