Skip to content

Commit

Permalink
Modify network used in unit tests.
Browse files Browse the repository at this point in the history
Signed-off-by: parvy <pierre.arvy@artelys.com>
  • Loading branch information
p-arvy committed Nov 22, 2023
1 parent 01bd1d3 commit be62d53
Show file tree
Hide file tree
Showing 31 changed files with 58 additions and 3,413 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private Path getAmplExecPath() throws IOException {

@Test
void testInputFile() throws IOException {
Network network = IeeeCdfNetworkFactory.create118();
Network network = IeeeCdfNetworkFactory.create57();
setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network

OpenReacParameters parameters = new OpenReacParameters().setObjective(
Expand Down Expand Up @@ -111,6 +111,7 @@ void testInputFile() throws IOException {

@Test
public void testOutputFileParsing() throws IOException {
// TODO : change the following network and adapt rest of the test
Network network = IeeeCdfNetworkFactory.create118();
setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network
// To parse correctly data from output files, there must be an ID in the Ampl mapper
Expand Down Expand Up @@ -152,10 +153,11 @@ public void testOutputFileParsing() throws IOException {

LocalCommandExecutor localCommandExecutor = new TestLocalCommandExecutor(
List.of("mock_outputs/reactiveopf_results_generators.csv",
"mock_outputs/reactiveopf_results_indic.txt", "mock_outputs/reactiveopf_results_rtc.csv",
"mock_outputs/reactiveopf_results_shunts.csv",
"mock_outputs/reactiveopf_results_static_var_compensators.csv",
"mock_outputs/reactiveopf_results_vsc_converter_stations.csv"));
"mock_outputs/reactiveopf_results_indic.txt",
"mock_outputs/reactiveopf_results_rtc.csv",
"mock_outputs/reactiveopf_results_shunts.csv",
"mock_outputs/reactiveopf_results_static_var_compensators.csv",
"mock_outputs/reactiveopf_results_vsc_converter_stations.csv"));
try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir),
localCommandExecutor, ForkJoinPool.commonPool())) {
OpenReacResult openReacResult = OpenReacRunner.run(network,
Expand All @@ -182,9 +184,9 @@ private void testAllModifAndLoadFlow(Network network, String subFolder, OpenReac
subFolder + "/reactiveopf_results_static_var_compensators.csv",
subFolder + "/reactiveopf_results_vsc_converter_stations.csv"));
// To really run open reac, use the commentede line below. Be sure that open-reac/src/test/resources/com/powsybl/config/test/config.yml contains your ampl path
try (ComputationManager computationManager = new LocalComputationManager()) {
// try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir),
// localCommandExecutor, ForkJoinPool.commonPool())) {
// try (ComputationManager computationManager = new LocalComputationManager()) {
try (ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir),
localCommandExecutor, ForkJoinPool.commonPool())) {
OpenReacResult openReacResult = OpenReacRunner.run(network,
network.getVariantManager().getWorkingVariantId(), parameters, new OpenReacConfig(true),
computationManager);
Expand Down Expand Up @@ -246,12 +248,9 @@ public void testTransformer() throws IOException {

@Test
public void testRealNetwork() throws IOException {
// Network {CC0 SC0}: 53 generators have an inconsistent target voltage and have been discarded from voltage control
Network network = IeeeCdfNetworkFactory.create118();
Network network = IeeeCdfNetworkFactory.create57();
setDefaultVoltageLimits(network); // set default voltage limits to every voltage levels of the network
OpenReacParameters parameters = new OpenReacParameters();
// LoadFlowResult loadFlowResult = LoadFlow.run(network);
// assertTrue(loadFlowResult.isOk());
testAllModifAndLoadFlow(network, "openreac-output-real-network", parameters);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#amplId powsyblId
1 'B5-SH'
1 'B18-SH'

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#amplId powsyblId
178 'T8-5-1'
64 'T4-18-1'

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit be62d53

Please sign in to comment.