flixopt 2.2.0b0__py3-none-any.whl → 3.0.0__py3-none-any.whl

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.

Files changed (63) hide show
  1. flixopt/__init__.py +35 -1
  2. flixopt/aggregation.py +60 -81
  3. flixopt/calculation.py +381 -196
  4. flixopt/components.py +1022 -359
  5. flixopt/config.py +553 -191
  6. flixopt/core.py +475 -1315
  7. flixopt/effects.py +477 -214
  8. flixopt/elements.py +591 -344
  9. flixopt/features.py +403 -957
  10. flixopt/flow_system.py +781 -293
  11. flixopt/interface.py +1159 -189
  12. flixopt/io.py +50 -55
  13. flixopt/linear_converters.py +384 -92
  14. flixopt/modeling.py +759 -0
  15. flixopt/network_app.py +789 -0
  16. flixopt/plotting.py +273 -135
  17. flixopt/results.py +639 -383
  18. flixopt/solvers.py +25 -21
  19. flixopt/structure.py +928 -442
  20. flixopt/utils.py +34 -5
  21. flixopt-3.0.0.dist-info/METADATA +209 -0
  22. flixopt-3.0.0.dist-info/RECORD +26 -0
  23. {flixopt-2.2.0b0.dist-info → flixopt-3.0.0.dist-info}/WHEEL +1 -1
  24. flixopt-3.0.0.dist-info/top_level.txt +1 -0
  25. docs/examples/00-Minimal Example.md +0 -5
  26. docs/examples/01-Basic Example.md +0 -5
  27. docs/examples/02-Complex Example.md +0 -10
  28. docs/examples/03-Calculation Modes.md +0 -5
  29. docs/examples/index.md +0 -5
  30. docs/faq/contribute.md +0 -49
  31. docs/faq/index.md +0 -3
  32. docs/images/architecture_flixOpt-pre2.0.0.png +0 -0
  33. docs/images/architecture_flixOpt.png +0 -0
  34. docs/images/flixopt-icon.svg +0 -1
  35. docs/javascripts/mathjax.js +0 -18
  36. docs/release-notes/_template.txt +0 -32
  37. docs/release-notes/index.md +0 -7
  38. docs/release-notes/v2.0.0.md +0 -93
  39. docs/release-notes/v2.0.1.md +0 -12
  40. docs/release-notes/v2.1.0.md +0 -31
  41. docs/release-notes/v2.2.0.md +0 -55
  42. docs/user-guide/Mathematical Notation/Bus.md +0 -33
  43. docs/user-guide/Mathematical Notation/Effects, Penalty & Objective.md +0 -132
  44. docs/user-guide/Mathematical Notation/Flow.md +0 -26
  45. docs/user-guide/Mathematical Notation/Investment.md +0 -115
  46. docs/user-guide/Mathematical Notation/LinearConverter.md +0 -21
  47. docs/user-guide/Mathematical Notation/Piecewise.md +0 -49
  48. docs/user-guide/Mathematical Notation/Storage.md +0 -44
  49. docs/user-guide/Mathematical Notation/index.md +0 -22
  50. docs/user-guide/Mathematical Notation/others.md +0 -3
  51. docs/user-guide/index.md +0 -124
  52. flixopt/config.yaml +0 -10
  53. flixopt-2.2.0b0.dist-info/METADATA +0 -146
  54. flixopt-2.2.0b0.dist-info/RECORD +0 -59
  55. flixopt-2.2.0b0.dist-info/top_level.txt +0 -5
  56. pics/architecture_flixOpt-pre2.0.0.png +0 -0
  57. pics/architecture_flixOpt.png +0 -0
  58. pics/flixOpt_plotting.jpg +0 -0
  59. pics/flixopt-icon.svg +0 -1
  60. pics/pics.pptx +0 -0
  61. scripts/gen_ref_pages.py +0 -54
  62. tests/ressources/Zeitreihen2020.csv +0 -35137
  63. {flixopt-2.2.0b0.dist-info → flixopt-3.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,33 +0,0 @@
1
- A Bus is a simple nodal balance between its incoming and outgoing flow rates.
2
-
3
- $$ \label{eq:bus_balance}
4
- \sum_{f_\text{in} \in \mathcal{F}_\text{in}} p_{f_\text{in}}(\text{t}_i) =
5
- \sum_{f_\text{out} \in \mathcal{F}_\text{out}} p_{f_\text{out}}(\text{t}_i)
6
- $$
7
-
8
- Optionally, a Bus can have a `excess_penalty_per_flow_hour` parameter, which allows to penaltize the balance for missing or excess flow-rates.
9
- This is usefull as it handles a possible ifeasiblity gently.
10
-
11
- This changes the balance to
12
-
13
- $$ \label{eq:bus_balance-excess}
14
- \sum_{f_\text{in} \in \mathcal{F}_\text{in}} p_{f_ \text{in}}(\text{t}_i) + \phi_\text{in}(\text{t}_i) =
15
- \sum_{f_\text{out} \in \mathcal{F}_\text{out}} p_{f_\text{out}}(\text{t}_i) + \phi_\text{out}(\text{t}_i)
16
- $$
17
-
18
- The penalty term is defined as
19
-
20
- $$ \label{eq:bus_penalty}
21
- s_{b \rightarrow \Phi}(\text{t}_i) =
22
- \text a_{b \rightarrow \Phi}(\text{t}_i) \cdot \Delta \text{t}_i
23
- \cdot [ \phi_\text{in}(\text{t}_i) + \phi_\text{out}(\text{t}_i) ]
24
- $$
25
-
26
- With:
27
-
28
- - $\mathcal{F}_\text{in}$ and $\mathcal{F}_\text{out}$ being the set of all incoming and outgoing flows
29
- - $p_{f_\text{in}}(\text{t}_i)$ and $p_{f_\text{out}}(\text{t}_i)$ being the flow-rate at time $\text{t}_i$ for flow $f_\text{in}$ and $f_\text{out}$, respectively
30
- - $\phi_\text{in}(\text{t}_i)$ and $\phi_\text{out}(\text{t}_i)$ being the missing or excess flow-rate at time $\text{t}_i$, respectively
31
- - $\text{t}_i$ being the time step
32
- - $s_{b \rightarrow \Phi}(\text{t}_i)$ being the penalty term
33
- - $\text a_{b \rightarrow \Phi}(\text{t}_i)$ being the penalty coefficient (`excess_penalty_per_flow_hour`)
@@ -1,132 +0,0 @@
1
- ## Effects
2
- [`Effects`][flixopt.effects.Effect] are used to allocate things like costs, emissions, or other "effects" occuring in the system.
3
- These arise from so called **Shares**, which originate from **Elements** like [Flows](Flow.md).
4
-
5
- **Example:**
6
-
7
- [`Flows`][flixopt.elements.Flow] have an attribute called `effects_per_flow_hour`, defining the effect amount of per flow hour.
8
- Assiziated effects could be:
9
- - costs - given in [€/kWh]...
10
- - ...or emissions - given in [kg/kWh].
11
- -
12
- Effects are allocated seperatly for investments and operation.
13
-
14
- ### Shares to Effects
15
-
16
- $$ \label{eq:Share_invest}
17
- s_{l \rightarrow e, \text{inv}} = \sum_{v \in \mathcal{V}_{l, \text{inv}}} v \cdot \text a_{v \rightarrow e}
18
- $$
19
-
20
- $$ \label{eq:Share_operation}
21
- s_{l \rightarrow e, \text{op}}(\text{t}_i) = \sum_{v \in \mathcal{V}_{l,\text{op}}} v(\text{t}_i) \cdot \text a_{v \rightarrow e}(\text{t}_i)
22
- $$
23
-
24
- With:
25
-
26
- - $\text{t}_i$ being the time step
27
- - $\mathcal{V_l}$ being the set of all optimization variables of element $e$
28
- - $\mathcal{V}_{l, \text{inv}}$ being the set of all optimization variables of element $e$ related to investment
29
- - $\mathcal{V}_{l, \text{op}}$ being the set of all optimization variables of element $e$ related to operation
30
- - $v$ being an optimization variable of the element $l$
31
- - $v(\text{t}_i)$ being an optimization variable of the element $l$ at timestep $\text{t}_i$
32
- - $\text a_{v \rightarrow e}$ being the factor between the optimization variable $v$ to effect $e$
33
- - $\text a_{v \rightarrow e}(\text{t}_i)$ being the factor between the optimization variable $v$ to effect $e$ for timestep $\text{t}_i$
34
- - $s_{l \rightarrow e, \text{inv}}$ being the share of element $l$ to the investment part of effect $e$
35
- - $s_{l \rightarrow e, \text{op}}(\text{t}_i)$ being the share of element $l$ to the operation part of effect $e$
36
-
37
- ### Shares between different Effects
38
-
39
- Furthermore, the Effect $x$ can contribute a share to another Effect ${e} \in \mathcal{E}\backslash x$.
40
- This share is defined by the factor $\text r_{x \rightarrow e}$.
41
-
42
- For example, the Effect "CO$_2$ emissions" (unit: kg)
43
- can cause an additional share to Effect "monetary costs" (unit: €).
44
- In this case, the factor $\text a_{x \rightarrow e}$ is the specific CO$_2$ price in €/kg. However, circular references have to be avoided.
45
-
46
- The overall sum of investment shares of an Effect $e$ is given by $\eqref{Effect_invest}$
47
-
48
- $$ \label{eq:Effect_invest}
49
- E_{e, \text{inv}} =
50
- \sum_{l \in \mathcal{L}} s_{l \rightarrow e,\text{inv}} +
51
- \sum_{x \in \mathcal{E}\backslash e} E_{x, \text{inv}} \cdot \text{r}_{x \rightarrow e,\text{inv}}
52
- $$
53
-
54
- The overall sum of operation shares is given by $\eqref{eq:Effect_Operation}$
55
-
56
- $$ \label{eq:Effect_Operation}
57
- E_{e, \text{op}}(\text{t}_{i}) =
58
- \sum_{l \in \mathcal{L}} s_{l \rightarrow e, \text{op}}(\text{t}_i) +
59
- \sum_{x \in \mathcal{E}\backslash e} E_{x, \text{op}}(\text{t}_i) \cdot \text{r}_{x \rightarrow {e},\text{op}}(\text{t}_i)
60
- $$
61
-
62
- and totals to $\eqref{eq:Effect_Operation_total}$
63
- $$\label{eq:Effect_Operation_total}
64
- E_{e,\text{op},\text{tot}} = \sum_{i=1}^n E_{e,\text{op}}(\text{t}_{i})
65
- $$
66
-
67
- With:
68
-
69
- - $\mathcal{L}$ being the set of all elements in the FlowSystem
70
- - $\mathcal{E}$ being the set of all effects in the FlowSystem
71
- - $\text r_{x \rightarrow e, \text{inv}}$ being the factor between the operation part of Effect $x$ and Effect $e$
72
- - $\text r_{x \rightarrow e, \text{op}}(\text{t}_i)$ being the factor between the invest part of Effect $x$ and Effect $e$
73
-
74
- - $\text{t}_i$ being the time step
75
- - $s_{l \rightarrow e, \text{inv}}$ being the share of element $l$ to the investment part of effect $e$
76
- - $s_{l \rightarrow e, \text{op}}(\text{t}_i)$ being the share of element $l$ to the operation part of effect $e$
77
-
78
-
79
- The total of an effect $E_{e}$ is given as $\eqref{eq:Effect_Total}$
80
-
81
- $$ \label{eq:Effect_Total}
82
- E_{e} = E_{\text{inv},e} +E_{\text{op},\text{tot},e}
83
- $$
84
-
85
- ### Constraining Effects
86
-
87
- For each variable $v \in \{ E_{e,\text{inv}}, E_{e,\text{op},\text{tot}}, E_e\}$, a lower bound $v^\text{L}$ and upper bound $v^\text{U}$ can be defined as
88
-
89
- $$ \label{eq:Bounds_Single}
90
- \text v^\text{L} \leq v \leq \text v^\text{U}
91
- $$
92
-
93
- Furthermore, bounds for the operational shares can be set for each time step
94
-
95
- $$ \label{eq:Bounds_Time_Steps}
96
- \text E_{e,\text{op}}^\text{L}(\text{t}_i) \leq E_{e,\text{op}}(\text{t}_i) \leq \text E_{e,\text{op}}^\text{U}(\text{t}_i)
97
- $$
98
-
99
- ## Penalty
100
-
101
- Additionally to the user defined [Effects](#effects), a Penalty $\Phi$ is part of every FlixOpt Model.
102
- Its used to prevent unsolvable problems and simplify troubleshooting.
103
- Shares to the penalty can originate from every Element and are constructed similarly to
104
- $\eqref{Share_invest}$ and $\eqref{Share_operation}$.
105
-
106
- $$ \label{eq:Penalty}
107
- \Phi = \sum_{l \in \mathcal{L}} \left( s_{l \rightarrow \Phi} +\sum_{\text{t}_i \in \mathcal{T}} s_{l \rightarrow \Phi}(\text{t}_{i}) \right)
108
- $$
109
-
110
- With:
111
-
112
- - $\mathcal{L}$ being the set of all elements in the FlowSystem
113
- - $\mathcal{T}$ being the set of all timesteps
114
- - $s_{l \rightarrow \Phi}$ being the share of element $l$ to the penalty
115
-
116
- At the moment, penalties only occur in [Buses](#buses)
117
-
118
- ## Objective
119
-
120
- The optimization objective of a FlixOpt Model is defined as $\eqref{eq:Objective}$
121
- $$ \label{eq:Objective}
122
- \min(E_{\Omega} + \Phi)
123
- $$
124
-
125
- With:
126
-
127
- - $\Omega$ being the chosen **Objective [Effect](#effects)** (see $\eqref{eq:Effect_Total}$)
128
- - $\Phi$ being the [Penalty](#penalty)
129
-
130
- This approach allows for a multi-criteria optimization using both...
131
- - ... the **Weigted Sum**Method, as the chosen **Objective Effect** can incorporate other Effects.
132
- - ... the ($\epsilon$-constraint method) by constraining effects.
@@ -1,26 +0,0 @@
1
- The flow_rate is the main optimization variable of the Flow. It's limited by the size of the Flow and relative bounds \eqref{eq:flow_rate}.
2
-
3
- $$ \label{eq:flow_rate}
4
- \text P \cdot \text p^{\text{L}}_{\text{rel}}(\text{t}_{i})
5
- \leq p(\text{t}_{i}) \leq
6
- \text P \cdot \text p^{\text{U}}_{\text{rel}}(\text{t}_{i})
7
- $$
8
-
9
- With:
10
-
11
- - $\text P$ being the size of the Flow
12
- - $p(\text{t}_{i})$ being the flow-rate at time $\text{t}_{i}$
13
- - $\text p^{\text{L}}_{\text{rel}}(\text{t}_{i})$ being the relative lower bound (typically 0)
14
- - $\text p^{\text{U}}_{\text{rel}}(\text{t}_{i})$ being the relative upper bound (typically 1)
15
-
16
- With $\text p^{\text{L}}_{\text{rel}}(\text{t}_{i}) = 0$ and $\text p^{\text{U}}_{\text{rel}}(\text{t}_{i}) = 1$,
17
- equation \eqref{eq:flow_rate} simplifies to
18
-
19
- $$
20
- 0 \leq p(\text{t}_{i}) \leq \text P
21
- $$
22
-
23
-
24
- This mathematical Formulation can be extended or changed when using [OnOffParameters](#onoffparameters)
25
- to define the On/Off state of the Flow, or [InvestParameters](#investments),
26
- which changes the size of the Flow from a constant to an optimization variable.
@@ -1,115 +0,0 @@
1
- # Investments
2
-
3
- ## Current state
4
- $$
5
- \beta_{\text{invest}} \cdot \text{max}(\epsilon, \text V^{\text L}) \leq V \leq \beta_{\text{invest}} \cdot \text V^{\text U}
6
- $$
7
- With:
8
- - $V$ = size
9
- - $V^{\text L}$ = minimum size
10
- - $V^{\text U}$ = maximum size
11
- - $\epsilon$ = epsilon, a small number (such as $1e^{-5}$)
12
- - $\beta_{invest} \in {0,1}$ = wether the size is invested or not
13
-
14
- _Please edit the use cases as needed_
15
- ## Quickfix 1: Optimize the single best size overall
16
- ### Single variable
17
- This is already possible and should be, as this is a needed use case
18
- An additional factor to when the size is actually available might me practical (Which indicates the (fixed) time of investment)
19
- ## Math
20
- $$
21
- V(p) = V * a(p)
22
- $$
23
- with:
24
- - $V$ = size
25
- - $a(p)$ = factor for availlability per period
26
-
27
- Factor $a(p)$ is simply multiplied with relative minimum or maximum(t). This is already possible by doing this yourself.
28
- Effectively, the relative minimum or maximum are altered before using the same constraiints as before.
29
- THis might lead to some issues regariding minimum_load factor, or others, as the size is not 0 in a scenario where the component cant produce.
30
- **Therefore this might not be the best choice. See (#Variable per Scenario)
31
-
32
- ## Variable per Scenario
33
- - **size** and **invest** as a variable per period $V(s)$ and $\beta_{invest}(s)$
34
- - with scenario $s \in S$
35
-
36
- ### Usecase 1: Optimize the size for each Scenario independently
37
- Restrictions are seperatly for each scenario
38
- No changes needed. This could be the default behaviour.
39
-
40
- ### Usecase 2: Optimize ONE size for ALL scenarios
41
- The size is the same globally, but not a scalar, but a variable per scenario $V(s)$
42
- #### 2a: The same size in all scenarios
43
- $$
44
- V(s) = V(s') \quad \forall s,s' \in S
45
- $$
46
-
47
- With:
48
- - $V(s)$ and $V(s')$ = size
49
- - $S$ = set of scenarios
50
-
51
- #### 2b: The same size, but can be 0 prior to the first increment
52
- - Find the Optimal time of investment.
53
- - Force an investment in a certain scenario (parameter optional as a list/array ob booleans)
54
- - Combine optional and minimum/maximum size to force an investment inside a range if scenarios
55
-
56
- $$
57
- \beta_{\text{invest}}(s) \leq \beta_{\text{invest}}(s+1) \quad \forall s \in \{1,2,\ldots,S-1\}
58
- $$
59
-
60
- $$
61
- V(s') - V(s) \leq M \cdot (2 - \beta_{\text{invest}}(s) - \beta_{\text{invest}}(s')) \quad \forall s, s' \in S
62
- $$
63
- $$
64
- V(s') - V(s) \geq M \cdot (2 - \beta_{\text{invest}}(s) - \beta_{\text{invest}}(s')) \quad \forall s, s' \in S
65
- $$
66
-
67
- This could be the default behaviour. (which would be consistent with other variables)
68
-
69
-
70
- ### Switch
71
-
72
- $$
73
- \begin{aligned}
74
- & \text{SWITCH}_s \in \{0,1\} \quad \forall s \in \{1,2,\ldots,S\} \\
75
- & \sum_{s=1}^{S} \text{SWITCH}_s = 1 \\
76
- & \beta_{\text{invest}}(s) = \sum_{s'=1}^{s} \text{SWITCH}_{s'} \quad \forall s \in \{1,2,\ldots,S\} \\
77
- \end{aligned}
78
- $$
79
-
80
- $$
81
- \begin{aligned}
82
- & V(s) \leq V_{\text{actual}} \quad \forall s \in \{1,2,\ldots,S\} \\
83
- & V(s) \geq V_{\text{actual}} - M \cdot (1 - \beta_{\text{invest}}(s)) \quad \forall s \in \{1,2,\ldots,S\}
84
- \end{aligned}
85
- $$
86
-
87
-
88
-
89
-
90
- ### Usecase 3: Find the best scenario to increment the size (Timing of the investment)
91
- The size can only increment once (based on a starting point). This allows to optimize the timing of an investment.
92
- #### Math
93
- Treat $\beta_{invest}$ like an ON/OFF variable, and introduce a SwitchOn, that can only be active once.
94
-
95
- *Thoughts:*
96
- - Treating $\beta_{invest}$ like an ON/OFF variable suggest using the already presentconstraints linked to On/OffModel
97
- - The timing could be constraint to be first in scenario x, or last in scenario y
98
- - Restrict the number of consecutive scenarios
99
- THis might needs the OnOffModel to be more generic (HOURS). Further, the span between scenarios needs to be weighted (like dt_in_hours), or the scenarios need to be measureable (integers)
100
-
101
-
102
- ### Others
103
-
104
- #### Usecase 4: Only increase/decrease the size
105
- Start from a certain size. For each scenario, the size can increase, but never decrease. (Or the other way around).
106
- This would mean that a size expansion is possible,
107
-
108
- #### Usecase 5: Restrict the increment in size per scenario
109
- Restrict how much the size can increase/decrease for in scenario, based on the prior scenario.
110
-
111
-
112
-
113
-
114
-
115
- Many more are possible
@@ -1,21 +0,0 @@
1
- [`LinearConverters`][flixopt.components.LinearConverter] define a ratio between incoming and outgoing [Flows](#flows).
2
-
3
- $$ \label{eq:Linear-Transformer-Ratio}
4
- \sum_{f_{\text{in}} \in \mathcal F_{in}} \text a_{f_{\text{in}}}(\text{t}_i) \cdot p_{f_\text{in}}(\text{t}_i) = \sum_{f_{\text{out}} \in \mathcal F_{out}} \text b_{f_\text{out}}(\text{t}_i) \cdot p_{f_\text{out}}(\text{t}_i)
5
- $$
6
-
7
- With:
8
-
9
- - $\mathcal F_{in}$ and $\mathcal F_{out}$ being the set of all incoming and outgoing flows
10
- - $p_{f_\text{in}}(\text{t}_i)$ and $p_{f_\text{out}}(\text{t}_i)$ being the flow-rate at time $\text{t}_i$ for flow $f_\text{in}$ and $f_\text{out}$, respectively
11
- - $\text a_{f_\text{in}}(\text{t}_i)$ and $\text b_{f_\text{out}}(\text{t}_i)$ being the ratio of the flow-rate at time $\text{t}_i$ for flow $f_\text{in}$ and $f_\text{out}$, respectively
12
-
13
- With one incoming **Flow** and one outgoing **Flow**, this can be simplified to:
14
-
15
- $$ \label{eq:Linear-Transformer-Ratio-simple}
16
- \text a(\text{t}_i) \cdot p_{f_\text{in}}(\text{t}_i) = p_{f_\text{out}}(\text{t}_i)
17
- $$
18
-
19
- where $\text a$ can be interpreted as the conversion efficiency of the **LinearTransformer**.
20
- #### Piecewise Concersion factors
21
- The conversion efficiency can be defined as a piecewise linear approximation. See [Piecewise](Piecewise.md) for more details.
@@ -1,49 +0,0 @@
1
- # Piecewise
2
-
3
- A Piecewise is a collection of [`Pieces`][flixopt.interface.Piece], which each define a valid range for a variable $v$
4
-
5
- $$ \label{eq:active_piece}
6
- \beta_\text{k} = \lambda_\text{0, k} + \lambda_\text{1, k}
7
- $$
8
-
9
- $$ \label{eq:piece}
10
- v_\text{k} = \lambda_\text{0, k} * \text{v}_{\text{start,k}} + \lambda_\text{1,k} * \text{v}_{\text{end,k}}
11
- $$
12
-
13
- $$ \label{eq:piecewise_in_pieces}
14
- \sum_{k=1}^k \beta_{k} = 1
15
- $$
16
-
17
- With:
18
-
19
- - $v$: The variable to be defined by the Piecewise
20
- - $\text{v}_{\text{start,k}}$: the start point of the piece for variable $v$
21
- - $\text{v}_{\text{end,k}}$: the end point of the piece for variable $v$
22
- - $\beta_\text{k} \in \{0, 1\}$: defining wether the Piece $k$ is active
23
- - $\lambda_\text{0,k} \in [0, 1]$: A variable defining the fraction of $\text{v}_{\text{start,k}}$ that is active
24
- - $\lambda_\text{1,k} \in [0, 1]$: A variable defining the fraction of $\text{v}_{\text{end,k}}$ that is active
25
-
26
- Which can also be described as $v \in 0 \cup [\text{v}_\text{start}, \text{v}_\text{end}]$.
27
-
28
- Instead of \eqref{eq:piecewise_in_pieces}, the following constraint is used to also allow all variables to be zero:
29
-
30
- $$ \label{eq:piecewise_in_pieces_zero}
31
- \sum_{k=1}^k \beta_{k} = \beta_\text{zero}
32
- $$
33
-
34
- With:
35
-
36
- - $\beta_\text{zero} \in \{0, 1\}$.
37
-
38
- Which can also be described as $v \in \{0\} \cup [\text{v}_{\text{start_k}}, \text{v}_{\text{end_k}}]$
39
-
40
-
41
- ## Combining multiple Piecewises
42
-
43
- Piecewise allows representing non-linear relationships.
44
- This is a powerful technique in linear optimization to model non-linear behaviors while maintaining the problem's linearity.
45
-
46
- Therefore, each Piecewise must have the same number of Pieces $k$.
47
-
48
- The variables described in [Piecewise](#piecewise) are created for each Piece, but nor for each Piecewise.
49
- Rather, \eqref{eq:piece} is the only constraint that is created for each Piecewise, using the start and endpoints $\text{v}_{\text{start,k}}$ and $\text{v}_{\text{end,k}}$ of each Piece for the corresponding variable $v$
@@ -1,44 +0,0 @@
1
- # Storages
2
- **Storages** have one incoming and one outgoing **[Flow](#flows)** with a charging and discharging efficiency.
3
- A storage has a state of charge $c(\text{t}_i)$ which is limited by its `size` $\text C$ and relative bounds $\eqref{eq:Storage_Bounds}$.
4
-
5
- $$ \label{eq:Storage_Bounds}
6
- \text C \cdot \text c^{\text{L}}_{\text{rel}}(\text t_{i})
7
- \leq c(\text{t}_i) \leq
8
- \text C \cdot \text c^{\text{U}}_{\text{rel}}(\text t_{i})
9
- $$
10
-
11
- Where:
12
-
13
- - $\text C$ is the size of the storage
14
- - $c(\text{t}_i)$ is the state of charge at time $\text{t}_i$
15
- - $\text c^{\text{L}}_{\text{rel}}(\text t_{i})$ is the relative lower bound (typically 0)
16
- - $\text c^{\text{U}}_{\text{rel}}(\text t_{i})$ is the relative upper bound (typically 1)
17
-
18
- With $\text c^{\text{L}}_{\text{rel}}(\text t_{i}) = 0$ and $\text c^{\text{U}}_{\text{rel}}(\text t_{i}) = 1$,
19
- Equation $\eqref{eq:Storage_Bounds}$ simplifies to
20
-
21
- $$ 0 \leq c(\text t_{i}) \leq \text C $$
22
-
23
- The state of charge $c(\text{t}_i)$ decreases by a fraction of the prior state of charge. The belonging parameter
24
- $ \dot{ \text c}_\text{rel, loss}(\text{t}_i)$ expresses the "loss fraction per hour". The storage balance from $\text{t}_i$ to $\text t_{i+1}$ is
25
-
26
- $$
27
- \begin{align*}
28
- c(\text{t}_{i+1}) &= c(\text{t}_{i}) \cdot (1-\dot{\text{c}}_\text{rel,loss}(\text{t}_i) \cdot \Delta \text{t}_{i}) \\
29
- &\quad + p_{f_\text{in}}(\text{t}_i) \cdot \Delta \text{t}_i \cdot \eta_\text{in}(\text{t}_i) \\
30
- &\quad - \frac{p_{f_\text{out}}(\text{t}_i) \cdot \Delta \text{t}_i}{\eta_\text{out}(\text{t}_i)}
31
- \tag{3}
32
- \end{align*}
33
- $$
34
-
35
- Where:
36
-
37
- - $c(\text{t}_{i+1})$ is the state of charge at time $\text{t}_{i+1}$
38
- - $c(\text{t}_{i})$ is the state of charge at time $\text{t}_{i}$
39
- - $\dot{\text{c}}_\text{rel,loss}(\text{t}_i)$ is the relative loss rate (self-discharge) per hour
40
- - $\Delta \text{t}_{i}$ is the time step duration in hours
41
- - $p_{f_\text{in}}(\text{t}_i)$ is the input flow rate at time $\text{t}_i$
42
- - $\eta_\text{in}(\text{t}_i)$ is the charging efficiency at time $\text{t}_i$
43
- - $p_{f_\text{out}}(\text{t}_i)$ is the output flow rate at time $\text{t}_i$
44
- - $\eta_\text{out}(\text{t}_i)$ is the discharging efficiency at time $\text{t}_i$
@@ -1,22 +0,0 @@
1
-
2
- # Mathematical Notation
3
-
4
- ## Naming Conventions
5
-
6
- FlixOpt uses the following naming conventions:
7
-
8
- - All optimization variables are denoted by italic letters (e.g., $x$, $y$, $z$)
9
- - All parameters and constants are denoted by non italic small letters (e.g., $\text{a}$, $\text{b}$, $\text{c}$)
10
- - All Sets are denoted by greek capital letters (e.g., $\mathcal{F}$, $\mathcal{E}$)
11
- - All units of a set are denoted by greek small letters (e.g., $\mathcal{f}$, $\mathcal{e}$)
12
- - The letter $i$ is used to denote an index (e.g., $i=1,\dots,\text n$)
13
- - All time steps are denoted by the letter $\text{t}$ (e.g., $\text{t}_0$, $\text{t}_1$, $\text{t}_i$)
14
-
15
- ## Timesteps
16
- Time steps are defined as a sequence of discrete time steps $\text{t}_i \in \mathcal{T} \quad \text{for} \quad i \in \{1, 2, \dots, \text{n}\}$ (left-aligned in its timespan).
17
- From this sequence, the corresponding time intervals $\Delta \text{t}_i \in \Delta \mathcal{T}$ are derived as
18
-
19
- $$\Delta \text{t}_i = \text{t}_{i+1} - \text{t}_i \quad \text{for} \quad i \in \{1, 2, \dots, \text{n}-1\}$$
20
-
21
- The final time interval $\Delta \text{t}_\text n$ defaults to $\Delta \text{t}_\text n = \Delta \text{t}_{\text n-1}$, but is of course customizable.
22
- Non-equidistant time steps are also supported.
@@ -1,3 +0,0 @@
1
- # Work in Progress
2
-
3
- This is a work in progress.
docs/user-guide/index.md DELETED
@@ -1,124 +0,0 @@
1
- # FlixOpt Concepts
2
-
3
- FlixOpt is built around a set of core concepts that work together to represent and optimize energy and material flow systems. This page provides a high-level overview of these concepts and how they interact.
4
-
5
- ## Core Concepts
6
-
7
- ### FlowSystem
8
-
9
- The [`FlowSystem`][flixopt.flow_system.FlowSystem] is the central organizing unit in FlixOpt.
10
- Every FlixOpt model starts with creating a FlowSystem. It:
11
-
12
- - Defines the timesteps for the optimization
13
- - Contains and connects [components](#components), [buses](#buses), and [flows](#flows)
14
- - Manages the [effects](#effects) (objectives and constraints)
15
-
16
- ### Flows
17
-
18
- [`Flow`][flixopt.elements.Flow] objects represent the movement of energy or material between a [Bus](#buses) and a [Component](#components) in a predefined direction.
19
-
20
- - Have a `size` which, generally speaking, defines how fast energy or material can be moved. Usually measured in MW, kW, m³/h, etc.
21
- - Have a `flow_rate`, which is defines how fast energy or material is transported. Usually measured in MW, kW, m³/h, etc.
22
- - Have constraints to limit the flow-rate (min/max, total flow hours, on/off etc.)
23
- - Can have fixed profiles (for demands or renewable generation)
24
- - Can have [Effects](#effects) associated by their use (operation, investment, on/off, ...)
25
-
26
- #### Flow Hours
27
- While the **Flow Rate** defines the rate in which energy or material is transported, the **Flow Hours** define the amount of energy or material that is transported.
28
- Its defined by the flow_rate times the duration of the timestep in hours.
29
-
30
- Examples:
31
-
32
- | Flow Rate | Timestep | Flow Hours |
33
- |-----------|----------|------------|
34
- | 10 (MW) | 1 hour | 10 (MWh) |
35
- | 10 (MW) | 6 minutes | 0.1 (MWh) |
36
- | 10 (kg/h) | 1 hour | 10 (kg) |
37
-
38
- ### Buses
39
-
40
- [`Bus`][flixopt.elements.Bus] objects represent nodes or connection points in a FlowSystem. They:
41
-
42
- - Balance incoming and outgoing flows
43
- - Can represent physical networks like heat, electricity, or gas
44
- - Handle infeasible balances gently by allowing the balance to be closed in return for a big Penalty (optional)
45
-
46
- ### Components
47
-
48
- [`Component`][flixopt.elements.Component] objects usually represent physical entities in your system that interact with [`Flows`][flixopt.elements.Flow]. They include:
49
-
50
- - [`LinearConverters`][flixopt.components.LinearConverter] - Converts input flows to output flows with (piecewise) linear relationships
51
- - [`Storages`][flixopt.components.Storage] - Stores energy or material over time
52
- - [`Sources`][flixopt.components.Source] / [`Sinks`][flixopt.components.Sink] / [`SourceAndSinks`][flixopt.components.SourceAndSink] - Produce or consume flows. They are usually used to model external demands or supplies.
53
- - [`Transmissions`][flixopt.components.Transmission] - Moves flows between locations with possible losses
54
- - Specialized [`LinearConverters`][flixopt.components.LinearConverter] like [`Boilers`][flixopt.linear_converters.Boiler], [`HeatPumps`][flixopt.linear_converters.HeatPump], [`CHPs`][flixopt.linear_converters.CHP], etc. These simplify the usage of the `LinearConverter` class and can also be used as blueprint on how to define custom classes or parameterize existing ones.
55
-
56
- ### Effects
57
-
58
- [`Effect`][flixopt.effects.Effect] objects represent impacts or metrics related to your system, such as:
59
-
60
- - Costs (investment, operation)
61
- - Emissions (CO₂, NOx, etc.)
62
- - Resource consumption
63
- - Area demand
64
-
65
- These can be freely defined and crosslink to each other (`CO₂` ──[specific CO₂-costs]─→ `Costs`).
66
- One effect is designated as the **optimization objective** (typically Costs), while others can be constrained.
67
- This approach allows for a multi-criteria optimization using both...
68
- - ... the **Weigted Sum**Method, by Optimizing a theoretical Effect which other Effects crosslink to.
69
- - ... the ($\epsilon$-constraint method) by constraining effects.
70
-
71
- ### Calculation
72
-
73
- A [`FlowSystem`][flixopt.flow_system.FlowSystem] can be converted to a Model and optimized by creating a [`Calculation`][flixopt.calculation.Calculation] from it.
74
-
75
- FlixOpt offers different calculation modes:
76
-
77
- - [`FullCalculation`][flixopt.calculation.FullCalculation] - Solves the entire problem at once
78
- - [`SegmentedCalculation`][flixopt.calculation.SegmentedCalculation] - Solves the problem in segments (with optioinal overlap), improving performance for large problems
79
- - [`AggregatedCalculation`][flixopt.calculation.AggregatedCalculation] - Uses typical periods to reduce computational requirements
80
-
81
- ### Results
82
-
83
- The results of a calculation are stored in a [`CalculationResults`][flixopt.results.CalculationResults] object.
84
- This object contains the solutions of the optimization as well as all information about the [`Calculation`][flixopt.calculation.Calculation] and the [`FlowSystem`][flixopt.flow_system.FlowSystem] it was created from.
85
- The solutions is stored as an `xarray.Dataset`, but can be accessed through their assotiated Component, Bus or Effect.
86
-
87
- This [`CalculationResults`][flixopt.results.CalculationResults] object can be saved to file and reloaded from file, allowing you to analyze the results anytime after the solve.
88
-
89
- ## How These Concepts Work Together
90
-
91
- The process of working with FlixOpt can be divided into 3 steps:
92
-
93
- 1. Create a [`FlowSystem`][flixopt.flow_system.FlowSystem], containing all the elements and data of your system
94
- - Define the time series of your system
95
- - Add [`Components`][flixopt.components] like [`Boilers`][flixopt.linear_converters.Boiler], [`HeatPumps`][flixopt.linear_converters.HeatPump], [`CHPs`][flixopt.linear_converters.CHP], etc.
96
- - Add [`Buses`][flixopt.elements.Bus] as connection points in your system
97
- - Add [`Effects`][flixopt.effects.Effect] to represent costs, emissions, etc.
98
- - *This [`FlowSystem`][flixopt.flow_system.FlowSystem] can also be loaded from a netCDF file*
99
- 2. Translate the model to a mathematical optimization problem
100
- - Create a [`Calculation`][flixopt.calculation.Calculation] from your FlowSystem and choose a Solver
101
- - ...The Calculation is translated internaly to a mathematical optimization problem...
102
- - ...and solved by the chosen solver.
103
- 3. Analyze the results
104
- - The results are stored in a [`CalculationResults`][flixopt.results.CalculationResults] object
105
- - This object can be saved to file and reloaded from file, retaining all information about the calculation
106
- - As it contains the used [`FlowSystem`][flixopt.flow_system.FlowSystem], it can be used to start a new calculation
107
-
108
- <figure markdown>
109
- ![FlixOpt Conceptual Usage](../images/architecture_flixOpt.png)
110
- <figcaption>Conceptual Usage and IO operations of FlixOpt</figcaption>
111
- </figure>
112
-
113
- ## Advanced Usage
114
- As flixopt is build on [linopy](https://github.com/PyPSA/linopy), any model created with FlixOpt can be extended or modified using the great [linopy API](https://linopy.readthedocs.io/en/latest/api.html).
115
- This allows to adjust your model to very specific requirements without loosing the convenience of FlixOpt.
116
-
117
- <!--## Next Steps-->
118
- <!---->
119
- <!--Now that you understand the basic concepts, learn more about each one:-->
120
- <!---->
121
- <!--- [FlowSystem](api/flow_system.md) - Time series and system organization-->
122
- <!--- [Components](api/components.md) - Available component types and how to use them-->
123
- <!--- [Effects](apieffects.md) - Costs, emissions, and other impacts-->
124
- <!--- [Calculation Modes](api/calculation.md) - Different approaches to solving your model-->
flixopt/config.yaml DELETED
@@ -1,10 +0,0 @@
1
- # Default configuration of flixopt
2
- config_name: flixopt # Name of the config file. This has no effect on the configuration itself.
3
- logging:
4
- level: INFO
5
- file: flixopt.log
6
- rich: false # logging output is formatted using rich. This is only advisable when using a proper terminal
7
- modeling:
8
- BIG: 10000000 # 1e notation not possible in yaml
9
- EPSILON: 0.00001
10
- BIG_BINARY_BOUND: 100000