Apache Groovy is an object-oriented programming language for the Java platform. This language is widely used in PowSyBl to implement domain specific languages such as the contingency DSL, the action DSL or the DSLs for time-domain simulations. With Groovy, you have access to all features of the framework without any payload.
- to load and save a case file
- to easily run power flow simulations.
It’s possible to extend this DSL with user-friendly functions by writing extensions.
This small example shows how to load a case file and run a power simulation in Groovy:
import com.powsybl.loadflow.LoadFlow // Load a case file network = loadNetwork("eurostag-tutorial-example1.xml") // Run a power flow with OpenLF implementation result = LoadFlow.find("OpenLoadFlow").run(network) println "Computation OK? " + result.isOk() println "Metrics: " + result.getMetrics() // Save the network saveNetwork("XIIDM", network, null, "eurostag-tutorial-example1-after-lf.xml")