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 %}
{% endhighlight %}
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:
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:
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.
