Runs a power flow

        @rtype: dict
        @return: Solution dictionary with the following keys:
                   - C{V} - final complex voltages
                   - C{converged} - boolean value indicating if the solver
                     converged or not
                   - C{iterations} - the number of iterations performed

def solve(self):
        """ Runs a power flow

        @rtype: dict
        @return: Solution dictionary with the following keys:
                   - C{V} - final complex voltages
                   - C{converged} - boolean value indicating if the solver
                     converged or not
                   - C{iterations} - the number of iterations performed
        """
        # Zero result attributes.
        self.case.reset()

        # Retrieve the contents of the case.
        b, l, g, _, _, _, _ = self._unpack_case(self.case)

        # Update bus indexes.
        self.case.index_buses(b)

        # Index buses accoding to type.
#        try:
#            _, pq, pv, pvpq = self._index_buses(b)
#        except SlackBusError:
#            logger.error("Swing bus required for DCPF.")
#            return {"converged": False}

        refs, pq, pv, pvpq = self._index_buses(b)
        if len(refs) != 1:
            logger.error("Swing bus required for DCPF.")
            return {"converged": False}

        # Start the clock.
        t0 = time()

        # Build the vector of initial complex bus voltages.
        V0 = self._initial_voltage(b, g)

        # Save index and angle of original reference bus.
#        if self.qlimit:
#            ref0 = ref
#            Varef0 = b[ref0].Va
#            # List of buses at Q limits.
#            limits = []
#            # Qg of generators at Q limits.
#            fixedQg = matrix(0.0, (g.size[0], 1))

        repeat = True
        while repeat:
            # Build admittance matrices.
            Ybus, Yf, Yt = self.case.getYbus(b, l)

            # Compute complex bus power injections (generation - load).
            Sbus = self.case.getSbus(b)

            # Run the power flow.
            V, converged, i = self._run_power_flow(Ybus, Sbus, V0, pv, pq, pvpq)

            # Update case with solution.
            self.case.pf_solution(Ybus, Yf, Yt, V)

            # Enforce generator Q limits.
            if self.qlimit:
                raise NotImplementedError
            else:
                repeat = False

        elapsed = time() - t0

        if converged and self.verbose:
            logger.info("AC power flow converged in %.3fs" % elapsed)

        return {"converged": converged, "elapsed": elapsed, "iterations": i,
                "V":V}