LightSim2Grid 0.7.4__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.4 → LightSim2Grid-0.7.4.post1/LightSim2Grid.egg-info}/PKG-INFO +24 -4
  2. {LightSim2Grid-0.7.4/LightSim2Grid.egg-info → LightSim2Grid-0.7.4.post1}/PKG-INFO +24 -4
  3. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/__init__.py +1 -1
  4. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/lightSimBackend.py +84 -56
  5. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/setup.py +1 -1
  6. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/AUTHORS.txt +0 -0
  7. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/LICENSE +0 -0
  8. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/LICENSE.md +0 -0
  9. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/LightSim2Grid.egg-info/SOURCES.txt +0 -0
  10. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/LightSim2Grid.egg-info/dependency_links.txt +0 -0
  11. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/LightSim2Grid.egg-info/not-zip-safe +0 -0
  12. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/LightSim2Grid.egg-info/requires.txt +0 -0
  13. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/LightSim2Grid.egg-info/top_level.txt +0 -0
  14. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/README.md +0 -0
  15. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/_utils/__init__.py +0 -0
  16. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/elements/__init__.py +0 -0
  17. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/__init__.py +0 -0
  18. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_dc_line.py +0 -0
  19. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_gen.py +0 -0
  20. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_line.py +0 -0
  21. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_load.py +0 -0
  22. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_sgen.py +0 -0
  23. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_shunt.py +0 -0
  24. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_slack.py +0 -0
  25. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_storage.py +0 -0
  26. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_add_trafo.py +0 -0
  27. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/_aux_check_legit.py +0 -0
  28. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/gridmodel/initGridModel.py +0 -0
  29. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/newtonpf/__init__.py +0 -0
  30. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/newtonpf/newtonpf.py +0 -0
  31. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/physical_law_checker.py +0 -0
  32. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/securityAnalysis.py +0 -0
  33. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/solver/__init__.py +0 -0
  34. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/lightsim2grid/timeSerie.py +0 -0
  35. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/pyproject.toml +0 -0
  36. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/setup.cfg +0 -0
  37. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/BaseConstants.cpp +0 -0
  38. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/BaseMultiplePowerflow.cpp +0 -0
  39. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/BaseSolver.cpp +0 -0
  40. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/ChooseSolver.cpp +0 -0
  41. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/Computers.cpp +0 -0
  42. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/DataConverter.cpp +0 -0
  43. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/DataDCLine.cpp +0 -0
  44. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/DataGen.cpp +0 -0
  45. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/DataGeneric.cpp +0 -0
  46. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/DataLine.cpp +0 -0
  47. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/DataLoad.cpp +0 -0
  48. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/DataSGen.cpp +0 -0
  49. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/DataShunt.cpp +0 -0
  50. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/DataTrafo.cpp +0 -0
  51. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/GaussSeidelSolver.cpp +0 -0
  52. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/GaussSeidelSynchSolver.cpp +0 -0
  53. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/GridModel.cpp +0 -0
  54. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/KLUSolver.cpp +0 -0
  55. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/SecurityAnalysis.cpp +0 -0
  56. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/SparseLUSolver.cpp +0 -0
  57. {LightSim2Grid-0.7.4 → LightSim2Grid-0.7.4.post1}/src/help_fun_msg.cpp +0 -0
  58. {LightSim2Grid-0.7.4 → 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.4
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LightSim2Grid
3
- Version: 0.7.4
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
@@ -9,7 +9,7 @@
9
9
  import faulthandler
10
10
  faulthandler.enable()
11
11
 
12
- __version__ = "0.7.4"
12
+ __version__ = "0.7.4.post1"
13
13
 
14
14
  __all__ = ["newtonpf", "SolverType", "ErrorType", "solver"]
15
15
 
@@ -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,22 +40,29 @@ 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
68
  from lightsim2grid._utils import _DoNotUseAnywherePandaPowerBackend
@@ -65,6 +72,8 @@ class LightSimBackend(Backend):
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
@@ -92,8 +101,6 @@ class LightSimBackend(Backend):
92
101
  self.init_pp_backend = _DoNotUseAnywherePandaPowerBackend()
93
102
 
94
103
  self.V = None
95
- self.max_it = max_iter
96
- self.tol = tol # tolerance for the solver
97
104
 
98
105
  self.prod_pu_to_kv = None
99
106
  self.load_pu_to_kv = None
@@ -145,12 +152,20 @@ class LightSimBackend(Backend):
145
152
 
146
153
  # available solver in lightsim
147
154
  self.available_solvers = []
148
- 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
+
149
166
  self._timer_postproc = 0.
150
167
  self._timer_preproc = 0.
151
168
  self._timer_solver = 0.
152
- self._check_suitable_solver_type(solver_type, check_in_avail_solver=False)
153
- self.__current_solver_type = solver_type
154
169
 
155
170
  # hack for the storage unit:
156
171
  # in grid2op, for simplicity, I suppose that if a storage is alone on a busbar, and
@@ -162,32 +177,33 @@ class LightSimBackend(Backend):
162
177
  # TODO and should rather be handled in pandapower backend
163
178
  # backend SHOULD not do these kind of stuff
164
179
  self._idx_hack_storage = []
165
-
166
- # does the "turned off" generators (including when p=0)
167
- # are pv buses
168
- self._turned_off_pv = turned_off_pv
169
-
170
- # distributed slack, on non renewable gen with P > 0
171
- self._dist_slack_non_renew = dist_slack_non_renew
172
-
173
- # add the static gen to the list of controlable gen in grid2Op
174
- self._use_static_gen = use_static_gen # TODO implement it
175
-
176
- # storage data for this object (otherwise it's in the class)
177
- self.n_storage = None
178
- self.storage_to_subid = None
179
- self.storage_pu_to_kv = None
180
- self.name_storage = None
181
- self.storage_to_sub_pos = None
182
- self.storage_type = None
183
- self.storage_Emin = None
184
- self.storage_Emax = None
185
- self.storage_max_p_prod = None
186
- self.storage_max_p_absorb = None
187
- self.storage_marginal_cost = None
188
- self.storage_loss = None
189
- self.storage_discharging_efficiency = None
190
- self.storage_charging_efficiency = None
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)
191
207
 
