-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
152 additions
and
85 deletions.
There are no files selected for viewing
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
14 changes: 14 additions & 0 deletions
14
cse-cc-export-runner-app/src/main/resources/cseCracCreationParameters.json
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,14 @@ | ||
{ | ||
"crac-factory": "CracImplFactory", | ||
"ra-usage-limits-per-instant": [ | ||
{ | ||
"instant": "curative", | ||
"max-ra-per-tso": { | ||
"IT": 6, | ||
"FR": 5, | ||
"CH": 1, | ||
"AT": 3, | ||
"SI": 3 | ||
} | ||
}] | ||
} |
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
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
14 changes: 14 additions & 0 deletions
14
cse-cc-import-runner-app/src/main/resources/cseCracCreationParameters.json
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,14 @@ | ||
{ | ||
"crac-factory": "CracImplFactory", | ||
"ra-usage-limits-per-instant": [ | ||
{ | ||
"instant": "curative", | ||
"max-ra-per-tso": { | ||
"IT": 6, | ||
"FR": 5, | ||
"CH": 1, | ||
"AT": 3, | ||
"SI": 3 | ||
} | ||
}] | ||
} |
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
42 changes: 42 additions & 0 deletions
42
.../java/com/farao_community/farao/cse/network_processing/CracCreationParametersService.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,42 @@ | ||
/* | ||
* Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
* 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/. | ||
*/ | ||
package com.farao_community.farao.cse.network_processing; | ||
|
||
import com.powsybl.openrao.data.craccreation.creator.api.parameters.CracCreationParameters; | ||
import com.powsybl.openrao.data.craccreation.creator.api.parameters.JsonCracCreationParameters; | ||
import com.powsybl.openrao.data.craccreation.creator.cse.parameters.BusBarChangeSwitches; | ||
import com.powsybl.openrao.data.craccreation.creator.cse.parameters.CseCracCreationParameters; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.InputStream; | ||
import java.util.Set; | ||
|
||
/** | ||
* @author Ameni Walha {@literal <ameni.walha at rte-france.com>} | ||
*/ | ||
public final class CracCreationParametersService { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(CracCreationParametersService.class); | ||
|
||
private CracCreationParametersService() { | ||
// utility class | ||
} | ||
|
||
public static CracCreationParameters getCracCreationParameters(InputStream cracCreationParamsInputStream, Set<BusBarChangeSwitches> busBarChangeSwitches) { | ||
CracCreationParameters cracCreationParameters = JsonCracCreationParameters.read(cracCreationParamsInputStream); | ||
CseCracCreationParameters cseCracCreationParameters = cracCreationParameters.getExtension(CseCracCreationParameters.class); | ||
if (cseCracCreationParameters != null) { | ||
cseCracCreationParameters.setBusBarChangeSwitchesSet(busBarChangeSwitches); | ||
} else { | ||
cseCracCreationParameters = new CseCracCreationParameters(); | ||
cseCracCreationParameters.setBusBarChangeSwitchesSet(busBarChangeSwitches); | ||
cracCreationParameters.addExtension(CseCracCreationParameters.class, cseCracCreationParameters); | ||
} | ||
return cracCreationParameters; | ||
} | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
...a/com/farao_community/farao/cse/network_processing/CracCreationParametersServiceTest.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,42 @@ | ||
/* | ||
* Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
* 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/. | ||
*/ | ||
package com.farao_community.farao.cse.network_processing; | ||
|
||
import com.powsybl.openrao.data.cracapi.RaUsageLimits; | ||
import com.powsybl.openrao.data.craccreation.creator.api.parameters.CracCreationParameters; | ||
import com.powsybl.openrao.data.craccreation.creator.cse.parameters.BusBarChangeSwitches; | ||
import com.powsybl.openrao.data.craccreation.creator.cse.parameters.CseCracCreationParameters; | ||
import com.powsybl.openrao.data.craccreation.creator.cse.parameters.SwitchPairId; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.InputStream; | ||
import java.util.Objects; | ||
import java.util.Set; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
/** | ||
* @author Ameni Walha {@literal <ameni.walha at rte-france.com>} | ||
*/ | ||
class CracCreationParametersServiceTest { | ||
@Test | ||
void getCracCreationParametersTest() { | ||
InputStream cracCreationParametersJsonPath = Objects.requireNonNull(getClass().getResourceAsStream("cseCracCreationParameters.json")); | ||
Set<BusBarChangeSwitches> busBarChangesSwitches = Set.of(new BusBarChangeSwitches("ra-id", Set.of(new SwitchPairId("switch-to-open", "switch-to-close")))); | ||
CracCreationParameters cracCreationParameters = CracCreationParametersService.getCracCreationParameters(cracCreationParametersJsonPath, busBarChangesSwitches); | ||
RaUsageLimits raUsageLimits = cracCreationParameters.getRaUsageLimitsPerInstant().get("curative"); | ||
assertTrue(raUsageLimits.getMaxTopoPerTso().isEmpty()); | ||
assertTrue(raUsageLimits.getMaxTopoPerTso().isEmpty()); | ||
assertEquals(6, raUsageLimits.getMaxRaPerTso().get("IT")); | ||
assertEquals(5, raUsageLimits.getMaxRaPerTso().get("FR")); | ||
assertEquals(1, raUsageLimits.getMaxRaPerTso().get("CH")); | ||
assertEquals(3, raUsageLimits.getMaxRaPerTso().get("AT")); | ||
assertEquals(3, raUsageLimits.getMaxRaPerTso().get("SI")); | ||
CseCracCreationParameters cseCracCreationParameters = cracCreationParameters.getExtension(CseCracCreationParameters.class); | ||
assertEquals(1, cseCracCreationParameters.getBusBarChangeSwitches("ra-id").getSwitchPairs().size()); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...resources/com/farao_community/farao/cse/network_processing/cseCracCreationParameters.json
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,14 @@ | ||
{ | ||
"crac-factory": "CracImplFactory", | ||
"ra-usage-limits-per-instant": [ | ||
{ | ||
"instant": "curative", | ||
"max-ra-per-tso": { | ||
"IT": 6, | ||
"FR": 5, | ||
"CH": 1, | ||
"AT": 3, | ||
"SI": 3 | ||
} | ||
}] | ||
} |