def get_voltage_at_bus_bar(grid, tree):
    """
    Determine voltage level at bus bar of MV-LV substation

    Parameters
    ----------
    grid : LVGridDing0
        Ding0 grid object
    tree : :networkx:`NetworkX Graph Obj< >`
        Tree of grid topology:

    Returns
    -------
    :any:`list`
        Voltage at bus bar. First item refers to load case, second item refers
        to voltage in feedin (generation) case
    """

    # voltage at substation bus bar
    r_mv_grid, x_mv_grid = get_mv_impedance(grid)

    r_trafo = sum([tr.r for tr in grid._station._transformers])
    x_trafo = sum([tr.x for tr in grid._station._transformers])

    cos_phi_load = cfg_ding0.get('assumptions', 'cos_phi_load')
    cos_phi_feedin = cfg_ding0.get('assumptions', 'cos_phi_gen')
    v_nom = cfg_ding0.get('assumptions', 'lv_nominal_voltage')

    # loads and generators connected to bus bar
    bus_bar_load = sum(
        [node.peak_load for node in tree.successors(grid._station)
         if isinstance(node, LVLoadDing0)]) / cos_phi_load
    bus_bar_generation = sum(
        [node.capacity for node in tree.successors(grid._station)
         if isinstance(node, GeneratorDing0)]) / cos_phi_feedin

    v_delta_load_case_bus_bar = voltage_delta_vde(v_nom,
                                                  bus_bar_load,
                                                  (r_mv_grid + r_trafo),
                                                  (x_mv_grid + x_trafo),
                                                  cos_phi_load)
    v_delta_gen_case_bus_bar = voltage_delta_vde(v_nom,
                                                 bus_bar_generation,
                                                 (r_mv_grid + r_trafo),
                                                 -(x_mv_grid + x_trafo),
                                                 cos_phi_feedin)

    return v_delta_load_case_bus_bar, v_delta_gen_case_bus_bar
def get_voltage_at_bus_bar ( grid , tree ) : r_mv_grid , x_mv_grid = get_mv_impedance ( grid ) r_trafo = sum ( [ tr . r for tr in grid . _station . _transformers ] ) x_trafo = sum ( [ tr . x for tr in grid . _station . _transformers ] ) cos_phi_load = cfg_ding0 . get ( 'assumptions' , 'cos_phi_load' ) cos_phi_feedin = cfg_ding0 . get ( 'assumptions' , 'cos_phi_gen' ) v_nom = cfg_ding0 . get ( 'assumptions' , 'lv_nominal_voltage' ) bus_bar_load = sum ( [ node . peak_load for node in tree . successors ( grid . _station ) if isinstance ( node , LVLoadDing0 ) ] ) / cos_phi_load bus_bar_generation = sum ( [ node . capacity for node in tree . successors ( grid . _station ) if isinstance ( node , GeneratorDing0 ) ] ) / cos_phi_feedin v_delta_load_case_bus_bar = voltage_delta_vde ( v_nom , bus_bar_load , ( r_mv_grid + r_trafo ) , ( x_mv_grid + x_trafo ) , cos_phi_load ) v_delta_gen_case_bus_bar = voltage_delta_vde ( v_nom , bus_bar_generation , ( r_mv_grid + r_trafo ) , - ( x_mv_grid + x_trafo ) , cos_phi_feedin ) return v_delta_load_case_bus_bar , v_delta_gen_case_bus_bar
Determine voltage level at bus bar of MV-LV substation

    Parameters
    ----------
    grid : LVGridDing0
        Ding0 grid object
    tree : :networkx:`NetworkX Graph Obj< >`
        Tree of grid topology:

    Returns
    -------
    :any:`list`
        Voltage at bus bar. First item refers to load case, second item refers
        to voltage in feedin (generation) case