Skip to content

Commit

Permalink
Merge branch 'develop' into single_sc
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.rst
  • Loading branch information
wangzhenassd committed Jan 9, 2021
2 parents 4f117f4 + 3836999 commit 56b7645
Show file tree
Hide file tree
Showing 184 changed files with 349 additions and 950 deletions.
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016-2020 by University of Kassel and Fraunhofer Institute for Energy Economics
Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for Energy Economics
and Energy System Technology (IEE), Kassel. All rights reserved.

Lead Developers:
Expand Down
35 changes: 25 additions & 10 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
Change Log
=============

- [ADDED] travis CI tests for PowerModels.jl interface (julia tests)
- [ADDED] documentation on how to install Gurobi as a PowerModels.jl solver
- [CHANGED] internal datastructure tutorial contains now an example of a spy plot to visiualize the admittance matrix Ybus
- [FIXED] json load for broken geom columns in bus_geodata
- [ADDED] The voltage setpoint of external grids can now be optimized by the OPF by setting net.ext_grid.controllable to True.
- [ADDED] The Powermodels AC OPF can now be used with line loading constraints formulated with respect to the maximum current net.line.max_i_ka by using pp.runpm_ac_opf(net, opf_flow_lim="I")
- [ADDED] For easier debugging of the Powermodels interface, you can now save your .json file and specify the file name by using pp.runpm(net, delete_buffer_file=False, pm_file_path="filename.json")
- [CHANGED] The create-module now contains some functions for standardized checks and procedures in all create functions.
- [ADDED] Factorization mode instead of inversion of Ybus in short-circuit calculation
- [ADDED] Optimized the calculation of single/selected buses in 1ph/2ph/3ph short-circuit calculation

