Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Luma <zamarrenolm@aia.es>
  • Loading branch information
zamarrenolm committed Sep 20, 2023
1 parent b354c5b commit edb37eb
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions emf/src/test/java/com/powsybl/emf/IGMmergeTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
import javax.xml.stream.XMLStreamWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.FileSystem;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.nio.file.*;
import java.util.*;
import java.util.function.Consumer;

Expand Down Expand Up @@ -202,6 +199,20 @@ void cgmToCgmes() throws IOException {
compareNetwork(serializedMergedNetwork, networkBENL);
}

@Test
void testCompareSubnetworksMergeAgainstAssembled() {
Network merged = Network.create("merged",
Network.read(CgmesConformity1Catalog.microGridBaseCaseBE().dataSource()),
Network.read(CgmesConformity1Catalog.microGridBaseCaseNL().dataSource()));
// In merged, reset all p0, q0 values for all paired dangling lines
for (DanglingLine dl : merged.getDanglingLines(DanglingLineFilter.PAIRED)) {
dl.setP0(0);
dl.setQ0(0);
}
Network assembled = createCGM();
compareNetwork(assembled, merged);
}

private static void validate(Network n, Set<String> branchIds, Set<String> generatorsId, Set<String> voltageLevelIds) {
branchIds.forEach(b -> assertNotNull(n.getBranch(b)));
generatorsId.forEach(g -> assertNotNull(n.getGenerator(g)));
Expand Down

0 comments on commit edb37eb

Please sign in to comment.