Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/facts_vsc_hvdc' into facts_vsc_hvdc
Browse files Browse the repository at this point in the history
  • Loading branch information
BaraaUniKassel committed Nov 10, 2023
2 parents 36fa4ac + 746d7c7 commit 2f58a85
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pandapower/converter/powerfactory/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def make_gui(app, project_name, browse_dst, calc):

# row 8
max_iter = tk.IntVar(input_panel)
max_iter.set(10)
max_iter.set(30)
tk.Label(input_panel, anchor='w', text='Max. iterations:').grid(row=8, column=0, sticky=tk.W, pady=0)

iter_entry = tk.Entry(input_panel, width=8)
Expand Down
6 changes: 3 additions & 3 deletions pandapower/converter/powerfactory/main_pf.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ def run_verify(net, load_flow_params=None):
logger.info('Validating import...')
if load_flow_params is None:
load_flow_params = {
'tolerance_mva': 1e-9, # tolerance of load flow calculation
'calculate_voltage_angles': True, # set True for meshed networks
'init': 'dc', # initialization of load flow: 'flat', 'dc', 'results'
#'tolerance_mva': 1e-9, # tolerance of load flow calculation
# 'calculate_voltage_angles': True, # set True for meshed networks
# 'init': 'dc', # initialization of load flow: 'flat', 'dc', 'results'
'PF_MAX_IT': 500 # Pypower option, maximal iterations, passed with kwargs
}
logger.debug('load flow params: %s' % load_flow_params)
Expand Down
11 changes: 10 additions & 1 deletion pandapower/pypower/newtonpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ def newtonpf(Ybus, Sbus, V0, ref, pv, pq, ppci, options, makeYbus=None):
ppci["internal"]["Ybus_tcsc"] = Ybus_tcsc
ppci["internal"]["Ybus_ssc"] = Ybus_ssc
ppci["internal"]["Ybus_vsc"] = Ybus_vsc
ppci["internal"]["Ybus_hvdc"] = Ybus_hvdc
ppci["internal"]["Yf_tcsc"] = Yf_tcsc
ppci["internal"]["Yt_tcsc"] = Yt_tcsc
ppci["internal"]["tcsc_fb"] = tcsc_fb
Expand Down Expand Up @@ -650,11 +651,16 @@ def _evaluate_Fx_facts(V,pq ,svc_buses=None, svc_set_vm_pu=None, tcsc_controllab
count_ref[unique_vsc_dc_bus] = c_ref
count_b2b_ref[unique_vsc_dc_bus] = c_b2b_ref

unique_vsc_p_bus, c_p, _ = _sum_by_group(vsc_fb[vsc_p], np.ones_like(vsc_fb[vsc_p]), np.ones_like(vsc_fb[vsc_p]))
count_p = np.zeros(vsc_fb.max() + 1, dtype=np.int64)
count_p[unique_vsc_p_bus] = c_p


# todo fix this part
# a configuration of B2B bus connecting also with DC lines could be implemented here in the future if needed:
if len(dc_p):
# vsc_set_p_pu[vsc_p] = -P_dc[dc_p][dc_p_lookup[vsc_dc_p_bus]]
# vsc_set_p_pu[vsc_p] = vsc_value_dc[vsc_p] * count_p[vsc_fb[vsc_p]] # todo test for when they share same bus
vsc_set_p_pu[vsc_p] = vsc_value_dc[vsc_p] # todo test for when they share same bus
if len(dc_ref):
# vsc_set_p_pu[vsc_mode_dc == 1] = -P_dc[dc_ref][dc_ref_lookup[vsc_dc_ref_bus]] # dc_p
Expand All @@ -664,7 +670,10 @@ def _evaluate_Fx_facts(V,pq ,svc_buses=None, svc_set_vm_pu=None, tcsc_controllab
vsc_set_p_pu[vsc_b2b_p] = vsc_value_dc[vsc_b2b_p]
vsc_set_p_pu[vsc_b2b_ref] = P_dc[dc_b2b][dc_b2b_lookup[vsc_dc_b2b_bus]] / count_b2b_ref[vsc_dc_bus[vsc_b2b_ref]]
#### here used vsc_tb refereing to the q bus
mis_vsc_p = Sbus_vsc[vsc_tb[vsc_controllable]].real - vsc_set_p_pu # this is coupling the AC and the DC sides
# S_temp = Sbus_vsc.real
# S_temp[vsc_tb[vsc_p]] /= count_p[vsc_fb[vsc_p]]
# mis_vsc_p = S_temp[vsc_tb[vsc_controllable]] - vsc_set_p_pu # this is coupling the AC and the DC sides
mis_vsc_p = Sbus_vsc[vsc_tb[vsc_controllable]].real - vsc_set_p_pu # this is coupling the AC and the DC sides # todo old
# todo: adjust the lookup to work with 1) VSC at ext_grid bus 2) only 1 VSC connected to HVDC line
old_F[-len(pq) * 2 + pq_lookup[vsc_tb]] = mis_vsc_p

Expand Down

0 comments on commit 2f58a85

Please sign in to comment.