Skip to content

Commit

Permalink
ultimate cleaning
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu DEHARBE <[email protected]>
  • Loading branch information
Mathieu-Deharbe committed Sep 4, 2024
1 parent d249d45 commit 90b6b5c
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
import org.gridsuite.modification.server.modifications.ModificationUtils;

import static org.gridsuite.modification.server.NetworkModificationException.Type.MODIFY_GENERATOR_ERROR;
import static org.gridsuite.modification.server.modifications.GeneratorModification.modifyGeneratorActiveLimitsAttributes;
import static org.gridsuite.modification.server.modifications.GeneratorModification.modifyGeneratorShortCircuitAttributes;
import static org.gridsuite.modification.server.modifications.GeneratorModification.modifyGeneratorStartUpAttributes;
import static org.gridsuite.modification.server.modifications.GeneratorModification.modifyTargetQ;
import static org.gridsuite.modification.server.modifications.GeneratorModification.modifyTargetV;
import static org.gridsuite.modification.server.modifications.GeneratorModification.*;

/**
* @author Seddik Yengui <Seddik.yengui at rte-france.com>
Expand Down Expand Up @@ -89,7 +85,7 @@ public static void setNewValue(Generator generator, String generatorField, Doubl
case REACTIVE_POWER_SET_POINT -> modifyTargetQ(generator, attrModif);
case VOLTAGE_SET_POINT -> modifyTargetV(generator, attrModif);
case PLANNED_ACTIVE_POWER_SET_POINT ->
modifyGeneratorStartUpAttributes(attrModif, null, null, null, generator, null, null);
modifyGeneratorStartUpAttributes(attrModif, null, null, null, generator, null, null);
case MARGINAL_COST ->
modifyGeneratorStartUpAttributes(null, attrModif, null, null, generator, null, null);
case PLANNED_OUTAGE_RATE ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
import org.gridsuite.modification.server.dto.OperationType;
import org.gridsuite.modification.server.dto.ShuntCompensatorType;

import static org.gridsuite.modification.server.modifications.ShuntCompensatorModification.modifyMaxSusceptance;
import static org.gridsuite.modification.server.modifications.ShuntCompensatorModification.modifyMaximumQAtNominalVoltage;
import static org.gridsuite.modification.server.modifications.ShuntCompensatorModification.modifyMaximumSectionCount;
import static org.gridsuite.modification.server.modifications.ShuntCompensatorModification.modifySectionCount;
import static org.gridsuite.modification.server.modifications.ShuntCompensatorModification.*;

/**
* @author Seddik Yengui <Seddik.yengui at rte-france.com>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
import org.gridsuite.modification.server.dto.AttributeModification;
import org.gridsuite.modification.server.dto.OperationType;

import static org.gridsuite.modification.server.modifications.VoltageLevelModification.modifLowVoltageLimit;
import static org.gridsuite.modification.server.modifications.VoltageLevelModification.modifyHighVoltageLimit;
import static org.gridsuite.modification.server.modifications.VoltageLevelModification.modifyNominalV;
import static org.gridsuite.modification.server.modifications.VoltageLevelModification.modifyVoltageLevelShortCircuit;
import static org.gridsuite.modification.server.modifications.VoltageLevelModification.*;

/**
* @author Seddik Yengui <Seddik.yengui at rte-france.com>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ private void applyFormula(Identifiable<?> identifiable,
.withUntypedValue(KEY_VALUE, newValue)
.withSeverity(TypedValue.TRACE_SEVERITY)
.build());
} catch (Exception e) { // ATTENTION : ce catch attrape bien mes throw mais sans utiliser les messages donc c'est un peu gâché; En faire un spécifique pour les NetworkModificationException ?
} catch (Exception e) {
notEditableEquipments.add(identifiable.getId());
equipmentNotModifiedCount += 1;
reports.add(ReportNode.newRootReportNode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private void modifyGenerator(Generator generator, GeneratorModificationInfos mod
modifyGeneratorLimitsAttributes(modificationInfos, generator, subReportNode);
modifyGeneratorSetpointsAttributes(modificationInfos, generator, subReportNode);
modifyGeneratorShortCircuitAttributes(modificationInfos.getDirectTransX(), modificationInfos.getStepUpTransformerX(), generator, subReportNode);
modifyGeneratorStartUpAttributesAndLog(modificationInfos, generator, subReportNode);
modifyGeneratorStartUpAttributes(modificationInfos, generator, subReportNode);
modifyGeneratorConnectivityAttributes(modificationInfos, generator, subReportNode);
PropertiesUtils.applyProperties(generator, subReportNode, modificationInfos.getProperties(), "GeneratorProperties");
}
Expand Down Expand Up @@ -223,8 +223,8 @@ private ReportNode modifyGeneratorActivePowerControlAttributes(GeneratorModifica
return ModificationUtils.getInstance().modifyActivePowerControlAttributes(activePowerControl, activePowerControlAdder, modificationInfos.getParticipate(), modificationInfos.getDroop(), subReportNode, subReportNodeSetpoints);
}

private void modifyGeneratorStartUpAttributesAndLog(GeneratorModificationInfos modificationInfos, Generator generator,
ReportNode subReportNode) {
private void modifyGeneratorStartUpAttributes(GeneratorModificationInfos modificationInfos, Generator generator,
ReportNode subReportNode) {
List<ReportNode> reports = new ArrayList<>();
modifyGeneratorStartUpAttributes(modificationInfos.getPlannedActivePowerSetPoint(),
modificationInfos.getMarginalCost(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ private void applyModificationOnLinearModel(ReportNode subReportNode, ShuntCompe
}

public static void modifyMaxSusceptance(AttributeModification<Double> maxSusceptance,
int maximumSectionCount,
List<ReportNode> reports,
ShuntCompensatorLinearModel model) {
int maximumSectionCount,
List<ReportNode> reports,
ShuntCompensatorLinearModel model) {
double newSusceptancePerSection = maxSusceptance.getValue() / maximumSectionCount;
if (reports != null) {
double oldSusceptancePerSection = model.getBPerSection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ protected void modifyCharacteristics(Branch<?> branch, BranchModificationInfos b

// Transformer specific fields
TwoWindingsTransformerModificationInfos twoWindingsTransformerModificationInfos = (TwoWindingsTransformerModificationInfos) branchModificationInfos;
modifyTransformerFields(twoWindingsTransformer, twoWindingsTransformerModificationInfos.getG(), twoWindingsTransformerModificationInfos.getB(), twoWindingsTransformerModificationInfos.getRatedS(), twoWindingsTransformerModificationInfos.getRatedU1(), twoWindingsTransformerModificationInfos.getRatedU2(), characteristicsReporter);
modifyTransformerFields(twoWindingsTransformer,
twoWindingsTransformerModificationInfos.getG(),
twoWindingsTransformerModificationInfos.getB(),
twoWindingsTransformerModificationInfos.getRatedS(),
twoWindingsTransformerModificationInfos.getRatedU1(),
twoWindingsTransformerModificationInfos.getRatedU2(),
characteristicsReporter);
}

public static void modifyTransformerFields(TwoWindingsTransformer transformer,
Expand Down

0 comments on commit 90b6b5c

Please sign in to comment.