Skip to content

Commit

Permalink
Docs for new features:
Browse files Browse the repository at this point in the history
[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")
  • Loading branch information
friederikemeier committed Oct 12, 2020
1 parent e51cf11 commit bc7b12c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Change Log
- [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")

[2.4.0]- 2020-09-01
----------------------
Expand Down
5 changes: 4 additions & 1 deletion pandapower/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def runopp(net, verbose=False, calculate_voltage_angles=True, check_connectivity
Runs the pandapower Optimal Power Flow.
Flexibilities, constraints and cost parameters are defined in the pandapower element tables.
Flexibilities can be defined in net.sgen / net.gen /net.load / net.storage
Flexibilities can be defined in net.sgen / net.gen /net.load / net.storage /net.ext_grid
net.sgen.controllable if a static generator is controllable. If False,
the active and reactive power are assigned as in a normal power flow. If True, the following
flexibilities apply:
Expand All @@ -301,6 +301,9 @@ def runopp(net, verbose=False, calculate_voltage_angles=True, check_connectivity
- net.trafo.max_loading_percent
- net.trafo3w.max_loading_percent
If the external grid ist controllable, the voltage setpoint of the external grid can be optimized within the
voltage constraints by the OPF. The same applies to the voltage setpoints of the controllable generator elements.
How these costs are combined into a cost function depends on the cost_function parameter.
INPUT:
Expand Down
34 changes: 27 additions & 7 deletions pandapower/runpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ def runpm(net, julia_file=None, pp_to_pm_callback=None, calculate_voltage_angles
**pm_log_level** (int, 0) - solver log level in power models
**delete_buffer_file** (Bool, True) - If True, the .json file used by powermodels will be deleted after
optimization.
**pm_file_path** (str, None) - Specifiy the filename, under which the .json file for powermodels is stored. If
you want to keep the file after optimization, you should also set
delete_buffer_file to False!
**opf_flow_lim** (str, "I") - Quantity to limit for branch flow constraints, in line with matpower's
"opf.flowlim" parameter
"S" - apparent power flow (limit in MVA),
"I" - current magnitude (limit in MVA at 1 p.u. voltage)
"""
net._options = {}
ac = True if "DC" not in pm_model else False
Expand All @@ -92,7 +104,7 @@ def runpm(net, julia_file=None, pp_to_pm_callback=None, calculate_voltage_angles
def runpm_dc_opf(net, pp_to_pm_callback=None, calculate_voltage_angles=True,
trafo_model="t", delta=1e-8, trafo3w_losses="hv", check_connectivity=True,
correct_pm_network_data=True, pm_model="DCPPowerModel", pm_solver="ipopt",
pm_time_limits=None, pm_log_level=0, opf_flow_lim="S"): # pragma: no cover
pm_time_limits=None, pm_log_level=0): # pragma: no cover
"""
Runs a linearized power system optimization using PowerModels.jl.
Expand Down Expand Up @@ -153,7 +165,7 @@ def runpm_dc_opf(net, pp_to_pm_callback=None, calculate_voltage_angles=True,
_add_opf_options(net, trafo_loading='power', ac=ac, init="flat", numba=True,
pp_to_pm_callback=pp_to_pm_callback, julia_file=julia_file,
correct_pm_network_data=correct_pm_network_data, pm_model=pm_model, pm_solver=pm_solver,
pm_time_limits=pm_time_limits, pm_log_level=pm_log_level, opf_flow_lim=opf_flow_lim)
pm_time_limits=pm_time_limits, pm_log_level=pm_log_level, opf_flow_lim="S")
_runpm(net)


Expand Down Expand Up @@ -215,6 +227,13 @@ def runpm_ac_opf(net, pp_to_pm_callback=None, calculate_voltage_angles=True,
"opf.flowlim" parameter
"S" - apparent power flow (limit in MVA),
"I" - current magnitude (limit in MVA at 1 p.u. voltage)
**delete_buffer_file** (Bool, True) - If True, the .json file used by powermodels will be deleted after
optimization.
**pm_file_path** (str, None) - Specifiy the filename, under which the .json file for powermodels is stored. If
you want to keep the file after optimization, you should also set
delete_buffer_file to False!
"""
julia_file = os.path.join(pp_dir, "opf", 'run_powermodels.jl')
ac = True if "DC" not in pm_model else False
Expand All @@ -235,8 +254,7 @@ def runpm_ac_opf(net, pp_to_pm_callback=None, calculate_voltage_angles=True,
def runpm_tnep(net, pp_to_pm_callback=None, calculate_voltage_angles=True,
trafo_model="t", delta=1e-8, trafo3w_losses="hv", check_connectivity=True,
pm_model="DCPPowerModel", pm_solver=None, correct_pm_network_data=True,
pm_nl_solver="ipopt", pm_mip_solver="cbc", pm_time_limits=None, pm_log_level=0,
opf_flow_lim = "S"): # pragma: no cover
pm_nl_solver="ipopt", pm_mip_solver="cbc", pm_time_limits=None, pm_log_level=0): # pragma: no cover
"""
Runs a non-linear transmission network extension planning (tnep) optimization using PowerModels.jl.
Expand Down Expand Up @@ -280,15 +298,15 @@ def runpm_tnep(net, pp_to_pm_callback=None, calculate_voltage_angles=True,
pp_to_pm_callback=pp_to_pm_callback, julia_file=julia_file, pm_model=pm_model, pm_solver=pm_solver,
correct_pm_network_data=correct_pm_network_data, pm_nl_solver=pm_nl_solver,
pm_mip_solver=pm_mip_solver, pm_time_limits=pm_time_limits, pm_log_level=pm_log_level,
opf_flow_lim=opf_flow_lim)
opf_flow_lim="S")
_runpm(net)
read_tnep_results(net)


def runpm_ots(net, pp_to_pm_callback=None, calculate_voltage_angles=True,
trafo_model="t", delta=1e-8, trafo3w_losses="hv", check_connectivity=True,
pm_model="DCPPowerModel", pm_solver="juniper", pm_nl_solver="ipopt", pm_mip_solver="cbc",
correct_pm_network_data=True, pm_time_limits=None, pm_log_level=0, opf_flow_lim="S"): # pragma: no cover
correct_pm_network_data=True, pm_time_limits=None, pm_log_level=0): # pragma: no cover
"""
Runs a non-linear optimal transmission switching (OTS) optimization using PowerModels.jl.
Expand All @@ -311,6 +329,8 @@ def runpm_ots(net, pp_to_pm_callback=None, calculate_voltage_angles=True,
{"pm_time_limit": 300., "pm_nl_time_limit": 300., "pm_mip_time_limit": 300.}
**pm_log_level** (int, 0) - solver log level in power models
"""
julia_file = os.path.join(pp_dir, "opf", 'run_powermodels_ots.jl')
ac = True if "DC" not in pm_model else False
Expand All @@ -327,7 +347,7 @@ def runpm_ots(net, pp_to_pm_callback=None, calculate_voltage_angles=True,
pp_to_pm_callback=pp_to_pm_callback, julia_file=julia_file, pm_model=pm_model, pm_solver=pm_solver,
correct_pm_network_data=correct_pm_network_data, pm_mip_solver=pm_mip_solver,
pm_nl_solver=pm_nl_solver, pm_time_limits=pm_time_limits, pm_log_level=pm_log_level,
opf_flow_lim=opf_flow_lim)
opf_flow_lim="S")
_runpm(net)
read_ots_results(net)

Expand Down

0 comments on commit bc7b12c

Please sign in to comment.