Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
87820e8
Rename Calcualtion to optimization.py
FBumann Nov 20, 2025
01c8a2b
Rename new classes slightly
FBumann Nov 20, 2025
82e2295
Also rename results classes
FBumann Nov 20, 2025
9a7a962
FInalize port to new names
FBumann Nov 20, 2025
f80dad4
Add old methods
FBumann Nov 20, 2025
613148e
Udpate CHANGELOG.md
FBumann Nov 20, 2025
0cd3cd6
Temp
FBumann Nov 20, 2025
589c6a5
I've successfully renamed all aggregation-related classes and modul…
FBumann Nov 21, 2025
8be0c11
Bugfixes
FBumann Nov 21, 2025
14073a3
Use correct deprecation version removal
FBumann Nov 21, 2025
e32b637
Import fix
FBumann Nov 21, 2025
5a2c9f4
Improve docstrings and remove duplicate check
FBumann Nov 21, 2025
4fa73f5
Remove loguru usage
FBumann Nov 21, 2025
7488d56
Bugfix
FBumann Nov 22, 2025
6a41872
Move solve to Optimization class
FBumann Nov 22, 2025
9c217e1
1. ✅ Added validation for nr_of_previous_values in SegmentedOptimiz…
FBumann Nov 22, 2025
558f355
Update CHANGELOG.md
FBumann Nov 22, 2025
c458495
Update tests
FBumann Nov 22, 2025
3224e88
Update tests
FBumann Nov 22, 2025
091ee0b
Add setting logger level to SUCCESS directly
FBumann Nov 22, 2025
8635dd4
Remove warnings from examples
FBumann Nov 22, 2025
dac8412
Remove warnings from examples
FBumann Nov 22, 2025
dd3a485
Fix SUCCESS Level setting
FBumann Nov 22, 2025
90af29a
1. Exported SUCCESS_LEVEL Constant ✓
FBumann Nov 22, 2025
956bb63
Removed:
FBumann Nov 22, 2025
0a925f8
Fix singel line coloring
FBumann Nov 22, 2025
ad586fc
FIx single and multiline coloring
FBumann Nov 22, 2025
437b5a6
Add proper .modeled, .main_results and .summary to SegmentedOptimization
FBumann Nov 22, 2025
74a922f
Updaet CHANGELOG.md
FBumann Nov 22, 2025
4392c79
Implement Protocol
FBumann Nov 22, 2025
28d3a11
Add proper type hints
FBumann Nov 22, 2025
2f31189
Remove not needed hints
FBumann Nov 22, 2025
3babf6e
rename methods
FBumann Nov 22, 2025
ad92e52
rename calculation variables to optimization
FBumann Nov 22, 2025
b74a672
Fixed the _initialize_optimization_common call in SegmentedOptimizati…
FBumann Nov 22, 2025
44942cd
Make init more explicit
FBumann Nov 22, 2025
50c9a13
1. Fixed outdated docstring in SegmentedResults.setup_colors
FBumann Nov 22, 2025
be2ef11
Change assertions to proper Exceptions
FBumann Nov 22, 2025
02fc285
Updated Terminology in docs:
FBumann Nov 22, 2025
ff74f71
Add missing type hints and rename files mentioning claculation
FBumann Nov 22, 2025
c802563
renamed all the "aggregation" attributes and methods to "clustering" …
FBumann Nov 23, 2025
955d485
Improve naming in example
FBumann Nov 23, 2025
47fa938
Fix remaining mentions of Calculation
FBumann Nov 23, 2025
9d37d47
Imrpove docstring
FBumann Nov 23, 2025
68f722c
Improve conftest.py
FBumann Nov 23, 2025
7f55f56
Merge remote-tracking branch 'origin/main' into feature/rename-calcul…
FBumann Nov 23, 2025
5b5646f
Changed x-axis label from "Calculation type" to "Optimization type" for
FBumann Nov 23, 2025
936eae3
Fixed xarray boolean comparisons by adding .item() to convert DataAr…
FBumann Nov 23, 2025
d118f31
Updated TimeSeriesData class docstring from "with aggregation metadat…
FBumann Nov 23, 2025
2d8f217
Fix tests
FBumann Nov 23, 2025
55c59f1
removed the unused hours_per_timestep attribute from SegmentedResults…
FBumann Nov 23, 2025
2c4e169
Add early validation
FBumann Nov 23, 2025
8dac934
Remove not needed type hint
FBumann Nov 23, 2025
66615e9
Add guards against results accessing before modeling
FBumann Nov 23, 2025
c17b16c
Backward compatibility for legacy JSON key (lines 2128-2133):
FBumann Nov 23, 2025
8a93a7c
Guard against empty segment_results
FBumann Nov 23, 2025
6ed6dcd
Fix deprecation of flow_system parameter in results.py
FBumann Nov 23, 2025
d2c598f
Reuse SUCCESS_LEVEL constant
FBumann Nov 23, 2025
0f449c1
Typo
FBumann Nov 23, 2025
721a2bd
Typo
FBumann Nov 23, 2025
445e598
Revert docstring changes
FBumann Nov 23, 2025
562f965
Revert docstring changes
FBumann Nov 24, 2025
1532da5
Improve docstring
FBumann Nov 24, 2025
9563b39
Update CHANGELOG.md
FBumann Nov 24, 2025
056ecba
updated results.py to use the new naming scheme
FBumann Nov 24, 2025
4e4afb1
Further renamings
FBumann Nov 24, 2025
a6b8e31
Further renamings
FBumann Nov 24, 2025
10029b0
Rename CalculationResultsPaths to ResultsPaths
FBumann Nov 24, 2025
ba93cf7
Rename CalculationResultsPaths to ResultsPaths
FBumann Nov 24, 2025
1c2a6cf
Change folder.mkdir(parents=False to True
FBumann Nov 25, 2025
681b444
Temp
FBumann Nov 25, 2025
bbdbfcc
Synchronized folder creation across codebase to always use parents=Tr…
FBumann Nov 25, 2025
949fa3e
added overwrite protection to prevent accidentally overwriting Resul…
FBumann Nov 25, 2025
d39cdf6
Use unique names in tests
FBumann Nov 25, 2025
4b668f5
Improve logging message
FBumann Nov 25, 2025
ff858e6
Improve CHANGELOG.md
FBumann Nov 25, 2025
1105454
Improve CHANGELOG.md
FBumann Nov 25, 2025
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
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ 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).


