Skip to content

Commit

Permalink
Generic Area model in IIDM (#2955)
Browse files Browse the repository at this point in the history
* Generic Area model in IIDM

Signed-off-by: mguibert <marine.guibert@artelys.com>
Co-authored-by: vmouradian <valentin.mouradian@artelys.com>
Co-authored-by: jeandemanged <damien.jeandemange@artelys.com>
  • Loading branch information
3 people authored and geofjamg committed Sep 18, 2024
1 parent 68a4b98 commit 82e413b
Show file tree
Hide file tree
Showing 32 changed files with 2,347 additions and 14 deletions.
50 changes: 50 additions & 0 deletions docs/grid_model/network_subnetwork.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,56 @@ When defining the model, the user has to specify how the different equipment con
- [Identifiable Short-Circuit](extensions.md#identifiable-short-circuit)
- [Slack Terminal](extensions.md#slack-terminal)

(area)=
## Area
[![Javadoc](https://img.shields.io/badge/-javadoc-blue.svg)](https://javadoc.io/doc/com.powsybl/powsybl-core/latest/com/powsybl/iidm/network/Area.html)

An Area is a geographical zone of a given type.

An Area is composed of a collection of [voltage levels](#voltage-level), and a collection of area boundaries.
Area boundaries can be terminals of equipments or `Boundary` objects from [dangling lines](#dangling-line).

The area type is used to distinguish between various area concepts of different granularity. For instance: control areas, bidding zones, countries...

A [voltage level](#voltage-level) can belong to several areas, as long as all areas are of different type.

The area boundaries define how interchange are to be calculated for the area.
Area interchange is calculated by summing the active power flows across the area boundaries and can be obtained for AC part only (considering only AC boundaries),
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 |

**Characteristics of an AreaBoundary**

An area boundary is modeled by an `AreaBoundary` instance.
It is composed of either DanglingLine Boundary or a Terminal, and boolean telling if the area boundary
is to be considered as AC or DC.

The `Ac` flag is informative and is present to support the use case where boundaries are defined on AC components even though
the boundary is related to an HVDC link. An example for this is a DanglingLine (which is an AC equipment) that may actually represent
an HVDC interconnection that is not explicitly described in the network model. This information is used when computing area interchanges,
which are then separated for AC and DC parts.

| Attribute | Unit | Description |
|------------|------|-----------------------------------------------------------------------------|
| $Area$ | | The area of this boundary |
| $Boundary$ | | Boundary of a DanglingLine (mutually exclusive with the Terminal attribute) |
| $Terminal$ | | Terminal of an equipment (mutually exclusive with the Boundary attribute) |
| $Ac$ | | True if AreaBoundary is to be considered AC, false otherwise |

(generator)=
## Generator
[![Javadoc](https://img.shields.io/badge/-javadoc-blue.svg)](https://javadoc.io/doc/com.powsybl/powsybl-core/latest/com/powsybl/iidm/network/Generator.html)
Expand Down
191 changes: 191 additions & 0 deletions iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Area.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
/**
* Copyright (c) 2024, Coreso SA (https://www.coreso.eu/) and TSCNET Services GmbH (https://www.tscnet.eu/)
* 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.OptionalDouble;
import java.util.stream.Stream;

/**
* An Area is a geographical zone of a given type.
* <p> An Area is composed of a collection of voltage levels, and a collection of area boundaries.
* <p> The area type is used to distinguish between various area concepts of different granularity.
* For instance: control areas, bidding zones, countries...
* <p> To create an Area, see {@link AreaAdder}
*
* <p>
* Characteristics
* </p>
*
* <table style="border: 1px solid black; border-collapse: collapse">
* <thead>
* <tr>
* <th style="border: 1px solid black">Attribute</th>
* <th style="border: 1px solid black">Type</th>
* <th style="border: 1px solid black">Unit</th>
* <th style="border: 1px solid black">Required</th>
* <th style="border: 1px solid black">Default value</th>
* <th style="border: 1px solid black">Description</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td style="border: 1px solid black">Id</td>
* <td style="border: 1px solid black">String</td>
* <td style="border: 1px solid black"> - </td>
* <td style="border: 1px solid black">yes</td>
* <td style="border: 1px solid black"> - </td>
* <td style="border: 1px solid black">Unique identifier of the Area</td>
* </tr>
* <tr>
* <td style="border: 1px solid black">Name</td>
* <td style="border: 1px solid black">String</td>
* <td style="border: 1px solid black">-</td>
* <td style="border: 1px solid black">no</td>
* <td style="border: 1px solid black"> - </td>
* <td style="border: 1px solid black">Human-readable name of the Area</td>
* </tr>
* <tr>
* <td style="border: 1px solid black">AreaType</td>
* <td style="border: 1px solid black">String</td>
* <td style="border: 1px solid black">-</td>
* <td style="border: 1px solid black">yes</td>
* <td style="border: 1px solid black"> - </td>
* <td style="border: 1px solid black">The type of Area. For instance: "ControlArea", "BiddingZone", "Country"...</td>
* </tr>
* <tr>
* <td style="border: 1px solid black">AcInterchangeTarget</td>
* <td style="border: 1px solid black">Double</td>
* <td style="border: 1px solid black">-</td>
* <td style="border: 1px solid black">no</td>
* <td style="border: 1px solid black"> - </td>
* <td style="border: 1px solid black">The optional target AC Interchange of this area in MW, using load sign convention (negative is export, positive is import)</td>
* </tr>
* </tbody>
* </table>
*
* @author Marine Guibert {@literal <marine.guibert at artelys.com>}
* @author Valentin Mouradian {@literal <valentin.mouradian at artelys.com>}
* @see VoltageLevel
* @see AreaBoundary
* @see AreaAdder
*/
public interface Area extends Identifiable<Area> {

/**
* Get the type of this area
*/
String getAreaType();

/**
* Get all area voltage levels.
*/
Iterable<VoltageLevel> getVoltageLevels();

/**
* Get all area voltage levels.
*/
Stream<VoltageLevel> getVoltageLevelStream();

/**
* Adds a voltage level to the area.
* @param voltageLevel voltage level to be added
*/
Area addVoltageLevel(VoltageLevel voltageLevel);

/**
* Removes the provided VoltageLevel from the area. The VoltageLevel is not removed from the network,
* the VoltageLevel is not part of the Area anymore.
* @param voltageLevel the VoltageLevel to be removed from the Area.
*/
Area removeVoltageLevel(VoltageLevel voltageLevel);

/**
* @return adder to create a new area boundary
*/
AreaBoundaryAdder newAreaBoundary();

/**
* If exists, remove the area boundary associated with the provided terminal.
* The Terminal and its Connectable are not removed from the network, but are not part of the Area anymore.
* @param terminal terminal
*/
Area removeAreaBoundary(Terminal terminal);

/**
* If exists, remove the area boundary associated with the provided DanglingLine's Boundary.
* The DanglingLine and its Boundary are not removed from the network, but are not part of the Area anymore.
* @param boundary DanglingLine's boundary
*/
Area removeAreaBoundary(Boundary boundary);

/**
* If found, returns the area boundary associated with the provided DanglingLine's Boundary.
* Otherwise, null is returned.
* @param boundary DanglingLine's boundary
*/
AreaBoundary getAreaBoundary(Boundary boundary);

/**
* If found, returns the area boundary associated with the provided Terminal.
* Otherwise, null is returned.
* @param terminal terminal
*/
AreaBoundary getAreaBoundary(Terminal terminal);

/**
* Get all area boundaries.
*/
Iterable<AreaBoundary> getAreaBoundaries();

/**
* Get all area boundaries.
*/
Stream<AreaBoundary> getAreaBoundaryStream();

@Override
default IdentifiableType getType() {
return IdentifiableType.AREA;
}

/**
* Get the optional target AC Interchange of this area in MW, in load sign convention (negative is export, positive is import).
* <p>Depends on the working variant.</p>
*
* @return the AC Interchange target (MW)
*/
OptionalDouble getAcInterchangeTarget();

/**
* Set the target AC Interchange of this area in MW, in load sign convention (negative is export, positive is import).
* Providing Double.NaN removes the target.
* <p>Depends on the working variant.</p>
* @param acInterchangeTarget new AC interchange target (MW)
*/
Area setAcInterchangeTarget(double acInterchangeTarget);

/**
* Get the current AC Interchange of this area in MW, in load sign convention (negative is export, positive is import)
* @return the AC position (MW, 0 MW if no boundary)
*/
double getAcInterchange();

/**
* Get the current DC Interchange of this area in MW, in load sign convention (negative is export, positive is import)
* @return the DC position (MW, 0 MW if no boundary)
*/
double getDcInterchange();

/**
* 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();

void remove();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* Copyright (c) 2024, Coreso SA (https://www.coreso.eu/) and TSCNET Services GmbH (https://www.tscnet.eu/)
* 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;

/**
* To create an Area, from a <code>Network</code> instance call
* the {@link Network#newArea()} method to get an Area builder instance.
* <p>
* Example:
*<pre>
* Network n = ...
* Area a = n.newArea()
* .setId("FR")
* ...
* .add();
*</pre>
*
* @author Marine Guibert {@literal <marine.guibert at artelys.com>}
* @author Valentin Mouradian {@literal <valentin.mouradian at artelys.com>}
* @see Area
* @see Network
*/
public interface AreaAdder extends IdentifiableAdder<Area, AreaAdder> {

/**
* Set the Area type
*/
AreaAdder setAreaType(String areaType);

/**
* Set the target AC Interchange of this area in MW, in load sign convention (negative is export, positive is import).
*/
AreaAdder setAcInterchangeTarget(double acInterchangeTarget);

/**
* add a VoltageLevel to the Area
*/
AreaAdder addVoltageLevel(VoltageLevel voltageLevel);

/**
* add a Terminal as an area boundary
*/
AreaAdder addAreaBoundary(Terminal terminal, boolean ac);

/**
* add a DanglingLine boundary as an area boundary
*/
AreaAdder addAreaBoundary(Boundary boundary, boolean ac);

/**
* Build the Area object.
* <p>These are the checks that are performed before creating the object :</p>
* <ul>
* <li>areaType is not null;</li>
* </ul>
* @return {@link Area}
*/
@Override
Area add();
}
Loading

0 comments on commit 82e413b

Please sign in to comment.