From 2676c6227b9e0e480cbe05998f12f57d96ede994 Mon Sep 17 00:00:00 2001 From: DONNOT Benjamin Date: Tue, 2 Apr 2024 10:26:05 +0200 Subject: [PATCH] fixing some compilation warnings --- .circleci/config.yml | 11 ++ .github/workflows/main.yml | 2 +- CHANGELOG.rst | 3 +- ..._glop1.10.0.rst => ls0.8.1_glop1.10.1.rst} | 2 +- ..._glop1.10.0.rst => ls0.8.1_glop1.10.1.rst} | 2 +- ...py311.rst => ls0.8.1_glop1.10.1_py311.rst} | 2 +- .../ls0.8.1_glop1.10.1_py312.rst | 150 ++++++++++++++++++ docs/benchmarks.rst | 14 +- docs/conf.py | 2 +- lightsim2grid/__init__.py | 3 +- setup.py | 2 +- src/GridModel.cpp | 34 ++-- src/GridModel.h | 16 +- src/batch_algorithm/BaseBatchSolverSynch.h | 1 + src/element_container/GenericContainer.cpp | 40 ++--- src/element_container/GenericContainer.h | 28 ++++ src/main.cpp | 2 +- src/powerflow_algorithm/BaseNRAlgo.tpp | 4 +- .../BaseNRSingleSlackAlgo.tpp | 4 +- 19 files changed, 262 insertions(+), 60 deletions(-) rename docs/benchmark_solver/ubuntu_2004_dell/{ls0.8.1_glop1.10.0.rst => ls0.8.1_glop1.10.1.rst} (99%) rename docs/benchmark_solver/ubuntu_2004_server/{ls0.8.1_glop1.10.0.rst => ls0.8.1_glop1.10.1.rst} (99%) rename docs/benchmark_solver/ubuntu_2004_server/{ls0.8.1_glop1.10.0_py311.rst => ls0.8.1_glop1.10.1_py311.rst} (99%) create mode 100644 docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1_py312.rst diff --git a/.circleci/config.yml b/.circleci/config.yml index 8f6291b..6bd3179 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -199,6 +199,11 @@ jobs: make CC=gcc python setup.py build python -m pip install .[test] + - run: + name: "Show package versions" + command: | + source venv_test/bin/activate + pip freeze - run: name: "make tests" command: | @@ -380,6 +385,11 @@ jobs: make CC=clang python setup.py build CC=clang python -m pip install -e .[test] + - run: + name: "Show package versions" + command: | + source venv_test/bin/activate + pip freeze - run: name: "make tests" command: | @@ -418,6 +428,7 @@ jobs: git submodule update python setup.py build python -m pip install -e .[test] + pip freeze - run: name: "make tests" command: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a680952..f592faa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -222,7 +222,7 @@ jobs: - name: Upload wheel uses: actions/upload-artifact@v3 with: - name: lightsim2grid-wheel-win-${{ matrix.config.name }}-${{ matrix.python.name }} + name: lightsim2grid-wheel-win-${{ matrix.python.name }} path: dist/*.whl macos_build_37: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fe4bac4..a49e751 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -18,10 +18,11 @@ Change Log - maybe have a look at suitesparse "sliplu" tools ? - easier building (get rid of the "make" part) -[0.8.1] 2024-xx-yy +[0.8.2] 2024-xx-yy -------------------- - [FIXED] CI was broken after migration to artifact v4, set it back to v3 (and make the names of the folder clearer) +- [IMPROVED] remove some compilation warnings for clang [0.8.1] 2024-03-26 -------------------- diff --git a/docs/benchmark_solver/ubuntu_2004_dell/ls0.8.1_glop1.10.0.rst b/docs/benchmark_solver/ubuntu_2004_dell/ls0.8.1_glop1.10.1.rst similarity index 99% rename from docs/benchmark_solver/ubuntu_2004_dell/ls0.8.1_glop1.10.0.rst rename to docs/benchmark_solver/ubuntu_2004_dell/ls0.8.1_glop1.10.1.rst index e34afed..534484a 100644 --- a/docs/benchmark_solver/ubuntu_2004_dell/ls0.8.1_glop1.10.0.rst +++ b/docs/benchmark_solver/ubuntu_2004_dell/ls0.8.1_glop1.10.1.rst @@ -1,4 +1,4 @@ -Lightsim2grid 0.8.1 and grid2op 1.10.0 +Lightsim2grid 0.8.1 and grid2op 1.10.1 ====================================== l2rpn_case14_sandbox diff --git a/docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.0.rst b/docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1.rst similarity index 99% rename from docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.0.rst rename to docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1.rst index c1ac40b..9b6ed6d 100644 --- a/docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.0.rst +++ b/docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1.rst @@ -1,4 +1,4 @@ -Lightsim2grid 0.8.1 and grid2op 1.10.0 +Lightsim2grid 0.8.1 and grid2op 1.10.1 ====================================== l2rpn_case14_sandbox diff --git a/docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.0_py311.rst b/docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1_py311.rst similarity index 99% rename from docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.0_py311.rst rename to docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1_py311.rst index 4a85744..c2cee52 100644 --- a/docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.0_py311.rst +++ b/docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1_py311.rst @@ -1,4 +1,4 @@ -Lightsim2grid 0.8.1 and grid2op 1.10.0 (python 3.11) +Lightsim2grid 0.8.1 and grid2op 1.10.1 (python 3.11) ==================================================== l2rpn_case14_sandbox diff --git a/docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1_py312.rst b/docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1_py312.rst new file mode 100644 index 0000000..0753bdd --- /dev/null +++ b/docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1_py312.rst @@ -0,0 +1,150 @@ +Lightsim2grid 0.8.1 and grid2op 1.10.1 (python 3.12) +==================================================== + +l2rpn_case14_sandbox +--------------------- + +Configuration: + +- date: 2024-03-26 13:42 CET +- system: Linux 5.4.0-153-generic +- OS: ubuntu 20.04 +- processor: Intel(R) Core(TM) i7-5960X CPU @ 3.00GHz +- python version: 3.12.2.final.0 (64 bit) +- numpy version: 1.26.4 +- pandas version: 2.2.1 +- pandapower version: 2.13.1 +- grid2op version: 1.10.1 +- lightsim2grid version: 0.8.1 +- lightsim2grid extra information: + + - klu_solver_available: True + - nicslu_solver_available: True + - cktso_solver_available: True + - compiled_march_native: True + - compiled_o3_optim: True + +==================== ====================== =================================== ============================ +case14_sandbox grid2op speed (it/s) grid2op 'backend.runpf' time (ms) solver powerflow time (ms) +==================== ====================== =================================== ============================ +PP 31.3 28.9 16.8 +GS 716 0.502 0.393 +GS synch 696 0.522 0.41 +NR single (SLU) 912 0.196 0.0829 +NR (SLU) 911 0.197 0.084 +NR single (KLU) 971 0.133 0.023 +NR (KLU) 973 0.132 0.0213 +NR single (NICSLU *) 955 0.136 0.023 +NR (NICSLU *) 952 0.135 0.0213 +NR single (CKTSO *) 970 0.132 0.0216 +NR (CKTSO *) 975 0.13 0.0199 +FDPF XB (SLU) 961 0.145 0.0355 +FDPF BX (SLU) 949 0.158 0.0491 +FDPF XB (KLU) 968 0.137 0.0285 +FDPF BX (KLU) 957 0.15 0.0412 +FDPF XB (NICSLU *) 963 0.139 0.0295 +FDPF BX (NICSLU *) 943 0.154 0.0429 +FDPF XB (CKTSO *) 971 0.138 0.0291 +FDPF BX (CKTSO *) 956 0.151 0.0416 +==================== ====================== =================================== ============================ + + +Differences: + +============================ ============== ============== ================ +case14_sandbox (1000 iter) Δ aor (amps) Δ gen_p (MW) Δ gen_q (MVAr) +============================ ============== ============== ================ +PP (ref) 0 0 0 +GS 0.000122 7.63e-06 7.63e-06 +GS synch 0.000122 7.63e-06 7.63e-06 +NR single (SLU) 0.000122 7.63e-06 7.63e-06 +NR (SLU) 0.000122 7.63e-06 7.63e-06 +NR single (KLU) 0.000122 7.63e-06 7.63e-06 +NR (KLU) 0.000122 7.63e-06 7.63e-06 +NR single (NICSLU *) 0.000122 7.63e-06 7.63e-06 +NR (NICSLU *) 0.000122 7.63e-06 7.63e-06 +NR single (CKTSO *) 0.000122 7.63e-06 7.63e-06 +NR (CKTSO *) 0.000122 7.63e-06 7.63e-06 +FDPF XB (SLU) 0.000122 7.63e-06 7.63e-06 +FDPF BX (SLU) 0.000122 7.63e-06 7.63e-06 +FDPF XB (KLU) 0.000122 7.63e-06 7.63e-06 +FDPF BX (KLU) 0.000122 7.63e-06 7.63e-06 +FDPF XB (NICSLU *) 0.000122 7.63e-06 7.63e-06 +FDPF BX (NICSLU *) 0.000122 7.63e-06 7.63e-06 +FDPF XB (CKTSO *) 0.000122 7.63e-06 7.63e-06 +FDPF BX (CKTSO *) 0.000122 7.63e-06 7.63e-06 +============================ ============== ============== ================ + +l2rpn_neurips_2020_track2_small +--------------------------------- + +Configuration: + +- date: 2024-03-26 13:51 CET +- system: Linux 5.4.0-153-generic +- OS: ubuntu 20.04 +- processor: Intel(R) Core(TM) i7-5960X CPU @ 3.00GHz +- python version: 3.12.2.final.0 (64 bit) +- numpy version: 1.26.4 +- pandas version: 2.2.1 +- pandapower version: 2.13.1 +- grid2op version: 1.10.1 +- lightsim2grid version: 0.8.1 +- lightsim2grid extra information: + + - klu_solver_available: True + - nicslu_solver_available: True + - cktso_solver_available: True + - compiled_march_native: True + - compiled_o3_optim: True + +===================== ====================== =================================== ============================ +neurips_2020_track2 grid2op speed (it/s) grid2op 'backend.runpf' time (ms) solver powerflow time (ms) +===================== ====================== =================================== ============================ +PP 28.1 32.3 20.4 +GS 4.05 245 245 +GS synch 29.4 33 32.9 +NR single (SLU) 519 0.9 0.754 +NR (SLU) 518 0.917 0.771 +NR single (KLU) 763 0.293 0.151 +NR (KLU) 770 0.28 0.139 +NR single (NICSLU *) 777 0.279 0.139 +NR (NICSLU *) 774 0.27 0.127 +NR single (CKTSO *) 792 0.27 0.13 +NR (CKTSO *) 786 0.26 0.119 +FDPF XB (SLU) 700 0.406 0.268 +FDPF BX (SLU) 688 0.431 0.294 +FDPF XB (KLU) 725 0.36 0.223 +FDPF BX (KLU) 719 0.376 0.24 +FDPF XB (NICSLU *) 730 0.351 0.215 +FDPF BX (NICSLU *) 732 0.365 0.229 +FDPF XB (CKTSO *) 748 0.343 0.209 +FDPF BX (CKTSO *) 729 0.367 0.232 +===================== ====================== =================================== ============================ + +Differences: + +================================= ============== ============== ================ +neurips_2020_track2 (1000 iter) Δ aor (amps) Δ gen_p (MW) Δ gen_q (MVAr) +================================= ============== ============== ================ +PP (ref) 0 0 0 +GS 6.1e-05 3.81e-06 1.53e-05 +GS synch 6.1e-05 3.81e-06 1.53e-05 +NR single (SLU) 6.1e-05 0 9.54e-07 +NR (SLU) 6.1e-05 0 9.54e-07 +NR single (KLU) 6.1e-05 0 9.54e-07 +NR (KLU) 6.1e-05 0 9.54e-07 +NR single (NICSLU *) 6.1e-05 0 9.54e-07 +NR (NICSLU *) 6.1e-05 0 9.54e-07 +NR single (CKTSO *) 6.1e-05 0 9.54e-07 +NR (CKTSO *) 6.1e-05 0 9.54e-07 +FDPF XB (SLU) 6.1e-05 1.91e-06 1.53e-05 +FDPF BX (SLU) 6.1e-05 1.91e-06 7.63e-06 +FDPF XB (KLU) 6.1e-05 1.91e-06 1.53e-05 +FDPF BX (KLU) 6.1e-05 1.91e-06 7.63e-06 +FDPF XB (NICSLU *) 6.1e-05 1.91e-06 1.53e-05 +FDPF BX (NICSLU *) 6.1e-05 1.91e-06 7.63e-06 +FDPF XB (CKTSO *) 6.1e-05 1.91e-06 1.53e-05 +FDPF BX (CKTSO *) 6.1e-05 1.91e-06 7.63e-06 +================================= ============== ============== ================ + diff --git a/docs/benchmarks.rst b/docs/benchmarks.rst index 2304f25..6f489d0 100644 --- a/docs/benchmarks.rst +++ b/docs/benchmarks.rst @@ -315,7 +315,7 @@ The results can be found in: :maxdepth: 1 :caption: For a laptop with a i7 of 2015 wth a frequency of 2.70 GHz - benchmark_solver/ubuntu_2004_dell/ls0.8.1_glop1.10.0 + benchmark_solver/ubuntu_2004_dell/ls0.8.1_glop1.10.1 benchmark_solver/ubuntu_2004_dell/ls0.8.0_glop1.10.0 benchmark_solver/ubuntu_2004_dell/ls0.8.0_glop1.9.8 @@ -323,8 +323,16 @@ The results can be found in: :maxdepth: 1 :caption: For a laptop with a i7 of 2014 wth a frequency of 3.0 GHz - benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.0 - benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.0_py311 + benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1 + benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1_py311 + benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1_py312 + +.. note:: + Any contribution here is more than welcomed. You can write a github discussion here + https://github.com/BDonnot/lightsim2grid/discussions/new?category=show-and-tell + and describe rapidly your setup and we'll make sure to include your benchmark in future release. + + Thanks ! Benchmarks of other lightsim2grid functions -------------------------------------------- diff --git a/docs/conf.py b/docs/conf.py index 3e4db7b..8a1d91a 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.8.1" +release = "0.8.2.dev0" version = '0.8' # -- General configuration --------------------------------------------------- diff --git a/lightsim2grid/__init__.py b/lightsim2grid/__init__.py index 85ece59..d726658 100644 --- a/lightsim2grid/__init__.py +++ b/lightsim2grid/__init__.py @@ -5,7 +5,8 @@ # you can obtain one at http://mozilla.org/MPL/2.0/. # SPDX-License-Identifier: MPL-2.0 # This file is part of LightSim2grid, LightSim2grid implements a c++ backend targeting the Grid2Op platform. -__version__ = "0.8.1" + +__version__ = "0.8.2.dev0" __all__ = ["newtonpf", "SolverType", "ErrorType", "solver", "compilation_options"] diff --git a/setup.py b/setup.py index a8ca33b..95b86fa 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ from pybind11.setup_helpers import Pybind11Extension, build_ext -__version__ = "0.8.1" +__version__ = "0.8.2.dev0" KLU_SOLVER_AVAILABLE = False # Try to link against SuiteSparse (if available) diff --git a/src/GridModel.cpp b/src/GridModel.cpp index 1ca5fe0..6499c96 100644 --- a/src/GridModel.cpp +++ b/src/GridModel.cpp @@ -986,23 +986,23 @@ void GridModel::remove_gen_slackbus(int gen_id){ } /** GRID2OP SPECIFIC REPRESENTATION **/ -void GridModel::update_bus_status(int nb_bus_before, - Eigen::Ref > active_bus) -{ - for(int bus_id = 0; bus_id < active_bus.rows(); ++bus_id) - { - if(active_bus(bus_id, 0)){ - reactivate_bus(bus_id); - }else{ - deactivate_bus(bus_id); - } - if(active_bus(bus_id, 1)){ - reactivate_bus(bus_id + nb_bus_before); - }else{ - deactivate_bus(bus_id + nb_bus_before); - } - } -} +// void GridModel::update_bus_status(int nb_bus_before, +// Eigen::Ref > active_bus) +// { +// for(int bus_id = 0; bus_id < active_bus.rows(); ++bus_id) +// { +// if(active_bus(bus_id, 0)){ +// reactivate_bus(bus_id); +// }else{ +// deactivate_bus(bus_id); +// } +// if(active_bus(bus_id, 1)){ +// reactivate_bus(bus_id + nb_bus_before); +// }else{ +// deactivate_bus(bus_id + nb_bus_before); +// } +// } +// } void GridModel::update_gens_p(Eigen::Ref > has_changed, Eigen::Ref > new_values) diff --git a/src/GridModel.h b/src/GridModel.h index 2ffd4f3..e66aad8 100644 --- a/src/GridModel.h +++ b/src/GridModel.h @@ -558,10 +558,13 @@ class GridModel : public GenericContainer real_type get_computation_time() const{ return _solver.get_computation_time();} real_type get_dc_computation_time() const{ return _dc_solver.get_computation_time();} + // private: + // using GenericContainer::update_bus_status; // to silence clang warnings (overload-virtual) + // public: + // void update_bus_status(int nb_bus_before, + // Eigen::Ref > active_bus); // part dedicated to grid2op backend, optimized for grid2op data representation (for speed) // this is not recommended to use it outside of its intended usage within grid2op ! - void update_bus_status(int nb_bus_before, - Eigen::Ref > active_bus); void update_gens_p(Eigen::Ref > has_changed, Eigen::Ref > new_values); void update_sgens_p(Eigen::Ref > has_changed, @@ -659,10 +662,16 @@ class GridModel : public GenericContainer } //for FDPF + private: + using GenericContainer::fillBp_Bpp; // silence clang warning overload-virtual + public: void fillBp_Bpp(Eigen::SparseMatrix & Bp, Eigen::SparseMatrix & Bpp, FDPFMethod xb_or_bx) const; + private: + using GenericContainer::fillBf_for_PTDF; // silence clang warning overload-virtual + public: void fillBf_for_PTDF(Eigen::SparseMatrix & Bf, bool transpose=false) const; Eigen::SparseMatrix debug_get_Bp_python(FDPFMethod xb_or_bx){ @@ -714,6 +723,9 @@ class GridModel : public GenericContainer const Eigen::VectorXi & slack_bus_id_me, Eigen::VectorXi & slack_bus_id_solver ); + private: + using GenericContainer::fillYbus; // to silence the overload-virtual warning in clang + protected: void fillYbus(Eigen::SparseMatrix & res, bool ac, const std::vector& id_me_to_solver); void fillSbus_me(CplxVect & res, bool ac, const std::vector& id_me_to_solver); void fillpv_pq(const std::vector& id_me_to_solver, diff --git a/src/batch_algorithm/BaseBatchSolverSynch.h b/src/batch_algorithm/BaseBatchSolverSynch.h index 42c1ae5..7006ecc 100644 --- a/src/batch_algorithm/BaseBatchSolverSynch.h +++ b/src/batch_algorithm/BaseBatchSolverSynch.h @@ -53,6 +53,7 @@ class BaseBatchSolverSynch } BaseBatchSolverSynch(const BaseBatchSolverSynch&) = delete; + virtual ~BaseBatchSolverSynch() = default; // to avoid warning about overload virtual // solver "control" void change_solver(const SolverType & type){ diff --git a/src/element_container/GenericContainer.cpp b/src/element_container/GenericContainer.cpp index e7c7ccd..3ed8dc4 100644 --- a/src/element_container/GenericContainer.cpp +++ b/src/element_container/GenericContainer.cpp @@ -29,38 +29,25 @@ void GenericContainer::_get_amps(RealVect & a, const RealVect & p, const RealVec } void GenericContainer::_reactivate(int el_id, std::vector & status){ - bool val = status.at(el_id); - status.at(el_id) = true; //TODO why it's needed to do that again + _check_in_range(static_cast::size_type>(el_id), + status, + "_reactivate"); + status[el_id] = true; //TODO why it's needed to do that again } void GenericContainer::_deactivate(int el_id, std::vector & status){ - bool val = status.at(el_id); - status.at(el_id) = false; //TODO why it's needed to do that again + _check_in_range(static_cast::size_type>(el_id), + status, + "_deactivate"); + status[el_id] = false; } void GenericContainer::_change_bus(int el_id, int new_bus_me_id, Eigen::VectorXi & el_bus_ids, SolverControl & solver_control, int nb_bus){ // bus id here "me_id" and NOT "solver_id" // throw error: object id does not exist - if(el_id >= el_bus_ids.size()) - { - // TODO DEBUG MODE: only check in debug mode - std::ostringstream exc_; - exc_ << "GenericContainer::_change_bus: Cannot change the bus of element with id "; - exc_ << el_id; - exc_ << " while the grid counts "; - exc_ << el_bus_ids.size(); - exc_ << " such elements (id too high)"; - throw std::out_of_range(exc_.str()); - } - if(el_id < 0) - { - // TODO DEBUG MODE: only check in debug mode - std::ostringstream exc_; - exc_ << "GenericContainer::_change_bus: Cannot change the bus of element with id "; - exc_ << el_id; - exc_ << " (id should be >= 0)"; - throw std::out_of_range(exc_.str()); - } + _check_in_range(static_cast(el_id), + el_bus_ids, + "_change_bus"); // throw error: bus id does not exist if(new_bus_me_id >= nb_bus) @@ -98,8 +85,11 @@ void GenericContainer::_change_bus(int el_id, int new_bus_me_id, Eigen::VectorXi int GenericContainer::_get_bus(int el_id, const std::vector & status_, const Eigen::VectorXi & bus_id_) const { + _check_in_range(static_cast::size_type>(el_id), + status_, + "_get_bus"); int res; - bool val = status_.at(el_id); // also check if the el_id is out of bound + bool val = status_[el_id]; // also check if the el_id is out of bound if(!val) res = _deactivated_bus_id; else{ res = bus_id_(el_id); diff --git a/src/element_container/GenericContainer.h b/src/element_container/GenericContainer.h index 98050a0..cb59b61 100644 --- a/src/element_container/GenericContainer.h +++ b/src/element_container/GenericContainer.h @@ -116,6 +116,34 @@ class GenericContainer : public BaseConstants std::vector names_; protected: + template + // todo automatically "unwrap" IntType to be either cont::size_type for stl container and + // Eigen::Index for Eigen containers + void _check_in_range(IntType el_id, const Cont& cont, FunName fun_name="") const + { + // TODO debug mode: only in debug mode + if(el_id >= cont.size()) + { + // TODO DEBUG MODE: only check in debug mode + std::ostringstream exc_; + exc_ << "GenericContainer::"<= 0)"; + throw std::out_of_range(exc_.str()); + } + } + /** activation / deactivation of elements **/ diff --git a/src/main.cpp b/src/main.cpp index b8aac5b..9bd3b47 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -899,7 +899,7 @@ PYBIND11_MODULE(lightsim2grid_cpp, m) // apply action faster (optimized for grid2op representation) // it is not recommended to use it outside of grid2Op. - .def("update_bus_status", &GridModel::update_bus_status, DocGridModel::_internal_do_not_use.c_str()) + // .def("update_bus_status", &GridModel::update_bus_status, DocGridModel::_internal_do_not_use.c_str()) .def("update_gens_p", &GridModel::update_gens_p, DocGridModel::_internal_do_not_use.c_str()) .def("update_sgens_p", &GridModel::update_sgens_p, DocGridModel::_internal_do_not_use.c_str()) .def("update_gens_v", &GridModel::update_gens_v, DocGridModel::_internal_do_not_use.c_str()) diff --git a/src/powerflow_algorithm/BaseNRAlgo.tpp b/src/powerflow_algorithm/BaseNRAlgo.tpp index e889771..7cf118a 100644 --- a/src/powerflow_algorithm/BaseNRAlgo.tpp +++ b/src/powerflow_algorithm/BaseNRAlgo.tpp @@ -583,7 +583,7 @@ void BaseNRAlgo::fill_value_map( // row_map_ = std::vector (J_.nonZeros()); const auto n_row = J_.cols(); - unsigned int pos_el = 0; + // unsigned int pos_el = 0; for (Eigen::Index col_=1; col_ < n_row; ++col_){ // last column is never updated (slack equation) for (Eigen::SparseMatrix::InnerIterator it(J_, col_); it; ++it) { @@ -640,7 +640,7 @@ void BaseNRAlgo::fill_value_map( } } // go to the next element - ++pos_el; + // ++pos_el; } } dS_dVa_.makeCompressed(); diff --git a/src/powerflow_algorithm/BaseNRSingleSlackAlgo.tpp b/src/powerflow_algorithm/BaseNRSingleSlackAlgo.tpp index efd86b5..5749d83 100644 --- a/src/powerflow_algorithm/BaseNRSingleSlackAlgo.tpp +++ b/src/powerflow_algorithm/BaseNRSingleSlackAlgo.tpp @@ -393,7 +393,7 @@ void BaseNRSingleSlackAlgo::fill_value_map( BaseNRAlgo::value_map_.reserve(BaseNRAlgo::J_.nonZeros()); const int n_col = static_cast(BaseNRAlgo::J_.cols()); - unsigned int pos_el = 0; + // unsigned int pos_el = 0; for (int col_=0; col_ < n_col; ++col_){ for (Eigen::SparseMatrix::InnerIterator it(BaseNRAlgo::J_, col_); it; ++it) { @@ -437,7 +437,7 @@ void BaseNRSingleSlackAlgo::fill_value_map( } // go to the next element - ++pos_el; + // ++pos_el; } } // BaseNRAlgo::dS_dVa_.makeCompressed();