sinergym.config.modeling.ModelJSON

class sinergym.config.modeling.ModelJSON(env_name: str, json_file: str, weather_files: List[str], variables: Dict[str, Tuple[str, str]], meters: Dict[str, str], actuators: Dict[str, Tuple[str, str, str]], max_ep_store: int, extra_config: Dict[str, Any])

Class to manage backend models (building, weathers…) and folders in Sinergym (JSON version).

Parameters:
  • _json_path – JSON path origin to create the building model.

  • weather_files – Available weather 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.

  • _idd – IDD eppy object to set up Epm.

  • _variables – Output:Variable(s) information about building model.

  • _meters – Output:Meter(s) information about building model.

  • _actuators – Actuators information about building model.

  • 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).

  • building – Building model (Dictionary extracted from JSON).

  • ddy_model – eppy object with DDY model.

  • weather_data – epw module Weather class instance with EPW data.

  • zone_names – List of the zone names available in the building.

  • schedulers – Information in Dict format about all building schedulers.

  • runperiod – Information in Dict format about runperiod that determine an episode.

  • episode_length – Time in seconds that an episode has.

  • step_size – Time in seconds that an step has.

  • timestep_per_episode – Timestep in a runperiod (simulation episode).

__init__(env_name: str, json_file: str, weather_files: List[str], variables: Dict[str, Tuple[str, str]], meters: Dict[str, str], actuators: Dict[str, Tuple[str, str, str]], max_ep_store: int, extra_config: Dict[str, Any])

Constructor. Variables, meters and actuators are required to update building model scheme.

Parameters:
  • env_name (str) – Name of the environment, required for Sinergym output management.

  • json_file (str) – Json file name, path is calculated by the constructor.

  • weather_files (List[str]) – List of the weather file names, one of them will be select randomly, path will be calculated by the constructor.

  • variables (Dict[str, Tuple[str, str]]) – Specification for EnergyPlus Output:Variable. The key name is custom, then tuple must be the original variable name and the output variable key.

  • meters (Dict[str, str]) – Specification for EnergyPlus Output:Meter. The key name is custom, then value is the original EnergyPlus Meters name.

  • actuators (Dict[str, Tuple[str, str, str]]) – Specification for EnergyPlus Input Actuators. The key name is custom, then value is a tuple with actuator type, value type and original actuator name.

  • max_ep_store (int) – Number of episodes directories will be stored in experiment_path.

  • extra_config (Dict[str, Any]) – Dict config with extra configuration which is required to modify building model (may be None).

Methods

__init__(env_name, json_file, weather_files, ...)

Constructor.

adapt_building_to_config()

Set extra configuration in building model

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.

adapt_building_to_meters()

This method reads all meters and write it in the building model as Output:Meter field.

adapt_building_to_variables()

This method reads all variables and write it in the building model as Output:Variable field.

apply_weather_variability([weather_variability])

Modify weather data using Ornstein-Uhlenbeck process according to the variation specified in the weather_variability dictionary.

get_schedulers()

Extract all schedulers available in the building model to be controlled.

save_building_model()

Take current building model and save as epJSON in current episode path folder.

set_episode_working_dir()

Set episode working dir path like config attribute for current simulation execution.

update_weather_path()

When this method is called, weather file is changed randomly and building model is adapted to new one.

Attributes

building_path

ddy_path

idd_path

logger

weather_path

adapt_building_to_config() None

Set extra configuration in building model

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_building_to_meters() None

This method reads all meters and write it in the building model as Output:Meter field.

adapt_building_to_variables() None

This method reads all variables and write it in the building model as Output:Variable field.

apply_weather_variability(weather_variability: Dict[str, Tuple[float, float, float]] | None = None) str

Modify weather data using Ornstein-Uhlenbeck process according to the variation specified in the weather_variability dictionary.

Parameters:

weather_variability (Optional[Dict[str, Tuple[float, float, float]]], optional) – Dictionary with the variation for each column in the weather data. Defaults to None. The key is the column name and the value is a tuple with the sigma, mean and tau for OU process.

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

property building_path: str
property ddy_path: str | None
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]]

property idd_path: str | None
logger = <Logger MODEL (INFO)>
save_building_model() str

Take current building model and save as epJSON in current episode path folder.

Returns:

Path of epJSON file stored (episode folder).

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

update_weather_path() None

When this method is called, weather file is changed randomly and building model is adapted to new one.

property weather_path: str