192
208
  def turnedoff_no_pv(self):
193
209
  self._turned_off_pv = False
@@ -909,25 +925,37 @@ class LightSimBackend(Backend):
909
925
  ####################
910
926
  # res = copy.deepcopy(self) # super slow
911
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
912
940
 
913
941
  # copy the regular attribute
914
942
  res.__has_storage = self.__has_storage
915
- res.__current_solver_type = self.__current_solver_type
943
+ res.__current_solver_type = self.__current_solver_type # forced here because of special `__`
916
944
  res.__nb_powerline = self.__nb_powerline
917
945
  res.__nb_bus_before = self.__nb_bus_before
918
- res._can_be_copied = self._can_be_copied
919
946
  res.cst_1 = dt_float(1.0)
920
- 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",
921
948
  "nb_bus_total", "initdc",
922
- "_big_topo_to_obj", "max_it", "tol", "dim_topo",
949
+ "_big_topo_to_obj", "dim_topo",
923
950
  "_idx_hack_storage",
924
951
  "_timer_preproc", "_timer_postproc", "_timer_solver",
925
- "_my_kwargs",
926
- "_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"
927
955
  ]
928
956
  for attr_nm in li_regular_attr:
929
957
  if hasattr(self, attr_nm):
930
- # this test is needed for backward compatibility with other grid2op version
958
+ # this test is needed for backward compatibility with older grid2op version
931
959
  setattr(res, attr_nm, copy.deepcopy(getattr(self, attr_nm)))
932
960
 
933
961
  # copy the numpy array
@@ -970,7 +998,7 @@ class LightSimBackend(Backend):
970
998
  ] + type(self)._li_attr_disp
971
999
 
972
1000
  for attr_nm in cls_attr:
973
- if hasattr(self, attr_nm):
1001
+ if hasattr(self, attr_nm) and not hasattr(type(self), attr_nm):
974
1002
  # this test is needed for backward compatibility with other grid2op version
975
1003
  setattr(res, attr_nm, copy.deepcopy(getattr(self, attr_nm)))
976
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.4"
17
+ __version__ = "0.7.4.post1"
18
18
  KLU_SOLVER_AVAILABLE = False
19
19
 
20
20
  # Try to link against SuiteSparse (if available)