├── .gitignore ├── OpenStudio_to_EnergyPlusAPI.ipynb ├── README.md └── images └── interactive_plot.gif /.gitignore: -------------------------------------------------------------------------------- 1 | test.idf 2 | out/ 3 | 4 | # Byte-compiled / optimized / DLL files 5 | __pycache__/ 6 | *.py[cod] 7 | *$py.class 8 | 9 | # C extensions 10 | *.so 11 | 12 | # Distribution / packaging 13 | .Python 14 | build/ 15 | develop-eggs/ 16 | dist/ 17 | downloads/ 18 | eggs/ 19 | .eggs/ 20 | lib/ 21 | lib64/ 22 | parts/ 23 | sdist/ 24 | var/ 25 | wheels/ 26 | share/python-wheels/ 27 | *.egg-info/ 28 | .installed.cfg 29 | *.egg 30 | MANIFEST 31 | 32 | # PyInstaller 33 | # Usually these files are written by a python script from a template 34 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 35 | *.manifest 36 | *.spec 37 | 38 | # Installer logs 39 | pip-log.txt 40 | pip-delete-this-directory.txt 41 | 42 | # Unit test / coverage reports 43 | htmlcov/ 44 | .tox/ 45 | .nox/ 46 | .coverage 47 | .coverage.* 48 | .cache 49 | nosetests.xml 50 | coverage.xml 51 | *.cover 52 | *.py,cover 53 | .hypothesis/ 54 | .pytest_cache/ 55 | cover/ 56 | 57 | # Translations 58 | *.mo 59 | *.pot 60 | 61 | # Django stuff: 62 | *.log 63 | local_settings.py 64 | db.sqlite3 65 | db.sqlite3-journal 66 | 67 | # Flask stuff: 68 | instance/ 69 | .webassets-cache 70 | 71 | # Scrapy stuff: 72 | .scrapy 73 | 74 | # Sphinx documentation 75 | docs/_build/ 76 | 77 | # PyBuilder 78 | .pybuilder/ 79 | target/ 80 | 81 | # Jupyter Notebook 82 | .ipynb_checkpoints 83 | 84 | # IPython 85 | profile_default/ 86 | ipython_config.py 87 | 88 | # pyenv 89 | # For a library or package, you might want to ignore these files since the code is 90 | # intended to run in multiple environments; otherwise, check them in: 91 | # .python-version 92 | 93 | # pipenv 94 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 95 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 96 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 97 | # install all needed dependencies. 98 | #Pipfile.lock 99 | 100 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 101 | __pypackages__/ 102 | 103 | # Celery stuff 104 | celerybeat-schedule 105 | celerybeat.pid 106 | 107 | # SageMath parsed files 108 | *.sage.py 109 | 110 | # Environments 111 | .env 112 | .venv 113 | env/ 114 | venv/ 115 | ENV/ 116 | env.bak/ 117 | venv.bak/ 118 | 119 | # Spyder project settings 120 | .spyderproject 121 | .spyproject 122 | 123 | # Rope project settings 124 | .ropeproject 125 | 126 | # mkdocs documentation 127 | /site 128 | 129 | # mypy 130 | .mypy_cache/ 131 | .dmypy.json 132 | dmypy.json 133 | 134 | # Pyre type checker 135 | .pyre/ 136 | 137 | # pytype static type analyzer 138 | .pytype/ 139 | 140 | # Cython debug symbols 141 | cython_debug/ 142 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Python: using OpenStudio Bindings, EnergyPlus API, and matplotlib 2 | 3 | Written By Julien Marrec of [EffiBEM](https://www.effibem.com), circa 2021-01-05. 4 | 5 | ## Purpose 6 | 7 | This notebook aims to demonstrate the use of: 8 | 9 | * **The OpenStudio Python Bindings**. 10 | * This is used to efficiently create and customize a model to be simulated 11 | 12 | * **Note**: Until a version > 3.1.0 (eg 3.1.1 or 3.2.0) is out on [**pypi**](https://pypi.org/project/openstudio/), I recommend using the [**testpypi**](https://test.pypi.org/project/openstudio/) version where I made usability adjustments. You can do `pip install -i https://test.pypi.org/simple/ openstudio` for that one. 13 | 14 | 15 | * **The EnergyPlus Python API**, and how to use callbacks to retrieve data 16 | 17 | * **Updating a live matplotlib plot during E+ simulation** via the EnergyPlus Python API callback. 18 | 19 | 20 | Several options and examples are shown below. **I strongly recommend you encapsulate your data inside a class** (see section 3.4) instead of relying on python `global` data, but it does bring a sligthly higher complexity level so for simple stuff you can ommit that and use 3.1 to 3.3 instead (which are also used as an entry point to demonstrate the API) 21 | 22 | ---- 23 | 24 | **Resources:** 25 | 26 | * OpenStudio SDK documentation: https://openstudio-sdk-documentation.s3.amazonaws.com/index.html 27 | * EnergyPlus Python API documentation: https://energyplus.readthedocs.io/en/latest/api.html 28 | 29 | ## Demo 30 | 31 | ![](images/interactive_plot.gif) 32 | -------------------------------------------------------------------------------- /images/interactive_plot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmarrec/OpenStudio_to_EnergyPlusAPI/57aa09e55259e13ac6f718225d3085bc75ff11cf/images/interactive_plot.gif --------------------------------------------------------------------------------