Skip to content

Commit

Permalink
WIP: fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rbolgaryn committed Dec 5, 2023
1 parent e0aa30a commit f96e9cd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 304 deletions.
3 changes: 2 additions & 1 deletion pandapower/pd2ppc.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from pandapower.pypower.idx_svc import SVC_STATUS, SVC_BUS
from pandapower.pypower.idx_vsc import VSC_BUS_DC, VSC_STATUS, VSC_MODE_AC, VSC_MODE_AC_V, VSC_MODE_AC_Q, VSC_MODE_AC_SL
from pandapower.pypower.run_userfcn import run_userfcn
from itertools import combinations


def _pd2ppc_recycle(net, sequence, recycle):
Expand Down Expand Up @@ -76,7 +77,7 @@ def _check_vsc_different_ac_control_modes_at_same_bus(ppci):
ac_vm_pu_buses = ppci["vsc"][ppci["vsc"][:, VSC_MODE_AC] == VSC_MODE_AC_V, VSC_BUS]
ac_q_mvar_buses = ppci["vsc"][ppci["vsc"][:, VSC_MODE_AC] == VSC_MODE_AC_Q, VSC_BUS]
ac_slack_buses = ppci["vsc"][ppci["vsc"][:, VSC_MODE_AC] == VSC_MODE_AC_SL, VSC_BUS]
ac_bus_intersection = np.intersect1d(np.intersect1d(ac_vm_pu_buses, ac_q_mvar_buses), ac_slack_buses)
ac_bus_intersection = np.hstack([np.intersect1d(a, b) for a, b in combinations([ac_vm_pu_buses, ac_q_mvar_buses, ac_slack_buses], r=2)])
if len(ac_bus_intersection) != 0:
raise NotImplementedError("Found multiple VSC converters that share the same AC bus and have "
"different AC control modes - not implemented. VSC converters can only "
Expand Down
7 changes: 4 additions & 3 deletions pandapower/pypower/newtonpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
makeYbus_ssc_vsc, make_Ybus_facts, make_Yft_facts
from pandapower.pypower.idx_bus_dc import DC_PD, DC_VM, DC_BUS_TYPE, DC_NONE, DC_BUS_I, DC_REF, DC_P, DC_B2B
from pandapower.pypower.idx_vsc import VSC_CONTROLLABLE, VSC_MODE_AC, VSC_VALUE_AC, VSC_MODE_DC, VSC_VALUE_DC, VSC_R, \
VSC_X, VSC_Q, VSC_P, VSC_BUS_DC, VSC_P_DC, VSC_MODE_AC_SL, VSC_MODE_AC_V, VSC_MODE_AC_Q
VSC_X, VSC_Q, VSC_P, VSC_BUS_DC, VSC_P_DC, VSC_MODE_AC_SL, VSC_MODE_AC_V, VSC_MODE_AC_Q, VSC_MODE_DC_P, \
VSC_MODE_DC_V
from pandapower.pypower.makeSbus import makeSbus
from pandapower.pf.create_jacobian import create_jacobian_matrix, get_fastest_jacobian_function
from pandapower.pypower.idx_gen import PG
Expand Down Expand Up @@ -650,8 +651,8 @@ def _evaluate_Fx_facts(V,pq ,svc_buses=None, svc_set_vm_pu=None, tcsc_controllab

vsc_p = np.isin(vsc_dc_bus, vsc_dc_p_bus)
vsc_ref = np.isin(vsc_dc_bus, vsc_dc_ref_bus)
vsc_b2b_p = np.isin(vsc_dc_bus, vsc_dc_b2b_bus) & (vsc_mode_dc == 1)
vsc_b2b_ref = np.isin(vsc_dc_bus, vsc_dc_b2b_bus) & (vsc_mode_dc == 0)
vsc_b2b_p = np.isin(vsc_dc_bus, vsc_dc_b2b_bus) & (vsc_mode_dc == VSC_MODE_DC_P)
vsc_b2b_ref = np.isin(vsc_dc_bus, vsc_dc_b2b_bus) & (vsc_mode_dc == VSC_MODE_DC_V)

unique_vsc_dc_bus, c_ref, c_b2b_ref = _sum_by_group(vsc_dc_bus, vsc_ref.astype(np.float64), vsc_b2b_ref.astype(np.float64))
count_ref = np.zeros(vsc_dc_bus.max()+1, dtype=np.int64)
Expand Down
Loading

0 comments on commit f96e9cd

Please sign in to comment.