-
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.
Signed-off-by: lisrte <laurent.issertial@rte-france.com>
- Loading branch information
Showing
29 changed files
with
535 additions
and
64 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
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
18 changes: 18 additions & 0 deletions
18
dynawaltz-dsl/src/test/resources/dynamicModels/danglingHvdcException.groovy
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,18 @@ | ||
/** | ||
* 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 dynamicModels | ||
|
||
import com.powsybl.iidm.network.Branch | ||
|
||
HvdcPV { | ||
staticId "L" | ||
dynamicModelId "BBM_HVDC_L" | ||
parameterSetId "HVDC" | ||
dangling Branch.Side.ONE | ||
} |
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,4 +13,3 @@ HvdcPV { | |
dynamicModelId "BBM_HVDC_L" | ||
parameterSetId "HVDC" | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
dynawaltz-dsl/src/test/resources/dynamicModels/hvdcPvDangling.groovy
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,18 @@ | ||
/** | ||
* 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 dynamicModels | ||
|
||
import com.powsybl.iidm.network.Branch | ||
|
||
HvdcPVDanglingDiagramPQ { | ||
staticId "L" | ||
dynamicModelId "BBM_HVDC_L" | ||
parameterSetId "HVDC" | ||
dangling Branch.Side.ONE | ||
} |
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,4 +13,3 @@ HvdcVSC { | |
dynamicModelId "BBM_HVDC_L" | ||
parameterSetId "HVDC" | ||
} | ||
|
18 changes: 18 additions & 0 deletions
18
dynawaltz-dsl/src/test/resources/dynamicModels/hvdcVscDangling.groovy
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,18 @@ | ||
/** | ||
* 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 dynamicModels | ||
|
||
import com.powsybl.iidm.network.Branch | ||
|
||
HvdcVSCDanglingUdc { | ||
staticId "L" | ||
dynamicModelId "BBM_HVDC_L" | ||
parameterSetId "HVDC" | ||
dangling Branch.Side.TWO | ||
} |
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
39 changes: 39 additions & 0 deletions
39
dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/DanglingSide.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,39 @@ | ||
package com.powsybl.dynawaltz.models.hvdc; | ||
|
||
import com.powsybl.dynawaltz.models.Side; | ||
import com.powsybl.dynawaltz.models.VarConnection; | ||
import com.powsybl.dynawaltz.models.buses.BusModel; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
import java.util.function.BiConsumer; | ||
import java.util.function.BiFunction; | ||
|
||
public final class DanglingSide { | ||
|
||
private final String prefix; | ||
private final Side side; | ||
|
||
public DanglingSide(String prefix, Side side) { | ||
this.prefix = Objects.requireNonNull(prefix); | ||
this.side = Objects.requireNonNull(side); | ||
} | ||
|
||
boolean isDangling(Side side) { | ||
return this.side == side; | ||
} | ||
|
||
public int getSideNumber() { | ||
return side.getSideNumber(); | ||
} | ||
|
||
public void createMacroConnections(BiFunction<BusModel, Side, List<VarConnection>> basicVarConnectionsSupplier, | ||
BiConsumer<BiFunction<BusModel, Side, List<VarConnection>>, Side> connectionCreator) { | ||
connectionCreator.accept(this::getVarConnectionsWith, side); | ||
connectionCreator.accept(basicVarConnectionsSupplier, side.getOppositeSide()); | ||
} | ||
|
||
private List<VarConnection> getVarConnectionsWith(BusModel connected, Side side) { | ||
return List.of(new VarConnection(prefix + side.getSideNumber(), connected.getTerminalVarName())); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPvDangling.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,44 @@ | ||
/** | ||
* 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.dynawaltz.models.hvdc; | ||
|
||
import com.powsybl.commons.PowsyblException; | ||
import com.powsybl.dynawaltz.DynaWaltzContext; | ||
import com.powsybl.dynawaltz.models.Side; | ||
import com.powsybl.dynawaltz.models.buses.BusModel; | ||
import com.powsybl.dynawaltz.models.utils.BusUtils; | ||
import com.powsybl.iidm.network.HvdcLine; | ||
|
||
/** | ||
* @author Laurent Issertial <laurent.issertial at rte-france.com> | ||
*/ | ||
public class HvdcPvDangling extends HvdcPv { | ||
|
||
private final DanglingSide danglingSide; | ||
|
||
public HvdcPvDangling(String dynamicModelId, HvdcLine hvdc, String parameterSetId, String hvdcLib, Side danglingSide) { | ||
super(dynamicModelId, hvdc, parameterSetId, hvdcLib); | ||
this.danglingSide = new DanglingSide(TERMINAL_PREFIX, danglingSide); | ||
} | ||
|
||
@Override | ||
public void createMacroConnections(DynaWaltzContext context) { | ||
danglingSide.createMacroConnections( | ||
this::getVarConnectionsWith, | ||
(varCoSupplier, side) -> createMacroConnections(BusUtils.getConnectableBusStaticId(equipment, side), BusModel.class, varCoSupplier, context, side) | ||
); | ||
} | ||
|
||
@Override | ||
public String getSwitchOffSignalEventVarName(Side side) { | ||
if (danglingSide.isDangling(side)) { | ||
throw new PowsyblException(String.format("Equipment %s side %s is dangling and can't be disconnected with an event", getLib(), danglingSide.getSideNumber())); | ||
} | ||
return super.getSwitchOffSignalEventVarName(side); | ||
} | ||
} |
Oops, something went wrong.