Skip to content

Commit

Permalink
Merge branch 'main' into upgrade_to_powsybl_dependencies_2024.4.O
Browse files Browse the repository at this point in the history
  • Loading branch information
FranckLecuyer authored Dec 23, 2024
2 parents 51f9710 + 851f64c commit 77d7975
Show file tree
Hide file tree
Showing 28 changed files with 74 additions and 137 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<groupId>org.gridsuite</groupId>
<artifactId>gridsuite-network-modification</artifactId>
<version>0.4.0-SNAPSHOT</version>
<version>0.5.0-SNAPSHOT</version>

<packaging>jar</packaging>
<name>Network modification library</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class BatteryCreationInfos extends InjectionCreationInfos implements Reac
private Double maxQ;

@Schema(description = "Reactive capability curve points")
private List<ReactiveCapabilityCurveCreationInfos> reactiveCapabilityCurvePoints;
private List<ReactiveCapabilityCurvePointsInfos> reactiveCapabilityCurvePoints;

@Schema(description = "Active power set point")
private double targetP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class BatteryModificationInfos extends InjectionModificationInfos {
private AttributeModification<Double> maxQ;

@Schema(description = "Reactive capability curve points")
private List<ReactiveCapabilityCurveModificationInfos> reactiveCapabilityCurvePoints;
private List<ReactiveCapabilityCurvePointsInfos> reactiveCapabilityCurvePoints;

@Schema(description = "Reactive capability curve")
private AttributeModification<Boolean> reactiveCapabilityCurve;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ public class ConverterStationCreationInfos extends InjectionCreationInfos implem
private Double maxQ;

@Schema(description = "Reactive capability curve points")
private List<ReactiveCapabilityCurveCreationInfos> reactiveCapabilityCurvePoints;
private List<ReactiveCapabilityCurvePointsInfos> reactiveCapabilityCurvePoints;

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ public class ConverterStationModificationInfos extends InjectionModificationInfo
private AttributeModification<Double> maxQ;

@Schema(description = "Reactive capability curve points")
private List<ReactiveCapabilityCurveModificationInfos> reactiveCapabilityCurvePoints;
private List<ReactiveCapabilityCurvePointsInfos> reactiveCapabilityCurvePoints;

}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class GeneratorCreationInfos extends InjectionCreationInfos implements Re
private Double maxQ;

@Schema(description = "Reactive capability curve points")
private List<ReactiveCapabilityCurveCreationInfos> reactiveCapabilityCurvePoints;
private List<ReactiveCapabilityCurvePointsInfos> reactiveCapabilityCurvePoints;

