Skip to content

feat: handle p and q measurement modification in battery#817

Merged
KoloMenek merged 3 commits into
mainfrom
marutk/feat/handle_battery_p_q_measurements_modification
May 21, 2026
Merged

feat: handle p and q measurement modification in battery#817
KoloMenek merged 3 commits into
mainfrom
marutk/feat/handle_battery_p_q_measurements_modification

Conversation

@KoloMenek
Copy link
Copy Markdown
Member

PR Summary

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

Review Change Stack

Caution

Review failed

The head commit changed during the review from 821ca5f to 00727b3.

📝 Walkthrough

Walkthrough

Battery modification mapping now includes active/reactive power measurement values and validity flags; pom property bumped to 0.83.0 and tests were expanded to set and assert these measurement fields.

Changes

Battery Measurement Fields

Layer / File(s) Summary
Dependency version update
pom.xml
network-modification.version updated from 0.82.0 to 0.83.0 (TODO comment retained).
Entity measurement field mapping
src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BatteryModificationEntity.java
toBatteryModificationInfosBuilder() extended to map four new fields: pMeasurementValue, pMeasurementValidity, qMeasurementValue, qMeasurementValidity via toAttributeModification(...).
Test measurement field validation
src/test/java/org/gridsuite/modification/server/modifications/BatteryModificationTest.java
Test adds measurement imports, expected constants and validity flags, sets P/Q measurement fields on BatteryModificationInfos, invokes assertMeasurements(modifiedBattery), and implements assertMeasurements(Battery) to verify ACTIVE_POWER and REACTIVE_POWER entries' values and validity.

Suggested reviewers

  • achour94
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The pull request description is empty, providing no detail about changes, objectives, or context for reviewers. Add a description explaining what was changed, why these measurement fields are being added, and any testing performed.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding support for handling p (active power) and q (reactive power) measurements in battery modifications.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pom.xml`:
- Line 56: Update the Maven property network-modification.version to remove the
SNAPSHOT and point to a released artifact: change the value from 0.82.0-SNAPSHOT
to a released version (e.g., 0.78.0) so builds are reproducible; ensure any
references to org.gridsuite:gridsuite-network-modification in the pom(s) use
that released version and run a quick mvn -DskipTests verify to confirm
dependency resolution succeeds before merging.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 98d86604-cd75-4613-be57-8e6ae3adb048

📥 Commits

Reviewing files that changed from the base of the PR and between 73809a3 and 67dafed.

📒 Files selected for processing (3)
  • pom.xml
  • src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BatteryModificationEntity.java
  • src/test/java/org/gridsuite/modification/server/modifications/BatteryModificationTest.java

Comment thread pom.xml Outdated
Copy link
Copy Markdown
Contributor

@benrejebmoh benrejebmoh left a comment

Choose a reason for hiding this comment

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

Minor comment

Collection<Measurement> reactivePowerMeasurements = measurements.getMeasurements(Measurement.Type.REACTIVE_POWER).stream().toList();
assertThat(activePowerMeasurements).isNotEmpty();
assertThat(reactivePowerMeasurements).isNotEmpty();
assertThat(activePowerMeasurements).allMatch(m -> m.getValue() == MEASUREMENT_P_VALUE && m.isValid() == MEASUREMENT_P_VALID);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same remark as network-modification lib => prefer using isEqualTo

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed

KoloMenek and others added 3 commits May 21, 2026 11:12
Signed-off-by: Kamil MARUT <kamil.marut@rte-france.com>
Signed-off-by: KoloMenek <kolomenek@gmail.com>
Signed-off-by: KoloMenek <kolomenek@gmail.com>
@KoloMenek KoloMenek force-pushed the marutk/feat/handle_battery_p_q_measurements_modification branch 3 times, most recently from 821ca5f to 00727b3 Compare May 21, 2026 11:40
@sonarqubecloud
Copy link
Copy Markdown

@KoloMenek KoloMenek merged commit 6def173 into main May 21, 2026
5 of 7 checks passed
@KoloMenek KoloMenek deleted the marutk/feat/handle_battery_p_q_measurements_modification branch May 21, 2026 11:47
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.

2 participants