Skip to content

[WIP] Deprecate creation of new LoadingLimits from Branch and FlowsLimitsHo… #3340

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -158,19 +158,18 @@ void testExpressionEvaluator() throws IOException {
void testIsOverloadedNode() throws IOException {
line1.getTerminal1().setP(100.0).setQ(50.0);
evalAndAssert(false, "isOverloaded(['NHV1_NHV2_1','NHV1_NHV2_2'])");

line1.newCurrentLimits1().setPermanentLimit(0.00001).add();
line1.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits().setPermanentLimit(0.00001).add();
assertTrue(line1.getCurrentLimits1().isPresent());
evalAndAssert(true, "isOverloaded(['NHV1_NHV2_1','NHV1_NHV2_2'])");

line1.getTerminal1().setP(600.0).setQ(300.0); // i = 1019.2061
double current = line1.getTerminal1().getI();
line1.newCurrentLimits1().setPermanentLimit(current - 100).add();
line1.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits().setPermanentLimit(current - 100).add();
evalAndAssert(true, "isOverloaded(['NHV1_NHV2_1','NHV1_NHV2_2'])");
evalAndAssert(true, "isOverloaded(['NHV1_NHV2_1','NHV1_NHV2_2'], 0.05)");
line1.newCurrentLimits1().setPermanentLimit(current).add();
line1.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits().setPermanentLimit(current).add();
evalAndAssert(true, "isOverloaded(['NHV1_NHV2_1','NHV1_NHV2_2'])"); // permanent = real current
line1.newCurrentLimits1().setPermanentLimit(current * 2).add();
line1.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits().setPermanentLimit(current * 2).add();
evalAndAssert(false, "isOverloaded(['NHV1_NHV2_1','NHV1_NHV2_2'], 0.9)");
evalAndAssert(true, "isOverloaded(['NHV1_NHV2_1','NHV1_NHV2_2'], 0.1)");

Expand All @@ -196,13 +195,13 @@ void testAllOverloadedNode() throws IOException {
// Only line1 is overloaded
line1.getTerminal1().setP(600.0f).setQ(300.0f); // i = 1019.2061
double current1 = line1.getTerminal1().getI();
line1.newCurrentLimits1().setPermanentLimit(current1 - 100).add();
line1.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits().setPermanentLimit(current1 - 100).add();
evalAndAssert(false, "allOverloaded(['NHV1_NHV2_1','NHV1_NHV2_2'])");

// Both lines are overloaded
line2.getTerminal1().setP(600.0f).setQ(300.0f); // i = 1019.2061
double current2 = line2.getTerminal1().getI();
line2.newCurrentLimits1().setPermanentLimit(current2 - 100).add();
line2.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits().setPermanentLimit(current2 - 100).add();
evalAndAssert(true, "allOverloaded(['NHV1_NHV2_1','NHV1_NHV2_2'])");

// Only line2 is overloaded
Expand All @@ -219,7 +218,7 @@ void testAllOverloadedNode() throws IOException {
}

private void addCurrentLimitsOnLine1() {
line1.newCurrentLimits1()
line1.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits()
.setPermanentLimit(400)
.beginTemporaryLimit()
.setName("20")
Expand All @@ -242,7 +241,7 @@ private void addCurrentLimitsOnLine1() {
@Test
void testNetworkAccess() throws IOException {
// add temporary limits
line1.newCurrentLimits1()
line1.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits()
.setPermanentLimit(400)
.beginTemporaryLimit()
.setName("20")
Expand All @@ -262,15 +261,15 @@ void testNetworkAccess() throws IOException {
@Test
void testLoadingRank() throws IOException {
// add temporary limits
line1.newCurrentLimits1()
line1.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits()
.setPermanentLimit(400)
.beginTemporaryLimit()
.setName("20")
.setAcceptableDuration(20 * 60)
.setValue(800)
.endTemporaryLimit()
.add();
line2.newCurrentLimits1()
line2.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits()
.setPermanentLimit(400)
.beginTemporaryLimit()
.setName("20")
Expand Down Expand Up @@ -307,15 +306,15 @@ void testLoadingRank() throws IOException {
@Test
void testLoadingRankWithDifferentAcceptableDuration() throws IOException {
// add temporary limits
line1.newCurrentLimits1()
line1.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits()
.setPermanentLimit(400)
.beginTemporaryLimit()
.setName("20")
.setAcceptableDuration(20 * 60)
.setValue(800)
.endTemporaryLimit()
.add();
line2.newCurrentLimits1()
line2.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits()
.setPermanentLimit(400)
.beginTemporaryLimit()
.setName("20")
Expand All @@ -339,7 +338,7 @@ void testLoadingRankWithDifferentAcceptableDuration() throws IOException {
@Test
void testLoadingRankWithUndefinedCurrentLimitsForLine2() throws IOException {
// add temporary limits
line1.newCurrentLimits1()
line1.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits()
.setPermanentLimit(400)
.beginTemporaryLimit()
.setName("20")
Expand All @@ -358,15 +357,15 @@ void testLoadingRankWithUndefinedCurrentLimitsForLine2() throws IOException {
@Test
void testLoadingRankWithCurrentLimitsAtBothSides() throws IOException {
// add temporary limits
line1.newCurrentLimits1()
line1.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits()
.setPermanentLimit(400)
.beginTemporaryLimit()
.setName("20")
.setAcceptableDuration(20 * 60)
.setValue(800)
.endTemporaryLimit()
.add();
line1.newCurrentLimits2()
line1.getOrCreateSelectedOperationalLimitsGroup2().newCurrentLimits()
.setPermanentLimit(400)
.beginTemporaryLimit()
.setName("20")
Expand All @@ -379,7 +378,7 @@ void testLoadingRankWithCurrentLimitsAtBothSides() throws IOException {
.setValue(800)
.endTemporaryLimit()
.add();
line2.newCurrentLimits1()
line2.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits()
.setPermanentLimit(400)
.beginTemporaryLimit()
.setName("20")
Expand Down Expand Up @@ -408,15 +407,15 @@ void testLoadingRankWithCurrentLimitsAtBothSides() throws IOException {
@Test
void testMostLoaded() throws IOException {
// add temporary limits
line1.newCurrentLimits1()
line1.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits()
.setPermanentLimit(400)
.beginTemporaryLimit()
.setName("20")
.setAcceptableDuration(20 * 60)
.setValue(800)
.endTemporaryLimit()
.add();
line2.newCurrentLimits1()
line2.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits()
.setPermanentLimit(400)
.beginTemporaryLimit()
.setName("20")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static Network create() {
Network network = EurostagTutorialExample1Factory.create();
// add a temporary limit
Line l2 = network.getLine("NHV1_NHV2_2");
l2.newCurrentLimits1()
l2.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits()
.setPermanentLimit(400)
.beginTemporaryLimit()
.setName("20")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void writeCurrentLimits() throws IOException {
void writeTieLine() throws IOException {
Network network = EurostagTutorialExample1Factory.createWithTieLine();
for (DanglingLine danglingLine : network.getDanglingLines()) {
danglingLine.newCurrentLimits()
danglingLine.getOrCreateSelectedOperationalLimitsGroup().newCurrentLimits()
.setPermanentLimit(100.0)
.beginTemporaryLimit().setName("20'").setValue(120.0).setAcceptableDuration(20 * 60).endTemporaryLimit()
.beginTemporaryLimit().setName("10'").setValue(140.0).setAcceptableDuration(10 * 60).endTemporaryLimit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void testDanglingLineExport() throws IOException {
void testTieLineExport() throws IOException {
Network network = EurostagTutorialExample1Factory.createWithTieLine();
for (DanglingLine danglingLine : network.getDanglingLines()) {
danglingLine.newCurrentLimits()
danglingLine.getOrCreateSelectedOperationalLimitsGroup().newCurrentLimits()
.setPermanentLimit(100.0)
.beginTemporaryLimit().setName("20'").setValue(120.0).setAcceptableDuration(20 * 60).endTemporaryLimit()
.beginTemporaryLimit().setName("10'").setValue(140.0).setAcceptableDuration(10 * 60).endTemporaryLimit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private static Network microBE(String modelId) {
.setB(2.1677e-5)
.setPairingKey("TN_Border_ST24")
.add();
be7.newCurrentLimits().setPermanentLimit(1180)
be7.getOrCreateSelectedOperationalLimitsGroup().newCurrentLimits().setPermanentLimit(1180)
.beginTemporaryLimit()
.setName(CL_0)
.setValue(1312.0)
Expand Down Expand Up @@ -223,7 +223,7 @@ private static Network microBE(String modelId) {
.setB(1.49854e-4)
.setPairingKey("TN_Border_AL11")
.add();
be3.newCurrentLimits().setPermanentLimit(1371)
be3.getOrCreateSelectedOperationalLimitsGroup().newCurrentLimits().setPermanentLimit(1371)
.beginTemporaryLimit()
.setName(CL_0)
.setValue(1443.0)
Expand All @@ -249,7 +249,7 @@ private static Network microBE(String modelId) {
.setB(6.59734E-5)
.setPairingKey("TN_Border_GY11")
.add();
be5.newCurrentLimits().setPermanentLimit(1804)
be5.getOrCreateSelectedOperationalLimitsGroup().newCurrentLimits().setPermanentLimit(1804)
.beginTemporaryLimit()
.setName(CL_0)
.setValue(1876.0)
Expand All @@ -275,7 +275,7 @@ private static Network microBE(String modelId) {
.setB(2.51956e-5)
.setPairingKey("TN_Border_MA11")
.add();
be4.newCurrentLimits().setPermanentLimit(1226)
be4.getOrCreateSelectedOperationalLimitsGroup().newCurrentLimits().setPermanentLimit(1226)
.beginTemporaryLimit()
.setName(CL_0)
.setValue(1299.0)
Expand Down Expand Up @@ -337,7 +337,7 @@ private static Network microBE(String modelId) {
.setBus2(busAnvers220.getId())
.setVoltageLevel2(vlAnvers220.getId())
.add();
lineBE2.newCurrentLimits1().setPermanentLimit(1443.0)
lineBE2.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits().setPermanentLimit(1443.0)
.beginTemporaryLimit()
.setName(CL_0)
.setValue(1574.0)
Expand All @@ -349,7 +349,7 @@ private static Network microBE(String modelId) {
.setAcceptableDuration(10)
.endTemporaryLimit()
.add();
lineBE2.newCurrentLimits2().setPermanentLimit(1443.0)
lineBE2.getOrCreateSelectedOperationalLimitsGroup2().newCurrentLimits().setPermanentLimit(1443.0)
.beginTemporaryLimit()
.setName(CL_0)
.setValue(1574.0)
Expand Down Expand Up @@ -386,7 +386,7 @@ private static Network microBE(String modelId) {
.setBus2(busAnvers220.getId())
.setVoltageLevel2(vlAnvers220.getId())
.add();
lineBE6.newCurrentLimits1().setPermanentLimit(1180.0)
lineBE6.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits().setPermanentLimit(1180.0)
.beginTemporaryLimit()
.setName(CL_0)
.setValue(1312.0)
Expand All @@ -398,7 +398,7 @@ private static Network microBE(String modelId) {
.setAcceptableDuration(10)
.endTemporaryLimit()
.add();
lineBE6.newCurrentLimits2().setPermanentLimit(1180.0)
lineBE6.getOrCreateSelectedOperationalLimitsGroup2().newCurrentLimits().setPermanentLimit(1180.0)
.beginTemporaryLimit()
.setName(CL_0)
.setValue(1312.0)
Expand Down Expand Up @@ -544,7 +544,7 @@ private static void addTransformerBrussels110Brussels10(Substation sBrussels,
.setRatedU1(u1)
.setRatedU2(u2)
.add();
tx.newCurrentLimits1().setPermanentLimit(1308.1)
tx.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits().setPermanentLimit(1308.1)
.beginTemporaryLimit()
.setName(CL_0)
.setValue(1408.1)
Expand All @@ -556,7 +556,7 @@ private static void addTransformerBrussels110Brussels10(Substation sBrussels,
.setAcceptableDuration(10)
.endTemporaryLimit()
.add();
tx.newCurrentLimits2().setPermanentLimit(13746.4)
tx.getOrCreateSelectedOperationalLimitsGroup2().newCurrentLimits().setPermanentLimit(13746.4)
.beginTemporaryLimit()
.setName(CL_0)
.setValue(14746.4)
Expand Down Expand Up @@ -621,7 +621,7 @@ private static void addTransformerBrussels225Brussels110(Substation sBrussels,
.setRatedU1(u1)
.setRatedU2(u2)
.add();
txBE22.newCurrentLimits2().setPermanentLimit(3411.6)
txBE22.getOrCreateSelectedOperationalLimitsGroup2().newCurrentLimits().setPermanentLimit(3411.6)
.beginTemporaryLimit()
.setName(CL_0)
.setValue(3611.6)
Expand Down Expand Up @@ -686,7 +686,7 @@ private static TwoWindingsTransformer addTransformerBrussels380Brussels110(Subst
.setRatedU1(u1)
.setRatedU2(u2)
.add();
txBE21.newCurrentLimits2().setPermanentLimit(3411.6)
txBE21.getOrCreateSelectedOperationalLimitsGroup2().newCurrentLimits().setPermanentLimit(3411.6)
.beginTemporaryLimit()
.setName(CL_0)
.setValue(3611.6)
Expand Down Expand Up @@ -770,7 +770,7 @@ private static void addTWTBrussels380Brussels225Brussels21(Substation sBrussels,
.setVoltageLevel(vlBrussels21.getId())
.add()
.add();
txBETR3.getLeg1().newCurrentLimits()
txBETR3.getLeg1().getOrCreateSelectedOperationalLimitsGroup().newCurrentLimits()
.setPermanentLimit(938.2)
.beginTemporaryLimit()
.setAcceptableDuration(20)
Expand All @@ -783,7 +783,7 @@ private static void addTWTBrussels380Brussels225Brussels21(Substation sBrussels,
.setValue(998.2)
.endTemporaryLimit()
.add();
txBETR3.getLeg2().newCurrentLimits()
txBETR3.getLeg2().getOrCreateSelectedOperationalLimitsGroup().newCurrentLimits()
.setPermanentLimit(1705.8)
.beginTemporaryLimit()
.setAcceptableDuration(20)
Expand All @@ -796,7 +796,7 @@ private static void addTWTBrussels380Brussels225Brussels21(Substation sBrussels,
.setValue(1905.8)
.endTemporaryLimit()
.add();
txBETR3.getLeg3().newCurrentLimits()
txBETR3.getLeg3().getOrCreateSelectedOperationalLimitsGroup().newCurrentLimits()
.setPermanentLimit(17870.4)
.beginTemporaryLimit()
.setAcceptableDuration(20)
Expand Down Expand Up @@ -830,7 +830,7 @@ public static Network microBaseCaseBE() {
String modelId = "urn:uuid:d400c631-75a0-4c30-8aed-832b0d282e73";
Network network = microBE(modelId);
DanglingLine be1 = network.getDanglingLine(DANGLING_LINE_ID_1);
be1.newCurrentLimits().setPermanentLimit(1443)
be1.getOrCreateSelectedOperationalLimitsGroup().newCurrentLimits().setPermanentLimit(1443)
.beginTemporaryLimit()
.setName("CL-4")
.setValue(1500.0)
Expand All @@ -853,7 +853,7 @@ public static Network microBaseCaseBE() {
.endTemporaryLimit()
.add();
TwoWindingsTransformer txBE21 = network.getTwoWindingsTransformer(TWT_ID_2);
txBE21.newCurrentLimits1().setPermanentLimit(938.2)
txBE21.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits().setPermanentLimit(938.2)
.beginTemporaryLimit()
.setName(CL_0)
.setValue(958.2)
Expand All @@ -866,7 +866,7 @@ public static Network microBaseCaseBE() {
.endTemporaryLimit()
.add();
TwoWindingsTransformer txBE22 = network.getTwoWindingsTransformer(TWT_ID_1);
txBE22.newCurrentLimits1().setPermanentLimit(1705.8)
txBE22.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits().setPermanentLimit(1705.8)
.beginTemporaryLimit()
.setName(CL_0)
.setValue(1805.8)
Expand Down Expand Up @@ -997,7 +997,7 @@ public static Network microType4BE() {
TwoWindingsTransformer txBE22 = network.getTwoWindingsTransformer(TWT_ID_1);
txBE22.getRatioTapChanger().remove();
addPhaseTapChangerOnTxBE22(txBE22);
txBE22.newCurrentLimits1().setPermanentLimit(1705.8)
txBE22.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits().setPermanentLimit(1705.8)
.beginTemporaryLimit()
.setName(CL_2)
.setValue(1805.8)
Expand All @@ -1009,7 +1009,7 @@ public static Network microType4BE() {
.setAcceptableDuration(10)
.endTemporaryLimit()
.add();
txBE22.newCurrentLimits2().setPermanentLimit(3411.6)
txBE22.getOrCreateSelectedOperationalLimitsGroup2().newCurrentLimits().setPermanentLimit(3411.6)
.beginTemporaryLimit()
.setName(CL_2)
.setValue(3611.6)
Expand All @@ -1025,7 +1025,7 @@ public static Network microType4BE() {
TwoWindingsTransformer txBE21 = network.getTwoWindingsTransformer(TWT_ID_2);
txBE21.getPhaseTapChanger().remove();
addPhaseTapChangerOnTxBE21(txBE21);
txBE21.newCurrentLimits1().setPermanentLimit(938.2)
txBE21.getOrCreateSelectedOperationalLimitsGroup1().newCurrentLimits().setPermanentLimit(938.2)
.beginTemporaryLimit()
.setName(CL_2)
.setValue(958.2)
Expand All @@ -1037,7 +1037,7 @@ public static Network microType4BE() {
.setAcceptableDuration(10)
.endTemporaryLimit()
.add();
txBE21.newCurrentLimits2().setPermanentLimit(3411.6)
txBE21.getOrCreateSelectedOperationalLimitsGroup2().newCurrentLimits().setPermanentLimit(3411.6)
.beginTemporaryLimit()
.setName(CL_2)
.setValue(3611.6)
Expand All @@ -1056,7 +1056,7 @@ public static Network microType4BE() {
network.getDanglingLine(DANGLING_LINE_ID_1)
.setP0(-89.462903)
.setQ0(1.519011)
.newCurrentLimits()
.getOrCreateSelectedOperationalLimitsGroup().newCurrentLimits()
.setPermanentLimit(1443)
.beginTemporaryLimit()
.setName(CL_0)
Expand Down
Loading
Loading