Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load active power target caching #1163

Merged
merged 2 commits into from
Jan 14, 2025
Merged

Load active power target caching #1163

merged 2 commits into from
Jan 14, 2025

Conversation

geofjamg
Copy link
Member

@geofjamg geofjamg commented Jan 3, 2025

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Does this PR already have an issue describing the problem?

No

What kind of change does this PR introduce?

Perfs improvement

What is the current behavior?

When profiling a DC security analysis we get 2.8% if the time spent in calculating bus active power. Generation part is alreadu cached bu not load part.
image

What is the new behavior (if this is a feature change)?

After caching also the load part, we get twice faster.
image

After using a traditionnal loop instead of a stream, we get 0;
image

Does this PR introduce a breaking change or deprecate an API?

  • Yes
  • No

If yes, please check if the following requirements are fulfilled

  • The Breaking Change or Deprecated label has been added
  • The migration steps are described in the following section

What changes might users need to make in their application due to this PR? (migration steps)

Other information:

public void invalidateLoadTargetP() {
loadTargetP = null;
}

Copy link
Collaborator

@vidaldid-rte vidaldid-rte Jan 13, 2025

Choose a reason for hiding this comment

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

Shouldn't this also be called by AbstractLfBus.addLoad (or safer LfLoadImpl.add load, dangling line, converter station etc..) ?

Copy link
Collaborator

@vidaldid-rte vidaldid-rte Jan 14, 2025

Choose a reason for hiding this comment

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

After discussion, ok to consider the addXXX as builfder methods that don't need to call invalidate. The NetworkCache currently only uses setTargetP for what is implemented. So lets assume for now that if Load changes are supported in the future it will ony be through setTargetP and not adding loads or line to a bus.

Signed-off-by: Geoffroy Jamgotchian <[email protected]>
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
@vidaldid-rte vidaldid-rte force-pushed the load_target_p_caching branch from 3ce0729 to 1f0e537 Compare January 14, 2025 14:26
@vidaldid-rte vidaldid-rte merged commit fbec503 into main Jan 14, 2025
8 checks passed
@vidaldid-rte vidaldid-rte deleted the load_target_p_caching branch January 14, 2025 14:38
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.

4 participants