Skip to content

Commit

Permalink
Add integration test
Browse files Browse the repository at this point in the history
Signed-off-by: lisrte <[email protected]>
  • Loading branch information
Lisrte committed Jun 13, 2024
1 parent a8d96f1 commit 0cc61a3
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import com.powsybl.dynawaltz.DynaWaltzParameters;
import com.powsybl.dynawaltz.DynaWaltzProvider;
import com.powsybl.dynawaltz.parameters.ParametersSet;
import com.powsybl.dynawaltz.suppliers.dynamicmodels.DynawoModelsSupplier;
import com.powsybl.dynawaltz.suppliers.events.DynawoEventModelsSupplier;
import com.powsybl.dynawaltz.xml.ParametersXml;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.VariantManagerConstants;
Expand Down Expand Up @@ -273,6 +275,36 @@ void testSimulationError() {
assertTrue(result.getCurves().isEmpty());
}

@Test
void testIeee14DynawoSuppliers() {
Network network = Network.read(new ResourceDataSource("IEEE14", new ResourceSet("/ieee14", "IEEE14.iidm")));

DynamicModelsSupplier dynamicModelsSupplier = new DynawoModelsSupplier(getResourceAsStream("/ieee14/disconnectline/dynamicModels.json"));
EventModelsSupplier eventModelsSupplier = new DynawoEventModelsSupplier(getResourceAsStream("/ieee14/disconnectline/eventModels.json"));

List<ParametersSet> modelsParameters = ParametersXml.load(getResourceAsStream("/ieee14/disconnectline/models.par"));
ParametersSet networkParameters = ParametersXml.load(getResourceAsStream("/ieee14/disconnectline/network.par"), "8");
ParametersSet solverParameters = ParametersXml.load(getResourceAsStream("/ieee14/disconnectline/solvers.par"), "2");
dynaWaltzParameters.setModelsParameters(modelsParameters)
.setNetworkParameters(networkParameters)
.setSolverParameters(solverParameters)
.setSolverType(DynaWaltzParameters.SolverType.IDA)
.setDefaultDumpFileParameters()
.setTimelineExportMode(DynaWaltzParameters.ExportMode.XML);

DynamicSimulationResult result = provider.run(network, dynamicModelsSupplier, eventModelsSupplier, CurvesSupplier.empty(),
VariantManagerConstants.INITIAL_VARIANT_ID, computationManager, parameters, NO_OP)
.join();

assertEquals(DynamicSimulationResult.Status.SUCCESS, result.getStatus());
assertTrue(result.getStatusText().isEmpty());
assertEquals(0, result.getCurves().size());
List<TimelineEvent> timeLine = result.getTimeLine();
assertEquals(11, timeLine.size());
checkFirstTimeLineEvent(timeLine.get(0), 0, "_GEN____8_SM", "PMIN : activation");
}


private void checkFirstTimeLineEvent(TimelineEvent event, double time, String modelName, String message) {
assertEquals(time, event.time());
assertEquals(modelName, event.modelName());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"models":[
{
"model":"LoadAlphaBeta",
"group": "LAB",
"properties":[
{
"name":"staticId",
"value":"_LOAD___5_EC",
"type":"STRING"
}
]
},
{
"model":"LoadAlphaBeta",
"group": "LAB",
"properties":[
{
"name":"staticId",
"value":"_LOAD___6_EC",
"type":"STRING"
}
]
},
{
"model":"GeneratorSynchronousThreeWindingsProportionalRegulations",
"group": "GSTWPR",
"groupType": "PREFIX",
"properties":[
{
"name":"staticId",
"value":"_GEN____6_SM",
"type":"STRING"
}
]
},
{
"model":"GeneratorSynchronousThreeWindingsProportionalRegulations",
"group": "GSTWPR",
"groupType": "PREFIX",
"properties":[
{
"name":"staticId",
"value":"_GEN____8_SM",
"type":"STRING"
}
]
},
{
"model":"GeneratorSynchronousFourWindingsProportionalRegulations",
"group": "GSFWPR",
"groupType": "PREFIX",
"properties":[
{
"name":"staticId",
"value":"_GEN____2_SM",
"type":"STRING"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"events":[
{
"model":"Disconnect",
"properties":[
{
"name":"staticId",
"value":"_BUS____1-BUS____5-1_AC",
"type":"STRING"
},
{
"name":"startTime",
"value":"1",
"type":"DOUBLE"
},
{
"name":"disconnectOnly",
"value":"TWO",
"type":"TWO_SIDES"
}
]
}
]
}

0 comments on commit 0cc61a3

Please sign in to comment.