Skip to content

Commit fab3a01

Browse files
authored
Feature/v3/feature/308 rename effect domains (#365)
* Rename effect domains * Rename effect domains * Ensure backwards compatability * Improve * Improve * Bugfix IO with deprectaed params * Add guards for extra kwargs * Add guards for extra kwargs * centralize logic for deprectaed params * Move handlign from centralized back to classes in a dedicated method * Improce property handling * Move handling to Interface class * Getting lost * Revert "Getting lost" This reverts commit 3c0db76. * Revert "Move handling to Interface class" This reverts commit 09bdeec. * Revert "Improce property handling" This reverts commit 5fe2c64. * Revert "Move handlign from centralized back to classes in a dedicated method" This reverts commit 9f4c1f6. * Revert "centralize logic for deprectaed params" This reverts commit 4a82574. * Add "" to warnings * Revert change in examples * Improve BackwardsCompatibleDataset * Add unit tests for backwards compatability * Remove backwards compatible dataset * Renamed maximum_temporal_per_hour to maximum_per_hour and minimum_temporal_per_hour to minimum_per_hour * Add entires to CHANGELOG.md * Remove backwards compatible dataset * Remove unused imports * Move to unreleased * Catch up on missed renamings from merge * Catch up on missed renamings from merge
1 parent 95f3666 commit fab3a01

17 files changed

Lines changed: 544 additions & 300 deletions

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ The weighted sum of the total objective effect of each scenario is used as the o
108108
* 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.
109109
* 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.
110110
* 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.
111+
- Renamed `Effect` parameters:
112+
- `minimum_investment` → `minimum_nontemporal`
113+
- `maximum_investment` → `maximum_nontemporal`
114+
- `minimum_operation` → `minimum_temporal`
115+
- `maximum_operation` → `maximum_temporal`
116+
- `minimum_operation_per_hour` → `minimum_per_hour`
117+
- `maximum_operation_per_hour` → `maximum_per_hour`
111118
112119
113120
### 🐛 Fixed

examples/03_Calculation_types/example_calculation_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ def get_solutions(calcs: list, variable: str) -> xr.Dataset:
207207
).write_html('results/BHKW2 Thermal Power.html')
208208

209209
fx.plotting.with_plotly(
210-
get_solutions(calculations, 'costs(operation)|total_per_timestep').to_dataframe(),
210+
get_solutions(calculations, 'costs(temporal)|per_timestep').to_dataframe(),
211211
style='line',
212212
title='Operation Cost Comparison',
213213
ylabel='Costs [€]',
214214
).write_html('results/Operation Costs.html')
215215

216216
fx.plotting.with_plotly(
217-
pd.DataFrame(get_solutions(calculations, 'costs(operation)|total_per_timestep').to_dataframe().sum()).T,
217+
pd.DataFrame(get_solutions(calculations, 'costs(temporal)|per_timestep').to_dataframe().sum()).T,
218218
style='stacked_bar',
219219
title='Total Cost Comparison',
220220
ylabel='Costs [€]',

examples/05_Two-stage-optimization/two_stage_optimization.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@
145145
comparison_main = comparison[
146146
[
147147
'Duration [s]',
148-
'costs|total',
149-
'costs(invest)|total',
150-
'costs(operation)|total',
148+
'costs',
149+
'costs(nontemporal)',
150+
'costs(temporal)',
151151
'BHKW2(Q_fu)|size',
152152
'Kessel(Q_fu)|size',
153153
'Speicher|size',

flixopt/calculation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ def main_results(self) -> dict[str, Scalar | dict]:
107107
'Penalty': self.model.effects.penalty.total.solution.values,
108108
'Effects': {
109109
f'{effect.label} [{effect.unit}]': {
110-
'operation': effect.submodel.operation.total.solution.values,
111-
'invest': effect.submodel.invest.total.solution.values,
110+
'temporal': effect.submodel.temporal.total.solution.values,
111+
'nontemporal': effect.submodel.nontemporal.total.solution.values,
112112
'total': effect.submodel.total.solution.values,
113113
}
114114
for effect in self.flow_system.effects

flixopt/components.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ def __init__(
10561056
prevent_simultaneous_sink_and_source = kwargs.pop('prevent_simultaneous_sink_and_source', None)
10571057
if source is not None:
10581058
warnings.warn(
1059-
'The use of the source argument is deprecated. Use the outputs argument instead.',
1059+
'The use of the "source" argument is deprecated. Use the "outputs" argument instead.',
10601060
DeprecationWarning,
10611061
stacklevel=2,
10621062
)
@@ -1066,7 +1066,7 @@ def __init__(
10661066

10671067
if sink is not None:
10681068
warnings.warn(
1069-
'The use of the sink argument is deprecated. Use the inputs argument instead.',
1069+
'The use of the "sink" argument is deprecated. Use the "inputs" argument instead.',
10701070
DeprecationWarning,
10711071
stacklevel=2,
10721072
)
@@ -1076,12 +1076,15 @@ def __init__(
10761076

10771077
if prevent_simultaneous_sink_and_source is not None:
10781078
warnings.warn(
1079-
'The use of the prevent_simultaneous_sink_and_source argument is deprecated. Use the prevent_simultaneous_flow_rates argument instead.',
1079+
'The use of the "prevent_simultaneous_sink_and_source" argument is deprecated. Use the "prevent_simultaneous_flow_rates" argument instead.',
10801080
DeprecationWarning,
10811081
stacklevel=2,
10821082
)
10831083
prevent_simultaneous_flow_rates = prevent_simultaneous_sink_and_source
10841084

1085+
# Validate any remaining unexpected kwargs
1086+
self._validate_kwargs(kwargs)
1087+
10851088
super().__init__(
10861089
label,
10871090
inputs=inputs,
@@ -1206,14 +1209,17 @@ def __init__(
12061209
source = kwargs.pop('source', None)
12071210
if source is not None:
12081211
warnings.warn(
1209-
'The use of the source argument is deprecated. Use the outputs argument instead.',
1212+
'The use of the "source" argument is deprecated. Use the "outputs" argument instead.',
12101213
DeprecationWarning,
12111214
stacklevel=2,
12121215
)
12131216
if outputs is not None:
12141217
raise ValueError('Either source or outputs can be specified, but not both.')
12151218
outputs = [source]
12161219

1220+
# Validate any remaining unexpected kwargs
1221+
self._validate_kwargs(kwargs)
1222+
12171223
self.prevent_simultaneous_flow_rates = prevent_simultaneous_flow_rates
12181224
super().__init__(
12191225
label,
@@ -1334,14 +1340,17 @@ def __init__(
13341340
sink = kwargs.pop('sink', None)
13351341
if sink is not None:
13361342
warnings.warn(
1337-
'The use of the sink argument is deprecated. Use the inputs argument instead.',
1343+
'The use of the "sink" argument is deprecated. Use the "inputs" argument instead.',
13381344
DeprecationWarning,
13391345
stacklevel=2,
13401346
)
13411347
if inputs is not None:
13421348
raise ValueError('Either sink or inputs can be specified, but not both.')
13431349
inputs = [sink]
13441350

1351+
# Validate any remaining unexpected kwargs
1352+
self._validate_kwargs(kwargs)
1353+
13451354
self.prevent_simultaneous_flow_rates = prevent_simultaneous_flow_rates
13461355
super().__init__(
13471356
label,

0 commit comments

Comments
 (0)