Al/refactor sys functools#183
Merged
Merged
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
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.



Change Summary
This pull request refactors and extends the time series aggregation utilities for distribution system components, primarily in
sys_functools.py. The main improvements include a unified, flexible DataFrame construction function for both single and non-sequential time series, new support for per-phase aggregation, and enhanced feature column handling. The test suite is also updated to leverage these new capabilities and improve coverage.Refactoring and Generalization of Time Series Aggregation:
Introduced a unified
_get_combined_time_series_dffunction that handles bothSingleTimeSeriesandNonSequentialTimeSeries, replacing the previous, more specialized functions. This new function supports phase aggregation, per-phase output, and optional inclusion of feature columns, making the codebase more maintainable and extensible. [1] [2] [3] [4]Added helper functions such as
_get_timestamps,_convert_power_value,_extract_features_cols, and_build_power_row_dfto modularize and clarify the DataFrame construction process.Per-Phase Aggregation Support:
Implemented
_get_load_power_per_phaseand_get_solar_power_per_phaseto enable per-phase power calculations for loads and solar components, supporting both aggregate and per-phase outputs in the DataFrame.Updated
get_combined_load_time_series_dfandget_combined_solar_time_series_dfto acceptaggregate_phasesandinclude_featuresparameters, allowing users to control phase aggregation and feature column inclusion. [1] [2] [3]Test Suite Enhancements:
Refactored tests to use a parameterized fixture (
ts_system) that runs test cases for bothSingleTimeSeriesandNonSequentialTimeSeries, improving coverage and reducing code duplication. [1] [2] [3]Updated imports and utility usage in tests to align with the refactored API.
These changes make the time series aggregation code more robust, flexible, and easier to extend for future needs.
Related issue number
Checklist