sinergym.config.modeling.ModelJSON
- class sinergym.config.modeling.ModelJSON(json_file: str, weather_files: List[str], variables: Dict[str, List[str]], env_name: str, max_ep_store: int, action_definition: Dict[str, Any] | None, extra_config: Dict[str, Any])
Class to manage backend models (building, weathers…) and folders in Sinergym (JSON version).
- Parameters:
_json_path – JSON path origin for apply extra configuration.
weather_files – weather available files for each episode
_weather_path – EPW path origin for apply weather to simulation in current episode.
_ddy_path – DDY path origin for get DesignDays and weather Location
experiment_path – Path for Sinergym experiment output
episode_path – Path for Sinergym specific episode (before first simulator reset this param is None)
max_ep_store – Number of episodes directories will be stored in experiment_path
config – Dict config with extra configuration which is required to modify building model (may be None)
_idd – IDD opyplus object to set up Epm
building – Building model (Dictionary extracted from JSON)
ddy_model – opyplus Epm object with DDY model
weather_data – opyplus WeatherData object with EPW data
action_definition – Dict with action definition to automatic building model preparation.
- __init__(json_file: str, weather_files: List[str], variables: Dict[str, List[str]], env_name: str, max_ep_store: int, action_definition: Dict[str, Any] | None, extra_config: Dict[str, Any])
Methods
__init__
(json_file, weather_files, ...)Interpret action definition and apply changes in building model, in order to control schedulers specified.
adapt_building_to_epw
([summerday, winterday])Given a summer day name and winter day name from DDY file, this method modify Location and DesingDay's in order to adapt building model to EPW.
This method adds to XML variable tree all observation and action variables information.
Set extra configuration in building model
apply_weather_variability
([columns, variation])Modify weather data using Ornstein-Uhlenbeck process.
get_current_time_info
(sec_elapsed)Returns the current day, month and hour given the seconds elapsed since the simulation started.
Extract all schedulers available in the building model to be controlled.
Take current building model and save as epJSON in current env_working_dir episode folder.
This method saves current XML variables tree model into a variables.cfg file.
Set episode working dir path like config attribute for current simulation execution.
set_experiment_working_dir
(env_name)Set experiment working dir path like config attribute for current simulation.
Set an empty external interface with Ptolemy server if is not in the current building
When this method is called, weather file is changed randomly and building model is adapted to new one.
Attributes
Returns the EnergyPlus simulation year.
- adapt_building_to_action_definition() None
Interpret action definition and apply changes in building model, in order to control schedulers specified.
- adapt_building_to_epw(summerday: str = 'Ann Clg .4% Condns DB=>MWB', winterday: str = 'Ann Htg 99.6% Condns DB') None
Given a summer day name and winter day name from DDY file, this method modify Location and DesingDay’s in order to adapt building model to EPW.
- Parameters:
summerday (str) – Design day for summer day specifically (DDY has several of them).
winterday (str) – Design day for winter day specifically (DDY has several of them).
- adapt_variables_to_cfg_and_building() None
This method adds to XML variable tree all observation and action variables information. In addition, it modifies building Output:Variable in order to adapt to new observation variables set.
- apply_extra_conf() None
Set extra configuration in building model
- apply_weather_variability(columns: List[str] = ['drybulb'], variation: Tuple[float, float, float] | None = None) str
Modify weather data using Ornstein-Uhlenbeck process.
- Parameters:
columns (List[str], optional) – List of columns to be affected. Defaults to [‘drybulb’].
variation (Optional[Tuple[float, float, float]], optional) – Tuple with the sigma, mean and tau for OU process. Defaults to None.
- Returns:
New EPW file path generated in simulator working path in that episode or current EPW path if variation is not defined.
- Return type:
str
- get_current_time_info(sec_elapsed: float) List[int]
Returns the current day, month and hour given the seconds elapsed since the simulation started.
- Parameters:
sec_elapsed (float) – Seconds elapsed since the start of the simulation
- Returns:
A List composed by the current year, day, month and hour in the simulation.
- Return type:
List[int]
- get_schedulers() Dict[str, Dict[str, str | Dict[str, str]]]
Extract all schedulers available in the building model to be controlled.
- Returns:
Python Dictionary: For each scheduler found, it shows type value and where this scheduler is present (table, object and field).
- Return type:
Dict[str, Dict[str, Any]]
- save_building_model() str
Take current building model and save as epJSON in current env_working_dir episode folder.
- Returns:
Path of epJSON file stored (episode folder).
- Return type:
str
- save_variables_cfg() str
This method saves current XML variables tree model into a variables.cfg file.
- Raises:
RuntimeError – If this method is used without an episode_path generated (see reset method in simulator), this exception is raised.
- Returns:
Path to the new saved variables.cfg used by BCVTB for Energyplus communication.
- Return type:
str
- set_episode_working_dir() str
Set episode working dir path like config attribute for current simulation execution.
- Raises:
Exception – If experiment path (parent folder) has not be created previously.
- Returns:
Episode path for directory created.
- Return type:
str
- set_experiment_working_dir(env_name: str) str
Set experiment working dir path like config attribute for current simulation.
- Parameters:
env_name (str) – simulation env name to define a name in directory
- Returns:
Experiment path for directory created.
- Return type:
str
- set_external_interface() None
Set an empty external interface with Ptolemy server if is not in the current building
- property start_year: int
Returns the EnergyPlus simulation year.
- Returns:
Simulation year.
- Return type:
int
- update_weather_path() None
When this method is called, weather file is changed randomly and building model is adapted to new one.