From acdd8b55f267b8d4eb4d3b2ec46b7ea532b1f635 Mon Sep 17 00:00:00 2001 From: achour94 Date: Tue, 3 Jun 2025 13:18:32 +0200 Subject: [PATCH 1/6] 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 2/6] 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 3/6] 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 4/6] 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 5/6] 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 6/6] 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