LightSim2Grid 0.7.3__tar.gz → 0.7.4.post1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1/LightSim2Grid.egg-info}/PKG-INFO +28 -6
  2. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/LightSim2Grid.egg-info/SOURCES.txt +1 -0
  3. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/LightSim2Grid.egg-info/requires.txt +2 -2
  4. {LightSim2Grid-0.7.3/LightSim2Grid.egg-info → LightSim2Grid-0.7.4.post1}/PKG-INFO +28 -6
  5. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/README.md +4 -0
  6. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/__init__.py +1 -1
  7. LightSim2Grid-0.7.4.post1/lightsim2grid/_utils/__init__.py +11 -0
  8. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/lightSimBackend.py +92 -49
  9. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/setup.py +2 -2
  10. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/AUTHORS.txt +0 -0
  11. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/LICENSE +0 -0
  12. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/LICENSE.md +0 -0
  13. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/LightSim2Grid.egg-info/dependency_links.txt +0 -0
  14. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/LightSim2Grid.egg-info/not-zip-safe +0 -0
  15. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/LightSim2Grid.egg-info/top_level.txt +0 -0
  16. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/elements/__init__.py +0 -0
  17. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/__init__.py +0 -0
  18. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_dc_line.py +0 -0
  19. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_gen.py +0 -0
  20. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_line.py +0 -0
  21. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_load.py +0 -0
  22. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_sgen.py +0 -0
  23. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_shunt.py +0 -0
  24. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_slack.py +0 -0
  25. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_storage.py +0 -0
  26. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_trafo.py +0 -0
  27. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_check_legit.py +0 -0
  28. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/initGridModel.py +0 -0
  29. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/newtonpf/__init__.py +0 -0
  30. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/newtonpf/newtonpf.py +0 -0
  31. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/physical_law_checker.py +0 -0
  32. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/securityAnalysis.py +0 -0
  33. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/solver/__init__.py +0 -0
  34. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/lightsim2grid/timeSerie.py +0 -0
  35. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/pyproject.toml +0 -0
  36. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/setup.cfg +0 -0
  37. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/BaseConstants.cpp +0 -0
  38. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/BaseMultiplePowerflow.cpp +0 -0
  39. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/BaseSolver.cpp +0 -0
  40. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/ChooseSolver.cpp +0 -0
  41. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/Computers.cpp +0 -0
  42. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/DataConverter.cpp +0 -0
  43. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/DataDCLine.cpp +0 -0
  44. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/DataGen.cpp +0 -0
  45. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/DataGeneric.cpp +0 -0
  46. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/DataLine.cpp +0 -0
  47. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/DataLoad.cpp +0 -0
  48. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/DataSGen.cpp +0 -0
  49. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/DataShunt.cpp +0 -0
  50. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/DataTrafo.cpp +0 -0
  51. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/GaussSeidelSolver.cpp +0 -0
  52. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/GaussSeidelSynchSolver.cpp +0 -0
  53. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/GridModel.cpp +0 -0
  54. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/KLUSolver.cpp +0 -0
  55. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/SecurityAnalysis.cpp +0 -0
  56. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/SparseLUSolver.cpp +0 -0
  57. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/help_fun_msg.cpp +0 -0
  58. {LightSim2Grid-0.7.3 → LightSim2Grid-0.7.4.post1}/src/main.cpp +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LightSim2Grid
3
- Version: 0.7.3
3
+ Version: 0.7.4.post1
4
4
  Summary: LightSim2Grid implements a c++ backend targeting the Grid2Op platform.
5
5
  Home-page: https://github.com/BDonnot/lightsim2grid/
6
6
  Author: Benjamin Donnot
@@ -23,13 +23,33 @@ Classifier: Intended Audience :: Education
23
23
  Classifier: Intended Audience :: Science/Research
24
24
  Classifier: Natural Language :: English
25
25
  Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ License-File: LICENSE.md
28
+ License-File: AUTHORS.txt
29
+ Requires-Dist: pandapower>=2.8
30
+ Requires-Dist: pytest
26
31
  Provides-Extra: docs
