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

Clean CGMES export with subnetworks #2711

Merged
merged 2 commits into from
Sep 21, 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
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,6 @@ public static List<DanglingLine> getBoundaryDanglingLines(Network network) {
.collect(Collectors.toList());
}

public static boolean isBoundary(Network network, DanglingLine danglingLine) {
return network.getBoundaryElements().stream().map(Identifiable::getId).toList().contains(danglingLine.getId());
}

public static boolean isEquivalentShuntWithZeroSectionCount(Connectable<?> c) {
if (c instanceof ShuntCompensator shuntCompensator) {
return "true".equals(c.getProperty(Conversion.PROPERTY_IS_EQUIVALENT_SHUNT))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ private static void writeControlArea(CgmesControlArea cgmesControlArea, String e
for (Terminal terminal : cgmesControlArea.getTerminals()) {
Connectable<?> c = terminal.getConnectable();
if (c instanceof DanglingLine dl) {
if (CgmesExportUtil.isBoundary(network, dl)) {
if (network.isBoundaryElement(dl)) {
TieFlowEq.write(CgmesExportUtil.getUniqueId(), controlAreaCgmesId,
context.getNamingStrategy().getCgmesIdFromAlias(dl, Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + TERMINAL_BOUNDARY),
cimNamespace, writer, context);
Expand All @@ -1146,7 +1146,7 @@ private static void writeControlArea(CgmesControlArea cgmesControlArea, String e

private static String getTieFlowBoundaryTerminal(Boundary boundary, CgmesExportContext context, Network network) {
DanglingLine dl = boundary.getDanglingLine();
if (CgmesExportUtil.isBoundary(network, dl)) {
if (network.isBoundaryElement(dl)) {
return context.getNamingStrategy().getCgmesIdFromAlias(dl, Conversion.CGMES_PREFIX_ALIAS_PROPERTIES + TERMINAL_BOUNDARY);
} else {
// This means the boundary corresponds to a TieLine.
Expand Down Expand Up @@ -1203,7 +1203,7 @@ private static void writeTerminal(Terminal t, Map<Terminal, String> mapTerminal2
// When we change the export and write the two dangling lines as separate equipment,
// then we should always return 1 and forget about this special case
Connectable<?> c = t.getConnectable();
if (c instanceof DanglingLine dl && !CgmesExportUtil.isBoundary(network, dl)) {
if (c instanceof DanglingLine dl && !network.isBoundaryElement(dl)) {
equipmentId = context.getNamingStrategy().getCgmesId(dl.getTieLine().orElseThrow(IllegalStateException::new));
}
writeTerminal(t, mapTerminal2Id, CgmesExportUtil.getTerminalId(t, context), equipmentId, connectivityNodeId(mapNodeKey2NodeId, t),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ private static void writeStatus(Network network, String cimNamespace, XMLStreamW

private static void writeConnectableStatus(Connectable<?> connectable, String cimNamespace, XMLStreamWriter writer,
CgmesExportContext context, Network network) {
if (connectable instanceof DanglingLine dl && !CgmesExportUtil.isBoundary(network, dl)) {
if (connectable instanceof DanglingLine dl && !network.isBoundaryElement(dl)) {
// TODO(Luma) Export tie line components instead of a single equipment
// If this dangling line is part of a tie line we will be exporting the tie line as a single equipment
// We ignore dangling lines inside tie lines for now
Expand Down
Loading