Skip to content

Commit

Permalink
Merge branch 'develop' into scalar
Browse files Browse the repository at this point in the history
  • Loading branch information
vogt31337 committed Aug 28, 2024
2 parents 27695ab + be0f2cf commit 15796a7
Show file tree
Hide file tree
Showing 65 changed files with 5,472 additions and 2,514 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/github_test_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12']
# Reminder: when removing the support of an old python version here, then don't forget to
# remove it also in pyproject.toml 'requires-python'
group: [ 1, 2 ]
Expand All @@ -37,7 +37,7 @@ jobs:
python -m pip install .["all"]
if ${{ matrix.python-version == '3.9' }}; then python -m pip install pypower; fi
if ${{ matrix.python-version != '3.9' }}; then python -m pip install numba; fi
if ${{ matrix.python-version == '3.8' || matrix.python-version == '3.10' }}; then python -m pip install lightsim2grid; fi
if ${{ matrix.python-version == '3.10' }}; then python -m pip install lightsim2grid; fi
- name: List of installed packages
run: |
python -m pip list
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12']
os: [ ubuntu-latest, windows-latest ]
group: [ 1, 2 ]

Expand All @@ -41,14 +41,14 @@ jobs:
run: |
if ( '${{ matrix.python-version }}' -eq '3.9' ) { python -m pip install pypower }
if ( '${{ matrix.python-version }}' -ne '3.9' ) { python -m pip install numba }
if ( '${{ matrix.python-version }}' -eq '3.8' -or '${{ matrix.python-version }}' -eq '3.10' ) { python -m pip install lightsim2grid }
if ( '${{ matrix.python-version }}' -eq '3.10' ) { python -m pip install lightsim2grid }
- name: Install specific dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
if ${{ matrix.python-version == '3.9' }}; then python -m pip install pypower; fi
if ${{ matrix.python-version != '3.9' }}; then python -m pip install numba; fi
if ${{ matrix.python-version == '3.8' || matrix.python-version == '3.10' }}; then python -m pip install lightsim2grid; fi
if ${{ matrix.python-version == '3.10' }}; then python -m pip install lightsim2grid; fi
# - name: Install Julia
# if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
Change Log
=============

[2.14.11] - 2024-07-08
-------------------------------
- [FIXED] Lightsim2grid version

[2.14.10] - 2024-07-08
-------------------------------
- [FIXED] geopandas version

[2.14.9] - 2024-06-25
-------------------------------
- [FIXED] scipy version

[upcoming release] - 2024-..-..
-------------------------------
- [FIXED] copy array element to standard python scalar
- [REMOVED] python 3.8 support
- [CHANGED] geopandas version to >= 1.0
- [ADDED] station controller functionality with voltage and reactive power control with and without droop and pf import support
- [ADDED] creating series capacitor added in pf to pp converter
- [FIXED] using loc to remove the warning
- [FIXED] replacing deprecated H and A from scipy.sparse.csc_matrix
Expand Down Expand Up @@ -42,9 +57,14 @@ Change Log
- [FIXED] error during unbalanced powerflow due to out of service external grids
- [FIXED] PowerFactory converter: fix trafo3w tap dependent impedance
- [ADDED] PowerFactory converter: support load types (constI, constZ) and the setting whether to consider voltage dependency of loads
- [CHANGED] considering trafo controller and improve implementation for other (bus element) controller at grid_equivalent creation
- [CHANGED] vectorization of y_bus reordering in _calculate_equivalent_Ybus() within get_equivalent()
- [FIXED] deprecation of matplotlib.cm.get_cmap(name) -> matplotlib.colormaps[name]
- [FIXED] merge_nets failing if net2 has custom DataFrame that is not present in net1
- [CHANGED] grid_equivalent creation: improved consideration of controller
- [CHANGED] create consistent parameter names (element and element_index) in controllers -> Changes for TrafoController: trafotable & trafotype -> element, tid -> element_index
- [CHANGED] parameter renaming in net.group: element -> element_index
- [CHANGED] in to_ppc(), the default of calculate_voltage_angles is True now (as in previously changed in runpp()).
- [FIXED] fixed some small bugs in the CGMES converter and improved its speed
- [CHANGED] trigger a numpy error in makeYbus, makeBbus, _wye_delta instead of warning
- [ADDED] transformer tap hunting detection for DiscreteTapControl
Expand All @@ -55,6 +75,7 @@ Change Log
- [ADDED] shunt components G and B for impedance elements, also supports unequal G and B parameters for from and to bus
- [ADDED] support for unequal leakage resistance and reactance for HV and LV sides of a 2W-transformer
- [ADDED] Add VSC element, dc buses, dc lines, and hybrid AC/DC power flow calculation
- [CHANGED] accelerate _integrate_power_elements_connected_with_switch_buses() in get_equivalent()

