sinergym.utils.common.CSVLogger

class sinergym.utils.common.CSVLogger(monitor_header, progress_header, log_progress_file, log_file=None, flag=True)

CSV Logger for agent interaction with environment.

Parameters:
  • monitor_header – CSV header for sub_run_N/monitor.csv which record interaction step by step.

  • progress_header – CSV header for res_N/progress.csv which record main data episode by episode.

  • log_file – log_file path for monitor.csv, there will be one CSV per episode.

  • log_progress_file – log_file path for progress.csv, there will be only one CSV per whole simulation.

  • flag – This flag is used to activate (True) or deactivate (False) Logger in real time.

  • etc (steps_data, rewards, powers,) – These arrays are used to record steps data to elaborate main data for progress.csv later.

  • total_timesteps – Current episode timesteps executed.

  • total_time_elapsed – Current episode time elapsed (simulation seconds).

  • comfort_violation_timesteps – Current episode timesteps whose comfort_penalty!=0.

  • steps_data – It is a array of str’s. Each element belong to a step data.

__init__(monitor_header, progress_header, log_progress_file, log_file=None, flag=True)

Methods

__init__(monitor_header, progress_header, ...)

activate_flag()

Activate Sinergym CSV logger

deactivate_flag()

Deactivate Sinergym CSV logger

log_episode(episode)

Log episode main information using steps_data param.

log_step(timestep, date, observation, ...)

Log step information and store it in steps_data param.

log_step_normalize(timestep, date, ...)

set_log_file(new_log_file)

Change log_file path for monitor.csv when an episode ends.

activate_flag()

Activate Sinergym CSV logger

deactivate_flag()

Deactivate Sinergym CSV logger

log_episode(episode)

Log episode main information using steps_data param.

Parameters:

episode (int) – Current simulation episode number.

log_step(timestep, date, observation, action, simulation_time, reward, total_power_no_units, comfort_penalty, power, done)

Log step information and store it in steps_data param.

Parameters:
  • timestep (int) – Current episode timestep in simulation.

  • date (list) – Current date [month,day,hour] in simulation.

  • observation (list) – Values that belong to current observation.

  • action (list) – Values that belong to current action.

  • simulation_time (float) – Total time elapsed in current episode (seconds).

  • reward (float) – Current reward achieved.

  • total_power_no_units (float) – Power consumption penalty depending on reward function.

  • comfort_penalty (float) – Temperature comfort penalty depending on reward function.

  • power (float) – Power consumption in current step (W).

  • done (bool) – Spicifies if this step terminates episode or not.

log_step_normalize(timestep, date, observation, action, simulation_time, reward, total_power_no_units, comfort_penalty, done)
set_log_file(new_log_file)

Change log_file path for monitor.csv when an episode ends.

Parameters:

new_log_file (str) – New log path depending on simulation.