Skip to content

Commit 39ae306

Browse files
authored
Merge pull request #116 from Grid2op/dev-switches
Upgrade to version 0.11.0
2 parents 3ef8e56 + 632f13f commit 39ae306

File tree

69 files changed

+4013
-1734
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+4013
-1734
lines changed

.circleci/config.yml

Lines changed: 220 additions & 40 deletions
Large diffs are not rendered by default.

.github/workflows/main.yml

Lines changed: 66 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ jobs:
1111
manylinux_build:
1212
# build wheels for some linux
1313
name: Build linux ${{ matrix.python.name }} wheel on ${{ matrix.cont.name}}
14-
runs-on: ubuntu-latest
14+
runs-on: ${{matrix.cont.runner}}
1515
env:
1616
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
1717
strategy:
1818
matrix:
1919
python:
20-
- {
21-
name: cp37,
22-
abi: cp37m,
23-
version: '3.7',
24-
}
20+
# - {
21+
# name: cp37,
22+
# abi: cp37m,
23+
# version: '3.7',
24+
# }
2525
- {
2626
name: cp38,
2727
abi: cp38,
@@ -52,17 +52,24 @@ jobs:
5252
abi: cp313,
5353
version: '3.13',
5454
}
55+
- {
56+
name: cp314,
57+
abi: cp314,
58+
version: '3.14',
59+
}
5560

5661
cont:
5762
- {
5863
name: manylinux_2_28_x86_64,
5964
val: quay.io/pypa/manylinux_2_28_x86_64,
60-
arch: amd64
65+
arch: amd64,
66+
runner: ubuntu-latest
6167
}
6268
# - {
63-
# name: manylinux2014_aarch64,
64-
# val: quay.io/pypa/manylinux2014_aarch64,
65-
# arch: arm64
69+
# name: manylinux_2_28_aarch64,
70+
# val: quay.io/pypa/manylinux_2_28_aarch64,
71+
# arch: arm64,
72+
# runner: ubuntu-24.04-arm
6673
# }
6774

6875
container:
@@ -72,7 +79,7 @@ jobs:
7279