32
+ Requires-Dist: numpydoc>=0.9.2; extra == "docs"
33
+ Requires-Dist: sphinx<7,>=2.4.4; extra == "docs"
34
+ Requires-Dist: sphinx-rtd-theme>=0.4.3; extra == "docs"
35
+ Requires-Dist: sphinxcontrib-trio>=1.1.0; extra == "docs"
36
+ Requires-Dist: autodocsumm>=0.1.13; extra == "docs"
37
+ Requires-Dist: grid2op>=1.6.4; extra == "docs"
38
+ Requires-Dist: recommonmark; extra == "docs"
27
39
  Provides-Extra: benchmark
40
+ Requires-Dist: tabulate; extra == "benchmark"
41
+ Requires-Dist: grid2op>=1.6.4; extra == "benchmark"
42
+ Requires-Dist: numpy>=1.20; extra == "benchmark"
43
+ Requires-Dist: distro; extra == "benchmark"
44
+ Requires-Dist: py-cpuinfo; extra == "benchmark"
28
45
  Provides-Extra: recommended
46
+ Requires-Dist: grid2op>=1.6.4; extra == "recommended"
47
+ Requires-Dist: numba; extra == "recommended"
29
48
  Provides-Extra: test
30
- License-File: LICENSE
31
- License-File: LICENSE.md
32
- License-File: AUTHORS.txt
49
+ Requires-Dist: grid2op>=1.6.4; extra == "test"
50
+ Requires-Dist: numba; extra == "test"
51
+ Requires-Dist: pandapower>=2.8.0; extra == "test"
52
+ Requires-Dist: packaging; extra == "test"
33
53
 
34
54
  # LightSim2Grid
35
55
  Provide a fast backend for grid2op using c++ KLU and Eigen librairies. Its primary goal is to serve as a fast
@@ -118,6 +138,10 @@ Pypi packages are available for linux, windows and macos with python versions:
118
138
  - 3.8
119
139
  - 3.9
120
140
  - 3.10 (lightsim2grid >= 0.6.1)
141
+ - 3.11 (lightsim2grid >= 0.7.1)
142
+
143
+ **NB** on some version of MacOs (thanks Apple !), especially the one using M1 or M2 chip, lightsim2grid is only available
144
+ on pypi starting from version 0.7.3
121
145
 
122
146
  ## Installation (from source, for more advanced user)
123
147
 
@@ -342,5 +366,3 @@ On the clang compiler (default one on MacOS computer) it is sometime require to
342
366
  to 2.6.2 to install the package.
343
367
 
344
368
  You can downgrade pybind11 with: `python -m pip install -U pybind11==2.6.2`
345
-
346
-
@@ -15,6 +15,7 @@ lightsim2grid/lightSimBackend.py
15
15
  lightsim2grid/physical_law_checker.py
16
16
  lightsim2grid/securityAnalysis.py
17
17
  lightsim2grid/timeSerie.py
18
+ lightsim2grid/_utils/__init__.py
18
19
  lightsim2grid/elements/__init__.py
19
20
  lightsim2grid/gridmodel/__init__.py
20
21
  lightsim2grid/gridmodel/_aux_add_dc_line.py
@@ -1,4 +1,4 @@
1
- pandapower
1
+ pandapower>=2.8
2
2
  pytest
3
3
 
4
4
  [benchmark]
@@ -10,7 +10,7 @@ py-cpuinfo
10
10
 
11
11
  [docs]
12
12
  numpydoc>=0.9.2
13
- sphinx>=2.4.4
13
+ sphinx<7,>=2.4.4
14
14
  sphinx-rtd-theme>=0.4.3
15
15
  sphinxcontrib-trio>=1.1.0
16
16
  autodocsumm>=0.1.13
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LightSim2Grid
3
- Version: 0.7.3
3
+ Version: 0.7.4.post1
4
4
  Summary: LightSim2Grid implements a c++ backend targeting the Grid2Op platform.
5
5
  Home-page: https://github.com/BDonnot/lightsim2grid/
6
6
  Author: Benjamin Donnot
@@ -23,13 +23,33 @@ Classifier: Intended Audience :: Education
23
23
  Classifier: Intended Audience :: Science/Research
24
24
  Classifier: Natural Language :: English
25
25
  Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ License-File: LICENSE.md
28
+ License-File: AUTHORS.txt
29
+ Requires-Dist: pandapower>=2.8
30
+ Requires-Dist: pytest
26
31
  Provides-Extra: docs