[2.14.7] - 2024-06-14
-------------------------------
Expand Down
3 changes: 2 additions & 1 deletion doc/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ Operation at the Fraunhofer Institute for Energy Economics and Energy System Tec
:maxdepth: 1

about/units
about/update
about/update30
about/update20
about/authors
about/changelog
about/license
Expand Down
74 changes: 37 additions & 37 deletions doc/about/update.rst → doc/about/update20.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

<br />

============================
============================
Update to pandapower 2.0
============================

Some fundamental changes were made to make pandapower more easy to use and consistent with other tools with the release of pandapower 2.0.
Some fundamental changes were made to make pandapower more easy to use and consistent with other tools with the release of pandapower 2.0.

Most of these changes go back to the fact that pandapower was originally developed only for power flow calculations in low and medium voltage networks, but is today also widely
used in transmission systems. The most significant changes are:
Expand All @@ -28,22 +28,22 @@ How to update saved networks

pandapower has a convert_format function that detects if an network that was saved to the hard drive with an older version of pandapower, and automatically corrects
the data names and values in the element tables. However, the older the network is and the more changes have been made to the data structure, the more difficult
it will be for the convert_format function to apply all necessary changes. Therefore, it is strongly advised to resave all networks when updating pandapower
it will be for the convert_format function to apply all necessary changes. Therefore, it is strongly advised to resave all networks when updating pandapower
(especially with a major update such as 2.0):


.. image:: /pics/convert_format.png
:align: center
:align: center



