Skip to content

feat: add subtract load flow balancing option #645

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

Merged
merged 15 commits into from
Jul 23, 2025
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
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
<sonar.coverage.exclusions>**/migration/**/*</sonar.coverage.exclusions>
<sonar.organization>gridsuite</sonar.organization>
<sonar.projectKey>org.gridsuite:network-modification-server</sonar.projectKey>
<!-- TODO network-modification.version remove when upgrading gridsuite dependencies -->
<network-modification.version>0.27.0</network-modification.version>
<powsybl-balances-adjustment.version>2.14.1</powsybl-balances-adjustment.version>
</properties>

<build>
Expand Down Expand Up @@ -94,6 +97,13 @@
<type>pom</type>
<scope>import</scope>
</dependency>

<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-balances-adjustment</artifactId>
<version>${powsybl-balances-adjustment.version}</version>
</dependency>

<!-- imports -->
<dependency>
<groupId>org.gridsuite</groupId>
Expand All @@ -117,6 +127,7 @@
<dependency>
<groupId>org.gridsuite</groupId>
<artifactId>gridsuite-network-modification</artifactId>
<version>${network-modification.version}</version>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.List;
import java.util.UUID;

import static com.powsybl.balances_adjustment.balance_computation.BalanceComputationParameters.DEFAULT_SUBTRACT_LOAD_FLOW_BALANCING;
import static org.gridsuite.modification.dto.BalancesAdjustmentModificationInfos.*;

/**
Expand Down Expand Up @@ -54,6 +55,9 @@ public class BalancesAdjustmentEntity extends ModificationEntity {
@Column(name = "with_ratio_tap_changers")
private boolean withRatioTapChangers = DEFAULT_WITH_RATIO_TAP_CHANGERS;

@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<BalancesAdjustmentAreaEntity> areas;
Expand All @@ -78,6 +82,7 @@ public BalancesAdjustmentModificationInfos toModificationInfos() {
.withLoadFlow(withLoadFlow)
.loadFlowParametersId(loadFlowParametersId)
.withRatioTapChangers(withRatioTapChangers)
.subtractLoadFlowBalancing(subtractLoadFlowBalancing)
.build();
}

Expand All @@ -95,6 +100,7 @@ private void assignAttributes(BalancesAdjustmentModificationInfos balancesAdjust
withLoadFlow = balancesAdjustmentModificationInfos.isWithLoadFlow();
loadFlowParametersId = balancesAdjustmentModificationInfos.getLoadFlowParametersId();
withRatioTapChangers = balancesAdjustmentModificationInfos.isWithRatioTapChangers();
subtractLoadFlowBalancing = balancesAdjustmentModificationInfos.isSubtractLoadFlowBalancing();
List<BalancesAdjustmentAreaEntity> areaEntities = balancesAdjustmentModificationInfos
.getAreas()
.stream()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet author="mancinijor (generated)" id="1749721253189-28">
<addColumn tableName="balances_adjustment">
<column name="subtract_load_flow_balancing" type="boolean" defaultValue="false"/>
</addColumn>
</changeSet>
</databaseChangeLog>
3 changes: 3 additions & 0 deletions src/main/resources/db/changelog/db.changelog-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ databaseChangeLog:
- include:
file: changesets/changelog_20250620T115827Z.xml
relativeToChangelogFile: true
- include:
file: changesets/changelog_20250612T094023Z.xml
relativeToChangelogFile: true
- include:
file: changesets/changelog_20250722T125427Z.xml
relativeToChangelogFile: true