Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/snapshot-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:

# Build powsybl-core
- name: Checking for powsybl-core snapshot branch
run: ${{ env.SCRIPTS_PATH }}/check_snapshot_branch.sh "https://github.com/powsybl/powsybl-open-loadflow.git" ${{ env.SNAPSHOT_VERSION }}
run: ${{ env.SCRIPTS_PATH }}/check_snapshot_branch.sh "https://github.com/powsybl/powsybl-core.git" ${{ env.SNAPSHOT_VERSION }}

- name: Checkout core sources
uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
/**
* @author Pauline JEAN-MARIE {@literal <pauline.jean-marie at artelys.com>}
*/
public interface DanglingLineActionAdder extends SingleNetworkElementActionAdder<DanglingLineActionAdder> {
public interface BoundaryLineActionAdder extends SingleNetworkElementActionAdder<BoundaryLineActionAdder> {

DanglingLineActionAdder withActivePowerValue(double setPoint);
BoundaryLineActionAdder withActivePowerValue(double setPoint);

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
package com.powsybl.openrao.data.crac.api.networkaction;

import com.powsybl.action.Action;
import com.powsybl.action.DanglingLineAction;
import com.powsybl.action.BoundaryLineAction;
import com.powsybl.action.GeneratorAction;
import com.powsybl.action.HvdcAction;
import com.powsybl.action.LoadAction;
Expand Down Expand Up @@ -70,7 +70,7 @@ default boolean isCompatibleWith(NetworkAction otherNetworkAction) {
} else {
// FIXME: Action equals is only implemented for Action currently used in Rao,
// so the code above is not working for all Action but only for:
// GeneratorAction, LoadAction, DanglingLineAction, ShuntCompensatorPositionAction,
// GeneratorAction, LoadAction, BoundaryLineAction, ShuntCompensatorPositionAction,
// PhaseTapChangerTapPositionAction, TerminalsConnectionAction, SwitchAction
return otherNetworkAction.getElementaryActions().stream().allMatch(otherElementaryAction -> {
if (otherElementaryAction instanceof SwitchPair) {
Expand All @@ -94,8 +94,8 @@ static String getNetworkElementId(Action elementaryAction) {
return generatorAction.getGeneratorId();
} else if (elementaryAction instanceof LoadAction loadAction) {
return loadAction.getLoadId();
} else if (elementaryAction instanceof DanglingLineAction danglingLineAction) {
return danglingLineAction.getDanglingLineId();
} else if (elementaryAction instanceof BoundaryLineAction boundaryLineAction) {
return boundaryLineAction.getBoundaryLineId();
} else if (elementaryAction instanceof ShuntCompensatorPositionAction shuntCompensatorPositionAction) {
return shuntCompensatorPositionAction.getShuntCompensatorId();
} else if (elementaryAction instanceof PhaseTapChangerTapPositionAction phaseTapChangerTapPositionAction) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public interface NetworkActionAdder extends RemedialActionAdder<NetworkActionAdd

LoadActionAdder newLoadAction();

DanglingLineActionAdder newDanglingLineAction();
BoundaryLineActionAdder newBoundaryLineAction();

ShuntCompensatorPositionActionAdder newShuntCompensatorPositionAction();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* A range action interface specifying an action on one or several Injections
*
* Injections can be Generator and/or Loads (DanglingLine are not yet taken into
* Injections can be Generator and/or Loads (BoundaryLines are not yet taken into
* account in that object).
*
* The InjectionRangeAction can affect several Injections, the conversion between
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@
package com.powsybl.openrao.data.crac.impl;

import com.powsybl.action.Action;
import com.powsybl.action.DanglingLineActionBuilder;
import com.powsybl.openrao.data.crac.api.networkaction.DanglingLineActionAdder;
import com.powsybl.action.BoundaryLineActionBuilder;
import com.powsybl.openrao.data.crac.api.networkaction.BoundaryLineActionAdder;

import static com.powsybl.openrao.data.crac.impl.AdderUtils.assertAttributeNotNull;

/**
* @author Pauline JEAN-MARIE {@literal <pauline.jean-marie at artelys.com>}
*/
public class DanglingLineActionAdderImpl extends AbstractSingleNetworkElementActionAdderImpl<DanglingLineActionAdder> implements DanglingLineActionAdder {
public class BoundaryLineActionAdderImpl extends AbstractSingleNetworkElementActionAdderImpl<BoundaryLineActionAdder> implements BoundaryLineActionAdder {

private Double activePowerValue;

DanglingLineActionAdderImpl(NetworkActionAdderImpl ownerAdder) {
BoundaryLineActionAdderImpl(NetworkActionAdderImpl ownerAdder) {
super(ownerAdder);
}

@Override
public DanglingLineActionAdder withActivePowerValue(double activePowerValue) {
public BoundaryLineActionAdder withActivePowerValue(double activePowerValue) {
this.activePowerValue = activePowerValue;
return this;
}

protected Action buildAction() {
return new DanglingLineActionBuilder()
return new BoundaryLineActionBuilder()
.withId(String.format("%s_%s_%s", getActionName(), networkElementId, activePowerValue))
.withNetworkElementId(networkElementId)
.withRelativeValue(false)
Expand All @@ -44,6 +44,6 @@ protected void assertSpecificAttributes() {
}

protected String getActionName() {
return "DanglingLineAction";
return "BoundaryLineAction";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void addElementsInContingency(ContingencyBuilder builder, String conting
case SHUNT_COMPENSATOR -> builder.addShuntCompensator(contingencyElementId);
case HVDC_LINE -> builder.addHvdcLine(contingencyElementId);
case BUSBAR_SECTION -> builder.addBusbarSection(contingencyElementId);
case DANGLING_LINE -> builder.addDanglingLine(contingencyElementId);
case BOUNDARY_LINE -> builder.addBoundaryLine(contingencyElementId);
case LINE -> builder.addLine(contingencyElementId);
case TWO_WINDINGS_TRANSFORMER -> builder.addTwoWindingsTransformer(contingencyElementId);
case THREE_WINDINGS_TRANSFORMER -> builder.addThreeWindingsTransformer(contingencyElementId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.powsybl.openrao.commons.logs.OpenRaoLoggerProvider;
import com.powsybl.openrao.data.crac.api.NetworkElement;
import com.powsybl.openrao.data.crac.api.networkaction.AcEmulationDeactivationActionAdder;
import com.powsybl.openrao.data.crac.api.networkaction.DanglingLineActionAdder;
import com.powsybl.openrao.data.crac.api.networkaction.BoundaryLineActionAdder;
import com.powsybl.openrao.data.crac.api.networkaction.GeneratorActionAdder;
import com.powsybl.openrao.data.crac.api.networkaction.LoadActionAdder;
import com.powsybl.openrao.data.crac.api.networkaction.NetworkAction;
Expand Down Expand Up @@ -74,8 +74,8 @@ public LoadActionAdder newLoadAction() {
}

@Override
public DanglingLineActionAdder newDanglingLineAction() {
return new DanglingLineActionAdderImpl(this);
public BoundaryLineActionAdder newBoundaryLineAction() {
return new BoundaryLineActionAdderImpl(this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

package com.powsybl.openrao.data.crac.impl;

import com.powsybl.action.DanglingLineAction;
import com.powsybl.action.BoundaryLineAction;
import com.powsybl.openrao.commons.OpenRaoException;
import com.powsybl.openrao.data.crac.api.Crac;
import com.powsybl.openrao.data.crac.api.networkaction.DanglingLineActionAdder;
import com.powsybl.openrao.data.crac.api.networkaction.BoundaryLineActionAdder;
import com.powsybl.openrao.data.crac.api.networkaction.NetworkAction;
import com.powsybl.openrao.data.crac.api.networkaction.NetworkActionAdder;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -23,7 +23,7 @@
/**
* @author Pauline JEAN-MARIE {@literal <pauline.jean-marie at artelys.com>}
*/
class DanglingLineActionAdderImplTest {
class BoundaryLineActionAdderImplTest {

private Crac crac;
private NetworkActionAdder networkActionAdder;
Expand All @@ -39,15 +39,15 @@ public void setUp() {

@Test
void testOk() {
NetworkAction networkAction = networkActionAdder.newDanglingLineAction()
NetworkAction networkAction = networkActionAdder.newBoundaryLineAction()
.withNetworkElement("groupNetworkElementId")
.withActivePowerValue(100.)
.add()
.add();

DanglingLineAction danglingLineAction = (DanglingLineAction) networkAction.getElementaryActions().iterator().next();
assertEquals("groupNetworkElementId", danglingLineAction.getDanglingLineId());
assertEquals(100., danglingLineAction.getActivePowerValue().getAsDouble(), 1e-3);
BoundaryLineAction boundaryLineAction = (BoundaryLineAction) networkAction.getElementaryActions().iterator().next();
assertEquals("groupNetworkElementId", boundaryLineAction.getBoundaryLineId());
assertEquals(100., boundaryLineAction.getActivePowerValue().getAsDouble(), 1e-3);

// check that network element have been added to CracImpl
assertEquals(1, ((CracImpl) crac).getNetworkElements().size());
Expand All @@ -56,18 +56,18 @@ void testOk() {

@Test
void testNoNetworkElement() {
DanglingLineActionAdder danglingLineActionAdder = networkActionAdder.newDanglingLineAction()
BoundaryLineActionAdder boundaryLineActionAdder = networkActionAdder.newBoundaryLineAction()
.withActivePowerValue(100.);
Exception e = assertThrows(OpenRaoException.class, danglingLineActionAdder::add);
assertEquals("Cannot add DanglingLineAction without a network element. Please use withNetworkElement() with a non null value", e.getMessage());
Exception e = assertThrows(OpenRaoException.class, boundaryLineActionAdder::add);
assertEquals("Cannot add BoundaryLineAction without a network element. Please use withNetworkElement() with a non null value", e.getMessage());
}

@Test
void testNoSetpoint() {
DanglingLineActionAdder danglingLineActionAdder = networkActionAdder.newDanglingLineAction()
BoundaryLineActionAdder boundaryLineActionAdder = networkActionAdder.newBoundaryLineAction()
.withNetworkElement("groupNetworkElementId");
Exception e = assertThrows(OpenRaoException.class, danglingLineActionAdder::add);
assertEquals("Cannot add DanglingLineAction without a activePowerValue. Please use withActivePowerValue() with a non null value", e.getMessage());
Exception e = assertThrows(OpenRaoException.class, boundaryLineActionAdder::add);
assertEquals("Cannot add BoundaryLineAction without a activePowerValue. Please use withActivePowerValue() with a non null value", e.getMessage());
}

}
Loading