Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automation systems #2779

Merged
merged 15 commits into from
Jan 11, 2024
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 Olivier Perrin {@literal <olivier.perrin at rte-france.com>}
*/
public interface AutomationSystem<I extends AutomationSystem<I>> extends Identifiable<I> {

/**
* Tell if the system is active or not.
* @return <code>true</code> is the automation system is enabled
*/
boolean isEnabled();

/**
* Change the state of the automation system
* @param enabled <code>true</code> to enable the automation system
*/
void setEnabled(boolean enabled);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ public enum IdentifiableType {
SHUNT_COMPENSATOR,
DANGLING_LINE,
STATIC_VAR_COMPENSATOR,
HVDC_CONVERTER_STATION
HVDC_CONVERTER_STATION,
OVERLOAD_MANAGEMENT_SYSTEM
}
22 changes: 22 additions & 0 deletions iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Network.java
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,28 @@ default VoltageLevelAdder newVoltageLevel() {
*/
ThreeWindingsTransformer getThreeWindingsTransformer(String id);

/**
olperr1 marked this conversation as resolved.
Show resolved Hide resolved
* Get all overload management systems.
*/
Iterable<OverloadManagementSystem> getOverloadManagementSystems();

/**
* Get all overload management systems.
*/
Stream<OverloadManagementSystem> getOverloadManagementSystemStream();

/**
* Get the overload management system count.
*/
int getOverloadManagementSystemCount();

/**
* Get an overload management system.
*
* @param id the id or an alias of the overload management system
*/
OverloadManagementSystem getOverloadManagementSystem(String id);

/**
* Get all generators.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
/**
* 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.List;
import java.util.Optional;

/**
* An overload management system.
*
* @author Olivier Perrin {@literal <olivier.perrin at rte-france.com>}
*/
public interface OverloadManagementSystem extends AutomationSystem<OverloadManagementSystem> {

interface Tripping {
enum Type {
BRANCH_TRIPPING,
THREE_WINDINGS_TRANSFORMER_TRIPPING,
SWITCH_TRIPPING
}

Type getType();

/**
* Get the unique key of the tripping.
* <p>This key is unique for a single overload management system, but it can be reused
* for another overload management system).</p>
* @return the tripping key
*/
String getKey();

/**
* Get the name (if available) or the key of the tripping.
* <p>This method result is used for reporting purposes.</p>
* @return the name (if available) or the key of the tripping
*/
String getNameOrKey();

/**
* Set the name of the tripping.
* <p>This name is facultative. It is used only for reporting purposes.</p>
* @param name the name of the tripping
* @see #getNameOrKey()
*/
Tripping setName(String name);

/**
* Tell if the tripping is active or not.
* @return <code>true</code> is the tripping is enabled
*/
boolean isEnabled();

/**
* Change the state of the tripping.
* @param enabled <code>true</code> to enable it
*/
Tripping setEnabled(boolean enabled);

/**
* Return the minimum acceptable current value (in A).
* @return the minimum current value, or `Optional.empty()` if no low limit is defined
*/
Optional<Double> getLowLimit();

Tripping setLowLimit(Double lowLimit);

/**
* Return the maximum acceptable current value (in A).
* @return the maximum current value, or `Optional.empty()` if no high limit is defined
*/
Optional<Double> getHighLimit();

Tripping setHighLimit(Double highLimit);

/**
* Tell if the tripping operation consists in opening (<code>true</code>) or closing (<code>false</code>)
* the element (branch, three windings transformer or switch) to operate.
* @return <code>true</code> it the operation consists in opening the element, else <code>false</code>.
*/
boolean isOpenAction();

Tripping setOpenAction(boolean open);
}

interface SwitchTripping extends Tripping {
@Override
default Type getType() {
return Type.SWITCH_TRIPPING;
}

Switch getSwitchToOperate();

SwitchTripping setSwitchToOperate(Switch switchToOperate);
}

interface BranchTripping extends Tripping {
@Override
default Type getType() {
return Type.BRANCH_TRIPPING;
}

Branch getBranchToOperate();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is also available for the other tripping impl.
I can see 2 issues:

  • we use the Identifiable in the setter and getter and not the ID like for monitoredElementId. We have to be consistent.
  • the difficulty that we have by using the Identifiable is that we need to manager in the implementation the cleaning in case if the Identifiable removal. Otherwise you will have a link to a dead object, which is bad for a String but even worst if we keep a link to a removed Identifiable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right.

As discussed together:

  • It will be better to introduce a global mechanism to address the problem of referenced network elements removal (deferred for now);
  • As a first step, I will replace the Identifiable by a String in the trippings. This won't have an impact on the IIDM serialization result so it will be possible to use Identifiables later without having to publish a new IIDM version.


BranchTripping setBranchToOperate(Branch<?> branch);

Branch.Side getSideToOperate();

BranchTripping setSideToOperate(Branch.Side side);
}

interface ThreeWindingsTransformerTripping extends Tripping {
@Override
default Type getType() {
return Type.THREE_WINDINGS_TRANSFORMER_TRIPPING;
}

ThreeWindingsTransformer getThreeWindingsTransformerToOperate();

ThreeWindingsTransformerTripping setThreeWindingsTransformerToOperate(ThreeWindingsTransformer threeWindingsTransformer);

ThreeSides getSideToOperate();

ThreeWindingsTransformerTripping setSideToOperate(ThreeSides side);

default ThreeWindingsTransformer.Leg getLegToOperate() {
//TODO(op) This should be simplified once the sides' refactoring is merged
return getThreeWindingsTransformerToOperate().getLeg(getSideToOperate().toThreeWindingsTransformerSide());
}
}

/**
* Get the parent substation.
* @return the parent substation
*/
Substation getSubstation();

/**
* Get the id of the element (branch or three windings transformer) which is monitored
* @return the id of the monitored element
*/
String getMonitoredElementId();

/**
* Get the monitored side of the element.
* @return the side
* @see #getMonitoredElementId()
*/
ThreeSides getMonitoredSide();

/**
* Add a tripping (operation to perform when the current is out of an acceptable interval)
* @param tripping the tripping to add
*/
void addTripping(Tripping tripping);

/**
* Return the list of the defined trippings.
* @return the trippings
*/
List<Tripping> getTrippings();

@Override
default IdentifiableType getType() {
return IdentifiableType.OVERLOAD_MANAGEMENT_SYSTEM;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/**
* 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 Olivier Perrin {@literal <olivier.perrin at rte-france.com>}
*/
public interface OverloadManagementSystemAdder extends IdentifiableAdder<OverloadManagementSystem, OverloadManagementSystemAdder> {

interface TrippingAdder<I extends TrippingAdder<I>> {
/**
* Set the unique key of the tripping.
* <p>This key is unique for a single overload management system, but it can be reused
* for another overload management system).</p>
* @param key the tripping key
*/
I setKey(String key);

/**
* Set the name of the tripping.
* <p>This name is facultative. It is used only for reporting purposes.</p>
* @param name the name of the tripping
*/
I setName(String name);

/**
* Change the state of the tripping.
* @param enabled <code>true</code> to enable it
*/
I setEnabled(boolean enabled);

/**
* Set the minimum acceptable current value (in A).
* @param lowLimit the minimum current value
*/
I setLowLimit(Double lowLimit);

/**
* Set the maximum acceptable current value (in A).
* @param highLimit the maximum current value
*/
I setHighLimit(Double highLimit);

I setOpenAction(boolean open);

OverloadManagementSystem.Tripping.Type getType();
olperr1 marked this conversation as resolved.
Show resolved Hide resolved

OverloadManagementSystemAdder add();
olperr1 marked this conversation as resolved.
Show resolved Hide resolved
}

interface SwitchTrippingAdder extends TrippingAdder<SwitchTrippingAdder> {
@Override
default OverloadManagementSystem.Tripping.Type getType() {
return OverloadManagementSystem.Tripping.Type.SWITCH_TRIPPING;
}

SwitchTrippingAdder setSwitchToOperateId(String switchId);
}

interface BranchTrippingAdder extends TrippingAdder<BranchTrippingAdder> {
@Override
default OverloadManagementSystem.Tripping.Type getType() {
return OverloadManagementSystem.Tripping.Type.BRANCH_TRIPPING;
}

BranchTrippingAdder setBranchToOperateId(String branchId);

BranchTrippingAdder setSideToOperate(Branch.Side side);
}

interface ThreeWindingsTransformerTrippingAdder extends TrippingAdder<ThreeWindingsTransformerTrippingAdder> {
@Override
default OverloadManagementSystem.Tripping.Type getType() {
return OverloadManagementSystem.Tripping.Type.THREE_WINDINGS_TRANSFORMER_TRIPPING;
}

ThreeWindingsTransformerTrippingAdder setThreeWindingsTransformerToOperate(String threeWindingsTransformerId);

ThreeWindingsTransformerTrippingAdder setSideToOperate(ThreeSides side);

}

@Override
OverloadManagementSystem add();

OverloadManagementSystemAdder setEnabled(boolean enabled);

/**
* Set the id of the element (branch or three windings transformer) which is monitored.
* @param monitoredElementId the id of the monitored element
* @return the adder
*/
OverloadManagementSystemAdder setMonitoredElementId(String monitoredElementId);

/**
* Set the monitored side of the element.
* @param monitoredElementSide the monitored side of the element
* @return the adder
*/
OverloadManagementSystemAdder setMonitoredElementSide(ThreeSides monitoredElementSide);

SwitchTrippingAdder newSwitchTripping();

BranchTrippingAdder newBranchTripping();

ThreeWindingsTransformerTrippingAdder newThreeWindingsTransformerTripping();
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,26 @@ public interface Substation extends Container<Substation> {
*/
int getThreeWindingsTransformerCount();

/**
* Get a builder to create a new overload management system in the substation.
*/
OverloadManagementSystemAdder newOverloadManagementSystem();

/**
* Get the overload management systems relative to the substation.
*/
Iterable<OverloadManagementSystem> getOverloadManagementSystems();

/**
* Get the overload management systems relative to the substation.
*/
Stream<OverloadManagementSystem> getOverloadManagementSystemStream();

/**
* Get the overload management systems count
*/
int getOverloadManagementSystemCount();

/**
* Get geographical tags associated to the substation.
*/
Expand Down
Loading