-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Guillaume Verger <[email protected]> Signed-off-by: Damien Jeandemange <[email protected]>
- Loading branch information
Showing
6 changed files
with
699 additions
and
38 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
flow-decomposition/src/main/java/com/powsybl/flow_decomposition/AcReferenceFlowComputer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) 2024, Coreso SA (https://www.coreso.eu/) and TSCNET Services GmbH (https://www.tscnet.eu/) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
package com.powsybl.flow_decomposition; | ||
|
||
import com.powsybl.iidm.network.Branch; | ||
import com.powsybl.iidm.network.Identifiable; | ||
|
||
import java.util.Collection; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* @author Guillaume Verger {@literal <guillaume.verger at artelys.com>} | ||
*/ | ||
class AcReferenceFlowComputer { | ||
private static ReferenceFlowComputer flowComputer = new ReferenceFlowComputer(); | ||
|
||
Map<String, Double> run(Collection<Branch> xnecList, LoadFlowRunningService.Result loadFlowServiceAcResult) { | ||
if (loadFlowServiceAcResult.fallbackHasBeenActivated()) { | ||
return xnecList.stream().collect(Collectors.toMap(Identifiable::getId, branch -> Double.NaN)); | ||
} | ||
|
||
return flowComputer.run(xnecList); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
...decomposition/src/main/java/com/powsybl/flow_decomposition/FlowDecompositionObserver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
* Copyright (c) 2024, Coreso SA (https://www.coreso.eu/) and TSCNET Services GmbH (https://www.tscnet.eu/) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
package com.powsybl.flow_decomposition; | ||
|
||
import com.powsybl.iidm.network.Country; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* @author Guillaume Verger {@literal <guillaume.verger at artelys.com>} | ||
*/ | ||
public interface FlowDecompositionObserver { | ||
|
||
/** | ||
* Called when the computation starts | ||
*/ | ||
void runStart(); | ||
|
||
/** | ||
* Called when the computation is done | ||
*/ | ||
void runDone(); | ||
|
||
/** | ||
* Called when the base case starts to be computed | ||
*/ | ||
void computingBaseCase(); | ||
|
||
/** | ||
* Called when a contingency computation starts | ||
* | ||
* @param contingencyId The current contingency id | ||
*/ | ||
void computingContingency(String contingencyId); | ||
|
||
/** | ||
* Called when Glsk are computed thanks to the GlskProvider (during base case computation) | ||
* | ||
* @param glsks the Glsks per country per generator | ||
*/ | ||
void computedGlsk(Map<Country, Map<String, Double>> glsks); | ||
|
||
/** | ||
* Called when net positions are computed (for base case computation) | ||
* | ||
* @param netPositions the net positions per country | ||
*/ | ||
void computedNetPositions(Map<Country, Double> netPositions); | ||
|
||
/** | ||
* Called when the nodal injection matrix is computed (for base case or contingency) | ||
* | ||
* @param nodalInjections the matrix of nodal injections indexed by(node, flow) | ||
*/ | ||
void computedNodalInjectionsMatrix(Map<String, Map<String, Double>> nodalInjections); | ||
|
||
/** | ||
* Called when the PTDF matrix is computed (for base case or contingency) | ||
* | ||
* @param pdtfMatrix the matrix of ptdf indexed by (line, node) | ||
*/ | ||
void computedPtdfMatrix(Map<String, Map<String, Double>> pdtfMatrix); | ||
|
||
/** | ||
* Called when the PSDF matrix is computed (for base case or contingency) | ||
* | ||
* @param psdfMatrix the matrix of psdf indexed by (line, node) | ||
*/ | ||
void computedPsdfMatrix(Map<String, Map<String, Double>> psdfMatrix); | ||
|
||
/** | ||
* Called when the AC nodal injections matrix is computed (for base case or contingency) | ||
* | ||
* @param positions the positions after AC loadflow | ||
* @param fallbackHasBeenActivated true if AC loadflow didn't converge | ||
*/ | ||
void computedAcNodalInjections(Map<String, Double> positions, boolean fallbackHasBeenActivated); | ||
|
||
/** | ||
* Called when the DC nodal injections matrix is computed (for base case or contingency) | ||
* | ||
* @param positions the positions after DC loadflow | ||
*/ | ||
void computedDcNodalInjections(Map<String, Double> positions); | ||
|
||
/** | ||
* Called when the AC loadflow is computed (for base case or contingency) | ||
* | ||
* @param flows the flows for all branches | ||
*/ | ||
void computedAcFlows(Map<String, Double> flows); | ||
|
||
/** | ||
* Called when the DC loadflow is computed (for base case or contingency) | ||
* | ||
* @param flows the flows for all branches | ||
*/ | ||
void computedDcFlows(Map<String, Double> flows); | ||
} |
Oops, something went wrong.