Writes generator data in MATPOWER format.

def write_generator_data(self, file):
        """ Writes generator data in MATPOWER format.
        """
        gen_attr = ["p", "q", "q_max", "q_min", "v_magnitude",
            "base_mva", "online", "p_max", "p_min", "mu_pmax", "mu_pmin",
            "mu_qmax", "mu_qmin"]

        file.write("\n%%%% generator data\n")
        file.write("%%\tbus\tPg\tQg\tQmax\tQmin\tVg\tmBase\tstatus\tPmax\tPmin")
        file.write("\tmu_Pmax\tmu_Pmin\tmu_Qmax\tmu_Qmin")
        file.write("\n%sgen = [\n" % self._prefix)

        for generator in self.case.generators:
            vals = [getattr(generator, a) for a in gen_attr]
            vals.insert(0, generator.bus._i)
            assert len(vals) == 14
            file.write("\t%d\t%g\t%g\t%g\t%g\t%.8g\t%g\t%d\t%g\t%g\t%g\t%g"
                       "\t%g\t%g;\n" % tuple(vals))
        file.write("];\n")