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

Bump core 610 #569

Merged
merged 23 commits into from
Dec 12, 2023
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7ebafd1
Bump to powsybl-core 6.1.0
So-Fras Dec 8, 2023
bb03539
Remove joda-time library
So-Fras Dec 8, 2023
3414284
Change artifact name from xml-converter to serde
So-Fras Dec 8, 2023
ee439a6
BranchStatus renamed OperatingStatus
So-Fras Dec 8, 2023
a350995
TwoSides and ThreeSides used instead of Branch.Side and ThreeWindings…
So-Fras Dec 8, 2023
8bf0101
Remove remaining ThreeWindingsTransformer.Side
So-Fras Dec 8, 2023
a3f29bf
Deal with change of package name xml -> serde
So-Fras Dec 8, 2023
e03e8ea
Replace readUntilEndElement function (that does not exist anymore) by…
So-Fras Dec 8, 2023
06e9f42
Merge branch 'main' into bump_core_610
So-Fras Dec 8, 2023
3ea6d38
Update reading metadata following XmlUtil changes
flo-dup Dec 8, 2023
7c9ef63
Fix unit test
flo-dup Dec 8, 2023
2ce5227
Rename methods to clarify use
flo-dup Dec 8, 2023
35551ec
Fix comparing to have the diff in the logs
flo-dup Dec 8, 2023
67a07d9
Fix checkstyle
flo-dup Dec 8, 2023
c5a8420
Following review comments: use ThreeSides functions to refactor code
So-Fras Dec 11, 2023
93ffc71
Merge branch 'main' into bump_core_610
So-Fras Dec 11, 2023
a01ff58
Fix code smell regarding lambda / method reference
So-Fras Dec 11, 2023
44c1aa7
Merge branch 'bump_core_610' of https://github.com/powsybl/powsybl-di…
So-Fras Dec 11, 2023
f61f827
Merge branch 'main' into bump_core_610
So-Fras Dec 11, 2023
c178ded
Revert "Fix comparing to have the diff in the logs"
flo-dup Dec 11, 2023
53bdc32
Revert "Fix checkstyle"
flo-dup Dec 11, 2023
aa7a2cb
Improve getNextSideNum(...) function
So-Fras Dec 11, 2023
8ccd7f9
Merge branch 'main' into bump_core_610
So-Fras Dec 12, 2023
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 @@ -13,6 +13,7 @@
import com.powsybl.nad.model.*;
import com.powsybl.nad.utils.iidm.IidmUtils;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -99,14 +100,10 @@ private void visitThreeWindingsTransformer(VoltageLevel vl, ThreeWindingsTransfo
ThreeWtNode tn = new ThreeWtNode(idProvider.createId(thwt), thwt.getId(), thwt.getNameOrId());
graph.addNode(tn);

ThreeSides side;
if (thwt.getLeg1().getTerminal().getVoltageLevel() == vl) {
side = ThreeSides.ONE;
} else if (thwt.getLeg2().getTerminal().getVoltageLevel() == vl) {
side = ThreeSides.TWO;
} else {
side = ThreeSides.THREE;
}
ThreeSides side = Arrays.stream(ThreeSides.values())
.filter(streamedSide -> thwt.getLeg(streamedSide).getTerminal().getVoltageLevel() == vl)
.findFirst()
.orElseThrow(() -> new IllegalStateException());

for (ThreeSides s : getSidesArray(side)) {
addThreeWtEdge(graph, thwt, tn, s);
Expand Down Expand Up @@ -204,18 +201,10 @@ private VoltageLevelNode getVoltageLevelNode(Graph graph, Terminal terminal) {
}

private ThreeSides[] getSidesArray(ThreeSides sideA) {
ThreeSides sideB;
ThreeSides sideC;
if (sideA == ThreeSides.ONE) {
sideB = ThreeSides.TWO;
sideC = ThreeSides.THREE;
} else if (sideA == ThreeSides.TWO) {
sideB = ThreeSides.ONE;
sideC = ThreeSides.THREE;
} else {
sideB = ThreeSides.ONE;
sideC = ThreeSides.TWO;
}
return new ThreeSides[] {sideA, sideB, sideC};
return new ThreeSides[] {sideA, ThreeSides.valueOf(getNextSideNum(sideA.getNum(), 1)), ThreeSides.valueOf(getNextSideNum(sideA.getNum(), 2))};
}

private int getNextSideNum(int sideNum, int steps) {
return (sideNum + steps) % 3 == 0 ? 3 : (sideNum + steps) % 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

could be simplified by return (sideNum + steps + 2) % 3 + 1; but not sure if this is understandable...?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is shrewd! And I think it is understandable (one can simply check the formula with examples if needed).

}
}