Skip to content

Commit 4b355b6

Browse files
authored
Merge branch 'main' into applytoolongtransactionmini
2 parents 36e0515 + b2cbf5a commit 4b355b6

34 files changed

+829
-102
lines changed

pom.xml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<groupId>org.gridsuite</groupId>
2323
<artifactId>gridsuite-network-modification-server</artifactId>
24-
<version>2.24.0-SNAPSHOT</version>
24+
<version>2.25.0-SNAPSHOT</version>
2525

2626
<packaging>jar</packaging>
2727
<name>Network modification server</name>
@@ -52,7 +52,9 @@
5252
<sonar.organization>gridsuite</sonar.organization>
5353
<sonar.projectKey>org.gridsuite:network-modification-server</sonar.projectKey>
5454
<!-- TODO network-modification.version remove when upgrading gridsuite dependencies -->
55-
<network-modification.version>0.37.0</network-modification.version>
55+
<network-modification.version>0.42.0</network-modification.version>
56+
<!-- FIXME: powsybl-network-store modules'version is overloaded in the dependencies section.The overloads and this property below have to be removed at next powsybl-ws-dependencies.version upgrade -->
57+
<powsybl-network-store.version>1.31.0</powsybl-network-store.version>
5658
<powsybl-balances-adjustment.version>2.14.1</powsybl-balances-adjustment.version>
5759
</properties>
5860

@@ -96,6 +98,24 @@
9698
<type>pom</type>
9799
<scope>import</scope>
98100
</dependency>
101+
<!-- FIXME: to be removed at next powsybl-ws-dependencies upgrade -->
102+
<dependency>
103+
<groupId>com.powsybl</groupId>
104+
<artifactId>powsybl-network-store-model</artifactId>
105+
<version>${powsybl-network-store.version}</version>
106+
</dependency>
107+
<!-- FIXME: to be removed at next powsybl-ws-dependencies upgrade -->
108+
<dependency>
109+
<groupId>com.powsybl</groupId>
110+
<artifactId>powsybl-network-store-iidm-impl</artifactId>
111+
<version>${powsybl-network-store.version}</version>
112+
</dependency>
113+
<!-- FIXME: to be removed at next powsybl-ws-dependencies upgrade -->
114+
<dependency>
115+
<groupId>com.powsybl</groupId>
116+
<artifactId>powsybl-network-store-client</artifactId>
117+
<version>${powsybl-network-store.version}</version>
118+
</dependency>
99119

100120
<dependency>
101121
<groupId>com.powsybl</groupId>
@@ -207,11 +227,6 @@
207227
<artifactId>powsybl-open-loadflow</artifactId>
208228
<scope>runtime</scope>
209229
</dependency>
210-
<dependency>
211-
<groupId>com.powsybl</groupId>
212-
<artifactId>powsybl-config-classic</artifactId>
213-
<scope>runtime</scope>
214-
</dependency>
215230

216231
<!-- Test dependencies -->
217232
<dependency>

src/main/java/org/gridsuite/modification/server/dto/catalog/LineTypeInfos.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ public class LineTypeInfos {
6767

6868
@JsonIgnore
6969
public LineTypeEntity toEntity() {
70-
throw new UnsupportedOperationException("TODO");
70+
throw new UnsupportedOperationException("toEntity() should be implemented in subclasses");
7171
}
7272
}

src/main/java/org/gridsuite/modification/server/elasticsearch/EquipmentInfosService.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
package org.gridsuite.modification.server.elasticsearch;
88

