Framework for the optimization of energy systems
Project description
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.
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).
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
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aristopy-0.9.4.tar.gz
.
File metadata
- Download URL: aristopy-0.9.4.tar.gz
- Upload date:
- Size: 619.6 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6729035f1e16c947abf8a251e7f9a974199e37752ebf3ff61b2abb67fa5b55f6 |
|
MD5 | e4519ea442d44d8c32717bca688d33c7 |
|
BLAKE2b-256 | 9e9c753c2843a42ff93d35d46fbb45c87a631b065370b7a5edd3e9ff9b6b3eac |
File details
Details for the file aristopy-0.9.4-py3-none-any.whl
.
File metadata
- Download URL: aristopy-0.9.4-py3-none-any.whl
- Upload date:
- Size: 85.5 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b91a6f33899b75faa3caa719c7f16df8791db7677fe85c29193fd08e0d4dd51 |
|
MD5 | 207d428fd5068936415bd0de0c58f8b6 |
|
BLAKE2b-256 | b8bf014adf7d24b2f5e382ec4876c6508b5dbf83ba39d783116ba5556af3b7c7 |