Merged
Conversation
Add method to CaseStudy to cluster it
Adjust to newest LEGO format Add inplace flag Improve computational performance (vectorized instead of iterrows) Remove adjustment of VRESProfiles (is now dependent on g instead of i)
Fix filter_representative_periods for dataframes set to None
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request implements functionality for technical representation in power system modeling, focusing on:
- Security enhancement: Adds
rich.markup.escape()to all printer methods to prevent markup injection vulnerabilities - Refactoring: Splits the monolithic
apply_kmedoids_aggregationfunction into three composable functions (get_kmedoids_representative_periods,apply_representative_periods, andapply_kmedoids_aggregation) - SQLite enhancements: Adds automatic objective decomposition, dual values, solver statistics, and run parameters to SQLite output
- Bug fixes:
- Corrects dPower_Demand index order from ['rp', 'i', 'k'] to ['rp', 'k', 'i']
- Fixes 'long' to 'lon' for longitude column name
- Improves merge_single_node_buses with zone name handling and better aggregation logic
- API improvements: Adds wrapper methods to CaseStudy class for kmedoids operations, improves copy() method, adds equal_to() comparison method
- New features:
- Adds linear expression printing to Printer class
- Adds validation for pEnableInvest values in Power_Network
- Adds weight adjustment logic to filter_timesteps method
- Removes unused xlrd dependency
Changes:
- Enhanced security by escaping user input in printer methods
- Refactored kmedoids aggregation into composable functions
- Added comprehensive SQLite database export features (objective decomposition, dual values, solver stats)
- Fixed multiple bugs in data handling and method return values
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| printer.py | Added escape() for security, new linear_expression() method, pyomo import |
| environment.yml | Removed unused xlrd dependency |
| Utilities.py | Refactored kmedoids functions, fixed dPower_Demand index order |
| SQLiteWriter.py | Added objective decomposition, dual values, solver statistics, and run parameters export |
| ExcelWriter.py | Added TYPE_CHECKING import pattern to avoid circular imports |
| ExcelReader.py | Added validation for pEnableInvest column values |
| CaseStudy.py | Enhanced copy(), added equal_to(), fixed merge_single_node_buses, added kmedoids wrappers, improved filter_timesteps |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fix some output strings Add printer to Utilities, add solver for kmedoids
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
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.
No description provided.