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
Metadata
Release files for energypylinear 1.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| energypylinear-1.4.1.tar.gz | 53.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| energypylinear-1.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 123.1 kB
Release files / energypylinear-1.4.1.tar.gz
| Download URL | energypylinear-1.4.1.tar.gz |
|---|---|
| Size | 53.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba133e1716b2541117635d05f9923da156b0dab07629552d93c312ab0988de12
|
|
BLAKE2b-256 checksum How to use checksums |
c1027d1f1295afb9b23e23bb501b827036ee9a18163fcc371e6b6d742626d1b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.0 CPython/3.11.5 Linux/6.14.0-1017-azure
|
Release files / energypylinear-1.4.1-py3-none-any.whl
| Download URL | energypylinear-1.4.1-py3-none-any.whl |
|---|---|
| Size | 69.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25d4477d42768a96e29f2bcb52463e72874f2c15fb0b926c42c2f077235060bf
|
|
BLAKE2b-256 checksum How to use checksums |
ba428322bf8e14c82d07d67fb165fc3ee10f2791640c9c8d3a6179bd35bf658f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.0 CPython/3.11.5 Linux/6.14.0-1017-azure
|