From acdd8b55f267b8d4eb4d3b2ec46b7ea532b1f635 Mon Sep 17 00:00:00 2001 From: achour94 Date: Tue, 3 Jun 2025 13:18:32 +0200 Subject: [PATCH 01/10] Add `withLoadFlow` column and field to balances adjustment Signed-off-by: achour94 --- pom.xml | 8 +++++- .../BalancesAdjustmentEntity.java | 25 +++++++++++-------- .../changesets/changelog_20250602T145520Z.xml | 8 ++++++ .../db/changelog/db.changelog-master.yaml | 3 +++ 4 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 src/main/resources/db/changelog/changesets/changelog_20250602T145520Z.xml diff --git a/pom.xml b/pom.xml index d2a5cef8b..2242e4593 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 1.0.5 5.0.0-alpha.14 - 0.17.0 + 0.18.0-SNAPSHOT org.gridsuite.modification.server **/migration/**/* gridsuite @@ -96,6 +96,12 @@ import + + com.powsybl + powsybl-balances-adjustment + 2.14.0-SNAPSHOT + + org.gridsuite diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BalancesAdjustmentEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BalancesAdjustmentEntity.java index 0180bb9fb..1a802b2da 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BalancesAdjustmentEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BalancesAdjustmentEntity.java @@ -44,6 +44,9 @@ public class BalancesAdjustmentEntity extends ModificationEntity { @Enumerated(EnumType.STRING) private LoadFlowParameters.BalanceType balanceType = DEFAULT_BALANCE_TYPE; + @Column(name = "with_load_flow") + private boolean withLoadFlow = DEFAULT_WITH_LOAD_FLOW; + @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY) @JoinColumn(name = "balances_adjustment_id", foreignKey = @ForeignKey(name = "area_balances_adjustment_id_fk")) private List areas; @@ -56,16 +59,17 @@ public BalancesAdjustmentEntity(@NonNull BalancesAdjustmentModificationInfos bal @Override public BalancesAdjustmentModificationInfos toModificationInfos() { return BalancesAdjustmentModificationInfos.builder() - .date(getDate()) - .uuid(getId()) - .stashed(getStashed()) - .activated(getActivated()) - .areas(areas.stream().map(BalancesAdjustmentAreaEntity::getAreaInfos).toList()) - .thresholdNetPosition(thresholdNetPosition) - .maxNumberIterations(maxNumberIterations) - .countriesToBalance(CountriesUtils.toList(countriesToBalance)) - .balanceType(balanceType) - .build(); + .date(getDate()) + .uuid(getId()) + .stashed(getStashed()) + .activated(getActivated()) + .areas(areas.stream().map(BalancesAdjustmentAreaEntity::getAreaInfos).toList()) + .thresholdNetPosition(thresholdNetPosition) + .maxNumberIterations(maxNumberIterations) + .countriesToBalance(CountriesUtils.toList(countriesToBalance)) + .balanceType(balanceType) + .withLoadFlow(withLoadFlow) + .build(); } @Override @@ -79,6 +83,7 @@ private void assignAttributes(BalancesAdjustmentModificationInfos balancesAdjust thresholdNetPosition = balancesAdjustmentModificationInfos.getThresholdNetPosition(); countriesToBalance = CountriesUtils.stringify(balancesAdjustmentModificationInfos.getCountriesToBalance()); balanceType = balancesAdjustmentModificationInfos.getBalanceType(); + withLoadFlow = balancesAdjustmentModificationInfos.isWithLoadFlow(); List areaEntities = balancesAdjustmentModificationInfos .getAreas() .stream() diff --git a/src/main/resources/db/changelog/changesets/changelog_20250602T145520Z.xml b/src/main/resources/db/changelog/changesets/changelog_20250602T145520Z.xml new file mode 100644 index 000000000..99e2d1433 --- /dev/null +++ b/src/main/resources/db/changelog/changesets/changelog_20250602T145520Z.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/main/resources/db/changelog/db.changelog-master.yaml b/src/main/resources/db/changelog/db.changelog-master.yaml index 564b08075..c277436fb 100644 --- a/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/src/main/resources/db/changelog/db.changelog-master.yaml @@ -363,3 +363,6 @@ databaseChangeLog: - include: file: changesets/changelog_20250527T123404Z.xml relativeToChangelogFile: true + - include: + file: changesets/changelog_20250602T145520Z.xml + relativeToChangelogFile: true From 32d21c5b18935cd4b687063ebefa2b1b5fd72064 Mon Sep 17 00:00:00 2001 From: achour94 Date: Tue, 3 Jun 2025 13:27:21 +0200 Subject: [PATCH 02/10] Add `withLoadFlow` column and field to balances adjustment Signed-off-by: achour94 --- .../server/modifications/BalancesAdjustmentTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/org/gridsuite/modification/server/modifications/BalancesAdjustmentTest.java b/src/test/java/org/gridsuite/modification/server/modifications/BalancesAdjustmentTest.java index 007850f07..ed9a5d90a 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/BalancesAdjustmentTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/BalancesAdjustmentTest.java @@ -68,6 +68,7 @@ protected ModificationInfos buildModification() { .shiftEquipmentType(ShiftEquipmentType.LOAD) .build() )) + .withLoadFlow(true) .build(); } From 3a9d89a29de01f58410027c0def369aafb75ad84 Mon Sep 17 00:00:00 2001 From: achour94 Date: Mon, 9 Jun 2025 16:26:56 +0200 Subject: [PATCH 03/10] Add `withLoadFlow` column and field to balances adjustment Signed-off-by: achour94 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2242e4593..2bb4beeb1 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 1.0.5 5.0.0-alpha.14 - 0.18.0-SNAPSHOT + 0.19.0-SNAPSHOT org.gridsuite.modification.server **/migration/**/* gridsuite From d232fd994ef304439cfe9c1e8935e534ac78862a Mon Sep 17 00:00:00 2001 From: achour94 Date: Tue, 10 Jun 2025 12:56:22 +0200 Subject: [PATCH 04/10] Update balances_adjustment to set with_load_flow to true Signed-off-by: achour94 --- pom.xml | 2 +- .../db/changelog/changesets/changelog_20250602T145520Z.xml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 850611208..61b04de41 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 1.0.5 5.0.0-alpha.14 - 0.19.0 + 0.20.0-SNAPSHOT org.gridsuite.modification.server **/migration/**/* gridsuite diff --git a/src/main/resources/db/changelog/changesets/changelog_20250602T145520Z.xml b/src/main/resources/db/changelog/changesets/changelog_20250602T145520Z.xml index 99e2d1433..dbc805755 100644 --- a/src/main/resources/db/changelog/changesets/changelog_20250602T145520Z.xml +++ b/src/main/resources/db/changelog/changesets/changelog_20250602T145520Z.xml @@ -5,4 +5,10 @@ + + + + with_load_flow IS NULL + + From 2ed7fd9dc0357c6f839ede2a6ff2da172dbfeb9f Mon Sep 17 00:00:00 2001 From: achour94 Date: Wed, 11 Jun 2025 16:19:54 +0200 Subject: [PATCH 05/10] Set default value for `with_load_flow` column to true in balances_adjustment Signed-off-by: achour94 --- .../changesets/changelog_20250602T145520Z.xml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/resources/db/changelog/changesets/changelog_20250602T145520Z.xml b/src/main/resources/db/changelog/changesets/changelog_20250602T145520Z.xml index dbc805755..5fe5e833b 100644 --- a/src/main/resources/db/changelog/changesets/changelog_20250602T145520Z.xml +++ b/src/main/resources/db/changelog/changesets/changelog_20250602T145520Z.xml @@ -2,13 +2,9 @@ - + + + - - - - with_load_flow IS NULL - - From 7675f2105fbdd5c7da85592e2980aa5cea8b39d1 Mon Sep 17 00:00:00 2001 From: Joris Mancini Date: Fri, 13 Jun 2025 14:20:02 +0200 Subject: [PATCH 06/10] feat: add subtract load flow balancing option Signed-off-by: Joris Mancini --- pom.xml | 5 ----- .../equipment/modification/BalancesAdjustmentEntity.java | 5 +++++ .../changelog/changesets/changelog_20250612T094023Z.xml | 8 ++++++++ src/main/resources/db/changelog/db.changelog-master.yaml | 3 +++ 4 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/db/changelog/changesets/changelog_20250612T094023Z.xml diff --git a/pom.xml b/pom.xml index 61b04de41..ea43d5c2e 100644 --- a/pom.xml +++ b/pom.xml @@ -206,11 +206,6 @@ powsybl-open-loadflow runtime - - com.powsybl - powsybl-config-classic - runtime - diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BalancesAdjustmentEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BalancesAdjustmentEntity.java index 1a802b2da..cad198c51 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BalancesAdjustmentEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BalancesAdjustmentEntity.java @@ -47,6 +47,9 @@ public class BalancesAdjustmentEntity extends ModificationEntity { @Column(name = "with_load_flow") private boolean withLoadFlow = DEFAULT_WITH_LOAD_FLOW; + @Column(name = "subtract_load_flow_balancing") + private boolean subtractLoadFlowBalancing = DEFAULT_SUBTRACT_LOAD_FLOW_BALANCING; + @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY) @JoinColumn(name = "balances_adjustment_id", foreignKey = @ForeignKey(name = "area_balances_adjustment_id_fk")) private List areas; @@ -69,6 +72,7 @@ public BalancesAdjustmentModificationInfos toModificationInfos() { .countriesToBalance(CountriesUtils.toList(countriesToBalance)) .balanceType(balanceType) .withLoadFlow(withLoadFlow) + .subtractLoadFlowBalancing(subtractLoadFlowBalancing) .build(); } @@ -84,6 +88,7 @@ private void assignAttributes(BalancesAdjustmentModificationInfos balancesAdjust countriesToBalance = CountriesUtils.stringify(balancesAdjustmentModificationInfos.getCountriesToBalance()); balanceType = balancesAdjustmentModificationInfos.getBalanceType(); withLoadFlow = balancesAdjustmentModificationInfos.isWithLoadFlow(); + subtractLoadFlowBalancing = balancesAdjustmentModificationInfos.isSubtractLoadFlowBalancing(); List areaEntities = balancesAdjustmentModificationInfos .getAreas() .stream() diff --git a/src/main/resources/db/changelog/changesets/changelog_20250612T094023Z.xml b/src/main/resources/db/changelog/changesets/changelog_20250612T094023Z.xml new file mode 100644 index 000000000..3c21f4e24 --- /dev/null +++ b/src/main/resources/db/changelog/changesets/changelog_20250612T094023Z.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/main/resources/db/changelog/db.changelog-master.yaml b/src/main/resources/db/changelog/db.changelog-master.yaml index bd4d0bd1c..9611b18c1 100644 --- a/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/src/main/resources/db/changelog/db.changelog-master.yaml @@ -369,3 +369,6 @@ databaseChangeLog: - include: file: changesets/changelog_20250602T145520Z.xml relativeToChangelogFile: true + - include: + file: changesets/changelog_20250612T094023Z.xml + relativeToChangelogFile: true From 71cd90cb6c043032983efa016e5f31dc6e5fc18f Mon Sep 17 00:00:00 2001 From: Joris Mancini Date: Thu, 10 Jul 2025 10:48:28 +0200 Subject: [PATCH 07/10] fix pom.xml Signed-off-by: Joris Mancini --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 56156b602..b7da23e4d 100644 --- a/pom.xml +++ b/pom.xml @@ -206,6 +206,11 @@ powsybl-open-loadflow runtime + + com.powsybl + powsybl-config-classic + runtime + From 7a34ae6770ee168f6f48e24b60c222a8873d9f4e Mon Sep 17 00:00:00 2001 From: Franck LECUYER Date: Mon, 21 Jul 2025 13:17:52 +0200 Subject: [PATCH 08/10] Upgrade to network-modification.version 0.26.0-SNAPSHOT and powsybl-balances-adjustment.version 2.15.0-SNAPSHOT Signed-off-by: Franck LECUYER --- pom.xml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index dbb5a5ad2..fb922db85 100644 --- a/pom.xml +++ b/pom.xml @@ -49,14 +49,13 @@ 41.0.0 1.0.5 5.0.0-alpha.14 - - 0.20.0-SNAPSHOT org.gridsuite.modification.server **/migration/**/* gridsuite org.gridsuite:network-modification-server - 0.25.0 + 0.26.0-SNAPSHOT + 2.15.0-SNAPSHOT @@ -121,7 +120,7 @@ com.powsybl powsybl-balances-adjustment - 2.14.0-SNAPSHOT + ${powsybl-balances-adjustment.version} From a4427b54681a00ca0c9bff7d4f25109e8042d491 Mon Sep 17 00:00:00 2001 From: Franck LECUYER Date: Wed, 23 Jul 2025 11:02:20 +0200 Subject: [PATCH 09/10] Upgrade to network-modification.version 0.27.0-SNAPSHOT and powsybl-balances-adjustment.version 2.14.1 Signed-off-by: Franck LECUYER --- pom.xml | 4 ++-- ...TwoWindingsTransformerModificationTest.java | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index fb922db85..5153b0848 100644 --- a/pom.xml +++ b/pom.xml @@ -54,8 +54,8 @@ gridsuite org.gridsuite:network-modification-server - 0.26.0-SNAPSHOT - 2.15.0-SNAPSHOT + 0.27.0-SNAPSHOT + 2.14.1 diff --git a/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerModificationTest.java b/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerModificationTest.java index 119e5483f..467a561ba 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerModificationTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerModificationTest.java @@ -869,7 +869,7 @@ void testProcessPhaseTapChangerModification() { List regulationReports = new ArrayList<>(); processPhaseTapRegulation(phaseTapChanger, null, true, new AttributeModification<>(PhaseTapChanger.RegulationMode.FIXED_TAP, OperationType.SET), - null, null, regulationReports); + null, null, null, regulationReports); assertEquals(PhaseTapChanger.RegulationMode.FIXED_TAP, phaseTapChanger.getRegulationMode()); assertTrue(Double.isNaN(phaseTapChanger.getRegulationValue())); assertTrue(Double.isNaN(phaseTapChanger.getTargetDeadband())); @@ -877,7 +877,7 @@ void testProcessPhaseTapChangerModification() { processPhaseTapRegulation(phaseTapChanger, null, true, new AttributeModification<>(PhaseTapChanger.RegulationMode.ACTIVE_POWER_CONTROL, OperationType.SET), - new AttributeModification<>(10.0, OperationType.SET), null, regulationReports); + new AttributeModification<>(10.0, OperationType.SET), null, null, regulationReports); assertEquals(PhaseTapChanger.RegulationMode.ACTIVE_POWER_CONTROL, phaseTapChanger.getRegulationMode()); assertEquals(10.0, phaseTapChanger.getRegulationValue()); assertEquals(0.0, phaseTapChanger.getTargetDeadband()); @@ -885,7 +885,7 @@ void testProcessPhaseTapChangerModification() { processPhaseTapRegulation(phaseTapChanger, null, true, new AttributeModification<>(PhaseTapChanger.RegulationMode.FIXED_TAP, OperationType.SET), - null, null, regulationReports); + null, null, null, regulationReports); assertEquals(PhaseTapChanger.RegulationMode.ACTIVE_POWER_CONTROL, phaseTapChanger.getRegulationMode()); assertEquals(10.0, phaseTapChanger.getRegulationValue()); assertEquals(0.0, phaseTapChanger.getTargetDeadband()); @@ -895,7 +895,7 @@ void testProcessPhaseTapChangerModification() { new AttributeModification<>(PhaseTapChanger.RegulationMode.CURRENT_LIMITER, OperationType.SET), new AttributeModification<>(12.0, OperationType.SET), new AttributeModification<>(8.0, OperationType.SET), - regulationReports); + null, regulationReports); assertEquals(PhaseTapChanger.RegulationMode.CURRENT_LIMITER, phaseTapChanger.getRegulationMode()); assertEquals(12.0, phaseTapChanger.getRegulationValue()); assertEquals(8.0, phaseTapChanger.getTargetDeadband()); @@ -903,7 +903,7 @@ void testProcessPhaseTapChangerModification() { processPhaseTapRegulation(phaseTapChanger, null, true, new AttributeModification<>(PhaseTapChanger.RegulationMode.FIXED_TAP, OperationType.SET), - null, null, regulationReports); + null, null, null, regulationReports); assertEquals(PhaseTapChanger.RegulationMode.CURRENT_LIMITER, phaseTapChanger.getRegulationMode()); assertEquals(12.0, phaseTapChanger.getRegulationValue()); assertEquals(8.0, phaseTapChanger.getTargetDeadband()); @@ -920,16 +920,16 @@ void testProcessPhaseTapChangerCreation() { PhaseTapChangerAdder adder = twt.newPhaseTapChanger(); preparePhaseTapChangerAdder(adder); String message = assertThrows(NetworkModificationException.class, () -> processPhaseTapRegulation(null, adder, false, - null, null, null, regulationReports)).getMessage(); + null, null, null, null, regulationReports)).getMessage(); assertEquals("CREATE_TWO_WINDINGS_TRANSFORMER_ERROR : Regulation mode is missing when creating tap phase changer", message); AttributeModification regulationModeModification = new AttributeModification<>(PhaseTapChanger.RegulationMode.CURRENT_LIMITER, OperationType.SET); String message2 = assertThrows(NetworkModificationException.class, () -> processPhaseTapRegulation(null, adder, false, - regulationModeModification, null, null, regulationReports)).getMessage(); + regulationModeModification, null, null, null, regulationReports)).getMessage(); assertEquals("CREATE_TWO_WINDINGS_TRANSFORMER_ERROR : Regulation value is missing when creating tap phase changer with regulation enabled (different from FIXED_TAP)", message2); processPhaseTapRegulation(null, adder, false, new AttributeModification<>(PhaseTapChanger.RegulationMode.FIXED_TAP, OperationType.SET), - null, null, regulationReports); + null, null, null, regulationReports); adder.add(); PhaseTapChanger phaseTapChanger = twt.getPhaseTapChanger(); assertEquals(PhaseTapChanger.RegulationMode.FIXED_TAP, phaseTapChanger.getRegulationMode()); @@ -941,7 +941,7 @@ void testProcessPhaseTapChangerCreation() { preparePhaseTapChangerAdder(adder1); processPhaseTapRegulation(null, adder1, false, new AttributeModification<>(PhaseTapChanger.RegulationMode.CURRENT_LIMITER, OperationType.SET), - new AttributeModification<>(10.0, OperationType.SET), null, regulationReports); + new AttributeModification<>(10.0, OperationType.SET), null, null, regulationReports); adder1.add(); phaseTapChanger = twt.getPhaseTapChanger(); assertEquals(PhaseTapChanger.RegulationMode.CURRENT_LIMITER, phaseTapChanger.getRegulationMode()); From 9b080b7bb4de89c7c236e8abb67c738bcdb14c6a Mon Sep 17 00:00:00 2001 From: Franck LECUYER Date: Wed, 23 Jul 2025 15:17:23 +0200 Subject: [PATCH 10/10] Upgrade to network-modification.version 0.27.0 Signed-off-by: Franck LECUYER --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a44cf0593..6161556c2 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,7 @@ gridsuite org.gridsuite:network-modification-server - 0.27.0-SNAPSHOT + 0.27.0 2.14.1