-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/contingenciesProviderMock' into …
…contingenciesProviderMock
- Loading branch information
Showing
13 changed files
with
119 additions
and
6 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
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
50 changes: 50 additions & 0 deletions
50
ampl-export/src/main/test/java/eu/itesla_project/iidm/export/ampl/AmplNetworkWriterTest.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,50 @@ | ||
/** | ||
* Copyright (c) 2016, 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 eu.itesla_project.iidm.export.ampl; | ||
|
||
import com.google.common.io.CharStreams; | ||
import eu.itesla_project.iidm.datasource.MemDataSource; | ||
import eu.itesla_project.iidm.network.Network; | ||
import eu.itesla_project.iidm.network.test.EurostagTutorialExample1Factory; | ||
import org.junit.Test; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com> | ||
*/ | ||
public class AmplNetworkWriterTest { | ||
|
||
private void assertEqualsToRef(MemDataSource dataSource, String suffix, String refFileName) throws IOException { | ||
assertEquals(new String(dataSource.getData(suffix, "txt"), StandardCharsets.UTF_8), | ||
CharStreams.toString(new InputStreamReader(getClass().getResourceAsStream("/" + refFileName), StandardCharsets.UTF_8))); | ||
} | ||
|
||
@Test | ||
public void write() throws Exception { | ||
Network network = EurostagTutorialExample1Factory.create(); | ||
|
||
MemDataSource dataSource = new MemDataSource(); | ||
new AmplNetworkWriter(network, dataSource, new AmplExportConfig(AmplExportConfig.ExportScope.ALL, true)) | ||
.write(); | ||
|
||
assertEqualsToRef(dataSource, "_network_substations", "eurostag-tutorial-example1-substations.txt"); | ||
assertEqualsToRef(dataSource, "_network_buses", "eurostag-tutorial-example1-buses.txt"); | ||
assertEqualsToRef(dataSource, "_network_tct", "eurostag-tutorial-example1-tct.txt"); | ||
assertEqualsToRef(dataSource, "_network_rtc", "eurostag-tutorial-example1-rtc.txt"); | ||
assertEqualsToRef(dataSource, "_network_ptc", "eurostag-tutorial-example1-ptc.txt"); | ||
assertEqualsToRef(dataSource, "_network_loads", "eurostag-tutorial-example1-loads.txt"); | ||
assertEqualsToRef(dataSource, "_network_shunts", "eurostag-tutorial-example1-shunts.txt"); | ||
assertEqualsToRef(dataSource, "_network_generators", "eurostag-tutorial-example1-generators.txt"); | ||
assertEqualsToRef(dataSource, "_network_limits", "eurostag-tutorial-example1-limits.txt"); | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
ampl-export/src/main/test/resources/eurostag-tutorial-example1-branches.txt
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,6 @@ | ||
#Branches (sim1/InitialState) | ||
#"num" "bus1" "bus2" "3wt num" "sub.1" "sub.2" "r (pu)" "x (pu)" "g1 (pu)" "g2 (pu)" "b1 (pu)" "b2 (pu)" "cst ratio (pu)" "ratio tc" "phase tc" "p1 (MW)" "p2 (MW)" "q1 (MVar)" "q2 (MVar)" "patl1 (A)" "patl2 (A)" "merged" "fault" "curative" "id" "description" | ||
1 2 3 -1 2 3 0.00207756 0.0228532 0.00000 0.00000 0.278692 0.278692 1.00000 -1 -1 -99999.0 -99999.0 -99999.0 -99999.0 -99999.0 -99999.0 false 0 0 "NHV1_NHV2_1" "NHV1_NHV2_1" | ||
2 2 3 -1 2 3 0.00207756 0.0228532 0.00000 0.00000 0.278692 0.278692 1.00000 -1 -1 -99999.0 -99999.0 -99999.0 -99999.0 -99999.0 -99999.0 false 0 0 "NHV1_NHV2_2" "NHV1_NHV2_2" | ||
3 1 2 -1 1 2 0.000184615 0.00769009 0.00000 0 0.00000 0 1.05263 -1 -1 -99999.0 -99999.0 -99999.0 -99999.0 -99999.0 -99999.0 false 0 0 "NGEN_NHV1" "NGEN_NHV1" | ||
4 3 4 -1 3 4 0.000210000 0.0179988 0.00000 0 0.00000 0 1.00067 1 -1 -99999.0 -99999.0 -99999.0 -99999.0 -99999.0 -99999.0 false 0 0 "NHV2_NLOAD" "NHV2_NLOAD" |
6 changes: 6 additions & 0 deletions
6
ampl-export/src/main/test/resources/eurostag-tutorial-example1-buses.txt
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,6 @@ | ||
#Buses (sim1/InitialState) | ||
#"num" "substation" "cc" "v (pu)" "theta (rad)" "p (MW)" "q (MVar)" "fault" "curative" | ||
1 1 0 -99999.0 -99999.0 0.00000 0.00000 0 0 | ||
2 2 0 -99999.0 -99999.0 0.00000 0.00000 0 0 | ||
3 3 0 -99999.0 -99999.0 0.00000 0.00000 0 0 | ||
4 4 0 -99999.0 -99999.0 0.00000 0.00000 0 0 |
3 changes: 3 additions & 0 deletions
3
ampl-export/src/main/test/resources/eurostag-tutorial-example1-generators.txt
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,3 @@ | ||
#Generators (sim1/InitialState) | ||
#"num" "bus" "con. bus" "substation" "minP (MW)" "maxP (MW)" "minQmaxP (MVar)" "minQminP (MVar)" "maxQmaxP (MVar)" "maxQminP (MVar)" "v regul." "targetV (pu)" "targetP (MW)" "targetQ (MVar)" "fault" "curative" "id" "description" | ||
1 1 1 1 -9999.99 9999.99 -9999.99 -9999.99 9999.99 9999.99 true 1.02083 607.000 301.000 0 0 "GEN" "GEN" |
2 changes: 2 additions & 0 deletions
2
ampl-export/src/main/test/resources/eurostag-tutorial-example1-limits.txt
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,2 @@ | ||
#Temporary current limits (sim1/InitialState) | ||
#"num" "branch" "side" "limit (A)" "accept. duration (s)" "fault" "curative" |
3 changes: 3 additions & 0 deletions
3
ampl-export/src/main/test/resources/eurostag-tutorial-example1-loads.txt
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,3 @@ | ||
#Loads (sim1/InitialState) | ||
#"num" "bus" "substation" "p (MW)" "q (MVar)" "fault" "curative" "id" "description" | ||
1 4 4 600.000 200.000 0 0 "LOAD" "LOAD" |
2 changes: 2 additions & 0 deletions
2
ampl-export/src/main/test/resources/eurostag-tutorial-example1-ptc.txt
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,2 @@ | ||
#Phase tap changers (sim1/InitialState) | ||
#"num" "tap" "table" "fault" "curative" "id" |
3 changes: 3 additions & 0 deletions
3
ampl-export/src/main/test/resources/eurostag-tutorial-example1-rtc.txt
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,3 @@ | ||
#Ratio tap changers (sim1/InitialState) | ||
#"num" "tap" "table" "onLoad" "fault" "curative" "id" | ||
1 2 1 true 0 0 "NHV2_NLOAD" |
2 changes: 2 additions & 0 deletions
2
ampl-export/src/main/test/resources/eurostag-tutorial-example1-shunts.txt
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,2 @@ | ||
#Shunts (sim1/InitialState) | ||
#"num" "bus" "con. bus" "substation" "minB (pu)" "maxB (pu)" "inter. points" "b (pu)" "fault" "curative" "id" "description" |
6 changes: 6 additions & 0 deletions
6
ampl-export/src/main/test/resources/eurostag-tutorial-example1-substations.txt
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,6 @@ | ||
#Substations (sim1/InitialState) | ||
#"num" "horizon" "reference date distance (minutes)" "nomV (KV)" "minV (pu)" "maxV (pu)" "fault" "curative" "country" "id" "description" | ||
1 "SN" 0 24.0000 -99999.0 -99999.0 0 0 "FR" "VLGEN" "VLGEN" | ||
2 "SN" 0 380.000 -99999.0 -99999.0 0 0 "FR" "VLHV1" "VLHV1" | ||
3 "SN" 0 380.000 -99999.0 -99999.0 0 0 "FR" "VLHV2" "VLHV2" | ||
4 "SN" 0 150.000 -99999.0 -99999.0 0 0 "FR" "VLLOAD" "VLLOAD" |
5 changes: 5 additions & 0 deletions
5
ampl-export/src/main/test/resources/eurostag-tutorial-example1-tct.txt
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,5 @@ | ||
#Tap changer table (sim1/InitialState) | ||
#"num" "tap" "var ratio" "x (pu)" "angle (rad)" "fault" "curative" | ||
1 1 0.850567 0.0179988 0.00000 0 0 | ||
1 2 1.00067 0.0179988 0.00000 0 0 | ||
1 3 1.15077 0.0179988 0.00000 0 0 |