e2nIEE / pandapower

Compare 2b03f8a ... +5 ... 050cddd

Coverage Reach
pandapower/pypower/pips.py pandapower/pypower/opf_model.py pandapower/pypower/dcopf_solver.py pandapower/pypower/opf_setup.py pandapower/pypower/pipsopf_solver.py pandapower/pypower/opf_execute.py pandapower/pypower/newtonpf.py pandapower/pypower/opf_args.py pandapower/pypower/opf_consfcn.py pandapower/pypower/fdpf.py pandapower/pypower/pfsoln.py pandapower/pypower/opf_hessfcn.py pandapower/pypower/gausspf.py pandapower/pypower/opf_costfcn.py pandapower/pypower/dSbr_dV.py pandapower/pypower/makePTDF.py pandapower/pypower/qps_pips.py pandapower/pypower/makeApq.py pandapower/pypower/makeAy.py pandapower/pypower/makeAvl.py pandapower/pypower/makeYbus.py pandapower/pypower/makeBdc.py pandapower/pypower/makeSbus.py pandapower/pypower/totcost.py pandapower/pypower/opf.py pandapower/pypower/makeAang.py pandapower/pypower/polycost.py pandapower/pypower/idx_gen.py pandapower/pypower/qps_pypower.py pandapower/pypower/idx_bus.py pandapower/pypower/idx_brch.py pandapower/pypower/dSbus_dV.py pandapower/pypower/makeB.py pandapower/pypower/d2Sbus_dV2.py pandapower/pypower/dIbr_dV.py pandapower/pypower/hasPQcap.py pandapower/pypower/d2Sbr_dV2.py pandapower/pypower/add_userfcn.py pandapower/pypower/makeLODF.py pandapower/pypower/update_mupq.py pandapower/pypower/ppoption.py pandapower/pypower/run_userfcn.py pandapower/pypower/pqcost.py pandapower/pypower/util.py pandapower/pypower/d2ASbr_dV2.py pandapower/pypower/dAbr_dV.py pandapower/pypower/d2AIbr_dV2.py pandapower/pypower/d2Ibr_dV2.py pandapower/pypower/dcpf.py pandapower/pypower/printpf.py pandapower/pypower/bustypes.py pandapower/pypower/idx_cost.py pandapower/pypower/ppver.py pandapower/pypower/pipsver.py pandapower/pypower/isload.py pandapower/pypower/idx_area.py pandapower/pypower/_compat.py pandapower/pypower/__init__.py pandapower/toolbox.py pandapower/networks/cigre_networks.py pandapower/networks/create_examples.py pandapower/networks/power_system_test_cases.py pandapower/networks/dickert_lv_networks.py pandapower/networks/kerber_networks.py pandapower/networks/simple_pandapower_test_networks.py pandapower/networks/synthetic_voltage_control_lv_networks.py pandapower/networks/kerber_extreme_networks.py pandapower/networks/mv_oberrhein.py pandapower/networks/ieee_europen_lv_asymmetric.py pandapower/networks/__init__.py pandapower/estimation/algorithm/base.py pandapower/estimation/algorithm/estimator.py pandapower/estimation/algorithm/matrix_base.py pandapower/estimation/algorithm/lp.py pandapower/estimation/algorithm/optimization.py pandapower/estimation/ppc_conversion.py pandapower/estimation/util.py pandapower/estimation/state_estimation.py pandapower/estimation/results.py pandapower/estimation/idx_brch.py pandapower/estimation/idx_bus.py pandapower/estimation/__init__.py pandapower/pf/run_bfswpf.py pandapower/pf/runpp_3ph.py pandapower/pf/runpf_pypower.py pandapower/pf/run_newton_raphson_pf.py pandapower/pf/create_jacobian.py pandapower/pf/pfsoln_numba.py pandapower/pf/run_dc_pf.py pandapower/pf/iwamoto_multiplier.py pandapower/pf/makeYbus_numba.py pandapower/pf/ppci_variables.py pandapower/pf/dSbus_dV_numba.py pandapower/pf/no_numba.py pandapower/pf/create_jacobian_numba.py pandapower/shortcircuit/ppc_conversion.py pandapower/shortcircuit/currents.py pandapower/shortcircuit/results.py pandapower/shortcircuit/calc_sc.py pandapower/shortcircuit/kappa.py pandapower/shortcircuit/toolbox.py pandapower/shortcircuit/impedance.py pandapower/shortcircuit/idx_bus.py pandapower/shortcircuit/idx_brch.py pandapower/shortcircuit/__init__.py pandapower/control/controller/trafo/DiscreteTapControl.py pandapower/control/controller/trafo/ContinuousTapControl.py pandapower/control/controller/trafo/u_setofp.py pandapower/control/controller/trafo/USetTapControl.py pandapower/control/controller/characteristic_control.py pandapower/control/controller/const_control.py pandapower/control/controller/trafo_control.py pandapower/control/util/auxiliary.py pandapower/control/util/diagnostic.py pandapower/control/util/characteristic.py pandapower/control/util/__init__.py pandapower/control/run_control.py pandapower/control/basic_controller.py pandapower/control/__init__.py pandapower/timeseries/output_writer.py pandapower/timeseries/run_time_series.py pandapower/timeseries/ts_runpp.py pandapower/timeseries/read_batch_results.py pandapower/timeseries/data_sources/frame_data.py pandapower/timeseries/data_sources/__init__.py pandapower/timeseries/data_source.py pandapower/timeseries/__init__.py pandapower/converter/pypower/from_ppc.py pandapower/converter/pypower/to_ppc.py pandapower/converter/pypower/__init__.py pandapower/converter/powermodels/to_pm.py pandapower/converter/powermodels/from_pm.py pandapower/converter/powermodels/__init__.py pandapower/converter/matpower/from_mpc.py pandapower/converter/matpower/to_mpc.py pandapower/converter/matpower/__init__.py pandapower/converter/__init__.py pandapower/io_utils.py pandapower/create.py pandapower/auxiliary.py pandapower/build_branch.py pandapower/diagnostic.py pandapower/results_branch.py pandapower/build_bus.py pandapower/topology/create_graph.py pandapower/topology/graph_searches.py pandapower/topology/graph_tool_interface.py pandapower/topology/__init__.py pandapower/diagnostic_reports.py pandapower/results_bus.py pandapower/pd2ppc_zero.py pandapower/convert_format.py pandapower/build_gen.py pandapower/results_gen.py pandapower/opf/make_objective.py pandapower/opf/pm_storage.py pandapower/opf/validate_opf_input.py pandapower/opf/run_powermodels.py pandapower/file_io.py pandapower/pd2ppc.py pandapower/results.py pandapower/powerflow.py pandapower/std_types.py pandapower/run.py pandapower/optimal_powerflow.py pandapower/runpm.py pandapower/__init__.py setup.py

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -7,12 +7,10 @@
Loading
7 7
import numpy as np
8 8
import pandas as pd
9 9
from pandapower.auxiliary import _sum_by_group, I_from_SV_elementwise, sequence_to_phase, S_from_VI_elementwise
10 -
from pandapower.auxiliary import _sum_by_group
11 10
from pandapower.pypower.idx_brch import F_BUS, T_BUS, PF, QF, PT, QT, BR_R
12 11
from pandapower.pypower.idx_bus import BASE_KV, VM, VA
13 12
14 13
15 -
16 14
def _get_branch_results(net, ppc, bus_lookup_aranged, pq_buses, suffix=None):
17 15
    """
18 16
    Extract the branch results and writes it in the Dataframe net.res_line,  net.res_trafo, net.res_trafo3w...
@@ -62,7 +60,7 @@
Loading
62 60
    # _get_xward_branch_results(net, ppc, bus_lookup_aranged, pq_buses)
63 61
    # _get_switch_results(net, i_ft)
64 62
65 -
																			 
63 +
66 64
def _get_branch_flows(ppc):
67 65
    br_idx = ppc["branch"][:, (F_BUS, T_BUS)].real.astype(int)
68 66
    vm_ft = ppc["bus"][br_idx, VM] * ppc["bus"][br_idx, BASE_KV]
@@ -76,17 +74,17 @@
Loading
76 74
    br_from_idx = ppc1["branch"][:, F_BUS].real.astype(int)
77 75
    br_to_idx = ppc1["branch"][:, T_BUS].real.astype(int)
78 76
    V012_f = np.array([(ppc["bus"][br_from_idx, VM] * ppc["bus"][br_from_idx, BASE_KV] *
79 -
                         np.exp(1j * np.deg2rad(ppc["bus"][br_from_idx, VA]))).flatten() for ppc in [ppc0, ppc1, ppc2]])
77 +
                        np.exp(1j * np.deg2rad(ppc["bus"][br_from_idx, VA]))).flatten() for ppc in [ppc0, ppc1, ppc2]])
80 78
    V012_t = np.array([(ppc["bus"][br_to_idx, VM] * ppc["bus"][br_to_idx, BASE_KV] *
81 -
                         np.exp(1j * np.deg2rad(ppc["bus"][br_to_idx, VA]))).flatten() for ppc in [ppc0, ppc1, ppc2]])
79 +
                        np.exp(1j * np.deg2rad(ppc["bus"][br_to_idx, VA]))).flatten() for ppc in [ppc0, ppc1, ppc2]])
82 80
    S012_f = np.array([((ppc["branch"][:, PF].real +
83 -
                    1j * ppc["branch"][:, QF].real) )
84 -
                    for ppc in [ppc0, ppc1, ppc2]])
81 +
                         1j * ppc["branch"][:, QF].real))
82 +
                       for ppc in [ppc0, ppc1, ppc2]])
85 83
    S012_t = np.array([((ppc["branch"][:, PT].real +
86 -
                    1j * ppc["branch"][:, QT].real) )
87 -
                    for ppc in [ppc0, ppc1, ppc2]])
88 -
    I012_f = I_from_SV_elementwise(S012_f , V012_f / np.sqrt(3))
89 -
    I012_t = I_from_SV_elementwise(S012_t , V012_t / np.sqrt(3))
84 +
                         1j * ppc["branch"][:, QT].real))
85 +
                       for ppc in [ppc0, ppc1, ppc2]])
86 +
    I012_f = I_from_SV_elementwise(S012_f, V012_f / np.sqrt(3))
87 +
    I012_t = I_from_SV_elementwise(S012_t, V012_t / np.sqrt(3))
90 88
91 89
    return I012_f, S012_f, V012_f, I012_t, S012_t, V012_t
92 90
@@ -123,7 +121,7 @@
Loading
123 121
    to_bus = ppc["branch"][f:t, T_BUS].real.astype(int)
124 122
125 123
    # write to line
126 -
    res_line_df = net["res_line"] if suffix is None else net["res_line%s"%suffix]
124 +
    res_line_df = net["res_line"] if suffix is None else net["res_line%s" % suffix]
127 125
128 126
    res_line_df["p_from_mw"].values[:] = p_from_mw
129 127
    res_line_df["q_from_mvar"].values[:] = q_from_mvar
@@ -177,15 +175,15 @@
Loading
177 175
    else:
178 176
        Pabcl_mw = np.zeros_like(Pabcf_mw)
179 177
        Qabcl_mvar = np.zeros_like(Qabct_mvar)
180 -
    
181 -
    #getting complex values of the sequence current line   
178 +
179 +
    # getting complex values of the sequence current line
182 180
    Iabc_f_ka_complex = sequence_to_phase(I012_from_ka)
183 181
    Iabc_t_ka_complex = sequence_to_phase(I012_to_ka)
184 -
    
182 +
185 183
    Iabc_f_ka = np.abs(Iabc_f_ka_complex)
186 184
    Iabc_t_ka = np.abs(Iabc_t_ka_complex)
187 185
    Iabc_ka = np.maximum.reduce([Iabc_t_ka, Iabc_f_ka])
188 -
    
186 +
189 187
    In_f_ka_complex = Iabc_f_ka_complex.sum(axis=0)
190 188
    In_f_ka = np.abs(In_f_ka_complex)
191 189
#    In_f_ia_n_degree = np.angle(In_f_ka_complex).flatten()*180/np.pi
@@ -306,9 +304,9 @@
Loading
306 304
    trafo_df = net["trafo"]
307 305
308 306
    Vabc_hv, Vabc_lv, Iabc_hv, Iabc_lv = [sequence_to_phase(X012) for X012 in
309 -
                                      [V012_f[:, f:t], V012_t[:, f:t], I012_f[:, f:t], I012_t[:, f:t]]]
307 +
                                          [V012_f[:, f:t], V012_t[:, f:t], I012_f[:, f:t], I012_t[:, f:t]]]
310 308
    Sabc_hv, Sabc_lv = [S_from_VI_elementwise(*Xabc_tup) / np.sqrt(3) for Xabc_tup in
311 -
                      [(Vabc_hv, Iabc_hv), (Vabc_lv, Iabc_lv)]]
309 +
                        [(Vabc_hv, Iabc_hv), (Vabc_lv, Iabc_lv)]]
312 310
    # Todo: Check why the sqrt(3) is necessary in the previous line as opposed to _get_line_results()
313 311
    Pabc_hv_mw = Sabc_hv.real
314 312
    Qabc_hv_mvar = Sabc_hv.imag
@@ -320,25 +318,71 @@
Loading
320 318
    else:
321 319
        Pabcl_mw = np.zeros_like(Pabc_hv_mw)
322 320
        Qabcl_mvar = np.zeros_like(Qabc_lv_mvar)
323 -
        
321 +
324 322
    Iabc_hv_ka = np.abs(sequence_to_phase(I012_hv_ka))
325 323
    Iabc_lv_ka = np.abs(sequence_to_phase(I012_lv_ka))
326 -
    
327 -
    #geting complex values of the sequence current    
324 +
325 +
    # current calculation for trafo lv side for vector groups with zero seq. gap (Dyn, Yzn)
326 +
    # in this case, the currents of elemnts that go out from the trafo are summed and the sum applied to the trafo lv side
327 +
    gap_trafo_index = np.where(I012_lv_ka[0] == 0)[0]
328 +
    if len(gap_trafo_index > 0):
329 +
        for i_trafo in gap_trafo_index:
330 +
            Iabc_sum = [0, 0, 0]
331 +
            lv_bus = net.trafo.lv_bus[i_trafo]
332 +
            V_bus_abc = np.array([[net.res_bus_3ph['vm_a_pu'][lv_bus] * net.bus['vn_kv'][lv_bus]],
333 +
                                  [net.res_bus_3ph['vm_b_pu'][lv_bus] * net.bus['vn_kv'][lv_bus]],
334 +
                                  [net.res_bus_3ph['vm_c_pu'][lv_bus] * net.bus['vn_kv'][lv_bus]]])
335 +
336 +
            # Branch Elements
337 +
            i_branch = np.where(ppc0['branch'][:, F_BUS] == lv_bus)[0]
338 +
            if len(i_branch > 0):
339 +
                I_branch_012 = I012_f[:, i_branch]
340 +
                I_branch_abc = sequence_to_phase(I_branch_012)
341 +
                for x in range(len(I_branch_abc[0])):
342 +
                    Iabc_sum += abs(I_branch_abc[:, x])
343 +
344 +
            # Loads
345 +
            load_index = np.where(net.asymmetric_load['bus'] == lv_bus)[0]
346 +
            if len(load_index > 0):
347 +
                S_load_abc = abs(np.array([net.res_asymmetric_load_3ph['p_a_mw'][load_index]
348 +
                                           + (1j * net.res_asymmetric_load_3ph['q_a_mvar'][load_index]),
349 +
                                           net.res_asymmetric_load_3ph['p_b_mw'][load_index]
350 +
                                           + (1j * net.res_asymmetric_load_3ph['q_b_mvar'][load_index]),
351 +
                                           net.res_asymmetric_load_3ph['p_c_mw'][load_index]
352 +
                                           + (1j * net.res_asymmetric_load_3ph['q_c_mvar'][load_index])]))
353 +
                I_load_abc = S_load_abc / (V_bus_abc / np.sqrt(3))
354 +
                for x in range(len(I_load_abc[0])):
355 +
                    Iabc_sum += I_load_abc[:, x]
356 +
357 +
            # Sgens
358 +
            sgen_bus_index = np.where(net.asymmetric_sgen['bus'] == lv_bus)[0]
359 +
            if len(sgen_bus_index > 0):
360 +
                S_sgen_abc = abs(np.array([net.res_asymmetric_sgen_3ph['p_a_mw'][sgen_bus_index]
361 +
                                           + (1j * net.res_asymmetric_sgen_3ph['q_a_mvar'][sgen_bus_index]),
362 +
                                           net.res_asymmetric_sgen_3ph['p_b_mw'][sgen_bus_index]
363 +
                                           + (1j * net.res_asymmetric_sgen_3ph['q_b_mvar'][sgen_bus_index]),
364 +
                                           net.res_asymmetric_sgen_3ph['p_c_mw'][sgen_bus_index]
365 +
                                           + (1j * net.res_asymmetric_sgen_3ph['q_c_mvar'][sgen_bus_index])]))
366 +
                I_sgen_abc = S_sgen_abc / (V_bus_abc / np.sqrt(3))
367 +
                for x in range(len(I_sgen_abc[0])):
368 +
                    Iabc_sum -= I_sgen_abc[:, x]
369 +
370 +
            Iabc_lv_ka[:, i_trafo] = Iabc_sum
371 +
372 +
    # geting complex values of the sequence current
328 373
#    Iabc_hv_ka_complex = sequence_to_phase(I012_hv_ka)
329 374
#    Iabc_lv_ka_complex = sequence_to_phase(I012_lv_ka)
330 -
#    
375 +
#
331 376
#    Iabc_hv_ka = np.abs(Iabc_hv_ka_complex)
332 377
#    Iabc_lv_ka = np.abs(Iabc_lv_ka_complex)
333 -
#   
378 +
#
334 379
#    In_hv_ka_complex = Iabc_hv_ka_complex.sum(axis=0)
335 380
#    In_hv_ka = np.abs(In_hv_ka_complex)
336 381
#    In_hv_ia_n_degree = np.angle(In_hv_ka_complex).flatten()*180/np.pi
337 382
#    In_lv_ka_complex = Iabc_lv_ka_complex.sum(axis=0)
338 383
#    In_lv_ka = np.abs(In_lv_ka_complex)
339 384
#    In_lv_ia_n_degree = np.angle(In_lv_ka_complex).flatten()*180/np.pi
340 385
341 -
342 386
    if trafo_loading == "current":
343 387
        trafo_df = net["trafo"]
344 388
        vns = np.vstack([trafo_df["vn_hv_kv"].values, trafo_df["vn_lv_kv"].values]).T
@@ -390,7 +434,6 @@
Loading
390 434
    res_trafo_df.index = net["trafo"].index.values
391 435
392 436
393 -
394 437
def _get_trafo3w_lookups(net):
395 438
    f, t = net._pd2ppc_lookups["branch"]["trafo3w"]
396 439
    hv = int(f + (t - f) / 3)
@@ -456,7 +499,7 @@
Loading
456 499
    lv_buses = ppc["branch"][mv:lv, T_BUS].real.astype(int)
457 500
458 501
    # write results to trafo3w dataframe
459 -
    res_trafo3w_df = net["res_trafo3w"] if suffix is None else net["res_trafo3w%s"%suffix]
502 +
    res_trafo3w_df = net["res_trafo3w"] if suffix is None else net["res_trafo3w%s" % suffix]
460 503
461 504
    res_trafo3w_df["p_hv_mw"].values[:] = p_hv_mw
462 505
    res_trafo3w_df["q_hv_mvar"].values[:] = q_hv_mvar
@@ -480,7 +523,6 @@
Loading
480 523
    res_trafo3w_df["loading_percent"].values[:] = loading_percent
481 524
482 525
483 -
484 526
def _get_impedance_results(net, ppc, i_ft, suffix=None):
485 527
    ac = net["_options"]["ac"]
486 528
@@ -510,7 +552,7 @@
Loading
510 552
    i_to_ka = i_ft[f:t][:, 1]
511 553
512 554
    # write to impedance
513 -
    res_impedance_df = net["res_impedance"] if suffix is None else net["res_impedance%s"%suffix]
555 +
    res_impedance_df = net["res_impedance"] if suffix is None else net["res_impedance%s" % suffix]
514 556
515 557
    res_impedance_df["p_from_mw"].values[:] = p_from_mw
516 558
    res_impedance_df["q_from_mvar"].values[:] = q_from_mvar
@@ -522,7 +564,6 @@
Loading
522 564
    res_impedance_df["i_to_ka"].values[:] = i_to_ka
523 565
524 566
525 -
526 567
def _get_xward_branch_results(net, ppc, bus_lookup_aranged, pq_buses, suffix=None):
527 568
    ac = net["_options"]["ac"]
528 569
@@ -550,7 +591,6 @@
Loading
550 591
    res_xward_df.index = net["xward"].index
551 592
552 593
553 -
554 594
def _get_switch_results(net, i_ft, suffix=None):
555 595
    if not "switch" in net._pd2ppc_lookups["branch"]:
556 596
        return

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
pandapower 0.02% 87.69%
setup.py 0.00%
Project Totals (168 files) 87.62%
Loading