With pandapower 2.0, we also advice to save networks in the .json format. It is much more robust to updates of libraries (for example, a .p file created with pandas < 0.20 can
With pandapower 2.0, we also advice to save networks in the .json format. It is much more robust to updates of libraries (for example, a .p file created with pandas < 0.20 can
not be loaded with pandas 0.20 due to a change in the internal data structures. This is not an issue when saving the networks as .json files). So resave your pickle files as .json files such as ::

import pandapower as pp
net = pp.from_pickle("C:\\my_file.p")
pp.runpp(net)
pp.to_json(net, "C:\\my_file_2.0.json")


Transformer parameter naming
==============================
Expand All @@ -55,61 +55,61 @@ Two major changes have been made to transformer parameters:

The meaning or value of these parameters has not changed, so that the code can be updated by searching and replacing as follows:

- tp\_ -------> tap\_
- _st_ ------> _step_
- _mid -----> _neutral
- vsc ------> vk
- tp\_ tap\_
- _st_ _step_
- _mid _neutral
- vsc vk

Here is a full list of affected parameters:

+--------------------------+---------------------+------------------------+
| pandapower 1.x | pandapower 2.x | elements |
+==========================+=====================+========================+
| tp_side | tap_side | trafo, trafo3w |
| tp_side | tap_side | trafo, trafo3w |
+--------------------------+---------------------+------------------------+
| tp_mid | tap_neutral | trafo, trafo3w |
| tp_mid | tap_neutral | trafo, trafo3w |
+--------------------------+---------------------+------------------------+
| tp_min | tap_min | trafo, trafo3w |
| tp_min | tap_min | trafo, trafo3w |
+--------------------------+---------------------+------------------------+
| tp_max | tap_max | trafo, trafo3w |
+--------------------------+---------------------+------------------------+
| tp_pos | tap_pos | trafo, trafo3w |
| tp_pos | tap_pos | trafo, trafo3w |
+--------------------------+---------------------+------------------------+
| tp_st_percent | tap_step_percent | trafo, trafo3w |
| tp_st_percent | tap_step_percent | trafo, trafo3w |
+--------------------------+---------------------+------------------------+
| tp_st_degree | tap_step_degree | trafo, trafo3w |
| tp_st_degree | tap_step_degree | trafo, trafo3w |
+--------------------------+---------------------+------------------------+
| tp_phase_shifter | tap_phase_shifter | trafo, trafo3w |
| tp_phase_shifter | tap_phase_shifter | trafo, trafo3w |
+--------------------------+---------------------+------------------------+
| vsc_percent | vk_percent | trafo |
| vsc_percent | vk_percent | trafo |
+--------------------------+---------------------+------------------------+
| vscr_percent | vkr_percent | trafo |
| vscr_percent | vkr_percent | trafo |
+--------------------------+---------------------+------------------------+
| vsc_hv_percent | vk_hv_percent | trafo3w |
| vsc_hv_percent | vk_hv_percent | trafo3w |
+--------------------------+---------------------+------------------------+
| vscr_hv_percent | vkr_hv_percent | trafo3w |
| vscr_hv_percent | vkr_hv_percent | trafo3w |
+--------------------------+---------------------+------------------------+
| vsc_mv_percent | vk_mv_percent | trafo3w |
| vsc_mv_percent | vk_mv_percent | trafo3w |
+--------------------------+---------------------+------------------------+
| vscr_mv_percent | vkr_mv_percent | trafo3w |
| vscr_mv_percent | vkr_mv_percent | trafo3w |
+--------------------------+---------------------+------------------------+
| vsc_lv_percent | vk_lv_percent | trafo3w |
| vsc_lv_percent | vk_lv_percent | trafo3w |
+--------------------------+---------------------+------------------------+
| vscr_lv_percent | vkr_lv_percent | trafo3w |
| vscr_lv_percent | vkr_lv_percent | trafo3w |
+--------------------------+---------------------+------------------------+



MVA-based Units
==============================

The basic power unit has been changed from kVA to MVA to allow a more comfortable handling of transmission systems. This affects all three types of power units:

- active power: kw --> mw
- reactive power: kvar --> mvar
- apparent power: kva --> mva
All elements have to be defined with MVA-based units, and results are also given in these units.
- active power: kw mw
- reactive power: kvar mvar
- apparent power: kva mva

All elements have to be defined with MVA-based units, and results are also given in these units.
Since the units in pandapower are always hard coded in the column names, the access to the dataframes also has to be adapted:


Expand Down Expand Up @@ -139,7 +139,7 @@ a generator based signing system:
- net.gen
- net.sgen
- net.ext_grid

All other elements remain in the load-based signing system.
So for these three elements, in addition to the unit being changed from kW to MW, the sign for active and reactive power is also reversed:

Expand Down Expand Up @@ -184,12 +184,12 @@ the cost parameters can be directly specified as parameters instead of passing a
The definition of piecewise linear costs has also changed. In pandapower 1.x, the cost polyonmial is given as list of cost points: ::

[(p1, c1), (p2, c2), (p3, c3)]

The cost function is then interpolated between those points, and the costs are then defined by the slope of the curve between those points.
So for a generator with the cost function: ::

[(0, 0), (100, 50), (300, 250)]

the costs are 0.5 €/MW in the range between 0 and 100 MW and 1€/MW in the range between 100 MW and 300 MW.

With this definition of the cost function, the actual costs are not intuitively clear from the defined function.
Expand All @@ -202,7 +202,7 @@ The same cost function that was defined as above would therefore be defined in p
[(0, 100, 0.5), (100, 300, 1.)]

which allows direct definition of the costs and ranges.

Of course the signing changes and the MVA-unit changes also apply, so that in summary the different cost function definitions look like this:

+--------------------+--------------------------------------------------------------------------------------------------------------+
Expand Down
34 changes: 34 additions & 0 deletions doc/about/update30.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.. _update:


.. |br| raw:: html

<br />

============================
Update to pandapower 3.0
============================

Breaking changes are provided with pandapower 3.0 to allow using geo_json functionality and to make namings more consistent.
New features are not explained here.

New format for geo data
==============================

Previously, geo data were stored in tables :code:`net.bus_geodata` and :code:`net.line_geodata`.
Now, these data are stored as geojson strings within the element tables, i.e. :code:`net.bus.geo` and :code:`net.line.geo`.


Renaming
==========

Parameters were renamed for more consistency at controllers :code:`net.controller`.
With version 3.0, controllers refer to net elements via :code:`element` (shorthand for :code:`type`) and :code:`element_index`.
This is established by multiple functions/codings in the pandapower package.
The columns in :code:`net.group` are also changed: To :code:`element_type` and :code:`element_index` to avoid misunderstandings.
A major rework could include the names :code:`element_type` and :code:`element_index` at any place in the package but has not been implemented (yet?) since it would break large parts of package usage.

To sum up, the following changes were made:

- TrafoController parameters: :code:`trafotable, trafotype` ➔ :code:`element_type`; :code:`tid` ➔ :code:`element_index`
- Group column: :code:`net.groups.element` ➔ :code:`net.groups.element_index`
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,4 @@
#texinfo_show_urls = 'footnote'

# Additional magic lines (beacuse of: https://github.com/phn/pytpm/issues/3)
numpydoc_show_class_members = False
numpydoc_show_class_members = False
23 changes: 22 additions & 1 deletion doc/control/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,25 @@ SplineCharacteristic
********************

.. autoclass:: pandapower.control.util.characteristic.SplineCharacteristic
:members:
:members:

The following controllers are used for the representation of station controllers as used in PowerFactory


Station Controller
==================

**********************
Binary Search Control
**********************

.. autoclass:: pandapower.control.controller.station_control.BinarySearchControl
:members:

***************
Droop Control
***************

.. autoclass:: pandapower.control.controller.station_control.DroopControl
:members:

4 changes: 2 additions & 2 deletions pandapower/auxiliary.py
Original file line number Diff line number Diff line change
Expand Up @@ -1608,8 +1608,8 @@ def _init_runpp_options(net, algorithm, calculate_voltage_angles, init,

if distributed_slack:
false_slack_weight_elms = [elm for elm in {
'asymmetric_load', 'asymmetric_sgen', 'load', 'sgen', 'shunt',
'storage', 'ward'} if "slack_weight" in net[elm].columns]
'asymmetric_load', 'asymmetric_sgen', 'load', 'sgen', 'shunt', 'storage',
'ward'} if "slack_weight" in net[elm].columns and net[elm].slack_weight.sum() > 0]
if len(false_slack_weight_elms):
logger.warning("Currently distributed_slack is implemented for 'ext_grid', 'gen' "
"and 'xward' only, not for '" + "', '".join(
Expand Down
4 changes: 3 additions & 1 deletion pandapower/control/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from pandapower.auxiliary import ControllerNotConverged

import pandapower.control.basic_controller
import pandapower.control.controller

Expand All @@ -10,11 +12,11 @@
from pandapower.control.controller.trafo.VmSetTapControl import VmSetTapControl
from pandapower.control.controller.trafo.TapDependentImpedance import TapDependentImpedance
from pandapower.control.controller.trafo_control import TrafoController
from pandapower.control.controller.station_control import BinarySearchControl, DroopControl
from pandapower.control.controller.DERController.der_control import DERController

# --- Other ---
from pandapower.control.run_control import *
from pandapower.control.run_control import ControllerNotConverged
from pandapower.control.util.characteristic import Characteristic, SplineCharacteristic
from pandapower.control.util.auxiliary import get_controller_index, plot_characteristic, create_trafo_characteristics
from pandapower.control.util.diagnostic import control_diagnostic, trafo_characteristics_diagnostic
Loading

0 comments on commit 15796a7

Please sign in to comment.