Metadata-Version: 2.5
Name: frads-gym
Version: 0.2.0
Summary: Gymnasium environment for facade control with EnergyPlus and Radiance (via frads)
Project-URL: Homepage, https://github.com/silaskalmbach/frads-gym
Project-URL: Documentation, https://silaskalmbach.github.io/frads-gym/
Project-URL: Repository, https://github.com/silaskalmbach/frads-gym
Project-URL: Issues, https://github.com/silaskalmbach/frads-gym/issues
Project-URL: Changelog, https://github.com/silaskalmbach/frads-gym/blob/main/CHANGELOG.md
Author-email: Silas Kalmbach <silas.kalmbach@gmail.com>
License: The MIT License
        
        Copyright (c) 2025–2026 Silas Kalmbach
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in
        all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
        THE SOFTWARE.
License-File: LICENSE
Keywords: building-simulation,daylighting,electrochromic,energyplus,facade-control,frads,gymnasium,radiance,reinforcement-learning
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Requires-Dist: frads<2.2,>=2.1.15
Requires-Dist: gymnasium>=1.0.0
Requires-Dist: numpy>=1.24.4
Requires-Dist: pyenergyplus-lbnl==25.2.0
Requires-Dist: pyradiance
Provides-Extra: dev
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
Requires-Dist: mkdocs>=1.6; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.26; extra == 'docs'
Provides-Extra: test
Requires-Dist: pytest>=8; extra == 'test'
Description-Content-Type: text/markdown

<p align="center">
  <img src="https://raw.githubusercontent.com/silaskalmbach/frads-gym/main/docs/assets/logo.png" alt="frads-gym logo" width="200"/>
</p>

# frads-gym

[![CI](https://github.com/silaskalmbach/frads-gym/actions/workflows/ci.yml/badge.svg)](https://github.com/silaskalmbach/frads-gym/actions/workflows/ci.yml)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.18504304.svg)](https://doi.org/10.5281/zenodo.18504304)
[![Docs](https://img.shields.io/badge/docs-silaskalmbach.github.io-blue)](https://silaskalmbach.github.io/frads-gym/)

**Documentation: <https://silaskalmbach.github.io/frads-gym/>**

`frads-gym` is a [Gymnasium](https://gymnasium.farama.org/) environment for controlling switchable
facades, such as electrochromic glazing, with reinforcement learning. It couples
[EnergyPlus](https://energyplus.net/) (thermal and energy simulation) and
[Radiance](https://www.radiance-online.org/) (daylight and glare) through
[frads](https://github.com/LBNL-ETA/frads) and hands control to the agent at every EnergyPlus timestep.

- One `step()` per EnergyPlus zone timestep; the action sets the glazing state of each controlled window.
- Observations from a JSON configuration: any EnergyPlus output variable, work-plane or sensor
  illuminance, enhanced simplified DGP, daylight-dimmed lighting energy, energy sums and more.
- Per-observation normalisation (static, dynamic percentile, z-score, EMA), episodes per day or month,
  wrappers for action repeat, active hours, solar forecast and observation history.
- `pip install` brings EnergyPlus and Radiance along; nothing has to be installed by hand.

## Installation

```bash
pip install frads-gym
```

Python 3.10 to 3.12 on Linux (x86_64), Windows (x86_64) and macOS (arm64). Details and the development
install: [Installation](https://silaskalmbach.github.io/frads-gym/installation/).

## Quickstart

```bash
git clone https://github.com/silaskalmbach/frads-gym.git
cd frads-gym/examples
python quickstart.py
```

`quickstart.py` simulates one June day in the DOE medium office with Chicago weather (both ship with
`pyenergyplus`) and four synthetic electrochromic states created by `make_glazing.py`. The core of it:

```python
from frads_gym import FradsEnv

# config: path to a JSON configuration or a dict (quickstart.py builds one); epw: path to a weather file
env = FradsEnv(output_dir="output", config_file=config, weather_files_path=[epw],
               reward_function=lambda obs, action, next_obs, info: 0.0,
               number_of_timesteps_per_hour=4)
obs, info = env.reset()
obs, reward, terminated, truncated, info = env.step(env.action_space.sample())
env.close()
```

The other examples (EnergyPlus without Radiance, the wiring for PPO with stable-baselines3) are listed
in [Quickstart](https://silaskalmbach.github.io/frads-gym/quickstart/).

## Documentation

<https://silaskalmbach.github.io/frads-gym/>

- [How it works](https://silaskalmbach.github.io/frads-gym/how-it-works/): the co-simulation loop, timing of
  actions and observations, episodes, reproducibility
- [Configuration](https://silaskalmbach.github.io/frads-gym/configuration/): every key of the JSON configuration
- [Wrappers](https://silaskalmbach.github.io/frads-gym/wrappers/) and
  [API reference](https://silaskalmbach.github.io/frads-gym/api/)

## Contributing

Bug reports, questions and pull requests are welcome, see
[CONTRIBUTING.md](https://github.com/silaskalmbach/frads-gym/blob/main/CONTRIBUTING.md).

## Citation

Please cite the archived release you used; the concept DOI
[10.5281/zenodo.18504304](https://doi.org/10.5281/zenodo.18504304) always resolves to the latest
version. `CITATION.cff` holds the metadata.

## License

MIT, see [LICENSE](https://github.com/silaskalmbach/frads-gym/blob/main/LICENSE).
