Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,29 @@ Until here -->

## [7.0.0] - Unreleased

**Summary**: Performance release with **up to 67x faster model building** for large systems through batched/vectorized operations.
**Summary**: Performance release with **up to 67x faster model building** for large systems through batched/vectorized operations. Renames `label` to `id` across the API with deprecation support, introduces `IdList[T]` as the standard container, and redesigns the `Flow` constructor.

### ✨ Added

- **`IdList[T]` container** (`flixopt/id_list.py`): New generic frozen ordered container replacing `FlowContainer`, `ElementContainer`, `ResultsContainer`, and `CarrierContainer`. Provides dict-like access by primary key, short-key fallback, or positional index, with helpful error messages including close-match suggestions.

### 💥 Breaking Changes

- **`label` renamed to `id`**: All element constructors now use `id` instead of `label`. The old `label` parameter and `.label` / `.label_full` properties are deprecated and will be removed in v8.0.0. Use `.id` everywhere.
- **`Flow` constructor redesigned**: `bus` is now the first positional argument; `flow_id` (optional) sets the short name, defaulting to the bus name. Old forms `Flow(label, bus)` and `Flow(label, bus=...)` remain deprecated until v8.0.0.
- **`Flow.id` returns qualified name**: `Flow.id` now returns `component(flow_id)` (e.g., `Boiler(Q_fu)`) instead of just the short name. Use `flow.flow_id` for the short name.
- **`Flow.flow_id`**: New public property for the short flow identifier (e.g., `'Q_fu'`). This replaces the internal `_short_id` for Flow objects.
- **Container classes replaced**: `FlowContainer`, `ElementContainer`, `ResultsContainer` replaced by `IdList`. `EffectCollection` and `CarrierContainer` now inherit from `IdList`. Access patterns (`[]`, `in`, `keys()`, `values()`, `items()`, `get()`) are preserved.

### 🗑️ Deprecated

The following items are deprecated and will be removed in **v8.0.0**:

- `Element(label=...)` — use `Element(id=...)` instead
- `Flow(id=...)` — use `Flow(flow_id=...)` instead
- `.label` property — use `.id` instead
- `.label_full` property — use `.id` instead
- `Flow(label, bus)` positional form — use `Flow(bus, flow_id=...)` instead

### 🚀 Performance

Expand Down
5 changes: 4 additions & 1 deletion flixopt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
)
from .config import CONFIG
from .core import TimeSeriesData
from .effects import PENALTY_EFFECT_LABEL, Effect
from .effects import PENALTY_EFFECT_ID, PENALTY_EFFECT_LABEL, Effect
from .elements import Bus, Flow
from .flow_system import FlowSystem
from .flow_system_status import FlowSystemStatus
from .id_list import IdList
from .interface import InvestParameters, Piece, Piecewise, PiecewiseConversion, PiecewiseEffects, StatusParameters
from .optimization import Optimization, SegmentedOptimization
from .plot_result import PlotResult
Expand All @@ -48,6 +49,8 @@
'Flow',
'Bus',
'Effect',
'IdList',
'PENALTY_EFFECT_ID',
'PENALTY_EFFECT_LABEL',
'Source',
'Sink',
Expand Down
Loading