code: def s_demand(self, bus):
          
          Svl = array([complex(g.p, g.q) for g in self.generators if
                      (g.bus == bus) and g.is_load], dtype=complex64)
  
          Sd = complex(bus.p_demand, bus.q_demand)
  
          return -sum(Svl) + Sd
docs: Returns the total complex power demand.