flixopt 3.0.0__tar.gz → 3.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of flixopt might be problematic. Click here for more details.
- {flixopt-3.0.0 → flixopt-3.0.2}/CHANGELOG.md +29 -0
- flixopt-3.0.2/PKG-INFO +272 -0
- flixopt-3.0.2/README.md +192 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/calculation.py +9 -5
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/config.py +1 -1
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/core.py +3 -3
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/modeling.py +2 -4
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/results.py +2 -2
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/utils.py +3 -5
- flixopt-3.0.2/flixopt.egg-info/PKG-INFO +272 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt.egg-info/requires.txt +2 -2
- {flixopt-3.0.0 → flixopt-3.0.2}/pyproject.toml +3 -3
- flixopt-3.0.0/PKG-INFO +0 -209
- flixopt-3.0.0/README.md +0 -129
- flixopt-3.0.0/flixopt.egg-info/PKG-INFO +0 -209
- {flixopt-3.0.0 → flixopt-3.0.2}/LICENSE +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/MANIFEST.in +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/__init__.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/aggregation.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/commons.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/components.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/effects.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/elements.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/features.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/flow_system.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/interface.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/io.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/linear_converters.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/network_app.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/plotting.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/solvers.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt/structure.py +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt.egg-info/SOURCES.txt +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt.egg-info/dependency_links.txt +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/flixopt.egg-info/top_level.txt +0 -0
- {flixopt-3.0.0 → flixopt-3.0.2}/setup.cfg +0 -0
|
@@ -69,9 +69,38 @@ Please keep the format of the changelog consistent with the other releases, so t
|
|
|
69
69
|
---
|
|
70
70
|
Until here -->
|
|
71
71
|
|
|
72
|
+
## [3.0.2] - 2025-10-15
|
|
73
|
+
**Summary**: This is a follow-up release to **[v3.0.0](https://github.com/flixOpt/flixOpt/releases/tag/v3.0.0)**, improving the documentation.
|
|
74
|
+
|
|
75
|
+
**Note**: If upgrading from v2.x, see the [v3.0.0 release notes](https://github.com/flixOpt/flixOpt/releases/tag/v3.0.0) and [Migration Guide](https://flixopt.github.io/flixopt/latest/user-guide/migration-guide-v3/).
|
|
76
|
+
|
|
77
|
+
### 📝 Docs
|
|
78
|
+
- Update the Readme
|
|
79
|
+
- Add a project roadmap to the docs
|
|
80
|
+
- Change Development status to "Production/Stable"
|
|
81
|
+
- Regroup parts in docs
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## [3.0.1] - 2025-10-14
|
|
86
|
+
**Summary**: This is a follow-up release to **[v3.0.0](https://github.com/flixOpt/flixOpt/releases/tag/v3.0.0)**, adding a Migration Guide and bugfixing the docs.
|
|
87
|
+
|
|
88
|
+
**Note**: If upgrading from v2.x, see the [v3.0.0 release notes](https://github.com/flixOpt/flixOpt/releases/tag/v3.0.0) and [Migration Guide](https://flixopt.github.io/flixopt/latest/user-guide/migration-guide-v3/).
|
|
89
|
+
|
|
90
|
+
### 📝 Docs
|
|
91
|
+
- Fixed deployed docs
|
|
92
|
+
- Added Migration Guide for flixopt 3
|
|
93
|
+
|
|
94
|
+
### 👷 Development
|
|
95
|
+
- Added missing type hints
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
72
99
|
## [3.0.0] - 2025-10-13
|
|
73
100
|
**Summary**: This release introduces new model dimensions (periods and scenarios) for multi-period investments and stochastic modeling, along with a redesigned effect sharing system and enhanced I/O capabilities.
|
|
74
101
|
|
|
102
|
+
**Note**: If upgrading from v2.x, see the [v3.0.0 release notes](https://github.com/flixOpt/flixOpt/releases/tag/v3.0.0) and [Migration Guide](https://flixopt.github.io/flixopt/latest/user-guide/migration-guide-v3/).
|
|
103
|
+
|
|
75
104
|
### ✨ Added
|
|
76
105
|
|
|
77
106
|
**New model dimensions:**
|
flixopt-3.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flixopt
|
|
3
|
+
Version: 3.0.2
|
|
4
|
+
Summary: Vector based energy and material flow optimization framework in Python.
|
|
5
|
+
Author-email: "Chair of Building Energy Systems and Heat Supply, TU Dresden" <peter.stange@tu-dresden.de>, Felix Bumann <felixbumann387@gmail.com>, Felix Panitz <baumbude@googlemail.com>, Peter Stange <peter.stange@tu-dresden.de>
|
|
6
|
+
Maintainer-email: Felix Bumann <felixbumann387@gmail.com>, Peter Stange <peter.stange@tu-dresden.de>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: homepage, https://tu-dresden.de/ing/maschinenwesen/iet/gewv/forschung/forschungsprojekte/flixopt
|
|
9
|
+
Project-URL: repository, https://github.com/flixOpt/flixopt
|
|
10
|
+
Project-URL: documentation, https://flixopt.github.io/flixopt/
|
|
11
|
+
Keywords: optimization,energy systems,numerical analysis
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Intended Audience :: Science/Research
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: numpy<3,>=1.21.5
|
|
24
|
+
Requires-Dist: pandas<3,>=2.0.0
|
|
25
|
+
Requires-Dist: xarray<2026.0,>=2024.2.0
|
|
26
|
+
Requires-Dist: linopy<0.6,>=0.5.1
|
|
27
|
+
Requires-Dist: h5netcdf<2,>=1.0.0
|
|
28
|
+
Requires-Dist: pyyaml<7,>=6.0.0
|
|
29
|
+
Requires-Dist: rich<15,>=13.0.0
|
|
30
|
+
Requires-Dist: tomli<3,>=2.0.1; python_version < "3.11"
|
|
31
|
+
Requires-Dist: highspy<2,>=1.5.3
|
|
32
|
+
Requires-Dist: matplotlib<4,>=3.5.2
|
|
33
|
+
Requires-Dist: plotly<7,>=5.15.0
|
|
34
|
+
Requires-Dist: numexpr<2.14,>=2.8.4; python_version < "3.11"
|
|
35
|
+
Provides-Extra: network-viz
|
|
36
|
+
Requires-Dist: dash<4,>=3.0.0; extra == "network-viz"
|
|
37
|
+
Requires-Dist: dash-cytoscape<2,>=1.0.0; extra == "network-viz"
|
|
38
|
+
Requires-Dist: dash-daq<1,>=0.6.0; extra == "network-viz"
|
|
39
|
+
Requires-Dist: networkx<4,>=3.0.0; extra == "network-viz"
|
|
40
|
+
Requires-Dist: werkzeug<4,>=3.0.0; extra == "network-viz"
|
|
41
|
+
Requires-Dist: flask<4,>=3.0.0; extra == "network-viz"
|
|
42
|
+
Provides-Extra: full
|
|
43
|
+
Requires-Dist: pyvis==0.3.2; extra == "full"
|
|
44
|
+
Requires-Dist: tsam<3,>=2.3.1; extra == "full"
|
|
45
|
+
Requires-Dist: scipy<2,>=1.15.1; extra == "full"
|
|
46
|
+
Requires-Dist: gurobipy<13,>=10.0.0; extra == "full"
|
|
47
|
+
Requires-Dist: dash<4,>=3.0.0; extra == "full"
|
|
48
|
+
Requires-Dist: dash-cytoscape<2,>=1.0.0; extra == "full"
|
|
49
|
+
Requires-Dist: dash-daq<1,>=0.6.0; extra == "full"
|
|
50
|
+
Requires-Dist: networkx<4,>=3.0.0; extra == "full"
|
|
51
|
+
Requires-Dist: werkzeug<4,>=3.0.0; extra == "full"
|
|
52
|
+
Requires-Dist: flask<4,>=3.0.0; extra == "full"
|
|
53
|
+
Provides-Extra: dev
|
|
54
|
+
Requires-Dist: pytest==8.4.2; extra == "dev"
|
|
55
|
+
Requires-Dist: pytest-xdist==3.8.0; extra == "dev"
|
|
56
|
+
Requires-Dist: nbformat==5.10.4; extra == "dev"
|
|
57
|
+
Requires-Dist: ruff==0.13.3; extra == "dev"
|
|
58
|
+
Requires-Dist: pre-commit==4.3.0; extra == "dev"
|
|
59
|
+
Requires-Dist: pyvis==0.3.2; extra == "dev"
|
|
60
|
+
Requires-Dist: tsam==2.3.9; extra == "dev"
|
|
61
|
+
Requires-Dist: scipy==1.15.1; extra == "dev"
|
|
62
|
+
Requires-Dist: gurobipy==12.0.3; extra == "dev"
|
|
63
|
+
Requires-Dist: dash==3.0.0; extra == "dev"
|
|
64
|
+
Requires-Dist: dash-cytoscape==1.0.2; extra == "dev"
|
|
65
|
+
Requires-Dist: dash-daq==0.6.0; extra == "dev"
|
|
66
|
+
Requires-Dist: networkx==3.0.0; extra == "dev"
|
|
67
|
+
Requires-Dist: werkzeug==3.0.0; extra == "dev"
|
|
68
|
+
Provides-Extra: docs
|
|
69
|
+
Requires-Dist: mkdocs-material==9.6.21; extra == "docs"
|
|
70
|
+
Requires-Dist: mkdocstrings-python==1.18.2; extra == "docs"
|
|
71
|
+
Requires-Dist: mkdocs-table-reader-plugin==3.1.0; extra == "docs"
|
|
72
|
+
Requires-Dist: mkdocs-gen-files==0.5.0; extra == "docs"
|
|
73
|
+
Requires-Dist: mkdocs-include-markdown-plugin==7.1.7; extra == "docs"
|
|
74
|
+
Requires-Dist: mkdocs-literate-nav==0.6.2; extra == "docs"
|
|
75
|
+
Requires-Dist: markdown-include==0.8.1; extra == "docs"
|
|
76
|
+
Requires-Dist: pymdown-extensions==10.16.1; extra == "docs"
|
|
77
|
+
Requires-Dist: pygments==2.19.2; extra == "docs"
|
|
78
|
+
Requires-Dist: mike==2.1.3; extra == "docs"
|
|
79
|
+
Dynamic: license-file
|
|
80
|
+
|
|
81
|
+
# FlixOpt: Energy and Material Flow Optimization Framework
|
|
82
|
+
|
|
83
|
+
[](https://flixopt.github.io/flixopt/latest/)
|
|
84
|
+
[](https://github.com/flixOpt/flixopt/actions/workflows/python-app.yaml)
|
|
85
|
+
[](https://pypi.org/project/flixopt/)
|
|
86
|
+
[](https://pypi.org/project/flixopt/)
|
|
87
|
+
[](https://pypi.org/project/flixopt/)
|
|
88
|
+
[](https://opensource.org/licenses/MIT)
|
|
89
|
+
[](https://pypi.org/project/flixopt/)
|
|
90
|
+
[](https://github.com/flixOpt/flixopt/commits/main)
|
|
91
|
+
[](https://github.com/flixOpt/flixopt/issues)
|
|
92
|
+
[](https://results.pre-commit.ci/latest/github/flixOpt/flixopt/main)
|
|
93
|
+
[](https://github.com/astral-sh/ruff)
|
|
94
|
+
[](https://github.com/PyPSA/linopy/)
|
|
95
|
+
[](https://xarray.dev/)
|
|
96
|
+
[](https://doi.org/10.18086/eurosun.2022.04.07)
|
|
97
|
+
[](https://github.com/flixOpt/flixopt/stargazers)
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
**FlixOpt is a Python framework for optimizing energy and material flow systems** - from district heating networks to industrial production lines, from renewable energy portfolios to supply chain logistics.
|
|
102
|
+
|
|
103
|
+
**Start simple, scale complex:** Build a working optimization model in minutes, then progressively add detail - multi-period investments, stochastic scenarios, custom constraints - without rewriting your code.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 🚀 Quick Start
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pip install flixopt
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
That's it! FlixOpt comes with the [HiGHS](https://highs.dev/) solver included. You're ready to optimize.
|
|
114
|
+
|
|
115
|
+
**The basic workflow:**
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
import flixopt as fx
|
|
119
|
+
|
|
120
|
+
# 1. Define your system structure
|
|
121
|
+
flow_system = fx.FlowSystem(timesteps)
|
|
122
|
+
flow_system.add_elements(buses, components, effects)
|
|
123
|
+
|
|
124
|
+
# 2. Create and solve
|
|
125
|
+
calculation = fx.FullCalculation("MyModel", flow_system)
|
|
126
|
+
calculation.solve()
|
|
127
|
+
|
|
128
|
+
# 3. Analyze results
|
|
129
|
+
calculation.results.solution
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Get started with real examples:**
|
|
133
|
+
- 📚 [Full Documentation](https://flixopt.github.io/flixopt/latest/)
|
|
134
|
+
- 💡 [Examples Gallery](https://flixopt.github.io/flixopt/latest/examples/) - Complete working examples from simple to complex
|
|
135
|
+
- 🔧 [API Reference](https://flixopt.github.io/flixopt/latest/api-reference/)
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## 🌟 Why FlixOpt?
|
|
140
|
+
|
|
141
|
+
### Progressive Enhancement - Your Model Grows With You
|
|
142
|
+
|
|
143
|
+
**Start simple:**
|
|
144
|
+
```python
|
|
145
|
+
# Basic single-period model
|
|
146
|
+
flow_system = fx.FlowSystem(timesteps)
|
|
147
|
+
boiler = fx.Boiler("Boiler", eta=0.9, ...)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Add complexity incrementally:**
|
|
151
|
+
- **Investment decisions** → Add `InvestParameters` to components
|
|
152
|
+
- **Multi-period planning** → Add `periods` dimension to FlowSystem
|
|
153
|
+
- **Uncertainty modeling** → Add `scenarios` dimension with probabilities
|
|
154
|
+
- **Custom constraints** → Extend with native linopy syntax
|
|
155
|
+
|
|
156
|
+
**No refactoring required.** Your component definitions stay the same - periods, scenarios, and features are added as dimensions and parameters.
|
|
157
|
+
|
|
158
|
+
→ [Learn more about multi-period and stochastic modeling](https://flixopt.github.io/flixopt/latest/user-guide/mathematical-notation/dimensions/)
|
|
159
|
+
|
|
160
|
+
### For Everyone
|
|
161
|
+
|
|
162
|
+
- **Beginners:** High-level components that "just work"
|
|
163
|
+
- **Experts:** Full access to modify models with linopy
|
|
164
|
+
- **Researchers:** Quick prototyping with customization options
|
|
165
|
+
- **Engineers:** Reliable, tested components without black boxes
|
|
166
|
+
- **Students:** Clear, Pythonic interfaces for learning optimization
|
|
167
|
+
|
|
168
|
+
### Key Features
|
|
169
|
+
|
|
170
|
+
**Multi-criteria optimization:** Model costs, emissions, resource use - any custom metric. Optimize single objectives or use weighted combinations and ε-constraints.
|
|
171
|
+
→ [Effects documentation](https://flixopt.github.io/flixopt/latest/user-guide/mathematical-notation/effects-penalty-objective/)
|
|
172
|
+
|
|
173
|
+
**Performance at any scale:** Choose calculation modes without changing your model - Full, Segmented, or Aggregated (using [TSAM](https://github.com/FZJ-IEK3-VSA/tsam)).
|
|
174
|
+
→ [Calculation modes](https://flixopt.github.io/flixopt/latest/api-reference/calculation/)
|
|
175
|
+
|
|
176
|
+
**Built for reproducibility:** Self-contained NetCDF result files with complete model information. Load results months later - everything is preserved.
|
|
177
|
+
→ [Results documentation](https://flixopt.github.io/flixopt/latest/api-reference/results/)
|
|
178
|
+
|
|
179
|
+
**Flexible data operations:** Transform FlowSystems with xarray-style operations (`sel()`, `resample()`) for multi-stage optimization.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 🎯 What is FlixOpt?
|
|
184
|
+
|
|
185
|
+
### A General-Purpose Flow Optimization Framework
|
|
186
|
+
|
|
187
|
+
FlixOpt models **any system involving flows and conversions:**
|
|
188
|
+
|
|
189
|
+
- **Energy systems:** District heating/cooling, microgrids, renewable portfolios, sector coupling
|
|
190
|
+
- **Material flows:** Supply chains, production lines, chemical processes
|
|
191
|
+
- **Integrated systems:** Water-energy nexus, industrial symbiosis
|
|
192
|
+
|
|
193
|
+
While energy systems are our primary focus, the same foundation applies universally. This enables coupling different system types within integrated models.
|
|
194
|
+
|
|
195
|
+
### Modern Foundations
|
|
196
|
+
|
|
197
|
+
Built on [linopy](https://github.com/PyPSA/linopy/) and [xarray](https://github.com/pydata/xarray), FlixOpt delivers **performance** and **transparency**. Full access to variables, constraints, and model structure. Extend anything with native linopy syntax.
|
|
198
|
+
|
|
199
|
+
### Our Position
|
|
200
|
+
|
|
201
|
+
We bridge the gap between high-level strategic models (like [FINE](https://github.com/FZJ-IEK3-VSA/FINE)) and low-level dispatch tools - similar to [PyPSA](https://docs.pypsa.org/latest/). FlixOpt is the sweet spot for detailed operational planning and long-term investment analysis in the **same framework**.
|
|
202
|
+
|
|
203
|
+
### Academic Roots
|
|
204
|
+
|
|
205
|
+
Originally developed at [TU Dresden](https://github.com/gewv-tu-dresden) for the SMARTBIOGRID project (funded by the German Federal Ministry for Economic Affairs and Energy, FKZ: 03KB159B). FlixOpt evolved from the MATLAB-based flixOptMat framework while incorporating best practices from [oemof/solph](https://github.com/oemof/oemof-solph).
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## 🛣️ Roadmap
|
|
210
|
+
|
|
211
|
+
**FlixOpt aims to be the most accessible, flexible, and universal Python framework for energy and material flow optimization.** We believe optimization modeling should be approachable for beginners yet powerful for experts, minimizing context switching between different planning horizons.
|
|
212
|
+
|
|
213
|
+
**Current focus:**
|
|
214
|
+
- Enhanced component library (sector coupling, hydrogen, thermal networks)
|
|
215
|
+
- Examples showcasing multi-period and stochastic modeling
|
|
216
|
+
- Advanced result analysis and visualization
|
|
217
|
+
|
|
218
|
+
**Future vision:**
|
|
219
|
+
- Modeling to generate alternatives (MGA) for robust decision-making
|
|
220
|
+
- Advanced stochastic optimization (two-stage, CVaR)
|
|
221
|
+
- Community ecosystem of user-contributed components
|
|
222
|
+
|
|
223
|
+
→ [Full roadmap and vision](https://flixopt.github.io/flixopt/latest/roadmap/)
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 🛠️ Installation
|
|
228
|
+
|
|
229
|
+
### Basic Installation
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
pip install flixopt
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Includes the [HiGHS](https://highs.dev/) solver - you're ready to optimize immediately.
|
|
236
|
+
|
|
237
|
+
### Full Installation
|
|
238
|
+
|
|
239
|
+
For additional features (interactive network visualization, time series aggregation):
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
pip install "flixopt[full]"
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Solver Support
|
|
246
|
+
|
|
247
|
+
FlixOpt supports many solvers via linopy: **HiGHS** (included), **Gurobi**, **CPLEX**, **CBC**, **GLPK**, and more.
|
|
248
|
+
|
|
249
|
+
→ [Installation guide](https://flixopt.github.io/flixopt/latest/getting-started/)
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## 🤝 Contributing
|
|
254
|
+
|
|
255
|
+
FlixOpt thrives on community input. Whether you're fixing bugs, adding components, improving docs, or sharing use cases - **we welcome your contributions.**
|
|
256
|
+
|
|
257
|
+
→ [Contribution guide](https://flixopt.github.io/flixopt/latest/contribute/)
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## 📖 Citation
|
|
262
|
+
|
|
263
|
+
If FlixOpt supports your research or project, please cite:
|
|
264
|
+
|
|
265
|
+
- **Main Citation:** [DOI:10.18086/eurosun.2022.04.07](https://doi.org/10.18086/eurosun.2022.04.07)
|
|
266
|
+
- **Short Overview:** [DOI:10.13140/RG.2.2.14948.24969](https://doi.org/10.13140/RG.2.2.14948.24969)
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## 📄 License
|
|
271
|
+
|
|
272
|
+
MIT License - See [LICENSE](https://github.com/flixopt/flixopt/blob/main/LICENSE) for details.
|
flixopt-3.0.2/README.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# FlixOpt: Energy and Material Flow Optimization Framework
|
|
2
|
+
|
|
3
|
+
[](https://flixopt.github.io/flixopt/latest/)
|
|
4
|
+
[](https://github.com/flixOpt/flixopt/actions/workflows/python-app.yaml)
|
|
5
|
+
[](https://pypi.org/project/flixopt/)
|
|
6
|
+
[](https://pypi.org/project/flixopt/)
|
|
7
|
+
[](https://pypi.org/project/flixopt/)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](https://pypi.org/project/flixopt/)
|
|
10
|
+
[](https://github.com/flixOpt/flixopt/commits/main)
|
|
11
|
+
[](https://github.com/flixOpt/flixopt/issues)
|
|
12
|
+
[](https://results.pre-commit.ci/latest/github/flixOpt/flixopt/main)
|
|
13
|
+
[](https://github.com/astral-sh/ruff)
|
|
14
|
+
[](https://github.com/PyPSA/linopy/)
|
|
15
|
+
[](https://xarray.dev/)
|
|
16
|
+
[](https://doi.org/10.18086/eurosun.2022.04.07)
|
|
17
|
+
[](https://github.com/flixOpt/flixopt/stargazers)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
**FlixOpt is a Python framework for optimizing energy and material flow systems** - from district heating networks to industrial production lines, from renewable energy portfolios to supply chain logistics.
|
|
22
|
+
|
|
23
|
+
**Start simple, scale complex:** Build a working optimization model in minutes, then progressively add detail - multi-period investments, stochastic scenarios, custom constraints - without rewriting your code.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 🚀 Quick Start
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install flixopt
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
That's it! FlixOpt comes with the [HiGHS](https://highs.dev/) solver included. You're ready to optimize.
|
|
34
|
+
|
|
35
|
+
**The basic workflow:**
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
import flixopt as fx
|
|
39
|
+
|
|
40
|
+
# 1. Define your system structure
|
|
41
|
+
flow_system = fx.FlowSystem(timesteps)
|
|
42
|
+
flow_system.add_elements(buses, components, effects)
|
|
43
|
+
|
|
44
|
+
# 2. Create and solve
|
|
45
|
+
calculation = fx.FullCalculation("MyModel", flow_system)
|
|
46
|
+
calculation.solve()
|
|
47
|
+
|
|
48
|
+
# 3. Analyze results
|
|
49
|
+
calculation.results.solution
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Get started with real examples:**
|
|
53
|
+
- 📚 [Full Documentation](https://flixopt.github.io/flixopt/latest/)
|
|
54
|
+
- 💡 [Examples Gallery](https://flixopt.github.io/flixopt/latest/examples/) - Complete working examples from simple to complex
|
|
55
|
+
- 🔧 [API Reference](https://flixopt.github.io/flixopt/latest/api-reference/)
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 🌟 Why FlixOpt?
|
|
60
|
+
|
|
61
|
+
### Progressive Enhancement - Your Model Grows With You
|
|
62
|
+
|
|
63
|
+
**Start simple:**
|
|
64
|
+
```python
|
|
65
|
+
# Basic single-period model
|
|
66
|
+
flow_system = fx.FlowSystem(timesteps)
|
|
67
|
+
boiler = fx.Boiler("Boiler", eta=0.9, ...)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Add complexity incrementally:**
|
|
71
|
+
- **Investment decisions** → Add `InvestParameters` to components
|
|
72
|
+
- **Multi-period planning** → Add `periods` dimension to FlowSystem
|
|
73
|
+
- **Uncertainty modeling** → Add `scenarios` dimension with probabilities
|
|
74
|
+
- **Custom constraints** → Extend with native linopy syntax
|
|
75
|
+
|
|
76
|
+
**No refactoring required.** Your component definitions stay the same - periods, scenarios, and features are added as dimensions and parameters.
|
|
77
|
+
|
|
78
|
+
→ [Learn more about multi-period and stochastic modeling](https://flixopt.github.io/flixopt/latest/user-guide/mathematical-notation/dimensions/)
|
|
79
|
+
|
|
80
|
+
### For Everyone
|
|
81
|
+
|
|
82
|
+
- **Beginners:** High-level components that "just work"
|
|
83
|
+
- **Experts:** Full access to modify models with linopy
|
|
84
|
+
- **Researchers:** Quick prototyping with customization options
|
|
85
|
+
- **Engineers:** Reliable, tested components without black boxes
|
|
86
|
+
- **Students:** Clear, Pythonic interfaces for learning optimization
|
|
87
|
+
|
|
88
|
+
### Key Features
|
|
89
|
+
|
|
90
|
+
**Multi-criteria optimization:** Model costs, emissions, resource use - any custom metric. Optimize single objectives or use weighted combinations and ε-constraints.
|
|
91
|
+
→ [Effects documentation](https://flixopt.github.io/flixopt/latest/user-guide/mathematical-notation/effects-penalty-objective/)
|
|
92
|
+
|
|
93
|
+
**Performance at any scale:** Choose calculation modes without changing your model - Full, Segmented, or Aggregated (using [TSAM](https://github.com/FZJ-IEK3-VSA/tsam)).
|
|
94
|
+
→ [Calculation modes](https://flixopt.github.io/flixopt/latest/api-reference/calculation/)
|
|
95
|
+
|
|
96
|
+
**Built for reproducibility:** Self-contained NetCDF result files with complete model information. Load results months later - everything is preserved.
|
|
97
|
+
→ [Results documentation](https://flixopt.github.io/flixopt/latest/api-reference/results/)
|
|
98
|
+
|
|
99
|
+
**Flexible data operations:** Transform FlowSystems with xarray-style operations (`sel()`, `resample()`) for multi-stage optimization.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 🎯 What is FlixOpt?
|
|
104
|
+
|
|
105
|
+
### A General-Purpose Flow Optimization Framework
|
|
106
|
+
|
|
107
|
+
FlixOpt models **any system involving flows and conversions:**
|
|
108
|
+
|
|
109
|
+
- **Energy systems:** District heating/cooling, microgrids, renewable portfolios, sector coupling
|
|
110
|
+
- **Material flows:** Supply chains, production lines, chemical processes
|
|
111
|
+
- **Integrated systems:** Water-energy nexus, industrial symbiosis
|
|
112
|
+
|
|
113
|
+
While energy systems are our primary focus, the same foundation applies universally. This enables coupling different system types within integrated models.
|
|
114
|
+
|
|
115
|
+
### Modern Foundations
|
|
116
|
+
|
|
117
|
+
Built on [linopy](https://github.com/PyPSA/linopy/) and [xarray](https://github.com/pydata/xarray), FlixOpt delivers **performance** and **transparency**. Full access to variables, constraints, and model structure. Extend anything with native linopy syntax.
|
|
118
|
+
|
|
119
|
+
### Our Position
|
|
120
|
+
|
|
121
|
+
We bridge the gap between high-level strategic models (like [FINE](https://github.com/FZJ-IEK3-VSA/FINE)) and low-level dispatch tools - similar to [PyPSA](https://docs.pypsa.org/latest/). FlixOpt is the sweet spot for detailed operational planning and long-term investment analysis in the **same framework**.
|
|
122
|
+
|
|
123
|
+
### Academic Roots
|
|
124
|
+
|
|
125
|
+
Originally developed at [TU Dresden](https://github.com/gewv-tu-dresden) for the SMARTBIOGRID project (funded by the German Federal Ministry for Economic Affairs and Energy, FKZ: 03KB159B). FlixOpt evolved from the MATLAB-based flixOptMat framework while incorporating best practices from [oemof/solph](https://github.com/oemof/oemof-solph).
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 🛣️ Roadmap
|
|
130
|
+
|
|
131
|
+
**FlixOpt aims to be the most accessible, flexible, and universal Python framework for energy and material flow optimization.** We believe optimization modeling should be approachable for beginners yet powerful for experts, minimizing context switching between different planning horizons.
|
|
132
|
+
|
|
133
|
+
**Current focus:**
|
|
134
|
+
- Enhanced component library (sector coupling, hydrogen, thermal networks)
|
|
135
|
+
- Examples showcasing multi-period and stochastic modeling
|
|
136
|
+
- Advanced result analysis and visualization
|
|
137
|
+
|
|
138
|
+
**Future vision:**
|
|
139
|
+
- Modeling to generate alternatives (MGA) for robust decision-making
|
|
140
|
+
- Advanced stochastic optimization (two-stage, CVaR)
|
|
141
|
+
- Community ecosystem of user-contributed components
|
|
142
|
+
|
|
143
|
+
→ [Full roadmap and vision](https://flixopt.github.io/flixopt/latest/roadmap/)
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 🛠️ Installation
|
|
148
|
+
|
|
149
|
+
### Basic Installation
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
pip install flixopt
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Includes the [HiGHS](https://highs.dev/) solver - you're ready to optimize immediately.
|
|
156
|
+
|
|
157
|
+
### Full Installation
|
|
158
|
+
|
|
159
|
+
For additional features (interactive network visualization, time series aggregation):
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
pip install "flixopt[full]"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Solver Support
|
|
166
|
+
|
|
167
|
+
FlixOpt supports many solvers via linopy: **HiGHS** (included), **Gurobi**, **CPLEX**, **CBC**, **GLPK**, and more.
|
|
168
|
+
|
|
169
|
+
→ [Installation guide](https://flixopt.github.io/flixopt/latest/getting-started/)
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 🤝 Contributing
|
|
174
|
+
|
|
175
|
+
FlixOpt thrives on community input. Whether you're fixing bugs, adding components, improving docs, or sharing use cases - **we welcome your contributions.**
|
|
176
|
+
|
|
177
|
+
→ [Contribution guide](https://flixopt.github.io/flixopt/latest/contribute/)
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## 📖 Citation
|
|
182
|
+
|
|
183
|
+
If FlixOpt supports your research or project, please cite:
|
|
184
|
+
|
|
185
|
+
- **Main Citation:** [DOI:10.18086/eurosun.2022.04.07](https://doi.org/10.18086/eurosun.2022.04.07)
|
|
186
|
+
- **Short Overview:** [DOI:10.13140/RG.2.2.14948.24969](https://doi.org/10.13140/RG.2.2.14948.24969)
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 📄 License
|
|
191
|
+
|
|
192
|
+
MIT License - See [LICENSE](https://github.com/flixopt/flixopt/blob/main/LICENSE) for details.
|
|
@@ -23,7 +23,7 @@ import yaml
|
|
|
23
23
|
|
|
24
24
|
from . import io as fx_io
|
|
25
25
|
from . import utils as utils
|
|
26
|
-
from .aggregation import AggregationModel, AggregationParameters
|
|
26
|
+
from .aggregation import Aggregation, AggregationModel, AggregationParameters
|
|
27
27
|
from .components import Storage
|
|
28
28
|
from .config import CONFIG
|
|
29
29
|
from .core import DataConverter, Scalar, TimeSeriesData, drop_constant_arrays
|
|
@@ -286,7 +286,10 @@ class AggregatedCalculation(FullCalculation):
|
|
|
286
286
|
This equalizes variables in the components according to the typical periods computed in the aggregation
|
|
287
287
|
active_timesteps: DatetimeIndex of timesteps to use for calculation. If None, all timesteps are used
|
|
288
288
|
folder: Folder where results should be saved. If None, current working directory is used
|
|
289
|
-
|
|
289
|
+
|
|
290
|
+
Attributes:
|
|
291
|
+
aggregation (Aggregation | None): Contains the clustered time series data
|
|
292
|
+
aggregation_model (AggregationModel | None): Contains Variables and Constraints that equalize clusters of the time series data
|
|
290
293
|
"""
|
|
291
294
|
|
|
292
295
|
def __init__(
|
|
@@ -306,7 +309,8 @@ class AggregatedCalculation(FullCalculation):
|
|
|
306
309
|
super().__init__(name, flow_system, active_timesteps, folder=folder)
|
|
307
310
|
self.aggregation_parameters = aggregation_parameters
|
|
308
311
|
self.components_to_clusterize = components_to_clusterize
|
|
309
|
-
self.aggregation = None
|
|
312
|
+
self.aggregation: Aggregation | None = None
|
|
313
|
+
self.aggregation_model: AggregationModel | None = None
|
|
310
314
|
|
|
311
315
|
def do_modeling(self) -> AggregatedCalculation:
|
|
312
316
|
t_start = timeit.default_timer()
|
|
@@ -317,10 +321,10 @@ class AggregatedCalculation(FullCalculation):
|
|
|
317
321
|
self.model = self.flow_system.create_model(self.normalize_weights)
|
|
318
322
|
self.model.do_modeling()
|
|
319
323
|
# Add Aggregation Submodel after modeling the rest
|
|
320
|
-
self.
|
|
324
|
+
self.aggregation_model = AggregationModel(
|
|
321
325
|
self.model, self.aggregation_parameters, self.flow_system, self.aggregation, self.components_to_clusterize
|
|
322
326
|
)
|
|
323
|
-
self.
|
|
327
|
+
self.aggregation_model.do_modeling()
|
|
324
328
|
self.durations['modeling'] = round(timeit.default_timer() - t_start, 2)
|
|
325
329
|
return self
|
|
326
330
|
|
|
@@ -6,7 +6,7 @@ It provides Datatypes, logging functionality, and some functions to transform da
|
|
|
6
6
|
import logging
|
|
7
7
|
import warnings
|
|
8
8
|
from itertools import permutations
|
|
9
|
-
from typing import Literal, Union
|
|
9
|
+
from typing import Any, Literal, Union
|
|
10
10
|
|
|
11
11
|
import numpy as np
|
|
12
12
|
import pandas as pd
|
|
@@ -46,12 +46,12 @@ class TimeSeriesData(xr.DataArray):
|
|
|
46
46
|
|
|
47
47
|
def __init__(
|
|
48
48
|
self,
|
|
49
|
-
*args,
|
|
49
|
+
*args: Any,
|
|
50
50
|
aggregation_group: str | None = None,
|
|
51
51
|
aggregation_weight: float | None = None,
|
|
52
52
|
agg_group: str | None = None,
|
|
53
53
|
agg_weight: float | None = None,
|
|
54
|
-
**kwargs,
|
|
54
|
+
**kwargs: Any,
|
|
55
55
|
):
|
|
56
56
|
"""
|
|
57
57
|
Args:
|
|
@@ -396,7 +396,7 @@ class BoundingPatterns:
|
|
|
396
396
|
variable: linopy.Variable,
|
|
397
397
|
bounds: tuple[TemporalData, TemporalData],
|
|
398
398
|
name: str = None,
|
|
399
|
-
):
|
|
399
|
+
) -> list[linopy.constraints.Constraint]:
|
|
400
400
|
"""Create simple bounds.
|
|
401
401
|
variable ∈ [lower_bound, upper_bound]
|
|
402
402
|
|
|
@@ -409,9 +409,7 @@ class BoundingPatterns:
|
|
|
409
409
|
bounds: Tuple of (lower_bound, upper_bound) absolute bounds
|
|
410
410
|
|
|
411
411
|
Returns:
|
|
412
|
-
|
|
413
|
-
- variables (Dict): Empty dict
|
|
414
|
-
- constraints (Dict[str, linopy.Constraint]): 'ub', 'lb'
|
|
412
|
+
List containing lower_bound and upper_bound constraints
|
|
415
413
|
"""
|
|
416
414
|
if not isinstance(model, Submodel):
|
|
417
415
|
raise ValueError('BoundingPatterns.basic_bounds() can only be used with a Submodel')
|
|
@@ -1243,7 +1243,7 @@ class ComponentResults(_NodeResults):
|
|
|
1243
1243
|
class EffectResults(_ElementResults):
|
|
1244
1244
|
"""Results for an Effect"""
|
|
1245
1245
|
|
|
1246
|
-
def get_shares_from(self, element: str):
|
|
1246
|
+
def get_shares_from(self, element: str) -> xr.Dataset:
|
|
1247
1247
|
"""Get effect shares from specific element.
|
|
1248
1248
|
|
|
1249
1249
|
Args:
|
|
@@ -1399,7 +1399,7 @@ class SegmentedCalculationResults:
|
|
|
1399
1399
|
)
|
|
1400
1400
|
|
|
1401
1401
|
@classmethod
|
|
1402
|
-
def from_file(cls, folder: str | pathlib.Path, name: str):
|
|
1402
|
+
def from_file(cls, folder: str | pathlib.Path, name: str) -> SegmentedCalculationResults:
|
|
1403
1403
|
"""Load SegmentedCalculationResults from saved files.
|
|
1404
1404
|
|
|
1405
1405
|
Args:
|
|
@@ -5,7 +5,7 @@ This module contains several utility functions used throughout the flixopt frame
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
7
7
|
import logging
|
|
8
|
-
from typing import Literal
|
|
8
|
+
from typing import Any, Literal
|
|
9
9
|
|
|
10
10
|
import numpy as np
|
|
11
11
|
import xarray as xr
|
|
@@ -13,7 +13,7 @@ import xarray as xr
|
|
|
13
13
|
logger = logging.getLogger('flixopt')
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def round_nested_floats(obj, decimals=2):
|
|
16
|
+
def round_nested_floats(obj: dict | list | float | int | Any, decimals: int = 2) -> dict | list | float | int | Any:
|
|
17
17
|
"""Recursively round floating point numbers in nested data structures.
|
|
18
18
|
|
|
19
19
|
This function traverses nested data structures (dictionaries, lists) and rounds
|
|
@@ -27,9 +27,7 @@ def round_nested_floats(obj, decimals=2):
|
|
|
27
27
|
decimals (int, optional): Number of decimal places to round to. Defaults to 2.
|
|
28
28
|
|
|
29
29
|
Returns:
|
|
30
|
-
The processed object with the same structure as the input, but with all
|
|
31
|
-
floating point numbers rounded to the specified precision. NumPy arrays
|
|
32
|
-
and xarray DataArrays are converted to lists.
|
|
30
|
+
The processed object with the same structure as the input, but with all floating point numbers rounded to the specified precision. NumPy arrays and xarray DataArrays are converted to lists.
|
|
33
31
|
|
|
34
32
|
Examples:
|
|
35
33
|
>>> data = {'a': 3.14159, 'b': [1.234, 2.678]}
|