Skip to content
Closed
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
54 changes: 54 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,66 @@ If upgrading from v2.x, see the [v3.0.0 release notes](https://github.com/flixOp

### 💥 Breaking Changes

**Class and module renaming:**
- `FullCalculation` → `Optimization`
- `AggregatedCalculation` → `ClusteredOptimization`
- `SegmentedCalculation` → `SegmentedOptimization`
- `CalculationResults` → `Results`
- `SegmentedCalculationResults` → `SegmentedResults`
- `Aggregation` → `Clustering`
- `AggregationParameters` → `ClusteringParameters`
- `AggregationModel` → `ClusteringModel`
- Module: `calculation.py` → `optimization.py`
- Module: `aggregation.py` → `clustering.py`

Old names remain available with deprecation warnings (removed in v5.0.0).

Comment on lines +62 to +75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Rename list matches implementation; consider also documenting Calculation → Optimization.

The class/module rename bullets now line up with the new API (AggregatedCalculation → ClusteredOptimization, FullCalculation → Optimization, results and aggregation/clustering mappings) and the deprecation behavior in code.

For completeness of the migration notes, consider adding an entry for the plain Calculation → Optimization rename as well, since flixopt/calculation.py still exposes Calculation as a deprecated wrapper.

🤖 Prompt for AI Agents
In CHANGELOG.md around lines 62 to 75, the rename list omits the plain
Calculation → Optimization mapping; add a bullet documenting that Calculation
was renamed to Optimization (and note that the old Calculation remains available
as a deprecated wrapper in flixopt/calculation.py and will be removed in v5.0.0)
so the migration notes fully cover all deprecated aliases.


### ♻️ Changed

### 🗑️ Deprecated

### 🔥 Removed

**Deprecated parameters removed** (all were deprecated in v4.0.0 or earlier):

**TimeSeriesData:**
- `agg_group` → use `aggregation_group`
- `agg_weight` → use `aggregation_weight`
- Properties: `agg_group`, `agg_weight`

**Effect:**
- Constructor parameters: `minimum_operation` → use `minimum_temporal`, `maximum_operation` → use `maximum_temporal`, `minimum_invest` → use `minimum_periodic`, `maximum_invest` → use `maximum_periodic`, `minimum_operation_per_hour` → use `minimum_per_hour`, `maximum_operation_per_hour` → use `maximum_per_hour`
- Properties: `minimum_operation`, `maximum_operation`, `minimum_invest`, `maximum_invest`, `minimum_operation_per_hour`, `maximum_operation_per_hour`, `minimum_total_per_period`, `maximum_total_per_period`

**Flow:**
- Constructor parameters: `flow_hours_per_period_max` → use `flow_hours_max`, `flow_hours_per_period_min` → use `flow_hours_min`, `flow_hours_total_max` → use `flow_hours_max`, `flow_hours_total_min` → use `flow_hours_min`, `total_flow_hours_max` → use `flow_hours_max_over_periods`, `total_flow_hours_min` → use `flow_hours_min_over_periods`
- Properties: `flow_hours_total_max`, `flow_hours_total_min`

**InvestParameters:**
- Constructor parameters: `fix_effects` → use `effects_of_investment`, `specific_effects` → use `effects_of_investment_per_size`, `divest_effects` → use `effects_of_retirement`, `piecewise_effects` → use `piecewise_effects_of_investment`, `optional` → use `mandatory` (with inverted logic)
- Properties: `optional`, `fix_effects`, `specific_effects`, `divest_effects`, `piecewise_effects`

**OnOffParameters:**
- Constructor parameters: `on_hours_total_min` → use `on_hours_min`, `on_hours_total_max` → use `on_hours_max`, `switch_on_total_max` → use `switch_on_max`

**Storage:**
- `initial_charge_state="lastValueOfSim"` → use `initial_charge_state="equals_final"`

**Source, Sink, SourceAndSink:**
- Constructor parameters:
- Source: `source` → use `outputs`
- Sink: `sink` → use `inputs`
- SourceAndSink: `source` → use `outputs`, `sink` → use `inputs`, `prevent_simultaneous_sink_and_source` → use `prevent_simultaneous_flow_rates`
- Properties:
- Source: `source` property
- Sink: `sink` property
- SourceAndSink: `source`, `sink`, `prevent_simultaneous_sink_and_source` properties

**Linear Converters** (Boiler, CHP, HeatPump, etc.):
- Flow parameters: `Q_fu` → use `fuel_flow`, `P_el` → use `electrical_flow`, `Q_th` → use `thermal_flow`, `Q_ab` → use `heat_source_flow`
- Efficiency parameters: `eta` → use `thermal_efficiency`, `eta_th` → use `thermal_efficiency`, `eta_el` → use `electrical_efficiency`, `COP` → use `cop`

### 🐛 Fixed

### 🔒 Security
Expand Down
17 changes: 14 additions & 3 deletions flixopt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@

# Import commonly used classes and functions
from . import linear_converters, plotting, results, solvers
from .aggregation import AggregationParameters

# Import old Calculation classes for backwards compatibility (deprecated)
from .calculation import AggregatedCalculation, FullCalculation, SegmentedCalculation
from .clustering import AggregationParameters, ClusteringParameters # AggregationParameters is deprecated
from .components import (
Comment on lines +18 to 21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Calculation is not re‑exported at package root, breaking top‑level backward compatibility.

This module promises that legacy Calculation* names remain available as deprecated wrappers, but __init__.py only imports/exports FullCalculation, AggregatedCalculation, and SegmentedCalculation. Code that previously did:

from flixopt import Calculation
# or
import flixopt as fx; fx.Calculation(...)

will now fail, even though flixopt.calculation.Calculation still exists.

To keep the public API backward compatible, consider:

-from .calculation import AggregatedCalculation, FullCalculation, SegmentedCalculation
+from .calculation import AggregatedCalculation, Calculation, FullCalculation, SegmentedCalculation
...
-    # Old Calculation classes (deprecated, for backwards compatibility)
-    'FullCalculation',
-    'AggregatedCalculation',
-    'SegmentedCalculation',
+    # Old Calculation classes (deprecated, for backwards compatibility)
+    'Calculation',
+    'FullCalculation',
+    'AggregatedCalculation',
+    'SegmentedCalculation',

This aligns the package surface with the deprecation story in flixopt/calculation.py and the changelog.

Also applies to: 52-60, 66-67

🤖 Prompt for AI Agents
In flixopt/__init__.py around lines 17 to 20, the legacy alias Calculation is
not re-exported which breaks top-level backward compatibility; import
Calculation from .calculation and add it to the module exports (and __all__ if
present) alongside FullCalculation, AggregatedCalculation, and
SegmentedCalculation so from flixopt import Calculation and attribute access
like flixopt.Calculation continue to work as before.

LinearConverter,
Sink,
Expand All @@ -31,6 +33,9 @@
from .flow_system import FlowSystem
from .interface import InvestParameters, OnOffParameters, Piece, Piecewise, PiecewiseConversion, PiecewiseEffects

# Import new Optimization classes
from .optimization import ClusteredOptimization, Optimization, SegmentedOptimization

__all__ = [
'TimeSeriesData',
'CONFIG',
Expand All @@ -45,16 +50,22 @@
'LinearConverter',
'Transmission',
'FlowSystem',
# New Optimization classes (preferred)
'Optimization',
'ClusteredOptimization',
'SegmentedOptimization',
# Old Calculation classes (deprecated, for backwards compatibility)
'FullCalculation',
'SegmentedCalculation',
'AggregatedCalculation',
'SegmentedCalculation',
'InvestParameters',
'OnOffParameters',
'Piece',
'Piecewise',
'PiecewiseConversion',
'PiecewiseEffects',
'AggregationParameters',
'ClusteringParameters',
'AggregationParameters', # Deprecated, use ClusteringParameters
'plotting',
'results',
'linear_converters',
Expand Down
Loading