### ♻️ Changed

### 🗑️ Deprecated
Expand All @@ -67,6 +82,11 @@ If upgrading from v2.x, see the [v3.0.0 release notes](https://github.com/flixOp

### 🐛 Fixed

- Fixed xarray truth-value ambiguity in `main_results` buses with excess filter
- Added validation for `nr_of_previous_values` in `SegmentedOptimization` to prevent silent indexing bugs
- Fixed `active_timesteps` type annotation to include `None`
- Fixed `fix_sizes()` docstring/implementation inconsistency for optional `ds` parameter

### 🔒 Security

### 📦 Dependencies
Expand Down
2 changes: 1 addition & 1 deletion examples/00_Minmal/minimal_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
),
)

calculation = fx.FullCalculation('Simulation1', flow_system).do_modeling().solve(fx.solvers.HighsSolver(0.01, 60))
calculation = fx.FullCalculation('Simulation1', flow_system).solve(fx.solvers.HighsSolver(0.01, 60))
calculation.results['Heat'].plot_node_balance()
8 changes: 4 additions & 4 deletions examples/03_Calculation_types/example_calculation_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,21 +170,21 @@
calculations: list[fx.FullCalculation | fx.AggregatedCalculation | fx.SegmentedCalculation] = []

if full:
calculation = fx.FullCalculation('Full', flow_system)
calculation = fx.FullCalculation('Full', flow_system.copy())
calculation.do_modeling()
calculation.solve(fx.solvers.HighsSolver(0.01 / 100, 60))
calculations.append(calculation)

if segmented:
calculation = fx.SegmentedCalculation('Segmented', flow_system, segment_length, overlap_length)
calculation = fx.SegmentedCalculation('Segmented', flow_system.copy(), segment_length, overlap_length)
calculation.do_modeling_and_solve(fx.solvers.HighsSolver(0.01 / 100, 60))
calculations.append(calculation)

if aggregated:
if keep_extreme_periods:
aggregation_parameters.time_series_for_high_peaks = [TS_heat_demand]
aggregation_parameters.time_series_for_low_peaks = [TS_electricity_demand, TS_heat_demand]
calculation = fx.AggregatedCalculation('Aggregated', flow_system, aggregation_parameters)
calculation = fx.AggregatedCalculation('Aggregated', flow_system.copy(), aggregation_parameters)
calculation.do_modeling()
calculation.solve(fx.solvers.HighsSolver(0.01 / 100, 60))
calculations.append(calculation)
Expand All @@ -197,7 +197,7 @@ def get_solutions(calcs: list, variable: str) -> xr.Dataset:
dataarrays.append(calc.results.solution_without_overlap(variable).rename(calc.name))
else:
dataarrays.append(calc.results.model.variables[variable].solution.rename(calc.name))
return xr.merge(dataarrays)
return xr.merge(dataarrays, join='outer')

# --- Plotting for comparison ---
fx.plotting.with_plotly(
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 (
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
Loading