diff --git a/docs/grid_model/network_subnetwork.md b/docs/grid_model/network_subnetwork.md index 1295082713a..c28a691b299 100644 --- a/docs/grid_model/network_subnetwork.md +++ b/docs/grid_model/network_subnetwork.md @@ -118,18 +118,17 @@ for DC part only (considering only DC boundaries) and in total (AC+DC). Note that if the Area has no boundary explicitly defined, the interchange is considered 0 MW. For area types that are meant to be used for area interchange control, e.g. in Load Flow simulations, the interchange target of the area can be specified as an input for the simulation. -Note that this target interchange is for only the AC part of the interchange. All area interchange values use the load sign convention: positive values indicate that the area is importing, negative values that the area is exporting. **Characteristics of an Area** -| Attribute | Unit | Description | -|-----------------------|------|----------------------------------------------------------------| -| $AreaType$ | | To specify the type of Area (eg. ControlArea, BiddingZone ...) | -| $AcInterchangeTarget$ | MW | Target AC active power interchange | -| $VoltageLevels$ | | List of voltage levels of the area | -| $AreaBoundaries$ | | List of area boundaries of the area | +| Attribute | Unit | Description | +|---------------------|------|----------------------------------------------------------------| +| $AreaType$ | | To specify the type of Area (eg. ControlArea, BiddingZone ...) | +| $interchangeTarget$ | MW | Target active power interchange | +| $VoltageLevels$ | | List of voltage levels of the area | +| $AreaBoundaries$ | | List of area boundaries of the area | **Characteristics of an AreaBoundary** diff --git a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Area.java b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Area.java index b08d9e6e363..ababf54f7c4 100644 --- a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Area.java +++ b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Area.java @@ -58,12 +58,12 @@ * The type of Area. For instance: "ControlArea", "BiddingZone", "Country"... * * - * AcInterchangeTarget + * interchangeTarget * Double * - * no * - - * The optional target AC Interchange of this area in MW, using load sign convention (negative is export, positive is import) + * The optional target interchange of this area in MW, using load sign convention (negative is export, positive is import) * * * @@ -153,20 +153,20 @@ default IdentifiableType getType() { } /** - * Get the optional target AC Interchange of this area in MW, in load sign convention (negative is export, positive is import). + * Get the optional target interchange of this area in MW, in load sign convention (negative is export, positive is import). *

Depends on the working variant.

* - * @return the AC Interchange target (MW) + * @return the interchange target (MW) */ - OptionalDouble getAcInterchangeTarget(); + OptionalDouble getInterchangeTarget(); /** - * Set the target AC Interchange of this area in MW, in load sign convention (negative is export, positive is import). + * Set the target interchange of this area in MW, in load sign convention (negative is export, positive is import). * Providing Double.NaN removes the target. *

Depends on the working variant.

- * @param acInterchangeTarget new AC interchange target (MW) + * @param interchangeTarget new interchange target (MW) */ - Area setAcInterchangeTarget(double acInterchangeTarget); + Area setInterchangeTarget(double interchangeTarget); /** * Get the current AC Interchange of this area in MW, in load sign convention (negative is export, positive is import) @@ -184,7 +184,7 @@ default IdentifiableType getType() { * Get the current total (AC+DC) Interchange of this area in MW, in load sign convention (negative is export, positive is import) * @return the total position (MW, 0 MW if no boundary) */ - double getTotalInterchange(); + double getInterchange(); void remove(); diff --git a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/AreaAdder.java b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/AreaAdder.java index 316355c72fa..26cfb9d32f1 100644 --- a/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/AreaAdder.java +++ b/iidm/iidm-api/src/main/java/com/powsybl/iidm/network/AreaAdder.java @@ -33,9 +33,9 @@ public interface AreaAdder extends IdentifiableAdder { AreaAdder setAreaType(String areaType); /** - * Set the target AC Interchange of this area in MW, in load sign convention (negative is export, positive is import). + * Set the target interchange of this area in MW, in load sign convention (negative is export, positive is import). */ - AreaAdder setAcInterchangeTarget(double acInterchangeTarget); + AreaAdder setInterchangeTarget(double interchangeTarget); /** * add a VoltageLevel to the Area diff --git a/iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/AreaAdderImpl.java b/iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/AreaAdderImpl.java index b2df4429e1b..df9fae512d8 100644 --- a/iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/AreaAdderImpl.java +++ b/iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/AreaAdderImpl.java @@ -24,7 +24,7 @@ public class AreaAdderImpl extends AbstractIdentifiableAdder impl private String areaType; - private double acInterchangeTarget; + private double interchangeTarget; private final Set voltageLevels; @@ -38,7 +38,7 @@ public class AreaAdderImpl extends AbstractIdentifiableAdder impl this.terminalAreaBoundaries = new HashMap<>(); this.boundaryAreaBoundaries = new HashMap<>(); this.voltageLevels = new HashSet<>(); - this.acInterchangeTarget = Double.NaN; + this.interchangeTarget = Double.NaN; } public NetworkImpl getNetwork() { @@ -50,8 +50,8 @@ public AreaAdder setAreaType(String areaType) { return this; } - public AreaAdder setAcInterchangeTarget(double acInterchangeTarget) { - this.acInterchangeTarget = acInterchangeTarget; + public AreaAdder setInterchangeTarget(double interchangeTarget) { + this.interchangeTarget = interchangeTarget; return this; } @@ -77,7 +77,7 @@ protected Set getVoltageLevels() { @Override public Area add() { String id = checkAndGetUniqueId(); - AreaImpl area = new AreaImpl(networkRef, subnetworkRef, id, getName(), isFictitious(), areaType, acInterchangeTarget); + AreaImpl area = new AreaImpl(networkRef, subnetworkRef, id, getName(), isFictitious(), areaType, interchangeTarget); terminalAreaBoundaries.forEach((terminal, ac) -> area.newAreaBoundary().setTerminal(terminal).setAc(ac).add()); boundaryAreaBoundaries.forEach((boundary, ac) -> area.newAreaBoundary().setBoundary(boundary).setAc(ac).add()); voltageLevels.forEach(area::addVoltageLevel); diff --git a/iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/AreaImpl.java b/iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/AreaImpl.java index fd3edc96eaa..89d18793155 100644 --- a/iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/AreaImpl.java +++ b/iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/AreaImpl.java @@ -32,7 +32,7 @@ public class AreaImpl extends AbstractIdentifiable implements Area { // attributes depending on the variant - private final TDoubleArrayList acInterchangeTarget; + private final TDoubleArrayList interchangeTarget; private final class AreaListener extends DefaultNetworkListener { @Override @@ -61,7 +61,7 @@ void moveListener(NetworkImpl fromNetwork, NetworkImpl toNetwork) { private final NetworkListener areaListener; AreaImpl(Ref ref, Ref subnetworkRef, String id, String name, boolean fictitious, String areaType, - double acInterchangeTarget) { + double interchangeTarget) { super(id, name, fictitious); this.networkRef = Objects.requireNonNull(ref); this.subnetworkRef = subnetworkRef; @@ -70,9 +70,9 @@ void moveListener(NetworkImpl fromNetwork, NetworkImpl toNetwork) { this.areaBoundaries = new ArrayList<>(); int variantArraySize = networkRef.get().getVariantManager().getVariantArraySize(); - this.acInterchangeTarget = new TDoubleArrayList(variantArraySize); + this.interchangeTarget = new TDoubleArrayList(variantArraySize); for (int i = 0; i < variantArraySize; i++) { - this.acInterchangeTarget.add(acInterchangeTarget); + this.interchangeTarget.add(interchangeTarget); } this.areaListener = new AreaListener(); getNetwork().addListener(this.areaListener); @@ -114,9 +114,9 @@ public Stream getVoltageLevelStream() { } @Override - public OptionalDouble getAcInterchangeTarget() { - throwIfRemoved("AC interchange target"); - double target = acInterchangeTarget.get(getNetwork().getVariantIndex()); + public OptionalDouble getInterchangeTarget() { + throwIfRemoved("interchange target"); + double target = interchangeTarget.get(getNetwork().getVariantIndex()); if (Double.isNaN(target)) { return OptionalDouble.empty(); } @@ -124,12 +124,12 @@ public OptionalDouble getAcInterchangeTarget() { } @Override - public Area setAcInterchangeTarget(double acInterchangeTarget) { + public Area setInterchangeTarget(double interchangeTarget) { NetworkImpl n = getNetwork(); int variantIndex = n.getVariantIndex(); - double oldValue = this.acInterchangeTarget.set(variantIndex, acInterchangeTarget); + double oldValue = this.interchangeTarget.set(variantIndex, interchangeTarget); String variantId = n.getVariantManager().getVariantId(variantIndex); - notifyUpdate("acInterchangeTarget", variantId, oldValue, acInterchangeTarget); + notifyUpdate("interchangeTarget", variantId, oldValue, interchangeTarget); return this; } @@ -146,7 +146,7 @@ public double getDcInterchange() { } @Override - public double getTotalInterchange() { + public double getInterchange() { throwIfRemoved("total interchange"); return getInterchange(areaBoundary -> true); } @@ -266,16 +266,16 @@ protected void notifyUpdate(String attribute, String variantId, Object oldValue, @Override public void extendVariantArraySize(int initVariantArraySize, int number, int sourceIndex) { super.extendVariantArraySize(initVariantArraySize, number, sourceIndex); - acInterchangeTarget.ensureCapacity(acInterchangeTarget.size() + number); + interchangeTarget.ensureCapacity(interchangeTarget.size() + number); for (int i = 0; i < number; i++) { - acInterchangeTarget.add(acInterchangeTarget.get(sourceIndex)); + interchangeTarget.add(interchangeTarget.get(sourceIndex)); } } @Override public void reduceVariantArraySize(int number) { super.reduceVariantArraySize(number); - acInterchangeTarget.remove(acInterchangeTarget.size() - number, number); + interchangeTarget.remove(interchangeTarget.size() - number, number); } @Override @@ -288,7 +288,7 @@ public void deleteVariantArrayElement(int index) { public void allocateVariantArrayElement(int[] indexes, int sourceIndex) { super.allocateVariantArrayElement(indexes, sourceIndex); for (int index : indexes) { - acInterchangeTarget.set(index, acInterchangeTarget.get(sourceIndex)); + interchangeTarget.set(index, interchangeTarget.get(sourceIndex)); } } diff --git a/iidm/iidm-serde/src/main/java/com/powsybl/iidm/serde/AreaSerDe.java b/iidm/iidm-serde/src/main/java/com/powsybl/iidm/serde/AreaSerDe.java index 092a09bd8f9..03ff128cc4d 100644 --- a/iidm/iidm-serde/src/main/java/com/powsybl/iidm/serde/AreaSerDe.java +++ b/iidm/iidm-serde/src/main/java/com/powsybl/iidm/serde/AreaSerDe.java @@ -30,11 +30,11 @@ protected String getRootElementName() { @Override protected void writeRootElementAttributes(final Area area, final Network parent, final NetworkSerializerContext context) { context.getWriter().writeStringAttribute("areaType", context.getAnonymizer().anonymizeString(area.getAreaType())); - Double acInterchangeTarget = null; - if (area.getAcInterchangeTarget().isPresent()) { - acInterchangeTarget = area.getAcInterchangeTarget().getAsDouble(); + Double interchangeTarget = null; + if (area.getInterchangeTarget().isPresent()) { + interchangeTarget = area.getInterchangeTarget().getAsDouble(); } - context.getWriter().writeOptionalDoubleAttribute("acInterchangeTarget", acInterchangeTarget); + context.getWriter().writeOptionalDoubleAttribute("interchangeTarget", interchangeTarget); } @Override @@ -58,8 +58,8 @@ protected AreaAdder createAdder(final Network network) { protected Area readRootElementAttributes(final AreaAdder adder, final Network parent, final NetworkDeserializerContext context) { String areaType = context.getAnonymizer().deanonymizeString(context.getReader().readStringAttribute("areaType")); adder.setAreaType(areaType); - OptionalDouble acInterchangeTarget = context.getReader().readOptionalDoubleAttribute("acInterchangeTarget"); - acInterchangeTarget.ifPresent(adder::setAcInterchangeTarget); + OptionalDouble interchangeTarget = context.getReader().readOptionalDoubleAttribute("interchangeTarget"); + interchangeTarget.ifPresent(adder::setInterchangeTarget); return adder.add(); } diff --git a/iidm/iidm-serde/src/main/resources/xsd/iidm_V1_13.xsd b/iidm/iidm-serde/src/main/resources/xsd/iidm_V1_13.xsd index 1fd74826fea..7f05e3d027d 100644 --- a/iidm/iidm-serde/src/main/resources/xsd/iidm_V1_13.xsd +++ b/iidm/iidm-serde/src/main/resources/xsd/iidm_V1_13.xsd @@ -722,7 +722,7 @@ - + diff --git a/iidm/iidm-serde/src/main/resources/xsd/iidm_equipment_V1_13.xsd b/iidm/iidm-serde/src/main/resources/xsd/iidm_equipment_V1_13.xsd index 910e3cbee44..f6c25b626ab 100644 --- a/iidm/iidm-serde/src/main/resources/xsd/iidm_equipment_V1_13.xsd +++ b/iidm/iidm-serde/src/main/resources/xsd/iidm_equipment_V1_13.xsd @@ -722,7 +722,7 @@ - + diff --git a/iidm/iidm-serde/src/test/java/com/powsybl/iidm/serde/AreaSerDeTest.java b/iidm/iidm-serde/src/test/java/com/powsybl/iidm/serde/AreaSerDeTest.java index 100bd2515d9..10226c9db80 100644 --- a/iidm/iidm-serde/src/test/java/com/powsybl/iidm/serde/AreaSerDeTest.java +++ b/iidm/iidm-serde/src/test/java/com/powsybl/iidm/serde/AreaSerDeTest.java @@ -56,7 +56,7 @@ private static Network createBaseNetworkWithAreas() { network.newArea().setAreaType(biddingZoneType).setId("BidZoneId1").setName("BidZoneName1").addAreaBoundary(load1.getTerminal(), true) .addAreaBoundary(danglingLine.getBoundary(), false).add(); network.newArea().setAreaType(biddingZoneType).setId("BidZoneId2").setName("BidZoneName2").addAreaBoundary(line.getTerminal1(), true) - .setAcInterchangeTarget(100.).add(); + .setInterchangeTarget(100.).add(); network.newArea().setAreaType(controlAreaType).setId("ControlAreaId1").setName("ControlAreaName1").add(); vl1.addArea(network.getArea("BidZoneId1")); vl1.addArea(network.getArea("ControlAreaId1")); diff --git a/iidm/iidm-serde/src/test/resources/V1_13/areaRoundTripRef.xml b/iidm/iidm-serde/src/test/resources/V1_13/areaRoundTripRef.xml index 43513dcc01a..a3ab220c837 100644 --- a/iidm/iidm-serde/src/test/resources/V1_13/areaRoundTripRef.xml +++ b/iidm/iidm-serde/src/test/resources/V1_13/areaRoundTripRef.xml @@ -29,7 +29,7 @@ - + diff --git a/iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractAreaTest.java b/iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractAreaTest.java index 59cbec5f610..a7e49645f72 100644 --- a/iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractAreaTest.java +++ b/iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractAreaTest.java @@ -69,32 +69,32 @@ public void areaAttributes() { assertEquals("ControlArea_A", controlAreaA.getId()); assertEquals("Control Area A", controlAreaA.getOptionalName().orElseThrow()); assertEquals(CONTROL_AREA_TYPE, controlAreaA.getAreaType()); - assertEquals(-602.6, controlAreaA.getAcInterchangeTarget().orElseThrow()); + assertEquals(-602.6, controlAreaA.getInterchangeTarget().orElseThrow()); assertEquals(Set.of(vlgen, vlhv1), controlAreaA.getVoltageLevels()); assertEquals(2, controlAreaA.getAreaBoundaryStream().count()); assertEquals("ControlArea_B", controlAreaB.getId()); assertEquals("Control Area B", controlAreaB.getOptionalName().orElseThrow()); assertEquals(CONTROL_AREA_TYPE, controlAreaB.getAreaType()); - assertEquals(+602.6, controlAreaB.getAcInterchangeTarget().orElseThrow()); + assertEquals(+602.6, controlAreaB.getInterchangeTarget().orElseThrow()); assertEquals(Set.of(vlhv2, vlload), controlAreaB.getVoltageLevels()); assertEquals(2, controlAreaB.getAreaBoundaryStream().count()); assertEquals("Region_AB", regionAB.getId()); assertEquals("Region AB", regionAB.getOptionalName().orElseThrow()); assertEquals(REGION_AREA_TYPE, regionAB.getAreaType()); - assertFalse(regionAB.getAcInterchangeTarget().isPresent()); + assertFalse(regionAB.getInterchangeTarget().isPresent()); assertEquals(Set.of(vlgen, vlhv1, vlhv2, vlload), regionAB.getVoltageLevels()); assertEquals(0, regionAB.getAreaBoundaryStream().count()); } @Test public void testSetterGetter() { - controlAreaA.setAcInterchangeTarget(123.0); - assertTrue(controlAreaA.getAcInterchangeTarget().isPresent()); - assertEquals(123.0, controlAreaA.getAcInterchangeTarget().getAsDouble()); - controlAreaA.setAcInterchangeTarget(Double.NaN); - assertTrue(controlAreaA.getAcInterchangeTarget().isEmpty()); + controlAreaA.setInterchangeTarget(123.0); + assertTrue(controlAreaA.getInterchangeTarget().isPresent()); + assertEquals(123.0, controlAreaA.getInterchangeTarget().getAsDouble()); + controlAreaA.setInterchangeTarget(Double.NaN); + assertTrue(controlAreaA.getInterchangeTarget().isEmpty()); } @Test @@ -105,32 +105,32 @@ public void testChangesNotification() { network.addListener(mockedListener); // Get initial values - double oldValue = controlAreaA.getAcInterchangeTarget().orElseThrow(); + double oldValue = controlAreaA.getInterchangeTarget().orElseThrow(); // Change values - controlAreaA.setAcInterchangeTarget(Double.NaN); + controlAreaA.setInterchangeTarget(Double.NaN); // Check update notification Mockito.verify(mockedListener, Mockito.times(1)) - .onUpdate(controlAreaA, "acInterchangeTarget", VariantManagerConstants.INITIAL_VARIANT_ID, oldValue, Double.NaN); + .onUpdate(controlAreaA, "interchangeTarget", VariantManagerConstants.INITIAL_VARIANT_ID, oldValue, Double.NaN); // Change values - controlAreaA.setAcInterchangeTarget(123.4); + controlAreaA.setInterchangeTarget(123.4); // Check update notification Mockito.verify(mockedListener, Mockito.times(1)) - .onUpdate(controlAreaA, "acInterchangeTarget", VariantManagerConstants.INITIAL_VARIANT_ID, Double.NaN, 123.4); + .onUpdate(controlAreaA, "interchangeTarget", VariantManagerConstants.INITIAL_VARIANT_ID, Double.NaN, 123.4); // After this point, no more changes are taken into account. // Simulate exception for onUpdate calls Mockito.doThrow(new PowsyblException()).when(mockedListener) - .onUpdate(controlAreaA, "acInterchangeTarget", VariantManagerConstants.INITIAL_VARIANT_ID, oldValue, 123.4); + .onUpdate(controlAreaA, "interchangeTarget", VariantManagerConstants.INITIAL_VARIANT_ID, oldValue, 123.4); // Case when same value is set - controlAreaA.setAcInterchangeTarget(123.4); + controlAreaA.setInterchangeTarget(123.4); // Case when no listener is registered network.removeListener(mockedListener); - controlAreaA.setAcInterchangeTarget(456.7); + controlAreaA.setInterchangeTarget(456.7); // Check no notification Mockito.verifyNoMoreInteractions(mockedListener); @@ -150,11 +150,11 @@ public void testSetterGetterInMultiVariants() { variantManager.setWorkingVariant("s4"); // check values cloned by extend - assertEquals(-602.6, controlAreaA.getAcInterchangeTarget().orElseThrow(), 0.0); + assertEquals(-602.6, controlAreaA.getInterchangeTarget().orElseThrow(), 0.0); // change values in s4 - controlAreaA.setAcInterchangeTarget(123.0); + controlAreaA.setInterchangeTarget(123.0); // Check P0 & Q0 update notification - Mockito.verify(mockedListener, Mockito.times(1)).onUpdate(controlAreaA, "acInterchangeTarget", "s4", -602.6, 123.0); + Mockito.verify(mockedListener, Mockito.times(1)).onUpdate(controlAreaA, "interchangeTarget", "s4", -602.6, 123.0); // remove s2 variantManager.removeVariant("s2"); @@ -162,16 +162,16 @@ public void testSetterGetterInMultiVariants() { variantManager.cloneVariant("s4", "s2b"); variantManager.setWorkingVariant("s2b"); // check values cloned by allocate - assertEquals(123.0, controlAreaA.getAcInterchangeTarget().orElseThrow(), 0.0); + assertEquals(123.0, controlAreaA.getInterchangeTarget().orElseThrow(), 0.0); // recheck initial variant value variantManager.setWorkingVariant(VariantManagerConstants.INITIAL_VARIANT_ID); - assertEquals(-602.6, controlAreaA.getAcInterchangeTarget().orElseThrow(), 0.0); + assertEquals(-602.6, controlAreaA.getInterchangeTarget().orElseThrow(), 0.0); // remove working variant s4 variantManager.setWorkingVariant("s4"); variantManager.removeVariant("s4"); try { - controlAreaA.getAcInterchangeTarget(); + controlAreaA.getInterchangeTarget(); fail(); } catch (Exception ignored) { // ignore @@ -198,22 +198,22 @@ public void testGetAreaBoundary() { public void areaInterchangeComputation() { assertEquals(-602.94, controlAreaA.getAcInterchange(), DELTA); assertEquals(0.0, controlAreaA.getDcInterchange()); - assertEquals(-602.94, controlAreaA.getTotalInterchange(), DELTA); + assertEquals(-602.94, controlAreaA.getInterchange(), DELTA); assertEquals(+602.94, controlAreaB.getAcInterchange(), DELTA); assertEquals(0.0, controlAreaB.getDcInterchange()); - assertEquals(+602.94, controlAreaB.getTotalInterchange(), DELTA); + assertEquals(+602.94, controlAreaB.getInterchange(), DELTA); // no boundaries defined assertEquals(0.0, regionAB.getAcInterchange()); assertEquals(0.0, regionAB.getDcInterchange()); - assertEquals(0.0, regionAB.getTotalInterchange()); + assertEquals(0.0, regionAB.getInterchange()); // verify NaN do not mess up the calculation dlXnode1A.getTerminal().setP(Double.NaN); assertEquals(-301.47, controlAreaA.getAcInterchange(), DELTA); assertEquals(0.0, controlAreaA.getDcInterchange()); - assertEquals(-301.47, controlAreaA.getTotalInterchange(), DELTA); + assertEquals(-301.47, controlAreaA.getInterchange(), DELTA); } @Test @@ -287,17 +287,17 @@ public void testWithTerminals() { assertEquals(-604.89, controlAreaA.getAcInterchange(), DELTA); assertEquals(0.0, controlAreaA.getDcInterchange()); - assertEquals(-604.89, controlAreaA.getTotalInterchange(), DELTA); + assertEquals(-604.89, controlAreaA.getInterchange(), DELTA); assertEquals(+604.89, controlAreaB.getAcInterchange(), DELTA); assertEquals(0.0, controlAreaB.getDcInterchange()); - assertEquals(+604.89, controlAreaB.getTotalInterchange(), DELTA); + assertEquals(+604.89, controlAreaB.getInterchange(), DELTA); // verify NaN do not mess up the calculation ngenNhv1.getTerminal2().setP(Double.NaN); assertEquals(0.0, controlAreaA.getAcInterchange()); assertEquals(0.0, controlAreaA.getDcInterchange()); - assertEquals(0.0, controlAreaA.getTotalInterchange()); + assertEquals(0.0, controlAreaA.getInterchange()); // test removing Terminal boundaries controlAreaB @@ -317,7 +317,7 @@ public void testAddSameBoundary() { assertEquals(2, controlAreaA.getAreaBoundaryStream().count()); assertEquals(-602.94, controlAreaA.getAcInterchange(), DELTA); assertEquals(0.0, controlAreaA.getDcInterchange()); - assertEquals(-602.94, controlAreaA.getTotalInterchange(), DELTA); + assertEquals(-602.94, controlAreaA.getInterchange(), DELTA); // change them to DC controlAreaA @@ -326,7 +326,7 @@ public void testAddSameBoundary() { assertEquals(2, controlAreaA.getAreaBoundaryStream().count()); assertEquals(0.0, controlAreaA.getAcInterchange()); assertEquals(-602.94, controlAreaA.getDcInterchange(), DELTA); - assertEquals(-602.94, controlAreaA.getTotalInterchange(), DELTA); + assertEquals(-602.94, controlAreaA.getInterchange(), DELTA); } @Test @@ -342,7 +342,7 @@ public void testWithDc() { dlXnode2A.setP0(310.0); assertEquals(-290.0, controlAreaA.getAcInterchange(), DELTA); assertEquals(-310.0, controlAreaA.getDcInterchange()); - assertEquals(-600.0, controlAreaA.getTotalInterchange(), DELTA); + assertEquals(-600.0, controlAreaA.getInterchange(), DELTA); } @Test @@ -505,13 +505,13 @@ public void removeArea() { Throwable e1 = assertThrows(PowsyblException.class, controlAreaA::getAreaType); assertEquals("Cannot access area type of removed area ControlArea_A", e1.getMessage()); - Throwable e2 = assertThrows(PowsyblException.class, controlAreaA::getAcInterchangeTarget); - assertEquals("Cannot access AC interchange target of removed area ControlArea_A", e2.getMessage()); + Throwable e2 = assertThrows(PowsyblException.class, controlAreaA::getInterchangeTarget); + assertEquals("Cannot access interchange target of removed area ControlArea_A", e2.getMessage()); Throwable e3 = assertThrows(PowsyblException.class, controlAreaA::getAcInterchange); assertEquals("Cannot access AC interchange of removed area ControlArea_A", e3.getMessage()); Throwable e4 = assertThrows(PowsyblException.class, controlAreaA::getDcInterchange); assertEquals("Cannot access DC interchange of removed area ControlArea_A", e4.getMessage()); - Throwable e5 = assertThrows(PowsyblException.class, controlAreaA::getTotalInterchange); + Throwable e5 = assertThrows(PowsyblException.class, controlAreaA::getInterchange); assertEquals("Cannot access total interchange of removed area ControlArea_A", e5.getMessage()); Throwable e6 = assertThrows(PowsyblException.class, controlAreaA::getVoltageLevels); assertEquals("Cannot access voltage levels of removed area ControlArea_A", e6.getMessage()); diff --git a/iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractMergeNetworkTest.java b/iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractMergeNetworkTest.java index c590f3297dc..45602bcee92 100644 --- a/iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractMergeNetworkTest.java +++ b/iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractMergeNetworkTest.java @@ -417,7 +417,7 @@ public void failMergeContainingSubnetworks() { public void testMergeAndDetachWithDistinctAreas() { addCommonSubstationsAndVoltageLevels(); Area n1TsoA = addArea(n1, "tsoA", "tso"); - Area n2BzB = n2.newArea().setId("bzB").setName("bzB_Name").setAreaType("bz").setFictitious(true).setAcInterchangeTarget(100.).add(); + Area n2BzB = n2.newArea().setId("bzB").setName("bzB_Name").setAreaType("bz").setFictitious(true).setInterchangeTarget(100.).add(); n1TsoA.addVoltageLevel(n1.getVoltageLevel("vl1")); n2BzB.addVoltageLevel(n2.getVoltageLevel("vl2")); @@ -428,8 +428,8 @@ public void testMergeAndDetachWithDistinctAreas() { final Area mergedBzB = merged.getArea("bzB"); assertNotNull(mergedBzB); assertTrue(mergedBzB.isFictitious()); - assertTrue(mergedBzB.getAcInterchangeTarget().isPresent()); - assertEquals(100., mergedBzB.getAcInterchangeTarget().getAsDouble()); + assertTrue(mergedBzB.getInterchangeTarget().isPresent()); + assertEquals(100., mergedBzB.getInterchangeTarget().getAsDouble()); // Detach n1, and check its content Network n1Detached = merged.getSubnetwork(n1.getId()).detach(); @@ -446,8 +446,8 @@ public void testMergeAndDetachWithDistinctAreas() { final Area detachedBzB = n2Detached.getArea("bzB"); assertNotNull(detachedBzB); assertTrue(detachedBzB.isFictitious()); - assertTrue(detachedBzB.getAcInterchangeTarget().isPresent()); - assertEquals(100., detachedBzB.getAcInterchangeTarget().getAsDouble()); + assertTrue(detachedBzB.getInterchangeTarget().isPresent()); + assertEquals(100., detachedBzB.getInterchangeTarget().getAsDouble()); } @Test diff --git a/iidm/iidm-test/src/main/java/com/powsybl/iidm/network/test/EurostagTutorialExample1Factory.java b/iidm/iidm-test/src/main/java/com/powsybl/iidm/network/test/EurostagTutorialExample1Factory.java index b10ca53ebfa..0bef269be0b 100644 --- a/iidm/iidm-test/src/main/java/com/powsybl/iidm/network/test/EurostagTutorialExample1Factory.java +++ b/iidm/iidm-test/src/main/java/com/powsybl/iidm/network/test/EurostagTutorialExample1Factory.java @@ -898,7 +898,7 @@ public static Network createWithTieLinesAndAreas(NetworkFactory networkFactory) .setId("ControlArea_A") .setName("Control Area A") .setAreaType("ControlArea") - .setAcInterchangeTarget(-602.6) + .setInterchangeTarget(-602.6) .addVoltageLevel(network.getVoltageLevel(VLGEN)) .addVoltageLevel(network.getVoltageLevel(VLHV1)) .addAreaBoundary(network.getDanglingLine(DANGLING_LINE_XNODE1_1).getBoundary(), true) @@ -908,7 +908,7 @@ public static Network createWithTieLinesAndAreas(NetworkFactory networkFactory) .setId("ControlArea_B") .setName("Control Area B") .setAreaType("ControlArea") - .setAcInterchangeTarget(+602.6) + .setInterchangeTarget(+602.6) .addVoltageLevel(network.getVoltageLevel(VLHV2)) .addVoltageLevel(network.getVoltageLevel(VLLOAD)) .addAreaBoundary(network.getDanglingLine(DANGLING_LINE_XNODE1_2).getBoundary(), true)