-
Notifications
You must be signed in to change notification settings - Fork 6
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
Synchronization between views for v and angle bus values. #452
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Franck LECUYER <[email protected]>
Resolve Sonar issue ? |
} | ||
|
||
private void updateConfiguredBuses(double newValue, | ||
CalculatedBusAttributes calculatedBusAttributesBus, |
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.
CalculatedBusAttributes calculatedBusAttributesBus, | |
CalculatedBusAttributes calculatedBusAttributes, |
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.
Done
if (CollectionUtils.isNotEmpty(calculatedBusAttributesList)) { | ||
List<Integer> calculatedBusesNum = getAllTerminals().stream() | ||
.filter(Terminal::isConnected) | ||
.map(t -> ((CalculatedBus) t.getBusView().getBus()).getCalculatedBusNum()).distinct().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.
all terminals in one configured bus always map to the same busviewbus no ?
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.
You're right.
We consider now only the first bus in bus view ...
.map(Vertex::getBus) | ||
.toList(); | ||
|
||
List<Bus> buses = index.getConfiguredBuses().stream() |
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.
all configured bus of the network ?
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.
You're right.
We use now only the buses in voltage level bus breaker view ...
l1.getTerminal1().getBusView().getBus().setV(222); | ||
|
||
// Verify the voltage update in BusBreakerView | ||
assertEquals("Voltage should match in BusView after update in BusBreakerView", 222, l1.getTerminal1().getBusBreakerView().getBus().getV(), 0.0); |
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.
assertEquals("Voltage should match in BusView after update in BusBreakerView", 222, l1.getTerminal1().getBusBreakerView().getBus().getV(), 0.0); | |
assertEquals("Voltage should match in BusBreakerView after update in BusView", 222, l1.getTerminal1().getBusBreakerView().getBus().getV(), 0.0); |
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.
Done
Add new test with multiple buses in bus view and bus breaker view in a voltage level Signed-off-by: Franck LECUYER <[email protected]>
Signed-off-by: Franck LECUYER <[email protected]>
Quality Gate passedIssues Measures |
Removed |
List<ConnectedSetResult<T>> connectedSetList = findConnectedSetList(index, voltageLevelResource, isBusView); | ||
AtomicDouble v = new AtomicDouble(Double.NaN); | ||
AtomicDouble angle = new AtomicDouble(Double.NaN); |
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.
v set in all remaining buses
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.
Ah I see this bug made the AbstractMainConnectedComponentWithSwitchTest work because there is a bus without any vertex which would be unset, but since it's setting v in all remaining buses it sets it anyway.
This is all to do with the fact that we can not use the equipment Vertex (=non switch equipment) to match buses, we need to use the topology vertex (nodes/configuredbus)
String attributeName, | ||
ToDoubleFunction<Bus> getValue, | ||
ObjDoubleConsumer<ConfiguredBusAttributes> setValue) { | ||
List<String> busesIds = calculatedBusAttributes.getVertices().stream() |
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.
doesn't contain configuredbus without any vertex (equipment)
List<String> busesIds = calculatedBusAttributes.getVertices().stream() | ||
.map(Vertex::getBus) | ||
.toList(); | ||
|
||
List<Bus> buses = getVoltageLevel().getBusBreakerView().getBusStream() | ||
.filter(bus -> busesIds.contains(bus.getId()) && !Objects.equals(getValue.applyAsDouble(bus), newValue)) | ||
.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.
List<String> busesIds = calculatedBusAttributes.getVertices().stream() | |
.map(Vertex::getBus) | |
.toList(); | |
List<Bus> buses = getVoltageLevel().getBusBreakerView().getBusStream() | |
.filter(bus -> busesIds.contains(bus.getId()) && !Objects.equals(getValue.applyAsDouble(bus), newValue)) | |
.toList(); | |
List<Bus> buses = ((VoltageLevelImpl) getVoltageLevel()).getResource().getAttributes() | |
.getBusToCalculatedBusForBusView().entrySet().stream() | |
.filter(entry -> getCalculatedBusNum() == entry.getValue()) | |
.map(Map.Entry::getKey) | |
.map(getVoltageLevel().getBusBreakerView()::getBus) | |
.toList(); | |
something like that ?
Signed-off-by: HARPER Jon <[email protected]>
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
Currently, when updating the V and angle value in Bus for different topologies (NodeBreaker or BusBreaker), the synchronization between CalculatedBus and ConfiguredBus is not consistently handled across views, leading to potential inconsistencies in voltage values.
What is the new behavior (if this is a feature change)?
When setV is called on getBus() from getBusBreakerView() in a NodeBreaker topology (which by default updates calculatedBusForBusBreakerView), calculatedBusForBusView should also be updated if it is not null.
When setV is called on getBus() from getBusView() in a NodeBreaker topology (which by default updates calculatedBusForBusView), calculatedBusesForBusBreakerView should also be updated if it is not null.
When setV is called on getBus() from getBusView() in a BusBreaker topology (which by default updates calculatedBusForBusView), configuredBus should also be updated.
When setV is called on getBus() from getBusBreakerView() in a BusBreaker topology (which by default updates configuredBus), calculatedBusForBusView should also be updated if it is not null.
And when calculating a new view, the v and theta values should be taken from the other source (NodeBreaker: busview/busbreakerview; BusBreaker: busview/configuredbus).
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: