moved log file opening to before simulation