sinergym.simulators.eplus.EnergyPlus
- class sinergym.simulators.eplus.EnergyPlus(eplus_path: str, weather_path: str, bcvtb_path: str, idf_path: 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, weather_path: str, bcvtb_path: str, idf_path: 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.
weather_path (str) – EnergyPlus weather file (.epw) path.
bcvtb_path (str) – BCVTB installation path.
idf_path (str) – EnergyPlus input description file (.idf) path.
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, weather_path, ...[, ...])EnergyPlus simulation class.
end_env
()Method called after finishing using the environment in order to close it.
It ends current simulator episode.
It indicates whether simulator is running as subprocess.Popen or not.
reset
([weather_variability])Resets the environment.
step
(action)Executes a given action.
Attributes
Returns the environment name.
Returns the EnergyPlus simulation start day of the month.
Returns the EnergyPlus simulation start month.
Returns the EnergyPlus simulation start weekday.
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(weather_variability: Tuple[float, float, float] | None = None) Tuple[float, List[float], bool]
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:
weather_variability (Optional[Tuple[float, float, float]], optional) – Tuple with the sigma, mean and tau for OU process. Defaults to None.
- Returns:
The first element is a value with simulation time elapsed; the second element consist on EnergyPlus results in a 1-D list corresponding to the variables in variables.cfg and year, month, day and hour in simulation. The last element is a boolean indicating whether the episode terminates.
- Return type:
Tuple[float, List[float], bool]
- 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[float, List[float], bool]
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:
The first element is a float with simulation time elapsed; the second element consist on EnergyPlus results in a 1-D list corresponding to the variables in variables.cfg. The last element is a boolean indicating whether the episode terminates.
- Return type:
Tuple[float, List[float], bool]