-
Notifications
You must be signed in to change notification settings - Fork 9
Feature/aggregate rework v2 #540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
FBumann
wants to merge
179
commits into
main
Choose a base branch
from
feature/aggregate-rework-v2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…egration # Conflicts: # flixopt/flow_system.py
…er, time) data structure.
Summary of simplification:
1. Added clusters: pd.Index | None = None parameter to constructor (like periods, scenarios)
2. Simplified coords property - just adds cluster if self.clusters is not None
3. Simplified _use_true_cluster_dims → return self.clusters is not None
4. Simplified _cluster_n_clusters → return len(self.clusters)
5. Simplified _cluster_timesteps_per_cluster → return len(self.timesteps)
6. Simplified _cluster_time_coords → return self.timesteps
7. Simplified from_dataset - just uses ds.indexes.get('cluster') and ds.indexes['time']
8. Simplified to_dataset - uses self.clusters directly
9. Removed all _cluster_info and _clustered_data handling
The cluster dimension is now treated just like period and scenario - simply another dimension in the coordinate system. The code is much cleaner and more consistent.
This reverts commit 5df515f.
1. flixopt/components.py - InterclusterStorageModel fixes
_add_linking_constraints (line 1470-1476):
- Added decay factor (1-loss)^N to link SOC between periods per Blanke et al. (2022) Eq. 5
- Changed from scalar float() conversion to keeping rel_loss.mean('time') as DataArray to respect period/scenario dimensions
_add_combined_bound_constraints (line 1514-1528):
- Added decay factor (1-loss)^t to the combined bounds check per Blanke et al. (2022) Eq. 9
- Changed from scalar float() conversion to keeping rel_loss.mean('time') as DataArray
2. flixopt/transform_accessor.py - expand_solution fix
Lines 1206-1220:
- Fixed self-discharge decay calculation to use xarray DataArrays properly
- Created time_within_period_da as a DataArray with 'time' dimension
- Compute decay as (1 - loss_value) ** time_within_period_da to properly broadcast across period/scenario dimensions
Key Technical Details
- All parameters use xr.DataArray to respect per-period/scenario values
- Decay factors use mean loss rate over time (period-level linking doesn't use per-timestep loss)
- xarray broadcasting handles alignment across dimensions automatically
* Add realsitic data to notbeooks * Add local catch warnings to solution of model * Add local catch warnings to solution of model * Remove solving from generate_example_systems.py script * Remove new system * Remove new system
…o feature/aggregate-rework-v2
…o feature/aggregate-rework-v2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Brief description of the changes in this PR.
Type of Change
Related Issues
Closes #(issue number)
Testing
Checklist
Summary by CodeRabbit
Release Notes
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.