32
+ Requires-Dist: numpydoc>=0.9.2; extra == "docs"
33
+ Requires-Dist: sphinx<7,>=2.4.4; extra == "docs"
34
+ Requires-Dist: sphinx-rtd-theme>=0.4.3; extra == "docs"
35
+ Requires-Dist: sphinxcontrib-trio>=1.1.0; extra == "docs"
36
+ Requires-Dist: autodocsumm>=0.1.13; extra == "docs"
37
+ Requires-Dist: grid2op>=1.6.4; extra == "docs"
38
+ Requires-Dist: recommonmark; extra == "docs"
27
39
  Provides-Extra: benchmark
40
+ Requires-Dist: tabulate; extra == "benchmark"
41
+ Requires-Dist: grid2op>=1.6.4; extra == "benchmark"
42
+ Requires-Dist: numpy>=1.20; extra == "benchmark"
43
+ Requires-Dist: distro; extra == "benchmark"
44
+ Requires-Dist: py-cpuinfo; extra == "benchmark"
28
45
  Provides-Extra: recommended
46
+ Requires-Dist: grid2op>=1.6.4; extra == "recommended"
47
+ Requires-Dist: numba; extra == "recommended"
29
48
  Provides-Extra: test
30
- License-File: LICENSE
31
- License-File: LICENSE.md
32
- License-File: AUTHORS.txt
49
+ Requires-Dist: grid2op>=1.6.4; extra == "test"
50
+ Requires-Dist: numba; extra == "test"
51
+ Requires-Dist: pandapower>=2.8.0; extra == "test"
52
+ Requires-Dist: packaging; extra == "test"
33
53
 
34
54
  # LightSim2Grid
35
55
  Provide a fast backend for grid2op using c++ KLU and Eigen librairies. Its primary goal is to serve as a fast
@@ -118,6 +138,10 @@ Pypi packages are available for linux, windows and macos with python versions:
118
138
  - 3.8
119
139
  - 3.9
120
140
  - 3.10 (lightsim2grid >= 0.6.1)
141
+ - 3.11 (lightsim2grid >= 0.7.1)
142
+
143
+ **NB** on some version of MacOs (thanks Apple !), especially the one using M1 or M2 chip, lightsim2grid is only available
144
+ on pypi starting from version 0.7.3
121
145
 
122
146
  ## Installation (from source, for more advanced user)
123
147
 
@@ -342,5 +366,3 @@ On the clang compiler (default one on MacOS computer) it is sometime require to
342
366
  to 2.6.2 to install the package.
343
367
 
344
368
  You can downgrade pybind11 with: `python -m pip install -U pybind11==2.6.2`
345
-
346
-
@@ -85,6 +85,10 @@ Pypi packages are available for linux, windows and macos with python versions:
85
85
  - 3.8
86
86
  - 3.9
87
87
  - 3.10 (lightsim2grid >= 0.6.1)
88
+ - 3.11 (lightsim2grid >= 0.7.1)
89
+
90
+ **NB** on some version of MacOs (thanks Apple !), especially the one using M1 or M2 chip, lightsim2grid is only available
91
+ on pypi starting from version 0.7.3
88
92
 
89
93
  ## Installation (from source, for more advanced user)
90
94
 
@@ -9,7 +9,7 @@
9
9
  import faulthandler
10
10
  faulthandler.enable()
11
11
 
12
- __version__ = "0.7.3"
12
+ __version__ = "0.7.4.post1"
13
13
 
14
14
  __all__ = ["newtonpf", "SolverType", "ErrorType", "solver"]
15
15
 
@@ -0,0 +1,11 @@
1
+ # this class is defined to avoid circular references when using grid2op -> pandapower -> lightsim2grid -> grid2op
2
+ # this module is lazily imported by the LightSimBackend and should not be used anywhere else,
3
+ # as the name states
4
+ try:
5
+ from grid2op.Backend import PandaPowerBackend
6
+ class _DoNotUseAnywherePandaPowerBackend(PandaPowerBackend):
7
+ """used to duplicate the class attributes of PandaPowerBackend"""
8
+ pass
9
+ except ImportError as exc_:
10
+ # grid2op is not installed, we do not use it.
11
+ pass
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2020, RTE (https://www.rte-france.com)
1
+ # Copyright (c) 2020-2024, RTE (https://www.rte-france.com)
2
2
  # See AUTHORS.txt
3
3
  # This Source Code Form is subject to the terms of the Mozilla Public License, version 2.0.
4
4
  # If a copy of the Mozilla Public License, version 2.0 was not distributed with this file,
@@ -40,31 +40,40 @@ class LightSimBackend(Backend):
40
40
  dist_slack_non_renew: bool=False, # distribute the slack on non renewable turned on (and with P>0) generators
41
41
  use_static_gen: bool=False, # add the static generators as generator gri2dop side
42
42
  ):
