Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/powsybl/powsybl-dynawo
Dynawo integration in powsybl
https://github.com/powsybl/powsybl-dynawo
energy-system power-system-dynamic-modeling power-system-simulation powsybl powsybl-dynawo
Last synced: about 1 month ago
JSON representation
Dynawo integration in powsybl
- Host: GitHub
- URL: https://github.com/powsybl/powsybl-dynawo
- Owner: powsybl
- License: mpl-2.0
- Created: 2019-07-11T12:35:00.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-12T15:46:06.000Z (9 months ago)
- Last Synced: 2024-04-12T23:07:43.483Z (8 months ago)
- Topics: energy-system, power-system-dynamic-modeling, power-system-simulation, powsybl, powsybl-dynawo
- Language: Java
- Size: 2.49 MB
- Stars: 3
- Watchers: 18
- Forks: 0
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# powsybl-dynawo
[![Actions Status](https://github.com/powsybl/powsybl-dynawo/workflows/CI/badge.svg)](https://github.com/powsybl/powsybl-dynawo/actions)
[![Coverage Status](https://sonarcloud.io/api/project_badges/measure?project=com.powsybl%3Apowsybl-dynawo&metric=coverage)](https://sonarcloud.io/component_measures?id=com.powsybl%3Apowsybl-dynawo&metric=coverage)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=com.powsybl%3Apowsybl-dynawo&metric=alert_status)](https://sonarcloud.io/dashboard?id=com.powsybl%3Apowsybl-dynawo)
[![MPL-2.0 License](https://img.shields.io/badge/license-MPL_2.0-blue.svg)](https://www.mozilla.org/en-US/MPL/2.0/)
[![Javadocs](https://www.javadoc.io/badge/com.powsybl/powsybl-dynawo.svg?color=blue)](https://www.javadoc.io/doc/com.powsybl/powsybl-dynawo)
[![Slack](https://img.shields.io/badge/slack-powsybl-blueviolet.svg?logo=slack)](https://join.slack.com/t/powsybl/shared_invite/zt-rzvbuzjk-nxi0boim1RKPS5PjieI0rA)[Dynawo](https://dynawo.github.io) is an hybrid C++/Modelica open source suite of simulation tools for power systems. This integration module allows to use [DynaFlow](https://dynawo.github.io/about/dynaflow) for [power flow simulations](https://powsybl.readthedocs.io/projects/powsybl-core/en/stable/simulation/loadflow/index.html) and [Dynawo](https://dynawo.github.io) for [time domain simulations](https://powsybl.readthedocs.io/projects/powsybl-core/en/stable/simulation/dynamic/index.html).
## DynaFlow
To use DynaFlow as your power flow engine, add the `com.powsybl:powsybl-dynaflow` module to your dependencies.
```java
Network network = Network.read("/path/to/the/casefile.xiidm");
LoadFlowParameters parameters = LoadFlowParameters.load();
LoadFlow.find("DynaFlow").run(network, parameters);
```To learn more about the usage of DynaFlow, read the [dedicated page](https://powsybl.readthedocs.io/projects/powsybl-dynawo/en/latest/load_flow/index.html) on our website.
## Dynawo
To use Dynawo as your time domain engine, add the `com.powsybl:powsybl-dynawo` and `com.powsybl:powsybl-dynawo-dsl` modules to your dependencies.
To run a dynamic simulation, you need:
- a case file
- a `DynamicModelsSupplier` to associate dynamic models to the equipment of the network
- an `EventModelsSuppler` to configure events simulated during the simulation (optional)
- an `OutputVariablesSupplier` to follow the evolution of dynamic variables during the simulation (optional)
- a set of parameters to configure the simulation (optional)Thanks to `powsybl-dynawo-dsl`, the inputs can be easily configured using Groovy scripts.
The simulation parameters can be configured either in the `config.yml` file or using a Json file.```java
Network network = Network.read("/path/to/the/casefile.xiidm");// Load the dynamic models mapping
DynamicModelsSupplier dynamicModelsSupplier = new GroovyDynamicModelsSupplier(
Paths.get("/path/to/dynamicModelsMapping.groovy"),
GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME));// Load the events
EventModelsSupplier eventModelsSupplier = new GroovyEventModelsSupplier(
Paths.get("/path/to/event.groovy"),
GroovyExtension.find(EventModelGroovyExtension.class, DynawoSimulationProvider.NAME));// Configure the output variables
OutputVariablesSupplier outputVariablesSupplier = new GroovyOutputVariablesSupplier(
Paths.get("/path/to/outputVariables.groovy"),
GroovyExtension.find(OutputVariableGroovyExtension.class, DynawoSimulationProvider.NAME));// Load the parameters
DynamicSimulationParameters parameters = DynamicSimulationParameters.load();// Run the simulation and display the results
DynamicSimulationResult result = DynamicSimulation.run(network, dynamicModelsSupplier, eventModelsSupplier, outputVariablesSupplier, parameters);
System.out.println(result.getStatus());
System.out.println("Timeline:");
result.getTimeLine().forEach(tl -> System.out.printf("[%.8f] %s (on %s)%n", tl.time(), tl.message(), tl.modelName()));
```To learn more about the usage of Dynawo, read the [dedicated page](https://powsybl.readthedocs.io/projects/powsybl-dynawo/en/latest/dynamic_simulation/index.html) on our website.
### Examples
This is an example of a dynamic models mapping file:
```groovy
import com.powsybl.iidm.network.Line
import com.powsybl.iidm.network.Load
import com.powsybl.iidm.network.Generatorfor (Load load : network.loads) {
LoadAlphaBeta {
staticId load.id
parameterSetId "LAB"
}
}for (Generator gen : network.generators) {
GeneratorSynchronousThreeWindingsProportionalRegulations {
staticId gen.id
parameterSetId "GSTWPR"
}
}for (Line line : network.lines) {
OverloadManagementSystem {
dynamicModelId "BBM_" + line.id
parameterSetId "CLA"
controlledBranch line.id
iMeasurement line.id
iMeasurementSide TwoSides.TWO
}
}
```Note that this mapping file refers to parameter set ids which should be found in the Dynawo parameters file.
For the above example, the corresponding parameter file could be:
```xml
```
Other examples can be found in the [resources](https://github.com/powsybl/powsybl-dynawo/tree/main/dynawo-dsl/src/test/resources) of this project.
## Contribute to documentation
The documentation sources for PowSybl Dynawo features are in the `docs` folder.
Please keep them up to date with your developments.
They are published on https://powsybl.readthedocs.io and pull requests are built and previewed automatically via github CI.### Preview results
When modifying the website content, you can easily preview the result by building the docs locally.
To do so, run the following commands:
~~~bash
pip install -r docs/requirements.txt
sphinx-build -a docs ./build-docs
~~~
Then open `build-docs/index.html` in your browser.### Cross-documentation links
If you want to add links to another documentation, add the corresponding repository to the `conf.py` file.
In order to automatically get the version specified in the `pom.xml`, please use the same naming as the version: if you define the
Groovy version with ``, then use `groovy` as key. The specified URL should start with `https://` and end with `latest/` (the final `/` is mandatory).
For example, to add a link to the documentation of Sphinx, you need to add the following lines:
~~~python
# This parameter might already be present, just add the new value
intersphinx_mapping = {
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
}
~~~Then in your documentation file, you can add links to Sphinx documentation. If you want to link to a whole page,
use one of the following example:
~~~Markdown
- {doc}`sphinx:usage/extensions/intersphinx`
- {doc}`Intersphinx `
- [Intersphinx](inv:sphinx:std:doc#usage/extensions/intersphinx).
~~~If you want to link a specific part of a page, use one of those examples:
~~~Markdown
- [Intersphinx roles](inv:#ref-role).
- [Intersphinx roles](inv:sphinx#ref-role).
- [Intersphinx roles](inv:sphinx:std:label:#ref-role).
- [Intersphinx roles](inv:sphinx:*:*:#ref-role).
~~~
*Note 1: for the last examples to work, there need to be a corresponding reference in the external documentation.
For those examples, `(ref-role)=` has been added right before the corresponding title
in the [Cross-referencing syntax page](inv:sphinx:std:doc#usage/referencing). Another way to make it work is to use the `autosectionlabel` module in Sphinx to
automatically generate anchors for each title.**Note 2: if the build fails, try with the `-E` option to clear the cache:*
~~~bash
sphinx-build -a -E docs ./build-docs
~~~