| 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 instancecomputationManager: a computation manager instance to use to run simulation
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.
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>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.
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>