Skip to content

flixOpt Concepts & Mathematical Description

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.

Core Concepts

FlowSystem

The FlowSystem is the central organizing unit in flixOpt. Every flixOpt model starts with creating a FlowSystem. It:

  • Defines the timesteps for the optimization
  • Contains and connects components, buses, and flows
  • Manages the effects (objectives and constraints)

Timesteps

Time steps are defined as a sequence of discrete time steps tiTfori{1,2,,n} (left-aligned in its timespan). From this sequence, the corresponding time intervals ΔtiΔT are derived as

(1)Δti=ti+1tifori{1,2,,n1}

The final time interval Δtn defaults to Δtn=Δtn1, but is of course customizable. Non-equidistant time steps are also supported.

Buses

Bus objects represent nodes or connection points in a FlowSystem. They:

  • Balance incoming and outgoing flows
  • Can represent physical networks like heat, electricity, or gas
  • Handle infeasible balances gently by allowing the balance to be closed in return for a big Penalty (optional)

Flows

Flow objects represent the movement of energy or material between a Bus and a Component in a predefined direction.

  • Have a flow_rate, which is the main optimization variable of a Flow
  • Have a size which defines how much energy or material can be moved (fixed or part of an investment decision)
  • Have constraints to limit the flow-rate (min/max, total flow hours, on/off etc.)
  • Can have fixed profiles (for demands or renewable generation)
  • Can have Effects associated by their use (operation, investment, on/off, ...)

Components

Component objects usually represent physical entities in your system that interact with Flows. They include:

  • LinearConverters - Converts input flows to output flows with (piecewise) linear relationships
  • Storages - Stores energy or material over time
  • Sources / Sinks / SourceAndSinks - Produce or consume flows. They are usually used to model external demands or supplies.
  • Transmissions - Moves flows between locations with possible losses
  • Specialized LinearConverters like Boilers, HeatPumps, CHPs, 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.

Effects

Effect objects represent impacts or metrics related to your system, such as:

  • Costs (investment, operation)
  • Emissions (CO₂, NOx, etc.)
  • Resource consumption

These can be freely defined and crosslink to each other (CO₂ ──[specific CO₂-costs]─→ Costs). One effect is designated as the optimization objective (typically Costs), while others can have constraints. This effect can incorporate several other effects, which woul result in a weighted objective from multiple effects.

Calculation Modes

flixOpt offers different calculation approaches:

How These Concepts Work Together

  1. You create a FlowSystem with a specified time series
  2. You add elements to the FLowSystem:
    • Bus objects as connection points
    • Component objects like Boilers, Storages, etc.. They include Flow which define the connection to a Bus.
    • Effect objects to represent costs, emissions, etc. 3.You choose a calculation mode and solver 4.flixOpt converts your model into a mathematical optimization problem 5.The solver finds the optimal solution 6.You analyze the results with built-in or external tools

Advanced Usage

flixOpt uses linopy to model the mathematical optimization problem. Any model created with flixOpt can be extended or modified using the great linopy API. This allows to adjust your model to very specific requirements without loosing the convenience of flixOpt.

Architechture (outdated)

Architecture