Network Area Diagram - SVG Writing#

We are showing in this guide how to create some network-area diagrams.

Prerequisites#

Maven dependencies#

First of all, we need some Maven dependencies.

  • If you want to get a quick start, please add the powsybl-starter dependency to your pom file:

<dependency>
    <groupId>com.powsybl</groupId>
    <artifactId>powsybl-starter</artifactId>
    <version>2025.2.0</version>
</dependency>
  • If you only want to import the strictly needed dependencies for this tutorial, you can write a more detailed pom file:

Roll/unroll dependencies

{% highlight xml %}

com.powsybl powsybl-dependencies ${powsybl-dependencies.version} pom import com.powsybl powsybl-network-area-diagram com.powsybl powsybl-iidm-impl com.powsybl powsybl-ieee-cdf-converter org.slf4j slf4j-simple ${slf4j.version} 2025.2.0 2.0.17

{% endhighlight %}

Here are some details about these dependencies (see also the [powsybl artifacts documentation page](../../artifacts.md)): - `powsybl-network-area-diagram` is the core module of network-area-diagram, - `powsybl-iidm-impl` is used to deal with the network model, - `powsybl-ieee-cdf-converter` is used to load the `Network` example - `slf4j-simple` allows you to have simple logging capabilities.

Loading the test network#

We simply need to load the IEEE 300-bus example network:

Network network = IeeeCdfNetworkFactory.create300();

Generating the corresponding network area diagram SVG#

This can be done with a single line of code:

NetworkAreaDiagram.draw(network, Path.of("/tmp/diagram.svg"));

We end up with the following diagram:

wholeNetwork

Generating SVG for part of the input network#

If only part of the network is wanted, we can generate a partial graph of the network, by providing

  • Either a voltage level id and a depth;

  • Or a list of voltage level ids and a (unique) depth.

For instance, let’s generate the subgraph centered on voltage level "VL25" with a depth of 2:

NetworkAreaDiagram.draw(network, Path.of("/tmp/partial_diagram_25.svg"), "VL25", 2);

This leads to the following SVG:

VL25

Now let’s generate the subgraph with voltage levels at a maximum distance of 2 from "VL1" and "VL25":

NetworkAreaDiagram.draw(network, Path.of("/tmp/partial_diagram_1_25.svg"), List.of("VL1", "VL25"), 2);

This gives us the diagram below. Note that nothing ensures that the parts displayed in resulting diagram are connected. That is, the voltage levels between two voltage levels which are connected in the full graph are not necessarily drawn.

VL1_VL25