Skip to content

Commit

Permalink
Merge pull request #94 from Grid2op/bd-dev
Browse files Browse the repository at this point in the history
hotfix for grid initialized from pypowsybl
  • Loading branch information
BDonnot authored Nov 28, 2024
2 parents 535a65b + 40cd64a commit 7e3172e
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 17 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:

cont:
- {
name: manylinux2014_x86_64,
val: quay.io/pypa/manylinux2014_x86_64,
name: manylinux_2_28_x86_64,
val: quay.io/pypa/manylinux_2_28_x86_64,
arch: amd64
}
# - {
Expand All @@ -63,6 +63,7 @@ jobs:
container:
image: ${{matrix.cont.val}}
# does not work if not manylinux2014_x86_64...
# does not work if not manylinux_2_28_x86_64...

steps:
# - name: Set up QEMU
Expand All @@ -72,7 +73,7 @@ jobs:
# platforms: arm64

- name: Checkout sources
uses: actions/checkout@v1
uses: actions/checkout@v4
with:
submodules: true

Expand Down Expand Up @@ -145,7 +146,7 @@ jobs:
python3 -m pip freeze
- name: Check extra can be imported can be imported (with grid2op)
run:
run: |
cd tmp_for_import_checking
python3 -v -c "from lightsim2grid import LightSimBackend"
python3 -c "from lightsim2grid.timeSerie import TimeSerie"
Expand All @@ -155,18 +156,18 @@ jobs:
python3 -c "from lightsim2grid.gridmodel import init_from_pandapower"
- name: Check LightSimBackend can be used to create env
run:
run: |
cd tmp_for_import_checking
python3 -v -c "from lightsim2grid import LightSimBackend; import grid2op; env = grid2op.make('l2rpn_case14_sandbox', test=True, backend=LightSimBackend())"
- name: Upload wheel
uses: actions/upload-artifact@v3 # v4 broken
uses: actions/upload-artifact@v4 # v4 broken
with:
name: lightsim2grid-wheel-linux-${{ matrix.python.name }}-${{ matrix.cont.name }}
path: wheelhouse/*.whl

- name: Upload source archive
uses: actions/upload-artifact@v3 # v4 broken
uses: actions/upload-artifact@v4 # v4 broken
if: matrix.python.name == 'cp311'
with:
name: lightsim2grid-sources
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ 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.post1] 2024-11-28
--------------------------
- [FIXED] There is still a bug with the pypowsybl 1.8.1 version with the
tap changer ratio (unconsistency between what needs to be done and the
actual documentation). The fix is to set the const variable `PP_BUG_RATIO_TAP_CHANGER`
to be at least 1.9.0, otherwise results are wrong.

[0.9.2] 2024-10-18
--------------------------
- [ADDED] support loading a grid when everything is NOT on the same bus
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/benchmark_grid_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"case9241pegase.json"
]

def make_grid2op_env(pp_case, casse_name, load_p, load_q, gen_p, sgen_p):
def make_grid2op_env(pp_case, case_name, load_p, load_q, gen_p, sgen_p):
param = Parameters.Parameters()
param.init_from_dict({"NO_OVERFLOW_DISCONNECTION": True})

Expand All @@ -75,7 +75,7 @@ def make_grid2op_env(pp_case, casse_name, load_p, load_q, gen_p, sgen_p):
return env_lightsim


def make_grid2op_env_pp(pp_case, casse_name, load_p, load_q, gen_p, sgen_p):
def make_grid2op_env_pp(pp_case, case_name, load_p, load_q, gen_p, sgen_p):
param = Parameters.Parameters()
param.init_from_dict({"NO_OVERFLOW_DISCONNECTION": True})

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"
release = "0.9.2.post1"
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"
__version__ = "0.9.2.post1"

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

Expand Down
2 changes: 1 addition & 1 deletion lightsim2grid/gridmodel/from_pypowsybl/_from_pypowsybl.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from typing import Optional, Union
from packaging import version

PP_BUG_RATIO_TAP_CHANGER = version.parse("1.7.0")
PP_BUG_RATIO_TAP_CHANGER = version.parse("1.9.0")
PYPOWSYBL_VER = version.parse(pypo.__version__)
from lightsim2grid_cpp import GridModel

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"
__version__ = "0.9.2.post1"
KLU_SOLVER_AVAILABLE = False

# Try to link against SuiteSparse (if available)
Expand Down
8 changes: 4 additions & 4 deletions src/powerflow_algorithm/BaseAlgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ void BaseAlgo::reset(){


RealVect BaseAlgo::_evaluate_Fx(const Eigen::SparseMatrix<cplx_type> & Ybus,
const CplxVect & V,
const CplxVect & Sbus,
const Eigen::VectorXi & pv,
const Eigen::VectorXi & pq)
const CplxVect & V,
const CplxVect & Sbus,
const Eigen::VectorXi & pv,
const Eigen::VectorXi & pq)
{
auto timer = CustTimer();
auto npv = pv.size();
Expand Down

0 comments on commit 7e3172e

Please sign in to comment.