-
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.
Add the violation location in voltage LimitViolations (#3153)
* allow to get the bus id or the bus bar ids as limitViolation Id * refactor and add tests Signed-off-by: Etienne LESOT <[email protected]>
- Loading branch information
Showing
30 changed files
with
729 additions
and
56 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
...security-analysis-api/src/main/java/com/powsybl/security/BusBreakerViolationLocation.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,53 @@ | ||
/** | ||
* 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/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
package com.powsybl.security; | ||
|
||
import java.util.Objects; | ||
import java.util.Optional; | ||
|
||
/** | ||
* @author Étienne Lesot {@literal <etienne.lesot at rte-france.com>} | ||
*/ | ||
public class BusBreakerViolationLocation implements ViolationLocation { | ||
private final String voltageLevelId; | ||
private final String busId; | ||
|
||
public BusBreakerViolationLocation(String voltageLevelId, String busId) { | ||
Objects.requireNonNull(voltageLevelId, "voltageLevelId"); | ||
this.voltageLevelId = voltageLevelId; | ||
this.busId = busId; | ||
} | ||
|
||
@Override | ||
public String getVoltageLevelId() { | ||
return voltageLevelId; | ||
} | ||
|
||
@Override | ||
public Optional<String> getBusId() { | ||
return Optional.ofNullable(busId); | ||
} | ||
|
||
@Override | ||
public String getId() { | ||
return busId == null ? voltageLevelId : busId; | ||
} | ||
|
||
@Override | ||
public Type getType() { | ||
return Type.BUS_BREAKER; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "BusBreakerViolationLocation{" + | ||
"voltageLevelId='" + voltageLevelId + '\'' + | ||
", busId='" + busId + '\'' + | ||
'}'; | ||
} | ||
} |
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
53 changes: 53 additions & 0 deletions
53
...ecurity-analysis-api/src/main/java/com/powsybl/security/NodeBreakerViolationLocation.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,53 @@ | ||
/** | ||
* 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/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
package com.powsybl.security; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
/** | ||
* @author Étienne Lesot {@literal <etienne.lesot at rte-france.com>} | ||
*/ | ||
public class NodeBreakerViolationLocation implements ViolationLocation { | ||
private final String voltageLevelId; | ||
private final List<String> busBarIds; | ||
|
||
public NodeBreakerViolationLocation(String voltageLevelId, List<String> busBarIds) { | ||
Objects.requireNonNull(voltageLevelId, "voltageLevelId"); | ||
this.voltageLevelId = voltageLevelId; | ||
this.busBarIds = busBarIds; | ||
} | ||
|
||
@Override | ||
public String getVoltageLevelId() { | ||
return voltageLevelId; | ||
} | ||
|
||
@Override | ||
public List<String> getBusBarIds() { | ||
return busBarIds; | ||
} | ||
|
||
@Override | ||
public String getId() { | ||
return busBarIds.isEmpty() ? voltageLevelId : busBarIds.get(0); | ||
} | ||
|
||
@Override | ||
public Type getType() { | ||
return Type.NODE_BREAKER; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "NodeBreakerVoltageLocation{" + | ||
"voltageLevelId='" + voltageLevelId + '\'' + | ||
", busBarIds=" + busBarIds + | ||
'}'; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
...-analysis/security-analysis-api/src/main/java/com/powsybl/security/ViolationLocation.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,38 @@ | ||
/** | ||
* 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/. | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
package com.powsybl.security; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
/** | ||
* @author Étienne Lesot {@literal <etienne.lesot at rte-france.com>} | ||
*/ | ||
public interface ViolationLocation { | ||
|
||
enum Type { | ||
NODE_BREAKER, | ||
BUS_BREAKER | ||
} | ||
|
||
String getId(); | ||
|
||
Type getType(); | ||
|
||
String getVoltageLevelId(); | ||
|
||
default Optional<String> getBusId() { | ||
return Optional.empty(); | ||
} | ||
|
||
default List<String> getBusBarIds() { | ||
return Collections.emptyList(); | ||
} | ||
|
||
} |
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.