Skip to content

Latest commit

 

History

History
56 lines (44 loc) · 1.54 KB

File metadata and controls

56 lines (44 loc) · 1.54 KB
title JavaScriptPostProcessor
layout default

The com.powsybl.iidm.converter.JavaScriptPostProcessor class is an implementation of the com.powsybl.iidm.converter.ImportPostProcessor interface that runs a JS script after a IIDM network is loaded.

The JS script has access to two variables:

  • network : the IIDM network instance
  • computationManager : a computation manager instance to use to run simulation

Configuration

To activate the JavaScriptPostProcessor, add javaScript to the postProcessors property of the import module.

Read the javaScriptPostProcessor documentation to learn how to set the path of the JS script.

YAML

import:
    postProcessors: javaScript
    
groovy-post-processor:
    script: /tmp/script.js
<import>
    <postProcessors>javaScript</postProcessors>
</import>

<groovy-post-processor>
    <script>/tmp/script.js</script>
</groovy-post-processor>

Examples

The following example prints meta-information from the network:

print("Network " + network.getId() + " (" + network.getSourceFormat()+ ") is imported");

Read this tutorial to learn how to write more complex JS script.

Maven configuration

To use the Groovy post processor, add the following dependencies to the pom.xml file:

<dependency>
    <groupId>com.powsybl</groupId>
    <artifactId>powsybl-iidm-api</artifactId>
    <version>${powsybl.version}</version>
</dependency>