code: def write_generator_data(self, file):
          
          writer = self._get_writer(file)
          writer.writerow(["bus"] + GENERATOR_ATTRS)
  
          for g in self.case.generators:
              i = g.bus._i
              writer.writerow([i] + [getattr(g,a) for a in GENERATOR_ATTRS])
docs: Write generator data as CSV.