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

CGMES import: import TATL shortName or name, not ID + CGMES export: fix on LoadingLimitType and LoadingLimit names #2537

Merged
merged 4 commits into from
Apr 17, 2023
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 @@ -19,6 +19,10 @@
*/
public final class CgmesConformity1NetworkCatalog {

private static final String CL_0 = "CL-0";
private static final String CL_1 = "CL-1";
private static final String CL_2 = "CL-2";

private CgmesConformity1NetworkCatalog() {
}

Expand Down Expand Up @@ -118,12 +122,12 @@ private static Network microBE(String modelId) {
.add();
be7.newCurrentLimits().setPermanentLimit(1180)
.beginTemporaryLimit()
.setName("fa8eb432-3107-4562-95fa-7f35d75101b0")
.setName(CL_0)
.setValue(1312.0)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("367fe7fa-1b11-4090-af9a-0abc050fda58")
.setName(CL_1)
.setValue(1443.0)
.setAcceptableDuration(10)
.endTemporaryLimit()
Expand Down Expand Up @@ -212,12 +216,12 @@ private static Network microBE(String modelId) {
.add();
be3.newCurrentLimits().setPermanentLimit(1371)
.beginTemporaryLimit()
.setName("e207f382-e138-4a26-a40d-6c01dda96879")
.setName(CL_0)
.setValue(1443.0)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("ca002966-c9a3-4a17-a12d-1cd32c9d9a7e")
.setName(CL_1)
.setValue(1515.0)
.setAcceptableDuration(10)
.endTemporaryLimit()
Expand All @@ -238,12 +242,12 @@ private static Network microBE(String modelId) {
.add();
be5.newCurrentLimits().setPermanentLimit(1804)
.beginTemporaryLimit()
.setName("bea68f9e-5348-40dd-ac14-75c41a6a38bd")
.setName(CL_0)
.setValue(1876.0)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("3b3fdb5e-dafe-41bb-acfb-eb21be018863")
.setName(CL_1)
.setValue(1948.0)
.setAcceptableDuration(10)
.endTemporaryLimit()
Expand All @@ -264,12 +268,12 @@ private static Network microBE(String modelId) {
.add();
be4.newCurrentLimits().setPermanentLimit(1226)
.beginTemporaryLimit()
.setName("d5a5feb2-8345-487c-a1bc-af3829329391")
.setName(CL_0)
.setValue(1299.0)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("e6c72199-8db4-4674-bdd8-d6808afb115e")
.setName(CL_1)
.setValue(1371.0)
.setAcceptableDuration(10)
.endTemporaryLimit()
Expand Down Expand Up @@ -350,24 +354,24 @@ private static Network microBE(String modelId) {
.add();
lineBE2.newCurrentLimits1().setPermanentLimit(1443.0)
.beginTemporaryLimit()
.setName("1594f66e-86bd-45da-aa04-3c2bd8e07d76")
.setName(CL_0)
.setValue(1574.0)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("6f35cf24-2d5e-4b9a-ac65-943610878a4b")
.setName(CL_1)
.setValue(1705.0)
.setAcceptableDuration(10)
.endTemporaryLimit()
.add();
lineBE2.newCurrentLimits2().setPermanentLimit(1443.0)
.beginTemporaryLimit()
.setName("43d42f99-7c35-4907-a6ea-372b41eb8f77")
.setName(CL_0)
.setValue(1574.0)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("3ab4897f-cf5e-418b-8e1c-94f9cde91501")
.setName(CL_1)
.setValue(1705.0)
.setAcceptableDuration(10)
.endTemporaryLimit()
Expand Down Expand Up @@ -399,24 +403,24 @@ private static Network microBE(String modelId) {
.add();
lineBE6.newCurrentLimits1().setPermanentLimit(1180.0)
.beginTemporaryLimit()
.setName("0f8bff64-4cfe-4c94-9471-da94b2efcc4f")
.setName(CL_0)
.setValue(1312.0)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("61870312-e0be-4dd7-8941-22c108b61c30")
.setName(CL_1)
.setValue(1443.0)
.setAcceptableDuration(10)
.endTemporaryLimit()
.add();
lineBE6.newCurrentLimits2().setPermanentLimit(1180.0)
.beginTemporaryLimit()
.setName("a634eecf-b900-4808-8b74-d91e36c383a0")
.setName(CL_0)
.setValue(1312.0)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("5a4a910c-f57f-456b-b9ca-670ab3676adb")
.setName(CL_1)
.setValue(1443.0)
.setAcceptableDuration(10)
.endTemporaryLimit()
Expand Down Expand Up @@ -456,24 +460,24 @@ private static Network microBE(String modelId) {
.add();
tx.newCurrentLimits1().setPermanentLimit(1308.1)
.beginTemporaryLimit()
.setName("a5d3cd27-798c-4910-9729-6fc745346601")
.setName(CL_0)
.setValue(1408.1)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("7059bdb7-fa2d-4061-aea7-a88760835e2f")
.setName(CL_1)
.setValue(1508.1)
.setAcceptableDuration(10)
.endTemporaryLimit()
.add();
tx.newCurrentLimits2().setPermanentLimit(13746.4)
.beginTemporaryLimit()
.setName("3674d58e-946d-4901-8084-eb21afe1565a")
.setName(CL_0)
.setValue(14746.4)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("a1cfb7e6-ed0d-4369-b555-007826ba82fb")
.setName(CL_1)
.setValue(15746.4)
.setAcceptableDuration(10)
.endTemporaryLimit()
Expand Down Expand Up @@ -548,12 +552,12 @@ private static Network microBE(String modelId) {
.add();
txBE22.newCurrentLimits2().setPermanentLimit(3411.6)
.beginTemporaryLimit()
.setName("7939fc42-08ef-4ce7-9912-97552a4db39a")
.setName(CL_0)
.setValue(3611.6)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("84d4dbeb-ef3b-43a1-9a7e-ce5713013498")
.setName(CL_1)
.setValue(3811.6)
.setAcceptableDuration(10)
.endTemporaryLimit()
Expand Down Expand Up @@ -621,12 +625,12 @@ private static Network microBE(String modelId) {
.add();
txBE21.newCurrentLimits2().setPermanentLimit(3411.6)
.beginTemporaryLimit()
.setName("da1cb116-0730-4a00-b795-8ab0b52ad89f")
.setName(CL_0)
.setValue(3611.6)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("4af98ccd-29f1-4039-86cd-c23fc2deb3bc")
.setName(CL_1)
.setValue(3811.6)
.setAcceptableDuration(10)
.endTemporaryLimit()
Expand Down Expand Up @@ -744,38 +748,38 @@ private static Network microBE(String modelId) {
.setPermanentLimit(938.2)
.beginTemporaryLimit()
.setAcceptableDuration(20)
.setName("ddcb76e0-13ea-413f-9a8f-553d78782f76")
.setName(CL_0)
.setValue(968.2)
.endTemporaryLimit()
.beginTemporaryLimit()
.setAcceptableDuration(10)
.setName("3e9ed732-dd10-4f10-bc9d-d399e1e75a78")
.setName(CL_1)
.setValue(998.2)
.endTemporaryLimit()
.add();
txBETR3.getLeg2().newCurrentLimits()
.setPermanentLimit(1705.8)
.beginTemporaryLimit()
.setAcceptableDuration(20)
.setName("52d7ccc6-b4a1-48eb-9cfa-f5870b8b7fce")
.setName(CL_0)
.setValue(1805.8)
.endTemporaryLimit()
.beginTemporaryLimit()
.setAcceptableDuration(10)
.setName("11763596-6f4b-4cd5-a4a0-be649f368e86")
.setName(CL_1)
.setValue(1905.8)
.endTemporaryLimit()
.add();
txBETR3.getLeg3().newCurrentLimits()
.setPermanentLimit(17870.4)
.beginTemporaryLimit()
.setAcceptableDuration(20)
.setName("50448009-0fad-4656-bce4-438fe76e18cf")
.setName(CL_0)
.setValue(18870.4)
.endTemporaryLimit()
.beginTemporaryLimit()
.setAcceptableDuration(10)
.setName("df2d3155-4436-4542-8d3b-64241c7433be")
.setName(CL_1)
.setValue(19870.4)
.endTemporaryLimit()
.add();
Expand Down Expand Up @@ -817,48 +821,48 @@ public static Network microBaseCaseBE() {
DanglingLine be1 = network.getDanglingLine("17086487-56ba-4979-b8de-064025a6b4da");
be1.newCurrentLimits().setPermanentLimit(1443)
.beginTemporaryLimit()
.setName("58c959fd-3675-4ad4-a221-9647b57073dd")
.setName("CL-4")
.setValue(1500.0)
.setAcceptableDuration(30)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("b1714414-0394-42b6-b441-a664069554a2")
.setName("CL-3")
.setValue(1550.0)
.setAcceptableDuration(25)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("ad0fa884-ec20-4908-9986-48ab09ac55cd")
.setName(CL_0)
.setValue(1574.0)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("19627231-9a8b-45e1-815c-b280a66a59ca")
.setName(CL_1)
.setValue(1705.0)
.setAcceptableDuration(10)
.endTemporaryLimit()
.add();
TwoWindingsTransformer txBE21 = network.getTwoWindingsTransformer("a708c3bc-465d-4fe7-b6ef-6fa6408a62b0");
txBE21.newCurrentLimits1().setPermanentLimit(938.2)
.beginTemporaryLimit()
.setName("aaa63bb1-fa34-41a3-bd92-0637bfce549c")
.setName(CL_0)
.setValue(958.2)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("acbd4688-6393-4b43-a9f4-27d8c3f8c309")
.setName(CL_1)
.setValue(998.2)
.setAcceptableDuration(10)
.endTemporaryLimit()
.add();
TwoWindingsTransformer txBE22 = network.getTwoWindingsTransformer("b94318f6-6d24-4f56-96b9-df2531ad6543");
txBE22.newCurrentLimits1().setPermanentLimit(1705.8)
.beginTemporaryLimit()
.setName("0d6f26df-9f86-4df0-b00c-bfb23870257f")
.setName(CL_0)
.setValue(1805.8)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("5b77485f-20a3-4a19-8d15-e4038c81663f")
.setName(CL_1)
.setValue(1905.8)
.setAcceptableDuration(10)
.endTemporaryLimit()
Expand Down Expand Up @@ -998,24 +1002,24 @@ public static Network microType4BE() {
}
txBE22.newCurrentLimits1().setPermanentLimit(1705.8)
.beginTemporaryLimit()
.setName("9732c968-c1c4-446a-b47b-9038f5a59724")
.setName(CL_2)
.setValue(1805.8)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("d29ef207-67d3-47bb-82ea-9d82074dde55")
.setName(CL_1)
.setValue(1905.8)
.setAcceptableDuration(10)
.endTemporaryLimit()
.add();
txBE22.newCurrentLimits2().setPermanentLimit(3411.6)
.beginTemporaryLimit()
.setName("6236459d-8471-44be-9b66-b271ac407165")
.setName(CL_2)
.setValue(3611.6)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("9b2c1328-381e-4277-9042-94b0085f2b77")
.setName(CL_1)
.setValue(3811.6)
.setAcceptableDuration(10)
.endTemporaryLimit()
Expand Down Expand Up @@ -1043,24 +1047,24 @@ public static Network microType4BE() {
}
txBE21.newCurrentLimits1().setPermanentLimit(938.2)
.beginTemporaryLimit()
.setName("1b0850d6-317b-40a3-aa98-040b64f9350c")
.setName(CL_2)
.setValue(958.2)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("dea05113-ef3e-4161-957d-4602c874839e")
.setName(CL_1)
.setValue(998.2)
.setAcceptableDuration(10)
.endTemporaryLimit()
.add();
txBE21.newCurrentLimits2().setPermanentLimit(3411.6)
.beginTemporaryLimit()
.setName("e1ae19e7-8bb7-42ce-8ae6-24893f16e366")
.setName(CL_2)
.setValue(3611.6)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("1e793cd6-1608-46af-a3f7-b4d1cabc9d58")
.setName(CL_1)
.setValue(3811.6)
.setAcceptableDuration(10)
.endTemporaryLimit()
Expand All @@ -1075,12 +1079,12 @@ public static Network microType4BE() {
.newCurrentLimits()
.setPermanentLimit(1443)
.beginTemporaryLimit()
.setName("ad0fa884-ec20-4908-9986-48ab09ac55cd")
.setName(CL_0)
.setValue(1574.0)
.setAcceptableDuration(20)
.endTemporaryLimit()
.beginTemporaryLimit()
.setName("19627231-9a8b-45e1-815c-b280a66a59ca")
.setName(CL_1)
.setValue(1705.0)
.setAcceptableDuration(10)
.endTemporaryLimit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.powsybl.iidm.network.TwoWindingsTransformer;
import com.powsybl.triplestore.api.PropertyBag;

import java.util.Optional;
import java.util.function.Supplier;

/**
Expand Down Expand Up @@ -311,14 +312,15 @@ private void convertTatl(double value) {

// if there is no direction, the limit is considered as absoluteValue (cf. CGMES specification)
if (direction == null || direction.endsWith("high") || direction.endsWith("absoluteValue")) {
String name = Optional.ofNullable(p.getId("shortName")).orElse(p.getId("name"));
if (loadingLimitsAdder != null) {
addTatl(context.namingStrategy().getIidmId("TATL", id), value, acceptableDuration, loadingLimitsAdder);
addTatl(name, value, acceptableDuration, loadingLimitsAdder);
} else {
if (loadingLimitsAdder1 != null) {
addTatl(context.namingStrategy().getIidmId("TATL", id), value, acceptableDuration, loadingLimitsAdder1);
addTatl(name, value, acceptableDuration, loadingLimitsAdder1);
}
if (loadingLimitsAdder2 != null) {
addTatl(context.namingStrategy().getIidmId("TATL", id), value, acceptableDuration, loadingLimitsAdder2);
addTatl(name, value, acceptableDuration, loadingLimitsAdder2);
}
}
} else if (direction.endsWith("low")) {
Expand Down
Loading