code: def get_voltage_delta_branch(grid, tree, node, r_preceeding, x_preceeding):
      
      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')
      omega = 2 * math.pi * 50
  
      # add resitance/ reactance to preceeding
      in_edge = [_ for _ in grid.graph_branches_from_node(node) if
                 _[0] in list(tree.predecessors(node))][0][1]
      r = r_preceeding + (in_edge['branch'].type['R'] *
                       in_edge['branch'].length)
      x = x_preceeding + (in_edge['branch'].type['L'] / 1e3 * omega *
                       in_edge['branch'].length)
  
      # get apparent power for load and generation case
      peak_load, gen_capacity = get_house_conn_gen_load(tree, node)
      s_max_load = peak_load / cos_phi_load
      s_max_feedin = gen_capacity / cos_phi_feedin
  
      # determine voltage increase/ drop a node
      voltage_delta_load = voltage_delta_vde(v_nom, s_max_load, r, x,
                                             cos_phi_load)
      voltage_delta_gen = voltage_delta_vde(v_nom, s_max_feedin, r, -x,
                                            cos_phi_feedin)
  
      return [voltage_delta_load, voltage_delta_gen, r, x]
docs: Determine voltage for a preceeding branch (edge) of node
  
      Parameters
      ----------
      grid : LVGridDing0
          Ding0 grid object
      tree : :networkx:`NetworkX Graph Obj< >`
          Tree of grid topology
      node : graph node
          Node to determine voltage level at
      r_preceeding : float
          Resitance of preceeding grid
      x_preceeding : float
          Reactance of preceeding grid
  
      Return
      ------
      :any:`float`
          Delta voltage for node