From 82bc06a4cf84bbdd4428f3531a4b59784fb9c6ee Mon Sep 17 00:00:00 2001 From: Ghazoua Rehili Date: Fri, 20 Dec 2024 22:08:32 +0100 Subject: [PATCH] enhance diagram PQ (#579) Signed-off-by: Rehili Ghazwa --- pom.xml | 2 +- .../modification/server/dto/DTOUtils.java | 23 +++++++---- .../creation/BatteryCreationEntity.java | 26 +++--------- .../ConverterStationCreationEntity.java | 41 +++---------------- .../creation/GeneratorCreationEntity.java | 23 ++--------- ...tiveCapabilityCurveCreationEmbeddable.java | 17 +++++++- .../BatteryModificationEntity.java | 17 ++------ .../ConverterStationModificationEntity.java | 17 +++----- .../GeneratorModificationEntity.java | 27 ++++-------- ...CapabilityCurveModificationEmbeddable.java | 24 ++++++----- .../changesets/changelog_20241216T142706Z.xml | 39 ++++++++++++++++++ .../changesets/changelog_20241219T103410Z.xml | 38 +++++++++++++++++ ...CapabilityCurvePoints_20241219T103410Z.sql | 18 ++++++++ .../db/changelog/db.changelog-master.yaml | 12 ++++-- .../BatteryCreationInBusBreakerTest.java | 10 ++--- .../BatteryCreationInNodeBreakerTest.java | 8 ++-- .../BatteryModificationTest.java | 11 +++-- .../GeneratorCreationInBusBreakerTest.java | 10 ++--- .../GeneratorCreationInNodeBreakerTest.java | 8 ++-- .../GeneratorModificationTest.java | 9 ++-- .../modifications/ModificationUtilsTest.java | 14 +++---- .../server/modifications/VscCreationTest.java | 6 +-- .../modifications/VscModificationTest.java | 6 +-- ...mpensatorModificationByAssignmentTest.java | 4 +- ...tCompensatorByFormulaModificationTest.java | 8 ++-- .../TabularGeneratorCreationsTest.java | 20 ++++----- .../TabularGeneratorModificationsTest.java | 6 +-- .../service/ModificationRepositoryTest.java | 2 +- .../server/utils/ModificationCreation.java | 8 ++-- 29 files changed, 244 insertions(+), 210 deletions(-) create mode 100644 src/main/resources/db/changelog/changesets/changelog_20241216T142706Z.xml create mode 100644 src/main/resources/db/changelog/changesets/changelog_20241219T103410Z.xml create mode 100644 src/main/resources/db/changelog/changesets/migrationReactiveCapabilityCurvePoints_20241219T103410Z.sql diff --git a/pom.xml b/pom.xml index 97f501143..f96204df0 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@ 5.0.0-alpha.14 org.gridsuite.modification.server **/migration/**/* - 0.2.0 + 0.4.0 1.0.16 diff --git a/src/main/java/org/gridsuite/modification/server/dto/DTOUtils.java b/src/main/java/org/gridsuite/modification/server/dto/DTOUtils.java index ef80cdc35..43fd6ebf3 100644 --- a/src/main/java/org/gridsuite/modification/server/dto/DTOUtils.java +++ b/src/main/java/org/gridsuite/modification/server/dto/DTOUtils.java @@ -6,11 +6,13 @@ */ package org.gridsuite.modification.server.dto; -import org.gridsuite.modification.dto.ReactiveCapabilityCurveModificationInfos; +import org.gridsuite.modification.dto.ReactiveCapabilityCurvePointsInfos; +import org.gridsuite.modification.server.entities.equipment.creation.ReactiveCapabilityCurveCreationEmbeddable; import org.gridsuite.modification.server.entities.equipment.modification.ReactiveCapabilityCurveModificationEmbeddable; import org.springframework.util.CollectionUtils; import java.util.List; +import java.util.Objects; /** * @author jamal kheyyad @@ -19,12 +21,19 @@ public final class DTOUtils { private DTOUtils() { } - public static List convertToReactiveCapabilityCurveModificationInfos(List rCCpoints) { - return CollectionUtils.isEmpty(rCCpoints) ? null : rCCpoints - .stream() - .map(value -> new ReactiveCapabilityCurveModificationInfos(value.getMinQ(), value.getOldMinQ(), - value.getMaxQ(), value.getOldMaxQ(), - value.getP(), value.getOldP())) + public static List toReactiveCapabilityCurvePointsCreationInfos(List rCCpoints) { + return Objects.isNull(rCCpoints) || CollectionUtils.isEmpty(rCCpoints) ? null + : rCCpoints.stream().map(point -> new ReactiveCapabilityCurvePointsInfos(point.getMinQ(), + point.getMaxQ(), + point.getP())) + .toList(); + } + + public static List toReactiveCapabilityCurvePointsModificationInfos(List rCCpoints) { + return Objects.isNull(rCCpoints) || CollectionUtils.isEmpty(rCCpoints) ? null + : rCCpoints.stream().map(point -> new ReactiveCapabilityCurvePointsInfos(point.getMinQ(), + point.getMaxQ(), + point.getP())) .toList(); } } diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/BatteryCreationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/BatteryCreationEntity.java index db2fe339b..f2373f76c 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/BatteryCreationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/BatteryCreationEntity.java @@ -6,19 +6,19 @@ */ package org.gridsuite.modification.server.entities.equipment.creation; +import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.NonNull; import org.gridsuite.modification.dto.BatteryCreationInfos; import org.gridsuite.modification.dto.ModificationInfos; -import org.gridsuite.modification.dto.ReactiveCapabilityCurveCreationInfos; - -import jakarta.persistence.*; +import org.gridsuite.modification.server.dto.DTOUtils; import org.gridsuite.modification.server.entities.equipment.modification.FreePropertyEntity; import org.springframework.util.CollectionUtils; import java.util.List; -import java.util.stream.Collectors; + +import static org.gridsuite.modification.server.entities.equipment.creation.ReactiveCapabilityCurveCreationEmbeddable.toEmbeddablePoints; /** * @author Ghazwa Rehili @@ -85,28 +85,12 @@ private void assignAttributes(BatteryCreationInfos batteryCreationInfos) { this.droop = batteryCreationInfos.getDroop(); } - public static List toEmbeddablePoints( - List points) { - return points == null ? null : points.stream() - .map(point -> new ReactiveCapabilityCurveCreationEmbeddable(point.getMinQ(), - point.getMaxQ(), - point.getP())) - .collect(Collectors.toList()); - } - @Override public BatteryCreationInfos toModificationInfos() { return toBatteryCreationInfosBuilder().build(); } private BatteryCreationInfos.BatteryCreationInfosBuilder toBatteryCreationInfosBuilder() { - List points = getReactiveCapabilityCurvePoints() != null ? getReactiveCapabilityCurvePoints() - .stream() - .map(value -> new ReactiveCapabilityCurveCreationInfos(value.getMinQ(), - value.getMaxQ(), - value.getP())) - .collect(Collectors.toList()) : null; - return BatteryCreationInfos .builder() .uuid(getId()) @@ -128,7 +112,7 @@ public BatteryCreationInfos toModificationInfos() { .reactiveCapabilityCurve(this.getReactiveCapabilityCurve()) .minQ(this.getMinQ()) .maxQ(this.getMaxQ()) - .reactiveCapabilityCurvePoints(points) + .reactiveCapabilityCurvePoints(DTOUtils.toReactiveCapabilityCurvePointsCreationInfos(getReactiveCapabilityCurvePoints())) .targetP(getTargetP()) .targetQ(getTargetQ()) .participate(getParticipate()) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ConverterStationCreationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ConverterStationCreationEntity.java index d2a616b21..577964b45 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ConverterStationCreationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ConverterStationCreationEntity.java @@ -7,23 +7,17 @@ package org.gridsuite.modification.server.entities.equipment.creation; +import jakarta.persistence.*; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import org.gridsuite.modification.dto.ConverterStationCreationInfos; -import org.gridsuite.modification.dto.ReactiveCapabilityCurveCreationInfos; - -import jakarta.persistence.CollectionTable; -import jakarta.persistence.Column; -import jakarta.persistence.ElementCollection; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.Table; +import org.gridsuite.modification.server.dto.DTOUtils; + import java.util.List; import java.util.UUID; -import java.util.stream.Collectors; + +import static org.gridsuite.modification.server.entities.equipment.creation.ReactiveCapabilityCurveCreationEmbeddable.toEmbeddablePoints; /** * @author Seddik Yengui @@ -101,31 +95,8 @@ public ConverterStationCreationInfos toConverterStationInfos() { .reactivePowerSetpoint(getReactivePowerSetpoint()) .voltageRegulationOn(getVoltageRegulationOn()) .voltageSetpoint(getVoltageSetpoint()) - .reactiveCapabilityCurvePoints(toReactiveCapabilityCurveInfos(getReactiveCapabilityCurvePoints())) + .reactiveCapabilityCurvePoints(DTOUtils.toReactiveCapabilityCurvePointsCreationInfos(getReactiveCapabilityCurvePoints())) .reactiveCapabilityCurve(getReactiveCapabilityCurve()) .build(); } - - private static List toEmbeddablePoints( - List points) { - return points == null ? null : points.stream() - .map(point -> new ReactiveCapabilityCurveCreationEmbeddable(point.getMinQ(), - point.getMaxQ(), - point.getP())) - .collect(Collectors.toList()); - } - - private static List toReactiveCapabilityCurveInfos(List pointsEmbeddable) { - if (pointsEmbeddable == null) { - return null; - } - - return pointsEmbeddable.stream() - .map(pointEmbeddable -> ReactiveCapabilityCurveCreationInfos.builder() - .p(pointEmbeddable.getP()) - .maxQ(pointEmbeddable.getMaxQ()) - .minQ(pointEmbeddable.getMinQ()) - .build()) - .collect(Collectors.toList()); - } } diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/GeneratorCreationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/GeneratorCreationEntity.java index f9a0b0add..0a4e7d848 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/GeneratorCreationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/GeneratorCreationEntity.java @@ -13,12 +13,13 @@ import lombok.NonNull; import org.gridsuite.modification.dto.GeneratorCreationInfos; import org.gridsuite.modification.dto.ModificationInfos; -import org.gridsuite.modification.dto.ReactiveCapabilityCurveCreationInfos; +import org.gridsuite.modification.server.dto.DTOUtils; import org.gridsuite.modification.server.entities.equipment.modification.FreePropertyEntity; import org.springframework.util.CollectionUtils; import java.util.List; -import java.util.stream.Collectors; + +import static org.gridsuite.modification.server.entities.equipment.creation.ReactiveCapabilityCurveCreationEmbeddable.toEmbeddablePoints; /** * @author Franck Lecuyer @@ -140,28 +141,12 @@ private void assignAttributes(GeneratorCreationInfos generatorCreationInfos) { this.reactiveCapabilityCurve = generatorCreationInfos.getReactiveCapabilityCurve(); } - public static List toEmbeddablePoints( - List points) { - return points == null ? null : points.stream() - .map(point -> new ReactiveCapabilityCurveCreationEmbeddable(point.getMinQ(), - point.getMaxQ(), - point.getP())) - .collect(Collectors.toList()); - } - @Override public GeneratorCreationInfos toModificationInfos() { return toGeneratorCreationInfosBuilder().build(); } private GeneratorCreationInfos.GeneratorCreationInfosBuilder toGeneratorCreationInfosBuilder() { - List points = getReactiveCapabilityCurvePoints() != null ? getReactiveCapabilityCurvePoints() - .stream() - .map(value -> new ReactiveCapabilityCurveCreationInfos(value.getMinQ(), - value.getMaxQ(), - value.getP())) - .collect(Collectors.toList()) : null; - return GeneratorCreationInfos .builder() .uuid(getId()) @@ -194,7 +179,7 @@ public GeneratorCreationInfos toModificationInfos() { .participate(getParticipate()) .droop(getDroop()) .maxQ(this.getMaxQ()) - .reactiveCapabilityCurvePoints(points) + .reactiveCapabilityCurvePoints(DTOUtils.toReactiveCapabilityCurvePointsCreationInfos(getReactiveCapabilityCurvePoints())) .regulatingTerminalId(getRegulatingTerminalId()) .regulatingTerminalType(getRegulatingTerminalType()) .regulatingTerminalVlId(getRegulatingTerminalVlId()) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ReactiveCapabilityCurveCreationEmbeddable.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ReactiveCapabilityCurveCreationEmbeddable.java index 264ed689f..d9901150a 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ReactiveCapabilityCurveCreationEmbeddable.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ReactiveCapabilityCurveCreationEmbeddable.java @@ -7,12 +7,16 @@ package org.gridsuite.modification.server.entities.equipment.creation; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; +import org.gridsuite.modification.dto.ReactiveCapabilityCurvePointsInfos; +import org.springframework.util.CollectionUtils; -import jakarta.persistence.Column; -import jakarta.persistence.Embeddable; +import java.util.List; +import java.util.Objects; /** * @author Seddik Yengui @@ -31,4 +35,13 @@ public class ReactiveCapabilityCurveCreationEmbeddable { @Column private Double p; + + public static List toEmbeddablePoints( + List points) { + return Objects.isNull(points) || CollectionUtils.isEmpty(points) ? null + : points.stream() + .map(point -> new ReactiveCapabilityCurveCreationEmbeddable(point.getMinQ(), + point.getMaxQ(), point.getP())) + .toList(); + } } diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BatteryModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BatteryModificationEntity.java index 18d19e1b9..eec86f0c9 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BatteryModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BatteryModificationEntity.java @@ -10,12 +10,10 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.NonNull; - import org.gridsuite.modification.dto.AttributeModification; import org.gridsuite.modification.dto.BatteryModificationInfos; import org.gridsuite.modification.dto.ModificationInfos; -import org.gridsuite.modification.dto.ReactiveCapabilityCurveModificationInfos; -import org.gridsuite.modification.server.dto.*; +import org.gridsuite.modification.server.dto.DTOUtils; import org.gridsuite.modification.server.entities.equipment.modification.attribute.BooleanModificationEmbedded; import org.gridsuite.modification.server.entities.equipment.modification.attribute.DoubleModificationEmbedded; import org.gridsuite.modification.server.entities.equipment.modification.attribute.FloatModificationEmbedded; @@ -23,6 +21,7 @@ import java.util.List; +import static org.gridsuite.modification.server.entities.equipment.modification.ReactiveCapabilityCurveModificationEmbeddable.toEmbeddablePoints; import static org.gridsuite.modification.server.entities.equipment.modification.attribute.IAttributeModificationEmbeddable.toAttributeModification; /** @@ -107,16 +106,6 @@ private void assignAttributes(BatteryModificationInfos batteryModificationInfos) this.reactiveCapabilityCurvePoints = toEmbeddablePoints(batteryModificationInfos.getReactiveCapabilityCurvePoints()); } - public static List toEmbeddablePoints( - List points) { - return points == null ? null - : points.stream() - .map(point -> new ReactiveCapabilityCurveModificationEmbeddable(point.getMinQ(), point.getOldMinQ(), - point.getMaxQ(), point.getOldMaxQ(), point.getP(), - point.getOldP())) - .toList(); - } - @Override public BatteryModificationInfos toModificationInfos() { return toBatteryModificationInfosBuilder().build(); @@ -146,7 +135,7 @@ public BatteryModificationInfos toModificationInfos() { .participate(toAttributeModification(getParticipate())) .droop(toAttributeModification(getDroop())) .reactiveCapabilityCurve(toAttributeModification(getReactiveCapabilityCurve())) - .reactiveCapabilityCurvePoints(DTOUtils.convertToReactiveCapabilityCurveModificationInfos(getReactiveCapabilityCurvePoints())) + .reactiveCapabilityCurvePoints(DTOUtils.toReactiveCapabilityCurvePointsModificationInfos(getReactiveCapabilityCurvePoints())) // properties .properties(CollectionUtils.isEmpty(getProperties()) ? null : getProperties().stream() diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ConverterStationModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ConverterStationModificationEntity.java index 39d3c82ab..64d42180b 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ConverterStationModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ConverterStationModificationEntity.java @@ -11,7 +11,9 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.NonNull; -import org.gridsuite.modification.dto.*; +import org.gridsuite.modification.dto.AttributeModification; +import org.gridsuite.modification.dto.ConverterStationModificationInfos; +import org.gridsuite.modification.dto.ModificationInfos; import org.gridsuite.modification.server.dto.DTOUtils; import org.gridsuite.modification.server.entities.equipment.modification.attribute.BooleanModificationEmbedded; import org.gridsuite.modification.server.entities.equipment.modification.attribute.DoubleModificationEmbedded; @@ -19,6 +21,7 @@ import java.util.List; +import static org.gridsuite.modification.server.entities.equipment.modification.ReactiveCapabilityCurveModificationEmbeddable.toEmbeddablePoints; import static org.gridsuite.modification.server.entities.equipment.modification.attribute.IAttributeModificationEmbeddable.toAttributeModification; /** @@ -94,16 +97,6 @@ private void assignAttributes(ConverterStationModificationInfos converterStation } - public static List toEmbeddablePoints( - List points) { - return points == null ? null - : points.stream() - .map(point -> new ReactiveCapabilityCurveModificationEmbeddable(point.getMinQ(), point.getOldMinQ(), - point.getMaxQ(), point.getOldMaxQ(), point.getP(), - point.getOldP())) - .toList(); - } - @Override public ConverterStationModificationInfos toModificationInfos() { return toConverterStationModificationInfoBuilder().build(); @@ -125,6 +118,6 @@ public ConverterStationModificationInfos toModificationInfos() { .voltageRegulationOn(toAttributeModification(getVoltageRegulationOn())) .voltageSetpoint(toAttributeModification(getVoltageSetpoint())) .reactiveCapabilityCurve(toAttributeModification(getReactiveCapabilityCurve())) - .reactiveCapabilityCurvePoints(DTOUtils.convertToReactiveCapabilityCurveModificationInfos(getReactiveCapabilityCurvePoints())); + .reactiveCapabilityCurvePoints(DTOUtils.toReactiveCapabilityCurvePointsModificationInfos(getReactiveCapabilityCurvePoints())); } } diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GeneratorModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GeneratorModificationEntity.java index bbf1a795b..0cd0f2bf8 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GeneratorModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GeneratorModificationEntity.java @@ -11,13 +11,17 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.NonNull; -import org.gridsuite.modification.dto.*; +import org.gridsuite.modification.dto.AttributeModification; +import org.gridsuite.modification.dto.GeneratorModificationInfos; +import org.gridsuite.modification.dto.ModificationInfos; +import org.gridsuite.modification.dto.VoltageRegulationType; +import org.gridsuite.modification.server.dto.DTOUtils; import org.gridsuite.modification.server.entities.equipment.modification.attribute.*; import org.springframework.util.CollectionUtils; import java.util.List; -import java.util.stream.Collectors; +import static org.gridsuite.modification.server.entities.equipment.modification.ReactiveCapabilityCurveModificationEmbeddable.toEmbeddablePoints; import static org.gridsuite.modification.server.entities.equipment.modification.attribute.IAttributeModificationEmbeddable.toAttributeModification; @@ -241,29 +245,12 @@ private void assignAttributes(GeneratorModificationInfos generatorModificationIn this.reactiveCapabilityCurvePoints = toEmbeddablePoints(generatorModificationInfos.getReactiveCapabilityCurvePoints()); } - public static List toEmbeddablePoints( - List points) { - return points == null ? null - : points.stream() - .map(point -> new ReactiveCapabilityCurveModificationEmbeddable(point.getMinQ(), point.getOldMinQ(), - point.getMaxQ(), point.getOldMaxQ(), point.getP(), - point.getOldP())) - .collect(Collectors.toList()); - } - @Override public GeneratorModificationInfos toModificationInfos() { return toGeneratorModificationInfosBuilder().build(); } private GeneratorModificationInfos.GeneratorModificationInfosBuilder toGeneratorModificationInfosBuilder() { - List pointsEmbeddable = !CollectionUtils.isEmpty(reactiveCapabilityCurvePoints) ? reactiveCapabilityCurvePoints : null; - List points = pointsEmbeddable != null ? getReactiveCapabilityCurvePoints() - .stream() - .map(value -> new ReactiveCapabilityCurveModificationInfos(value.getMinQ(), value.getOldMinQ(), - value.getMaxQ(), value.getOldMaxQ(), - value.getP(), value.getOldP())) - .collect(Collectors.toList()) : null; return GeneratorModificationInfos .builder() .uuid(getId()) @@ -302,7 +289,7 @@ public GeneratorModificationInfos toModificationInfos() { .regulatingTerminalVlId(toAttributeModification(getRegulatingTerminalVlId())) .qPercent(toAttributeModification(getQPercent())) .reactiveCapabilityCurve(toAttributeModification(getReactiveCapabilityCurve())) - .reactiveCapabilityCurvePoints(points) + .reactiveCapabilityCurvePoints(DTOUtils.toReactiveCapabilityCurvePointsModificationInfos(getReactiveCapabilityCurvePoints())) // properties .properties(CollectionUtils.isEmpty(getProperties()) ? null : getProperties().stream() diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ReactiveCapabilityCurveModificationEmbeddable.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ReactiveCapabilityCurveModificationEmbeddable.java index e985b3738..1693d57f3 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ReactiveCapabilityCurveModificationEmbeddable.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ReactiveCapabilityCurveModificationEmbeddable.java @@ -7,12 +7,16 @@ package org.gridsuite.modification.server.entities.equipment.modification; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; +import org.gridsuite.modification.dto.ReactiveCapabilityCurvePointsInfos; +import org.springframework.util.CollectionUtils; -import jakarta.persistence.Column; -import jakarta.persistence.Embeddable; +import java.util.List; +import java.util.Objects; /** * @author Ayoub LABIDI @@ -25,18 +29,18 @@ public class ReactiveCapabilityCurveModificationEmbeddable { @Column private Double minQ; - @Column - private Double oldMinQ; - @Column private Double maxQ; - @Column - private Double oldMaxQ; - @Column private Double p; - @Column - private Double oldP; + public static List toEmbeddablePoints( + List points) { + return Objects.isNull(points) || CollectionUtils.isEmpty(points) ? null + : points.stream() + .map(point -> new ReactiveCapabilityCurveModificationEmbeddable(point.getMinQ(), + point.getMaxQ(), point.getP())) + .toList(); + } } diff --git a/src/main/resources/db/changelog/changesets/changelog_20241216T142706Z.xml b/src/main/resources/db/changelog/changesets/changelog_20241216T142706Z.xml new file mode 100644 index 000000000..d5d2be4f8 --- /dev/null +++ b/src/main/resources/db/changelog/changesets/changelog_20241216T142706Z.xml @@ -0,0 +1,39 @@ + + + + + + edited_field='MAXIMUM_Q_AT_NOMINAL_VOLTAGE' + + + + edited_field='MAXIMUM_SUSCEPTANCE' + + + + + + edited_field='MAXIMUM_Q_AT_NOMINAL_VOLTAGE' + + + + equipment_field1='MAXIMUM_Q_AT_NOMINAL_VOLTAGE' + + + + equipment_field2='MAXIMUM_Q_AT_NOMINAL_VOLTAGE' + + + + edited_field='MAXIMUM_SUSCEPTANCE' + + + + equipment_field1='MAXIMUM_SUSCEPTANCE' + + + + equipment_field2='MAXIMUM_SUSCEPTANCE' + + + diff --git a/src/main/resources/db/changelog/changesets/changelog_20241219T103410Z.xml b/src/main/resources/db/changelog/changesets/changelog_20241219T103410Z.xml new file mode 100644 index 000000000..0e594fa43 --- /dev/null +++ b/src/main/resources/db/changelog/changesets/changelog_20241219T103410Z.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/db/changelog/changesets/migrationReactiveCapabilityCurvePoints_20241219T103410Z.sql b/src/main/resources/db/changelog/changesets/migrationReactiveCapabilityCurvePoints_20241219T103410Z.sql new file mode 100644 index 000000000..4c84c5326 --- /dev/null +++ b/src/main/resources/db/changelog/changesets/migrationReactiveCapabilityCurvePoints_20241219T103410Z.sql @@ -0,0 +1,18 @@ +UPDATE generator_modification_entity_reactive_capability_curve_points +SET + p = coalesce(generator_modification_entity_reactive_capability_curve_points.p, oldp), + maxq = coalesce(generator_modification_entity_reactive_capability_curve_points.maxq, old_maxq), + minq = coalesce(generator_modification_entity_reactive_capability_curve_points.minq, old_minq); + +UPDATE battery_modification_entity_reactive_capability_curve_points +SET + p = coalesce(battery_modification_entity_reactive_capability_curve_points.p, oldp), + maxq = coalesce(battery_modification_entity_reactive_capability_curve_points.maxq, old_maxq), + minq = coalesce(battery_modification_entity_reactive_capability_curve_points.minq, old_minq); + +UPDATE converter_station_modification_rcc_points +SET + p = coalesce(converter_station_modification_rcc_points.p, oldp), + maxq = coalesce(converter_station_modification_rcc_points.maxq, old_maxq), + minq = coalesce(converter_station_modification_rcc_points.minq, old_minq); + diff --git a/src/main/resources/db/changelog/db.changelog-master.yaml b/src/main/resources/db/changelog/db.changelog-master.yaml index 6f2ec9372..1ce2b8e85 100644 --- a/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/src/main/resources/db/changelog/db.changelog-master.yaml @@ -313,11 +313,17 @@ databaseChangeLog: file: changesets/changelog_20240912T100256Z.xml relativeToChangelogFile: true - include: - relativeToChangelogFile: true file: changesets/changelog_20240912T130742Z.xml - - include: relativeToChangelogFile: true + - include: file: changesets/changelog_20241015T130742Z.xml + relativeToChangelogFile: true - include: + file: changesets/changelog_20241206T123930Z.xml relativeToChangelogFile: true - file: changesets/changelog_20241206T123930Z.xml \ No newline at end of file + - include: + file: changesets/changelog_20241216T142706Z.xml + relativeToChangelogFile: true + - include: + file: changesets/changelog_20241219T103410Z.xml + relativeToChangelogFile: true \ No newline at end of file diff --git a/src/test/java/org/gridsuite/modification/server/modifications/BatteryCreationInBusBreakerTest.java b/src/test/java/org/gridsuite/modification/server/modifications/BatteryCreationInBusBreakerTest.java index 23fe29a3f..262a83698 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/BatteryCreationInBusBreakerTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/BatteryCreationInBusBreakerTest.java @@ -13,7 +13,7 @@ import org.gridsuite.modification.dto.BatteryCreationInfos; import org.gridsuite.modification.dto.FreePropertyInfos; import org.gridsuite.modification.dto.ModificationInfos; -import org.gridsuite.modification.dto.ReactiveCapabilityCurveCreationInfos; +import org.gridsuite.modification.dto.ReactiveCapabilityCurvePointsInfos; import org.gridsuite.modification.server.utils.NetworkCreation; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -57,8 +57,8 @@ protected ModificationInfos buildModification() { .droop(5f) .participate(true) .reactiveCapabilityCurve(true) - .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurveCreationInfos(2.0, 3.0, 3.1), - new ReactiveCapabilityCurveCreationInfos(5.6, 9.8, 10.8))) + .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurvePointsInfos(2.0, 3.0, 3.1), + new ReactiveCapabilityCurvePointsInfos(5.6, 9.8, 10.8))) .connectionName("top") .connectionDirection(ConnectablePosition.Direction.TOP) .properties(List.of(FreePropertyInfos.builder().name(PROPERTY_NAME).value(PROPERTY_VALUE).build())) @@ -82,8 +82,8 @@ protected ModificationInfos buildModificationUpdate() { .droop(6f) .participate(true) .reactiveCapabilityCurve(true) - .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurveCreationInfos(1.0, 2.0, 2.1), - new ReactiveCapabilityCurveCreationInfos(6.6, 8.8, 11.8))) + .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurvePointsInfos(1.0, 2.0, 2.1), + new ReactiveCapabilityCurvePointsInfos(6.6, 8.8, 11.8))) .connectionName("top") .connectionDirection(ConnectablePosition.Direction.TOP) .build(); diff --git a/src/test/java/org/gridsuite/modification/server/modifications/BatteryCreationInNodeBreakerTest.java b/src/test/java/org/gridsuite/modification/server/modifications/BatteryCreationInNodeBreakerTest.java index 15aed2c83..05ac96333 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/BatteryCreationInNodeBreakerTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/BatteryCreationInNodeBreakerTest.java @@ -54,8 +54,8 @@ protected ModificationInfos buildModification() { .droop(5f) .participate(true) .reactiveCapabilityCurve(true) - .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurveCreationInfos(2.0, 3.0, 3.1), - new ReactiveCapabilityCurveCreationInfos(5.6, 9.8, 10.8))) + .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurvePointsInfos(2.0, 3.0, 3.1), + new ReactiveCapabilityCurvePointsInfos(5.6, 9.8, 10.8))) .connectionName("top") .connectionDirection(ConnectablePosition.Direction.TOP) .properties(List.of(FreePropertyInfos.builder().name(PROPERTY_NAME).value(PROPERTY_VALUE).build())) @@ -79,8 +79,8 @@ protected ModificationInfos buildModificationUpdate() { .droop(6f) .participate(true) .reactiveCapabilityCurve(true) - .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurveCreationInfos(1.0, 2.0, 2.1), - new ReactiveCapabilityCurveCreationInfos(6.6, 8.8, 11.8))) + .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurvePointsInfos(1.0, 2.0, 2.1), + new ReactiveCapabilityCurvePointsInfos(6.6, 8.8, 11.8))) .connectionName("top") .connectionDirection(ConnectablePosition.Direction.TOP) .build(); diff --git a/src/test/java/org/gridsuite/modification/server/modifications/BatteryModificationTest.java b/src/test/java/org/gridsuite/modification/server/modifications/BatteryModificationTest.java index 90c0f4bbf..c87a5ab65 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/BatteryModificationTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/BatteryModificationTest.java @@ -57,8 +57,8 @@ protected ModificationInfos buildModification() { .minQ(new AttributeModification<>(-100., OperationType.SET)) .maxP(new AttributeModification<>(100., OperationType.SET)) .reactiveCapabilityCurvePoints(List.of( - new ReactiveCapabilityCurveModificationInfos(0., 0., 100., 100., 0., 0.1), - new ReactiveCapabilityCurveModificationInfos(0., 0., 100., 100., 200., 150.))) + new ReactiveCapabilityCurvePointsInfos(100., 100., 0.1), + new ReactiveCapabilityCurvePointsInfos(100., 100., 150.))) .droop(new AttributeModification<>(0.1f, OperationType.SET)) .participate(new AttributeModification<>(true, OperationType.SET)) .reactiveCapabilityCurve(new AttributeModification<>(true, OperationType.SET)) @@ -94,7 +94,7 @@ protected void assertAfterNetworkModificationCreation() { assertEquals(ReactiveLimitsKind.CURVE, modifiedBattery.getReactiveLimits().getKind()); Collection points = modifiedBattery.getReactiveLimits(ReactiveCapabilityCurve.class).getPoints(); List batteryPoints = new ArrayList<>(points); - List modificationPoints = batteryModificationInfos.getReactiveCapabilityCurvePoints(); + List modificationPoints = batteryModificationInfos.getReactiveCapabilityCurvePoints(); if (!CollectionUtils.isEmpty(points)) { IntStream.range(0, batteryPoints.size()) .forEach(i -> { @@ -300,14 +300,14 @@ void testMinQGreaterThanMaxQ() throws Exception { .add(); Collection points = battery.getReactiveLimits(ReactiveCapabilityCurve.class).getPoints(); List batteryPoints = new ArrayList<>(points); - List modificationPoints = batteryModificationInfos.getReactiveCapabilityCurvePoints(); + List modificationPoints = batteryModificationInfos.getReactiveCapabilityCurvePoints(); AtomicReference maxQ = new AtomicReference<>(Double.NaN); AtomicReference minQ = new AtomicReference<>(Double.NaN); if (!CollectionUtils.isEmpty(points)) { IntStream.range(0, modificationPoints.size()) .forEach(i -> { ReactiveCapabilityCurve.Point oldPoint = batteryPoints.get(i); - ReactiveCapabilityCurveModificationInfos newPoint = modificationPoints.get(i); + ReactiveCapabilityCurvePointsInfos newPoint = modificationPoints.get(i); Double oldMaxQ = Double.NaN; Double oldMinQ = Double.NaN; if (oldPoint != null) { @@ -315,7 +315,6 @@ void testMinQGreaterThanMaxQ() throws Exception { oldMinQ = oldPoint.getMinQ(); } newPoint.setMinQ(300.0); - newPoint.setOldMaxQ(250.0); maxQ.set(newPoint.getMaxQ() != null ? newPoint.getMaxQ() : oldMaxQ); minQ.set(newPoint.getMinQ() != null ? newPoint.getMinQ() : oldMinQ); }); diff --git a/src/test/java/org/gridsuite/modification/server/modifications/GeneratorCreationInBusBreakerTest.java b/src/test/java/org/gridsuite/modification/server/modifications/GeneratorCreationInBusBreakerTest.java index 0c03fc8e8..ab7acccae 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/GeneratorCreationInBusBreakerTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/GeneratorCreationInBusBreakerTest.java @@ -14,7 +14,7 @@ import org.gridsuite.modification.dto.FreePropertyInfos; import org.gridsuite.modification.dto.GeneratorCreationInfos; import org.gridsuite.modification.dto.ModificationInfos; -import org.gridsuite.modification.dto.ReactiveCapabilityCurveCreationInfos; +import org.gridsuite.modification.dto.ReactiveCapabilityCurvePointsInfos; import org.gridsuite.modification.server.utils.NetworkCreation; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -73,8 +73,8 @@ protected ModificationInfos buildModification() { .regulatingTerminalVlId("v1") .qPercent(25.) .reactiveCapabilityCurve(true) - .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurveCreationInfos(2.0, 3.0, 3.1), - new ReactiveCapabilityCurveCreationInfos(5.6, 9.8, 10.8))) + .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurvePointsInfos(2.0, 3.0, 3.1), + new ReactiveCapabilityCurvePointsInfos(5.6, 9.8, 10.8))) .connectionName("top") .connectionDirection(ConnectablePosition.Direction.TOP) .properties(List.of(FreePropertyInfos.builder().name(PROPERTY_NAME).value(PROPERTY_VALUE).build())) @@ -112,8 +112,8 @@ protected ModificationInfos buildModificationUpdate() { .regulatingTerminalVlId("v1") .qPercent(29.) .reactiveCapabilityCurve(true) - .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurveCreationInfos(1.0, 2.0, 2.1), - new ReactiveCapabilityCurveCreationInfos(6.6, 8.8, 11.8))) + .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurvePointsInfos(1.0, 2.0, 2.1), + new ReactiveCapabilityCurvePointsInfos(6.6, 8.8, 11.8))) .connectionName("top") .connectionDirection(ConnectablePosition.Direction.TOP) .build(); diff --git a/src/test/java/org/gridsuite/modification/server/modifications/GeneratorCreationInNodeBreakerTest.java b/src/test/java/org/gridsuite/modification/server/modifications/GeneratorCreationInNodeBreakerTest.java index 742f415c6..78bc1d9ae 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/GeneratorCreationInNodeBreakerTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/GeneratorCreationInNodeBreakerTest.java @@ -69,8 +69,8 @@ protected ModificationInfos buildModification() { .regulatingTerminalVlId("v1") .qPercent(25.) .reactiveCapabilityCurve(true) - .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurveCreationInfos(2.0, 3.0, 3.1), - new ReactiveCapabilityCurveCreationInfos(5.6, 9.8, 10.8))) + .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurvePointsInfos(2.0, 3.0, 3.1), + new ReactiveCapabilityCurvePointsInfos(5.6, 9.8, 10.8))) .connectionName("top") .connectionDirection(ConnectablePosition.Direction.TOP) .properties(List.of(FreePropertyInfos.builder().name(PROPERTY_NAME).value(PROPERTY_VALUE).build())) @@ -108,8 +108,8 @@ protected ModificationInfos buildModificationUpdate() { .regulatingTerminalVlId("v1") .qPercent(29.) .reactiveCapabilityCurve(true) - .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurveCreationInfos(1.0, 2.0, 2.1), - new ReactiveCapabilityCurveCreationInfos(6.6, 8.8, 11.8))) + .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurvePointsInfos(1.0, 2.0, 2.1), + new ReactiveCapabilityCurvePointsInfos(6.6, 8.8, 11.8))) .connectionName("top") .connectionDirection(ConnectablePosition.Direction.TOP) .build(); diff --git a/src/test/java/org/gridsuite/modification/server/modifications/GeneratorModificationTest.java b/src/test/java/org/gridsuite/modification/server/modifications/GeneratorModificationTest.java index e051a379e..ba20bec50 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/GeneratorModificationTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/GeneratorModificationTest.java @@ -68,8 +68,8 @@ protected ModificationInfos buildModification() { .minQ(new AttributeModification<>(-100., OperationType.SET)) .maxQ(new AttributeModification<>(100., OperationType.SET)) .reactiveCapabilityCurvePoints(List.of( - new ReactiveCapabilityCurveModificationInfos(0., 0., 100., 100., 0., 0.1), - new ReactiveCapabilityCurveModificationInfos(0., 0., 100., 100., 200., 150.))) + new ReactiveCapabilityCurvePointsInfos(100., 100., 0.1), + new ReactiveCapabilityCurvePointsInfos(100., 100., 150.))) .droop(new AttributeModification<>(0.1f, OperationType.SET)) .participate(new AttributeModification<>(true, OperationType.SET)) .directTransX(new AttributeModification<>(0.1, OperationType.SET)) @@ -375,14 +375,14 @@ void testMinQGreaterThanMaxQ() throws Exception { .add(); Collection points = generator.getReactiveLimits(ReactiveCapabilityCurve.class).getPoints(); List generatorPoints = new ArrayList<>(points); - List modificationPoints = generatorModificationInfos.getReactiveCapabilityCurvePoints(); + List modificationPoints = generatorModificationInfos.getReactiveCapabilityCurvePoints(); AtomicReference maxQ = new AtomicReference<>(Double.NaN); AtomicReference minQ = new AtomicReference<>(Double.NaN); if (!CollectionUtils.isEmpty(points)) { IntStream.range(0, modificationPoints.size()) .forEach(i -> { ReactiveCapabilityCurve.Point oldPoint = generatorPoints.get(i); - ReactiveCapabilityCurveModificationInfos newPoint = modificationPoints.get(i); + ReactiveCapabilityCurvePointsInfos newPoint = modificationPoints.get(i); Double oldMaxQ = Double.NaN; Double oldMinQ = Double.NaN; if (oldPoint != null) { @@ -390,7 +390,6 @@ void testMinQGreaterThanMaxQ() throws Exception { oldMinQ = oldPoint.getMinQ(); } newPoint.setMinQ(300.0); - newPoint.setOldMaxQ(250.0); maxQ.set(newPoint.getMaxQ() != null ? newPoint.getMaxQ() : oldMaxQ); minQ.set(newPoint.getMinQ() != null ? newPoint.getMinQ() : oldMinQ); }); diff --git a/src/test/java/org/gridsuite/modification/server/modifications/ModificationUtilsTest.java b/src/test/java/org/gridsuite/modification/server/modifications/ModificationUtilsTest.java index 1707c2a24..9e2fb2722 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/ModificationUtilsTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/ModificationUtilsTest.java @@ -8,7 +8,7 @@ package org.gridsuite.modification.server.modifications; import org.gridsuite.modification.NetworkModificationException; -import org.gridsuite.modification.dto.ReactiveCapabilityCurveModificationInfos; +import org.gridsuite.modification.dto.ReactiveCapabilityCurvePointsInfos; import org.gridsuite.modification.utils.ModificationUtils; import org.junit.jupiter.api.Test; @@ -26,13 +26,13 @@ class ModificationUtilsTest { @Test void testCheckMaxQGreaterThanMinQ() { - var point1 = ReactiveCapabilityCurveModificationInfos.builder().oldMinQ(2.0).oldMaxQ(1.0).minQ(10.0).maxQ(20.0).build(); + var point1 = ReactiveCapabilityCurvePointsInfos.builder().minQ(10.0).maxQ(20.0).build(); ModificationUtils.getInstance().checkMaxQGreaterThanMinQ( Collections.singletonList(point1), MODIFY_GENERATOR_ERROR, "old KO, new OK: No exception should be thrown"); - var point2 = ReactiveCapabilityCurveModificationInfos.builder().oldMinQ(1.0).oldMaxQ(2.0).minQ(20.0).maxQ(10.0).build(); + var point2 = ReactiveCapabilityCurvePointsInfos.builder().minQ(20.0).maxQ(10.0).build(); var exception = (NetworkModificationException) catchRuntimeException(() -> ModificationUtils.getInstance().checkMaxQGreaterThanMinQ( Collections.singletonList(point2), MODIFY_GENERATOR_ERROR, @@ -42,7 +42,7 @@ void testCheckMaxQGreaterThanMinQ() { assertThat(exception) .hasMessageEndingWith("old OK, new KO: maximum reactive power 10.0 is expected to be greater than or equal to minimum reactive power 20.0"); - var point3 = ReactiveCapabilityCurveModificationInfos.builder().minQ(20.0).maxQ(10.0).build(); + var point3 = ReactiveCapabilityCurvePointsInfos.builder().minQ(20.0).maxQ(10.0).build(); exception = (NetworkModificationException) catchRuntimeException(() -> ModificationUtils.getInstance().checkMaxQGreaterThanMinQ( Collections.singletonList(point3), MODIFY_GENERATOR_ERROR, @@ -52,19 +52,19 @@ void testCheckMaxQGreaterThanMinQ() { assertThat(exception) .hasMessageEndingWith("old null, new KO: maximum reactive power 10.0 is expected to be greater than or equal to minimum reactive power 20.0"); - var point4 = ReactiveCapabilityCurveModificationInfos.builder().minQ(10.0).maxQ(20.0).build(); + var point4 = ReactiveCapabilityCurvePointsInfos.builder().minQ(10.0).maxQ(20.0).build(); ModificationUtils.getInstance().checkMaxQGreaterThanMinQ( Collections.singletonList(point4), MODIFY_GENERATOR_ERROR, "old null, new OK: No exception should be thrown"); - var point5 = ReactiveCapabilityCurveModificationInfos.builder().oldMinQ(10.0).oldMaxQ(20.0).build(); + var point5 = ReactiveCapabilityCurvePointsInfos.builder().minQ(10.0).maxQ(20.0).build(); ModificationUtils.getInstance().checkMaxQGreaterThanMinQ( Collections.singletonList(point5), MODIFY_GENERATOR_ERROR, "old OK, new null: No exception should be thrown"); - var point6 = ReactiveCapabilityCurveModificationInfos.builder().oldMinQ(20.0).oldMaxQ(10.0).build(); + var point6 = ReactiveCapabilityCurvePointsInfos.builder().minQ(20.0).maxQ(10.0).build(); exception = (NetworkModificationException) catchRuntimeException(() -> ModificationUtils.getInstance().checkMaxQGreaterThanMinQ( Collections.singletonList(point6), MODIFY_GENERATOR_ERROR, diff --git a/src/test/java/org/gridsuite/modification/server/modifications/VscCreationTest.java b/src/test/java/org/gridsuite/modification/server/modifications/VscCreationTest.java index b273929ea..6ef49c254 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/VscCreationTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/VscCreationTest.java @@ -79,18 +79,18 @@ private static ConverterStationCreationInfos buildConverterStationWithMinMaxReac .busOrBusbarSectionId("1.1") .connectionName("top") .connectionDirection(ConnectablePosition.Direction.TOP) - .reactiveCapabilityCurvePoints(List.of()) + .reactiveCapabilityCurvePoints(null) .reactiveCapabilityCurve(false) .build(); } private static ConverterStationCreationInfos buildConverterStationWithReactiveCapabilityCurve() { - var point1 = ReactiveCapabilityCurveCreationInfos.builder() + var point1 = ReactiveCapabilityCurvePointsInfos.builder() .p(0.4) .maxQ(3.) .minQ(0.) .build(); - var point2 = ReactiveCapabilityCurveCreationInfos.builder() + var point2 = ReactiveCapabilityCurvePointsInfos.builder() .p(0.6) .maxQ(2.) .minQ(1.1) diff --git a/src/test/java/org/gridsuite/modification/server/modifications/VscModificationTest.java b/src/test/java/org/gridsuite/modification/server/modifications/VscModificationTest.java index 13292d37d..8ff2ee58b 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/VscModificationTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/VscModificationTest.java @@ -76,8 +76,8 @@ private static ConverterStationModificationInfos buildConverterStationWithReacti .voltageSetpoint(new AttributeModification<>(0.3, OperationType.SET)) .reactiveCapabilityCurve(new AttributeModification<>(true, OperationType.SET)) .reactiveCapabilityCurvePoints(List.of( - new ReactiveCapabilityCurveModificationInfos(0.4, 3., 11., 13., 0.7, 0.9), - new ReactiveCapabilityCurveModificationInfos(0.6, 2., 12., 14., 0.8, 0.11))) + new ReactiveCapabilityCurvePointsInfos(0.4, 11., 0.7), + new ReactiveCapabilityCurvePointsInfos(0.6, 12., 0.8))) .build(); } @@ -167,7 +167,7 @@ protected void assertAfterNetworkModificationCreation() { assertEquals(2, reactiveLimits1.getPointCount()); Collection points = vscConverterStation1.getReactiveLimits(ReactiveCapabilityCurve.class).getPoints(); List vscPoints = new ArrayList<>(points); - List modificationPoints = vscModificationInfos.getConverterStation1().getReactiveCapabilityCurvePoints(); + List modificationPoints = vscModificationInfos.getConverterStation1().getReactiveCapabilityCurvePoints(); if (!CollectionUtils.isEmpty(points)) { IntStream.range(0, vscPoints.size()) .forEach(i -> { diff --git a/src/test/java/org/gridsuite/modification/server/modifications/byfilter/assignment/ShuntCompensatorModificationByAssignmentTest.java b/src/test/java/org/gridsuite/modification/server/modifications/byfilter/assignment/ShuntCompensatorModificationByAssignmentTest.java index 71030d0d7..010799e56 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/byfilter/assignment/ShuntCompensatorModificationByAssignmentTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/byfilter/assignment/ShuntCompensatorModificationByAssignmentTest.java @@ -94,13 +94,13 @@ protected List> getAssignmentInfos() { .build(); DoubleAssignmentInfos assignmentInfos3 = DoubleAssignmentInfos.builder() - .editedField(ShuntCompensatorField.MAXIMUM_SUSCEPTANCE.name()) + .editedField(ShuntCompensatorField.MAX_SUSCEPTANCE.name()) .value(5.) .filters(List.of(filter4)) .build(); DoubleAssignmentInfos assignmentInfos4 = DoubleAssignmentInfos.builder() - .editedField(ShuntCompensatorField.MAXIMUM_Q_AT_NOMINAL_VOLTAGE.name()) + .editedField(ShuntCompensatorField.MAX_Q_AT_NOMINAL_V.name()) .value(10.) .filters(List.of(filter5)) .build(); diff --git a/src/test/java/org/gridsuite/modification/server/modifications/byfilter/formula/ShuntCompensatorByFormulaModificationTest.java b/src/test/java/org/gridsuite/modification/server/modifications/byfilter/formula/ShuntCompensatorByFormulaModificationTest.java index a78c92464..a4cfe29d6 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/byfilter/formula/ShuntCompensatorByFormulaModificationTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/byfilter/formula/ShuntCompensatorByFormulaModificationTest.java @@ -98,16 +98,16 @@ protected List getFormulaInfos() { ReferenceFieldOrValue.builder().equipmentField(ShuntCompensatorField.MAXIMUM_SECTION_COUNT.name()).build(), ReferenceFieldOrValue.builder().value(2.).build()); - FormulaInfos formulaInfos3 = getFormulaInfo(ShuntCompensatorField.MAXIMUM_SUSCEPTANCE.name(), + FormulaInfos formulaInfos3 = getFormulaInfo(ShuntCompensatorField.MAX_SUSCEPTANCE.name(), List.of(filter4), Operator.ADDITION, - ReferenceFieldOrValue.builder().equipmentField(ShuntCompensatorField.MAXIMUM_SUSCEPTANCE.name()).build(), + ReferenceFieldOrValue.builder().equipmentField(ShuntCompensatorField.MAX_SUSCEPTANCE.name()).build(), ReferenceFieldOrValue.builder().value(5.).build()); - FormulaInfos formulaInfos4 = getFormulaInfo(ShuntCompensatorField.MAXIMUM_Q_AT_NOMINAL_VOLTAGE.name(), + FormulaInfos formulaInfos4 = getFormulaInfo(ShuntCompensatorField.MAX_Q_AT_NOMINAL_V.name(), List.of(filter5), Operator.DIVISION, - ReferenceFieldOrValue.builder().equipmentField(ShuntCompensatorField.MAXIMUM_Q_AT_NOMINAL_VOLTAGE.name()).build(), + ReferenceFieldOrValue.builder().equipmentField(ShuntCompensatorField.MAX_Q_AT_NOMINAL_V.name()).build(), ReferenceFieldOrValue.builder().value(2.).build()); return List.of(formulaInfos1, formulaInfos2, formulaInfos3, formulaInfos4); diff --git a/src/test/java/org/gridsuite/modification/server/modifications/tabularcreations/TabularGeneratorCreationsTest.java b/src/test/java/org/gridsuite/modification/server/modifications/tabularcreations/TabularGeneratorCreationsTest.java index 45a43c005..51790ae41 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/tabularcreations/TabularGeneratorCreationsTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/tabularcreations/TabularGeneratorCreationsTest.java @@ -59,7 +59,7 @@ protected ModificationInfos buildModification() { .minQ(7D).maxQ(13D).participate(true).droop(0.5F) .directTransX(5D).stepUpTransformerX(45D) .regulatingTerminalId("v2load").regulatingTerminalType("LOAD").regulatingTerminalVlId("v2").qPercent(35D) - .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(List.of()) + .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(null) .build(), GeneratorCreationInfos.builder() .equipmentId("id2").equipmentName("name2").voltageLevelId("v2").busOrBusbarSectionId("1A") @@ -69,14 +69,14 @@ protected ModificationInfos buildModification() { .plannedActivePowerSetPoint(200D).forcedOutageRate(3D) .minQ(7D).participate(false) .stepUpTransformerX(45D) - .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(List.of()) + .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(null) .build(), GeneratorCreationInfos.builder() .equipmentId("id3").voltageLevelId("v3").busOrBusbarSectionId("3A") .connectionName("feederId3").connectionDirection(ConnectablePosition.Direction.BOTTOM).connectionPosition(100).terminalConnected(false).terminalConnected(true) .energySource(EnergySource.WIND).minP(0).maxP(200) .targetP(150).voltageRegulationOn(true).targetV(375D) - .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(List.of()) + .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(null) .build(), GeneratorCreationInfos.builder() .equipmentId("id4").equipmentName("name4").voltageLevelId("v4").busOrBusbarSectionId("1.A") @@ -87,21 +87,21 @@ protected ModificationInfos buildModification() { .participate(false) .directTransX(5D) .regulatingTerminalId("v5load").regulatingTerminalType("LOAD").regulatingTerminalVlId("v5").qPercent(75D) - .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(List.of()) + .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(null) .build(), GeneratorCreationInfos.builder() .equipmentId("id5").voltageLevelId("v5").busOrBusbarSectionId("1A1") .connectionName("name5").connectionDirection(ConnectablePosition.Direction.BOTTOM).connectionPosition(100).terminalConnected(false).terminalConnected(true) .energySource(EnergySource.WIND).minP(0).maxP(200) .targetP(150).voltageRegulationOn(true).targetV(375D) - .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(List.of()) + .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(null) .build(), GeneratorCreationInfos.builder() .equipmentId("v5generator").voltageLevelId("v5").busOrBusbarSectionId("1A1") .connectionName("v5generator").connectionDirection(ConnectablePosition.Direction.BOTTOM).connectionPosition(100).terminalConnected(false).terminalConnected(true) .energySource(EnergySource.WIND).minP(0).maxP(200) .targetP(150).voltageRegulationOn(true).targetV(375D) - .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(List.of()) + .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(null) .build() ); return TabularCreationInfos.builder() @@ -123,7 +123,7 @@ protected ModificationInfos buildModificationUpdate() { .minQ(13D).maxQ(11D).participate(false) .directTransX(8D).stepUpTransformerX(44D) .regulatingTerminalId("v5load").regulatingTerminalType("LOAD").regulatingTerminalVlId("v5").qPercent(37D) - .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(List.of()) + .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(null) .build(), GeneratorCreationInfos.builder() .equipmentId("id4").equipmentName("name44").voltageLevelId("v4").busOrBusbarSectionId("1.A") @@ -134,7 +134,7 @@ protected ModificationInfos buildModificationUpdate() { .participate(true).droop(5F) .directTransX(3D) .regulatingTerminalId("v2load").regulatingTerminalType("LOAD").regulatingTerminalVlId("v2").qPercent(75D) - .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(List.of()) + .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(null) .build() ); return TabularCreationInfos.builder() @@ -226,7 +226,7 @@ void testAllModificationsHaveSucceeded() throws Exception { .minQ(7D).maxQ(13D).participate(true).droop(0.5F) .directTransX(5D).stepUpTransformerX(45D) .regulatingTerminalId("v2load").regulatingTerminalType("LOAD").regulatingTerminalVlId("v2").qPercent(35D) - .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(List.of()) + .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(null) .build(), GeneratorCreationInfos.builder() .equipmentId("id2").equipmentName("name2").voltageLevelId("v2").busOrBusbarSectionId("1A") @@ -236,7 +236,7 @@ void testAllModificationsHaveSucceeded() throws Exception { .plannedActivePowerSetPoint(200D).forcedOutageRate(3D) .minQ(7D).participate(false) .stepUpTransformerX(45D) - .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(List.of()) + .reactiveCapabilityCurve(false).reactiveCapabilityCurvePoints(null) .build() ); diff --git a/src/test/java/org/gridsuite/modification/server/modifications/tabularmodifications/TabularGeneratorModificationsTest.java b/src/test/java/org/gridsuite/modification/server/modifications/tabularmodifications/TabularGeneratorModificationsTest.java index 272436907..fa5bfca49 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/tabularmodifications/TabularGeneratorModificationsTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/tabularmodifications/TabularGeneratorModificationsTest.java @@ -582,9 +582,9 @@ private static List createGeneratorModificationList(int qty) ModificationCreation.getFreeProperty(), ModificationCreation.getFreeProperty("test", "value"))) .reactiveCapabilityCurvePoints(List.of( - ReactiveCapabilityCurveModificationInfos.builder().p(10.).oldP(15.).build(), - ReactiveCapabilityCurveModificationInfos.builder().maxQ(12.).oldMaxQ(17.).build(), - ReactiveCapabilityCurveModificationInfos.builder().minQ(5.).maxQ(5.).p(5.).build())) + ReactiveCapabilityCurvePointsInfos.builder().p(10.).build(), + ReactiveCapabilityCurvePointsInfos.builder().maxQ(17.).build(), + ReactiveCapabilityCurvePointsInfos.builder().minQ(5.).maxQ(5.).p(5.).build())) .build()) .toList(); } diff --git a/src/test/java/org/gridsuite/modification/server/service/ModificationRepositoryTest.java b/src/test/java/org/gridsuite/modification/server/service/ModificationRepositoryTest.java index 6d5f25b6a..c3683a2e0 100644 --- a/src/test/java/org/gridsuite/modification/server/service/ModificationRepositoryTest.java +++ b/src/test/java/org/gridsuite/modification/server/service/ModificationRepositoryTest.java @@ -315,7 +315,7 @@ void testGeneratorCreation() { .participate(false).droop(null).directTransX(null) .stepUpTransformerX(null).regulatingTerminalId("testTerminalId2") .regulatingTerminalType("BATTERY").regulatingTerminalVlId("idVlTest2") - .qPercent(25.).reactiveCapabilityCurve(true).reactiveCapabilityCurvePoints(List.of(new ReactiveCapabilityCurveCreationInfos(33., 44., 55.))) + .qPercent(25.).reactiveCapabilityCurve(true).reactiveCapabilityCurvePoints(List.of(new ReactiveCapabilityCurvePointsInfos(33., 44., 55.))) .connectionName("Top").connectionDirection(ConnectablePosition.Direction.TOP) .connectionPosition(3).build()); diff --git a/src/test/java/org/gridsuite/modification/server/utils/ModificationCreation.java b/src/test/java/org/gridsuite/modification/server/utils/ModificationCreation.java index 1d12dda2e..42c079624 100644 --- a/src/test/java/org/gridsuite/modification/server/utils/ModificationCreation.java +++ b/src/test/java/org/gridsuite/modification/server/utils/ModificationCreation.java @@ -58,8 +58,8 @@ public static BatteryCreationInfos getCreationBattery(String vlId, String batter .droop(5f) .participate(true) .reactiveCapabilityCurve(true) - .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurveCreationInfos(2.0, 3.0, 3.1), - new ReactiveCapabilityCurveCreationInfos(5.6, 9.8, 10.8))) + .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurvePointsInfos(2.0, 3.0, 3.1), + new ReactiveCapabilityCurvePointsInfos(5.6, 9.8, 10.8))) .connectionName("top") .connectionDirection(ConnectablePosition.Direction.TOP) .build(); @@ -92,8 +92,8 @@ public static GeneratorCreationInfos getCreationGenerator(String vlId, String ge .regulatingTerminalVlId(regulatingTerminalVlId) .qPercent(25.) .reactiveCapabilityCurve(true) - .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurveCreationInfos(2.0, 3.0, 3.1), - new ReactiveCapabilityCurveCreationInfos(5.6, 9.8, 10.8))) + .reactiveCapabilityCurvePoints(Arrays.asList(new ReactiveCapabilityCurvePointsInfos(2.0, 3.0, 3.1), + new ReactiveCapabilityCurvePointsInfos(5.6, 9.8, 10.8))) .connectionName("top") .connectionDirection(ConnectablePosition.Direction.TOP) .build();