code: def solveNetwork(self, Xgen, augYbus_solver, gbus):
          
          generators = self.dyn_generators
          j = 0 + 1j
  
          ng = len(gbus)
          Igen = zeros(ng)
  
          s = len(augYbus_solver)
          Ig = zeros(s)
  
          # Define generator types.
          typ1 = [g._i for g in generators if g.model == CLASSICAL]
          typ2 = [g._i for g in generators if g.model == FOURTH_ORDER]
  
          # Generator type 1: classical model
          delta = Xgen[typ1, 0]
          Eq_tr = Xgen[typ1, 2]
  
          xd_tr = array([g.xd_tr for g in generators])[typ1]
  
          # Calculate generator currents
          Igen[typ1] = (Eq_tr * exp(j * delta)) / (j * xd_tr)
  
          # Generator type 2: 4th order model
          delta = Xgen[typ2, 0]
          Eq_tr = Xgen[typ2, 2]
          Ed_tr = Xgen[typ2, 3]
  
          xd_tr = array([g.xd_tr for g in generators])[typ2] # Pgen(type2,8)
  
          # Calculate generator currents. (Padiyar, p.417.)
          Igen[typ2] = (Eq_tr + j * Ed_tr) * exp(j * delta) / (j * xd_tr)
  
          # Calculations --------------------------------------------------------
  
          # Generator currents
          Ig[gbus] = Igen
  
          # Calculate network voltages: U = Y/Ig
          U = augYbus_solver.solve(Ig)
  
          return U
docs: Based on SolveNetwork.m from MatDyn by Stijn Cole, developed at
          Katholieke Universiteit Leuven. See U{http://www.esat.kuleuven.be/
          electa/teaching/matdyn/} for more information.
  
          @rtype: array
          @return: Bus voltages.