Conversation
…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.
…p. Also add cluster modes.
Final Design StatusParameters.cluster_mode with two options: - 'relaxed' (default): No constraint at t=0, no cyclic constraint. Prevents phantom startups. - 'cyclic': No constraint at t=0, but status[0] == status[-1]. For daily cycling patterns.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughWalkthroughThe changes introduce a new Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings, 1 inconclusive)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This reverts commit 5df515f.
…ork-v2+status # Conflicts: # flixopt/elements.py
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
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
Description
Improve the handling of Status in clustered Models
Type of Change
Related Issues
Closes #(issue number)
Testing
Checklist
Summary by CodeRabbit
New Features
cluster_modeparameter with 'relaxed' and 'cyclic' options for clustered system modeling.Enhancements
✏️ Tip: You can customize this high-level summary in your review settings.