7380
steps:
7481
# - name: Set up QEMU
75-
# if: matrix.cont.name == 'manylinux2014_aarch64'
82+
# if: matrix.cont.name == 'manylinux_2_28_aarch64'
7683
# uses: docker/setup-qemu-action@v2
7784
# with:
7885
# platforms: arm64
@@ -148,7 +155,7 @@ jobs:
148155
- name: Install grid2op
149156
if: matrix.python.name != 'cp313' # pandapower does not support 3.13, so grid2op does not so I cannot test that for 3.13
150157
run: |
151-
python3 -m pip install grid2op pandapower
158+
python3 -m pip install grid2op pandapower lxml # lxml missing import see https://github.com/e2nIEE/pandapower/issues/2752
152159
python3 -m pip freeze
153160
154161
- name: Check extra can be imported can be imported (with grid2op)
@@ -184,14 +191,14 @@ jobs:
184191
windows_build:
185192
# build wheels for windows
186193
name: Build windows ${{ matrix.python.name }} wheel for ${{ matrix.win_arch.msvc}}
187-
runs-on: windows-2019
194+
runs-on: windows-2022
188195
strategy:
189196
matrix:
190197
python:
191-
- {
192-
name: cp37,
193-
version: '3.7',
194-
}
198+
# - {
199+
# name: cp37,
200+
# version: '3.7',
201+
# }
195202
- {
196203
name: cp38,
197204
version: '3.8',
@@ -216,6 +223,10 @@ jobs:
216223
name: cp313,
217224
version: '3.13',
218225
}
226+
- {
227+
name: cp314,
228+
version: '3.14',
229+
}
219230
win_arch:
220231
- {
221232
name: "AMD64",
@@ -226,7 +237,7 @@ jobs:
226237
# msvc: x86
227238
# }
228239
env:
229-
RUNNER_OS: windows-2019
240+
RUNNER_OS: windows-2022
230241
PYTHON_VERSION: ${{ matrix.python.version }}
231242

232243
steps:
@@ -302,7 +313,7 @@ jobs:
302313
- name: Check LightSimBackend can be imported (with grid2op)
303314
if: matrix.python.name != 'cp313' # pandapower does not support 3.13, so grid2op does not so I cannot test that for 3.13
304315
run: |
305-
python -m pip install grid2op
316+
python -m pip install grid2op lxml # lxml missing import see https://github.com/e2nIEE/pandapower/issues/2752
306317
cd tmp_for_import_checking
307318
python -c "from lightsim2grid import LightSimBackend"
308319
python -c "from lightsim2grid import LightSimBackend; import grid2op; env = grid2op.make('l2rpn_case14_sandbox', test=True, backend=LightSimBackend())"
@@ -335,10 +346,10 @@ jobs:
335346
strategy:
336347
matrix:
337348
python:
338-
- {
339-
name: cp37,
340-
version: '3.7',
341-
}
349+
# - {
350+
# name: cp37,
351+
# version: '3.7',
352+
# }
342353
- {
343354
name: cp38,
344355
version: '3.8',
@@ -363,9 +374,13 @@ jobs:
363374
name: cp313,
364375
version: '3.13',
365376
}
377+
- {
378+
name: cp314,
379+
version: '3.14',
380+
}
366381
runner:
367382
- {
368-
name: macos-13,
383+
name: macos-15-intel,
369384
arch: x86_64
370385
}
371386
- {
@@ -440,10 +455,9 @@ jobs:
440455
python3 -c "from lightsim2grid.securityAnalysis import SecurityAnalysisCPP"
441456
python3 -c "from lightsim2grid.gridmodel import GridModel"
442457
443-
- name: Check package can be imported (bare install, numpy < 2)
444-
if: matrix.python.name != 'cp37' && matrix.python.name != 'cp38' && matrix.python.name != 'cp313'
458+
- name: Check package can be imported (bare install)
459+
if: matrix.python.name != 'cp37' && matrix.python.name != 'cp38'
445460
run: |
446-
python3 -m pip install "numpy<2"
447461
cd tmp_for_import_checking
448462
python3 -c "import lightsim2grid"
449463
python3 -c "from lightsim2grid import *"
@@ -460,13 +474,17 @@ jobs:
460474
# otherwise urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips 26 Jan 2017'
461475

462476
- name: Install grid2op
463-
if: matrix.python.name != 'cp313' # pandapower does not support 3.13, so grid2op does not so I cannot test that for 3.13
477+
if: matrix.python.name != 'cp314' || matrix.runner.arch != 'x86_64'
478+
# grid2op does not work on darwin cp34 wheel on macos on x86_64
479+
# probably because of pandapower
464480
run: |
465-
python -m pip install grid2op
481+
python -m pip install grid2op lxml # lxml missing import see https://github.com/e2nIEE/pandapower/issues/2752
466482
python -m pip freeze
467483
468484
- name: Check extra can be imported can be imported (with grid2op)
469-
if: matrix.python.name != 'cp313' # pandapower does not support 3.13, so grid2op does not so I cannot test that for 3.13
485+
if: matrix.python.name != 'cp314' || matrix.runner.arch != 'x86_64'
486+
# grid2op does not work on darwin cp34 wheel on macos on x86_64
487+
# probably because of pandapower
470488
run: |
471489
cd tmp_for_import_checking
472490
python -v -c "from lightsim2grid import LightSimBackend"
@@ -477,7 +495,9 @@ jobs:
477495
python -c "from lightsim2grid.gridmodel import init_from_pandapower"
478496
479497
- name: Check LightSimBackend can be used to create env
480-
if: matrix.python.name != 'cp313' # pandapower does not support 3.13, so grid2op does not so I cannot test that for 3.13
498+
if: matrix.python.name != 'cp314' || matrix.runner.arch != 'x86_64'
499+
# grid2op does not work on darwin cp34 wheel on macos on x86_64
500+
# probably because of pandapower
481501
run: |
482502
cd tmp_for_import_checking
483503
python -v -c "from lightsim2grid import LightSimBackend; import grid2op; env = grid2op.make('l2rpn_case14_sandbox', test=True, backend=LightSimBackend())"
@@ -502,7 +522,7 @@ jobs:
502522
cibuildwheel: macos
503523
}
504524
- {
505-
name: windows-2019, # host on x86_64
525+
name: windows-2022, # host on x86_64
506526
whl_nm: windows_arm64,
507527
cibuildwheel: windows
508528
}
@@ -536,6 +556,10 @@ jobs:
536556
name: cp313,
537557
version: '3.13',
538558
}
559+
- {
560+
name: cp314,
561+
version: '3.14',
562+
}
539563
exclude:
540564
- python:
541565
name: cp310 # because already done natively above
@@ -553,10 +577,14 @@ jobs:
553577
name: cp313 # because already done natively above
554578
runner:
555579
name: macos-14
580+
- python:
581+
name: cp314 # because already done natively above
582+
runner:
583+
name: macos-14
556584
- python:
557585
name: cp38 # does not work
558586
runner:
559-
name: windows-2019
587+
name: windows-2022
560588
env:
561589
RUNNER_OS: ${{ matrix.runner.name }}
562590
PYTHON_VERSION: ${{ matrix.python.version }}
@@ -569,12 +597,12 @@ jobs:
569597

