Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
be6572d
Try to add to_dataset to Elements
FBumann Jun 23, 2025
f63db8b
Remove TimeSeries
FBumann Jun 23, 2025
167fb2c
Remove TimeSeries
FBumann Jun 23, 2025
fc76adf
Rename conversion method to pattern: to_...
FBumann Jun 23, 2025
cc7b155
Move methods to FlowSystem
FBumann Jun 23, 2025
ec6e792
Drop nan values across time dimension if present
FBumann Jun 23, 2025
b42aad2
Allow lists of values to create DataArray
FBumann Jun 24, 2025
b55af45
Update resolving of FlowSystem
FBumann Jun 24, 2025
d5ace96
Simplify TimeSeriesData
FBumann Jun 24, 2025
4187f30
Move TImeSeriesData to Structure and simplyfy to inherrit from xarray…
FBumann Jun 24, 2025
617600f
Adjust IO
FBumann Jun 24, 2025
e80bba0
Move TimeSeriesData back to core.py and fix Conversion
FBumann Jun 24, 2025
387cac6
Adjust IO to account for attrs of DataArrays in a Dataset
FBumann Jun 24, 2025
27734cf
Rename transforming and connection methods in FlowSystem
FBumann Jun 24, 2025
4915b81
Compacted IO methods
FBumann Jun 24, 2025
fc5549a
Remove infos()
FBumann Jun 24, 2025
299ff43
remove from_dict() and to_dict()
FBumann Jun 24, 2025
abc22b1
Update __str__ of Interface
FBumann Jun 24, 2025
9b4c44c
Improve str and repr
FBumann Jun 24, 2025
0ab7ea6
Improve str and repr
FBumann Jun 24, 2025
1dcbbb0
Add docstring
FBumann Jun 24, 2025
9aec990
Unify IO stuff in Interface class
FBumann Jun 24, 2025
e370311
Improve test tu utilize __eq__ method
FBumann Jun 24, 2025
793e820
Make Interface class more robust and improve exceptions
FBumann Jun 24, 2025
b87d979
Add option to copy Interfaces (And the FlowSystem)
FBumann Jun 24, 2025
8ec265e
Make a copy of a FLowSytsem that gets reused in a second Calculation
FBumann Jun 25, 2025
a46fe64
Remove test_timeseries.py
FBumann Jun 25, 2025
201d066
Reorganizing Datatypes
FBumann Jun 25, 2025
10d2925
Remove TImeSeries and TimeSeriesCollection entirely
FBumann Jun 25, 2025
cf9d17f
Remove old method
FBumann Jun 25, 2025
bd52e05
Add option to get structure with stats of dataarrays
FBumann Jun 25, 2025
aa36689
Change __str__ method
FBumann Jun 25, 2025
63b1c92
Remove old methods
FBumann Jun 25, 2025
29062fa
remove old imports
FBumann Jun 25, 2025
18c43e4
Add isel, sel and resample methods to FlowSystem
FBumann Jun 26, 2025
1f9ef07
Remove need for timeseries with extra timestep
FBumann Jun 26, 2025
5d88fde
Simplify IO of FLowSystem
FBumann Jun 26, 2025
1e94de3
Remove parameter timesteps from IO
FBumann Jun 26, 2025
e5828ad
Improve Exceptions and Docstrings
FBumann Jun 26, 2025
870efee
Improve isel sel and resample methods
FBumann Jun 26, 2025
e97ec5f
Change test
FBumann Jun 26, 2025
f15113e
Bugfix
FBumann Jun 26, 2025
284072e
Improve
FBumann Jun 26, 2025
ebbb5dd
Improve
FBumann Jun 26, 2025
a501e05
Add test for Storage Bounds
FBumann Jun 26, 2025
1825089
Add test for Storage Bounds
FBumann Jun 26, 2025
126b07f
CHANGELOG.md
FBumann Jun 26, 2025
94d841d
ruff check
FBumann Jun 26, 2025
c19edc8
Improve types
FBumann Jun 26, 2025
36cf47d
CHANGELOG.md
FBumann Jun 26, 2025
8f1261d
Bugfix in Storage
FBumann Jun 26, 2025
89d69f0
Revert changes in example_calculation_types.py
FBumann Jun 26, 2025
76f51a8
Revert changes in simple_example.py
FBumann Jun 26, 2025
0ff4d29
Add convenient access to Elements in FlowSystem
FBumann Jun 26, 2025
84c850b
Get Aggregated Calculation Working
FBumann Jun 27, 2025
8b9dabb
Segmented running with wrong results
FBumann Jun 27, 2025
7e72ab5
Use new persistent FLowSystem to create Calculations upfront
FBumann Jun 27, 2025
17632f3
Improve SegmentedCalcualtion
FBumann Jun 27, 2025
3c355c9
Improve SegmentedCalcualtion
FBumann Jun 27, 2025
f473ce5
Fix SegmentedResults IO
FBumann Jun 27, 2025
7869a72
ruff check
FBumann Jun 27, 2025
bb29ef2
Update example
FBumann Jun 27, 2025
8d96a49
Updated logger essages to use .label_full instead of .label
FBumann Jun 27, 2025
8240da1
Re-add parameters. Use deprecation warning instead
FBumann Jun 27, 2025
8ac2664
Update changelog
FBumann Jun 27, 2025
43a64ea
Improve warning message
FBumann Jun 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
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,51 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed
* **BREAKING**: `relative_minimum_charge_state` and `relative_maximum_charge_state` don't have an extra timestep anymore. The final charge state can now be constrained by parameters `relative_minimum_final_charge_state` and `relative_maximum_final_charge_state` instead
* FlowSystems can not be shared across multiple Calculations anymore. A copy of the FlowSystem is created instead, making every Calculation independent
* Type system overhaul - added clear separation between temporal and non-temporal data throughout codebase for better clarity
* FlowSystem data management simplified - removed `time_series_collection` pattern in favor of direct timestep properties
* Enhanced FlowSystem interface with improved `__repr__()` and `__str__()` methods

