Skip to content

Commit

Permalink
added test for ppc ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
WinfriedL committed Oct 9, 2018
1 parent 4819ea4 commit 08b2565
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pandapower/test/loadflow/result_test_network_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def result_test_network_generator(sn_kva=1e3, skip_test_impedance=False):
yield add_test_xward(net)
yield add_test_xward_combination(net)
yield add_test_gen(net)
yield add_test_ppc_gen_order(net)
yield add_test_ext_grid_gen_switch(net)
yield add_test_enforce_qlims(net)
yield add_test_trafo3w(net)
Expand Down Expand Up @@ -262,6 +263,21 @@ def add_test_gen(net):
net.last_added_case = "test_gen"
return net

def add_test_ppc_gen_order(net):
b_ids=[]
for b in range(6):
b_ids.append(pp.create_bus(net,vn_kv=1., name=b, zone='test_gen_order'))

for l_bus in [b_ids[0],b_ids[2],b_ids[4]]:
pp.create_line(net, from_bus=l_bus, to_bus=l_bus+1, length_km=1, std_type="48-AL1/8-ST1A 10.0")

for slack_bus in [b_ids[0],b_ids[2],b_ids[5]]:
pp.create_ext_grid(net, bus=slack_bus, vm_pu=1.)

for gen_bus in [ b_ids[x] for x in [ 0, 1, 2, 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5]]:
pp.create_gen(net, bus=gen_bus, p_kw=-1, vm_pu=1.)

net.last_added_case = "test_gen_order"

def add_test_enforce_qlims(net):
b1, b2, ln = add_grid_connection(net, zone="test_enforce_qlims")
Expand Down
8 changes: 8 additions & 0 deletions pandapower/test/loadflow/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,14 @@ def test_gen(result_test_network, v_tol=1e-6, i_tol=1e-6, s_tol=5e-3, l_tol=1e-3
assert abs(net.res_bus.vm_pu.at[b3] - u_set) < v_tol
assert abs(net.res_gen.q_kvar.at[g1] - (-q)) < s_tol

def test_gen_order(result_test_network, v_tol=1e-6, i_tol=1e-6, s_tol=5e-3, l_tol=1e-3):
net=result_test_network
bus_mask=net.bus.zone=='test_gen_order'
gen_mask=net.gen.bus.isin(net.bus[bus_mask].index)
xgrid_mask=net.ext_grid.bus.isin(net.bus[bus_mask].index)

assert all(net.res_gen[gen_mask].p_kw==net.gen[gen_mask].p_kw)
assert all(net.res_ext_grid[xgrid_mask].p_kw>0)

def test_enforce_qlims(result_test_network, v_tol=1e-6, i_tol=1e-6, s_tol=5e-3, l_tol=1e-3):
net = result_test_network
Expand Down

0 comments on commit 08b2565

Please sign in to comment.