-
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 add_control_for_battery_and_generator
- Loading branch information
Showing
31 changed files
with
638 additions
and
26 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
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
35 changes: 35 additions & 0 deletions
35
src/main/java/org/gridsuite/modification/server/dto/formula/equipmentfield/LoadField.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,35 @@ | ||
/** | ||
* Copyright (c) 2023, 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.formula.equipmentfield; | ||
|
||
import com.powsybl.iidm.network.Load; | ||
|
||
/** | ||
* @author Seddik Yengui <Seddik.yengui at rte-france.com> | ||
*/ | ||
|
||
public enum LoadField { | ||
ACTIVE_POWER, | ||
REACTIVE_POWER; | ||
|
||
public static Double getReferenceValue(Load load, String loadField) { | ||
LoadField field = LoadField.valueOf(loadField); | ||
return switch (field) { | ||
case ACTIVE_POWER -> load.getP0(); | ||
case REACTIVE_POWER -> load.getQ0(); | ||
}; | ||
} | ||
|
||
public static void setNewValue(Load load, String loadField, Double newValue) { | ||
LoadField field = LoadField.valueOf(loadField); | ||
switch (field) { | ||
case ACTIVE_POWER -> load.setP0(newValue); | ||
case REACTIVE_POWER -> load.setQ0(newValue); | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
.../java/org/gridsuite/modification/server/dto/formula/equipmentfield/VoltageLevelField.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,60 @@ | ||
/** | ||
* Copyright (c) 2023, 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.formula.equipmentfield; | ||
|
||
import com.powsybl.iidm.network.VoltageLevel; | ||
import com.powsybl.iidm.network.extensions.IdentifiableShortCircuit; | ||
import com.powsybl.iidm.network.extensions.IdentifiableShortCircuitAdder; | ||
|
||
/** | ||
* @author Seddik Yengui <Seddik.yengui at rte-france.com> | ||
*/ | ||
|
||
public enum VoltageLevelField { | ||
NOMINAL_VOLTAGE, | ||
LOW_VOLTAGE_LIMIT, | ||
HIGH_VOLTAGE_LIMIT, | ||
LOW_SHORT_CIRCUIT_CURRENT_LIMIT, | ||
HIGH_SHORT_CIRCUIT_CURRENT_LIMIT; | ||
|
||
public static Double getReferenceValue(VoltageLevel voltageLevel, String voltageLevelField) { | ||
IdentifiableShortCircuit<VoltageLevel> identifiableShortCircuit = voltageLevel.getExtension(IdentifiableShortCircuit.class); | ||
VoltageLevelField field = VoltageLevelField.valueOf(voltageLevelField); | ||
return switch (field) { | ||
case NOMINAL_VOLTAGE -> voltageLevel.getNominalV(); | ||
case LOW_VOLTAGE_LIMIT -> voltageLevel.getLowVoltageLimit(); | ||
case HIGH_VOLTAGE_LIMIT -> voltageLevel.getHighVoltageLimit(); | ||
case LOW_SHORT_CIRCUIT_CURRENT_LIMIT -> identifiableShortCircuit == null ? null : identifiableShortCircuit.getIpMin(); | ||
case HIGH_SHORT_CIRCUIT_CURRENT_LIMIT -> identifiableShortCircuit == null ? null : identifiableShortCircuit.getIpMax(); | ||
}; | ||
} | ||
|
||
public static void setNewValue(VoltageLevel voltageLevel, String voltageLevelField, Double newValue) { | ||
IdentifiableShortCircuit<VoltageLevel> identifiableShortCircuit = voltageLevel.getExtension(IdentifiableShortCircuit.class); | ||
VoltageLevelField field = VoltageLevelField.valueOf(voltageLevelField); | ||
switch (field) { | ||
case NOMINAL_VOLTAGE -> voltageLevel.setNominalV(newValue); | ||
case LOW_VOLTAGE_LIMIT -> voltageLevel.setLowVoltageLimit(newValue); | ||
case HIGH_VOLTAGE_LIMIT -> voltageLevel.setHighVoltageLimit(newValue); | ||
case LOW_SHORT_CIRCUIT_CURRENT_LIMIT -> { | ||
IdentifiableShortCircuitAdder<VoltageLevel> adder = voltageLevel.newExtension(IdentifiableShortCircuitAdder.class).withIpMin(newValue); | ||
if (identifiableShortCircuit != null) { | ||
adder.withIpMax(identifiableShortCircuit.getIpMax()); | ||
} | ||
adder.add(); | ||
} | ||
case HIGH_SHORT_CIRCUIT_CURRENT_LIMIT -> { | ||
IdentifiableShortCircuitAdder<VoltageLevel> adder = voltageLevel.newExtension(IdentifiableShortCircuitAdder.class).withIpMax(newValue); | ||
if (identifiableShortCircuit != null) { | ||
adder.withIpMin(identifiableShortCircuit.getIpMin()); | ||
} | ||
adder.add(); | ||
} | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.