Skip to content

Al/refactor sys functools#183

Merged
AadilLatif merged 4 commits into
mainfrom
al/refactor-sys-functools
Jun 15, 2026
Merged

Al/refactor sys functools#183
AadilLatif merged 4 commits into
mainfrom
al/refactor-sys-functools

Conversation

@AadilLatif

@AadilLatif AadilLatif commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

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_df function that handles both SingleTimeSeries and NonSequentialTimeSeries, 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_df to modularize and clarify the DataFrame construction process.

Per-Phase Aggregation Support:

  • Implemented _get_load_power_per_phase and _get_solar_power_per_phase to 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_df and get_combined_solar_time_series_df to accept aggregate_phases and include_features parameters, 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 both SingleTimeSeries and NonSequentialTimeSeries, 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

  • The pull request title is a good summary of the changes.
  • Tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including "please review" to assign reviewers

@sonarqubecloud

Copy link
Copy Markdown

@AadilLatif AadilLatif merged commit 574f060 into main Jun 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant