diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f92998c..94eeea3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -26,6 +26,26 @@ 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.10.2] 2025-01-xx +---------------------- +- [FIXED] an error when changing of bus one of the slack (did not trigger the + recompute of pv bus ids) +- [FIXED] an issue when turning off a generator: it was still declared as "slack" + if it was one. +- [FIXED] could not disconnect a generator when it was a slack bus +- [ADDED] packaging package as a dependency +- [IMPROVED] refactoring of the c++ side container element to reduce + code (for "one end" elements such as loads, generators, static generators and shunts) + +[0.10.1] 2025-01-04 +---------------------------- +- [FIXED] some timings on the benchmarks were not measured at the right time +- [ADDED] more benchmarks especially for DC powerflow +- [ADDED] a `dcpf` function that can replace the pandapower `dcpf` interal function +- [IMPROVED] benchmark on the documentation + (clarity of what is done) +- [IMPROVED] consistency of the names and measured times accross the different benchmarks + [0.10.0] 2024-12-17 ------------------- - [BREAKING] disconnected storage now raises errors if some power is produced / absorbed, when using legacy grid2op version, diff --git a/benchmarks/benchmark_grid_size.py b/benchmarks/benchmark_grid_size.py index 880f8e3..50049d3 100644 --- a/benchmarks/benchmark_grid_size.py +++ b/benchmarks/benchmark_grid_size.py @@ -360,7 +360,7 @@ def run_grid2op_env(env_lightsim, case, reset_solver, env_lightsim.backend.tol) time_serie._TimeSerie__computed = True a_or = time_serie.compute_A() - assert status, f"some powerflow diverge for Time Series for {case_name}: {computer.nb_solved()} " + assert status or computer.nb_solver() == nb_step_pp, f"some powerflow diverge for Time Series for {case_name}: {computer.nb_solved()} " if VERBOSE: # print detailed results if needed @@ -403,7 +403,32 @@ def run_grid2op_env(env_lightsim, case, reset_solver, print_configuration() print(f"Solver used for linear algebra: {linear_solver_used_str}") print() - + + print("TL;DR") + tab_tldr = [] + for i, nm_ in enumerate(case_names_displayed): + tab_tldr.append((nm_, + ts_sizes[i], + 1000. * ls_gridmodel_time[i] / nb_step if ls_gridmodel_time[i] else None, + 1000. * ls_gridmodel_time_reset[i] / nb_step_reset if ls_gridmodel_time_reset[i] else None, + 1000. / ts_speeds[i] if ts_speeds[i] else None, + 1000. / sa_speeds[i] if sa_speeds[i] else None, + )) + if TABULATE_AVAIL: + res_use_with_grid2op_2 = tabulate(tab_tldr, + headers=["grid", + "size (nb bus)", + "time (recycling)", + "time (no recycling)", + "time (`TimeSerie`)", + "time (`ContingencyAnalysis`)", + ], + tablefmt="rst") + print(res_use_with_grid2op_2) + else: + print(tab_tldr) + print() + print("Results using grid2op.steps (288 consecutive steps, only measuring 'dc pf [init] + ac pf') (no recycling allowed, non default)") tab_g2op = [] for i, nm_ in enumerate(case_names_displayed): @@ -417,7 +442,7 @@ def run_grid2op_env(env_lightsim, case, reset_solver, )) if TABULATE_AVAIL: res_use_with_grid2op_2 = tabulate(tab_g2op, - headers=["grid", + headers=["grid name", "size (nb bus)", "avg step duration (ms)", "time [DC + AC] (ms / pf)", @@ -450,8 +475,8 @@ def run_grid2op_env(env_lightsim, case, reset_solver, "avg step duration (ms)", "time [DC + AC] (ms / pf)", "speed (pf / s)", - "time in 'gridmodel' (ms / pf)", - "time in 'pf algo' (ms / pf)", + "time in 'solver' (ms / pf)", + "time in 'algo' (ms / pf)", ], tablefmt="rst") print(res_use_with_grid2op_2) diff --git a/docs/benchmarks_grid_sizes.rst b/docs/benchmarks_grid_sizes.rst index 0210899..8ab9d83 100644 --- a/docs/benchmarks_grid_sizes.rst +++ b/docs/benchmarks_grid_sizes.rst @@ -15,22 +15,23 @@ TL;DR In summary, lightsim2grid (when using KLU linear solver) perfomances are: -================ =============== =================== ===================== ===================== ================================ -grid name size (nb bus) time (recycling) time (no recycling) time (`TimeSerie`) time (`ContingencyAnalysis`) -================ =============== =================== ===================== ===================== ================================ -case14 14 0.0303807 0.0688201 0.00972245 0.0344761 -case118 118 0.167014 0.383771 0.0651537 0.0940448 -case_illinois200 200 0.366178 0.747475 0.152984 0.251852 -case300 300 0.592916 1.21181 0.379875 0.467905 -case1354pegase 1354 3.13735 5.17859 1.58152 2.01299 -case1888rte 1888 4.78187 7.58089 2.08743 2.72081 -case2848rte 2848 7.49326 12.0294 3.22694 4.19178 -case2869pegase 2869 7.06508 12.0486 3.64617 4.62894 -case3120sp 3120 8.54887 13.4784 3.04654 4.64494 -case6495rte 6495 26.4778 37.8204 10.9002 12.5037 -case6515rte 6515 29.8737 42.66 11.38 12.9684 -case9241pegase 9241 36.0544 55.4857 16.6537 20.0572 -================ =============== =================== ===================== ===================== ================================ +================ =============== ================== ===================== ==================== ============================== +grid size (nb bus) time (recycling) time (no recycling) time (`TimeSerie`) time (`ContingencyAnalysis`) +================ =============== ================== ===================== ==================== ============================== +case14 14 0.0130073 0.0343035 0.00457648 0.00986142 +case118 118 0.0727236 0.209858 0.031906 0.0466558 +case_illinois200 200 0.151148 0.363769 0.0633617 0.102013 +case300 300 0.264309 0.59775 0.129651 0.174466 +case1354pegase 1354 1.50257 2.7327 0.826231 1.05762 +case1888rte 1888 2.37322 3.92464 1.06475 1.37497 +case2848rte 2848 3.7093 6.13028 1.62492 2.19232 +case2869pegase 2869 3.6351 6.42046 1.92647 2.3468 +case3120sp 3120 4.13678 6.85112 1.52145 2.32498 +case6495rte 6495 11.4654 17.3329 4.96104 5.75883 +case6515rte 6515 13.1227 18.832 4.77071 5.86091 +case9241pegase 9241 16.9394 27.053 8.11946 9.34644 +================ =============== ================== ===================== ==================== ============================== + All timings reported above are in milliseconds (ms) for one powerflow (in all cases lots of powerflow are carried out, up to a thousands and the timings here are averaged accross all the powerflows performed) @@ -64,16 +65,16 @@ counting 9241 buses). All of them has been run on a computer with a the following characteristics: -- date: 2024-10-18 09:35 CEST -- system: Linux 5.15.0-56-generic -- OS: ubuntu 20.04 -- processor: Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz -- python version: 3.12.4.final.0 (64 bit) +- date: 2025-01-09 11:59 CET +- system: Linux 6.5.0-1024-oem +- OS: ubuntu 22.04 +- processor: 13th Gen Intel(R) Core(TM) i7-13700H +- python version: 3.9.21.final.0 (64 bit) - numpy version: 1.26.4 - pandas version: 2.2.3 - pandapower version: 2.14.10 - grid2op version: 1.10.5 -- lightsim2grid version: 0.9.2 +- lightsim2grid version: 0.10.0 - lightsim2grid extra information: - klu_solver_available: True @@ -82,6 +83,7 @@ All of them has been run on a computer with a the following characteristics: - compiled_march_native: True - compiled_o3_optim: True + Solver used for linear algebra: NR single (KLU) @@ -156,41 +158,42 @@ the other. Results using grid2op.steps (288 consecutive steps, only measuring 'dc pf [init] + ac pf') (recyling allowed, default) -================ =============== ======================== ========================== ================ =============================== ============================= +================ =============== ======================== ========================== ================ ============================ ========================== grid size (nb bus) avg step duration (ms) time [DC + AC] (ms / pf) speed (pf / s) time in 'solver' (ms / pf) time in 'algo' (ms / pf) -================ =============== ======================== ========================== ================ =============================== ============================= -case14 14 0.758799 0.0597669 16731.7 0.0303807 0.0250171 -case118 118 0.913219 0.211025 4738.78 0.167014 0.149728 -case_illinois200 200 1.18555 0.424583 2355.25 0.366178 0.340139 -case300 300 1.44624 0.661998 1510.58 0.592916 0.557392 -case1354pegase 1354 5.26387 3.37046 296.695 3.13735 2.9635 -case1888rte 1888 6.32057 5.04453 198.234 4.78187 4.58628 -case2848rte 2848 9.52315 7.88586 126.809 7.49326 7.19927 -case2869pegase 2869 10.428 7.51632 133.044 7.06508 6.70432 -case3120sp 3120 10.6149 9.01426 110.935 8.54887 8.24586 -case6495rte 6495 30.5814 27.5533 36.2933 26.4778 25.6759 -case6515rte 6515 34.0398 30.9591 32.3007 29.8737 29.0781 -case9241pegase 9241 46.1182 37.7921 26.4606 36.0544 34.7085 -================ =============== ======================== ========================== ================ =============================== ============================= +================ =============== ======================== ========================== ================ ============================ ========================== +case14 14 0.350895 0.0245781 40686.6 0.0130073 0.0105687 +case118 118 0.438527 0.0921714 10849.4 0.0727236 0.0640808 +case_illinois200 200 0.531842 0.177022 5649 0.151148 0.139818 +case300 300 0.692534 0.298294 3352.4 0.264309 0.247054 +case1354pegase 1354 2.54428 1.61281 620.037 1.50257 1.42742 +case1888rte 1888 3.1374 2.50807 398.713 2.37322 2.27984 +case2848rte 2848 4.66414 3.90836 255.862 3.7093 3.56542 +case2869pegase 2869 5.45635 3.87341 258.171 3.6351 3.4594 +case3120sp 3120 5.16431 4.37043 228.81 4.13678 3.99066 +case6495rte 6495 13.3672 11.9835 83.4479 11.4654 11.1138 +case6515rte 6515 15.0186 13.6416 73.305 13.1227 12.7565 +case9241pegase 9241 22.7308 17.9356 55.755 16.9394 16.294 +================ =============== ======================== ========================== ================ ============================ ========================== + Results using grid2op.steps (288 consecutive steps, only measuring 'dc pf [init] + ac pf') (**no recycling allowed**, non default) -================ =============== ======================== ========================== ================ =============================== ============================= -grid size (nb bus) avg step duration (ms) time [DC + AC] (ms / pf) speed (pf / s) time in 'solver' (ms / pf) time in 'algo' (ms / pf) -================ =============== ======================== ========================== ================ =============================== ============================= -case14 14 0.777772 0.119986 8334.27 0.0688201 0.0567457 -case118 118 1.26015 0.531649 1880.94 0.383771 0.343062 -case_illinois200 200 1.77514 0.961583 1039.95 0.747475 0.688786 -case300 300 2.39949 1.52385 656.232 1.21181 1.12254 -case1354pegase 1354 8.08618 6.32786 158.031 5.17859 4.75853 -case1888rte 1888 10.3294 9.00365 111.066 7.58089 7.0991 -case2848rte 2848 16.0491 14.2892 69.9832 12.0294 11.2664 -case2869pegase 2869 17.6752 14.6977 68.0376 12.0486 11.0712 -case3120sp 3120 17.6044 15.9006 62.8906 13.4784 12.7485 -case6495rte 6495 46.697 43.6531 22.9079 37.8204 35.8113 -case6515rte 6515 51.8558 48.7368 20.5184 42.66 40.588 -case9241pegase 9241 74.1648 65.6422 15.2341 55.4857 51.7239 -================ =============== ======================== ========================== ================ =============================== ============================= +================ =============== ======================== ========================== ================ ============================ ========================== +grid name size (nb bus) avg step duration (ms) time [DC + AC] (ms / pf) speed (pf / s) time in 'solver' (ms / pf) time in 'algo' (ms / pf) +================ =============== ======================== ========================== ================ ============================ ========================== +case14 14 0.394679 0.0589122 16974.4 0.0343035 0.028186 +case118 118 0.66635 0.292747 3415.92 0.209858 0.187849 +case_illinois200 200 0.851082 0.476794 2097.34 0.363769 0.336049 +case300 300 1.17444 0.764839 1307.46 0.59775 0.554902 +case1354pegase 1354 4.3213 3.37901 295.945 2.7327 2.52633 +case1888rte 1888 5.38228 4.7376 211.077 3.92464 3.68506 +case2848rte 2848 8.18769 7.40336 135.074 6.13028 5.75152 +case2869pegase 2869 9.52221 7.92512 126.181 6.42046 5.94842 +case3120sp 3120 9.07648 8.25089 121.199 6.85112 6.4863 +case6495rte 6495 21.8053 20.3641 49.1061 17.3329 16.4422 +case6515rte 6515 23.2821 21.8367 45.7945 18.832 17.9478 +case9241pegase 9241 37.3876 32.5509 30.7211 27.053 25.3161 +================ =============== ======================== ========================== ================ ============================ ========================== .. _bench_grid_size_ts: @@ -221,20 +224,21 @@ table in the previous benchmark. ================ =============== ================ ================ grid size (nb bus) time (ms / pf) speed (pf / s) ================ =============== ================ ================ -case14 14 0.00972245 102855 -case118 118 0.0651537 15348.3 -case_illinois200 200 0.152984 6536.64 -case300 300 0.379875 2632.45 -case1354pegase 1354 1.58152 632.305 -case1888rte 1888 2.08743 479.059 -case2848rte 2848 3.22694 309.891 -case2869pegase 2869 3.64617 274.26 -case3120sp 3120 3.04654 328.241 -case6495rte 6495 10.9002 91.7417 -case6515rte 6515 11.38 87.8737 -case9241pegase 9241 16.6537 60.0467 +case14 14 0.00457648 218508 +case118 118 0.031906 31342.1 +case_illinois200 200 0.0633617 15782.4 +case300 300 0.129651 7713.03 +case1354pegase 1354 0.826231 1210.32 +case1888rte 1888 1.06475 939.19 +case2848rte 2848 1.62492 615.415 +case2869pegase 2869 1.92647 519.085 +case3120sp 3120 1.52145 657.267 +case6495rte 6495 4.96104 201.571 +case6515rte 6515 4.77071 209.613 +case9241pegase 9241 8.11946 123.161 ================ =============== ================ ================ + .. _bench_grid_size_ca: Computation time using the lightsim2grid `ContingencyAnalysis` module @@ -258,17 +262,18 @@ only 1000). ================ =============== =================== =================== grid size (nb bus) time (ms / cont.) speed (cont. / s) ================ =============== =================== =================== -case14 14 0.0344761 29005.6 -case118 118 0.0940448 10633.2 -case_illinois200 200 0.251852 3970.58 -case300 300 0.467905 2137.18 -case1354pegase 1354 2.01299 496.774 -case1888rte 1888 2.72081 367.537 -case2848rte 2848 4.19178 238.562 -case2869pegase 2869 4.62894 216.032 -case3120sp 3120 4.64494 215.288 -case6495rte 6495 12.5037 79.9763 -case6515rte 6515 12.9684 77.1104 -case9241pegase 9241 20.0572 49.8575 +case14 14 0.00986142 101405 +case118 118 0.0466558 21433.6 +case_illinois200 200 0.102013 9802.67 +case300 300 0.174466 5731.77 +case1354pegase 1354 1.05762 945.523 +case1888rte 1888 1.37497 727.287 +case2848rte 2848 2.19232 456.137 +case2869pegase 2869 2.3468 426.112 +case3120sp 3120 2.32498 430.111 +case6495rte 6495 5.75883 173.646 +case6515rte 6515 5.86091 170.622 +case9241pegase 9241 9.34644 106.993 ================ =============== =================== =================== + diff --git a/docs/conf.py b/docs/conf.py index 512eedd..7265e23 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,7 +22,7 @@ author = 'Benjamin DONNOT' # The full version, including alpha/beta/rc tags -release = "0.10.0" +release = "0.10.1" version = '0.10' # -- General configuration --------------------------------------------------- diff --git a/lightsim2grid/__init__.py b/lightsim2grid/__init__.py index f5c5ccd..98497a9 100644 --- a/lightsim2grid/__init__.py +++ b/lightsim2grid/__init__.py @@ -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.10.0" +__version__ = "0.10.1" __all__ = ["newtonpf", "SolverType", "ErrorType", "solver", "compilation_options"] diff --git a/setup.py b/setup.py index 2cff340..0fa3af4 100644 --- a/setup.py +++ b/setup.py @@ -322,7 +322,8 @@ "pip", "pybind11", "scipy", - "numpy" + "numpy", + "packaging", # "pandapower" if sys.version_info < (3, 10) else "pandapower>=2.8", # "pytest", # for pandapower see https://github.com/e2nIEE/pandapower/issues/1988 ] @@ -363,7 +364,6 @@ "grid2op>=1.6.4", "numba", "pandapower>=2.14.0", # interface changed for pandapower, not backward compatible - "packaging", "pypowsybl" ] }