-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from centrefornetzero/release/v0.0.0
Release/v0.0.0
- Loading branch information
Showing
10 changed files
with
73 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
[packages] | ||
smart_building_rating_calculator = {editable = true, path = "."} | ||
pandas = "*" | ||
|
||
[dev-packages] | ||
|
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 |
---|---|---|
@@ -1,70 +1,50 @@ | ||
# Smart building rating calculator | ||
The calculation to generate a Smart Building Rating (SBR) and SBR 'archetype' | ||
This package allows users to calculate Smart Building Ratings (SBR) and their associated SBR 'archetype'. In brief, the smart building rating is a metric that measures a building’s potential to flex its energy demand. More information on the concept and methodology used to compute the SBR can be found on our [website](https://www.centrefornetzero.org/impact/smart-building-rating). | ||
|
||
## python-template | ||
## Installation | ||
|
||
Centre for Net Zero's template for Python projects. | ||
To install this package, run | ||
|
||
Tools: | ||
|
||
* [Pipenv](https://github.com/pypa/pipenv) for dependency management | ||
* [Pytest](https://github.com/pytest-dev/pytest/) for testing | ||
* [Mypy](https://mypy.readthedocs.io/en/stable/) for type checking | ||
* [Flake8](https://flake8.pycqa.org/en/latest/) for linting | ||
* [isort](https://github.com/PyCQA/isort) and [black](https://github.com/psf/black) for formatting | ||
|
||
Github Actions workflows: | ||
* `test_and_lint.yaml` runs checks on a Ubuntu Github-hosted runner. | ||
|
||
## Python Setup | ||
|
||
You need to [set up your Python environment](https://docs.google.com/document/d/1Tg0eKalqOp-IJEeH7aShc9fYF5zn95H6jxEk25BLLUE/) first. | ||
|
||
1. Clone this repo. | ||
2. Run `make setup` in your terminal. | ||
|
||
In step 2 this will: | ||
|
||
* Run `pipenv sync --dev` to install dependencies. | ||
* Install your local pre-commit environment which will be used to maintain code standards | ||
* Check the tests work by running `pipenv run pytest` | ||
``` | ||
pip install smart-building-rating-calculator | ||
``` | ||
|
||
## Performing SBR calculation | ||
## Performing the SBR calculation | ||
|
||
Main SBR calcuation is done with the `sbr_score` (`src/smart_building_rating_calculator/calculate_sbr_score.py`) function which takes in user inputs, and outputs: | ||
The main SBR calculation is done with the [`sbr_score`](src/smart_building_rating_calculator/calculate_sbr_score.py) function which takes in user inputs, and outputs: | ||
1) SBR value (between 0 and 100) | ||
2) SBR rating (A-G) | ||
3) Flex Archetype (see `src/smart_building_rating_calculator/flexer_enums.py`). | ||
3) Flex Archetype (see [`flexer_enums.py`](`src/smart_building_rating_calculator/flexer_enums.py`)). | ||
|
||
Inputs must have datatypes as defined in `src/smart_building_rating_calculator/inputs.py` | ||
- Most inputs are `bool` type (True/False) | ||
- Others are StrEnum type e.g., `charger_power` must have a value of `EVChargerPower("3 kW")`, `EVChargerPower("7 kW")`, `EVChargerPower("22 kW")`, or `EVChargerPower("None")` | ||
- Upon calling `sbr_score`, correct input datatypes are automatically checked for. An error is raised if input datatypes are incorrect. | ||
Inputs must have datatypes as defined in [`inputs.py`](src/smart_building_rating_calculator/inputs.py`) | ||
- Most inputs are `bool` type (`True`/`False`) | ||
- Others are `StrEnum` type e.g., `charger_power` must have a value of `EVChargerPower("3 kW")`, `EVChargerPower("7 kW")`, `EVChargerPower("22 kW")`, or `EVChargerPower("None")` | ||
- Upon calling `sbr_score`, correct input datatypes are automatically checked. An error is raised if input datatypes are incorrect. | ||
|
||
Example of how to call `sbr_score` in python: | ||
Here's an example of how to compute the SBR for a given set of inputs, using the `sbr_score` function. | ||
|
||
```ruby | ||
from src.smart_building_rating_calculator.calculate_sbr_score import sbr_score | ||
from src.smart_building_rating_calculator.inputs import ( | ||
```python | ||
from smart_building_rating_calculator.calculate_sbr_score import sbr_score | ||
from smart_building_rating_calculator.inputs import ( | ||
BatterySize, | ||
EVChargerPower, | ||
HeatingSource, | ||
HotWaterSource, | ||
SolarInverterSize, | ||
) | ||
sbr_val, sbr, flex_archetype = sbr_score( | ||
smart_meter=True, | ||
smart_ev_charger=True, | ||
charger_power=EVChargerPower("7 kW"), | ||
smart_v2g_enabled=True, | ||
home_battery=True, | ||
battery_size=BatterySize("8kWh or greater"), | ||
solar_pv=True, | ||
pv_inverter_size=SolarInverterSize("4 kW or less"), | ||
electric_heating=True, | ||
heating_source=HeatingSource("Heat Pump"), | ||
hot_water_source=HotWaterSource("Heat Battery / Electric Hot Water Tank"), | ||
secondary_heating=True, | ||
secondary_hot_water=True, | ||
integrated_control_sys=True) | ||
smart_meter=True, | ||
smart_ev_charger=True, | ||
charger_power=EVChargerPower("7 kW"), | ||
smart_v2g_enabled=True, | ||
home_battery=True, | ||
battery_size=BatterySize("8kWh or greater"), | ||
solar_pv=True, | ||
pv_inverter_size=SolarInverterSize("4 kW or less"), | ||
electric_heating=True, | ||
heating_source=HeatingSource("Heat Pump"), | ||
hot_water_source=HotWaterSource("Heat Battery / Electric Hot Water Tank"), | ||
secondary_heating=True, | ||
secondary_hot_water=True, | ||
integrated_control_sys=True) | ||
``` |
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 |
---|---|---|
@@ -1,19 +1,25 @@ | ||
from setuptools import setup | ||
from setuptools import find_packages, setup | ||
|
||
VERSION = "v0.0.0" | ||
|
||
install_requires = ["pandas>=2.2"] | ||
|
||
setup( | ||
name="smart-buildings-rating-calculator", | ||
version="0.2.0", | ||
name="smart-building-rating-calculator", | ||
version=VERSION, | ||
author="Centre for Net Zero", | ||
author_email="[email protected]", | ||
description="The calculation to generate a smart building rating", | ||
long_description=open("README.md").read(), | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/centrefornetzero/smart-building-rating-calculator", | ||
package_dir={"": "src"}, | ||
packages=find_packages(where="src"), | ||
install_requires=install_requires, | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
], | ||
python_requires="==3.11", | ||
python_requires=">=3.11", | ||
) |
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,17 @@ | ||
from smart_building_rating_calculator.calculate_sbr_score import sbr_score | ||
from smart_building_rating_calculator.inputs import ( | ||
BatterySize, | ||
EVChargerPower, | ||
HeatingSource, | ||
HotWaterSource, | ||
SolarInverterSize, | ||
) | ||
|
||
__all__ = [ | ||
"sbr_score", | ||
"BatterySize", | ||
"EVChargerPower", | ||
"HeatingSource", | ||
"HotWaterSource", | ||
"SolarInverterSize", | ||
] |
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