@Schema(description = "Participate")
private Boolean participate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class GeneratorModificationInfos extends InjectionModificationInfos {
private AttributeModification<Double> maxQ;

@Schema(description = "Reactive capability curve points")
private List<ReactiveCapabilityCurveModificationInfos> reactiveCapabilityCurvePoints;
private List<ReactiveCapabilityCurvePointsInfos> reactiveCapabilityCurvePoints;

@Schema(description = "Participate")
private AttributeModification<Boolean> participate;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
@AllArgsConstructor
@Getter
@Setter
@Schema(description = "Generator reactive capability curve point creation")
public class ReactiveCapabilityCurveCreationInfos {
@Schema(description = "Reactive capability curve points")
public class ReactiveCapabilityCurvePointsInfos {
@Schema(description = "Minimum reactive power ")
private Double minQ;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ public interface ReactiveLimitsHolderInfos {

Double getMaxQ();

List<ReactiveCapabilityCurveCreationInfos> getReactiveCapabilityCurvePoints();
List<ReactiveCapabilityCurvePointsInfos> getReactiveCapabilityCurvePoints();
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
public enum ShuntCompensatorField {
MAXIMUM_SECTION_COUNT,
SECTION_COUNT,
MAXIMUM_SUSCEPTANCE,
MAX_SUSCEPTANCE,
MAX_Q_AT_NOMINAL_V;

public static String getReferenceValue(ShuntCompensator shuntCompensator, String shuntCompensatorField) {
Expand All @@ -35,7 +35,7 @@ public static String getReferenceValue(ShuntCompensator shuntCompensator, String
return switch (field) {
case MAXIMUM_SECTION_COUNT -> String.valueOf(shuntCompensator.getMaximumSectionCount());
case SECTION_COUNT -> String.valueOf(shuntCompensator.getSectionCount());
case MAXIMUM_SUSCEPTANCE -> String.valueOf(bPerSection * shuntCompensator.getMaximumSectionCount());
case MAX_SUSCEPTANCE -> String.valueOf(bPerSection * shuntCompensator.getMaximumSectionCount());
case MAX_Q_AT_NOMINAL_V -> String.valueOf(Math.abs(Math.pow(voltageLevel.getNominalV(), 2) * bPerSection) * shuntCompensator.getMaximumSectionCount());
};
}
Expand All @@ -56,7 +56,7 @@ public static void setNewValue(ShuntCompensator shuntCompensator, String shuntCo
case MAXIMUM_SECTION_COUNT -> modifyMaximumSectionCount(new AttributeModification<>((int) Double.parseDouble(newValue), OperationType.SET),
null, null, null, shuntCompensator, model);
case SECTION_COUNT -> modifySectionCount(new AttributeModification<>((int) Double.parseDouble(newValue), OperationType.SET), null, shuntCompensator);
case MAXIMUM_SUSCEPTANCE -> modifyMaxSusceptance(new AttributeModification<>(Double.parseDouble(newValue), OperationType.SET),
case MAX_SUSCEPTANCE -> modifyMaxSusceptance(new AttributeModification<>(Double.parseDouble(newValue), OperationType.SET),
shuntCompensator.getMaximumSectionCount(), null, model);
case MAX_Q_AT_NOMINAL_V -> modifyMaximumQAtNominalVoltage(new AttributeModification<>(Double.parseDouble(newValue), OperationType.SET),
voltageLevel, shuntCompensator.getMaximumSectionCount(), null, model, shuntCompensatorType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.gridsuite.modification.NetworkModificationException;
import org.gridsuite.modification.dto.AttributeModification;
import org.gridsuite.modification.dto.BatteryModificationInfos;
import org.gridsuite.modification.dto.ReactiveCapabilityCurveModificationInfos;
import org.gridsuite.modification.dto.ReactiveCapabilityCurvePointsInfos;
import org.gridsuite.modification.utils.ModificationUtils;
import org.gridsuite.modification.utils.PropertiesUtils;

Expand Down Expand Up @@ -134,7 +134,7 @@ private void modifyBatteryReactiveCapabilityCurvePoints(BatteryModificationInfos
Battery battery, ReportNode subReportNode, ReportNode subReportNodeLimits) {

ReactiveCapabilityCurveAdder adder = battery.newReactiveCapabilityCurve();
List<ReactiveCapabilityCurveModificationInfos> modificationPoints = modificationInfos.getReactiveCapabilityCurvePoints();
List<ReactiveCapabilityCurvePointsInfos> modificationPoints = modificationInfos.getReactiveCapabilityCurvePoints();
Collection<ReactiveCapabilityCurve.Point> points = battery.getReactiveLimits().getKind() == ReactiveLimitsKind.CURVE ? battery.getReactiveLimits(ReactiveCapabilityCurve.class).getPoints() : List.of();
ModificationUtils.getInstance().modifyReactiveCapabilityCurvePoints(points, modificationPoints, adder, subReportNode, subReportNodeLimits);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public static void modifyGeneratorShortCircuitAttributes(AttributeModification<D
private void modifyGeneratorReactiveCapabilityCurvePoints(GeneratorModificationInfos modificationInfos,
Generator generator, ReportNode subReportNode, ReportNode subReportNodeLimits) {
ReactiveCapabilityCurveAdder adder = generator.newReactiveCapabilityCurve();
List<ReactiveCapabilityCurveModificationInfos> modificationPoints = modificationInfos.getReactiveCapabilityCurvePoints();
List<ReactiveCapabilityCurvePointsInfos> modificationPoints = modificationInfos.getReactiveCapabilityCurvePoints();
Collection<ReactiveCapabilityCurve.Point> points = generator.getReactiveLimits().getKind() == ReactiveLimitsKind.CURVE ? generator.getReactiveLimits(ReactiveCapabilityCurve.class).getPoints() : List.of();
ModificationUtils.getInstance().modifyReactiveCapabilityCurvePoints(points, modificationPoints, adder, subReportNode, subReportNodeLimits);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private void addReportConverterStationLcc(LccConverterStationCreationInfos lccCo
.withUntypedValue("id", lccConverterStationCreationInfos.getEquipmentId()).add();

List<ReportNode> characteristicsReport = List.of(ModificationUtils.getInstance().buildCreationReport(lccConverterStationCreationInfos.getLossFactor(), "Loss Factor"),
ModificationUtils.getInstance().buildCreationReport(lccConverterStationCreationInfos.getPowerFactor(), "Power Factor"));
ModificationUtils.getInstance().buildCreationReport(lccConverterStationCreationInfos.getPowerFactor(), "Power Factor"));
List<ReportNode> shuntCompensatorsOnSide = Optional.ofNullable(lccConverterStationCreationInfos.getShuntCompensatorsOnSide())
.orElse(List.of())
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.powsybl.iidm.network.extensions.HvdcOperatorActivePowerRangeAdder;
import org.gridsuite.modification.NetworkModificationException;
import org.gridsuite.modification.dto.ConverterStationModificationInfos;
import org.gridsuite.modification.dto.ReactiveCapabilityCurveModificationInfos;
import org.gridsuite.modification.dto.ReactiveCapabilityCurvePointsInfos;
import org.gridsuite.modification.dto.VscModificationInfos;
import org.gridsuite.modification.utils.ModificationUtils;
import org.gridsuite.modification.utils.PropertiesUtils;
Expand Down Expand Up @@ -346,7 +346,7 @@ private void modifyVscReactiveCapabilityCurvePoints(ConverterStationModification
VscConverterStation vscConverterStation, ReportNode subReporter, ReportNode subReportNodeLimits) {

ReactiveCapabilityCurveAdder adder = vscConverterStation.newReactiveCapabilityCurve();
List<ReactiveCapabilityCurveModificationInfos> modificationPoints = modificationInfos.getReactiveCapabilityCurvePoints();
List<ReactiveCapabilityCurvePointsInfos> modificationPoints = modificationInfos.getReactiveCapabilityCurvePoints();
Collection<ReactiveCapabilityCurve.Point> points = vscConverterStation.getReactiveLimits().getKind() == ReactiveLimitsKind.CURVE ? vscConverterStation.getReactiveLimits(ReactiveCapabilityCurve.class).getPoints() : List.of();
ModificationUtils.getInstance().modifyReactiveCapabilityCurvePoints(points, modificationPoints, adder, subReporter, subReportNodeLimits);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ public String formatRegulationModeReport(PhaseTapChanger.RegulationMode regulati
}

public void modifyReactiveCapabilityCurvePoints(Collection<ReactiveCapabilityCurve.Point> points,
List<ReactiveCapabilityCurveModificationInfos> modificationPoints,
List<ReactiveCapabilityCurvePointsInfos> modificationPoints,
ReactiveCapabilityCurveAdder adder,
ReportNode subReportNode, ReportNode subReportNodeLimits) {
List<ReportNode> reports = new ArrayList<>();
Expand All @@ -1065,7 +1065,7 @@ public void modifyReactiveCapabilityCurvePoints(Collection<ReactiveCapabilityCur
.forEach(i -> {
String fieldSuffix;
ReactiveCapabilityCurve.Point oldPoint = i < equipementIdPoints.size() - 1 ? equipementIdPoints.get(i) : null;
ReactiveCapabilityCurveModificationInfos newPoint = modificationPoints.get(i);
ReactiveCapabilityCurvePointsInfos newPoint = modificationPoints.get(i);
if (i == 0) {
fieldSuffix = "min";
} else if (i == (modificationPoints.size() - 1)) {
Expand Down Expand Up @@ -1093,7 +1093,7 @@ public void modifyReactiveCapabilityCurvePoints(Collection<ReactiveCapabilityCur
}

public void createReactiveCapabilityCurvePoint(ReactiveCapabilityCurveAdder adder,
ReactiveCapabilityCurveModificationInfos newPoint,
ReactiveCapabilityCurvePointsInfos newPoint,
ReactiveCapabilityCurve.Point oldPoint,
List<ReportNode> reports,
String fieldSuffix) {
Expand Down Expand Up @@ -1268,7 +1268,7 @@ public ReportNode modifyActivePowerControlAttributes(ActivePowerControl<?> activ
}

public void checkMaxQGreaterThanMinQ(
List<ReactiveCapabilityCurveModificationInfos> modificationPoints,
List<ReactiveCapabilityCurvePointsInfos> modificationPoints,
NetworkModificationException.Type exceptionType, String errorMessage
) {
for (var point : modificationPoints) {
Expand All @@ -1277,14 +1277,10 @@ public void checkMaxQGreaterThanMinQ(

if (point.getMaxQ() != null) {
maxQ = point.getMaxQ();
} else if (point.getOldMaxQ() != null) {
maxQ = point.getOldMaxQ();
}

if (point.getMinQ() != null) {
minQ = point.getMinQ();
} else if (point.getOldMinQ() != null) {
minQ = point.getOldMinQ();
}

if (maxQ < minQ) {
Expand All @@ -1307,7 +1303,7 @@ public void checkMaxReactivePowerGreaterThanMinReactivePower(MinMaxReactiveLimit
}

public void checkReactiveLimit(ReactiveLimitsHolder reactiveLimitsHolder, AttributeModification<Double> minimumReactivePower, AttributeModification<Double> maximumReactivePower,
List<ReactiveCapabilityCurveModificationInfos> modificationPoints, NetworkModificationException.Type exeptionType, String errorMessage) {
List<ReactiveCapabilityCurvePointsInfos> modificationPoints, NetworkModificationException.Type exeptionType, String errorMessage) {
if (reactiveLimitsHolder.getReactiveLimits().getKind() == ReactiveLimitsKind.MIN_MAX
&& (minimumReactivePower != null || maximumReactivePower != null)) {
MinMaxReactiveLimits minMaxReactiveLimits = reactiveLimitsHolder.getReactiveLimits(MinMaxReactiveLimits.class);
Expand Down Expand Up @@ -1352,14 +1348,14 @@ public void checkReactiveLimitsCreation(ReactiveLimitsHolderInfos modificationIn
}

// check reactive capability curve limits
List<ReactiveCapabilityCurveCreationInfos> points = modificationInfos.getReactiveCapabilityCurvePoints();
List<ReactiveCapabilityCurvePointsInfos> points = modificationInfos.getReactiveCapabilityCurvePoints();
if (!org.apache.commons.collections4.CollectionUtils.isEmpty(points)) {
if (points.size() < 2) {
throw makeEquipmentException(errorType, equipmentId, equipmentName, "a reactive capability curve should have at least two points");
}
IntStream.range(0, points.size())
.forEach(i -> {
ReactiveCapabilityCurveCreationInfos newPoint = points.get(i);
ReactiveCapabilityCurvePointsInfos newPoint = points.get(i);
if (Double.isNaN(newPoint.getP())) {
throw makeEquipmentException(errorType, equipmentId, equipmentName, "P is not set in a reactive capability curve limits point");
} else if (Double.isNaN(newPoint.getMinQ())) {
Expand Down Expand Up @@ -1458,11 +1454,11 @@ public void createReactiveCapabilityCurve(ReactiveLimitsHolderInfos creationInfo
ReportNode subReportNode) {
List<ReportNode> pointsReports = new ArrayList<>();
ReactiveCapabilityCurveAdder adder = reactiveLimitsHolder.newReactiveCapabilityCurve();
List<ReactiveCapabilityCurveCreationInfos> points = creationInfos.getReactiveCapabilityCurvePoints();
List<ReactiveCapabilityCurvePointsInfos> points = creationInfos.getReactiveCapabilityCurvePoints();
IntStream.range(0, points.size())
.forEach(i -> {
String fieldSuffix;
ReactiveCapabilityCurveCreationInfos newPoint = points.get(i);
ReactiveCapabilityCurvePointsInfos newPoint = points.get(i);
if (i == 0) {
fieldSuffix = "min";
} else if (i == (points.size() - 1)) {
Expand All @@ -1478,7 +1474,7 @@ public void createReactiveCapabilityCurve(ReactiveLimitsHolderInfos creationInfo
}

private void createReactiveCapabilityCurvePoint(ReactiveCapabilityCurveAdder adder,
ReactiveCapabilityCurveCreationInfos point,
ReactiveCapabilityCurvePointsInfos point,
List<ReportNode> reports,
String fieldSuffix) {
adder.beginPoint()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.utils.NetworkCreation;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -60,8 +60,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()))
Expand Down
Loading

0 comments on commit 77d7975

Please sign in to comment.