Skip to content

Commit

Permalink
Homogenize batteries and generators attributes (#441)
Browse files Browse the repository at this point in the history
* Homogenize batterry and group attributes
---------
Signed-off-by: maissa SOUISSI <[email protected]>
  • Loading branch information
souissimai authored Mar 7, 2024
1 parent ac7c3ad commit 3ada3a2
Show file tree
Hide file tree
Showing 45 changed files with 1,005 additions and 778 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,3 @@ Server to modify the network based on spring-boot.

Please read [liquibase usage](https://github.com/powsybl/powsybl-parent/#liquibase-usage) for instructions to automatically generate changesets.
After you generated a changeset do not forget to add it to git and in src/resource/db/changelog/db.changelog-master.yml

The old way to automatically generate the sql schema file (directly using hibernate) can still be used for debugging. Use the following command:
```
mvn package -DskipTests && rm -f src/main/resources/network-modification.sql && java -jar target/gridsuite-network-modification-server-1.0.0-SNAPSHOT-exec.jar --spring.jpa.properties.jakarta.persistence.schema-generation.scripts.action=create
```

Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,25 @@
public class BatteryCreationInfos extends InjectionCreationInfos implements ReactiveLimitsHolderInfos {

@Schema(description = "Minimum active power")
private double minActivePower;
private double minP;

@Schema(description = "Maximum active power")
private double maxActivePower;
private double maxP;

@Schema(description = "Minimum reactive power")
private Double minimumReactivePower;
private Double minQ;

@Schema(description = "Maximum reactive power")
private Double maximumReactivePower;
private Double maxQ;

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

@Schema(description = "Active power set point")
private double activePowerSetpoint;
private double targetP;

@Schema(description = "Reactive power set point")
private Double reactivePowerSetpoint;
private Double targetQ;

@Schema(description = "Participate")
private Boolean participate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@
@ModificationErrorTypeName("MODIFY_BATTERY_ERROR")
public class BatteryModificationInfos extends InjectionModificationInfos {
@Schema(description = "Minimum active power")
private AttributeModification<Double> minActivePower;
private AttributeModification<Double> minP;

@Schema(description = "Maximum active power")
private AttributeModification<Double> maxActivePower;
private AttributeModification<Double> maxP;

@Schema(description = "Active power set point")
private AttributeModification<Double> activePowerSetpoint;
private AttributeModification<Double> targetP;

@Schema(description = "Reactive power set point")
private AttributeModification<Double> reactivePowerSetpoint;
private AttributeModification<Double> targetQ;

@Schema(description = "Participate")
private AttributeModification<Boolean> participate;
Expand All @@ -53,10 +53,10 @@ public class BatteryModificationInfos extends InjectionModificationInfos {
private AttributeModification<Float> droop;

@Schema(description = "Minimum reactive power")
private AttributeModification<Double> minimumReactivePower;
private AttributeModification<Double> minQ;

@Schema(description = "Maximum reactive power")
private AttributeModification<Double> maximumReactivePower;
private AttributeModification<Double> maxQ;

@Schema(description = "Reactive capability curve points")
private List<ReactiveCapabilityCurveModificationInfos> reactiveCapabilityCurvePoints;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ public class ConverterStationCreationInfos extends InjectionCreationInfos implem
private Boolean reactiveCapabilityCurve;

@Schema(description = "Minimum reactive power")
private Double minimumReactivePower;
private Double minQ;

@Schema(description = "Maximum reactive power")
private Double maximumReactivePower;
private Double maxQ;

@Schema(description = "Reactive capability curve points")
private List<ReactiveCapabilityCurveCreationInfos> reactiveCapabilityCurvePoints;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,25 @@ public class GeneratorCreationInfos extends InjectionCreationInfos implements Re
private EnergySource energySource;

@Schema(description = "Minimum active power")
private double minActivePower;
private double minP;

@Schema(description = "Maximum active power")
private double maxActivePower;
private double maxP;

@Schema(description = "Rated nominal power")
private Double ratedNominalPower;
private Double ratedS;

@Schema(description = "Active power set point")
private double activePowerSetpoint;
private double targetP;

@Schema(description = "Reactive power set point")
private Double reactivePowerSetpoint;
private Double targetQ;

@Schema(description = "Voltage regulation on")
private boolean voltageRegulationOn;

@Schema(description = "Voltage set point")
private Double voltageSetpoint;
private Double targetV;

@Schema(description = "Planning active power set point")
private Double plannedActivePowerSetPoint;
Expand All @@ -75,10 +75,10 @@ public class GeneratorCreationInfos extends InjectionCreationInfos implements Re
private Double forcedOutageRate;

@Schema(description = "Minimum reactive power")
private Double minimumReactivePower;
private Double minQ;

@Schema(description = "Maximum reactive power")
private Double maximumReactivePower;
private Double maxQ;

@Schema(description = "Reactive capability curve points")
private List<ReactiveCapabilityCurveCreationInfos> reactiveCapabilityCurvePoints;
Expand All @@ -90,10 +90,10 @@ public class GeneratorCreationInfos extends InjectionCreationInfos implements Re
private Float droop;

@Schema(description = "Transient reactance")
private Double transientReactance;
private Double directTransX;

@Schema(description = "Step up transformer reactance")
private Double stepUpTransformerReactance;
private Double stepUpTransformerX;

@Schema(description = "Regulating terminal equipment id")
private String regulatingTerminalId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ public class GeneratorModificationInfos extends InjectionModificationInfos {
private AttributeModification<EnergySource> energySource;

@Schema(description = "Minimum active power")
private AttributeModification<Double> minActivePower;
private AttributeModification<Double> minP;

@Schema(description = "Maximum active power")
private AttributeModification<Double> maxActivePower;
private AttributeModification<Double> maxP;

@Schema(description = "Rated nominal power")
private AttributeModification<Double> ratedNominalPower;
private AttributeModification<Double> ratedS;

@Schema(description = "Active power set point")
private AttributeModification<Double> activePowerSetpoint;
private AttributeModification<Double> targetP;

@Schema(description = "Reactive power set point")
private AttributeModification<Double> reactivePowerSetpoint;
private AttributeModification<Double> targetQ;

@Schema(description = "Voltage regulation on")
private AttributeModification<Boolean> voltageRegulationOn;

@Schema(description = "Voltage set point")
private AttributeModification<Double> voltageSetpoint;
private AttributeModification<Double> targetV;

@Schema(description = "Planning active power set point")
private AttributeModification<Double> plannedActivePowerSetPoint;
Expand All @@ -73,10 +73,10 @@ public class GeneratorModificationInfos extends InjectionModificationInfos {
private AttributeModification<Double> forcedOutageRate;

@Schema(description = "Minimum reactive power")
private AttributeModification<Double> minimumReactivePower;
private AttributeModification<Double> minQ;

@Schema(description = "Maximum reactive power")
private AttributeModification<Double> maximumReactivePower;
private AttributeModification<Double> maxQ;

@Schema(description = "Reactive capability curve points")
private List<ReactiveCapabilityCurveModificationInfos> reactiveCapabilityCurvePoints;
Expand All @@ -88,10 +88,10 @@ public class GeneratorModificationInfos extends InjectionModificationInfos {
private AttributeModification<Float> droop;

@Schema(description = "Transient reactance")
private AttributeModification<Double> transientReactance;
private AttributeModification<Double> directTransX;

@Schema(description = "Step up transformer reactance")
private AttributeModification<Double> stepUpTransformerReactance;
private AttributeModification<Double> stepUpTransformerX;

@Schema(description = "Voltage Regulation type")
private AttributeModification<VoltageRegulationType> voltageRegulationType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
@Schema(description = "Generator reactive capability curve point creation")
public class ReactiveCapabilityCurveCreationInfos {
@Schema(description = "Minimum reactive power ")
private Double qminP;
private Double minQ;

@Schema(description = "Maximum reactive power")
private Double qmaxP;
private Double maxQ;

@Schema(description = "Active Power")
private Double p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
@Schema(description = "Generator reactive capability curve point creation")
public class ReactiveCapabilityCurveModificationInfos {
@Schema(description = "Minimum reactive power ")
private Double qminP;
private Double minQ;

@Schema(description = "Minimum reactive power ")
private Double oldQminP;
@Schema(description = "Old minimum reactive power ")
private Double oldMinQ;

@Schema(description = "Maximum reactive power")
private Double qmaxP;
private Double maxQ;

@Schema(description = "Maximum reactive power")
private Double oldQmaxP;
@Schema(description = "Old maximum reactive power")
private Double oldMaxQ;

@Schema(description = "Active Power")
private Double p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
public interface ReactiveLimitsHolderInfos {
Boolean getReactiveCapabilityCurve();

Double getMinimumReactivePower();
Double getMinQ();

Double getMaximumReactivePower();
Double getMaxQ();

List<ReactiveCapabilityCurveCreationInfos> getReactiveCapabilityCurvePoints();
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public class VoltageInitGeneratorModificationInfos {
private String generatorId;

@Schema(description = "Voltage set point")
private Double voltageSetpoint;
private Double targetV;

@Schema(description = "Reactive power set point")
private Double reactivePowerSetpoint;
private Double targetQ;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,30 @@
@PrimaryKeyJoinColumn(foreignKey = @ForeignKey(name = "batteryCreation_id_fk_constraint"))
public class BatteryCreationEntity extends InjectionCreationEntity {

@Column(name = "minActivePower")
private double minActivePower;
@Column(name = "minP")
private double minP;

@Column(name = "maxActivePower")
private double maxActivePower;
@Column(name = "maxP")
private double maxP;

@Column(name = "reactiveCapabilityCurve")
private Boolean reactiveCapabilityCurve;

@Column(name = "minimumReactivePower")
private Double minimumReactivePower;
@Column(name = "minQ")
private Double minQ;

@Column(name = "maximumReactivePower")
private Double maximumReactivePower;
@Column(name = "maxQ")
private Double maxQ;

@ElementCollection
@CollectionTable
private List<ReactiveCapabilityCurveCreationEmbeddable> reactiveCapabilityCurvePoints;

@Column(name = "activePowerSetpoint")
private double activePowerSetpoint;
@Column(name = "targetP")
private double targetP;

@Column(name = "reactivePowerSetpoint")
private Double reactivePowerSetpoint;
@Column(name = "targetQ")
private Double targetQ;

@Column(name = "participate")
private Boolean participate;
Expand All @@ -73,23 +73,23 @@ public void update(@NonNull ModificationInfos modificationInfos) {
}

private void assignAttributes(BatteryCreationInfos batteryCreationInfos) {
this.minActivePower = batteryCreationInfos.getMinActivePower();
this.maxActivePower = batteryCreationInfos.getMaxActivePower();
this.minP = batteryCreationInfos.getMinP();
this.maxP = batteryCreationInfos.getMaxP();
this.reactiveCapabilityCurve = batteryCreationInfos.getReactiveCapabilityCurve();
this.minimumReactivePower = batteryCreationInfos.getMinimumReactivePower();
this.maximumReactivePower = batteryCreationInfos.getMaximumReactivePower();
this.minQ = batteryCreationInfos.getMinQ();
this.maxQ = batteryCreationInfos.getMaxQ();
this.reactiveCapabilityCurvePoints = toEmbeddablePoints(batteryCreationInfos.getReactiveCapabilityCurvePoints());
this.activePowerSetpoint = batteryCreationInfos.getActivePowerSetpoint();
this.reactivePowerSetpoint = batteryCreationInfos.getReactivePowerSetpoint();
this.targetP = batteryCreationInfos.getTargetP();
this.targetQ = batteryCreationInfos.getTargetQ();
this.participate = batteryCreationInfos.getParticipate();
this.droop = batteryCreationInfos.getDroop();
}

public static List<ReactiveCapabilityCurveCreationEmbeddable> toEmbeddablePoints(
List<ReactiveCapabilityCurveCreationInfos> points) {
return points == null ? null : points.stream()
.map(point -> new ReactiveCapabilityCurveCreationEmbeddable(point.getQminP(),
point.getQmaxP(),
.map(point -> new ReactiveCapabilityCurveCreationEmbeddable(point.getMinQ(),
point.getMaxQ(),
point.getP()))
.collect(Collectors.toList());
}
Expand All @@ -102,8 +102,8 @@ public BatteryCreationInfos toModificationInfos() {
private BatteryCreationInfos.BatteryCreationInfosBuilder<?, ?> toBatteryCreationInfosBuilder() {
List<ReactiveCapabilityCurveCreationInfos> points = getReactiveCapabilityCurvePoints() != null ? getReactiveCapabilityCurvePoints()
.stream()
.map(value -> new ReactiveCapabilityCurveCreationInfos(value.getQminP(),
value.getQmaxP(),
.map(value -> new ReactiveCapabilityCurveCreationInfos(value.getMinQ(),
value.getMaxQ(),
value.getP()))
.collect(Collectors.toList()) : null;

Expand All @@ -122,14 +122,14 @@ public BatteryCreationInfos toModificationInfos() {
.connectionPosition(getConnectionPosition())
.connected(isConnected())
// battery
.minActivePower(getMinActivePower())
.maxActivePower(getMaxActivePower())
.minP(getMinP())
.maxP(getMaxP())
.reactiveCapabilityCurve(this.getReactiveCapabilityCurve())
.minimumReactivePower(this.getMinimumReactivePower())
.maximumReactivePower(this.getMaximumReactivePower())
.minQ(this.getMinQ())
.maxQ(this.getMaxQ())
.reactiveCapabilityCurvePoints(points)
.activePowerSetpoint(getActivePowerSetpoint())
.reactivePowerSetpoint(getReactivePowerSetpoint())
.targetP(getTargetP())
.targetQ(getTargetQ())
.participate(getParticipate())
.droop(getDroop())
// properties
Expand Down
Loading

0 comments on commit 3ada3a2

Please sign in to comment.