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

get number of voltage levels in nad diagram #486

Merged
merged 10 commits into from
Jan 31, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public VoltageLevelFilter(Set<VoltageLevel> voltageLevels) {
this.voltageLevels = voltageLevels;
}

public int getNbVoltageLevels() {
return voltageLevels.size();
}

private Set<VoltageLevel> getVoltageLevels() {
return voltageLevels;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ public void testDiamond() {
checkLayoutWithInitialPositions(LayoutNetworkFactory.createDiamond());
}

@Test
public void testNbVoltageLevels() {
Network network = LayoutNetworkFactory.createDiamond();

assertEquals(1, VoltageLevelFilter.createVoltageLevelDepthFilter(network, "A 400", 0).getNbVoltageLevels());
assertEquals(4, VoltageLevelFilter.createVoltageLevelDepthFilter(network, "A 400", 3).getNbVoltageLevels());
assertEquals(7, VoltageLevelFilter.createVoltageLevelDepthFilter(network, "A 400", 5).getNbVoltageLevels());
assertEquals(1, VoltageLevelFilter.createVoltageLevelDepthFilter(network, "A 400", 0).getNbVoltageLevels());
}

private void checkLayoutWithInitialPositions(Network network) {
Predicate<VoltageLevel> filter = vl -> vl.getNominalV() >= 100;

Expand Down