-
Notifications
You must be signed in to change notification settings - Fork 13
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
Consecutive shunts #361
Consecutive shunts #361
Conversation
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
ae99f09
to
4429f09
Compare
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
86e784e
to
43c0fe2
Compare
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK for me
graph.conditionalExtensionOfNodeConnectedToBus(node -> | ||
node.getType() == Node.NodeType.SWITCH && ((SwitchNode) node).getKind() != SwitchNode.SwitchKind.DISCONNECTOR | ||
|| node instanceof Middle2WTNode || node instanceof Middle3WTNode | ||
); | ||
graph.extendFirstOutsideNode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is required for some weird networks to have this fix... is this deleted line feature covered elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else { | ||
minHv = hPosition; | ||
} | ||
int minHv = shuntCells.stream().filter(shuntCell -> shuntCell.getSideCell(RIGHT) == this).findFirst() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why findFirst() only? Shouldn't we take the max considering all the shuntCells?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes you're right!
**/ | ||
private void detectAndTypeShunt(VoltageLevelGraph graph, Cell cell) { | ||
private void detectAndTypeShunt(VoltageLevelGraph graph, ExternCell cell) { | ||
|
||
List<Node> externalNodes = graph.getNodes() | ||
.stream() | ||
.filter(node -> !cell.getNodes().contains(node)) | ||
.collect(Collectors.toList()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(on the old code!) )wouldn't it be more efficient to do:
List externalNodes = new ArrayList<>(graph.getNodes());
externalNodes.removeAll(cell.getNodes());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, contains
and remove
are quite bad when it comes to (large) list, but let's see! if we call M the number of nodes in the cell and N the number of nodes in the graph:
contains
checks all the elements in the list until the element is found so O(M), but here it is done N times, hence O(MN)removeAll
does a M loop ofremove
, each looking in the array of size N for the element until it is found, so O(MN) so far, hence equivalent to previous one, but removing the element copies the array starting from found index, so O(MN) again. At the end it's still O(MN), but it's probably worse because of copying M-times array of size N.
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Kudos, SonarCloud Quality Gate passed! |
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem ?
No
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
When a so called shunt node is detected in
ImpliciCellDetector::detectAndTypeShunt
, 3 cells are created:If there are several consecutive shunt cells in the diagram, this detection leads to an unhandled pattern in
CellBlockDecomposer
.What is the new behavior (if this is a feature change)?
When a so called shunt node is detected in
ImpliciCellDetector::detectAndTypeShunt
, several cells are created:Does this PR introduce a breaking change or deprecate an API?
No