Skip to content

Conversation

@jarry7
Copy link
Contributor

@jarry7 jarry7 commented Apr 5, 2025

No description provided.

@jarry7 jarry7 requested a review from pesap April 5, 2025 00:03
@codecov-commenter
Copy link

codecov-commenter commented Apr 5, 2025

Codecov Report

Attention: Patch coverage is 84.76190% with 16 lines in your changes missing coverage. Please review.

Project coverage is 83.31%. Comparing base (ee1e886) to head (0ae4fe5).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/r2x/models/getters.py 70.45% 13 Missing ⚠️
src/r2x/plugins/pcm_defaults.py 92.10% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #180      +/-   ##
==========================================
+ Coverage   83.28%   83.31%   +0.03%     
==========================================
  Files          42       44       +2     
  Lines        4504     4614     +110     
==========================================
+ Hits         3751     3844      +93     
- Misses        753      770      +17     
Files with missing lines Coverage Δ
src/r2x/exporter/sienna.py 95.16% <100.00%> (+0.48%) ⬆️
src/r2x/models/generators.py 97.69% <100.00%> (-0.62%) ⬇️
src/r2x/parser/reeds.py 91.21% <100.00%> (-0.10%) ⬇️
src/r2x/plugins/pcm_defaults.py 91.83% <92.10%> (ø)
src/r2x/models/getters.py 70.45% <70.45%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jarry7
Copy link
Contributor Author

jarry7 commented Apr 10, 2025

@pesap - Ready for your review now. Seem to have addressed HydroPumpedStorage and HydroDispatch

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR revamps PCM defaults integration by introducing explicit ramp and time limit structures, extends generator models with these new fields, and updates time series exporter/parser logic to use unified name and initial_timestamp attributes.

  • Overhauled pcm_defaults plugin to consume new ramp_limits and time_limits JSON schema.
  • Added ramp_limits and time_limits to Generator and HydroPumpedStorage models with default values.
  • Updated parser and exporter functions (ReEDS, PLEXOS, Sienna) and corresponding tests to use name and initial_timestamp for time series metadata.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_sienna_exporter.py Adapt test to positional-only signature of create_timeseries_pointers
tests/test_plugin_pcm_defaults.py Validate new PCM defaults JSON structure (ramp_limits, time_limits)
tests/test_getter_funcs.py Cover new getter behaviors for ramp_limits and updated value multipliers
src/r2x/plugins/pcm_defaults.py Simplified defaults loading; apply new fields and helper functions
src/r2x/plugins/break_gens.py Refactored generator‐breaking logic to use _apply_new_value across types
src/r2x/parser/reeds.py Use name/initial_timestamp instead of variable_name/initial_time
src/r2x/parser/plexos.py Swapped connectioncontext and variable_namename for time series
src/r2x/models/getters.py Adjust getters to support new ramp_limits and ensure correct multipliers
src/r2x/models/generators.py Introduced ramp_limits/time_limits fields and default active/reactive limits
src/r2x/exporter/sienna.py Updated call to create_timeseries_pointers and its signature
src/r2x/exporter/handler.py Changed exporter to use name for metadata lookups
src/r2x/defaults/reeds_input.json Added missing ReEDS technology keys
src/r2x/defaults/pcm_defaults.json Extended every entry with active_power_limits, ramp_limits, and time_limits
pyproject.toml Added infrasys UV source dependency

for component in system.get_components(Generator):
pcm_values = (
pcm_defaults.get(component.name)
or pcm_defaults.get(attrgetter("ext.reeds_tech"))
Copy link

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using attrgetter directly inside pcm_defaults.get passes a function key instead of the reeds_tech string. You need to call the attrgetter on the component (e.g., pcm_defaults.get(attrgetter("ext.reeds_tech")(component))).

Suggested change
or pcm_defaults.get(attrgetter("ext.reeds_tech"))
or pcm_defaults.get(attrgetter("ext.reeds_tech")(component))

Copilot uses AI. Check for mistakes.
if _check_if_null(value):
continue
if field in needs_multiplication:
value = _multiply_value(get_magnitude(component.base_power or component.active_power), value)
Copy link

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For ramp_limits the multiplication helper returns a raw dict, but the model field expects an UpDown instance. Wrap the dict in UpDown(...) after multiplication or update _multiply_value to return the correct type.

Suggested change
value = _multiply_value(get_magnitude(component.base_power or component.active_power), value)
value = _multiply_value(get_magnitude(component.base_power or component.active_power), value, field)

Copilot uses AI. Check for mistakes.
@pesap pesap changed the base branch from main to v2.0.0 July 16, 2025 03:39
@pesap pesap merged commit 0c51455 into v2.0.0 Jul 16, 2025
@pesap pesap deleted the jw/ps branch July 16, 2025 04:01
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.

chore: Update PCM defaults

5 participants