Fix non-idempotent voltage level layout run - #830
Conversation
Signed-off-by: Samir Romdhani <samir.romdhani_externe@rte-france.com>
4d6286d to
d215f13
Compare
Signed-off-by: Samir Romdhani <samir.romdhani_externe@rte-france.com>
2b4a5ba to
3bc6770
Compare
Signed-off-by: Samir Romdhani <samir.romdhani_externe@rte-france.com>
NathanDissoubray
left a comment
There was a problem hiding this comment.
Have you checked that there isn't the same kind of bug for ZoneGraph and for SubstationGraph ?
Signed-off-by: Samir Romdhani <samir.romdhani_externe@rte-france.com>
Yes, both use |
Signed-off-by: Samir Romdhani <samir.romdhani_externe@rte-france.com>
Signed-off-by: Samir Romdhani <samir.romdhani_externe@rte-france.com>
So-Fras
left a comment
There was a problem hiding this comment.
Thanks for the work! I left first comments to discuss.
| LayoutParameters.Padding dPadding = layoutParam.getDiagramPadding(); | ||
| setCoord(coord.getX() + dPadding.left() + vlPadding.left(), | ||
| coord.getY() + dPadding.top() + vlPadding.top()); | ||
| setCoord(getCoord().getX() + dPadding.left() + vlPadding.left(), |
There was a problem hiding this comment.
I don't see the link with the 2nd root cause mentioned in the PR description.
There was a problem hiding this comment.
Here, I just preferred using the getter, the two root causes are added in the same method clearCells
public void clearCells() {
cells.clear(); // first root cause
cellCounter = 0; // first root cause
setCoord(0, 0); // second root cause
}There was a problem hiding this comment.
The root causes:
cells was not initialized when the layout was run twice => fixed by cells.clear()
graph.getNextCellNumber() was not initialized when the layout was run twice => fixed by cellCounter = 0
Coord was not initialized when the layout was run twice => fixed by setCoord(0, 0)
| substation = Networks.createSubstation(network, "s", "s", Country.FR); | ||
| vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); | ||
| Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); | ||
| Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); |
There was a problem hiding this comment.
| Networks.createLoad(vl, "l", "l", "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); | |
| Networks.createLoad(vl, "l", 0, ConnectablePosition.Direction.TOP, 2, 10, 10); |
| graphBuilder = new NetworkGraphBuilder(network); | ||
| substation = Networks.createSubstation(network, "s", "s", Country.FR); | ||
| vl = Networks.createVoltageLevel(substation, "vl", "vl", TopologyKind.NODE_BREAKER, 380); | ||
| Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); |
There was a problem hiding this comment.
| Networks.createBusBarSection(vl, "bbs", "bbs", 0, 1, 1); | |
| Networks.createBusBarSection(vl, "bbs", 0, 1, 1); |
|



Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
Fixes #289
What kind of change does this PR introduce?
What is the current behavior?
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change or deprecate an API?
If yes, please check if the following requirements are fulfilled
What changes might users need to make in their application due to this PR? (migration steps)
Other information:
Root cause
cellDetector.detectCells(getGraph());always creates new cells via graph.addCell()addPaddingToCoord()add vl padding to graph.coord on every run (coord is not reset)