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

Non evacuated energy computation #51

Merged
merged 24 commits into from
Jan 12, 2024

Conversation

FranckLecuyer
Copy link
Collaborator

No description provided.

@FranckLecuyer FranckLecuyer changed the title Non evacuated energy computation [WIP] Non evacuated energy computation Dec 1, 2023
…computation

Signed-off-by: Franck LECUYER <[email protected]>

# Conflicts:
#	src/main/java/org/gridsuite/sensitivityanalysis/server/service/SensitivityAnalysisWorkerService.java
…s (like for other computation types)

Signed-off-by: Franck LECUYER <[email protected]>
@FranckLecuyer FranckLecuyer changed the title [WIP] Non evacuated energy computation Non evacuated energy computation Dec 8, 2023
@TheMaskedTurtle TheMaskedTurtle self-requested a review December 13, 2023 13:51
…computation

Signed-off-by: Franck LECUYER <[email protected]>

# Conflicts:
#	src/main/java/org/gridsuite/sensitivityanalysis/server/service/SensitivityAnalysisInputBuilderService.java
Signed-off-by: Franck LECUYER <[email protected]>
Signed-off-by: Franck LECUYER <[email protected]>
…computation

Signed-off-by: Franck LECUYER <[email protected]>

# Conflicts:
#	src/main/java/org/gridsuite/sensitivityanalysis/server/service/NotificationService.java
#	src/main/java/org/gridsuite/sensitivityanalysis/server/service/SensitivityAnalysisWorkerService.java
…computation

Signed-off-by: Franck LECUYER <[email protected]>

# Conflicts:
#	src/main/java/org/gridsuite/sensitivityanalysis/server/SensitivityAnalysisController.java
#	src/main/java/org/gridsuite/sensitivityanalysis/server/service/SensitivityAnalysisInputBuilderService.java
private Map<EnergySource, Double> pInitByEnergySource = new EnumMap<>(EnergySource.class);

@Builder.Default
private Map<String, ContingencyStageDetailResult> resultsbyContingency = new HashMap<>(); // key is null for N
Copy link
Contributor

Choose a reason for hiding this comment

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

"N" instead ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or separate N result and contingency results ?

Copy link
Contributor

Choose a reason for hiding this comment

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

typo: resultsBy


private Double percentOverload;

private String contingencyId; // null if N
Copy link
Contributor

Choose a reason for hiding this comment

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

"N" if N?

* @author Franck Lecuyer <franck.lecuyer at rte-france.com>
*/
@Getter
public class NonEvacuatedEnergyRunContext {
Copy link
Contributor

Choose a reason for hiding this comment

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

Very close to the sensi version, can we have an abstraction?

/**
* @author Franck Lecuyer <franck.lecuyer at rte-france.com>
*/
public class NonEvacuatedEnergyResultContext {
Copy link
Contributor

Choose a reason for hiding this comment

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

Very close to the sensi version, can we have an abstraction?

* @author Franck Lecuyer <franck.lecuyer at rte-france.com>
*/
@Service
public class NonEvacuatedEnergyWorkerService {
Copy link
Contributor

Choose a reason for hiding this comment

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

Some methods can be shared with SensitivityAnalysisWorkerService

// the limit value multiplied by the input coefficient (nCoeff/nm1Coeff)
if (contingencyIndex < 0) { // N
if (monitoredBranchThreshold.isIstN()) {
limitName = "IST";
Copy link
Contributor

Choose a reason for hiding this comment

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

Add as constant at the top of the file?

// loop until no more remaining or no more generators to dispatch or max iteration reached
while (!finished) {
i++;
int j = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

change to boolean firstIteration?

// the sum of generator variation and generator capping is higher than the generator targetP :
// we update the generator capping with the targetP and remove this generator from the generators to dispatch
// we substract the delta between the generator targetP and the generator capping from the remaining
variationsByEnergySource.put(generator.getEnergySource(), variationsByEnergySource.get(generator.getEnergySource()) + targetP - generatorCappings.get(generatorId).getCapping());
Copy link
Contributor

Choose a reason for hiding this comment

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

Create a variable deltaP for targetP - generatorCappings.get(generatorId).getCapping()?

Copy link
Contributor

@antoinebhs antoinebhs left a comment

Choose a reason for hiding this comment

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

  • To validate this algorithm, a comparative study with CVG and the same input parameters should be done at some point.
  • We should try to lower the number of sonar issues, we should be able to get close to 0 with some method extraction and fixes?

Copy link
Contributor

@TheMaskedTurtle TheMaskedTurtle left a comment

Choose a reason for hiding this comment

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

You should add business logs to understand what's going on in the process, it's hard to debug for now

Signed-off-by: Franck LECUYER <[email protected]>
Signed-off-by: Franck LECUYER <[email protected]>
Signed-off-by: Franck LECUYER <[email protected]>
Signed-off-by: Franck LECUYER <[email protected]>
Adding reports

Signed-off-by: Franck LECUYER <[email protected]>
Signed-off-by: Franck LECUYER <[email protected]>
Copy link

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

21 New issues
0 Security Hotspots
82.1% Coverage on New Code
1.4% Duplication on New Code

See analysis details on SonarCloud

@FranckLecuyer FranckLecuyer merged commit 6ce9863 into main Jan 12, 2024
3 checks passed
@FranckLecuyer FranckLecuyer deleted the non-evacuated-energy-computation branch January 12, 2024 15:29
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