570598
- name: Set up QEMU
571599
if: runner.os == 'Linux'
572-
uses: docker/setup-qemu-action@v3
600+
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
573601
with:
574602
platforms: all
575603

576604
- name: Compile with cibuildwheel
577-
uses: pypa/cibuildwheel@v2.22.0
605+
uses: pypa/cibuildwheel@63fd63b352a9a8bdcc24791c9dbee952ee9a8abc # v3.3.0
578606
env:
579607
CIBW_PLATFORM: "${{ matrix.runner.cibuildwheel}}"
580608
CIBW_BUILD: "${{ matrix.python.name}}-*"
@@ -583,7 +611,7 @@ jobs:
583611
CIBW_ARCHS_WINDOWS: ARM64
584612
CIBW_ENVIRONMENT: __O3_OPTIM=1
585613
CIBW_BEFORE_ALL: python -m pip install --upgrade setuptools wheel pybind11 pip && python -m pip install "numpy>=2; python_version >= '3.9'" "numpy; python_version < '3.9'"
586-
CIBW_BEFORE_BUILD_MACOS: make clean && make CC=clang CXX=clang++ # no need to cross compile this because host is already arm64 based
614+
CIBW_BEFORE_BUILD_MACOS: make clean && CC=clang CXX=clang++ make # no need to cross compile this because host is already arm64 based
587615
CIBW_BEFORE_BUILD_LINUX: make clean && make # maybe we need to cross compile this (host x64) but maybe not (qemu) ?
588616
CIBW_BEFORE_BUILD_WINDOWS: >
589617
cd build_cmake &&
@@ -593,8 +621,8 @@ jobs:
593621
cmake -DCMAKE_INSTALL_PREFIX=..\built -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR_PLATFORM=arm64 .. &&
594622
cmake --build . --config Release &&
595623
cmake --install . --prefix ..\built
596-
CIBW_TEST_REQUIRES: grid2op pandapower "numpy<2"
597-
CIBW_TEST_SKIP: "cp312-* *-macosx_arm64 *-win_arm64 cp313-*" # to silence warning "While arm64 wheels can be built on x86_64, they cannot be tested."
624+
CIBW_TEST_REQUIRES: grid2op pandapower
625+
CIBW_TEST_SKIP: "*-macosx_arm64 *-win_arm64" # to silence warning "While arm64 wheels can be built on x86_64, they cannot be tested."
598626
CIBW_TEST_COMMAND: >
599627
python -c "import lightsim2grid" &&
600628
python -c "from lightsim2grid import *" &&

