Skip to content
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

add creation cspr modification network #519

Merged
merged 28 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b22a80c
first version of creation cspr
ghazwarhili Aug 20, 2024
2540fdb
Merge branch 'main' into create-modification-CSPR
ghazwarhili Aug 21, 2024
9cf4733
unuset import
ghazwarhili Aug 21, 2024
ea496ab
add table for stand by automate
ghazwarhili Aug 23, 2024
de654e8
cspr creation modification network
ghazwarhili Aug 25, 2024
b5b1ff2
add coverage for new code
ghazwarhili Aug 26, 2024
75a1c12
Merge branch 'main' into create-modification-CSPR
thangqp Aug 26, 2024
87922c4
fix sanor and coverage code
ghazwarhili Aug 26, 2024
8c1ab25
Merge remote-tracking branch 'origin/create-modification-CSPR' into c…
ghazwarhili Aug 26, 2024
416cff2
refacto some commun function and fix some issues
ghazwarhili Sep 5, 2024
b114562
Merge branch 'main' into create-modification-CSPR
ghazwarhili Sep 5, 2024
a01d340
fix unused import
ghazwarhili Sep 5, 2024
b902bf1
fix issues
ghazwarhili Sep 5, 2024
a631d4c
merge main into branch and resolve conflicts
ghazwarhili Sep 11, 2024
99ad321
code review remarqs
ghazwarhili Sep 11, 2024
c607863
code review remarqs
ghazwarhili Sep 12, 2024
395729b
Merge branch 'main' into create-modification-CSPR
ghazwarhili Sep 12, 2024
6aaf280
Merge branch 'main' into create-modification-CSPR
thangqp Sep 17, 2024
f34eb03
fix nan if null
ghazwarhili Sep 17, 2024
73783d2
Merge branch 'create-modification-CSPR' of https://github.com/gridsui…
ghazwarhili Sep 17, 2024
31fb678
code review remarks
ghazwarhili Sep 17, 2024
00ee3ac
resolve conflicts
ghazwarhili Sep 19, 2024
2a445bc
fix resolving conflicts errors
ghazwarhili Sep 19, 2024
705ee20
Merge branch 'main' into create-modification-CSPR
thangqp Sep 26, 2024
9277a9e
fix review remarqs
ghazwarhili Oct 2, 2024
71fc33f
merge main into branch
ghazwarhili Oct 4, 2024
bd6d18b
code review remarqs
ghazwarhili Oct 8, 2024
74b7f53
Merge branch 'main' into create-modification-CSPR
ghazwarhili Oct 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public enum ModificationType {
SUBSTATION_MODIFICATION(PreloadingStrategy.NONE),
SHUNT_COMPENSATOR_CREATION(PreloadingStrategy.NONE),
SHUNT_COMPENSATOR_MODIFICATION(PreloadingStrategy.NONE),
STATIC_VAR_COMPENSATOR_CREATION(PreloadingStrategy.NONE),
VOLTAGE_LEVEL_CREATION(PreloadingStrategy.NONE),
VOLTAGE_LEVEL_MODIFICATION(PreloadingStrategy.NONE),
LINE_SPLIT_WITH_VOLTAGE_LEVEL(PreloadingStrategy.NONE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public enum Type {
CREATE_GENERATOR_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
CREATE_SHUNT_COMPENSATOR_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
MODIFY_SHUNT_COMPENSATOR_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
CREATE_STATIC_VAR_COMPENSATOR_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
DELETE_EQUIPMENT_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
BY_FILTER_DELETION_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
EQUIPMENT_NOT_FOUND(HttpStatus.NOT_FOUND),
Expand All @@ -70,6 +71,8 @@ public enum Type {
GENERATOR_ALREADY_EXISTS(HttpStatus.BAD_REQUEST),
SHUNT_COMPENSATOR_ALREADY_EXISTS(HttpStatus.BAD_REQUEST),
SHUNT_COMPENSATOR_NOT_FOUND(HttpStatus.NOT_FOUND),
STATIC_VAR_COMPENSATOR_ALREADY_EXISTS(HttpStatus.BAD_REQUEST),
STATIC_VAR_COMPENSATOR_NOT_FOUND(HttpStatus.NOT_FOUND),
LINE_ALREADY_EXISTS(HttpStatus.BAD_REQUEST),
TWO_WINDINGS_TRANSFORMER_ALREADY_EXISTS(HttpStatus.BAD_REQUEST),
TWO_WINDINGS_TRANSFORMER_CREATION_ERROR(HttpStatus.BAD_REQUEST),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
@JsonSubTypes.Type(value = VoltageLevelModificationInfos.class),
@JsonSubTypes.Type(value = ShuntCompensatorCreationInfos.class),
@JsonSubTypes.Type(value = ShuntCompensatorModificationInfos.class),
@JsonSubTypes.Type(value = StaticVarCompensatorCreationInfos.class),
@JsonSubTypes.Type(value = TwoWindingsTransformerCreationInfos.class),
@JsonSubTypes.Type(value = TwoWindingsTransformerModificationInfos.class),
@JsonSubTypes.Type(value = EquipmentDeletionInfos.class),
Expand Down
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;
ghazwarhili marked this conversation as resolved.
Show resolved Hide resolved

@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();
}
}
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;
ghazwarhili marked this conversation as resolved.
Show resolved Hide resolved

@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());
}
}
Loading
Loading