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

Generator contingency for DC sensitivities #318

Merged
merged 30 commits into from
Jun 22, 2021

Conversation

Hadrien-Godard
Copy link
Member

Signed-off-by: Hadrien hadrien.godard@artelys.com

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

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

What is the current behavior? (You can also link to an open issue here)

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

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: Hadrien <hadrien.godard@artelys.com>
@Hadrien-Godard Hadrien-Godard requested a review from annetill June 4, 2021 09:19
@Hadrien-Godard Hadrien-Godard self-assigned this Jun 4, 2021
Signed-off-by: Hadrien <hadrien.godard@artelys.com>
Signed-off-by: Hadrien <hadrien.godard@artelys.com>
Signed-off-by: Hadrien <hadrien.godard@artelys.com>
Signed-off-by: Hadrien <hadrien.godard@artelys.com>
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.

It could be better to do test driven development, but it is up to you.

@@ -87,4 +87,9 @@ public void updateState(boolean reactiveLimits, boolean writeSlackBus, boolean d
public boolean isParticipating() {
return participating;
}

public void setIsParticipating(boolean b) {
Copy link
Member

Choose a reason for hiding this comment

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

Change for setParticipating and if you change that attribute, do not forget to store it and to restore it after contingency.

generatorsToSave.add(generator);
}
Map<Generator, GeneratorState> generatorStates = GeneratorState.createGeneratorStates(generatorsToSave);
for (String generatorId : contingency.getGeneratorIdsToLose()) {
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 to do that on the LfGenerator object directly and in the same time you have to remove it from slack distribution if in the parameters slack is distributed and the distribution is made on generators.

return generatorStates;
}

private List<ParticipatingElement> removeGeneratorParticipation(Network network, LfNetwork lfNetwork, PropagatedContingency contingency, List<ParticipatingElement> participatingElements) {
Copy link
Member

Choose a reason for hiding this comment

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

I think you don't need a dedicated function for that. It could be done with the other attributes of the generator.

/**
* @author Hadrien Godard <hadrien.godard at artelys.com>
*/
public class GeneratorState {
Copy link
Member

Choose a reason for hiding this comment

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

You don't need that class, I think that all of this can be done inside BusState. with some adaptions in order not to save all the generators of a bus maybe.

Hadrien-Godard and others added 11 commits June 10, 2021 15:01
…ed in next commit

Signed-off-by: Hadrien <hadrien.godard@artelys.com>
Signed-off-by: Hadrien <hadrien.godard@artelys.com>
Signed-off-by: Hadrien <hadrien.godard@artelys.com>
Signed-off-by: Hadrien <hadrien.godard@artelys.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
if (shouldChangeRhs) {
setBaseCaseSensitivityValues(factorGroups, factorStates);
}
List<ParticipatingElement> saveParticipatingElements = new ArrayList<>(participatingElements);
Copy link
Member

Choose a reason for hiding this comment

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

I suspect a serious performance regression, we should have something like before:

if (contingency.getHvdcIdsToOpen().isEmpty() || contingency.getGeneratorIdsToLose().isEmpty()) { 
    calculateSensitivityValues(factors, factorStates, contingenciesStates, flowStates, contingencyElements,
                    contingency, valueWriter);
} else { // if we have a contingency including the loss of a DC line or a generator loss

}

Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
@annetill annetill requested a review from geofjamg June 17, 2021 09:24
if (shouldChangeRhs) {
if (changeParticipatingElements) {
participatingElements.clear();
participatingElements.addAll(saveParticipatingElements);
Copy link
Member

Choose a reason for hiding this comment

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

Is it on purpose the fact that you change the participatingElements method input?

Copy link
Member

Choose a reason for hiding this comment

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

These three lines here are very important yes. What do you mean?

}
}

private Map<LfBus, BusState> applyContingencyOnNetwork(Network network, LfNetwork lfNetwork, PropagatedContingency contingency,
Copy link
Member

Choose a reason for hiding this comment

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

The name is confusing as we only apply injection part of the contingency

Copy link
Member

Choose a reason for hiding this comment

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

I have changed in applyInjectionContingencies, what do you think?

annetill and others added 7 commits June 17, 2021 16:48
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
flo-dup and others added 6 commits June 22, 2021 10:00
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@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 0 Code Smells

90.0% 90.0% Coverage
0.0% 0.0% Duplication

@annetill annetill merged commit a05ae20 into master Jun 22, 2021
@annetill annetill deleted the sensiDCGeneratorContingency branch June 22, 2021 11:40
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