Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
809b297
Rename effect domains
FBumann Sep 26, 2025
d69b1ca
Rename effect domains
FBumann Sep 26, 2025
8e44b93
Ensure backwards compatability
FBumann Sep 26, 2025
3966051
Improve
FBumann Sep 26, 2025
6d5b03f
Improve
FBumann Sep 26, 2025
ddcb6be
Bugfix IO with deprectaed params
FBumann Sep 27, 2025
de61895
Add guards for extra kwargs
FBumann Sep 27, 2025
115f3a0
Add guards for extra kwargs
FBumann Sep 27, 2025
4a82574
centralize logic for deprectaed params
FBumann Sep 27, 2025
9f4c1f6
Move handlign from centralized back to classes in a dedicated method
FBumann Sep 27, 2025
5fe2c64
Improce property handling
FBumann Sep 27, 2025
09bdeec
Move handling to Interface class
FBumann Sep 27, 2025
3c0db76
Getting lost
FBumann Sep 27, 2025
2f817d1
Revert "Getting lost"
FBumann Sep 27, 2025
fb0af15
Revert "Move handling to Interface class"
FBumann Sep 27, 2025
97b6295
Revert "Improce property handling"
FBumann Sep 27, 2025
2cc5e4c
Revert "Move handlign from centralized back to classes in a dedicated…
FBumann Sep 27, 2025
51bbe4e
Revert "centralize logic for deprectaed params"
FBumann Sep 27, 2025
4705a4f
Add "" to warnings
FBumann Sep 27, 2025
7dc51aa
Revert change in examples
FBumann Sep 27, 2025
b4d5e8b
Improve BackwardsCompatibleDataset
FBumann Sep 27, 2025
f5fbfc6
Add unit tests for backwards compatability
FBumann Sep 27, 2025
f6cfd6b
Remove backwards compatible dataset
FBumann Sep 27, 2025
b071671
Renamed maximum_temporal_per_hour to maximum_per_hour and minimum_tem…
FBumann Sep 27, 2025
02b8859
Add entires to CHANGELOG.md
FBumann Sep 27, 2025
59b5f22
Remove backwards compatible dataset
FBumann Sep 27, 2025
06f20e6
Remove unused imports
FBumann Sep 27, 2025
4907550
Move to unreleased
FBumann Sep 27, 2025
62cf3a4
Move to unreleased
FBumann Sep 27, 2025
7246e3c
Catch up on missed renamings from merge
FBumann Sep 27, 2025
9ddc509
Catch up on missed renamings from merge
FBumann Sep 27, 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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ The weighted sum of the total objective effect of each scenario is used as the o
* The `active_timesteps` parameter of `Calculation` is deprecated and will be removed in a future version. Use the new `sel(time=...)` method on the FlowSystem instead.
* The assignment of Bus Objects to Flow.bus is deprecated and will be removed in a future version. Use the label of the Bus instead.
* The usage of Effects objects in Dicts to assign shares to Effects is deprecated and will be removed in a future version. Use the label of the Effect instead.
- Renamed `Effect` parameters:
- `minimum_investment` → `minimum_nontemporal`
- `maximum_investment` → `maximum_nontemporal`
- `minimum_operation` → `minimum_temporal`
- `maximum_operation` → `maximum_temporal`
- `minimum_operation_per_hour` → `minimum_per_hour`
- `maximum_operation_per_hour` → `maximum_per_hour`
Comment on lines +111 to +117
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 | 🔴 Critical

🧩 Analysis chain

Confirm exact legacy parameter names ('minimum_invest' vs 'minimum_investment')

The changelog lists minimum_investment/maximum_investment; earlier notes sometimes reference minimum_invest/maximum_invest. Ensure the deprecation mapping and docs reflect the actual legacy names used in the API.


🏁 Script executed:

#!/bin/bash
# Check for occurrences of both variants to ensure consistency
rg -nP "(minimum|maximum)_(invest(ment)?|operation(_per_hour)?)" --type=py -C2
rg -nP "(minimum|maximum)_(nontemporal|temporal|per_hour)" --type=py -C2

Length of output: 33793


Use correct legacy names (minimum_invest/maximum_invest) in CHANGELOG.md
Change the entries from minimum_investment/maximum_investment to minimum_invest/maximum_invest to match the actual deprecated parameters.

🤖 Prompt for AI Agents
In CHANGELOG.md around lines 111 to 117, the legacy parameter names are
incorrect: update the listed renamed Effect parameters from
`minimum_investment`/`maximum_investment` to the actual deprecated names
`minimum_invest`/`maximum_invest` so the changelog matches the real legacy
parameter names; keep the other renames unchanged and verify spelling and
backticks for consistency.



### 🐛 Fixed
Expand Down
4 changes: 2 additions & 2 deletions examples/03_Calculation_types/example_calculation_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,14 @@ def get_solutions(calcs: list, variable: str) -> xr.Dataset:
).write_html('results/BHKW2 Thermal Power.html')

fx.plotting.with_plotly(
get_solutions(calculations, 'costs(operation)|total_per_timestep').to_dataframe(),
get_solutions(calculations, 'costs(temporal)|per_timestep').to_dataframe(),
style='line',
title='Operation Cost Comparison',
ylabel='Costs [€]',
).write_html('results/Operation Costs.html')

