Skip to content

Vector based Energy Optimization Framework

License

Notifications You must be signed in to change notification settings

JonasPfeiffer123/flixOpt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flixOpt: Energy and Material Flow Optimization Framework

flixOpt is a Python-based optimization framework designed to tackle energy and material flow problems using mixed-integer linear programming (MILP). Combining flexibility and efficiency, it provides a powerful platform for both dispatch and investment optimization challenges.


🚀 Introduction

flixOpt was developed by TU Dresden as part of the SMARTBIOGRID project, funded by the German Federal Ministry for Economic Affairs and Energy (FKZ: 03KB159B). Building on the Matlab-based flixOptMat framework (developed in the FAKS project), flixOpt also incorporates concepts from oemof/solph.

Although flixOpt is in its early stages, it is fully functional and ready for experimentation. It is used for investment and operation decisions by energy providing companys as well as research institutions. Feedback and collaboration are highly encouraged to help shape its future.


📦 Installation

Install flixOpt directly into your environment using pip. Thanks to HiGHS, flixOpt can be used without further setup. pip install git+https://github.com/flixOpt/flixOpt.git

We recommend installing flixOpt with additional dependencies for visualizing network graphs using pyvis: pip install "flixOpt[visualization] @ git+https://github.com/flixOpt/flixOpt.git"


🌟 Key Features and Concepts

💡 High-level Interface...

  • flixOpt aims to provide a user-friendly interface for defining and solving energy systems, without sacrificing fine-grained control where necessary.
  • This is achieved through a high-level interface with many optional or default parameters.
  • The most important concepts are:
    • FlowSystem: Represents the System that is modeled.
    • Flow: A Flow represents a stream of matter or energy. In an Energy-System, it could be electricity [kW]
    • Bus: A Bus represents a balancing node in the Energy-System, typically connecting a demand to a supply.
    • Component: A Component is a physical entity that consumes or produces matter or energy. It can also transform matter or energy into other kinds of matter or energy.
    • Effect: Flows and Components can have Effects, related to their usage (or size). Common effects are costs, CO2-emissions, primary-energy-demand or area-demand. One Effect is used as the optimization target. The others can be constrained.
  • To simplify the modeling process, high-level Components (CHP, Boiler, Heat Pump, Cooling Tower, Storage, etc.) are availlable.

🎛️ ...with low-level control

  • Segmented Linear Correlations
    • Accurate modeling for efficiencies, investment effects, and sizes.
  • On/Off Variables
    • Modeling On/Off-Variables and their constraints.
      • On-Hours/Off-Hours
      • Consecutive On-Hours/ Off-Hours
      • Switch On/Off

💰 Investment Optimization

  • flixOpt combines dispatch optimization with investment optimization in one model.
  • Size and/or discrete investment decisions can be modeled
  • Investment decisions can be combined with Modeling On/Off-Variables and their constraints

Further Features

  • Multiple Effects

    • Couple effects (e.g., specific CO2 costs) and set constraints (e.g., max CO2 emissions).
    • Easily switch between optimization targets (e.g., minimize CO2 or costs).
    • This allows to solve questions like "How much does it cost to reduce CO2 emissions by 20%?"
  • Advanced Time Handling

    • Non-equidistant timesteps supported.

    • Energy prices or effects in general can always be defined per hour (or per MWh...)

    • A variety of predefined constraints for operational and investment optimization can be applied.

    • Many of these are optional and only applied when necessary, keeping the amount o variables and equations low.


🖥️ Usage Example

Usage Example

Plotting examples: flixOpt plotting

⚙️ Calculation Modes

flixOpt offers three calculation modes, tailored to different performance and accuracy needs:

  • Full Mode

    • Provides exact solutions with high computational requirements.
    • Recommended for detailed analyses and investment decision problems.
  • Segmented Mode

    • Solving a Model segmentwise, this mode can speed up the solving process for complex systems, while being fairly accurate.
    • Utilizes variable time overlap to improve accuracy.
    • Not suitable for large storage systems or investment decisions.
  • Aggregated Mode

    • Automatically generates typical periods using TSAM.
    • Balances speed and accuracy, making it ideal for large-scale simulations.

🏗️ Architecture

  • Minimal coupling to Pyomo

    • Included independent module is used to organize variables and equations, independently of a specific modeling language.
    • While currently only working with Pyomo, flixOpt is designed to work with different modeling languages with minor modifications (cvxpy).
  • File-based Post-Processing Unit

    • Results are saved to .json and .yaml files for easy access and analysis anytime.
    • Internal plotting functions utilizing matplotlib, plotly and pandas simplify results visualization and reporting.

Architecture Diagram


🛠️ Solver Integration

By default, flixOpt uses the open-source solver HiGHS which is installed by default. However, it is compatible with additional solvers such as:

Executables can be found for example here for CBC and here for GLPK (Windows: You have to put solver-executables to the PATH-variable)

For detailed licensing and installation instructions, refer to the respective solver documentation.


📖 Citation

If you use flixOpt in your research or project, please cite the following:


🔧 Development and Testing

Run the tests using:

python -m unittest discover -s tests

About

Vector based Energy Optimization Framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%