Skip to content

Commit

Permalink
add report for regulation mode and type
Browse files Browse the repository at this point in the history
  • Loading branch information
ghazwarhili committed Oct 22, 2024
1 parent c92f933 commit 8fb90d5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ public void checkReactivePowerLimitsAndSetPointsCreation(StaticVarCompensatorCre
throw makeEquipmentException(creationInfos.getErrorType(), creationInfos.getEquipmentId(), equipmentName, "maximum susceptance is expected to be greater than or equal to minimum susceptance");
}
if (Objects.nonNull(creationInfos.getMaxQAtNominalV()) && Objects.nonNull(creationInfos.getMinQAtNominalV()) && creationInfos.getMaxQAtNominalV() < creationInfos.getMinQAtNominalV()) {
throw makeEquipmentException(creationInfos.getErrorType(), creationInfos.getEquipmentId(), equipmentName, "maximum Q is expected to be greater than or equal to minimum Q");
throw makeEquipmentException(creationInfos.getErrorType(), creationInfos.getEquipmentId(), equipmentName, "maximum Q at nominal voltage is expected to be greater than or equal to minimum Q");
}

// check set points
Expand All @@ -1358,12 +1358,12 @@ public void checkStandbyAutomatonCreation(StaticVarCompensatorCreationInfos crea
if (Objects.nonNull(creationInfos.getB0()) && Objects.nonNull(creationInfos.getMinSusceptance()) && Objects.nonNull(creationInfos.getMaxSusceptance()) &&
(creationInfos.getB0() < creationInfos.getMinSusceptance() || creationInfos.getB0() > creationInfos.getMaxSusceptance())) {
throw makeEquipmentException(creationInfos.getErrorType(), creationInfos.getEquipmentId(), equipmentName,
"b0 must be within the range of minimun susceptance and maximum susceptance");
"b0 must be within the range of minimum susceptance and maximum susceptance");
}
if (Objects.nonNull(creationInfos.getQ0()) && Objects.nonNull(creationInfos.getMinQAtNominalV()) && Objects.nonNull(creationInfos.getMaxQAtNominalV()) &&
(creationInfos.getQ0() < creationInfos.getMinQAtNominalV() || creationInfos.getQ0() > creationInfos.getMaxQAtNominalV())) {
throw makeEquipmentException(creationInfos.getErrorType(), creationInfos.getEquipmentId(), equipmentName,
"q0 must be within the range of minimun Q and maximum Q");
"q0 must be within the range of minimum Q and maximum Q");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.powsybl.iidm.network.extensions.StandbyAutomatonAdder;
import org.gridsuite.modification.server.NetworkModificationException;
import org.gridsuite.modification.server.dto.StaticVarCompensatorCreationInfos;
import org.gridsuite.modification.server.dto.VoltageRegulationType;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -212,15 +211,18 @@ private void reportStaticVarCompensatorLimitsAndSetpoints(StaticVarCompensatorCr
if (Objects.nonNull(staticVarCompensatorCreationInfos.getMaxQAtNominalV())) {
voltageReports.add(ModificationUtils.getInstance().buildCreationReport(staticVarCompensatorCreationInfos.getMaxQAtNominalV(), "Q max at nominal voltage"));
}
if (Objects.nonNull(staticVarCompensatorCreationInfos.getRegulationMode())) {
voltageReports.add(ModificationUtils.getInstance().buildCreationReport(staticVarCompensatorCreationInfos.getRegulationMode(), "regulation mode"));
}
if (Objects.nonNull(staticVarCompensatorCreationInfos.getVoltageSetpoint())) {
voltageReports.add(ModificationUtils.getInstance().buildCreationReport(staticVarCompensatorCreationInfos.getVoltageSetpoint(), "Voltage set point"));
}
if (Objects.nonNull(staticVarCompensatorCreationInfos.getReactivePowerSetpoint())) {
voltageReports.add(ModificationUtils.getInstance().buildCreationReport(staticVarCompensatorCreationInfos.getReactivePowerSetpoint(), "Reactive power set point"));
}
voltageReports.add(ModificationUtils.getInstance()
.createEnabledDisabledReport("VoltageRegulationOn", modificationInfos.getVoltageRegulationType() == VoltageRegulationType.DISTANT &&
modificationInfos.getRegulationMode() == StaticVarCompensator.RegulationMode.VOLTAGE));
if (Objects.nonNull(staticVarCompensatorCreationInfos.getVoltageRegulationType())) {
voltageReports.add(ModificationUtils.getInstance().buildCreationReport(staticVarCompensatorCreationInfos.getVoltageRegulationType(), "Voltage Regulation type"));
}
if (staticVarCompensatorCreationInfos.getRegulatingTerminalVlId() != null && staticVarCompensatorCreationInfos.getRegulatingTerminalId() != null &&
staticVarCompensatorCreationInfos.getRegulatingTerminalType() != null) {
Terminal terminal = ModificationUtils.getInstance().getTerminalFromIdentifiable(voltageLevel.getNetwork(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ public void testCreateWithErrors() throws Exception {
compensatorCreationInfos.setMaxSusceptance(null);
compensatorCreationInfos.setMinSusceptance(null);
compensatorCreationInfos.setMaxQAtNominalV(200.0);
compensatorCreationInfos.setMinQAtNominalV(300.0);
compensatorCreationInfosJson = mapper.writeValueAsString(compensatorCreationInfos);
mockMvc.perform(post(getNetworkModificationUri()).content(compensatorCreationInfosJson).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
assertLogMessage("CREATE_STATIC_VAR_COMPENSATOR_ERROR : " +
"StaticVarCompensator 'idStaticVarCompensator2' : maximum Q at nominal voltage is expected to be greater than or equal to minimum Q",
compensatorCreationInfos.getErrorType().name(), reportService);
compensatorCreationInfos.setMaxQAtNominalV(200.0);
compensatorCreationInfos.setMinQAtNominalV(100.0);
compensatorCreationInfos.setRegulationMode(StaticVarCompensator.RegulationMode.REACTIVE_POWER);
compensatorCreationInfos.setReactivePowerSetpoint(null);
Expand Down Expand Up @@ -213,7 +221,7 @@ public void testCreateWithErrors() throws Exception {
});
assertTrue(networkModificationResult.isEmpty());
assertNull(getNetwork().getStaticVarCompensator("idStaticVarCompensator3"));
testNetworkModificationsCount(getGroupId(), 10);
testNetworkModificationsCount(getGroupId(), 11);
}

@Test
Expand All @@ -234,11 +242,20 @@ public void testCreateWithStandbyAutomatonErrors() throws Exception {
mockMvc.perform(post(getNetworkModificationUri()).content(compensatorCreationInfosJson).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
assertLogMessage("CREATE_STATIC_VAR_COMPENSATOR_ERROR : " +
"StaticVarCompensator 'idStaticVarCompensator1' : q0 must be within the range of minimun Q and maximum Q",
"StaticVarCompensator 'idStaticVarCompensator1' : q0 must be within the range of minimum Q and maximum Q",
compensatorCreationInfos.getErrorType().name(), reportService);

compensatorCreationInfos.setB0(200.0);
compensatorCreationInfos.setMinQAtNominalV(null);
compensatorCreationInfos.setMaxQAtNominalV(null);
compensatorCreationInfos.setMaxSusceptance(300.0);
compensatorCreationInfos.setMinSusceptance(200.0);
compensatorCreationInfos.setB0(400.0);
compensatorCreationInfos.setQ0(null);
compensatorCreationInfosJson = mapper.writeValueAsString(compensatorCreationInfos);
mockMvc.perform(post(getNetworkModificationUri()).content(compensatorCreationInfosJson).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
assertLogMessage("CREATE_STATIC_VAR_COMPENSATOR_ERROR : " +
"StaticVarCompensator 'idStaticVarCompensator1' : b0 must be within the range of minimum susceptance and maximum susceptance",
compensatorCreationInfos.getErrorType().name(), reportService);
compensatorCreationInfos.setRegulationMode(OFF);
compensatorCreationInfos.setStandby(true);

Expand Down

0 comments on commit 8fb90d5

Please sign in to comment.