Skip to main content

Optimizing energy assets with mixed-integer linear programming.

Project description

energy-py-linear

Checked with mypy


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 & sites can be optimized to either maximize profit or minimize carbon emissions, or a user defined custom objective function.

Energy balances are performed on electricity, high, and low temperature heat.

Setup

Requires Python 3.10+:

$ 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,
  electricity_prices=[100.0, 50, 200, -100, 0, 200, 100, -100],
  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,
  electricity_prices=[100, 50, 200, -100, 0],
  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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

energypylinear-1.4.0.tar.gz (51.1 kB view details)

Uploaded Source

Built Distribution

energypylinear-1.4.0-py3-none-any.whl (66.5 kB view details)

Uploaded Python 3

File details

Details for the file energypylinear-1.4.0.tar.gz.

File metadata

  • Download URL: energypylinear-1.4.0.tar.gz
  • Upload date:
  • Size: 51.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.5 Linux/6.5.0-1022-azure

File hashes

Hashes for energypylinear-1.4.0.tar.gz
Algorithm Hash digest
SHA256 b817259dec07b06091dd03b7ad28617fe4beb718fa693e9d8d3dd55ebd4f6841
MD5 6bd69a564cb09508840d4f397b4fb2f9
BLAKE2b-256 f052ed388ec4541f36d1d7896e64be1c21d81efeaa2eb331ab0890a86498f4e6

See more details on using hashes here.

File details

Details for the file energypylinear-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: energypylinear-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 66.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.11.5 Linux/6.5.0-1022-azure

File hashes

Hashes for energypylinear-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65650e1f5ae83f62b8d481dde51c5244c9fca428492cffd657cb6aa8367bc03b
MD5 5d7653773b20e72d18e73f91379f60cf
BLAKE2b-256 c08427b8c437613c6088394e116bd4289f50679e873c72556e314e76b43021b9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page