43
- try:
44
- # for grid2Op >= 1.7.1
45
- Backend.__init__(self,
46
- detailed_infos_for_cascading_failures=detailed_infos_for_cascading_failures,
47
- can_be_copied=can_be_copied,
48
- solver_type=solver_type,
49
- max_iter=max_iter,
50
- tol=tol,
51
- turned_off_pv=turned_off_pv,
52
- dist_slack_non_renew=dist_slack_non_renew,
53
- use_static_gen=use_static_gen)
54
- except TypeError as exc_:
55
- warnings.warn("Please use grid2op >= 1.7.1: with older grid2op versions, "
56
- "you cannot set max_iter, tol nor solver_type arguments.")
57
- Backend.__init__(self,
58
- detailed_infos_for_cascading_failures=detailed_infos_for_cascading_failures)
43
+ self.max_it = max_iter
44
+ self.tol = tol # tolerance for the solver
45
+ self._check_suitable_solver_type(solver_type, check_in_avail_solver=False)
46
+ self.__current_solver_type = solver_type
47
+
48
+ # does the "turned off" generators (including when p=0)
49
+ # are pv buses
50
+ self._turned_off_pv = turned_off_pv
51
+
52
+ # distributed slack, on non renewable gen with P > 0
53
+ self._dist_slack_non_renew = dist_slack_non_renew
54
+
55
+ # add the static gen to the list of controlable gen in grid2Op
56
+ self._use_static_gen = use_static_gen # TODO implement it
57
+
58
+ self._aux_init_super(detailed_infos_for_cascading_failures,
59
+ can_be_copied,
60
+ solver_type,
61
+ max_iter,
62
+ tol,
63
+ turned_off_pv,
64
+ dist_slack_non_renew,
65
+ use_static_gen)
59
66
 
60
67
  # lazy loading because it crashes...
61
- from grid2op.Backend import PandaPowerBackend
68
+ from lightsim2grid._utils import _DoNotUseAnywherePandaPowerBackend
62
69
  from grid2op.Space import GridObjects # lazy import
63
70
  self.__has_storage = hasattr(GridObjects, "n_storage")
64
71
  if not self.__has_storage:
65
72
  warnings.warn("Please upgrade your grid2Op to >= 1.5.0. You are using a backward compatibility "
66
73
  "feature that will be removed in further lightsim2grid version.")
67
74
 
75
+ self.shunts_data_available = True # needs to be self and not type(self) here
76
+
68
77
  self.nb_bus_total = None
69
78
  self.initdc = True # does not really hurt computation time
70
79
  self.__nb_powerline = None
@@ -84,17 +93,14 @@ class LightSimBackend(Backend):
84
93
 
85
94
  self.topo_vect = None
86
95
  self.shunt_topo_vect = None
87
-
88
96
  try:
89
- self.init_pp_backend = PandaPowerBackend(with_numba=False)
97
+ self.init_pp_backend = _DoNotUseAnywherePandaPowerBackend(with_numba=False)
90
98
  except TypeError as exc_:
91
99
  # oldest version of grid2op do not support the kwargs "with_numba"
92
100
  # (before 1.9.1)
93
- self.init_pp_backend = PandaPowerBackend()
101
+ self.init_pp_backend = _DoNotUseAnywherePandaPowerBackend()
94
102
 
95
103
  self.V = None
96
- self.max_it = max_iter
97
- self.tol = tol # tolerance for the solver
98
104
 
99
105
  self.prod_pu_to_kv = None
100
106
  self.load_pu_to_kv = None
@@ -146,12 +152,20 @@ class LightSimBackend(Backend):
146
152
 
