-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into change-modification-order-when-deleted
- Loading branch information
Showing
18 changed files
with
1,162 additions
and
196 deletions.
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
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
109 changes: 109 additions & 0 deletions
109
src/main/java/org/gridsuite/modification/server/dto/StaticVarCompensatorCreationInfos.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,109 @@ | ||
/** | ||
* Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package org.gridsuite.modification.server.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import com.powsybl.commons.report.ReportNode; | ||
import com.powsybl.iidm.network.StaticVarCompensator; | ||
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.ModificationType; | ||
import org.gridsuite.modification.server.dto.annotation.ModificationErrorTypeName; | ||
import org.gridsuite.modification.server.entities.equipment.creation.StaticCompensatorCreationEntity; | ||
import org.gridsuite.modification.server.modifications.AbstractModification; | ||
import org.gridsuite.modification.server.modifications.StaticVarCompensatorCreation; | ||
|
||
/** | ||
* @author Ghazwa Rehili <ghazwa.rehili at rte-france.com> | ||
*/ | ||
|
||
@SuperBuilder | ||
@NoArgsConstructor | ||
@Getter | ||
@Setter | ||
@ToString(callSuper = true) | ||
@Schema(description = "Static var compensator creation") | ||
@JsonTypeName("STATIC_VAR_COMPENSATOR_CREATION") | ||
@ModificationErrorTypeName("CREATE_STATIC_VAR_COMPENSATOR_ERROR") | ||
public class StaticVarCompensatorCreationInfos extends InjectionCreationInfos { | ||
@Schema(description = "Susceptance max") | ||
private Double maxSusceptance; | ||
|
||
@Schema(description = "Susceptance min") | ||
private Double minSusceptance; | ||
|
||
@Schema(description = "Q max at nominal voltage") | ||
private Double maxQAtNominalV; | ||
|
||
@Schema(description = "Q min at nominal voltage") | ||
private Double minQAtNominalV; | ||
|
||
@Schema(description = "regulation mode") | ||
private StaticVarCompensator.RegulationMode regulationMode; | ||
|
||
@Schema(description = "Voltage set point") | ||
private Double voltageSetpoint; | ||
|
||
@Schema(description = "Reactive power set point") | ||
private Double reactivePowerSetpoint; | ||
|
||
@Schema(description = "Voltage Regulation type") | ||
private VoltageRegulationType voltageRegulationType; | ||
|
||
@Schema(description = "Regulating terminal equipment id") | ||
private String regulatingTerminalId; | ||
|
||
@Schema(description = "Regulating terminal equipment type") | ||
private String regulatingTerminalType; | ||
|
||
@Schema(description = "Regulating terminal voltage level id") | ||
private String regulatingTerminalVlId; | ||
|
||
@Schema(description = "standby automaton on") | ||
private boolean standbyAutomatonOn; | ||
|
||
@Schema(description = "Standby") | ||
private boolean standby; | ||
|
||
@Schema(description = "Fixed part of susceptance") | ||
private Double b0; | ||
|
||
@Schema(description = "Fixed part of Q at nominal voltage") | ||
private Double q0; | ||
|
||
@Schema(description = "Low voltage set point ") | ||
private Double lowVoltageSetpoint; | ||
|
||
@Schema(description = "High voltage set point") | ||
private Double highVoltageSetpoint; | ||
|
||
@Schema(description = "Low voltage threshold") | ||
private Double lowVoltageThreshold; | ||
|
||
@Schema(description = "High voltage threshold") | ||
private Double highVoltageThreshold; | ||
|
||
@Override | ||
public StaticCompensatorCreationEntity toEntity() { | ||
return new StaticCompensatorCreationEntity(this); | ||
} | ||
|
||
@Override | ||
public AbstractModification toModification() { | ||
return new StaticVarCompensatorCreation(this); | ||
} | ||
|
||
@Override | ||
public ReportNode createSubReportNode(ReportNode reportNode) { | ||
return reportNode.newReportNode().withMessageTemplate(ModificationType.STATIC_VAR_COMPENSATOR_CREATION.name(), | ||
"Static var compensator creation ${id}").withUntypedValue("id", this.getEquipmentId()).add(); | ||
} | ||
} |
168 changes: 168 additions & 0 deletions
168
...uite/modification/server/entities/equipment/creation/StaticCompensatorCreationEntity.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,168 @@ | ||
/** | ||
* Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package org.gridsuite.modification.server.entities.equipment.creation; | ||
|
||
import com.powsybl.iidm.network.StaticVarCompensator; | ||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.gridsuite.modification.server.dto.ModificationInfos; | ||
import org.gridsuite.modification.server.dto.StaticVarCompensatorCreationInfos; | ||
import org.gridsuite.modification.server.dto.VoltageRegulationType; | ||
import org.gridsuite.modification.server.entities.equipment.modification.FreePropertyEntity; | ||
import org.springframework.util.CollectionUtils; | ||
|
||
/** | ||
* @author Ghazwa Rehili <ghazwa.rehili at rte-france.com> | ||
*/ | ||
@NoArgsConstructor | ||
@Getter | ||
@Entity | ||
@Table(name = "staticVarCompensatorCreation") | ||
@PrimaryKeyJoinColumn(foreignKey = @ForeignKey(name = "staticVarCompensatorCreation_id_fk_constraint")) | ||
public class StaticCompensatorCreationEntity extends InjectionCreationEntity { | ||
@Column | ||
private Double maxSusceptance; | ||
|
||
@Column | ||
private Double minSusceptance; | ||
|
||
@Column | ||
private Double maxQAtNominalV; | ||
|
||
@Column | ||
private Double minQAtNominalV; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "regulationMode") | ||
private StaticVarCompensator.RegulationMode regulationMode; | ||
|
||
@Column | ||
private Double voltageSetpoint; | ||
|
||
@Column | ||
private Double reactivePowerSetpoint; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "voltageRegulationType") | ||
private VoltageRegulationType voltageRegulationType; | ||
|
||
@Column(name = "regulatingTerminalId") | ||
private String regulatingTerminalId; | ||
|
||
@Column(name = "regulatingTerminalType") | ||
private String regulatingTerminalType; | ||
|
||
@Column(name = "regulatingTerminalVlId") | ||
private String regulatingTerminalVlId; | ||
|
||
@Column | ||
private boolean standbyAutomatonOn; | ||
|
||
@Column | ||
private boolean standby; | ||
|
||
@Column | ||
private Double b0; | ||
|
||
@Column | ||
private Double q0; | ||
|
||
@Column | ||
private Double lowVoltageSetpoint; | ||
|
||
@Column | ||
private Double highVoltageSetpoint; | ||
|
||
@Column | ||
private Double lowVoltageThreshold; | ||
|
||
@Column | ||
private Double highVoltageThreshold; | ||
|
||
public StaticCompensatorCreationEntity(StaticVarCompensatorCreationInfos creationInfos) { | ||
super(creationInfos); | ||
assignAttributes(creationInfos); | ||
} | ||
|
||
@Override | ||
public void update(ModificationInfos modificationInfos) { | ||
super.update(modificationInfos); | ||
StaticVarCompensatorCreationInfos staticVarCompensatorCreationInfos = (StaticVarCompensatorCreationInfos) modificationInfos; | ||
assignAttributes(staticVarCompensatorCreationInfos); | ||
} | ||
|
||
private void assignAttributes(StaticVarCompensatorCreationInfos creationInfos) { | ||
this.maxSusceptance = creationInfos.getMaxSusceptance(); | ||
this.minSusceptance = creationInfos.getMinSusceptance(); | ||
this.maxQAtNominalV = creationInfos.getMaxQAtNominalV(); | ||
this.minQAtNominalV = creationInfos.getMinQAtNominalV(); | ||
this.regulationMode = creationInfos.getRegulationMode(); | ||
this.voltageSetpoint = creationInfos.getVoltageSetpoint(); | ||
this.reactivePowerSetpoint = creationInfos.getReactivePowerSetpoint(); | ||
this.voltageRegulationType = creationInfos.getVoltageRegulationType(); | ||
this.regulatingTerminalId = creationInfos.getRegulatingTerminalId(); | ||
this.regulatingTerminalType = creationInfos.getRegulatingTerminalType(); | ||
this.regulatingTerminalVlId = creationInfos.getRegulatingTerminalVlId(); | ||
this.standbyAutomatonOn = creationInfos.isStandbyAutomatonOn(); | ||
this.standby = creationInfos.isStandby(); | ||
this.b0 = creationInfos.getB0(); | ||
this.q0 = creationInfos.getQ0(); | ||
this.highVoltageSetpoint = creationInfos.getHighVoltageSetpoint(); | ||
this.lowVoltageSetpoint = creationInfos.getLowVoltageSetpoint(); | ||
this.lowVoltageThreshold = creationInfos.getLowVoltageThreshold(); | ||
this.highVoltageThreshold = creationInfos.getHighVoltageThreshold(); | ||
} | ||
|
||
@Override | ||
public StaticVarCompensatorCreationInfos toModificationInfos() { | ||
return toStaticVarCompensatorCreationInfosBuilder().build(); | ||
} | ||
|
||
private StaticVarCompensatorCreationInfos.StaticVarCompensatorCreationInfosBuilder<?, ?> toStaticVarCompensatorCreationInfosBuilder() { | ||
return StaticVarCompensatorCreationInfos | ||
.builder() | ||
.uuid(getId()) | ||
.date(getDate()) | ||
.stashed(getStashed()) | ||
.activated(getActivated()) | ||
.equipmentId(getEquipmentId()) | ||
.equipmentName(getEquipmentName()) | ||
// Injection | ||
.voltageLevelId(getVoltageLevelId()) | ||
.busOrBusbarSectionId(getBusOrBusbarSectionId()) | ||
.connectionName(getConnectionName()) | ||
.connectionDirection(getConnectionDirection()) | ||
.connectionPosition(getConnectionPosition()) | ||
.terminalConnected(isTerminalConnected()) | ||
.maxSusceptance(getMaxSusceptance()) | ||
.minSusceptance(getMinSusceptance()) | ||
.minQAtNominalV(getMinQAtNominalV()) | ||
.maxQAtNominalV(getMaxQAtNominalV()) | ||
.regulationMode(getRegulationMode()) | ||
.reactivePowerSetpoint(getReactivePowerSetpoint()) | ||
.voltageSetpoint(getVoltageSetpoint()) | ||
.voltageRegulationType(getVoltageRegulationType()) | ||
.regulatingTerminalId(getRegulatingTerminalId()) | ||
.regulatingTerminalType(getRegulatingTerminalType()) | ||
.regulatingTerminalVlId(getRegulatingTerminalVlId()) | ||
// Standby automaton | ||
.standbyAutomatonOn(isStandbyAutomatonOn()) | ||
.standby(isStandby()) | ||
.b0(getB0()) | ||
.q0(getQ0()) | ||
.lowVoltageSetpoint(getLowVoltageSetpoint()) | ||
.highVoltageSetpoint(getHighVoltageSetpoint()) | ||
.lowVoltageThreshold(getLowVoltageThreshold()) | ||
.highVoltageThreshold(getHighVoltageThreshold()) | ||
// properties | ||
.properties(CollectionUtils.isEmpty(getProperties()) ? null : | ||
getProperties().stream() | ||
.map(FreePropertyEntity::toInfos) | ||
.toList()); | ||
} | ||
} |
Oops, something went wrong.