code: def output_solution(self, fd, z, z_est, error_sqrsum):
          
          col_width = 11
          sep = ("=" * col_width + " ") * 4 + "\n"
  
          fd.write("State Estimation\n")
          fd.write("-" * 16 + "\n")
          fd.write(sep)
          fd.write("Type".center(col_width) + " ")
          fd.write("Name".center(col_width) + " ")
          fd.write("Measurement".center(col_width) + " ")
          fd.write("Estimation".center(col_width) + " ")
          fd.write("\n")
          fd.write(sep)
  
          c = 0
          for t in [PF, PT, QF, QT, PG, QG, VM, VA]:
              for meas in self.measurements:
                  if meas.type == t:
                      n = meas.b_or_l.name[:col_width].ljust(col_width)
                      fd.write(t.ljust(col_width) + " ")
                      fd.write(n + " ")
                      fd.write("%11.5f " % z[c])
                      fd.write("%11.5f\n" % z_est[c])
  #                    fd.write("%s\t%s\t%.3f\t%.3f\n" % (t, n, z[c], z_est[c]))
                      c += 1
  
          fd.write("\nWeighted sum of error squares = %.4f\n" % error_sqrsum)
docs: Prints comparison of measurements and their estimations.