Skip to content

Commit

Permalink
fix an issue that prevent to retrieve theta information when loading …
Browse files Browse the repository at this point in the history
…from pypowsybl

Signed-off-by: DONNOT Benjamin <[email protected]>
  • Loading branch information
BDonnot committed Nov 28, 2024
1 parent 40cd64a commit 940dc0a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ TODO: in `main.cpp` check the returned policy of pybind11 and also the `py::call
TODO: a cpp class that is able to compute (DC powerflow) ContingencyAnalysis and TimeSeries using PTDF and LODF
TODO: integration test with pandapower (see `pandapower/contingency/contingency.py` and import `lightsim2grid_installed` and check it's True)

[0.9.2.post2] 2024-11-28
--------------------------
- [FIXED] The attribute `can_output_theta` (of base `Backend` class)
was not set to `True` if using the pypowsybl loader.

[0.9.2.post1] 2024-11-28
--------------------------
- [FIXED] There is still a bug with the pypowsybl 1.8.1 version with the
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Benjamin DONNOT'

# The full version, including alpha/beta/rc tags
release = "0.9.2.post1"
release = "0.9.2.post2"
version = '0.9'

# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion lightsim2grid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# SPDX-License-Identifier: MPL-2.0
# This file is part of LightSim2grid, LightSim2grid implements a c++ backend targeting the Grid2Op platform.

__version__ = "0.9.2.post1"
__version__ = "0.9.2.post2"

__all__ = ["newtonpf", "SolverType", "ErrorType", "solver", "compilation_options"]

Expand Down
4 changes: 3 additions & 1 deletion lightsim2grid/lightSimBackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ def __init__(self,
if not hasattr(self, "_can_be_copied"):
self._can_be_copied = can_be_copied

#: I can output the voltage angle
self.can_output_theta = True

#: .. versionadded:: 0.8.0
#:
#: Which type of grid format can be read by your backend.
Expand Down Expand Up @@ -836,7 +839,6 @@ def _load_grid_pandapower(self, path=None, filename=None):
self._aux_init_pandapower()

def _aux_init_pandapower(self):
self.can_output_theta = True # i can compute the "theta" and output it to grid2op
from lightsim2grid.gridmodel import init_from_pandapower
self._grid = init_from_pandapower(self.init_pp_backend._grid)
self.__nb_bus_before = self.init_pp_backend.get_nb_active_bus()
Expand Down
2 changes: 2 additions & 0 deletions lightsim2grid/tests/test_backend_pypowsybl.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def test_runpf(self):
# DC powerflow
conv, exc_ = backend.runpf(is_dc=True)
assert conv
assert backend.can_output_theta

class BackendTester2(unittest.TestCase):
"""issue is still not replicated and these tests pass"""
Expand Down Expand Up @@ -101,6 +102,7 @@ def test_runpf(self):
# DC powerflow
conv, exc_ = backend.runpf(is_dc=True)
assert conv
assert backend.can_output_theta

if CAN_DO_TEST_SUITE:
dir_path = os.path.dirname(os.path.realpath(__file__))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pybind11.setup_helpers import Pybind11Extension, build_ext


__version__ = "0.9.2.post1"
__version__ = "0.9.2.post2"
KLU_SOLVER_AVAILABLE = False

# Try to link against SuiteSparse (if available)
Expand Down

0 comments on commit 940dc0a

Please sign in to comment.