fx.plotting.with_plotly(
pd.DataFrame(get_solutions(calculations, 'costs(operation)|total_per_timestep').to_dataframe().sum()).T,
pd.DataFrame(get_solutions(calculations, 'costs(temporal)|per_timestep').to_dataframe().sum()).T,
style='stacked_bar',
title='Total Cost Comparison',
ylabel='Costs [€]',
Expand Down
6 changes: 3 additions & 3 deletions examples/05_Two-stage-optimization/two_stage_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@
comparison_main = comparison[
[
'Duration [s]',
'costs|total',
'costs(invest)|total',
'costs(operation)|total',
'costs',
'costs(nontemporal)',
'costs(temporal)',
Comment on lines +148 to +150
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 | 🔴 Critical

🧩 Analysis chain

Aligns with renamed effect domains; please verify keys exist in results

The switch to 'costs', 'costs(nontemporal)', and 'costs(temporal)' matches the new terminology. Please confirm these variables are present in results for both Combined and Two-stage modes.


🏁 Script executed:

#!/bin/bash
# Inspect available data variables in both solutions to verify keys
rg -nP -C2 "results\.solution" --type=py
# Optionally print example outputs if a small fixture exists
rg -nP "costs\(temporal\)|costs\(nontemporal\)" --type=py -C2

Length of output: 20492


Update temporal cost key in example Replace 'costs(temporal)' with 'costs(temporal)|per_timestep' in examples/05_Two-stage-optimization/two_stage_optimization.py to match results.solution keys.

🤖 Prompt for AI Agents
In examples/05_Two-stage-optimization/two_stage_optimization.py around lines 148
to 150, the example uses the outdated key 'costs(temporal)'; update that entry
to 'costs(temporal)|per_timestep' so it matches the keys present in
results.solution (i.e., replace 'costs(temporal)' with
'costs(temporal)|per_timestep').

'BHKW2(Q_fu)|size',
'Kessel(Q_fu)|size',
'Speicher|size',
Expand Down
4 changes: 2 additions & 2 deletions flixopt/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def main_results(self) -> dict[str, Scalar | dict]:
'Penalty': self.model.effects.penalty.total.solution.values,
'Effects': {
f'{effect.label} [{effect.unit}]': {
'operation': effect.submodel.operation.total.solution.values,
'invest': effect.submodel.invest.total.solution.values,
'temporal': effect.submodel.temporal.total.solution.values,
'nontemporal': effect.submodel.nontemporal.total.solution.values,
'total': effect.submodel.total.solution.values,
}
for effect in self.flow_system.effects
Expand Down
19 changes: 14 additions & 5 deletions flixopt/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ def __init__(
prevent_simultaneous_sink_and_source = kwargs.pop('prevent_simultaneous_sink_and_source', None)
if source is not None:
warnings.warn(
'The use of the source argument is deprecated. Use the outputs argument instead.',
'The use of the "source" argument is deprecated. Use the "outputs" argument instead.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -1066,7 +1066,7 @@ def __init__(

if sink is not None:
warnings.warn(
'The use of the sink argument is deprecated. Use the inputs argument instead.',
'The use of the "sink" argument is deprecated. Use the "inputs" argument instead.',
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -1076,12 +1076,15 @@ def __init__(

if prevent_simultaneous_sink_and_source is not None:
warnings.warn(
'The use of the prevent_simultaneous_sink_and_source argument is deprecated. Use the prevent_simultaneous_flow_rates argument instead.',
'The use of the "prevent_simultaneous_sink_and_source" argument is deprecated. Use the "prevent_simultaneous_flow_rates" argument instead.',
DeprecationWarning,
stacklevel=2,
)
prevent_simultaneous_flow_rates = prevent_simultaneous_sink_and_source

# Validate any remaining unexpected kwargs
self._validate_kwargs(kwargs)

super().__init__(
label,
inputs=inputs,
Expand Down Expand Up @@ -1206,14 +1209,17 @@ def __init__(
source = kwargs.pop('source', None)
if source is not None:
warnings.warn(
'The use of the source argument is deprecated. Use the outputs argument instead.',
'The use of the "source" argument is deprecated. Use the "outputs" argument instead.',
DeprecationWarning,
stacklevel=2,
)
if outputs is not None:
raise ValueError('Either source or outputs can be specified, but not both.')
outputs = [source]

# Validate any remaining unexpected kwargs
self._validate_kwargs(kwargs)

self.prevent_simultaneous_flow_rates = prevent_simultaneous_flow_rates
super().__init__(
label,
Expand Down Expand Up @@ -1334,14 +1340,17 @@ def __init__(
sink = kwargs.pop('sink', None)
if sink is not None:
warnings.warn(
'The use of the sink argument is deprecated. Use the inputs argument instead.',
'The use of the "sink" argument is deprecated. Use the "inputs" argument instead.',
DeprecationWarning,
stacklevel=2,
)
if inputs is not None:
raise ValueError('Either sink or inputs can be specified, but not both.')
inputs = [sink]

# Validate any remaining unexpected kwargs
self._validate_kwargs(kwargs)

self.prevent_simultaneous_flow_rates = prevent_simultaneous_flow_rates
super().__init__(
label,
Expand Down
Loading