CHANGELOG.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,29 @@ TODO: in `main.cpp` check the returned policy of pybind11 and also the `py::call
2929
TODO: a cpp class that is able to compute (DC powerflow) ContingencyAnalysis and TimeSeries using PTDF and LODF
3030
TODO: integration test with pandapower (see `pandapower/contingency/contingency.py` and import `lightsim2grid_installed` and check it's True)
3131

32+
[0.11.0] 2025-12-xx
33+
----------------------
34+
- [DEPRECATED] python 3.7 builds will no longer be available
35+
- [FIXED] a bug in the import of the grid from pypowsybl
36+
- [FIXED] a bug with phase shifters in case the tap was on the low voltage side
37+
- [FIXED] a bug with active shunt values (wrong sign in the cpp part) and wrong Ybus diagonal coeff
38+
- [FIXED] a bug in DC computation with shunt active values (wrong sign)
39+
- [FIXED] a bug in DC computation with some phase shifters (when tap was not tagged on correct side)
40+
- [FIXED] a bug in FDPF when phase tap changer was not on high voltage side
41+
- [FIXED] a lots of bug in the conversion of pypowsybl grid when using
42+
"old" pypowysbl versions.
43+
- [ADDED] compatibility with python 3.14 and python 3.14 build
44+
- [ADDED] compatibility with pandapower >= 3 version when loading a grid
45+
(pandapower changed the way it initilizes the transformers model parameters)
46+
- [ADDED] more kwargs arguments are possible in the LightSimBackend `loader_kwargs`
47+
- [ADDED] name of the substations are now read from the grid when initializing from
48+
pypowsybl.
49+
- [ADDED] support for multiple slack when reading a grid from pypowsybl.
50+
- [IMPROVED] the way to initialize the transformers from pypowsybl
51+
- [IMPROVED] possibility to load grid with phase shifters from pypowsybl
52+
- [IMPROVED] function to initialize the grid from pypowsybl has now a
53+
basic documentation.
54+
3255
[0.10.3] 2025-04-28
3356
----------------------
3457
- [FIXED] remove deprecated use of numpy<2 function in LightSimBackend

DISCLAIMER.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Open source options for powerflow analysis
3737
To get free of these limitations and be able to perform state of the art powerflow analysis,
3838
while still using open source softwares, we kindly recommend you to have a look at:
3939

40+
- [power-grid-model](https://github.com/PowerGridModel/power-grid-model) which is an "*open-source library for
41+
steady-state distribution power system analysis, distributed for Python and C*"
4042
- [Matpower](https://matpower.org/) which is a "*free, open-source tools for electric power system simulation and
4143
optimization*"
4244
- [Pandapower](https://www.pandapower.org/) that is "*An easy to use open source tool for power system modeling,

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,20 @@ see section [6.1 Customization of the compilation](#Customization-of-the-compila
8282

8383
Pypi packages are available for linux (`x86_64` cpu architecture), windows (`x86_64` cpu architecture) and macos (`x86_64` cpu architecture) with python versions:
8484

85-
- 3.7
85+
- 3.7 (lightsim2grid < 0.10.4)
8686
- 3.8
8787
- 3.9
8888
- 3.10 (lightsim2grid >= 0.6.1)
8989
- 3.11 (lightsim2grid >= 0.7.1)
9090
- 3.12 (lightsim2grid >= 0.7.5)
9191
- 3.13 (lightsim2grid >= 0.9.2.post2)
92+
- 3.14 (lightsim2grid >= 0.10.4)
9293

9394

9495
As from version 0.8.2, we also distribute windows `arm64` and macos `arm64` binaries of lightsim2grid that can be installed
95-
directly with pip too (requires python >= 3.8 for macos and python >= 3.9 for windows). We do not currently produce `arm64` (`aarch64`) linux binaries because it takes too long to build. If you really want them, let us know and we'll see what we can do.
96+
directly with pip too (requires python >= 3.8 for macos and python >= 3.9 for windows).
97+
98+
We do not currently produce `arm64` (`aarch64`) linux binaries because it takes too long to build. If you really want them, let us know and we'll see what we can do.
9699

97100

98101
**NB** on some version of MacOs (thanks Apple !), especially the one using M1 or M2 chip, lightsim2grid is only available

benchmarks/benchmark_solvers.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
try:
2727
from pypowsybl2grid import PyPowSyBlBackend
28-
pypow_error = None
28+
pypowbk_error = None
2929
except ImportError as exc_:
30-
pypow_error = exc_
30+
pypowbk_error = exc_
3131
print("Backend based on pypowsybl will not be benchmarked")
3232

3333
from grid2op.Parameters import Parameters
@@ -123,7 +123,7 @@ def main(max_ts,
123123
data_feeding_kwargs={"gridvalueClass": GridStateFromFile})
124124
env_lightsim = make(env_name_input, backend=LightSimBackend(), param=param, test=test,
125125
data_feeding_kwargs={"gridvalueClass": GridStateFromFile})
126-
if pypow_error is None:
126+
if pypowbk_error is None:
127127
env_pypow = make(env_name_input, param=param, test=test,
128128
backend=PyPowSyBlBackend(),
129129
data_feeding_kwargs={"gridvalueClass": GridStateFromFile})
@@ -144,7 +144,7 @@ def main(max_ts,
144144
grid_path=env_name_input,
145145
backend=PandaPowerBackend(lightsim2grid=True, with_numba=True)
146146
)
147-
if pypow_error is None:
147+
if pypowbk_error is None:
148148
env_pypow = make("blank", param=param, test=True,
149149
data_feeding_kwargs={"gridvalueClass": ChangeNothing},
150150
grid_path=env_name_input,
@@ -181,7 +181,7 @@ def main(max_ts,
181181
# for oldest grid2op version where this was not stored
182182
time_pp_ls_numba = env_pp_ls_numba._time_step
183183

184-
if pypow_error is None:
184+
if pypowbk_error is None:
185185
# also benchmark pypowsybl backend
186186
nb_ts_pypow, time_pypow, aor_pypow, gen_p_pypow, gen_q_pypow = run_env(env_pypow, max_ts, agent, chron_id=0, env_seed=0)
187187
pypow_comp_time = env_pypow.backend.comp_time
@@ -226,7 +226,7 @@ def main(max_ts,
226226

227227
# NOW PRINT THE RESULTS
228228
print("Configuration:")
229-
config_str = print_configuration(pypow_error)
229+
config_str = print_configuration(pypowbk_error)
230230
if save_results != DONT_SAVE:
231231
with open(save_results+"config_info.txt", "w", encoding="utf-8") as f:
232232
f.write(config_str)
@@ -246,7 +246,7 @@ def main(max_ts,
246246
tab.append(["PP (with lightsim)", f"{nb_ts_pp_ls_numba/time_pp_ls_numba:.2e}",
247247
f"{1000.*pp_ls_numba_time_pf/nb_ts_pp_ls_numba:.2e}",
248248
f"{1000.*pp_ls_numba_comp_time/nb_ts_pp_ls_numba:.2e}"])
249-
if pypow_error is None:
249+
if pypowbk_error is None:
250250
tab.append(["pypowsybl", f"{nb_ts_pypow/time_pypow:.2e}",
251251
f"{1000.*pypow_time_pf/nb_ts_pypow:.2e}",
252252
f"{1000.*pypow_comp_time/nb_ts_pypow:.2e}"])

0 commit comments

Comments
 (0)