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

corrects Move connectable implementation in order to execute tcks on the network store server #447

Merged
merged 6 commits into from
Sep 17, 2024
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 @@ -146,9 +146,13 @@ public void moveConnectable(String busId, boolean connected) {
throw new PowsyblException("Trying to move connectable " + attributes.getResource().getId()
+ " to bus " + busId + " of voltage level " + bus.getVoltageLevel().getId() + ", which is a node breaker voltage level");
}
attributes.setConnectableBus(busId);
attributes.setBus(connected ? busId : null);
attributes.setVoltageLevelId(voltageLevel.getId());
getAbstractIdentifiable().updateResource(res -> {
InjectionAttributes attr = attributesGetter.apply(res);
attr.setConnectableBus(busId);
attr.setBus(connected ? busId : null);
attr.setNode(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you explain the reason to set null value for node in this case ?

Copy link
Contributor Author

@Mathieu-Deharbe Mathieu-Deharbe Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because an equipment may be connected by Node (in node breaker view) of by bus (in bus breaker view). When you affect one of those values the other makes no sense anymore (and this may cause problems of you reaffect to the previous value, like in the unit tests).

However this brings a good question : may an equipment be connected to a bus and a node simultaneously in the same voltage level ? In the unit test the bus breaker view and the node breaker view were in different voltage levels so the previous value had to be nulled.

I don't really know the answer, what do you say @geofjamg ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Geoffroy told me that a voltage level can only be in node breaker OR bus breaker. Therefore it is impossible to be connected at the same to a node and to a bus in the same voltage level. And therefore setting the other to null should be fine.

attr.setVoltageLevelId(voltageLevel.getId());
});
voltageLevel.invalidateCalculatedBuses();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ public void moveConnectable(int node, String voltageLevelId) {
throw new ValidationException(attributes.getResource(), "an equipment (" + terminal.getConnectable().getId()
+ ") is already connected to node " + node + " of voltage level " + voltageLevelId);
}
attributes.setNode(node);
attributes.setVoltageLevelId(voltageLevelId);
getAbstractIdentifiable().updateResource(res -> {
InjectionAttributes attr = attributesGetter.apply(res);
attr.setConnectableBus(null);
attr.setBus(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same remarks for Bus and connectableBus

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and same answer as well.

attr.setNode(node);
attr.setVoltageLevelId(voltageLevelId);
});
voltageLevel.invalidateCalculatedBuses();
}
}
Loading