|
| 1 | +# flixOpt Concepts & Mathematical Description |
| 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 | +### Timesteps |
| 17 | +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). |
| 18 | +From this sequence, the corresponding time intervals $\Delta \text{t}_i \in \Delta \mathcal{T}$ are derived as |
| 19 | + |
| 20 | +$$\Delta \text{t}_i = \text{t}_{i+1} - \text{t}_i \quad \text{for} \quad i \in \{1, 2, \dots, \text{n}-1\}$$ |
| 21 | + |
| 22 | +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. |
| 23 | +Non-equidistant time steps are also supported. |
| 24 | + |
| 25 | +### Buses |
| 26 | + |
| 27 | +[`Bus`][flixOpt.elements.Bus] objects represent nodes or connection points in a FlowSystem. They: |
| 28 | + |
| 29 | +- Balance incoming and outgoing flows |
| 30 | +- Can represent physical networks like heat, electricity, or gas |
| 31 | +- Handle infeasible balances gently by allowing the balance to be closed in return for a big Penalty (optional) |
| 32 | + |
| 33 | +### Flows |
| 34 | + |
| 35 | +[`Flow`][flixOpt.elements.Flow] objects represent the movement of energy or material between a [Bus](#buses) and a [Component](#components) in a predefined direction. |
| 36 | + |
| 37 | +- Have a `flow_rate`, which is the main optimization variable of a Flow |
| 38 | +- Have a `size` which defines how much energy or material can be moved (fixed or part of an investment decision) |
| 39 | +- Have constraints to limit the flow-rate (min/max, total flow hours, on/off etc.) |
| 40 | +- Can have fixed profiles (for demands or renewable generation) |
| 41 | +- Can have [Effects](#effects) associated by their use (operation, investment, on/off, ...) |
| 42 | + |
| 43 | +### Components |
| 44 | + |
| 45 | +[`Component`][flixOpt.elements.Component] objects usually represent physical entities in your system that interact with [`Flows`][flixOpt.elements.Flow]. They include: |
| 46 | + |
| 47 | +- [`LinearConverters`][flixOpt.components.LinearConverter] - Converts input flows to output flows with (piecewise) linear relationships |
| 48 | +- [`Storages`][flixOpt.components.Storage] - Stores energy or material over time |
| 49 | +- [`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. |
| 50 | +- [`Transmissions`][flixOpt.components.Transmission] - Moves flows between locations with possible losses |
| 51 | +- 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. |
| 52 | + |
| 53 | +### Effects |
| 54 | + |
| 55 | +[`Effect`][flixOpt.effects.Effect] objects represent impacts or metrics related to your system, such as: |
| 56 | + |
| 57 | +- Costs (investment, operation) |
| 58 | +- Emissions (CO₂, NOx, etc.) |
| 59 | +- Resource consumption |
| 60 | + |
| 61 | +These can be freely defined and crosslink to each other (`CO₂` ──[specific CO₂-costs]─→ `Costs`). |
| 62 | +One effect is designated as the **optimization objective** (typically Costs), while others can have constraints. |
| 63 | +This effect can incorporate several other effects, which woul result in a weighted objective from multiple effects. |
| 64 | + |
| 65 | +### Calculation Modes |
| 66 | + |
| 67 | +flixOpt offers different calculation approaches: |
| 68 | + |
| 69 | +- [`FullCalculation`][flixOpt.calculation.FullCalculation] - Solves the entire problem at once |
| 70 | +- [`SegmentedCalculation`][flixOpt.calculation.SegmentedCalculation] - Solves the problem in segments (with optioinal overlap), improving performance for large problems |
| 71 | +- [`AggregatedCalculation`][flixOpt.calculation.AggregatedCalculation] - Uses typical periods to reduce computational requirements |
| 72 | + |
| 73 | +## How These Concepts Work Together |
| 74 | + |
| 75 | +1. You create a `FlowSystem` with a specified time series |
| 76 | +2. You add elements to the FLowSystem: |
| 77 | + - `Bus` objects as connection points |
| 78 | + - `Component` objects like Boilers, Storages, etc.. They include `Flow` which define the connection to a Bus. |
| 79 | + - `Effect` objects to represent costs, emissions, etc. |
| 80 | +3.You choose a calculation mode and solver |
| 81 | +4.flixOpt converts your model into a mathematical optimization problem |
| 82 | +5.The solver finds the optimal solution |
| 83 | +6.You analyze the results with built-in or external tools |
| 84 | + |
| 85 | +## Advanced Usage |
| 86 | +flixOpt uses [linopy](https://github.com/PyPSA/linopy) to model the mathematical optimization problem. |
| 87 | +Any model created with flixOpt can be extended or modified using the great [linopy API](https://linopy.readthedocs.io/en/latest/api.html). |
| 88 | +This allows to adjust your model to very specific requirements without loosing the convenience of flixOpt. |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +## Architechture (outdated) |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | +<!--## Next Steps--> |
| 97 | +<!----> |
| 98 | +<!--Now that you understand the basic concepts, learn more about each one:--> |
| 99 | +<!----> |
| 100 | +<!--- [FlowSystem](api/flow_system.md) - Time series and system organization--> |
| 101 | +<!--- [Components](api/components.md) - Available component types and how to use them--> |
| 102 | +<!--- [Effects](apieffects.md) - Costs, emissions, and other impacts--> |
| 103 | +<!--- [Calculation Modes](api/calculation.md) - Different approaches to solving your model--> |
0 commit comments