Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete Merging View implementation #2612

Merged
merged 5 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions cgmes/cgmes-conversion/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>

<!-- To validate bus balances on converted Network -->
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down Expand Up @@ -171,10 +171,5 @@
<artifactId>xmlunit-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-iidm-mergingview</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.powsybl.cgmes.model.CgmesNames;
import com.powsybl.cgmes.model.CgmesNamespace;
import com.powsybl.commons.xml.XmlUtil;
import com.powsybl.iidm.mergingview.MergingView;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.TieLine;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -48,6 +47,14 @@ void microGridBaseCaseBEMergedWithNL() {
// All dangling lines must have been converted to tie lines
assertEquals(nDlBE, nTl);

for (TieLine tl : be.getTieLines()) {
// The danglingLine1 and danglingLine1.boundary.dl must be the same object
// Both should correspond to objects at my level of merging
assertEquals(tl.getDanglingLine1(), tl.getDanglingLine1().getBoundary().getDanglingLine());
assertEquals(tl.getDanglingLine2(), tl.getDanglingLine2().getBoundary().getDanglingLine());
}
assertEquals(10, be.getDanglingLineCount());

// Check SV export contains tie line terminals
checkExportSvTerminals(be);
}
Expand Down Expand Up @@ -101,35 +108,4 @@ private static boolean xmlContains(byte[] xml, String clazz, String ns, String a
return false;
}

