Skip to content

Commit

Permalink
Merge branch 'develop' into feature/make_available_required_std_type_…
Browse files Browse the repository at this point in the history
…params
  • Loading branch information
SteffenMeinecke authored Jan 6, 2025
2 parents 76091d8 + b323ab5 commit 2359f7a
Show file tree
Hide file tree
Showing 17 changed files with 455 additions and 147 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/upload_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ jobs:

# Waste some time
- name: Sleep for 150s to make release available
if: ${{ inputs.upload_server == 'pypi' }}
uses: juliangruber/sleep-action@v1
with:
time: 150s

# Notify fraunhofer ci about the new version
- uses: eic/trigger-gitlab-ci@v3
if: ${{ inputs.upload_server == 'pypi' }}
with:
url: https://gitlab.cc-asp.fraunhofer.de
project_id: 27329
Expand All @@ -81,6 +83,7 @@ jobs:

# Run an installation for testing
- name: Install pandapower from PyPI
if: ${{ inputs.upload_server == 'pypi' }}
run: |
python3 -m pip install pandapower
python3 -c "import pandapower; print(pandapower.__version__)"
python3 -m pip install --pre pandapower
python3 -c "import pandapower; print(pandapower.__version__)"
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Change Log

[upcoming release] - 2024-..-..
-------------------------------
- [ADDED] Static Var Compensator with Voltage Control
- [ADDED] Implementation of Allocation Factor WLS (AF-WLS) for non observable distribution grids
- [FIXED] Deletion of multiple measurements at the same bus or branch
- [FIXED] Creation of zero injection measurements in WLS estimator
Expand All @@ -19,6 +20,7 @@ Change Log
- [ADDED] Add GeographicalRegion and SubGeographicalRegion names and ids to bus df in cim converter
- [CHANGED] Capitalize first letter of columns busbar_id, busbar_name and substation_id in bus df for cim converter
- [CHANGED] required standard type parameters are made available by function :code:`required_std_type_parameters()`
- [CHANGED] toolbox replace functions (e.g. gen replacement by sgens): improved result table implementation and added profiles consideration
- [FIXED] Do not modify pandas options when importing pandapower
- [FIXED] fixed copy-paste error in contingency results "max_limit_nminus1" and "min_limit_nminus1"
- [ADDED] improved lightsim2grid documentation including compatibitliy issues
Expand Down Expand Up @@ -92,6 +94,7 @@ Change Log
- [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()
- [FIXED] index error during unbalanced powerflow if multiple external grids are present
- [CHANGED] accelerate distributed slack power flow calculation by using sparse-aware operations in _subnetworks()
- [CHANGED] Trafo Controllers can now be added to elements that are out of service, changed self.nothing_to_do()
- [ADDED] Discrete shunt controller for local voltage regulation with shunt steps
Expand Down
2 changes: 1 addition & 1 deletion doc/converter/powerfactory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The documentation describes how to use the exporter as a function in "Engine mod
- ElmZpu (pu Impedance)
- ElmSind (Series Reactor)
- Elmscap (Series Capacitor)

- ElmSvs (Static Var Compensator with Voltage Control)

Setup PowerFactory and Python
=====================================
Expand Down
10 changes: 5 additions & 5 deletions doc/elements/line_par.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ from_bus*;integer;;Index of bus where the line starts
to_bus*;integer;;Index of bus where the line ends
length_km*;float;:math:`>` 0;length of the line [km]
r_ohm_per_km*;float;:math:`\geq` 0 ;resistance of the line [Ohm per km]
x_ohm_per_km*;float;:math:`\geq` 0 ;inductance of the line [Ohm per km]
x_ohm_per_km*;float;:math:`\geq` 0 ;reactance of the line [Ohm per km]
c_nf_per_km*;float;:math:`\geq` 0 ;capacitance of the line (line-to-earth) [nano Farad per km]
r0_ohm_per_km****;float;:math:`\geq` 0 ;zero sequence resistance of the line [Ohm per km]
x0_ohm_per_km****;float;:math:`\geq` 0 ;zero sequence inductance of the line [Ohm per km]
x0_ohm_per_km****;float;:math:`\geq` 0 ;zero sequence reactance of the line [Ohm per km]
c0_nf_per_km****;float;:math:`\geq` 0 ;zero sequence capacitance of the line [nano Farad per km]
g_us_per_km*;float;:math:`\geq` 0 ;dielectric conductance of the line [micro Siemens per km]
max_i_ka*;float;:math:`>` 0 ;maximal thermal current [kilo Ampere]
parallel*;integer;:math:`\geq` 1;number of parallel line systems
df*;float;0...1 ;derating factor (scaling) for max_i_ka
type;string;"| Naming conventions:

| *""ol""* - overhead line
type;string;"| Naming conventions:
| *""ol""* - overhead line
| *""cs""* - underground cable system";type of line
max_loading_percent**;float;:math:`>` 0 ;Maximum loading of the line
endtemp_degree***;float;:math:`>` 0 ;Short-Circuit end temperature of the line
Expand Down
15 changes: 14 additions & 1 deletion pandapower/auxiliary.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
from geojson import loads, GeoJSON
import numpy as np
import pandas as pd
from pandas.api.types import is_numeric_dtype, is_string_dtype, is_object_dtype
# from pandas.api.types import is_integer_dtype, is_float_dtype
import scipy as sp
import numbers
from packaging.version import Version
Expand Down Expand Up @@ -451,12 +453,23 @@ def element_types_to_ets(element_types=None):
ser2 = pd.Series(ser1.index, index=list(ser1))
if element_types is None:
return ser2
elif isinstance(ets, str):
elif isinstance(element_types, str):
return ser2.at[element_types]
else:
return list(ser2.loc[element_types])


def empty_defaults_per_dtype(dtype):
if is_numeric_dtype(dtype):
return np.nan
elif is_string_dtype(dtype):
return ""
elif is_object_dtype(dtype):
return None
else:
raise NotImplementedError(f"{dtype=} is not implemented in _empty_defaults()")


def _preserve_dtypes(df, dtypes):
for item, dtype in list(dtypes.items()):
if df.dtypes.at[item] != dtype:
Expand Down
23 changes: 14 additions & 9 deletions pandapower/contingency/contingency.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,19 @@ def run_contingency(net, nminus1_cases, pf_options=None, pf_options_nminus1=None

def run_contingency_ls2g(net, nminus1_cases, contingency_evaluation_function=pp.runpp, **kwargs):
"""
Execute contingency analysis using the lightsim2grid library. This works much faster than using pandapower.
Limitation: the results for branch flows are valid only for the "from_bus" of lines and "hv_bus" of transformers.
This can lead to a small difference to the results using pandapower.
The results are written in pandapower results tables.
Make sure that the N-1 cases do not lead to isolated grid, otherwise results with pandapower and this function will
be different. Reason: pandapower selects a different gen as slack if the grid becomes isolated, but
lightsim2grid would simply return nan as results for such a contingency situation.
WARNING: continuous bus indices, 0-start, are required!
This function can be passed through to pandapower.timeseries.run_timeseries as the run_control_fct argument.
Execute contingency analysis using the lightsim2grid library. This works much faster than using
pandapower.
This function can be passed through to pandapower.timeseries.run_timeseries as the
run_control_fct argument.
**Limitation:** the results for branch flows are valid only for the "from_bus" of lines and
"hv_bus" of transformers. This can lead to a small difference to the results using pandapower.
The results are written in pandapower results tables. Make sure that the N-1 cases do not lead
to isolated grid, otherwise results with pandapower and this function will
be different. Reason: pandapower selects a different gen as slack if the grid becomes isolated,
but lightsim2grid would simply return nan as results for such a contingency situation.
**WARNING:** continuous bus indices, 0-start, are required!
The results will written for the
following additional variables: table res_bus with columns "max_vm_pu", "min_vm_pu",
Expand All @@ -159,6 +163,7 @@ def run_contingency_ls2g(net, nminus1_cases, contingency_evaluation_function=pp.
INPUT
----------
**net** - pandapowerNet
**nminus1_cases** - dict
describes all N-1 cases, e.g. {"line": {"index": [1, 2, 3]}, "trafo": {"index": [0]}}
Expand Down
2 changes: 2 additions & 0 deletions pandapower/converter/powerfactory/pf_export_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def create_network_dict(app, flag_graphics='GPS'):
'ElmAsm',
'ElmShnt',
'ElmVac',
'ElmSvs',
'ElmVsc',
'ElmVscmono',

Expand Down Expand Up @@ -56,6 +57,7 @@ def create_network_dict(app, flag_graphics='GPS'):
'ElmPvsys': ['W', 'var', 'VA'],
'ElmXnet': ['W', 'var', 'VA'],
'ElmSym': ['W', 'var', 'VA'],
'ElmSvs': ['W', 'var', 'VA'],
'ElmAsm': ['W', 'var', 'VA'],
'ElmShnt': ['W', 'var', 'VA'],
'ElmZpu': ['W', 'var', 'VA'],
Expand Down
Loading

0 comments on commit 2359f7a

Please sign in to comment.