sinergym.simulators.eplus.EnergyPlus

class sinergym.simulators.eplus.EnergyPlus(eplus_path: str, bcvtb_path: str, weather_files: List[str], idf_file: str, env_name: str, variables: Dict[str, List[str]], act_repeat: int = 1, max_ep_data_store_num: int = 10, action_definition: Dict[str, Any] | None = None, config_params: Dict[str, Any] | None = None)
__init__(eplus_path: str, bcvtb_path: str, weather_files: List[str], idf_file: str, env_name: str, variables: Dict[str, List[str]], act_repeat: int = 1, max_ep_data_store_num: int = 10, action_definition: Dict[str, Any] | None = None, config_params: Dict[str, Any] | None = None)

EnergyPlus simulation class.

Parameters:
  • eplus_path (str) – EnergyPlus installation path.

  • bcvtb_path (str) – BCVTB installation path.

  • weather_files (List[str]) – EnergyPlus weather file list (sampling one in each episode).

  • idf_file (str) – EnergyPlus input description file (.idf) file.

  • env_name (str) – The environment name.

  • variables (Dict[str,List[str]]) – Variables list with observation and action keys in a dictionary.

  • act_repeat (int, optional) – The number of times to repeat the control action. Defaults to 1.

  • max_ep_data_store_num (int, optional) – The number of simulation results to keep. Defaults to 10.

  • config_params (Optional[Dict[str, Any]], optional) – Dictionary with all extra configuration for simulator. Defaults to None.

Methods

__init__(eplus_path, bcvtb_path, ...[, ...])

EnergyPlus simulation class.

end_env()

Method called after finishing using the environment in order to close it.

end_episode()

It ends current simulator episode.

get_is_eplus_running()

It indicates whether simulator is running as subprocess.Popen or not.

reset([options])

Resets the environment.

step(action)

Executes a given action.

Attributes

env_name

Returns the environment name.

start_day

Returns the EnergyPlus simulation start day of the month.

start_mon

Returns the EnergyPlus simulation start month.

start_weekday

Returns the EnergyPlus simulation start weekday.

start_year

Returns the EnergyPlus simulation year.

end_env() None

Method called after finishing using the environment in order to close it.

end_episode() None

It ends current simulator episode.

property env_name: str

Returns the environment name.

Returns:

Environment name

Return type:

str

get_is_eplus_running() bool

It indicates whether simulator is running as subprocess.Popen or not.

Returns:

Flag which indicates subprocess is running or not.

Return type:

bool

reset(options: Dict[str, Any] | None = None) Tuple[List[float], Dict[str, Any]]

Resets the environment. This method does the following: 1. Makes a new EnergyPlus working directory. 2. Copies .idf and variables.cfg file to the working directory. 3. Creates the socket.cfg file in the working directory. 4. Creates the EnergyPlus subprocess. 5. Establishes the socket connection with EnergyPlus. 6. Reads the first sensor data from the EnergyPlus. 7. Uses a new weather file if passed.

Parameters:

options (Optional[Dict[str, Any]]) – Additional information to specify how the environment is reset (weather variability for example). Defaults to None.

Returns:

EnergyPlus results in a 1-D list corresponding to the variables in variables.cfg and year, month, day and hour in simulation. A Python dictionary with additional information is included.

Return type:

Tuple[List[float], Dict[str, Any]]

property start_day: int

Returns the EnergyPlus simulation start day of the month.

Returns:

Simulation start day of the month.

Return type:

int

property start_mon: int

Returns the EnergyPlus simulation start month.

Returns:

Simulation start month.

Return type:

int

property start_weekday: int

Returns the EnergyPlus simulation start weekday. From 0 (Monday) to 6 (Sunday).

Returns:

Simulation start weekday.

Return type:

int

property start_year: int

Returns the EnergyPlus simulation year.

Returns:

Simulation year.

Return type:

int

step(action: int | float | integer | ndarray | List[Any] | Tuple[Any]) Tuple[List[float], bool, bool, Dict[str, Any]]

Executes a given action. This method does the following: 1. Sends a list of floats to EnergyPlus. 2. Receives EnergyPlus results for the next step (state).

Parameters:

action (Union[int, float, np.integer, np.ndarray, List[Any], Tuple[Any]]) – Control actions that will be passed to EnergyPlus.

Raises:

RuntimeError – When you try to step in an terminated episode (you should be reset before).

Returns:

EnergyPlus results in a 1-D list corresponding to the variables in variables.cfg. Second element is whether episode has terminated state, third whether episode has truncated state (always False), and last element is a Python Dictionary with additional information about step

Return type:

Tuple[List[float], bool, bool, Dict[str, Any]]