Writes branch data to file.

def write_branch_data(self, file):
        """ Writes branch data to file.
        """
        branch_attr = ["r", "x", "b", "rate_a", "rate_b", "rate_c",
            "ratio", "phase_shift", "online", "ang_min", "ang_max", "p_from",
            "q_from", "p_to", "q_to", "mu_s_from", "mu_s_to", "mu_angmin",
            "mu_angmax"]

        file.write("\n%%%% branch data\n")
        file.write("%%\tfbus\ttbus\tr\tx\tb\trateA\trateB\trateC\tratio"
                   "\tangle\tstatus")
        file.write("\tangmin\tangmax")
        file.write("\tPf\tQf\tPt\tQt")
        file.write("\tmu_Sf\tmu_St")
        file.write("\tmu_angmin\tmu_angmax")
        file.write("\n%sbranch = [\n" % self._prefix)

        for branch in self.case.branches:
            vals = [getattr(branch, a) for a in branch_attr]

            vals.insert(0, branch.to_bus._i)
            vals.insert(0, branch.from_bus._i)

            file.write("\t%d\t%d\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%g\t%d\t%g\t%g"
                       "\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f\t%.4f;\n" %
                       tuple(vals))
        file.write("];\n")