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

Refactor jacobian matrix update #216

Merged
merged 12 commits into from
Feb 16, 2021
Merged

Refactor jacobian matrix update #216

merged 12 commits into from
Feb 16, 2021

Conversation

geofjamg
Copy link
Member

@geofjamg geofjamg commented Feb 7, 2021

Please check if the PR fulfills these requirements (please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • 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 ? If so, link to this issue using '#XXX' and skip the rest
No

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Refactoring

What is the new behavior (if this is a feature change)?
The equation system to jacobian matrix has been refactor to better encapsulate in JacobianMatrix the update logic. EquationSystem notification has been improve to give more informations to JacobianMatrix.
This refactoring will allow later to improve performance.

Does this PR introduce a breaking change or deprecate an API? If yes, check the following:

  • The Breaking Change or Deprecated label has been added
  • The migration guide has been updated in the github wiki (What changes might users need to make in their application due to this PR?)

Other information:

(if any of the questions/checkboxes don't apply, please delete them entirely)

Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
@geofjamg geofjamg requested review from annetill and flo-dup February 7, 2021 20:58
# Conflicts:
#	src/main/java/com/powsybl/openloadflow/sa/OpenSecurityAnalysis.java
#	src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
@@ -81,8 +81,11 @@ private void reIndex() {
for (Equation equation : equations.values()) {
if (equation.isActive()) {
NavigableMap<Variable, List<EquationTerm>> equationTermsByVariable = null;
// check we have at lest one equation term active
Copy link
Member

Choose a reason for hiding this comment

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

Typo "least" ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@@ -12,7 +12,6 @@
public enum EquationEventType {
EQUATION_CREATED,
EQUATION_REMOVED,
EQUATION_UPDATED,
Copy link
Member

Choose a reason for hiding this comment

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

You have removed that type because now you want to introduce the equation term granularity ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes

@annetill annetill self-requested a review February 9, 2021 17:09
Copy link
Member

@annetill annetill left a comment

Choose a reason for hiding this comment

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

I have tested on an security analysis on RTE network.

@@ -81,8 +81,11 @@ private void reIndex() {
for (Equation equation : equations.values()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

As EquationCache is becoming bigger you could maybe put it in a separate file

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know, EquationCache need to access to equations field of EquationSystem, so I would have to pass EquationSystem to EquationCache constructor

* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com>
*/
public enum EquationTermEventType {
EQUATION_TERM_ADDED,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could avoid this third type, as equation terms are always added at equation creation.

Copy link
Member Author

Choose a reason for hiding this comment

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

In the actual code, yes but the Equation API allows to add new terms after creation so maybe we should still keep it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok. The equation API is a bit strange in fact, as the equation has a temporary state when not containing any terms (or not containing all terms), and that temporary state doesn't really make sense. But ok to keep it that way.

Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

89.6% 89.6% Coverage
0.0% 0.0% Duplication

@geofjamg geofjamg merged commit 446e0a1 into master Feb 16, 2021
@geofjamg geofjamg deleted the refactor_jacobian branch February 16, 2021 20:58
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.

3 participants