-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Bertrand Rix <bertrand.rix@artelys.com> Co-authored-by: José Antonio Marqués <marquesja@aia.es> Co-authored-by: Luma <zamarrenolm@aia.es> Co-authored-by: Anne Tilloy <anne.tilloy@rte-france.com> Co-authored-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
- Loading branch information
1 parent
101549a
commit 67216f4
Showing
43 changed files
with
1,284 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,6 @@ public enum LimitType { | |
ACTIVE_POWER, | ||
APPARENT_POWER, | ||
CURRENT, | ||
VOLTAGE | ||
VOLTAGE, | ||
VOLTAGE_ANGLE | ||
} |
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
17 changes: 17 additions & 0 deletions
17
iidm/iidm-api/src/main/java/com/powsybl/iidm/network/ThreeSides.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,17 @@ | ||
/** | ||
* 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/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
package com.powsybl.iidm.network; | ||
|
||
/* | ||
@author Bertrand Rix <bertrand.rix at artelys.com> | ||
*/ | ||
public enum ThreeSides { | ||
ONE, | ||
TWO, | ||
THREE | ||
} |
50 changes: 50 additions & 0 deletions
50
iidm/iidm-api/src/main/java/com/powsybl/iidm/network/VoltageAngleLimit.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,50 @@ | ||
/** | ||
* 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/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
package com.powsybl.iidm.network; | ||
|
||
import java.util.OptionalDouble; | ||
|
||
/** | ||
* @author Luma Zamarreño <zamarrenolm at aia.es> | ||
* @author José Antonio Marqués <marquesja at aia.es> | ||
* @author Bertrand Rix <bertrand.rix at artelys.com> | ||
*/ | ||
public interface VoltageAngleLimit extends OperationalLimits { | ||
|
||
@Override | ||
default LimitType getLimitType() { | ||
return LimitType.VOLTAGE_ANGLE; | ||
} | ||
|
||
/** | ||
* Return the mandatory name. | ||
*/ | ||
String getId(); | ||
|
||
/** | ||
* A voltage angle limit is compared to the difference between the bus angle associated to the terminal from and | ||
* the bus angle associated to the terminal to. Difference = to - from. | ||
*/ | ||
Terminal getTerminalFrom(); | ||
|
||
/** | ||
* A voltage angle limit is compared to the difference between the bus angle associated to the terminal from and | ||
* the bus angle associated to the terminal to. Difference = to - from. | ||
*/ | ||
Terminal getTerminalTo(); | ||
|
||
/** | ||
* Get the low voltage angle limit value | ||
*/ | ||
OptionalDouble getLowLimit(); | ||
|
||
/** | ||
* Get the high voltage angle limit value | ||
*/ | ||
OptionalDouble getHighLimit(); | ||
} |
26 changes: 26 additions & 0 deletions
26
iidm/iidm-api/src/main/java/com/powsybl/iidm/network/VoltageAngleLimitAdder.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,26 @@ | ||
/** | ||
* 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/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
package com.powsybl.iidm.network; | ||
|
||
/** | ||
* @author Luma Zamarreño <zamarrenolm at aia.es> | ||
* @author José Antonio Marqués <marquesja at aia.es> | ||
*/ | ||
|
||
public interface VoltageAngleLimitAdder extends OperationalLimitsAdder<VoltageAngleLimit, VoltageAngleLimitAdder> { | ||
|
||
VoltageAngleLimitAdder setId(String name); | ||
|
||
VoltageAngleLimitAdder from(Terminal from); | ||
|
||
VoltageAngleLimitAdder to(Terminal to); | ||
|
||
VoltageAngleLimitAdder setLowLimit(double lowLimit); | ||
|
||
VoltageAngleLimitAdder setHighLimit(double highLimit); | ||
} |
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
80 changes: 80 additions & 0 deletions
80
iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/VoltageAngleLimitAdderImpl.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,80 @@ | ||
/** | ||
* 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/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
package com.powsybl.iidm.network.impl; | ||
|
||
import com.powsybl.commons.PowsyblException; | ||
import com.powsybl.iidm.network.*; | ||
import com.powsybl.iidm.network.impl.util.Ref; | ||
|
||
/** | ||
* | ||
* @author Luma Zamarreño <zamarrenolm at aia.es> | ||
* @author José Antonio Marqués <marquesja at aia.es> | ||
*/ | ||
class VoltageAngleLimitAdderImpl implements VoltageAngleLimitAdder { | ||
|
||
private final Ref<NetworkImpl> networkRef; | ||
private String id; | ||
private Terminal from; | ||
private Terminal to; | ||
private double lowLimit = Double.NaN; | ||
|
||
private double highLimit = Double.NaN; | ||
|
||
VoltageAngleLimitAdderImpl(Ref<NetworkImpl> networkRef) { | ||
this.networkRef = networkRef; | ||
} | ||
|
||
@Override | ||
public VoltageAngleLimitAdderImpl setId(String id) { | ||
this.id = id; | ||
return this; | ||
} | ||
|
||
@Override | ||
public VoltageAngleLimitAdderImpl from(Terminal from) { | ||
this.from = from; | ||
return this; | ||
} | ||
|
||
@Override | ||
public VoltageAngleLimitAdderImpl to(Terminal to) { | ||
this.to = to; | ||
return this; | ||
} | ||
|
||
@Override | ||
public VoltageAngleLimitAdderImpl setLowLimit(double lowLimit) { | ||
this.lowLimit = lowLimit; | ||
return this; | ||
} | ||
|
||
@Override | ||
public VoltageAngleLimitAdderImpl setHighLimit(double highLimit) { | ||
this.highLimit = highLimit; | ||
return this; | ||
} | ||
|
||
@Override | ||
public VoltageAngleLimit add() { | ||
if (id == null) { | ||
throw new IllegalStateException("Voltage angle limit id is mandatory."); | ||
} | ||
if (networkRef.get().getVoltageAngleLimitsIndex().containsKey(id)) { | ||
throw new PowsyblException("The network " + networkRef.get().getId() | ||
+ " already contains a voltage angle limit with the id '" + id + "'"); | ||
} | ||
if (!Double.isNaN(lowLimit) && !Double.isNaN(highLimit) && lowLimit >= highLimit) { | ||
throw new IllegalStateException("Voltage angle low limit must be lower than the high limit."); | ||
} | ||
|
||
VoltageAngleLimit voltageAngleLimit = new VoltageAngleLimitImpl(id, from, to, lowLimit, highLimit); | ||
networkRef.get().getVoltageAngleLimitsIndex().put(id, voltageAngleLimit); | ||
return voltageAngleLimit; | ||
} | ||
} |
Oops, something went wrong.