Skip to content

Commit

Permalink
fix a bug in assert_grid_correct_after_powerflow
Browse files Browse the repository at this point in the history
  • Loading branch information
BDonnot committed Jul 26, 2024
1 parent 83d7432 commit e8a5a10
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
10 changes: 6 additions & 4 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ TODO HVDC in Jacobian (see pandapower)

[0.9.0] 2024-07-xx
--------------------------
- TODO test for clang 18 and gcc 14
- TODO : numpy 2. compat (includes a mode without pandapower)

- [BREAKING] the way to initialize lightsim2grid `GridModel` now does not require
pandapower (you can initialize it with pypowsybl if you want). To make it both
cleaner and clearer the function `lightsim2grid.gridmodel.init` has been removed.
Expand Down Expand Up @@ -81,14 +78,19 @@ gridmodel.get_Bf() gridmodel.get_Bf_solver()
on some (rare) cases. Now an exception is thrown.
- [FIXED] basic backward compatibility is ensured and tested for legacy grid2op >= 0.9.1.post1
Not all features are tested and only 1.x versions are tested
(ie 1.1 or 1.2 but not 1.2.1, 1.2.2, 1.2.3 etc.)
(ie 1.1 or 1.2 but not 1.2.1, 1.2.2, 1.2.3 etc.) and only for python 3.11
- [FIXED] a bug when using `LightSimBackend` with some old (but not too old) grid2op
versions.
- [ADDED] it is now possible to deactivate the support for shunts by
subclassing the LightSimBackend class and setting the `shunts_data_available`
to `False`
- [IMPROVED] in the `ContingencyAnalysis` class, the underlying cpp model will now
perform an initial powerflow.
- [IMPROVED] distributed wheels are now compiled (whenever possible) with numpy 2.
This makes them compatible with both numpy 1.xx and numpy 2.yy versions.
- [IMPROVED] tests are now performed when lightsim2grid is compiled with
the latest clang (18) and gcc (14)
versions on the CI

[0.8.2.post1] 2024-04-xx
--------------------------
Expand Down
14 changes: 9 additions & 5 deletions lightsim2grid/lightSimBackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,11 +978,15 @@ def assert_grid_correct_after_powerflow(self) -> None:
except TypeError as exc_:
_init_action_to_set = self._get_action_to_set_deprecated()
self._init_action_to_set += _init_action_to_set
assert np.isfinite(self.prod_pu_to_kv).all()
assert np.isfinite(self.load_pu_to_kv).all()
assert np.isfinite(self.lines_or_pu_to_kv).all()
assert np.isfinite(self.lines_ex_pu_to_kv).all()
if self.__has_storage and self.n_storage > 0:
if self.prod_pu_to_kv is not None:
assert np.isfinite(self.prod_pu_to_kv).all()
if self.load_pu_to_kv is not None:
assert np.isfinite(self.load_pu_to_kv).all()
if self.lines_or_pu_to_kv is not None:
assert np.isfinite(self.lines_or_pu_to_kv).all()
if self.lines_ex_pu_to_kv is not None:
assert np.isfinite(self.lines_ex_pu_to_kv).all()
if self.__has_storage and self.n_storage > 0 and self.storage_pu_to_kv is not None:
assert np.isfinite(self.storage_pu_to_kv).all()

def _get_action_to_set_deprecated(self):
Expand Down

0 comments on commit e8a5a10

Please sign in to comment.