Skip to content

Commit

Permalink
Added option V_debug to store Vm and Va per NR step
Browse files Browse the repository at this point in the history
  • Loading branch information
WinfriedL committed Jul 11, 2018
1 parent b165702 commit 385b668
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions pandapower/pf/newtonpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def newtonpf(Ybus, Sbus, V0, pv, pq, ppci, options):
numba = options["numba"]
iwamoto = options["algorithm"] == "iwamoto_nr"
voltage_depend_loads = options["voltage_depend_loads"]
V_debug = options["V_debug"]

baseMVA = ppci['baseMVA']
bus = ppci['bus']
Expand All @@ -59,8 +60,12 @@ def newtonpf(Ybus, Sbus, V0, pv, pq, ppci, options):
if iwamoto:
dVm, dVa = zeros_like(Vm), zeros_like(Va)

Vm_it=Vm.copy()
Va_it=Va.copy()
if V_debug:
Vm_it=Vm.copy()
Va_it=Va.copy()
else:
Vm_it=None
Va_it=None

## set up indexing for updating V
pvpq = r_[pv, pq]
Expand Down Expand Up @@ -111,8 +116,9 @@ def newtonpf(Ybus, Sbus, V0, pv, pq, ppci, options):
Vm = abs(V) ## update Vm and Va again in case
Va = angle(V) ## we wrapped around with a negative Vm

Vm_it=column_stack((Vm_it,Vm))
Va_it=column_stack((Va_it,Va))
if V_debug:
Vm_it=column_stack((Vm_it,Vm))
Va_it=column_stack((Va_it,Va))

if voltage_depend_loads:
Sbus = makeSbus(baseMVA, bus, gen, vm=Vm)
Expand Down
4 changes: 2 additions & 2 deletions pandapower/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _passed_runpp_parameters(local_parameters):
def runpp(net, algorithm='nr', calculate_voltage_angles="auto", init="auto", max_iteration="auto",
tolerance_kva=1e-5, trafo_model="t", trafo_loading="current", enforce_q_lims=False,
numba=True, recycle=None, check_connectivity=True, r_switch=0.0, voltage_depend_loads=True,
delta_q=0, trafo3w_losses="hv", vm_start_pu=1.0, **kwargs):
delta_q=0, trafo3w_losses="hv", vm_start_pu=1.0, V_debug=False, **kwargs):
"""
Runs PANDAPOWER AC Flow
Expand Down Expand Up @@ -257,7 +257,7 @@ def runpp(net, algorithm='nr', calculate_voltage_angles="auto", init="auto", max
trafo3w_losses=trafo3w_losses)
_add_pf_options(net, tolerance_kva=tolerance_kva, trafo_loading=trafo_loading,
numba=numba, ac=ac, algorithm=algorithm, max_iteration=max_iteration,
vm_start_pu=vm_start_pu)
vm_start_pu=vm_start_pu, V_debug=V_debug)
# net.__internal_options.update(overrule_options)
net._options.update(overrule_options)
_check_bus_index_and_print_warning_if_high(net)
Expand Down

0 comments on commit 385b668

Please sign in to comment.