-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
work with Olivier PERRIN commit investigate tests Add test Migrate from CgmesControlArea to Area Signed-off-by: Hugo SCHINDLER <hugo.schindler@rte-france.com>
- Loading branch information
Showing
9 changed files
with
432 additions
and
49 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
...tment/src/main/java/com/powsybl/entsoe/cgmes/balances_adjustment/util/CgmesAreaUtils.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,49 @@ | ||
/** | ||
* Copyright (c) 2025, 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.entsoe.cgmes.balances_adjustment.util; | ||
|
||
import com.powsybl.iidm.network.*; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* @author Hugo Schindler{@literal <hugo.schindler at rte-france.com>} | ||
*/ | ||
public final class CgmesAreaUtils { | ||
private CgmesAreaUtils() { | ||
// Utility class | ||
} | ||
|
||
static boolean hasAreaBoundaries(Area area) { | ||
return area.getAreaBoundaryStream().map(AreaBoundary::getBoundary).anyMatch(Optional::isPresent); | ||
} | ||
|
||
static boolean hasAreaBoundaryTerminals(Area area) { | ||
return area.getAreaBoundaryStream().map(AreaBoundary::getTerminal).anyMatch(Optional::isPresent); | ||
} | ||
|
||
static boolean isIdInAreaBoundaryTerminals(String elementId, Area area) { | ||
return area.getAreaBoundaryStream() | ||
.map(AreaBoundary::getTerminal) | ||
.filter(Optional::isPresent) | ||
.map(Optional::get) | ||
.map(Terminal::getConnectable) | ||
.map(Identifiable::getId) | ||
.anyMatch(terminalId -> terminalId.equals(elementId)); | ||
} | ||
|
||
static boolean isIdInAreaBoundariesDanglingLines(String elementId, Area area) { | ||
return area.getAreaBoundaryStream() | ||
.map(AreaBoundary::getBoundary) | ||
.filter(Optional::isPresent) | ||
.map(Optional::get) | ||
.map(Boundary::getDanglingLine) | ||
.map(Identifiable::getId) | ||
.anyMatch(danglingLineId -> danglingLineId.equals(elementId)); | ||
} | ||
} |
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.