[2.5.0]- 2021-01-08
----------------------
- [ADDED] github actions for tests added.
- [ADDED] tests for PowerModels.jl interface (julia tests).
- [ADDED] documentation on how to install Gurobi as a PowerModels.jl solver.
- [ADDED] the voltage set point of external grids can now be optimized by the OPF by setting net.ext_grid.controllable to True.
- [ADDED] the Powermodels AC OPF can now be used with line loading constraints formulated with respect to the maximum current net.line.max_i_ka by using pp.runpm_ac_opf(net, opf_flow_lim="I").
- [ADDED] for easier debugging of the Powermodels interface, you can now save your .json file and specify the file name by using pp.runpm(net, delete_buffer_file=False, pm_file_path="filename.json".
- [CHANGED] The create-module now contains some functions for standardized checks and procedures in all create functions.
- [CHANGED] all controllers and output writers do not have net as attribute any more.
- [CHANGED] due to multi net implementations in pandapipes, time series functions have been adapted drastically in order to minimize duplicated code.
- [CHANGED] internal data structure tutorial contains now an example of a spy plot to visualize the admittance matrix Ybus.
- [CHANGED] introduce abstract node/branch formulation for the plotly functions.
- [FIXED] issue # 905 fixed (If powerflow not necessary, e.g. two ext_grids/pv-nodes with only two buses) powerflow is bypassed and the solution is trivial.
- [FIXES] issue # 954 fixed (Update bus IDs for net.asymmetric_load and net.asymmetric_sgen when merging nets in toolbox.py).
- [FIXED] issue # 780 fixed (passing the shape to pypower solves the problem)
- [FIXED] excel engine pd.ExcelFile not working in new pandas version. Adaptation in file_io with new module openpyxl. openpyxl needs to be installed. Requirements are adapted accordngly.
- [FIXED] in io_utils functions with no clear class name can be de-serialized as well.
- [FIXED] fixed generic coordinates creation when respect_switches is set.
- [FIXED] recycle values None and False are considered equally --> recycle usage is skipped.
- [FIXED] control_diagnostic distinguishes between two winding and three winding transformers.
- [FIXED] toolbox functions, e.g. get_connected_elements, consider switches for three winding transformers.
- [FIXED] json load for broken geom columns in bus_geodata.

[2.4.0]- 2020-09-01
----------------------
- [CHANGED] signing system in state estimation: bus p,q measurement in consumption reference (load is positive) #893
Expand Down Expand Up @@ -39,7 +54,7 @@ Change Log
- [FIXED] pandas 1.0 and 1.1 support
- [CHANGED] revision of toolbox function drop_out_of_service_elements()
- [ADDED] toolbox function drop_measurements_at_elements()
- [ADDED] Encyption for JSON I/O
- [ADDED] Encryption for JSON I/O
- [FIXED] Bug in converting measurements of out-of-service branch in state estimation #859
- [FIXED] Bug in using initialization option "results" in state estimation #859
- [CHANGED] In state estimation power flow results will not be renamed anymore
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016-2020 by University of Kassel and Fraunhofer Institute for for Energy Economics
Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for for Energy Economics
and Energy System Technology (IEE) Kassel and individual contributors (see AUTHORS file for details).
All rights reserved.

Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include LICENSE AUTHORS README.rst requirements.txt CHANGELOG.rst .travis.yml
include LICENSE AUTHORS README.rst requirements.txt CHANGELOG.rst .travis.yml .github/**/*.yml
global-include *.p
global-include *.mat
global-include *.json
Expand Down
2 changes: 1 addition & 1 deletion doc/about/license.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ License
pandapower is published under the following 3-clause BSD license: ::


Copyright (c) 2020 by University of Kassel and Fraunhofer Institute for Fraunhofer Institute for
Copyright (c) 2021 by University of Kassel and Fraunhofer Institute for Fraunhofer Institute for
Energy Economics and Energy System Technology (IEE) Kassel and individual contributors
(see AUTHORS file for details). All rights reserved.

Expand Down
6 changes: 3 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@

# General information about the project.
project = u'pandapower'
copyright = u'2016-2020 by Fraunhofer IEE and University of Kassel'
copyright = u'2016-2021 by Fraunhofer IEE and University of Kassel'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "2.4"
version = "2.5"
# The full version, including alpha/beta/rc tags.
release = "2.4.0"
release = "2.5.0"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
48 changes: 24 additions & 24 deletions doc/elements/trafo_res_3ph.csv
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
**Parameter**;**Datatype**;**Explanation**
p_A_hv_mw;float;active power flow at the high voltage transformer bus : Phase A [MW]
q_A_hv_mvar;float;reactive power flow at the high voltage transformer bus : Phase A [MVar]
p_B_hv_mw;float;active power flow at the high voltage transformer bus : Phase B [MW]
q_B_hv_mvar;float;reactive power flow at the high voltage transformer bus : Phase B [MVar]
p_C_hv_mw;float;active power flow at the high voltage transformer bus : Phase C [MW]
q_C_hv_mvar;float;reactive power flow at the high voltage transformer bus : Phase C [MVar]
p_A_lv_mw;float;active power flow at the low voltage transformer bus : Phase A [MW]
q_A_lv_mvar;float;reactive power flow at the low voltage transformer bus : Phase A [MVar]
p_B_lv_mw;float;active power flow at the low voltage transformer bus : Phase B [MW]
q_B_lv_mvar;float;reactive power flow at the low voltage transformer bus : Phase B [MVar]
p_C_lv_mw;float;active power flow at the low voltage transformer bus : Phase C [MW]
q_C_lv_mvar;float;reactive power flow at the low voltage transformer bus : Phase C [MVar]
pl_A_mw;float;active power losses of the transformer : Phase A [MW]
ql_A_mvar;float;reactive power consumption of the transformer : Phase A [Mvar]
pl_B_mw;float;active power losses of the transformer : Phase B [MW]
ql_B_mvar;float;reactive power consumption of the transformer : Phase B [Mvar]
pl_C_mw;float;active power losses of the transformer : Phase C [MW]
ql_C_mvar;float;reactive power consumption of the transformer : Phase C [Mvar]
i_A_hv_ka;float;current at the high voltage side of the transformer : Phase A [kA]
i_A_lv_ka;float;current at the low voltage side of the transformer : Phase A [kA]
i_B_hv_ka;float;current at the high voltage side of the transformer : Phase B [kA]
i_B_lv_ka;float;current at the low voltage side of the transformer : Phase B [kA]
i_C_hv_ka;float;current at the high voltage side of the transformer : Phase C [kA]
i_C_lv_ka;float;current at the low voltage side of the transformer : Phase C [kA]
p_a_hv_mw;float;active power flow at the high voltage transformer bus : Phase A [MW]
q_a_hv_mvar;float;reactive power flow at the high voltage transformer bus : Phase A [MVar]
p_b_hv_mw;float;active power flow at the high voltage transformer bus : Phase B [MW]
q_b_hv_mvar;float;reactive power flow at the high voltage transformer bus : Phase B [MVar]
p_c_hv_mw;float;active power flow at the high voltage transformer bus : Phase C [MW]
q_c_hv_mvar;float;reactive power flow at the high voltage transformer bus : Phase C [MVar]
p_a_lv_mw;float;active power flow at the low voltage transformer bus : Phase A [MW]
q_a_lv_mvar;float;reactive power flow at the low voltage transformer bus : Phase A [MVar]
p_b_lv_mw;float;active power flow at the low voltage transformer bus : Phase B [MW]
q_b_lv_mvar;float;reactive power flow at the low voltage transformer bus : Phase B [MVar]
p_c_lv_mw;float;active power flow at the low voltage transformer bus : Phase C [MW]
q_c_lv_mvar;float;reactive power flow at the low voltage transformer bus : Phase C [MVar]
pl_a_mw;float;active power losses of the transformer : Phase A [MW]
ql_a_mvar;float;reactive power consumption of the transformer : Phase A [Mvar]
pl_b_mw;float;active power losses of the transformer : Phase B [MW]
ql_b_mvar;float;reactive power consumption of the transformer : Phase B [Mvar]
pl_c_mw;float;active power losses of the transformer : Phase C [MW]
ql_c_mvar;float;reactive power consumption of the transformer : Phase C [Mvar]
i_a_hv_ka;float;current at the high voltage side of the transformer : Phase A [kA]
i_a_lv_ka;float;current at the low voltage side of the transformer : Phase A [kA]
i_b_hv_ka;float;current at the high voltage side of the transformer : Phase B [kA]
i_b_lv_ka;float;current at the low voltage side of the transformer : Phase B [kA]
i_c_hv_ka;float;current at the high voltage side of the transformer : Phase C [kA]
i_c_lv_ka;float;current at the low voltage side of the transformer : Phase C [kA]
loading_percent;float;load utilization relative to rated power [%]
2 changes: 1 addition & 1 deletion pandapower/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.4.0"
__version__ = "2.5.0"

import os
pp_dir = os.path.dirname(os.path.realpath(__file__))
Expand Down
2 changes: 1 addition & 1 deletion pandapower/auxiliary.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2016-2020 by University of Kassel and Fraunhofer Institute for Energy Economics
# Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.


Expand Down
2 changes: 1 addition & 1 deletion pandapower/build_branch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2016-2020 by University of Kassel and Fraunhofer Institute for Energy Economics
# Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Expand Down
2 changes: 1 addition & 1 deletion pandapower/build_bus.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2016-2020 by University of Kassel and Fraunhofer Institute for Energy Economics
# Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.


Expand Down
5 changes: 2 additions & 3 deletions pandapower/build_gen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2016-2020 by University of Kassel and Fraunhofer Institute for Energy Economics
# Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.


Expand Down Expand Up @@ -110,10 +110,9 @@ def _build_pp_ext_grid(net, ppc, f, t):
add_q_constraints(net, "ext_grid", eg_is, ppc, f, t, delta)
add_p_constraints(net, "ext_grid", eg_is, ppc, f, t, delta)


if "controllable" in net["ext_grid"]:
# if we do and one of them is false, do this only for the ones, where it is false
eg_constrained = net.ext_grid[eg_is][net.ext_grid.controllable==False]
eg_constrained = net.ext_grid[eg_is][net.ext_grid.controllable == False]
if len(eg_constrained):
eg_constrained_bus = eg_constrained.bus
ppc["bus"][eg_constrained_bus, VMAX] = net["ext_grid"]["vm_pu"].values[eg_constrained.index] + delta
Expand Down
20 changes: 9 additions & 11 deletions pandapower/control/basic_controller.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2016-2020 by University of Kassel and Fraunhofer Institute for Energy Economics
# Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.

import copy
from pandapower.auxiliary import get_free_id, _preserve_dtypes
from pandapower.control.util.auxiliary import \
Expand All @@ -25,22 +26,19 @@ def __init__(self, net, in_service=True, order=0, level=0, index=None, recycle=F
drop_same_existing_ctrl=False, initial_run=True, overwrite=False,
matching_params=None, **kwargs):
super().__init__()
self.recycle = recycle
self.initial_run = initial_run
self.matching_params = dict() if matching_params is None else matching_params
# add oneself to net, creating the ['controller'] DataFrame, if necessary
if index is None:
index = get_free_id(net.controller)
self.index = index
self.add_controller_to_net(net=net, in_service=in_service, order=order,
self.add_controller_to_net(net=net, in_service=in_service, initial_run=initial_run, order=order,
level=level, index=index, recycle=recycle,
drop_same_existing_ctrl=drop_same_existing_ctrl,
overwrite=overwrite, matching_params=matching_params, **kwargs)

def __repr__(self):
rep = "This " + self.__class__.__name__ + " has the following parameters: \n"

for member in ["index", "json_excludes", "recycle"]:
for member in ["index", "json_excludes"]:
rep += ("\n" + member + ": ").ljust(20)
d = locals()
exec('value = self.' + member, d)
Expand All @@ -67,7 +65,7 @@ def __setstate__(self, state):
self.__dict__.update(state)


def add_controller_to_net(self, net, in_service, order, level, index, recycle,
def add_controller_to_net(self, net, in_service, initial_run, order, level, index, recycle,
drop_same_existing_ctrl, overwrite, **kwargs):
"""
adds the controller to net['controller'] dataframe.
Expand All @@ -92,10 +90,10 @@ def add_controller_to_net(self, net, in_service, order, level, index, recycle,
# use base class method to raise an error if the object is in DF and overwrite = False
super().add_to_net(net=net, element='controller', index=index, overwrite=overwrite)

columns = ['object', 'in_service', 'recycle']
net.controller.loc[index,columns] = self, in_service, recycle
columns = ['object', 'in_service', 'initial_run', 'recycle']
net.controller.loc[index,columns] = (self, in_service, initial_run, recycle)
net.controller['order'][index] = order
net.controller['level'][index]= level
net.controller['level'][index] = level

_preserve_dtypes(net.controller, dtypes)

Expand All @@ -108,7 +106,7 @@ def time_step(self, net, time):
"""
pass

def set_recycle(self):
def set_recycle(self, net):
"""
Checks the recyclability of this controller and changes the recyclability of the control handler if
necessary. With this a faster time series calculation can be achieved since not everything must be
Expand Down
13 changes: 6 additions & 7 deletions pandapower/control/controller/const_control.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright (c) 2016-2020 by University of Kassel and Fraunhofer Institute for Energy Economics
# Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.

import numpy as np
Expand Down Expand Up @@ -79,7 +79,6 @@ def __init__(self, net, element, variable, element_index, profile_name=None, dat
logger.error("Parameter set_q_from_cosphi deprecated!")
raise ValueError
self.applied = False
self.initial_run = initial_run
# write functions faster, depending on type of self.element_index
if isinstance(self.element_index, int):
# use .at if element_index is integer for speedup
Expand All @@ -91,15 +90,15 @@ def __init__(self, net, element, variable, element_index, profile_name=None, dat
else:
# use common .loc
self.write = "loc"
self.set_recycle()
self.set_recycle(net)

def set_recycle(self):
def set_recycle(self, net):
allowed_elements = ["load", "sgen", "storage", "gen", "ext_grid", "trafo", "trafo3w",
"line"]
if self.recycle is False or self.element not in allowed_elements:
if net.controller.at[self.index, 'recycle'] is False or self.element not in allowed_elements:
# if recycle is set to False by the user when creating the controller it is deactivated
# or when const control controls an element which is not able to be recycled
self.recycle = False
net.controller.at[self.index, 'recycle'] = False
return
# these variables determine what is re-calculated during a time series run
recycle = dict(trafo=False, gen=False, bus_pq=False)
Expand All @@ -113,7 +112,7 @@ def set_recycle(self):
recycle["trafo"] = True
# recycle is either the dict what should be recycled
# or False if the element + variable combination is not supported
self.recycle = recycle if any(list(recycle.values())) else False
net.controller.at[self.index, 'recycle'] = recycle if any(list(recycle.values())) else False

def write_to_net(self, net):
"""
Expand Down
15 changes: 9 additions & 6 deletions pandapower/control/controller/trafo_control.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
__author__ = 'lthurner'
# -*- coding: utf-8 -*-

# Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.

import numpy as np
from pandapower.control.basic_controller import Controller
Expand Down Expand Up @@ -107,18 +110,18 @@ def __init__(self, net, tid, side, tol, in_service, trafotype, level=0, order=0,
self.tid))
if net[self.trafotable].at[self.tid, "tap_step_percent"] < 0:
self.tap_side_coeff *= -1
self.set_recycle()
self.set_recycle(net)

def set_recycle(self):
def set_recycle(self, net):
allowed_elements = ["2W", "3W"]
if self.recycle is False or self.trafotype not in allowed_elements:
if net.controller.at[self.index, 'recycle'] is False or self.trafotype not in allowed_elements:
# if recycle is set to False by the user when creating the controller it is deactivated or when
# const control controls an element which is not able to be recycled
self.recycle = False
net.controller.at[self.index, 'recycle'] = False
return
# these variables determine what is re-calculated during a time series run
recycle = dict(trafo=True, gen=False, bus_pq=False)
self.recycle = recycle
net.controller.at[self.index, 'recycle'] = recycle

def timestep(self, net):
self.tap_pos = net[self.trafotable].at[self.tid, "tap_pos"]
Expand Down
Loading

0 comments on commit 56b7645

Please sign in to comment.