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

Improve error message for lines between 2 Xnodes #2682

Merged
merged 3 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -281,7 +281,7 @@ private static void createGenerator(UcteNode ucteNode, VoltageLevel voltageLevel
private static void createDanglingLine(UcteLine ucteLine, boolean connected,
UcteNode xnode, UcteNodeCode nodeCode, UcteVoltageLevel ucteVoltageLevel,
Network network) {
LOGGER.trace("Create dangling line '{}' (Xnode='{}')", ucteLine.getId(), xnode.getCode());
LOGGER.trace("Create dangling line '{}' (X-node='{}')", ucteLine.getId(), xnode.getCode());

double p0 = isValueValid(xnode.getActiveLoad()) ? xnode.getActiveLoad() : 0;
double q0 = isValueValid(xnode.getReactiveLoad()) ? xnode.getReactiveLoad() : 0;
Expand Down Expand Up @@ -457,7 +457,7 @@ private static void createLine(UcteNetworkExt ucteNetwork, Network network,
createDanglingLine(ucteLine, connected, xnode, nodeCode1, ucteVoltageLevel1, network);

} else {
throw new UcteException("Line between 2 Xnodes");
throw new UcteException("Line between 2 X-nodes: '" + nodeCode1 + "' and '" + nodeCode2 + "'");
}
}
}
Expand Down Expand Up @@ -664,7 +664,7 @@ private static TwoWindingsTransformer createXnodeTransfo(UcteNetworkExt ucteNetw

UcteNode ucteXnode = ucteNetwork.getNode(xNodeCode);

LOGGER.warn("Create small impedance dangling line '{}{}' (transformer connected to XNODE '{}')",
LOGGER.warn("Create small impedance dangling line '{}{}' (transformer connected to X-node '{}')",
xNodeName, yNodeName, ucteXnode.getCode());

double p0 = isValueValid(ucteXnode.getActiveLoad()) ? ucteXnode.getActiveLoad() : 0;
Expand Down Expand Up @@ -853,7 +853,7 @@ private static DanglingLine getMatchingDanglingLine(DanglingLine dl1, Map<String
if (connectedMatchingDanglingLines.size() == 1) {
return connectedMatchingDanglingLines.get(0);
} else {
throw new UcteException("More that 2 connected dangling lines have the same XNODE " + dl1.getUcteXnodeCode());
throw new UcteException("More that 2 connected dangling lines have the same X-node " + dl1.getUcteXnodeCode());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
package com.powsybl.ucte.converter;

import com.powsybl.commons.PowsyblException;
import com.powsybl.commons.datasource.ReadOnlyDataSource;
import com.powsybl.commons.datasource.ResourceDataSource;
import com.powsybl.commons.datasource.ResourceSet;
Expand Down Expand Up @@ -274,5 +275,13 @@ void combineRtcAndPtc() {
assertEquals(1.92419, network2.getTwoWindingsTransformer("BBE2AA1 BBE3AA1 1").getPhaseTapChanger().getCurrentStep().getAlpha(), 0.001);
assertEquals(1.00000694, network2.getTwoWindingsTransformer("BBE2AA1 BBE3AA1 1").getPhaseTapChanger().getCurrentStep().getRho(), 0.0000001); // FIXME, symmetrical no impact
}

@Test
void lineBetweenTwoXnodesTest() {
ReadOnlyDataSource dataSource = new ResourceDataSource("lineBetweenTwoXnodes", new ResourceSet("/", "lineBetweenTwoXnodes.uct"));
NetworkFactory networkFactory = NetworkFactory.findDefault();
PowsyblException e = assertThrows(PowsyblException.class, () -> new UcteImporter().importData(dataSource, networkFactory, null));
assertEquals("Line between 2 X-nodes: 'XXNODE11' and 'XXNODE12'", e.getMessage());
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##C 2007.05.01
Test case for a line between 2 xnodes error
##N
##ZXX
XXNODE11 1 0 0 0 0 0 0 0 0 0 0 0 0 0
XXNODE12 1 0 0 0 0 0 0 0 0 0 0 0 0 0
##L
XXNODE11 XXNODE12 1 0 2 10 65 200 INTERCO FR