|
1 | | -# flixOpt: Energy and Material Flow Optimization Framework |
| 1 | +# FlixOpt: Energy and Material Flow Optimization Framework |
2 | 2 |
|
3 | 3 | [](https://flixopt.github.io/flixopt/) |
4 | 4 | [](https://github.com/flixOpt/flixopt/actions/workflows/python-app.yaml) |
5 | 5 | [](https://badge.fury.io/py/flixopt) |
6 | 6 | [](https://pypi.org/project/flixopt/) |
7 | 7 | [](https://opensource.org/licenses/MIT) |
8 | 8 |
|
9 | | -**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. |
10 | | - |
11 | 9 | --- |
12 | 10 |
|
13 | | -## 🚀 Introduction |
| 11 | +## 🚀 Purpose |
14 | 12 |
|
15 | | -flixOpt was developed by [TU Dresden](https://github.com/gewv-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](https://github.com/oemof/oemof-solph). |
| 13 | +**flixopt** is a Python-based optimization framework designed to tackle energy and material flow problems using mixed-integer linear programming (MILP). |
16 | 14 |
|
17 | | -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. |
| 15 | +**flixopt** bridges the gap between high-level energy systems models like [FINE](https://github.com/FZJ-IEK3-VSA/FINE) used for design and (multi-period) investment decisions and low-level dispatch optimization tools used for operation decisions. |
18 | 16 |
|
19 | | ---- |
| 17 | +**flixopt** leverages the fast and efficient [linopy](https://github.com/PyPSA/linopy/) for the mathematical modeling and [xarray](https://github.com/pydata/xarray) for data handling. |
20 | 18 |
|
21 | | -## 📦 Installation |
| 19 | +**flixopt** provides a user-friendly interface with options for advanced users. |
22 | 20 |
|
23 | | -Install flixOpt directly into your environment using pip. Thanks to [HiGHS](https://github.com/ERGO-Code/HiGHS?tab=readme-ov-file), flixOpt can be used without further setup. |
24 | | -`pip install flixopt` |
25 | | - |
26 | | -We recommend installing flixOpt with all dependencies, which enables interactive network visualizations by [pyvis](https://github.com/WestHealth/pyvis) and time series aggregation by [tsam](https://github.com/FZJ-IEK3-VSA/tsam). |
27 | | -`pip install "flixopt[full]"` |
| 21 | +It was originally developed by [TU Dresden](https://github.com/gewv-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](https://github.com/oemof/oemof-solph). |
28 | 22 |
|
29 | 23 | --- |
30 | 24 |
|
31 | | -## 📚 Documentation |
| 25 | +## 🌟 Key Features |
32 | 26 |
|
33 | | -Full documentation is available at [https://flixopt.github.io/flixopt/](https://flixopt.github.io/flixopt/) |
34 | | - |
35 | | -## 🌟 Key Features and Concepts |
36 | | - |
37 | | -### 💡 High-level Interface... |
38 | | - - flixOpt aims to provide a user-friendly interface for defining and solving energy systems, without sacrificing fine-grained control where necessary. |
39 | | - - This is achieved through a high-level interface with many optional or default parameters. |
40 | | - - The most important concepts are: |
41 | | - - **FlowSystem**: Represents the System that is modeled. |
42 | | - - **Flow**: A Flow represents a stream of matter or energy. In an Energy-System, it could be electricity [kW] |
43 | | - - **Bus**: A Bus represents a balancing node in the Energy-System, typically connecting a demand to a supply. |
44 | | - - **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. |
45 | | - - **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. |
46 | | - - To simplify the modeling process, high-level **Components** (CHP, Boiler, Heat Pump, Cooling Tower, Storage, etc.) are availlable. |
47 | | - |
48 | | -### 🎛️ ...with low-level control |
49 | | -- **Segmented Linear Correlations** |
50 | | - - Accurate modeling for efficiencies, investment effects, and sizes. |
51 | | -- **On/Off Variables** |
52 | | - - Modeling On/Off-Variables and their constraints. |
53 | | - - On-Hours/Off-Hours |
54 | | - - Consecutive On-Hours/ Off-Hours |
55 | | - - Switch On/Off |
56 | | - |
57 | | -### 💰 Investment Optimization |
58 | | -- flixOpt combines dispatch optimization with investment optimization in one model. |
59 | | -- Size and/or discrete investment decisions can be modeled |
60 | | -- Investment decisions can be combined with Modeling On/Off-Variables and their constraints |
61 | | - |
62 | | -### Further Features |
63 | | -- **Multiple Effects** |
64 | | - - Couple effects (e.g., specific CO2 costs) and set constraints (e.g., max CO2 emissions). |
65 | | - - Easily switch between optimization targets (e.g., minimize CO2 or costs). |
66 | | - - This allows to solve questions like "How much does it cost to reduce CO2 emissions by 20%?" |
67 | | - |
68 | | -- **Advanced Time Handling** |
69 | | - - Non-equidistant timesteps supported. |
70 | | - - Energy prices or effects in general can always be defined per hour (or per MWh...) |
71 | | - |
72 | | - - A variety of predefined constraints for operational and investment optimization can be applied. |
73 | | - - Many of these are optional and only applied when necessary, keeping the amount o variables and equations low. |
| 27 | +- **High-level Interface** with low-level control |
| 28 | + - User-friendly interface for defining flow systems |
| 29 | + - Pre-defined components like CHP, Heat Pump, Cooling Tower, etc. |
| 30 | + - Fine-grained control for advanced configurations |
74 | 31 |
|
75 | | ---- |
76 | | - |
77 | | -## 🖥️ Usage Example |
78 | | - |
79 | | - |
80 | | -**Plotting examples**: |
81 | | - |
| 32 | +- **Investment Optimization** |
| 33 | + - Combined dispatch and investment optimization |
| 34 | + - Size optimization and discrete investment decisions |
| 35 | + - Combined with On/Off variables and constraints |
82 | 36 |
|
83 | | -## ⚙️ Calculation Modes |
| 37 | +- **Effects, not only Costs --> Multi-criteria Optimization** |
| 38 | + - flixopt abstracts costs as so called 'Effects'. This allows to model costs, CO2-emissions, primary-energy-demand or area-demand at the same time. |
| 39 | + - Effects can interact with each other(e.g., specific CO2 costs) |
| 40 | + - Any of these `Effects` can be used as the optimization objective. |
| 41 | + - A **Weigted Sum** of Effects can be used as the optimization objective. |
| 42 | + - Every Effect can be constrained ($\epsilon$-constraint method). |
84 | 43 |
|
85 | | -flixOpt offers three calculation modes, tailored to different performance and accuracy needs: |
| 44 | +- **Calculation Modes** |
| 45 | + - **Full** - Solve the model with highest accuracy and computational requirements. |
| 46 | + - **Segmented** - Speed up solving by using a rolling horizon. |
| 47 | + - **Aggregated** - Speed up solving by identifying typical periods using [TSAM](https://github.com/FZJ-IEK3-VSA/tsam). Suitable for large models. |
86 | 48 |
|
87 | | -- **Full Mode** |
88 | | - - Provides exact solutions with high computational requirements. |
89 | | - - Recommended for detailed analyses and investment decision problems. |
90 | | - |
91 | | -- **Segmented Mode** |
92 | | - - Solving a Model segmentwise, this mode can speed up the solving process for complex systems, while being fairly accurate. |
93 | | - - Utilizes variable time overlap to improve accuracy. |
94 | | - - Not suitable for large storage systems or investment decisions. |
| 49 | +--- |
95 | 50 |
|
96 | | -- **Aggregated Mode** |
97 | | - - Automatically generates typical periods using [TSAM](https://github.com/FZJ-IEK3-VSA/tsam). |
98 | | - - Balances speed and accuracy, making it ideal for large-scale simulations. |
| 51 | +## 📦 Installation |
99 | 52 |
|
| 53 | +Install FlixOpt via pip. |
| 54 | +`pip install flixopt` |
| 55 | +With [HiGHS](https://github.com/ERGO-Code/HiGHS?tab=readme-ov-file) included out of the box, flixopt is ready to use.. |
100 | 56 |
|
101 | | -## 🏗️ Architecture |
| 57 | +We recommend installing FlixOpt with all dependencies, which enables additional features like interactive network visualizations ([pyvis](https://github.com/WestHealth/pyvis)) and time series aggregation ([tsam](https://github.com/FZJ-IEK3-VSA/tsam)). |
| 58 | +`pip install "flixopt[full]"` |
102 | 59 |
|
103 | | -- **Minimal coupling to Pyomo** |
104 | | - - Included independent module is used to organize variables and equations, independently of a specific modeling language. |
105 | | - - While currently only working with [Pyomo](http://www.pyomo.org/), flixOpt is designed to work with different modeling languages with minor modifications ([cvxpy](https://www.cvxpy.org)). |
| 60 | +--- |
106 | 61 |
|
107 | | -- **File-based Post-Processing Unit** |
108 | | - - Results are saved to .json and .yaml files for easy access and analysis anytime. |
109 | | - - Internal plotting functions utilizing matplotlib, plotly and pandas simplify results visualization and reporting. |
| 62 | +## 📚 Documentation |
110 | 63 |
|
111 | | - |
| 64 | +The documentation is available at [https://flixopt.github.io/flixopt/](https://flixopt.github.io/flixopt/) |
112 | 65 |
|
113 | 66 | --- |
114 | 67 |
|
115 | 68 | ## 🛠️ Solver Integration |
116 | 69 |
|
117 | | -By default, flixOpt uses the open-source solver [HiGHS](https://highs.dev/) which is installed by default. However, it is compatible with additional solvers such as: |
| 70 | +By default, FlixOpt uses the open-source solver [HiGHS](https://highs.dev/) which is installed by default. However, it is compatible with additional solvers such as: |
118 | 71 |
|
119 | | -- [CBC](https://github.com/coin-or/Cbc) |
120 | | -- [GLPK](https://www.gnu.org/software/glpk/) |
121 | 72 | - [Gurobi](https://www.gurobi.com/) |
| 73 | +- [CBC](https://github.com/coin-or/Cbc) |
| 74 | +- [GLPK](https://www.gnu.org/software/glpk/) |
122 | 75 | - [CPLEX](https://www.ibm.com/analytics/cplex-optimizer) |
123 | 76 |
|
124 | | -Executables can be found for example [here for CBC](https://portal.ampl.com/dl/open/cbc/) and [here for GLPK](https://sourceforge.net/projects/winglpk/) (Windows: You have to put solver-executables to the PATH-variable) |
125 | | - |
126 | 77 | For detailed licensing and installation instructions, refer to the respective solver documentation. |
127 | 78 |
|
128 | 79 | --- |
129 | 80 |
|
130 | 81 | ## 📖 Citation |
131 | 82 |
|
132 | | -If you use flixOpt in your research or project, please cite the following: |
| 83 | +If you use FlixOpt in your research or project, please cite the following: |
133 | 84 |
|
134 | 85 | - **Main Citation:** [DOI:10.18086/eurosun.2022.04.07](https://doi.org/10.18086/eurosun.2022.04.07) |
135 | 86 | - **Short Overview:** [DOI:10.13140/RG.2.2.14948.24969](https://doi.org/10.13140/RG.2.2.14948.24969) |
136 | | - |
137 | | ---- |
138 | | - |
139 | | -## 🔧 Development and Testing |
140 | | - |
141 | | -Run the tests using: |
142 | | - |
143 | | -```bash |
144 | | -python -m unittest discover -s tests |
0 commit comments