-
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: Nicolas Rol <nicolas.rol@rte-france.com>
- Loading branch information
Showing
16 changed files
with
474 additions
and
167 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
16 changes: 16 additions & 0 deletions
16
iidm/iidm-api/src/main/java/com/powsybl/iidm/network/GroundAdder.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,16 @@ | ||
/* | ||
* 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 Nicolas Rol {@literal <nicolas.rol at rte-france.com>} | ||
*/ | ||
public interface GroundAdder extends InjectionAdder<Ground, GroundAdder> { | ||
@Override | ||
Ground 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
55 changes: 55 additions & 0 deletions
55
iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/GroundAdderImpl.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,55 @@ | ||
/* | ||
* 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.iidm.network.GroundAdder; | ||
import com.powsybl.iidm.network.impl.util.Ref; | ||
|
||
/** | ||
* @author Nicolas Rol {@literal <nicolas.rol at rte-france.com>} | ||
*/ | ||
class GroundAdderImpl extends AbstractInjectionAdder<GroundAdderImpl> implements GroundAdder { | ||
|
||
private final VoltageLevelExt voltageLevel; | ||
|
||
GroundAdderImpl(VoltageLevelExt voltageLevel) { | ||
this.voltageLevel = voltageLevel; | ||
} | ||
|
||
@Override | ||
protected NetworkImpl getNetwork() { | ||
return voltageLevel.getNetwork(); | ||
} | ||
|
||
@Override | ||
protected String getTypeDescription() { | ||
return "Ground"; | ||
} | ||
|
||
@Override | ||
protected Ref<? extends VariantManagerHolder> getVariantManagerHolder() { | ||
return getNetworkRef(); | ||
} | ||
|
||
private Ref<NetworkImpl> getNetworkRef() { | ||
return voltageLevel.getNetworkRef(); | ||
} | ||
|
||
@Override | ||
public GroundImpl add() { | ||
NetworkImpl network = getNetwork(); | ||
String id = checkAndGetUniqueId(); | ||
TerminalExt terminal = checkAndGetTerminal(); | ||
GroundImpl ground = new GroundImpl(getNetworkRef(), id, id); | ||
ground.addTerminal(terminal); | ||
voltageLevel.attach(terminal, false); | ||
network.getIndex().checkAndAdd(ground); | ||
network.getListeners().notifyCreation(ground); | ||
return ground; | ||
} | ||
} |
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.