[Effects][flixopt.effects.Effect] are used to quantify system-wide impacts like costs, emissions, or resource consumption. These arise from shares contributed by Elements such as Flows, Storage, and other components.
Example:
[Flows][flixopt.elements.Flow] have an attribute effects_per_flow_hour that defines the effect contribution per flow-hour:
- Costs (€/kWh)
- Emissions (kg CO₂/kWh)
- Primary energy consumption (kWh_primary/kWh)
Effects are categorized into two domains:
- Temporal effects - Time-dependent contributions (e.g., operational costs, hourly emissions)
- Periodic effects - Time-independent contributions (e.g., investment costs, fixed annual fees)
The formulations below are written with time index
When the FlowSystem has additional dimensions (see Dimensions):
-
Temporal effects are indexed by all present dimensions:
$E_{e,\text{temp}}(\text{t}_i, y, s)$ -
Periodic effects are indexed by period only (scenario-independent within a period):
$E_{e,\text{per}}(y)$ - Effects are aggregated with dimension weights in the objective function
For complete details on how dimensions affect effects and the objective, see Dimensions.
Each element
Periodic shares (time-independent): $$ \label{eq:Share_periodic} s_{l \rightarrow e, \text{per}} = \sum_{v \in \mathcal{V}{l, \text{per}}} v \cdot \text{a}{v \rightarrow e} $$
Temporal shares (time-dependent): $$ \label{eq:Share_temporal} s_{l \rightarrow e, \text{temp}}(\text{t}i) = \sum{v \in \mathcal{V}_{l,\text{temp}}} v(\text{t}i) \cdot \text{a}{v \rightarrow e}(\text{t}_i) $$
Where:
-
$\text{t}_i$ is the time step -
$\mathcal{V}_l$ is the set of all optimization variables of element$l$ -
$\mathcal{V}_{l, \text{per}}$ is the subset of periodic (investment-related) variables -
$\mathcal{V}_{l, \text{temp}}$ is the subset of temporal (operational) variables -
$v$ is an optimization variable -
$v(\text{t}_i)$ is the variable value at timestep$\text{t}_i$ -
$\text{a}_{v \rightarrow e}$ is the effect factor (e.g., €/kW for investment, €/kWh for operation) -
$s_{l \rightarrow e, \text{per}}$ is the periodic share of element$l$ to effect$e$ -
$s_{l \rightarrow e, \text{temp}}(\text{t}_i)$ is the temporal share of element$l$ to effect$e$
Examples:
-
Periodic share: Investment cost =
$\text{size} \cdot \text{specific_cost}$ (€/kW) -
Temporal share: Operational cost =
$\text{flow_rate}(\text{t}_i) \cdot \text{price}(\text{t}_i)$ (€/kWh)
Effects can contribute shares to other effects, enabling relationships like carbon pricing or resource accounting.
An effect
Example: CO₂ emissions (kg) → Monetary costs (€)
- Effect
$x$ : "CO₂ emissions" (unit: kg) - Effect
$e$ : "costs" (unit: €) - Factor
$\text{r}_{x \rightarrow e}$ : CO₂ price (€/kg)
Note: Circular references must be avoided.
Periodic effects aggregate element shares and cross-effect contributions:
Temporal effects at each timestep:
Total temporal effects (sum over all timesteps):
Total effect (combining both domains):
Where:
-
$\mathcal{L}$ is the set of all elements in the FlowSystem -
$\mathcal{E}$ is the set of all effects -
$\text{r}_{x \rightarrow e, \text{per}}$ is the periodic conversion factor from effect$x$ to effect$e$ -
$\text{r}_{x \rightarrow e, \text{temp}}(\text{t}_i)$ is the temporal conversion factor
Effects can be bounded to enforce limits on costs, emissions, or other impacts:
Total bounds (apply to
Temporal bounds per timestep:
Implementation: See [Effect][flixopt.effects.Effect] parameters:
minimum_temporal,maximum_temporal- Total temporal boundsminimum_per_hour,maximum_per_hour- Hourly temporal boundsminimum_periodic,maximum_periodic- Periodic boundsminimum_total,maximum_total- Combined total bounds
In addition to user-defined Effects, every FlixOpt model includes a Penalty term
- Prevent infeasible problems
- Simplify troubleshooting by allowing constraint violations with high cost
Penalty shares originate from elements, similar to effect shares:
Where:
-
$\mathcal{L}$ is the set of all elements -
$\mathcal{T}$ is the set of all timesteps -
$s_{l \rightarrow \Phi}$ is the penalty share from element$l$
Current usage: Penalties primarily occur in Buses via the excess_penalty_per_flow_hour parameter, which allows nodal imbalances at a high cost.
The optimization objective minimizes the chosen effect plus any penalties:
Where:
-
$E_{\Omega}$ is the chosen objective effect (see$\eqref{eq:Effect_Total}$ ) -
$\Phi$ is the penalty term
One effect must be designated as the objective via is_objective=True.
This formulation supports multiple optimization approaches:
1. Weighted Sum Method
- The objective effect can incorporate other effects via cross-effect factors
- Example: Minimize costs while including carbon pricing:
$\text{CO}_2 \rightarrow \text{costs}$
2. ε-Constraint Method
- Optimize one effect while constraining others
- Example: Minimize costs subject to
$\text{CO}_2 \leq 1000$ kg
When the FlowSystem includes periods and/or scenarios (see Dimensions), the objective aggregates effects across all dimensions using weights.
Where:
- Temporal effects sum over time: $\sum_{\text{t}i} E{\Omega,\text{temp}}(\text{t}_i)$
- Periodic effects are constant:
$E_{\Omega,\text{per}}$ - Penalty sums over time:
$\Phi = \sum_{\text{t}_i} \Phi(\text{t}_i)$
Where:
-
$\mathcal{S}$ is the set of scenarios -
$w_s$ is the weight for scenario$s$ (typically scenario probability) - Periodic effects are shared across scenarios:
$E_{\Omega,\text{per}}$ (same for all$s$ ) - Temporal effects are scenario-specific: $E_{\Omega,\text{temp}}(s) = \sum_{\text{t}i} E{\Omega,\text{temp}}(\text{t}_i, s)$
- Penalties are scenario-specific:
$\Phi(s) = \sum_{\text{t}_i} \Phi(\text{t}_i, s)$
Interpretation:
- Investment decisions (periodic) made once, used across all scenarios
- Operations (temporal) differ by scenario
- Objective balances expected value across scenarios
Where:
-
$\mathcal{Y}$ is the set of periods (e.g., years) -
$w_y$ is the weight for period$y$ (typically annual discount factor) - Each period
$y$ has independent periodic and temporal effects - Each period
$y$ has independent investment and operational decisions
Where:
-
$\mathcal{S}$ is the set of scenarios -
$\mathcal{Y}$ is the set of periods -
$w_y$ is the period weight (for periodic effects) -
$w_{y,s}$ is the combined period-scenario weight (for temporal effects) -
Periodic effects
$E_{\Omega,\text{per}}(y)$ are period-specific but scenario-independent - Temporal effects $E_{\Omega,\text{temp}}(y,s) = \sum_{\text{t}i} E{\Omega,\text{temp}}(\text{t}_i, y, s)$ are fully indexed
-
Penalties
$\Phi(y,s)$ are fully indexed
Key Principle:
- Scenarios and periods are operationally independent (no energy/resource exchange)
- Coupled only through the weighted objective function
- Periodic effects within a period are shared across all scenarios (investment made once per period)
- Temporal effects are independent per scenario (different operations under different conditions)
| Concept | Formulation | Time Dependency | Dimension Indexing |
|---|---|---|---|
| Temporal share | Time-dependent |
|
|
| Periodic share | Time-independent |
|
|
| Total temporal effect | $E_{e,\text{temp},\text{tot}} = \sum_{\text{t}i} E{e,\text{temp}}(\text{t}_i)$ | Sum over time | Depends on dimensions |
| Total periodic effect | Constant |
|
|
| Total effect | Combined | Depends on dimensions | |
| Objective | With weights when multi-dimensional | See formulations above |
- Dimensions - Complete explanation of multi-dimensional modeling
- Flow - Temporal effect contributions via
effects_per_flow_hour - InvestParameters - Periodic effect contributions via investment
- [Effect API][flixopt.effects.Effect] - Implementation details and parameters