### Added
* **NEW**: Complete serialization infrastructure through `Interface` base class
* IO for all Interfaces and the FlowSystem with round-trip serialization support
* Automatic DataArray extraction and restoration
* NetCDF export/import capabilities for all Interface objects and FlowSystem
* JSON export for documentation purposes
* Recursive handling of nested Interface objects
* **NEW**: FlowSystem data manipulation methods
* `sel()` and `isel()` methods for temporal data selection
* `resample()` method for temporal resampling
* `copy()` method to create a copy of a FlowSystem, including all underlying Elements and their data
* `__eq__()` method for FlowSystem comparison
* **NEW**: Storage component enhancements
* `relative_minimum_final_charge_state` parameter for final state control
* `relative_maximum_final_charge_state` parameter for final state control
* *Internal*: Enhanced data handling methods
* `fit_to_model_coords()` method for data alignment
* `fit_effects_to_model_coords()` method for effect data processing
* `connect_and_transform()` method replacing separate operations
* **NEW**: Core data handling improvements
* `get_dataarray_stats()` function for statistical summaries
* Enhanced `DataConverter` class with better TimeSeriesData support

### Fixed
* Enhanced NetCDF I/O with proper attribute preservation for DataArrays
* Improved error handling and validation in serialization processes
* Better type consistency across all framework components

### Know Issues
* Plotly >= 6 may raise errors if "nbformat" is not installed. We pinned plotly to <6, but this may be fixed in the future.
* IO for single Interfaces/Elemenets to Datasets might not work properly if the Interface/Element is not part of a fully transformed and connected FlowSystem. This arrises from Numeric Data not being stored as xr.DataArray by the user. TO avoid this, always use the `to_dataset()` on Elements inside a FlowSystem thats connected and transformed.

### Deprecated
* The `agg_group` and `agg_weight` parameters of `TimeSeriesData` are deprecated and will be removed in a future version. Use `aggregation_group` and `aggregation_weight` instead.
* 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.

## [2.1.2] - 2025-06-14

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion examples/01_Simple/simple_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
discharging=fx.Flow('Q_th_unload', bus='Fernwärme', size=1000),
capacity_in_flow_hours=fx.InvestParameters(fix_effects=20, fixed_size=30, optional=False),
initial_charge_state=0, # Initial storage state: empty
relative_maximum_charge_state=1 / 100 * np.array([80, 70, 80, 80, 80, 80, 80, 80, 80, 80]),
relative_maximum_charge_state=1 / 100 * np.array([80, 70, 80, 80, 80, 80, 80, 80, 80]),
relative_maximum_final_charge_state=0.8,
eta_charge=0.9,
eta_discharge=1, # Efficiency factors for charging/discharging
relative_loss_per_hour=0.08, # 8% loss per hour. Absolute loss depends on current charge state
Expand Down
12 changes: 6 additions & 6 deletions examples/03_Calculation_types/example_calculation_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@

# TimeSeriesData objects
TS_heat_demand = fx.TimeSeriesData(heat_demand)
TS_electricity_demand = fx.TimeSeriesData(electricity_demand, agg_weight=0.7)
TS_electricity_price_sell = fx.TimeSeriesData(-(electricity_demand - 0.5), agg_group='p_el')
TS_electricity_price_buy = fx.TimeSeriesData(electricity_price + 0.5, agg_group='p_el')
TS_electricity_demand = fx.TimeSeriesData(electricity_demand, aggregation_weight=0.7)
TS_electricity_price_sell = fx.TimeSeriesData(-(electricity_demand - 0.5), aggregation_group='p_el')
TS_electricity_price_buy = fx.TimeSeriesData(electricity_price + 0.5, aggregation_group='p_el')

flow_system = fx.FlowSystem(timesteps)
flow_system.add_elements(
Expand Down Expand Up @@ -164,12 +164,12 @@
if full:
calculation = fx.FullCalculation('Full', flow_system)
calculation.do_modeling()
calculation.solve(fx.solvers.HighsSolver(0, 60))
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.do_modeling_and_solve(fx.solvers.HighsSolver(0, 60))
calculation.do_modeling_and_solve(fx.solvers.HighsSolver(0.01/100, 60))
calculations.append(calculation)

if aggregated:
Expand All @@ -178,7 +178,7 @@
aggregation_parameters.time_series_for_low_peaks = [TS_electricity_demand, TS_heat_demand]
calculation = fx.AggregatedCalculation('Aggregated', flow_system, aggregation_parameters)
calculation.do_modeling()
calculation.solve(fx.solvers.HighsSolver(0, 60))
calculation.solve(fx.solvers.HighsSolver(0.01/100, 60))
calculations.append(calculation)

# Get solutions for plotting for different calculations
Expand Down
4 changes: 2 additions & 2 deletions flixopt/aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,11 @@ def use_extreme_periods(self):

@property
def labels_for_high_peaks(self) -> List[str]:
return [ts.label for ts in self.time_series_for_high_peaks]
return [ts.name for ts in self.time_series_for_high_peaks]

@property
def labels_for_low_peaks(self) -> List[str]:
return [ts.label for ts in self.time_series_for_low_peaks]
return [ts.name for ts in self.time_series_for_low_peaks]

@property
def use_low_peaks(self):
Expand Down
Loading