Network Area Diagram - SVG Writing

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


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:
  • If you only want to import the strictly needed dependencies for this tutorial, you can write a more detailed pom file:
Roll/unroll dependencies



Here are some details about these dependencies (see also the powsybl artifacts documentation page):

  • 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:

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

We end up with the following diagram:


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:

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

This leads to the following SVG:


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

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

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.