Skip to content

yasstec/powsybl-single-line-diagram

 
 

Repository files navigation

PowSyBl Single Line Diagram

Actions Status Coverage Status Quality Gate MPL-2.0 License Join the community on Spectrum Slack

PowSyBl (Power System Blocks) is an open source framework written in Java, that makes it easy to write complex software for power systems’ simulations and analysis. Its modular approach allows developers to extend or customize its features.

PowSyBl is part of the LF Energy Foundation, a project of The Linux Foundation that supports open source innovation projects within the energy and electricity sectors.

PowSyBl Logo

Read more at https://www.powsybl.org !

This project and everyone participating in it is governed by the PowSyBl Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].

PowSyBl vs PowSyBl Single Line Diagram

PowSyBl Single Line Diagram is a component build on top of the Network model available in the PowSyBl Core repository responsible for generating a single line diagram.

The main features are:

  • Node/Breaker and bus/breaker topology.
  • SVG diagram to be used in various front-end technologies.
  • Voltage level, substation and zone diagrams.
  • Highly customizable rendering using equipment component libraries, CSS and configurable labels (position and content).
  • Multiple layout modes: fully automatic, semi-automatic (using relative positions for busbar sections and feeders), CGMES DL.

Diagram demo The example above corresponds to a CGMES file from the ENTSO-E sample files. A guide to generate this diagram is available here.

Getting started

To generate a SVG single line diagram from a voltage level, we first need to add a Maven dependency for the Network model and additionally for this example three other ones: two for the Network test case, one for simple logging capabilities:

<dependency>
    <groupId>com.powsybl</groupId>
    <artifactId>powsybl-iidm-impl</artifactId>
    <version>4.3.1</version>
</dependency>
<dependency>
    <groupId>com.powsybl</groupId>
    <artifactId>powsybl-iidm-test</artifactId>
    <version>4.3.1</version>
</dependency>
<dependency>
    <groupId>com.powsybl</groupId>
    <artifactId>powsybl-config-test</artifactId>
    <version>4.3.1</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.7.22</version>
</dependency>

We can now load a node/breaker test Network:

Network network = FictitiousSwitchFactory.create();

After adding the single line diagram core module dependency:

<dependency>
    <groupId>com.powsybl</groupId>
    <artifactId>powsybl-single-line-diagram-core</artifactId>
    <version>2.3.0</version>
</dependency>

We can generate a SVG for the voltage level N:

// "Convergence" style component library
ComponentLibrary componentLibrary = new ConvergenceComponentLibrary();

// fully automatic layout
VoltageLevelLayoutFactory voltageLevelLayoutFactory = new PositionVoltageLevelLayoutFactory(new PositionByClustering());

// create diagram for the voltage level N
VoltageLevelDiagram voltageLevelDiagram = VoltageLevelDiagram.build(new NetworkGraphBuilder(network), "N", voltageLevelLayoutFactory, false);

// create default parameters for the SVG layout
// then activating height compaction, tooltip and inclusion of CSS styles in the SVG
LayoutParameters layoutParameters = new LayoutParameters()
    .setAdaptCellHeightToContent(true)
    .setTooltipEnabled(true)
    .setCssLocation(LayoutParameters.CssLocation.INSERTED_IN_SVG);

// generate SVG
voltageLevelDiagram.writeSvg("",
    new DefaultSVGWriter(componentLibrary, layoutParameters),
    new DefaultDiagramLabelProvider(network, componentLibrary, layoutParameters),
    new NominalVoltageDiagramStyleProvider(network),
    Paths.get("/tmp/n.svg"));

We obtain the following SVG:

Diagram demo

About

Single line diagram generation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.7%
  • CSS 0.3%