energy-py-linear
Optimizing energy systems using mixed integer linear programming.
https://github.com/ADGEfficiency/energy-py-linear
Category: Energy Systems
Sub Category: Energy System Modeling Frameworks
Keywords
batteries electric-vehicles energy optimization python renewable-energy solar wind
Last synced: about 2 hours ago
JSON representation
Repository metadata
Optimize energy assets using mixed-integer linear programming
- Host: GitHub
- URL: https://github.com/ADGEfficiency/energy-py-linear
- Owner: ADGEfficiency
- License: gpl-3.0
- Created: 2019-01-15T21:59:41.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-03-30T09:36:42.000Z (about 1 month ago)
- Last Synced: 2025-04-17T21:21:54.186Z (14 days ago)
- Topics: batteries, electric-vehicles, energy, optimization, python, renewable-energy, solar, wind
- Language: Python
- Homepage:
- Size: 5.51 MB
- Stars: 93
- Watchers: 5
- Forks: 28
- Open Issues: 3
- Releases: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
README.md
energy-py-linear
Documentation: energypylinear.adgefficiency.com
A Python library for optimizing energy assets with mixed-integer linear programming:
- electric batteries,
- combined heat & power (CHP) generators,
- electric vehicle smart charging,
- heat pumps,
- renewable (wind & solar) generators.
Assets can be optimized to either maximize profit or minimize carbon emissions, or for user defined custom objective functions. Custom constraints can be used to further constrain asset behaviour.
A site is a collection of assets that can be optimized together. Sites can use custom objectives and constraints.
Energy balances are performed on electricity, high, and low temperature heat.
Setup
Requires Python 3.11 or 3.12:
$ pip install energypylinear
Quick Start
Asset API
The asset API allows optimizing a single asset at once:
import energypylinear as epl
# 2.0 MW, 4.0 MWh battery
asset = epl.Battery(
power_mw=2,
capacity_mwh=4,
efficiency_pct=0.9,
# different electricity prices for each interval
# length of electricity_prices is the length of the simulation
electricity_prices=[100.0, 50, 200, -100, 0, 200, 100, -100],
# a constant value for each interval
export_electricity_prices=40,
)
simulation = asset.optimize()
Site API
The site API allows optimizing multiple assets together:
import energypylinear as epl
assets = [
# 2.0 MW, 4.0 MWh battery
epl.Battery(power_mw=2.0, capacity_mwh=4.0),
# 30 MW open cycle generator
epl.CHP(
electric_power_max_mw=100, electric_power_min_mw=30, electric_efficiency_pct=0.4
),
# 2 EV chargers & 4 charge events
epl.EVs(
chargers_power_mw=[100, 100],
charge_events_capacity_mwh=[50, 100, 30, 40],
charge_events=[
[1, 0, 0, 0, 0],
[0, 1, 1, 1, 0],
[0, 0, 0, 1, 1],
[0, 1, 0, 0, 0],
],
),
# natural gas boiler to generate high temperature heat
epl.Boiler(),
# valve to generate low temperature heat from high temperature heat
epl.Valve(),
]
site = epl.Site(
assets=assets,
# length of energy prices is the length of the simulation
electricity_prices=[100, 50, 200, -100, 0],
# these should match the length of the export_electricity_prices
# if they don't, they will be repeated or cut to match the length of electricity_prices
high_temperature_load_mwh=[105, 110, 120, 110, 105],
low_temperature_load_mwh=[105, 110, 120, 110, 105],
)
simulation = site.optimize()
Documentation
See more asset types & use cases in the documentation.
Test
$ make test
Owner metadata
- Name: Adam Green
- Login: ADGEfficiency
- Email:
- Kind: user
- Description:
- Website: adgefficiency.com
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/24447881?u=e53b8b16b3d12af8f359c7fc4707da0c027e0fe3&v=4
- Repositories: 78
- Last ynced at: 2024-06-11T15:43:25.030Z
- Profile URL: https://github.com/ADGEfficiency
GitHub Events
Total
- Watch event: 5
- Delete event: 2
- Issue comment event: 1
- Push event: 12
- Pull request event: 3
- Create event: 1
Last Year
- Watch event: 5
- Delete event: 2
- Issue comment event: 1
- Push event: 12
- Pull request event: 3
- Create event: 1
Committers metadata
Last synced: about 18 hours ago
Total Commits: 151
Total Committers: 5
Avg Commits per committer: 30.2
Development Distribution Score (DDS): 0.185
Commits in past year: 11
Committers in past year: 1
Avg Commits per committer in past year: 11.0
Development Distribution Score (DDS) in past year: 0.0
Name | Commits | |
---|---|---|
Adam Green | a****n@a****m | 123 |
Thomas Harvey | t****m@a****k | 21 |
Sam | s****n@p****m | 5 |
Ben Freke | b****e@g****m | 1 |
Adam Green | u****u@i****l | 1 |
Committer domains:
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 22
Total pull requests: 58
Average time to close issues: 4 months
Average time to close pull requests: 15 days
Total issue authors: 11
Total pull request authors: 5
Average comments per issue: 2.45
Average comments per pull request: 0.19
Merged pull request: 54
Bot issues: 0
Bot pull requests: 1
Past year issues: 2
Past year pull requests: 7
Past year average time to close issues: 2 days
Past year average time to close pull requests: about 2 months
Past year issue authors: 2
Past year pull request authors: 1
Past year average comments per issue: 1.5
Past year average comments per pull request: 0.57
Past year merged pull request: 5
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- tomharvey (8)
- rzylius (3)
- ADGEfficiency (2)
- oopam (2)
- peterdudfield (1)
- matteodefelice (1)
- lucas-vivier-cvegroup (1)
- ben-freke (1)
- corneels (1)
- andreasslyngstad (1)
- Minvyd (1)
Top Pull Request Authors
- ADGEfficiency (49)
- tomharvey (6)
- ben-freke (1)
- dependabot[bot] (1)
- tonyfresko (1)
Top Issue Labels
Top Pull Request Labels
- publish (1)
- dependencies (1)
Dependencies
- actions/checkout v2 composite
- actions/setup-python v2 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- cairosvg *
- markdown-include *
- mike ==1.1.2
- mkdocs-material ==9.1.6
- mkdocstrings *
- phmdoctest *
- pillow *
- pytest *
- appnope 0.1.3 develop
- asttokens 2.2.1 develop
- attrs 23.1.0 develop
- backcall 0.2.0 develop
- beautifulsoup4 4.12.2 develop
- black 22.12.0 develop
- cffi 1.15.1 develop
- click 8.1.7 develop
- colorama 0.4.6 develop
- comm 0.1.4 develop
- coverage 6.5.0 develop
- coverage-badge 1.1.0 develop
- darglint 1.8.1 develop
- debugpy 1.6.7.post1 develop
- decorator 5.1.1 develop
- exceptiongroup 1.1.3 develop
- execnet 2.0.2 develop
- executing 1.2.0 develop
- fastjsonschema 2.18.0 develop
- flake8 6.1.0 develop
- flake8-docstring-checker 1.2 develop
- hypothesis 6.82.6 develop
- iniconfig 2.0.0 develop
- ipykernel 6.25.1 develop
- ipython 8.14.0 develop
- isort 5.12.0 develop
- jedi 0.19.0 develop
- jsonschema 4.19.0 develop
- jsonschema-specifications 2023.7.1 develop
- jupyter-client 8.3.0 develop
- jupyter-core 5.3.1 develop
- matplotlib-inline 0.1.6 develop
- mccabe 0.7.0 develop
- monotable 3.1.0 develop
- mypy 0.991 develop
- nbclient 0.6.8 develop
- nbformat 5.9.2 develop
- nbmake 1.4.3 develop
- nest-asyncio 1.5.7 develop
- parso 0.8.3 develop
- pathspec 0.11.2 develop
- pexpect 4.8.0 develop
- phmdoctest 1.4.0 develop
- pickleshare 0.7.5 develop
- platformdirs 3.10.0 develop
- pluggy 1.2.0 develop
- prompt-toolkit 3.0.39 develop
- psutil 5.9.5 develop
- ptyprocess 0.7.0 develop
- pure-eval 0.2.2 develop
- pycodestyle 2.11.0 develop
- pycparser 2.21 develop
- pyflakes 3.1.0 develop
- pytest 7.4.0 develop
- pytest-cov 4.1.0 develop
- pytest-sugar 0.9.7 develop
- pytest-xdist 3.3.1 develop
- pywin32 306 develop
- pyzmq 25.1.1 develop
- referencing 0.30.2 develop
- rpds-py 0.9.2 develop
- ruff 0.0.275 develop
- sortedcontainers 2.4.0 develop
- soupsieve 2.4.1 develop
- stack-data 0.6.2 develop
- termcolor 2.3.0 develop
- tornado 6.3.3 develop
- traitlets 5.9.0 develop
- wcwidth 0.2.6 develop
- commonmark 0.9.1
- contourpy 1.1.0
- cycler 0.11.0
- fonttools 4.42.1
- kiwisolver 1.4.5
- markdown 3.4.4
- markdown-include 0.8.1
- matplotlib 3.7.2
- multimethod 1.9.1
- mypy-extensions 1.0.0
- numpy 1.25.2
- packaging 23.1
- pandas 1.5.3
- pandera 0.14.5
- pillow 10.0.0
- pulp 2.7.0
- pydantic 1.10.12
- pygments 2.16.1
- pyparsing 3.0.9
- python-dateutil 2.8.2
- pytz 2023.3
- rich 12.6.0
- seaborn 0.12.2
- setuptools 68.1.2
- setuptools-scm 7.1.0
- six 1.16.0
- structlog 23.1.0
- tomli 2.0.1
- typing-extensions 4.7.1
- typing-inspect 0.9.0
- wrapt 1.15.0
- PuLP ^2.7.0
- markdown-include ^0.8.1
- matplotlib ^3.6.2
- numpy ^1.23.4
- pandas ^1.5.2
- pandera ^0.14.5
- pydantic ^1.10.2
- python ^3.10,<3.12
- rich ^12.0.0
- seaborn ^0.12.2
- structlog ^23.1.0
Score: 6.173786103901937