@@ -54,7 +54,7 @@
Loading
54 54
55 55
    def __init__(self, net, element, variable, element_index, profile_name=None, data_source=None,
56 56
                 scale_factor=1.0, in_service=True, recycle=True, order=0, level=0,
57 -
                 drop_same_existing_ctrl=False, set_q_from_cosphi=False, matching_params=None,
57 +
                 drop_same_existing_ctrl=False, matching_params=None,
58 58
                 initial_run=False, **kwargs):
59 59
        # just calling init of the parent
60 60
        if matching_params is None:
@@ -75,9 +75,6 @@
Loading
75 75
        self.values = None
76 76
        self.profile_name = profile_name
77 77
        self.scale_factor = scale_factor
78 -
        if set_q_from_cosphi:
79 -
            logger.error("Parameter set_q_from_cosphi deprecated!")
80 -
            raise ValueError
81 78
        self.applied = False
82 79
        # write functions faster, depending on type of self.element_index
83 80
        if isinstance(self.element_index, int):

@@ -2650,6 +2650,7 @@
Loading
2650 2650
    new_idx (int) - index of the created power line
2651 2651
2652 2652
    """
2653 +
2653 2654
    # impedance before changing the standard type
2654 2655
    r0 = net.line.at[idx, "r_ohm_per_km"]
2655 2656
    p0 = net.line.at[idx, "parallel"]
@@ -2663,22 +2664,21 @@
Loading
2663 2664
2664 2665
    # impedance after changing the standard type
2665 2666
    r1 = net.line.at[idx, "r_ohm_per_km"]
2666 -
    p1 = net.line.at[idx, "parallel"]
2667 2667
    x1 = net.line.at[idx, "x_ohm_per_km"]
2668 2668
    c1 = net.line.at[idx, "c_nf_per_km"]
2669 2669
    g1 = net.line.at[idx, "g_us_per_km"]
2670 2670
    i_ka1 = net.line.at[idx, "max_i_ka"]
2671 2671
2672 2672
    # complex resistance of the line parallel to the existing line
2673 -
    y1 = p1 / complex(r1, x1)
2673 +
    y1 = 1 / complex(r1, x1)
2674 2674
    y0 = p0 / complex(r0, x0)
2675 2675
    z2 = 1 / (y1 - y0)
2676 2676
2677 2677
    # required parameters
2678 -
    c_nf_per_km = c1 * p1 - c0 * p0
2678 +
    c_nf_per_km = c1 * 1 - c0 * p0
2679 2679
    r_ohm_per_km = z2.real
2680 2680
    x_ohm_per_km = z2.imag
2681 -
    g_us_per_km = g1 * p1 - g0 * p0
2681 +
    g_us_per_km = g1 * 1 - g0 * p0
2682 2682
    max_i_ka = i_ka1 - i_ka0
2683 2683
    name = "repl_" + str(idx) if name is None else name
2684 2684
@@ -2692,4 +2692,58 @@
Loading
2692 2692
                                          in_service=in_service, name=name, **kwargs)
2693 2693
    # restore the previous line parameters before changing the standard type
2694 2694
    net.line.loc[idx, :] = bak
2695 +
2696 +
    # check switching state and add line switch if necessary:
2697 +
    for bus in net.line.at[idx, "to_bus"], net.line.at[idx, "from_bus"]:
2698 +
        if bus in net.switch[(net.switch.closed == False) & (net.switch.element == idx) & (net.switch.et == "l")].bus.values:
2699 +
            create_switch(net, bus=bus, element=new_idx, closed=False, et="l", type="LBS")
2700 +
2695 2701
    return new_idx
2702 +
2703 +
2704 +
def merge_parallel_line(net, idx):
2705 +
    """
2706 +
    Changes the impedances of the parallel line so that it equals a single line.
2707 +
    Args:
2708 +
        net: pandapower net
2709 +
        idx: idx of the line to merge
2710 +
2711 +
    Returns:
2712 +
        net
2713 +
2714 +
    Z0 = impedance of the existing parallel lines
2715 +
    Z1 = impedance of the respective single line
2716 +
2717 +
        --- Z0 ---
2718 +
    ---|         |---   =  --- Z1 ---
2719 +
       --- Z0 ---
2720 +
2721 +
    """
2722 +
    # impedance before changing the standard type
2723 +
2724 +
    r0 = net.line.at[idx, "r_ohm_per_km"]
2725 +
    p0 = net.line.at[idx, "parallel"]
2726 +
    x0 = net.line.at[idx, "x_ohm_per_km"]
2727 +
    c0 = net.line.at[idx, "c_nf_per_km"]
2728 +
    g0 = net.line.at[idx, "g_us_per_km"]
2729 +
    i_ka0 = net.line.at[idx, "max_i_ka"]
2730 +
2731 +
    # complex resistance of the line to the existing line
2732 +
    y0 = 1 / complex(r0, x0)
2733 +
    y1 = p0*y0
2734 +
    z1 = 1 / y1
2735 +
    r1 = z1.real
2736 +
    x1 = z1.imag
2737 +
2738 +
    g1 = p0*g0
2739 +
    c1 = p0*c0
2740 +
    i_ka1 = p0*i_ka0
2741 +
2742 +
    net.line.at[idx, "r_ohm_per_km"] = r1
2743 +
    net.line.at[idx, "parallel"] = 1
2744 +
    net.line.at[idx, "x_ohm_per_km"] = x1
2745 +
    net.line.at[idx, "c_nf_per_km"] = c1
2746 +
    net.line.at[idx, "g_us_per_km"] = g1
2747 +
    net.line.at[idx, "max_i_ka"] = i_ka1
2748 +
2749 +
    return net
Files Coverage
pandapower 87.71%
setup.py 0.00%
Project Totals (162 files) 87.63%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading