Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flow transfer tutorial #37

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions flow-transfer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Flow transfer tutorial
This tutorial aims to compute flows transfer after a contingency on a small fictive network. This is based on a sensitivity analysis.

# How to install the loadflow simulator
In the tutorial, we use Hades2, a RTE load-flow tool. Please visit the [Hades2 documentation](https://rte-france.github.io/hades2/index.html) to learn how to install Hades2 on your computer. Note that Hades2 only works on Linux and on Windows for the moment.

# How to configure this tutorial
The configuration file is :
```
<path_to_powsybl_tutorials>/loadflow/complete/src/main/resources/config.yml
```
In the tutorial, you have to configure the path to Hades2. Please visit the [loadflow feature](https://www.powsybl.org/pages/documentation/simulation/powerflow/hades2.html) to configure it.

In the tutorial, you also have to configure the path to a local computation directory (Hades2 temporary files will be stored here). Please visit [this page](https://www.powsybl.org/docs/configuration/modules/computation-local.html) to learn how to do it.

# Running the tutorial
You just need to execute the following command lines :
```
cd <path_to_powsybl_tutorials>/flow-transfert/
mvn package exec:java
```
82 changes: 82 additions & 0 deletions flow-transfer/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>powsybl-tutorials</artifactId>
<groupId>com.powsybl.tutorials</groupId>
<version>1.3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>flow-transfer</artifactId>
<name>Flow transfer computation tutorial</name>

<!-- These properties are only needed to run the tutorial easily -->
<properties>
<exec.cleanupDaemonThreads>false</exec.cleanupDaemonThreads>
<exec.mainClass>powsybl.tutorials.flowtransfer.FlowTransferAnalysisTutorial</exec.mainClass>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<systemProperties>
<systemProperty>
<key>powsybl.config.dirs</key>
<value>${project.build.directory}/classes</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-commons</artifactId>
<version>${powsybl.core.version}</version>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-contingency-api</artifactId>
<version>${powsybl.core.version}</version>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-iidm-api</artifactId>
<version>${powsybl.core.version}</version>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-sensitivity-analysis-api</artifactId>
<version>${powsybl.core.version}</version>
</dependency>
<dependency>
<groupId>com.rte-france.powsybl</groupId>
<artifactId>powsybl-hades2-integration</artifactId>
<version>${powsybl.rte-core.version}</version>
</dependency>
Comment on lines +60 to +63
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this may be only needed in runtime

<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-config-classic</artifactId>
<version>${powsybl.core.version}</version>
Comment on lines +65 to +67
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this may be only needed in runtime

</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-iidm-impl</artifactId>
<version>${powsybl.core.version}</version>
</dependency>
Comment on lines +76 to +79
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this may be only needed in runtime

</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
/**
* Copyright (c) 2020, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package powsybl.tutorials.flowtransfer;

import com.powsybl.iidm.network.*;
import powsybl.tutorials.flowtransfer.engine.FlowTransferAnalysisInput;

import java.util.Arrays;

/**
* Test case is a 4 nodes network, with 4 countries.
*
* FR (+100 MW) BE (0 MW)
* + ------------ +
* | |
* | |
* | |
* + ------------ +
* DE (0 MW) NL (-100 MW)
*
* All lines have same impedance.
* Two outages are simulated:
* - loss of FR-BE interconnection line
* - loss of FR-DE interconnection line.
*
* @author Sebastien Murgey {@literal <sebastien.murgey at rte-france.com>}
*/
public final class ExampleGenerator {

private ExampleGenerator() {
throw new AssertionError("Utility class should not be instantiated");
}

public static Network network() {

Network network = Network.create("Generator", "code");

Substation substationFr = network.newSubstation()
.setId("Substation FR")
.setName("Substation FR")
.setCountry(Country.FR)
.add();
VoltageLevel voltageLevelFr = substationFr.newVoltageLevel()
.setId("Voltage level FR")
.setName("Voltage level FR")
.setNominalV(400)
.setTopologyKind(TopologyKind.BUS_BREAKER)
.setLowVoltageLimit(300)
.setHighVoltageLimit(500)
.add();
voltageLevelFr.getBusBreakerView()
.newBus()
.setId("Bus FR")
.setName("Bus FR")
.add();
voltageLevelFr.newGenerator()
.setId("Generator FR")
.setName("Generator FR")
.setBus("Bus FR")
.setEnergySource(EnergySource.OTHER)
.setMinP(1000)
.setMaxP(2000)
.setRatedS(100)
.setTargetP(1600)
.setTargetV(400)
.setVoltageRegulatorOn(true)
.add();
voltageLevelFr.newLoad()
.setId("Load FR")
.setName("Load FR")
.setBus("Bus FR")
.setLoadType(LoadType.UNDEFINED)
.setP0(1500)
.setQ0(0)
.add();

Substation substationBe = network.newSubstation()
.setId("Substation BE")
.setName("Substation BE")
.setCountry(Country.BE)
.add();
VoltageLevel voltageLevelBe = substationBe.newVoltageLevel()
.setId("Voltage level BE")
.setName("Voltage level BE")
.setNominalV(400)
.setTopologyKind(TopologyKind.BUS_BREAKER)
.setLowVoltageLimit(300)
.setHighVoltageLimit(500)
.add();
voltageLevelBe.getBusBreakerView()
.newBus()
.setId("Bus BE")
.setName("Bus BE")
.add();
voltageLevelBe.newGenerator()
.setId("Generator BE")
.setName("Generator BE")
.setBus("Bus BE")
.setEnergySource(EnergySource.OTHER)
.setMinP(1000)
.setMaxP(2000)
.setRatedS(100)
.setTargetP(1500)
.setTargetV(400)
.setVoltageRegulatorOn(true)
.add();
voltageLevelBe.newLoad()
.setId("Load BE")
.setName("Load BE")
.setBus("Bus BE")
.setLoadType(LoadType.UNDEFINED)
.setP0(1500)
.setQ0(0)
.add();

Substation substationDe = network.newSubstation()
.setId("Substation DE")
.setName("Substation DE")
.setCountry(Country.DE)
.add();
VoltageLevel voltageLevelDe = substationDe.newVoltageLevel()
.setId("Voltage level DE")
.setName("Voltage level DE")
.setNominalV(400)
.setTopologyKind(TopologyKind.BUS_BREAKER)
.setLowVoltageLimit(300)
.setHighVoltageLimit(500)
.add();
voltageLevelDe.getBusBreakerView()
.newBus()
.setId("Bus DE")
.setName("Bus DE")
.add();
voltageLevelDe.newGenerator()
.setId("Generator DE")
.setName("Generator DE")
.setBus("Bus DE")
.setEnergySource(EnergySource.OTHER)
.setMinP(1000)
.setMaxP(2000)
.setRatedS(100)
.setTargetP(1500)
.setTargetV(400)
.setVoltageRegulatorOn(true)
.add();
voltageLevelDe.newLoad()
.setId("Load DE")
.setName("Load DE")
.setBus("Bus DE")
.setLoadType(LoadType.UNDEFINED)
.setP0(1500)
.setQ0(0)
.add();

Substation substationNl = network.newSubstation()
.setId("Substation NL")
.setName("Substation NL")
.setCountry(Country.NL)
.add();
VoltageLevel voltageLevelNl = substationNl.newVoltageLevel()
.setId("Voltage level NL")
.setName("Voltage level NL")
.setNominalV(400)
.setTopologyKind(TopologyKind.BUS_BREAKER)
.setLowVoltageLimit(300)
.setHighVoltageLimit(500)
.add();
voltageLevelNl.getBusBreakerView()
.newBus()
.setId("Bus NL")
.setName("Bus NL")
.add();
voltageLevelNl.newGenerator()
.setId("Generator NL")
.setName("Generator NL")
.setBus("Bus NL")
.setEnergySource(EnergySource.OTHER)
.setMinP(1000)
.setMaxP(2000)
.setRatedS(100)
.setTargetP(1500)
.setTargetV(400)
.setVoltageRegulatorOn(true)
.add();
voltageLevelNl.newLoad()
.setId("Load NL")
.setName("Load NL")
.setBus("Bus NL")
.setLoadType(LoadType.UNDEFINED)
.setP0(1600)
.setQ0(0)
.add();

network.newLine()
.setId("FR-BE")
.setName("FR-BE")
.setVoltageLevel1("Voltage level FR")
.setVoltageLevel2("Voltage level BE")
.setBus1("Bus FR")
.setBus2("Bus BE")
.setR(0)
.setX(5)
.setB1(0)
.setB2(0)
.setG1(0)
.setG2(0)
.add();
network.newLine()
.setId("FR-DE")
.setName("FR-DE")
.setVoltageLevel1("Voltage level FR")
.setVoltageLevel2("Voltage level DE")
.setBus1("Bus FR")
.setBus2("Bus DE")
.setR(0)
.setX(5)
.setB1(0)
.setB2(0)
.setG1(0)
.setG2(0)
.add();
network.newLine()
.setId("BE-NL")
.setName("BE-NL")
.setVoltageLevel1("Voltage level BE")
.setVoltageLevel2("Voltage level NL")
.setBus1("Bus BE")
.setBus2("Bus NL")
.setR(0)
.setX(5)
.setB1(0)
.setB2(0)
.setG1(0)
.setG2(0)
.add();
network.newLine()
.setId("DE-NL")
.setName("DE-NL")
.setVoltageLevel1("Voltage level DE")
.setVoltageLevel2("Voltage level NL")
.setBus1("Bus DE")
.setBus2("Bus NL")
.setR(0)
.setX(5)
.setB1(0)
.setB2(0)
.setG1(0)
.setG2(0)
.add();
return network;
}

public static FlowTransferAnalysisInput input() {
return new FlowTransferAnalysisInput(Arrays.asList("FR-BE", "FR-DE"));
}
}
Loading