Skip to main content

Version DOI Documentation Status MIT license

aristopy logo

Optimizing energy systems with aristopy

The Python package aristopy is a framework for modeling and optimizing the design and operation of energy systems. The name of the framework is derived from the great Greek thinker Aristotle. For Aristotle, planning and the wise use of human goods represented great virtues. Transferred to today's time and the design of energy systems, this implies using appropriate tools that support the planning process and contribute to an optimal use of the available resources (money, fuel, etc.).

Selected highlights

  • Flexible modeling of energy systems with only a small number of basic components (Source, Sink, Conversion, Bus, Storage) and a comprehensive API.

  • Manual scripting of component constraints to enable all types of mathematical modeling classes (linear [LP], mixed-integer linear [MILP], mixed-integer non-linear [MINLP], etc.).

  • Declaration of persistent models to quickly run models iteratively after applying small changes (e.g., add an integer-cut constraint).

  • Auto-generated visualization of the optimization results with flexible plotting routines.

Documentation

The package documentation is hosted on readthedocs.org and can be accessed here.

Installation

Before you can create your first optimization model with aristopy, you need to make sure you have Python and aristopy, and at least one suitable mathematical solver installed on your machine.

The installation of aristopy in your current environment can easily be executed from the command line via pip:

pip install aristopy

More detailed installation instructions can be found in the documentation.

Examples

The code of the first simple example from the examples directory, shown below, illustrates the notation of aristopy. A detailed description of the code is provided in the documentation.

import aristopy as ar

# Create basic energy system instance
es = ar.EnergySystem(
    number_of_time_steps=3, hours_per_time_step=1,
    interest_rate=0.05, economic_lifetime=20)

# Add a gas source, two different conversion units and sinks
gas_source = ar.Source(
    ensys=es, name='gas_source', commodity_cost=20, outlet=ar.Flow('Fuel'))

gas_boiler = ar.Conversion(
    ensys=es, name='gas_boiler', basic_variable='Heat',
    inlet=ar.Flow('Fuel', 'gas_source'), outlet=ar.Flow('Heat', 'heat_sink'),
    capacity_max=150, capex_per_capacity=60e3,
    user_expressions='Heat == 0.9 * Fuel')

chp_unit = ar.Conversion(
    ensys=es, name='chp_unit', basic_variable='Elec',
    inlet=ar.Flow('Fuel', 'gas_source'),
    outlet=[ar.Flow('Heat', 'heat_sink'), ar.Flow('Elec', 'elec_sink')],
    capacity_max=100, capex_per_capacity=600e3,
    user_expressions=['Heat == 0.5 * Fuel',
                      'Elec == 0.4 * Fuel'])

heat_sink = ar.Sink(
    ensys=es, name='heat_sink', inlet=ar.Flow('Heat'),
    commodity_rate_fix=ar.Series('heat_demand', [100, 200, 150]))

elec_sink = ar.Sink(
    ensys=es, name='elec_sink', inlet=ar.Flow('Elec'), commodity_revenues=30)

# Run the optimization
es.optimize(solver='cbc', results_file='results.json')

# Plot some results
plotter = ar.Plotter('results.json')
plotter.plot_operation('heat_sink', 'Heat', lgd_pos='lower center',
                       bar_lw=0.5, ylabel='Thermal energy [MWh]')
plotter.plot_objective(lgd_pos='lower center')

The method plot_operation returns a mixed bar and line plot that visualizes the operation of a component based on a selected commodity.

operation plot

The method plot_objective returns a bar chart that summarizes the cost contributions of each component to the overall objective function value (net present value).

objective plot

Citing and Contributing

You are welcome to test aristopy and use it for your purposes. If you publish results based on the application of the package, please cite this GitLab repository or the project documentation on readthedocs.org.

If you have questions, found a bug, or want to contribute to the development of aristopy, you are invited to open an issue or contact the developers (aristopy@gmail.com).

License

MIT License

Copyright (c) 2021 Stefan Bruche (TU Berlin)

Acknowledgement

This work was developed during the research project "MINLP-Optimization of Design and Operation of Complex Energy Systems", funded by the German Federal Ministry for Economic Affairs and Energy (project reference number 03ET4053A). The funding is gratefully acknowledged.

BMWi Logo

Metadata

Release files for aristopy 0.9.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aristopy 0.9.4
File Size Uploaded
aristopy-0.9.4.tar.gz 619.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aristopy 0.9.4
File Interpreter ABI Platform
aristopy-0.9.4-py3-none-any.whl Python 3 none any Details

Total release size: 705.1 kB

Release files / aristopy-0.9.4.tar.gz

Download URL aristopy-0.9.4.tar.gz
Size 619.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6729035f1e16c947abf8a251e7f9a974199e37752ebf3ff61b2abb67fa5b55f6
BLAKE2b-256 checksum
How to use checksums
9e9c753c2843a42ff93d35d46fbb45c87a631b065370b7a5edd3e9ff9b6b3eac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.10

Release files / aristopy-0.9.4-py3-none-any.whl

Download URL aristopy-0.9.4-py3-none-any.whl
Size 85.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b91a6f33899b75faa3caa719c7f16df8791db7677fe85c29193fd08e0d4dd51
BLAKE2b-256 checksum
How to use checksums
b8bf014adf7d24b2f5e382ec4876c6508b5dbf83ba39d783116ba5556af3b7c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.7.10

Release history Release notifications | RSS feed

This release

0.9.4 This release

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page