Skip to content

Commit

Permalink
Fix UT
Browse files Browse the repository at this point in the history
Signed-off-by: lisrte <laurent.issertial@rte-france.com>
  • Loading branch information
Lisrte committed Apr 19, 2023
1 parent 65e8fc0 commit c6949e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.powsybl.dynamicsimulation.groovy.GroovyDynamicModelsSupplier;
import com.powsybl.dynamicsimulation.groovy.GroovyExtension;
import com.powsybl.dynawaltz.DynaWaltzProvider;
import com.powsybl.dynawaltz.models.BlackBoxModel;
import com.powsybl.dynawaltz.models.EquipmentBlackBoxModelModel;
import com.powsybl.dynawaltz.models.automatons.CurrentLimitAutomaton;
import com.powsybl.dynawaltz.models.buses.StandardBus;
import com.powsybl.dynawaltz.models.generators.GeneratorFictitious;
Expand Down Expand Up @@ -53,12 +53,12 @@ void testGroovyExtensionCount() {

@ParameterizedTest(name = "{0}")
@MethodSource("provideEquipmentModelData")
void testEquipmentDynamicModels(String groovyScriptName, Class<? extends BlackBoxModel> modelClass, Network network, String staticId, String dynamicId, String parameterId, String lib) {
void testEquipmentDynamicModels(String groovyScriptName, Class<? extends EquipmentBlackBoxModelModel> modelClass, Network network, String staticId, String dynamicId, String parameterId, String lib) {
DynamicModelsSupplier supplier = new GroovyDynamicModelsSupplier(getResourceAsStream(groovyScriptName), EXTENSIONS);
List<DynamicModel> dynamicModels = supplier.get(network);
assertEquals(1, dynamicModels.size());
assertTrue(modelClass.isInstance(dynamicModels.get(0)));
assertBlackBoxModel(modelClass.cast(dynamicModels.get(0)), dynamicId, staticId, parameterId, lib);
assertEquipmentBlackBoxModel(modelClass.cast(dynamicModels.get(0)), dynamicId, staticId, parameterId, lib);
}

@Test
Expand All @@ -69,15 +69,14 @@ void testCurrentLimitAutomaton() {
assertTrue(dynamicModels.get(0) instanceof CurrentLimitAutomaton);
CurrentLimitAutomaton bbm = (CurrentLimitAutomaton) dynamicModels.get(0);
assertEquals("AM_NHV1_NHV2_1", bbm.getDynamicModelId());
assertTrue(bbm.getStaticId().isEmpty());
assertEquals("CLA", bbm.getParameterSetId());
assertEquals("CurrentLimitAutomaton", bbm.getLib());
assertEquals("NHV1_NHV2_1", bbm.getLineStaticId());
}

void assertBlackBoxModel(BlackBoxModel bbm, String dynamicId, String staticId, String parameterId, String lib) {
void assertEquipmentBlackBoxModel(EquipmentBlackBoxModelModel bbm, String dynamicId, String staticId, String parameterId, String lib) {
assertEquals(dynamicId, bbm.getDynamicModelId());
assertEquals(staticId, bbm.getStaticId().orElseThrow());
assertEquals(staticId, bbm.getStaticId());
assertEquals(parameterId, bbm.getParameterSetId());
assertEquals(lib, bbm.getLib());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ void testEventModels(String groovyScriptName, Class<? extends AbstractEventModel

void assertEventModel(AbstractEventModel em, String dynamicId, String equipmentStaticId, String lib, double startTime) {
assertEquals(dynamicId, em.getDynamicModelId());
assertTrue(em.getStaticId().isEmpty());
assertEquals(equipmentStaticId, em.getEquipmentStaticId());
assertEquals(dynamicId, em.getParameterSetId());
assertEquals(lib, em.getLib());
Expand Down

0 comments on commit c6949e6

Please sign in to comment.