147
153
  # available solver in lightsim
148
154
  self.available_solvers = []
149
- self.comp_time = 0. # computation time of just the powerflow
155
+
156
+ # computation time of just the powerflow (when the grid is formatted
157
+ # by the gridmodel already)
158
+ # it takes only into account the time spend in the powerflow algorithm
159
+ self.comp_time = 0.
160
+
161
+ # computation time of the powerflow
162
+ # it takes into account everything in the gridmodel, including the mapping
163
+ # to the solver, building of Ybus and Sbus AND the time to solve the powerflow
164
+ self.timer_gridmodel_xx_pf = 0.
165
+
150
166
  self._timer_postproc = 0.
151
167
  self._timer_preproc = 0.
152
168
  self._timer_solver = 0.
153
- self._check_suitable_solver_type(solver_type, check_in_avail_solver=False)
154
- self.__current_solver_type = solver_type
155
169
 
156
170
  # hack for the storage unit:
157
171
  # in grid2op, for simplicity, I suppose that if a storage is alone on a busbar, and
@@ -163,17 +177,34 @@ class LightSimBackend(Backend):
163
177
  # TODO and should rather be handled in pandapower backend
164
178
  # backend SHOULD not do these kind of stuff
165
179
  self._idx_hack_storage = []
166
-
167
- # does the "turned off" generators (including when p=0)
168
- # are pv buses
169
- self._turned_off_pv = turned_off_pv
170
-
171
- # distributed slack, on non renewable gen with P > 0
172
- self._dist_slack_non_renew = dist_slack_non_renew
173
-
174
- # add the static gen to the list of controlable gen in grid2Op
175
- self._use_static_gen = use_static_gen # TODO implement it
176
-
180
+
181
+ def _aux_init_super(self,
182
+ detailed_infos_for_cascading_failures,
183
+ can_be_copied,
184
+ solver_type,
185
+ max_iter,
186
+ tol,
187
+ turned_off_pv,
188
+ dist_slack_non_renew,
189
+ use_static_gen):
190
+ try:
191
+ # for grid2Op >= 1.7.1
192
+ Backend.__init__(self,
193
+ detailed_infos_for_cascading_failures=detailed_infos_for_cascading_failures,
194
+ can_be_copied=can_be_copied,
195
+ solver_type=solver_type,
196
+ max_iter=max_iter,
197
+ tol=tol,
198
+ turned_off_pv=turned_off_pv,
199
+ dist_slack_non_renew=dist_slack_non_renew,
200
+ use_static_gen=use_static_gen
201
+ )
202
+ except TypeError as exc_:
203
+ warnings.warn("Please use grid2op >= 1.7.1: with older grid2op versions, "
204
+ "you cannot set max_iter, tol nor solver_type arguments.")
205
+ Backend.__init__(self,
206
+ detailed_infos_for_cascading_failures=detailed_infos_for_cascading_failures)
207
+
177
208
  def turnedoff_no_pv(self):
178
209
  self._turned_off_pv = False
179
210
  self._grid.turnedoff_no_pv()
@@ -439,7 +470,7 @@ class LightSimBackend(Backend):
439
470
  self.storage_loss = self.init_pp_backend.storage_loss
440
471
  self.storage_discharging_efficiency = self.init_pp_backend.storage_discharging_efficiency
441
472
  self.storage_charging_efficiency = self.init_pp_backend.storage_charging_efficiency
442
-
473
+
443
474
  self.nb_bus_total = self.init_pp_backend._grid.bus.shape[0]
444
475
 
445
476
  self.thermal_limit_a = copy.deepcopy(self.init_pp_backend.thermal_limit_a)
@@ -477,7 +508,7 @@ class LightSimBackend(Backend):
477
508
  tmp.reshape(-1, 1)), axis=-1)
478
509
 
479
510
  self._big_topo_to_obj = [(None, None) for _ in range(self.dim_topo)]
480
-
511
+
481
512
  self._compute_pos_big_topo()
482
513
 
483
514
  # set up the "lightsim grid" accordingly