@Test
void microGridBaseCaseBEMergingViewNL() {
Network be = Network.read(CgmesConformity3Catalog.microGridBaseCaseBE().dataSource());
assertNotEquals("unknown", be.getId());
int nSubBE = be.getSubstationCount();
int nDlBE = be.getDanglingLineCount();
Network nl = Network.read(CgmesConformity3Catalog.microGridBaseCaseNL().dataSource());
assertNotEquals("unknown", nl.getId());
int nSubNL = nl.getSubstationCount();
int nDlNL = nl.getDanglingLineCount();
// Both networks have the same number of dangling lines
assertEquals(nDlBE, nDlNL);

Network n = MergingView.create("be-nl", "CGMES");
n.merge(nl, be);

int nSub = n.getSubstationCount();
assertEquals(nSubBE + nSubNL, nSub);
long nTl = n.getTieLineCount();
// All dangling lines must have been converted to tie lines
assertEquals(nDlBE, nTl);
for (TieLine tl : n.getTieLines()) {
// The danglingLine1 and danglingLine1.boundary.dl must be the same object
// Both should correspond to objects at my level of merging
assertEquals(tl.getDanglingLine1(), tl.getDanglingLine1().getBoundary().getDanglingLine());
assertEquals(tl.getDanglingLine2(), tl.getDanglingLine2().getBoundary().getDanglingLine());
}
// No dangling lines should be seen in the merging view
// Even if dangling line adapters have been added to the cached identifiables in the merging index
assertEquals(10, n.getDanglingLineCount());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.powsybl.commons.PowsyblException;
import com.powsybl.commons.config.InMemoryPlatformConfig;
import com.powsybl.commons.datasource.ReadOnlyDataSource;
import com.powsybl.iidm.mergingview.MergingView;
import com.powsybl.iidm.network.*;
import com.powsybl.iidm.network.extensions.GeneratorEntsoeCategory;
import com.powsybl.iidm.network.extensions.LoadDetail;
Expand Down Expand Up @@ -510,65 +509,6 @@ void microBEReactivePowerGen() {
assertSame(network.getTwoWindingsTransformer("a708c3bc-465d-4fe7-b6ef-6fa6408a62b0").getTerminal2(), ext.getRegulatingTerminal());
}

@Test
void microSwitchAtBoundaryCompareMerges() {
final String tieLineId = "78736387-5f60-4832-b3fe-d50daf81b0a6 + 7f43f508-2496-4b64-9146-0a40406cbe49";
ReadOnlyDataSource assembled = CgmesConformity1ModifiedCatalog.microGridBaseCaseAssembledSwitchAtBoundary().dataSource();
ReadOnlyDataSource ds1 = CgmesConformity1ModifiedCatalog.microGridBESwitchAtBoundary().dataSource();
ReadOnlyDataSource ds2 = CgmesConformity1Catalog.microGridBaseCaseNL().dataSource();
compareMerges(tieLineId, assembled, ds1, ds2);
}

@Test
void microTransformerAtBoundaryCompareMerges() {
final String tieLineId = "78736387-5f60-4832-b3fe-d50daf81b0a6 + 7f43f508-2496-4b64-9146-0a40406cbe49";
ReadOnlyDataSource assembled = CgmesConformity1ModifiedCatalog.microGridBaseCaseAssembledTransformerAtBoundary().dataSource();
ReadOnlyDataSource ds1 = CgmesConformity1ModifiedCatalog.microGridBETransformerAtBoundary().dataSource();
ReadOnlyDataSource ds2 = CgmesConformity1Catalog.microGridBaseCaseNL().dataSource();
compareMerges(tieLineId, assembled, ds1, ds2);
}

@Test
void microEquivalentBranchAtBoundaryCompareMerges() {
final String tieLineId = "78736387-5f60-4832-b3fe-d50daf81b0a6 + 7f43f508-2496-4b64-9146-0a40406cbe49";
ReadOnlyDataSource assembled = CgmesConformity1ModifiedCatalog.microGridBaseCaseAssembledEquivalentBranchAtBoundary().dataSource();
ReadOnlyDataSource ds1 = CgmesConformity1ModifiedCatalog.microGridBEEquivalentBranchAtBoundary().dataSource();
ReadOnlyDataSource ds2 = CgmesConformity1Catalog.microGridBaseCaseNL().dataSource();
compareMerges(tieLineId, assembled, ds1, ds2);
}

private static void compareMerges(String tieLineId, ReadOnlyDataSource dsAssembled, ReadOnlyDataSource ds1, ReadOnlyDataSource ds2) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tie lines in the merging view and in the destructive merge are now equivalent. These tests can be deleted.

Network networkAssembled = Network.read(dsAssembled);
TieLine lineAssembled = networkAssembled.getTieLine(tieLineId);

Network n1 = Network.read(ds1);
Network n2 = Network.read(ds2);
Network networkMergingView = MergingView.create("1+2", "CGMES");
networkMergingView.merge(n1, n2);
TieLine lineMergingView = networkMergingView.getTieLine(tieLineId);

Network networkMerged = Network.read(ds1);
Network n2bis = Network.read(ds2);
networkMerged.merge(n2bis);
TieLine lineMerged = networkMergingView.getTieLine(tieLineId);

final double tolerance = 1e-10;

assertEquals(lineMergingView.getR(), lineMerged.getR(), tolerance);
assertEquals(lineMergingView.getX(), lineMerged.getX(), tolerance);
assertEquals(lineMergingView.getG1(), lineMerged.getG1(), tolerance);
assertEquals(lineMergingView.getG2(), lineMerged.getG2(), tolerance);
assertEquals(lineMergingView.getB1(), lineMerged.getB1(), tolerance);
assertEquals(lineMergingView.getB2(), lineMerged.getB2(), tolerance);

assertEquals(lineMergingView.getR(), lineAssembled.getR(), tolerance);
assertEquals(lineMergingView.getX(), lineAssembled.getX(), tolerance);
assertEquals(lineMergingView.getG1(), lineAssembled.getG1(), tolerance);
assertEquals(lineMergingView.getG2(), lineAssembled.getG2(), tolerance);
assertEquals(lineMergingView.getB1(), lineAssembled.getB1(), tolerance);
assertEquals(lineMergingView.getB2(), lineAssembled.getB2(), tolerance);
}

@Test
void microAssembledSwitchAtBoundary() {
final double tolerance = 1e-10;
Expand Down
6 changes: 0 additions & 6 deletions distribution-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,6 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>powsybl-iidm-mergingview</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>powsybl-iidm-reducer</artifactId>
Expand Down
113 changes: 0 additions & 113 deletions iidm/iidm-mergingview/pom.xml

This file was deleted.

This file was deleted.

This file was deleted.

Loading