-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(v3.5.10) - Sinergym terminal logging level set and intallation secti…
…on documentation fix (#444) * Update MODELING layer to MODEL * Develop sinergym package function to update loggers level * Logger: Develop simple logger for environment prints * Environment: Updated prints with simple logger from previous commit * set logger levels fix: wrapper loggers managed as set * Documentation: Added sinergym update logger level example in notebooks, and update documentation reference * Update sphinx modules * Update installation section in documentation * Updated Sinergym version from 3.5.9 to 3.5.10
- Loading branch information
1 parent
8299a28
commit 745b8df
Showing
15 changed files
with
267 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
docs/source/pages/modules/sinergym.utils.logger.SimpleLogger.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
sinergym.utils.logger.SimpleLogger | ||
================================== | ||
|
||
.. currentmodule:: sinergym.utils.logger | ||
|
||
.. autoclass:: SimpleLogger | ||
:members: | ||
:undoc-members: | ||
|
||
|
||
.. automethod:: __init__ | ||
|
||
|
||
.. rubric:: Methods | ||
|
||
.. autosummary:: | ||
|
||
~SimpleLogger.__init__ | ||
~SimpleLogger.getLogger | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
|
||
CustomFormatter | ||
LoggerStorage | ||
SimpleLogger | ||
TerminalLogger | ||
TqdmLoggingHandler | ||
WandBOutputFormat | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"path": "../../../../examples/sinergym_package.ipynb" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Sinergym package information" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"You can view or modify information directly from the *Sinergym* package without needing to set up any environment." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Available environments ids and version" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Couldn't import dot_parser, loading of dot files will not be possible.\n", | ||
"3.5.9\n", | ||
"['Eplus-demo-v1', 'Eplus-office-hot-continuous-v1', 'Eplus-office-hot-discrete-v1', 'Eplus-office-hot-continuous-stochastic-v1', 'Eplus-office-hot-discrete-stochastic-v1', 'Eplus-office-mixed-continuous-v1', 'Eplus-office-mixed-discrete-v1', 'Eplus-office-mixed-continuous-stochastic-v1', 'Eplus-office-mixed-discrete-stochastic-v1', 'Eplus-office-cool-continuous-v1', 'Eplus-office-cool-discrete-v1', 'Eplus-office-cool-continuous-stochastic-v1', 'Eplus-office-cool-discrete-stochastic-v1', 'Eplus-warehouse-hot-continuous-v1', 'Eplus-warehouse-hot-discrete-v1', 'Eplus-warehouse-hot-continuous-stochastic-v1', 'Eplus-warehouse-hot-discrete-stochastic-v1', 'Eplus-warehouse-mixed-continuous-v1', 'Eplus-warehouse-mixed-discrete-v1', 'Eplus-warehouse-mixed-continuous-stochastic-v1', 'Eplus-warehouse-mixed-discrete-stochastic-v1', 'Eplus-warehouse-cool-continuous-v1', 'Eplus-warehouse-cool-discrete-v1', 'Eplus-warehouse-cool-continuous-stochastic-v1', 'Eplus-warehouse-cool-discrete-stochastic-v1', 'Eplus-radiant-hot-discrete-v1', 'Eplus-radiant-hot-discrete-stochastic-v1', 'Eplus-radiant-mixed-discrete-v1', 'Eplus-radiant-mixed-discrete-stochastic-v1', 'Eplus-radiant-cool-discrete-v1', 'Eplus-radiant-cool-discrete-stochastic-v1', 'Eplus-radiant-stockholm-discrete-v1', 'Eplus-radiant-stockholm-discrete-stochastic-v1', 'Eplus-datacenter-hot-continuous-v1', 'Eplus-datacenter-hot-discrete-v1', 'Eplus-datacenter-hot-continuous-stochastic-v1', 'Eplus-datacenter-hot-discrete-stochastic-v1', 'Eplus-datacenter-mixed-continuous-v1', 'Eplus-datacenter-mixed-discrete-v1', 'Eplus-datacenter-mixed-continuous-stochastic-v1', 'Eplus-datacenter-mixed-discrete-stochastic-v1', 'Eplus-datacenter-cool-continuous-v1', 'Eplus-datacenter-cool-discrete-v1', 'Eplus-datacenter-cool-continuous-stochastic-v1', 'Eplus-datacenter-cool-discrete-stochastic-v1', 'Eplus-shop-hot-continuous-v1', 'Eplus-shop-hot-discrete-v1', 'Eplus-shop-hot-continuous-stochastic-v1', 'Eplus-shop-hot-discrete-stochastic-v1', 'Eplus-shop-mixed-continuous-v1', 'Eplus-shop-mixed-discrete-v1', 'Eplus-shop-mixed-continuous-stochastic-v1', 'Eplus-shop-mixed-discrete-stochastic-v1', 'Eplus-shop-cool-continuous-v1', 'Eplus-shop-cool-discrete-v1', 'Eplus-shop-cool-continuous-stochastic-v1', 'Eplus-shop-cool-discrete-stochastic-v1', 'Eplus-smalldatacenter-hot-continuous-v1', 'Eplus-smalldatacenter-hot-continuous-stochastic-v1', 'Eplus-smalldatacenter-mixed-continuous-v1', 'Eplus-smalldatacenter-mixed-continuous-stochastic-v1', 'Eplus-smalldatacenter-cool-continuous-v1', 'Eplus-smalldatacenter-cool-continuous-stochastic-v1', 'Eplus-officegrid-hot-continuous-v1', 'Eplus-officegrid-hot-discrete-v1', 'Eplus-officegrid-hot-continuous-stochastic-v1', 'Eplus-officegrid-hot-discrete-stochastic-v1', 'Eplus-officegrid-mixed-continuous-v1', 'Eplus-officegrid-mixed-discrete-v1', 'Eplus-officegrid-mixed-continuous-stochastic-v1', 'Eplus-officegrid-mixed-discrete-stochastic-v1', 'Eplus-officegrid-cool-continuous-v1', 'Eplus-officegrid-cool-discrete-v1', 'Eplus-officegrid-cool-continuous-stochastic-v1', 'Eplus-officegrid-cool-discrete-stochastic-v1', 'Eplus-5zone-hot-continuous-v1', 'Eplus-5zone-hot-discrete-v1', 'Eplus-5zone-hot-continuous-stochastic-v1', 'Eplus-5zone-hot-discrete-stochastic-v1', 'Eplus-5zone-mixed-continuous-v1', 'Eplus-5zone-mixed-discrete-v1', 'Eplus-5zone-mixed-continuous-stochastic-v1', 'Eplus-5zone-mixed-discrete-stochastic-v1', 'Eplus-5zone-cool-continuous-v1', 'Eplus-5zone-cool-discrete-v1', 'Eplus-5zone-cool-continuous-stochastic-v1', 'Eplus-5zone-cool-discrete-stochastic-v1']\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import sinergym\n", | ||
"\n", | ||
"print(sinergym.__version__)\n", | ||
"print(sinergym.__ids__)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Set terminal loggers' level" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"The logging level for each module is set by default in the Sinergym constants. However, these can be modified from the package once the environment has been created to take effect.\n", | ||
"\n", | ||
"The currently available levels are: ENVIRONMENT, SIMULATOR, MODEL, REWARD, COMMON, WRAPPER (or WRAPPERS, both options are detected), and CALLBACK.\n", | ||
"\n", | ||
"Below is an example of how to use them:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"#==============================================================================================#\n", | ||
"\u001b[38;20m[ENVIRONMENT] (INFO) : Creating Gymnasium environment.\u001b[0m\n", | ||
"\u001b[38;20m[ENVIRONMENT] (INFO) : Name: demo-v1\u001b[0m\n", | ||
"#==============================================================================================#\n", | ||
"\u001b[38;20m[MODEL] (INFO) : Experiment working directory created.\u001b[0m\n", | ||
"\u001b[38;20m[MODEL] (INFO) : Working directory: /workspaces/sinergym/examples/Eplus-env-demo-v1-res8\u001b[0m\n", | ||
"\u001b[38;20m[MODEL] (INFO) : Model Config is correct.\u001b[0m\n", | ||
"\u001b[38;20m[MODEL] (INFO) : Update building model Output:Variable with variable names.\u001b[0m\n", | ||
"\u001b[38;20m[MODEL] (INFO) : Update building model Output:Meter with meter names.\u001b[0m\n", | ||
"\u001b[38;20m[MODEL] (INFO) : Extra config: runperiod updated to {'apply_weekend_holiday_rule': 'No', 'begin_day_of_month': 1, 'begin_month': 1, 'begin_year': 1991, 'day_of_week_for_start_day': 'Monday', 'end_day_of_month': 1, 'end_month': 3, 'end_year': 1991, 'use_weather_file_daylight_saving_period': 'Yes', 'use_weather_file_holidays_and_special_days': 'Yes', 'use_weather_file_rain_indicators': 'Yes', 'use_weather_file_snow_indicators': 'Yes'}\u001b[0m\n", | ||
"\u001b[38;20m[MODEL] (INFO) : Updated episode length (seconds): 5184000.0\u001b[0m\n", | ||
"\u001b[38;20m[MODEL] (INFO) : Updated timestep size (seconds): 3600.0\u001b[0m\n", | ||
"\u001b[38;20m[MODEL] (INFO) : Updated timesteps per episode: 1440\u001b[0m\n", | ||
"\u001b[38;20m[MODEL] (INFO) : Runperiod established.\u001b[0m\n", | ||
"\u001b[38;20m[MODEL] (INFO) : Episode length (seconds): 5184000.0\u001b[0m\n", | ||
"\u001b[38;20m[MODEL] (INFO) : timestep size (seconds): 3600.0\u001b[0m\n", | ||
"\u001b[38;20m[MODEL] (INFO) : timesteps per episode: 1440\u001b[0m\n", | ||
"\u001b[38;20m[REWARD] (INFO) : Reward function initialized.\u001b[0m\n", | ||
"\u001b[38;20m[ENVIRONMENT] (INFO) : Environment created successfully.\u001b[0m\n", | ||
"#----------------------------------------------------------------------------------------------#\n", | ||
"\u001b[38;20m[ENVIRONMENT] (INFO) : Starting a new episode.\u001b[0m\n", | ||
"\u001b[38;20m[ENVIRONMENT] (INFO) : Episode 1: demo-v1\u001b[0m\n", | ||
"#----------------------------------------------------------------------------------------------#\n", | ||
"\u001b[38;20m[MODEL] (INFO) : Episode directory created.\u001b[0m\n", | ||
"\u001b[38;20m[MODEL] (INFO) : Weather file USA_PA_Pittsburgh-Allegheny.County.AP.725205_TMY3.epw used.\u001b[0m\n", | ||
"\u001b[38;20m[MODEL] (INFO) : Adapting weather to building model.\u001b[0m\n", | ||
"\u001b[38;20m[ENVIRONMENT] (INFO) : Saving episode output path.\u001b[0m\n", | ||
"\u001b[38;20m[ENVIRONMENT] (DEBUG) : Path: /workspaces/sinergym/examples/Eplus-env-demo-v1-res8/Eplus-env-sub_run1/output\u001b[0m\n", | ||
"\u001b[38;20m[ENVIRONMENT] (INFO) : Episode 1 started.\u001b[0m\n", | ||
"\u001b[38;20m[ENVIRONMENT] (DEBUG) : Waiting for finishing WARMUP process.\u001b[0m\n", | ||
"\u001b[38;20m[ENVIRONMENT] (DEBUG) : WARMUP process finished.\u001b[0m\n", | ||
"\u001b[38;20m[SIMULATOR] (INFO) : handlers initialized.\u001b[0m\n", | ||
"\u001b[38;20m[SIMULATOR] (INFO) : handlers are ready.\u001b[0m\n", | ||
"\u001b[38;20m[SIMULATOR] (INFO) : System is ready.\u001b[0m\n", | ||
"\u001b[38;20m[ENVIRONMENT] (DEBUG) : RESET observation received: {'month': 1, 'day_of_month': 1, 'hour': 0, 'outdoor_temperature': 7.2, 'htg_setpoint': 12.8, 'clg_setpoint': 40.0, 'air_temperature': 19.7479730060398, 'air_humidity': 54.12386596530383, 'HVAC_electricity_demand_rate': 87.36488027634958}\u001b[0m\n", | ||
"\u001b[38;20m[ENVIRONMENT] (DEBUG) : RESET info received: {'time_elapsed(hours)': 1.5, 'month': 1, 'day': 1, 'hour': 0, 'is_raining': False, 'timestep': 0}\u001b[0m\n", | ||
"\u001b[38;20m[ENVIRONMENT] (DEBUG) : STEP queues not receive value, simulation must be completed. changing TRUNCATED flag to TRUE\u001b[0m\n", | ||
"Simulation Progress [Episode 1]: 100%|██████████| 100/100 [00:02<00:00, 36.37%/s, 100% completed] \n", | ||
"\u001b[38;20m[ENVIRONMENT] (INFO) : Environment closed. [demo-v1]\u001b[0m\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import gymnasium as gym\n", | ||
"import sinergym\n", | ||
"\n", | ||
"env = gym.make('Eplus-demo-v1')\n", | ||
"# Update log levels to DEBUG in Environment instead of info\n", | ||
"sinergym.set_logger_level('ENVIRONMENT', 'DEBUG')\n", | ||
"\n", | ||
"env.reset()\n", | ||
"terminated=truncated=False\n", | ||
"\n", | ||
"# Run an episode\n", | ||
"while not terminated and not truncated:\n", | ||
" action = env.action_space.sample()\n", | ||
" _, _, terminated, truncated, _ = env.step(action)\n", | ||
"env.close()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"info = env.step(action)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.