Skip to content

Commit 67a5ca6

Browse files
authored
Feature/308 rename effect domains (#360)
* 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
1 parent ce7f2bb commit 67a5ca6

15 files changed

Lines changed: 460 additions & 204 deletions

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ Please keep the format of the changelog consistent with the other releases, so t
4848
### ♻️ Changed
4949
5050
### 🗑️ Deprecated
51+
- Renamed `Effect` parameters:
52+
- `minimum_investment` → `minimum_nontemporal`
53+
- `maximum_investment` → `maximum_nontemporal`
54+
- `minimum_operation` → `minimum_temporal`
55+
- `maximum_operation` → `maximum_temporal`
56+
- `minimum_operation_per_hour` → `minimum_per_hour`
57+
- `maximum_operation_per_hour` → `maximum_per_hour`
5158
5259
### 🔥 Removed
5360

examples/03_Calculation_types/example_calculation_types.py

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

206206
fx.plotting.with_plotly(
207-
get_solutions(calculations, 'costs(operation)|total_per_timestep').to_dataframe(),
207+
get_solutions(calculations, 'costs(temporal)|per_timestep').to_dataframe(),
208208
mode='line',
209209
title='Operation Cost Comparison',
210210
ylabel='Costs [€]',
211211
).write_html('results/Operation Costs.html')
212212

213213
fx.plotting.with_plotly(
214-
pd.DataFrame(get_solutions(calculations, 'costs(operation)|total_per_timestep').to_dataframe().sum()).T,
214+
pd.DataFrame(get_solutions(calculations, 'costs(temporal)|per_timestep').to_dataframe().sum()).T,
215215
mode='bar',
216216
title='Total Cost Comparison',
217217
ylabel='Costs [€]',

flixopt/calculation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def main_results(self) -> dict[str, Scalar | dict]:
8080
'Penalty': float(self.model.effects.penalty.total.solution.values),
8181
'Effects': {
8282
f'{effect.label} [{effect.unit}]': {
83-
'operation': float(effect.model.operation.total.solution.values),
84-
'invest': float(effect.model.invest.total.solution.values),
83+
'temporal': float(effect.model.temporal.total.solution.values),
84+
'nontemporal': float(effect.model.nontemporal.total.solution.values),
8585
'total': float(effect.model.total.solution.values),
8686
}
8787
for effect in self.flow_system.effects

flixopt/components.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ def __init__(
975975
prevent_simultaneous_sink_and_source = kwargs.pop('prevent_simultaneous_sink_and_source', None)
976976
if source is not None:
977977
warnings.warn(
978-
'The use of the source argument is deprecated. Use the outputs argument instead.',
978+
'The use of the "source" argument is deprecated. Use the "outputs" argument instead.',
979979
DeprecationWarning,
980980
stacklevel=2,
981981
)
@@ -985,7 +985,7 @@ def __init__(
985985

986986
if sink is not None:
987987
warnings.warn(
988-
'The use of the sink argument is deprecated. Use the inputs argument instead.',
988+
'The use of the "sink" argument is deprecated. Use the "inputs" argument instead.',
989989
DeprecationWarning,
990990
stacklevel=2,
991991
)
@@ -995,12 +995,15 @@ def __init__(
995995

996996
if prevent_simultaneous_sink_and_source is not None:
997997
warnings.warn(
998-
'The use of the prevent_simultaneous_sink_and_source argument is deprecated. Use the prevent_simultaneous_flow_rates argument instead.',
998+
'The use of the "prevent_simultaneous_sink_and_source" argument is deprecated. Use the "prevent_simultaneous_flow_rates" argument instead.',
999999
DeprecationWarning,
10001000
stacklevel=2,
10011001
)
10021002
prevent_simultaneous_flow_rates = prevent_simultaneous_sink_and_source
10031003

1004+
# Validate any remaining unexpected kwargs
1005+
self._validate_kwargs(kwargs)
1006+
10041007
super().__init__(
10051008
label,
10061009
inputs=inputs,
@@ -1125,14 +1128,17 @@ def __init__(
11251128
source = kwargs.pop('source', None)
11261129
if source is not None:
11271130
warnings.warn(
1128-
'The use of the source argument is deprecated. Use the outputs argument instead.',
1131+
'The use of the "source" argument is deprecated. Use the "outputs" argument instead.',
11291132
DeprecationWarning,
11301133
stacklevel=2,
11311134
)
11321135
if outputs is not None:
11331136
raise ValueError('Either source or outputs can be specified, but not both.')
11341137
outputs = [source]
11351138

1139+
# Validate any remaining unexpected kwargs
1140+
self._validate_kwargs(kwargs)
1141+
11361142
self.prevent_simultaneous_flow_rates = prevent_simultaneous_flow_rates
11371143
super().__init__(
11381144
label,
@@ -1253,14 +1259,17 @@ def __init__(
12531259
sink = kwargs.pop('sink', None)
12541260
if sink is not None:
12551261
warnings.warn(
1256-
'The use of the sink argument is deprecated. Use the inputs argument instead.',
1262+
'The use of the "sink" argument is deprecated. Use the "inputs" argument instead.',
12571263
DeprecationWarning,
12581264
stacklevel=2,
12591265
)
12601266
if inputs is not None:
12611267
raise ValueError('Either sink or inputs can be specified, but not both.')
12621268
inputs = [sink]
12631269

1270+
# Validate any remaining unexpected kwargs
1271+
self._validate_kwargs(kwargs)
1272+
12641273
self.prevent_simultaneous_flow_rates = prevent_simultaneous_flow_rates
12651274
super().__init__(
12661275
label,

0 commit comments

Comments
 (0)