Skip to content

Commit

Permalink
Fix: fictitious DC topological nodes are created when a DC converter …
Browse files Browse the repository at this point in the history
…station is disconnected

Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>
  • Loading branch information
miovd committed Mar 30, 2022
1 parent f5f4736 commit ef55d18
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ private static void addIidmMappingsTerminal(Terminal t, Connectable<?> c) {
boundaryId = CgmesExportUtil.getUniqueId();
c.addAlias(boundaryId, Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + TERMINAL_BOUNDARY);
}
} else if (c instanceof Load && ((Load) c).isFictitious()) {
} else if (c instanceof Load && c.isFictitious()) {
// An fictitious load do not need an alias
} else {
int sequenceNumber = CgmesExportUtil.getTerminalSide(t, c);
Expand Down Expand Up @@ -602,6 +602,11 @@ public Set<CgmesIidmMapping.CgmesTopologicalNode> getTopologicalNodesByBusViewBu
return topologicalNodeByBusViewBusMapping.get(busId);
}

public CgmesExportContext putTopologicalNode(String iidmBusId, String cgmesId) {
topologicalNodeByBusViewBusMapping.computeIfAbsent(iidmBusId, k -> new HashSet<>()).add(new CgmesIidmMapping.CgmesTopologicalNode(cgmesId, cgmesId, Source.IGM));
return this;
}

public Set<CgmesIidmMapping.CgmesTopologicalNode> getUnmappedTopologicalNodes() {
return Collections.unmodifiableSet(unmappedTopologicalNodes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,13 @@ private static void writeHvdcTerminals(Network network, String cimNamespace, XML
}

private static void writeHvdcBusTerminals(HvdcLine line, Bus bus, int side, String cimNamespace, XMLStreamWriter writer, CgmesExportContext context) throws XMLStreamException {
for (CgmesIidmMapping.CgmesTopologicalNode topologicalNode : context.getTopologicalNodesByBusViewBus(bus.getId())) {
String iidmId;
if (bus == null) {
iidmId = line.getId() + side;
} else {
iidmId = bus.getId();
}
for (CgmesIidmMapping.CgmesTopologicalNode topologicalNode : context.getTopologicalNodesByBusViewBus(iidmId)) {
String dcTopologicalNode = topologicalNode.getCgmesId() + "DC";
String dcNode = line.getAliasFromType(Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + "DCNode" + side).orElseThrow(PowsyblException::new);
writeDCNode(dcNode, dcTopologicalNode, cimNamespace, writer);
Expand Down Expand Up @@ -223,14 +229,23 @@ private static void writeHvdcTopologicalNodes(Network network, String cimNamespa
for (CgmesIidmMapping.CgmesTopologicalNode topologicalNode : context.getTopologicalNodesByBusViewBus(b1.getId())) {
writeDCTopologicalNode(topologicalNode.getCgmesId() + "DC", line.getNameOrId() + 1, cimNamespace, writer);
}
} else {
String topologicalNode = CgmesExportUtil.getUniqueId();
context.putTopologicalNode(line.getId() + 1, topologicalNode);
writeDCTopologicalNode(topologicalNode + "DC", line.getNameOrId() + 1, cimNamespace, writer);
}

Bus b2 = line.getConverterStation2().getTerminal().getBusView().getBus();
if (b2 != null) {
for (CgmesIidmMapping.CgmesTopologicalNode topologicalNode : context.getTopologicalNodesByBusViewBus(b2.getId())) {
writeDCTopologicalNode(topologicalNode.getCgmesId() + "DC", line.getNameOrId() + 2, cimNamespace, writer);
}
} else {
String topologicalNode = CgmesExportUtil.getUniqueId();
context.putTopologicalNode(line.getId() + 2, topologicalNode);
writeDCTopologicalNode(topologicalNode + "DC", line.getNameOrId() + 2, cimNamespace, writer);
}

}
}

Expand Down

0 comments on commit ef55d18

Please sign in to comment.