-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create new vsc modification #420
Merged
Merged
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
a2dae20
increase coverage , and fix bugs with activePowerControl extension
jamal-khey 856ce0c
Update database changelog and remove unused test method
jamal-khey 0c9dacf
Add author information to DTO and entity classes
jamal-khey 2bda20e
Merge branch 'main' into jamalkhey/vsc-modification
jamal-khey c79c54e
fix updated interface
jamal-khey 7025679
improve modification of OperatorActivePowerLimit
jamal-khey f9c31d1
improve logs
jamal-khey dbf4998
Merge branch 'main' into jamalkhey/vsc-modification
jamal-khey efddabe
Merge branch 'main' into jamalkhey/vsc-modification
jamal-khey 2ea65ce
Update src/main/java/org/gridsuite/modification/server/dto/DTOUtils.java
YenguiSeddik 87a0dee
take suggestion
jamal-khey 408a6ca
increase coverage
jamal-khey c82d6cf
fix convertToReactiveCapabilityCurveModificationInfos suggestion
jamal-khey 3e38480
Merge branch 'main' into jamalkhey/vsc-modification
jamal-khey 2e9cf12
Remove unused foreign key constraints
jamal-khey 6ea898d
Refactor reactive limit checks in VscModification , GeneratorModifica…
jamal-khey 61709bb
refactor code to avoid duplication detected by intellij
jamal-khey edab6dd
Merge branch 'main' into jamalkhey/vsc-modification
jamal-khey f409c7b
add Copyright
jamal-khey c8908e6
fix duplicated log
jamal-khey d3eb7a9
Merge branch 'main' into jamalkhey/vsc-modification
jamal-khey 348c123
increase test coverage, add test for ModifyOperatorActiveRange
jamal-khey 93a8353
fix style
jamal-khey fe0ab99
Merge branch 'main' into jamalkhey/vsc-modification
jamal-khey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/org/gridsuite/modification/server/dto/ConverterStationModificationInfos.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.gridsuite.modification.server.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import lombok.experimental.SuperBuilder; | ||
import org.gridsuite.modification.server.dto.annotation.ModificationErrorTypeName; | ||
import org.gridsuite.modification.server.entities.equipment.modification.ConverterStationModificationEntity; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author jamal kheyyad <jamal.kheyyad at rte-france.com> | ||
*/ | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
@Getter | ||
@Setter | ||
@ToString(callSuper = true) | ||
@Schema(description = "Converter station modification") | ||
@JsonTypeName("CONVERTER_STATION_MODIFICATION") | ||
@ModificationErrorTypeName("MODIFY_CONVERTER_STATION_ERROR") | ||
public class ConverterStationModificationInfos extends InjectionModificationInfos { | ||
@Schema(description = "Loss Factor") | ||
private AttributeModification<Float> lossFactor; | ||
|
||
@Schema(description = "Reactive power") | ||
private AttributeModification<Double> reactivePower; | ||
|
||
@Schema(description = "Voltage regulation") | ||
private AttributeModification<Boolean> voltageRegulationOn; | ||
|
||
@Schema(description = "Voltage") | ||
private AttributeModification<Double> voltage; | ||
|
||
@Schema(description = "Reactive capability curve") | ||
private AttributeModification<Boolean> reactiveCapabilityCurve; | ||
|
||
@Schema(description = "Minimum reactive power") | ||
private AttributeModification<Double> minimumReactivePower; | ||
|
||
@Schema(description = "Maximum reactive power") | ||
private AttributeModification<Double> maximumReactivePower; | ||
|
||
@Schema(description = "Reactive capability curve points") | ||
private List<ReactiveCapabilityCurveModificationInfos> reactiveCapabilityCurvePoints; | ||
|
||
@Override | ||
public ConverterStationModificationEntity toEntity() { | ||
return new ConverterStationModificationEntity(this); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/org/gridsuite/modification/server/dto/DTOUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.gridsuite.modification.server.dto; | ||
|
||
import org.gridsuite.modification.server.entities.equipment.modification.ReactiveCapabilityCurveModificationEmbeddable; | ||
import org.springframework.util.CollectionUtils; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author jamal kheyyad <jamal.kheyyad at rte-france.com> | ||
*/ | ||
public final class DTOUtils { | ||
private DTOUtils() { | ||
} | ||
|
||
public static List<ReactiveCapabilityCurveModificationInfos> convertToReactiveCapabilityCurveModificationInfos(List<ReactiveCapabilityCurveModificationEmbeddable> rCCpoints) { | ||
return CollectionUtils.isEmpty(rCCpoints) ? null : rCCpoints | ||
.stream() | ||
.map(value -> new ReactiveCapabilityCurveModificationInfos(value.getQminP(), value.getOldQminP(), | ||
value.getQmaxP(), value.getOldQmaxP(), | ||
value.getP(), value.getOldP())) | ||
.toList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
src/main/java/org/gridsuite/modification/server/dto/VscModificationInfos.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package org.gridsuite.modification.server.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import com.powsybl.commons.reporter.Reporter; | ||
import com.powsybl.commons.reporter.ReporterModel; | ||
import com.powsybl.iidm.network.HvdcLine; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
import lombok.experimental.SuperBuilder; | ||
import org.gridsuite.modification.server.dto.annotation.ModificationErrorTypeName; | ||
import org.gridsuite.modification.server.entities.equipment.modification.VscModificationEntity; | ||
import org.gridsuite.modification.server.modifications.AbstractModification; | ||
import org.gridsuite.modification.server.modifications.VscModification; | ||
|
||
/** | ||
* @author jamal kheyyad <jamal.kheyyad at rte-france.com> | ||
*/ | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
@Data | ||
@ToString(callSuper = true) | ||
@Schema(description = "VSC modification") | ||
@JsonTypeName("VSC_MODIFICATION") | ||
@ModificationErrorTypeName("MODIFY_VSC_ERROR") | ||
public class VscModificationInfos extends BasicEquipmentModificationInfos { | ||
@Schema(description = "DC nominal voltage") | ||
private AttributeModification<Double> dcNominalVoltage; | ||
|
||
@Schema(description = "DC resistance") | ||
private AttributeModification<Double> dcResistance; | ||
|
||
@Schema(description = "Maximum active power ") | ||
private AttributeModification<Double> maximumActivePower; | ||
|
||
@Schema(description = "Operator active power limit (Side1->Side2)") | ||
private AttributeModification<Float> operatorActivePowerLimitFromSide1ToSide2; | ||
|
||
@Schema(description = "Operator active power limit (Side2->Side1)") | ||
private AttributeModification<Float> operatorActivePowerLimitFromSide2ToSide1; | ||
|
||
@Schema(description = "Converters mode") | ||
private AttributeModification<HvdcLine.ConvertersMode> convertersMode; | ||
|
||
@Schema(description = "Active power") | ||
private AttributeModification<Double> activePower; | ||
|
||
@Schema(description = "Angle droop active power control ") | ||
private AttributeModification<Boolean> angleDroopActivePowerControl; | ||
|
||
@Schema(description = "p0") | ||
private AttributeModification<Float> p0; | ||
|
||
@Schema(description = "droop") | ||
private AttributeModification<Float> droop; | ||
|
||
@Schema(description = "Converter station 1") | ||
private ConverterStationModificationInfos converterStation1; | ||
|
||
@Schema(description = "Converter station 2") | ||
private ConverterStationModificationInfos converterStation2; | ||
|
||
@Override | ||
public VscModificationEntity toEntity() { | ||
return new VscModificationEntity(this); | ||
} | ||
|
||
@Override | ||
public AbstractModification toModification() { | ||
return new VscModification(this); | ||
} | ||
|
||
@Override | ||
public Reporter createSubReporter(ReporterModel reporter) { | ||
return reporter.createSubReporter(getType().name(), "Vsc modification ${vscId}", "vscId", this.getEquipmentId()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
...dification/server/entities/equipment/modification/ConverterStationModificationEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
package org.gridsuite.modification.server.entities.equipment.modification; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.NonNull; | ||
import org.gridsuite.modification.server.dto.*; | ||
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; | ||
|
||
import java.util.List; | ||
|
||
import static org.gridsuite.modification.server.entities.equipment.modification.attribute.IAttributeModificationEmbeddable.toAttributeModification; | ||
|
||
/** | ||
* @author jamal kheyyad <jamal.kheyyad at rte-france.com> | ||
*/ | ||
|
||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
@Entity | ||
@Table(name = "converterStationModification") | ||
public class ConverterStationModificationEntity extends InjectionModificationEntity { | ||
|
||
@Embedded | ||
@AttributeOverrides(value = {@AttributeOverride(name = "value", column = @Column(name = "lossFactor")), @AttributeOverride(name = "opType", column = @Column(name = "lossFactorOp")) | ||
}) | ||
private FloatModificationEmbedded lossFactor; | ||
|
||
@Embedded | ||
@AttributeOverrides(value = {@AttributeOverride(name = "value", column = @Column(name = "minimumReactivePower")), @AttributeOverride(name = "opType", column = @Column(name = "minimumReactivePowerOp")) | ||
}) | ||
private DoubleModificationEmbedded minimumReactivePower; | ||
|
||
@Embedded | ||
@AttributeOverrides(value = {@AttributeOverride(name = "value", column = @Column(name = "maximumReactivePower")), @AttributeOverride(name = "opType", column = @Column(name = "maximumReactivePowerOp")) | ||
}) | ||
private DoubleModificationEmbedded maximumReactivePower; | ||
|
||
@Embedded | ||
@AttributeOverrides(value = {@AttributeOverride(name = "value", column = @Column(name = "reactivePower")), @AttributeOverride(name = "opType", column = @Column(name = "reactivePowerOp")) | ||
}) | ||
private DoubleModificationEmbedded reactivePower; | ||
|
||
@Embedded | ||
@AttributeOverrides(value = {@AttributeOverride(name = "value", column = @Column(name = "voltageRegulationOn")), @AttributeOverride(name = "opType", column = @Column(name = "voltageRegulationOnOp")) | ||
}) | ||
private BooleanModificationEmbedded voltageRegulationOn; | ||
|
||
@Embedded | ||
@AttributeOverrides(value = {@AttributeOverride(name = "value", column = @Column(name = "voltage")), @AttributeOverride(name = "opType", column = @Column(name = "voltageOp")) | ||
}) | ||
private DoubleModificationEmbedded voltage; | ||
|
||
@ElementCollection | ||
@CollectionTable(name = "converter_station_modification_rcc_points") | ||
private List<ReactiveCapabilityCurveModificationEmbeddable> reactiveCapabilityCurvePoints; | ||
|
||
@Embedded | ||
@AttributeOverrides(value = {@AttributeOverride(name = "value", column = @Column(name = "reactiveCapabilityCurve")), @AttributeOverride(name = "opType", column = @Column(name = "reactiveCapabilityCurveOp")) | ||
}) | ||
private BooleanModificationEmbedded reactiveCapabilityCurve; | ||
|
||
public ConverterStationModificationEntity(ConverterStationModificationInfos converterStationModificationInfos) { | ||
super(converterStationModificationInfos); | ||
assignAttributes(converterStationModificationInfos); | ||
} | ||
|
||
@Override | ||
public void update(@NonNull ModificationInfos modificationInfos) { | ||
super.update(modificationInfos); | ||
assignAttributes((ConverterStationModificationInfos) modificationInfos); | ||
} | ||
|
||
private void assignAttributes(ConverterStationModificationInfos converterStationModificationInfos) { | ||
this.lossFactor = converterStationModificationInfos.getLossFactor() != null ? new FloatModificationEmbedded(converterStationModificationInfos.getLossFactor()) : null; | ||
this.minimumReactivePower = converterStationModificationInfos.getMinimumReactivePower() != null ? new DoubleModificationEmbedded(converterStationModificationInfos.getMinimumReactivePower()) : null; | ||
this.maximumReactivePower = converterStationModificationInfos.getMaximumReactivePower() != null ? new DoubleModificationEmbedded(converterStationModificationInfos.getMaximumReactivePower()) : null; | ||
this.reactivePower = converterStationModificationInfos.getReactivePower() != null ? new DoubleModificationEmbedded(converterStationModificationInfos.getReactivePower()) : null; | ||
this.voltageRegulationOn = converterStationModificationInfos.getVoltageRegulationOn() != null ? new BooleanModificationEmbedded(converterStationModificationInfos.getVoltageRegulationOn()) : null; | ||
this.voltage = converterStationModificationInfos.getVoltage() != null ? new DoubleModificationEmbedded(converterStationModificationInfos.getVoltage()) : null; | ||
this.reactiveCapabilityCurve = converterStationModificationInfos.getReactiveCapabilityCurve() != null ? new BooleanModificationEmbedded(converterStationModificationInfos.getReactiveCapabilityCurve()) : null; | ||
this.reactiveCapabilityCurvePoints = toEmbeddablePoints(converterStationModificationInfos.getReactiveCapabilityCurvePoints()); | ||
|
||
} | ||
|
||
public static List<ReactiveCapabilityCurveModificationEmbeddable> toEmbeddablePoints( | ||
List<ReactiveCapabilityCurveModificationInfos> points) { | ||
return points == null ? null | ||
: points.stream() | ||
.map(point -> new ReactiveCapabilityCurveModificationEmbeddable(point.getQminP(), point.getOldQminP(), | ||
point.getQmaxP(), point.getOldQmaxP(), point.getP(), | ||
point.getOldP())) | ||
.toList(); | ||
} | ||
|
||
@Override | ||
public ConverterStationModificationInfos toModificationInfos() { | ||
return toConverterStationModificationInfoBuilder().build(); | ||
} | ||
|
||
private ConverterStationModificationInfos.ConverterStationModificationInfosBuilder<?, ?> toConverterStationModificationInfoBuilder() { | ||
|
||
return ConverterStationModificationInfos.builder() | ||
.uuid(getId()) | ||
.date(getDate()) | ||
.stashed(getStashed()) | ||
.equipmentId(getEquipmentId()) | ||
.equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp())) | ||
.lossFactor(toAttributeModification(getLossFactor())) | ||
.minimumReactivePower(toAttributeModification(getMinimumReactivePower())) | ||
.maximumReactivePower(toAttributeModification(getMaximumReactivePower())) | ||
.reactivePower(toAttributeModification(getReactivePower())) | ||
.voltageRegulationOn(toAttributeModification(getVoltageRegulationOn())) | ||
.voltage(toAttributeModification(getVoltage())) | ||
.reactiveCapabilityCurve(toAttributeModification(getReactiveCapabilityCurve())) | ||
.reactiveCapabilityCurvePoints(DTOUtils.convertToReactiveCapabilityCurveModificationInfos(getReactiveCapabilityCurvePoints())); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it can be done like this i think
public static List convertToReactiveCapabilityCurveModificationInfos(List rCCpoints) {
return CollectionUtils.isEmpty(rCCpoints) ? List.of() : rCCpoints
.stream()
.map(value -> new ReactiveCapabilityCurveModificationInfos(value.getQminP(), value.getOldQminP(),
value.getQmaxP(), value.getOldQmaxP(),
value.getP(), value.getOldP()))
.toList();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done , i juste replaced 'List.of()' in your suggestion by 'null'