A Bus is where flows meet and must balance — inputs equal outputs at every timestep.
Buses can optionally be assigned a carrier — a type of energy or material (e.g., electricity, heat, gas). Carriers enable:
- Automatic coloring in plots based on energy type
- Unit tracking for better result visualization
- Semantic grouping of buses by type
# Assign a carrier by name (uses CONFIG.Carriers defaults)
heat_bus = fx.Bus('HeatNetwork', carrier='heat')
elec_bus = fx.Bus('Grid', carrier='electricity')
# Or register custom carriers on the FlowSystem
biogas = fx.Carrier('biogas', color='#228B22', unit='kW', description='Biogas fuel')
flow_system.add_carrier(biogas)
gas_bus = fx.Bus('BiogasNetwork', carrier='biogas')See Color Management for more on how carriers affect visualization.
heat_bus = fx.Bus(label='heat')
# All flows connected to this bus must balanceIf balance can't be achieved → model is infeasible.
Allow imbalance for debugging or soft constraints:
The slack variables
heat_bus = fx.Bus(
label='heat',
imbalance_penalty_per_flow_hour=1e5 # High penalty for imbalance
)!!! tip "Debugging"
If you see a virtual_demand or virtual_supply and its non zero in results → your system couldn't meet demand. Check capacities and connections.
| Symbol | Type | Description |
|---|---|---|
| Flow rate of connected flows | ||
| Slack: virtual supply (covers shortages) | ||
| Slack: virtual demand (absorbs surplus) | ||
Penalty factor (imbalance_penalty_per_flow_hour) |
||
| Timestep duration (hours) |
Classes: [Bus][flixopt.elements.Bus], [BusModel][flixopt.elements.BusModel]