@@ -591,8 +622,8 @@ class LightSimBackend(Backend):
591
622
  """
592
623
  # test the results gives the proper size
593
624
  super().assert_grid_correct_after_powerflow()
594
- self.init_pp_backend.__class__ = self.init_pp_backend.init_grid(self)
595
- self._backend_action_class = _BackendAction.init_grid(self)
625
+ self.init_pp_backend.__class__ = type(self.init_pp_backend).init_grid(type(self))
626
+ self._backend_action_class = _BackendAction.init_grid(type(self))
596
627
  self._init_action_to_set = self._backend_action_class()
597
628
  try:
598
629
  # feature added in grid2op 1.4 or 1.5
@@ -894,25 +925,37 @@ class LightSimBackend(Backend):
894
925
  ####################
895
926
  # res = copy.deepcopy(self) # super slow
896
927
  res = type(self).__new__(type(self))
928
+ # make sure to init the "base class"
929
+ # in particular with "new" attributes in future grid2op Backend
930
+ res._aux_init_super(self.detailed_infos_for_cascading_failures,
931
+ self._can_be_copied,
932
+ self.__current_solver_type,
933
+ self.max_it,
934
+ self.tol,
935
+ self._turned_off_pv,
936
+ self._dist_slack_non_renew,
937
+ self._use_static_gen)
938
+ res.comp_time = self.comp_time
939
+ res.timer_gridmodel_xx_pf = self.timer_gridmodel_xx_pf
897
940
 
898
941
  # copy the regular attribute
899
942
  res.__has_storage = self.__has_storage
900
- res.__current_solver_type = self.__current_solver_type
943
+ res.__current_solver_type = self.__current_solver_type # forced here because of special `__`
901
944
  res.__nb_powerline = self.__nb_powerline
902
945
  res.__nb_bus_before = self.__nb_bus_before
903
- res._can_be_copied = self._can_be_copied
904
946
  res.cst_1 = dt_float(1.0)
905
- li_regular_attr = ["detailed_infos_for_cascading_failures", "comp_time", "can_output_theta", "_is_loaded",
947
+ li_regular_attr = ["comp_time", "can_output_theta", "_is_loaded",
906
948
  "nb_bus_total", "initdc",
907
- "_big_topo_to_obj", "max_it", "tol", "dim_topo",
949
+ "_big_topo_to_obj", "dim_topo",
908
950
  "_idx_hack_storage",
909
951
  "_timer_preproc", "_timer_postproc", "_timer_solver",
910
- "_my_kwargs",
911
- "_turned_off_pv", "_dist_slack_non_renew"
952
+ "supported_grid_format",
953
+ "max_it", "tol", "_turned_off_pv", "_dist_slack_non_renew",
954
+ "_use_static_gen"
912
955
  ]
913
956
  for attr_nm in li_regular_attr:
914
957
  if hasattr(self, attr_nm):
915
- # this test is needed for backward compatibility with other grid2op version
958
+ # this test is needed for backward compatibility with older grid2op version
916
959
  setattr(res, attr_nm, copy.deepcopy(getattr(self, attr_nm)))
917
960
 
918
961
  # copy the numpy array
@@ -955,7 +998,7 @@ class LightSimBackend(Backend):
955
998
  ] + type(self)._li_attr_disp
956
999
 
957
1000
  for attr_nm in cls_attr:
958
- if hasattr(self, attr_nm):
1001
+ if hasattr(self, attr_nm) and not hasattr(type(self), attr_nm):
959
1002
  # this test is needed for backward compatibility with other grid2op version
960
1003
  setattr(res, attr_nm, copy.deepcopy(getattr(self, attr_nm)))
961
1004
  ###############
@@ -14,7 +14,7 @@ import warnings
14
14
  from pybind11.setup_helpers import Pybind11Extension, build_ext
15
15
 
16
16
 
17
- __version__ = "0.7.3"
17
+ __version__ = "0.7.4.post1"
18
18
  KLU_SOLVER_AVAILABLE = False
19
19
 
20
20
  # Try to link against SuiteSparse (if available)
@@ -327,7 +327,7 @@ pkgs = {
327
327
  "extras": {
328
328
  "docs": [
329
329
  "numpydoc>=0.9.2",
330
- "sphinx>=2.4.4",
330
+ "sphinx>=2.4.4,<7",
331
331
  "sphinx-rtd-theme>=0.4.3",
332
332
  "sphinxcontrib-trio>=1.1.0",
333
333
  "autodocsumm>=0.1.13",