sinergym.simulators.eplus.EnergyPlus
- class sinergym.simulators.eplus.EnergyPlus(eplus_path: str, weather_path: str, bcvtb_path: str, variable_path: str, idf_path: str, env_name: str, act_repeat: int = 1, max_ep_data_store_num: int = 10, config_params: Optional[Dict[str, Any]] = None)
- __init__(eplus_path: str, weather_path: str, bcvtb_path: str, variable_path: str, idf_path: str, env_name: str, act_repeat: int = 1, max_ep_data_store_num: int = 10, config_params: Optional[Dict[str, Any]] = 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.
variable_path (str) – Path to variables file.
idf_path (str) – EnergyPlus input description file (.idf) path.
env_name (str) – The environment name.
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: Optional[Tuple[float, float, float]] = None) Tuple[Tuple[int, int, int, 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 tuple with day, month, hour and simulation time elapsed in that order in that step; 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[Tuple[int, int, int, 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: Union[int, float, numpy.integer, numpy.ndarray, List[Any], Tuple[Any]]) Tuple[Tuple[int, int, int, 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 tuple with day, month, hour and simulation time elapsed in that order in that step; 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[Tuple[int, int, int, float], List[float], bool]