99
import com.google.common.collect.Lists;
10+
import com.google.common.collect.Sets;
1011
import com.powsybl.iidm.network.IdentifiableType;
1112
import org.gridsuite.modification.server.dto.elasticsearch.EquipmentInfos;
1213
import org.gridsuite.modification.server.dto.elasticsearch.TombstonedEquipmentInfos;
@@ -38,7 +39,7 @@ public class EquipmentInfosService {
3839
@Value("${spring.data.elasticsearch.partition-size-for-deletion:2048}")
3940
public int partitionSizeForDeletion;
4041

41-
private static final Set<IdentifiableType> TYPES_FOR_INDEXING = Set.of(
42+
private static final Set<IdentifiableType> TYPES_FOR_EQUIPMENT_INDEXING = Set.of(
4243
IdentifiableType.SUBSTATION,
4344
IdentifiableType.VOLTAGE_LEVEL,
4445
IdentifiableType.HVDC_LINE,
@@ -53,8 +54,16 @@ public class EquipmentInfosService {
5354
IdentifiableType.STATIC_VAR_COMPENSATOR,
5455
IdentifiableType.HVDC_CONVERTER_STATION);
5556

57+
private static final Set<IdentifiableType> TYPES_FOR_MODIFICATION_INDEXING = Sets.union(
58+
TYPES_FOR_EQUIPMENT_INDEXING,
59+
Set.of(IdentifiableType.SWITCH, IdentifiableType.BUSBAR_SECTION));
60+
5661
public static Set<IdentifiableType> getIndexedEquipmentTypes() {
57-
return TYPES_FOR_INDEXING;
62+
return TYPES_FOR_EQUIPMENT_INDEXING;
63+
}
64+
65+
public static Set<IdentifiableType> getIndexedEquipmentTypesInModification() {
66+
return TYPES_FOR_MODIFICATION_INDEXING;
5867
}
5968

6069
public EquipmentInfosService(EquipmentInfosRepository equipmentInfosRepository, TombstonedEquipmentInfosRepository tombstonedEquipmentInfosRepository) {

src/main/java/org/gridsuite/modification/server/entities/EntityRegistry.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ private EntityRegistry() {
7474
register(VoltageLevelTopologyModificationInfos.class, VoltageLevelTopologyModificationEntity.class);
7575
register(CreateCouplingDeviceInfos.class, CreateCouplingDeviceEntity.class);
7676
register(CreateVoltageLevelTopologyInfos.class, CreateVoltageLevelTopologyEntity.class);
77+
register(MoveVoltageLevelFeederBaysInfos.class, MoveVoltageLevelFeederBaysEntity.class);
7778

7879
// // attatching and splitting
7980
register(LineAttachToVoltageLevelInfos.class, LineAttachToVoltageLevelEntity.class);

src/main/java/org/gridsuite/modification/server/entities/equipment/creation/BatteryCreationEntity.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ public class BatteryCreationEntity extends InjectionCreationEntity {
6161
@Column(name = "droop")
6262
private Float droop;
6363

64+
@Column(name = "directTransX")
65+
private Double directTransX;
66+
67+
@Column(name = "stepUpTransformerX")
68+
private Double stepUpTransformerX;
69+
6470
public BatteryCreationEntity(@NonNull BatteryCreationInfos batteryCreationInfos) {
6571
super(batteryCreationInfos);
6672
assignAttributes(batteryCreationInfos);
@@ -83,6 +89,8 @@ private void assignAttributes(BatteryCreationInfos batteryCreationInfos) {
8389
this.targetQ = batteryCreationInfos.getTargetQ();
8490
this.participate = batteryCreationInfos.getParticipate();
8591
this.droop = batteryCreationInfos.getDroop();
92+
this.directTransX = batteryCreationInfos.getDirectTransX();
93+
this.stepUpTransformerX = batteryCreationInfos.getStepUpTransformerX();
8694
}
8795

8896
@Override
@@ -117,6 +125,8 @@ public BatteryCreationInfos toModificationInfos() {
117125
.targetQ(getTargetQ())
118126
.participate(getParticipate())
119127
.droop(getDroop())
128+
.directTransX(getDirectTransX())
129+
.stepUpTransformerX(getStepUpTransformerX())
120130
// properties
121131
.properties(CollectionUtils.isEmpty(getProperties()) ? null :
122132
getProperties().stream()

src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BatteryModificationEntity.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ public class BatteryModificationEntity extends InjectionModificationEntity {
6363
})
6464
private FloatModificationEmbedded droop;
6565

66+
@Embedded
67+
@AttributeOverrides(value = {@AttributeOverride(name = "value", column = @Column(name = "directTransX")), @AttributeOverride(name = "opType", column = @Column(name = "directTransxOp"))
68+
})
69+
private DoubleModificationEmbedded directTransX;
70+
71+
@Embedded
72+
@AttributeOverrides(value = {@AttributeOverride(name = "value", column = @Column(name = "stepUpTransformerX")), @AttributeOverride(name = "opType", column = @Column(name = "stepUpTransformerxOp"))
73+
})
74+
private DoubleModificationEmbedded stepUpTransformerX;
75+
6676
@Embedded
6777
@AttributeOverrides(value = {@AttributeOverride(name = "value", column = @Column(name = "minQ")), @AttributeOverride(name = "opType", column = @Column(name = "minqOp"))
6878
})
@@ -102,6 +112,8 @@ private void assignAttributes(BatteryModificationInfos batteryModificationInfos)
102112
this.maxQ = batteryModificationInfos.getMaxQ() != null ? new DoubleModificationEmbedded(batteryModificationInfos.getMaxQ()) : null;
103113
this.participate = batteryModificationInfos.getParticipate() != null ? new BooleanModificationEmbedded(batteryModificationInfos.getParticipate()) : null;
104114
this.droop = batteryModificationInfos.getDroop() != null ? new FloatModificationEmbedded(batteryModificationInfos.getDroop()) : null;
115+
this.directTransX = batteryModificationInfos.getDirectTransX() != null ? new DoubleModificationEmbedded(batteryModificationInfos.getDirectTransX()) : null;
116+
this.stepUpTransformerX = batteryModificationInfos.getStepUpTransformerX() != null ? new DoubleModificationEmbedded(batteryModificationInfos.getStepUpTransformerX()) : null;
105117
this.reactiveCapabilityCurve = batteryModificationInfos.getReactiveCapabilityCurve() != null ? new BooleanModificationEmbedded(batteryModificationInfos.getReactiveCapabilityCurve()) : null;
106118
this.reactiveCapabilityCurvePoints = toEmbeddablePoints(batteryModificationInfos.getReactiveCapabilityCurvePoints());
107119
}
@@ -134,6 +146,8 @@ public BatteryModificationInfos toModificationInfos() {
134146
.maxQ(toAttributeModification(getMaxQ()))
135147
.participate(toAttributeModification(getParticipate()))
136148
.droop(toAttributeModification(getDroop()))
149+
.directTransX(toAttributeModification(getDirectTransX()))
150+
.stepUpTransformerX(toAttributeModification(getStepUpTransformerX()))
137151
.reactiveCapabilityCurve(toAttributeModification(getReactiveCapabilityCurve()))
138152
.reactiveCapabilityCurvePoints(DTOUtils.toReactiveCapabilityCurvePointsModificationInfos(getReactiveCapabilityCurvePoints()))
139153
// properties

src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BranchModificationEntity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public class BranchModificationEntity extends BasicEquipmentModificationEntity {
4747
@OrderColumn(name = "pos_operationalLimitsGroups")
4848
private List<OperationalLimitsGroupModificationEntity> operationalLimitsGroups;
4949

50+
@Column(name = "enable_olg_modification", columnDefinition = "boolean default true")
51+
private Boolean enableOLGModification;
52+
5053
@Embedded
5154
@AttributeOverrides(value = {
5255
@AttributeOverride(name = "value", column = @Column(name = "selectedOperationalLimitsGroupId1")),
@@ -217,6 +220,7 @@ private void assignAttributes(BranchModificationInfos branchModificationInfos) {
217220
x = new DoubleModificationEmbedded(branchModificationInfos.getX());
218221
r = new DoubleModificationEmbedded(branchModificationInfos.getR());
219222
this.operationalLimitsGroups = assignOperationalLimitsGroups(branchModificationInfos.getOperationalLimitsGroups(), operationalLimitsGroups);
223+
this.enableOLGModification = branchModificationInfos.getEnableOLGModification() == null || branchModificationInfos.getEnableOLGModification();
220224
this.voltageLevelId1 = branchModificationInfos.getVoltageLevelId1() != null ? new StringModificationEmbedded(branchModificationInfos.getVoltageLevelId1()) : null;
221225
this.voltageLevelId2 = branchModificationInfos.getVoltageLevelId2() != null ? new StringModificationEmbedded(branchModificationInfos.getVoltageLevelId2()) : null;
222226
this.busOrBusbarSectionId1 = branchModificationInfos.getBusOrBusbarSectionId1() != null ? new StringModificationEmbedded(branchModificationInfos.getBusOrBusbarSectionId1()) : null;

src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LineModificationEntity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public LineModificationInfos toModificationInfos() {
9696
.connectionName2(toAttributeModification(getConnectionName2()))
9797
.selectedOperationalLimitsGroup1(toAttributeModification(getSelectedOperationalLimitsGroupId1()))
9898
.selectedOperationalLimitsGroup2(toAttributeModification(getSelectedOperationalLimitsGroupId2()))
99+
.enableOLGModification(getEnableOLGModification())
99100
.connectionDirection1(toAttributeModification(getConnectionDirection1()))
100101
.connectionDirection2(toAttributeModification(getConnectionDirection2()))
101102
.connectionPosition1(toAttributeModification(getConnectionPosition1()))
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/**
2+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
3+
* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
*/
7+
package org.gridsuite.modification.server.entities.equipment.modification;
8+
9+
import com.powsybl.iidm.network.extensions.ConnectablePosition;
10+
import io.swagger.v3.oas.annotations.media.Schema;
11+
import jakarta.persistence.Column;
12+
import jakarta.persistence.Embeddable;
13+
import lombok.AllArgsConstructor;
14+
import lombok.Getter;
15+
import lombok.NoArgsConstructor;
16+
import org.gridsuite.modification.dto.MoveFeederBayInfos;
17+
18+
/**
19+
* @author Etienne Lesot <etienne.lesot at rte-france.com>
20+
*/
21+
@NoArgsConstructor
22+
@AllArgsConstructor
23+
@Getter
24+
@Embeddable
25+
public class MoveFeederBayEmbeddable {
26+
@Column(name = "equipment_id")
27+
private String equipmentId;
28+
29+
@Column(name = "busbar_section_id")
30+
private String busbarSectionId;
31+
32+
@Schema(description = "connection_side")
33+
private String connectionSide;
34+
35+
@Schema(description = "connection_position")
36+
private Integer connectionPosition;
37+
38+
@Schema(description = "connection_name")
39+
private String connectionName;
40+
41+
@Schema(description = "connection_direction")
42+
private ConnectablePosition.Direction connectionDirection;
43+
44+
MoveFeederBayInfos toConnectablePositionModificationInfos() {
45+
return MoveFeederBayInfos.builder()
46+
.equipmentId(equipmentId)
47+
.busbarSectionId(busbarSectionId)
48+
.connectionSide(connectionSide)
49+
.connectionPosition(connectionPosition)
50+
.connectionName(connectionName)
51+
.connectionDirection(connectionDirection)
52+
.build();
53+
}
54+
55+
static MoveFeederBayEmbeddable toConnectablePositionModificationEmbeddable(MoveFeederBayInfos moveFeederBayInfos) {
56+
return new MoveFeederBayEmbeddable(moveFeederBayInfos.getEquipmentId(),
57+
moveFeederBayInfos.getBusbarSectionId(),
58+
moveFeederBayInfos.getConnectionSide(),
59+
moveFeederBayInfos.getConnectionPosition(),
60+
moveFeederBayInfos.getConnectionName(),
61+
moveFeederBayInfos.getConnectionDirection());
62+
}
63+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/**
2+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
3+
* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
*/
7+
package org.gridsuite.modification.server.entities.equipment.modification;
8+
9+
import jakarta.persistence.*;
10+
import lombok.Getter;
11+
import lombok.NoArgsConstructor;
12+
import lombok.NonNull;
13+
import org.gridsuite.modification.dto.ModificationInfos;
14+
import org.gridsuite.modification.dto.MoveVoltageLevelFeederBaysInfos;
15+
import org.gridsuite.modification.server.entities.ModificationEntity;
16+
17+
import java.util.ArrayList;
18+
import java.util.List;
19+
20+
/**
21+
* @author Etienne Lesot <etienne.lesot at rte-france.com>
22+
*/
23+
@NoArgsConstructor
24+
@Getter
25+
@Entity
26+
@Table(name = "move_voltage_level_feeder_bays")
27+
@PrimaryKeyJoinColumn(name = "id", foreignKey = @ForeignKey(name = "move_voltage_level_feeder_bays_id_fk_constraint"))
28+
public class MoveVoltageLevelFeederBaysEntity extends ModificationEntity {
29+
30+
@Column(name = "voltage_level_id")
31+
private String voltageLevelId;
32+
33+
@ElementCollection
34+
@CollectionTable(
35+
name = "move_feeder_bay",
36+
joinColumns = @JoinColumn(name = "modification_id"),
37+
foreignKey = @ForeignKey(name = "move_feeder_bay_modification_id_fk_constraint")
38+
)
39+
private List<MoveFeederBayEmbeddable> moveFeederBays;
40+
41+
public MoveVoltageLevelFeederBaysEntity(MoveVoltageLevelFeederBaysInfos moveVoltageLevelFeederBaysInfos) {
42+
super(moveVoltageLevelFeederBaysInfos);
43+
assignAttributes(moveVoltageLevelFeederBaysInfos);
44+
}
45+
46+
@Override
47+
public void update(@NonNull ModificationInfos modificationInfos) {
48+
super.update(modificationInfos);
49+
assignAttributes((MoveVoltageLevelFeederBaysInfos) modificationInfos);
50+
}
51+
52+
private void assignAttributes(MoveVoltageLevelFeederBaysInfos moveVoltageLevelFeederBaysInfos) {
53+
if (this.moveFeederBays == null) {
54+
this.moveFeederBays = new ArrayList<>();
55+
} else {
56+
this.moveFeederBays.clear();
57+
}
58+
this.voltageLevelId = moveVoltageLevelFeederBaysInfos.getVoltageLevelId();
59+
this.moveFeederBays.addAll(moveVoltageLevelFeederBaysInfos.getFeederBays().stream()
60+
.map(MoveFeederBayEmbeddable::toConnectablePositionModificationEmbeddable)
61+
.toList());
62+
}
63+
64+
@Override
65+
public MoveVoltageLevelFeederBaysInfos toModificationInfos() {
66+
return toMoveVoltageLevelFeederBaysInfosBuilder().build();
67+
}
68+
69+
private MoveVoltageLevelFeederBaysInfos.MoveVoltageLevelFeederBaysInfosBuilder<?, ?> toMoveVoltageLevelFeederBaysInfosBuilder() {
70+
return MoveVoltageLevelFeederBaysInfos.builder()
71+
.uuid(getId())
72+
.date(getDate())
73+
.stashed(getStashed())
74+
.activated(getActivated())
75+
.voltageLevelId(voltageLevelId)
76+
.feederBays(moveFeederBays.stream()
77+
.map(MoveFeederBayEmbeddable::toConnectablePositionModificationInfos).toList());
78+
}
79+
}

0 commit comments

Comments
 (0)