Skip to content

Commit

Permalink
Move openreac from incubator (#1)
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Pierre <nicolas.pierre@artelys.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
  • Loading branch information
nicolas-pierr authored Apr 21, 2023
1 parent b6c3eb8 commit 7178b42
Show file tree
Hide file tree
Showing 48 changed files with 4,797 additions and 17 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Maven projects
target/

# IntelliJ
/.idea
*.iml

# Eclipse projects
.classpath
.project
org.eclipse.core.resources.prefs
org.eclipse.jdt.core.prefs
org.eclipse.m2e.core.prefs
org.eclipse.jdt.groovy.core.prefs
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
# Powsybl-optimizer
A repository to store production-ready powerflow optimizers
A repository to store production-ready optimal powerflow optimizers

## Getting started

### AMPL
For this project, you must have [AMPL](https://ampl.com/) installed.
AMPL is a proprietary tool that works as an optimization modelling language. It can be interfaced with many solvers.

AMPL is sold by many companies including Artelys, you can find keys [here](https://www.artelys.com/solvers/ampl/).

You must add in your `~/.itools/config.yml` an ampl section like this:
```yaml
ampl:
# Change to the ampl folder path that contains the ampl executable
homeDir: /home/user/ampl
```
62 changes: 62 additions & 0 deletions open-reac/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# OpenReac
OpenReac is a reactive optimal power flow that gives a set of hypotheses for voltage and reactive controls by network equipments such as generators, shunt compensators and transformers. OpenReac can be used for network planning or in operation as well.

## Getting started
### Knitro
To run this model, in addition of AMPL you'll need Knitro. Knitro is a proprietary non-linear solver.

Artelys is the company developping Knitro. It is distributing keys [here](https://www.artelys.com/solvers/knitro/).

After the installation is done and that you got a valid licence, you must have `knitroampl` in your path.

To check, start a bash and run :
```bash
knitroampl stub
```
## Itools
This project also provides an utilty to run OpenReac with Itools.

1. Run OpenReac on the provided network.
2. Run LoadFlow on the result.
3. Run another OpenReac on the loadflow result.

You will have the running OpenReac folders next to your working directory.

### Syntax

```` bash
itools open-reac --case-file NETWORK [--open-reac-params PARAM_FILE]
````

You can customize OpenReac parameters directly with the option `--open-reac-params params.json`.
Here are the specific mappings.
``` json
{
"obj_min_gen" : null,
# list of shunt with variable Q
"variable-shunts-list" : ["var-shunt", "var-shunt-2"],
# list of generators with constant Q
"fixed-generators-list" : ["constant-q-gen"],
# list of transformers with variable ratio
"variable-transformers-list" : ["2-winding-transfo"],
# list of voltage limit override (delta from nominal voltage)
"voltage-level-override" : [
{
"id": "voltageLevelId",
"lower": "-5",
"upper": "5"
}
]
# All other key or key value mapping will be passed as algorithm parameters
}
```
Here is a quick description for each objective and how to put them in the json.
```
# =============== Objectives ================
# Minimum power generation (default)
"obj_min_gen" : null
# Target low_voltage_limit + (high_voltage_limit - low_voltage_limit) * RATIO for each equipement
"obj_target_ratio": RATIO
# Use the target voltage provided in the network file
"obj_provided_target_v" : null
```
141 changes: 141 additions & 0 deletions open-reac/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2023, 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/.
-->
<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">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-optimizer</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>

<packaging>jar</packaging>
<artifactId>powsybl-open-reac</artifactId>
<name>OpenReac</name>
<description>OpenReac optimizer</description>

<properties>
<powsybl-core.version>5.2.1</powsybl-core.version>
</properties>

<developers>
<developer>
<name>Nicolas PIERRE</name>
<email>nicolas.pierre@artelys.com</email>
<organization>Artelys</organization>
<organizationUrl>https://www.artelys.com</organizationUrl>
</developer>
<developer>
<name>Geoffroy JAMGOTCHIAN</name>
<email>geoffroy.jamgotchian@rte-france.com</email>
<organization>RTE</organization>
<organizationUrl>https://www.rte-france.com</organizationUrl>
</developer>
<developer>
<name>Anne TILLOY</name>
<email>anne.tilloy@rte-france.com</email>
<organization>RTE</organization>
<organizationUrl>https://www.rte-france.com</organizationUrl>
</developer>
</developers>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>com.powsybl.openreac</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-core</artifactId>
<version>${powsybl-core.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>

<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-ampl-converter</artifactId>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-ampl-executor</artifactId>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-iidm-extensions</artifactId>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-loadflow-api</artifactId>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-tools</artifactId>
</dependency>

<dependency>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.jimfs</groupId>
<artifactId>jimfs</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-config-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-iidm-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-ieee-cdf-converter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
41 changes: 41 additions & 0 deletions open-reac/src/main/java/com/powsybl/openreac/OpenReacConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Copyright (c) 2023, 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 com.powsybl.openreac;

import com.powsybl.commons.config.PlatformConfig;

import java.util.Objects;

/**
*
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com>
*/
public class OpenReacConfig {

private static final boolean DEFAULT_DEBUG = false;

private final boolean debug;

public OpenReacConfig(boolean debug) {
this.debug = debug;
}

public static OpenReacConfig load() {
return load(PlatformConfig.defaultConfig());
}

public static OpenReacConfig load(PlatformConfig platformConfig) {
Objects.requireNonNull(platformConfig);
return platformConfig.getOptionalModuleConfig("open-reac")
.map(config -> new OpenReacConfig(config.getBooleanProperty("debug", DEFAULT_DEBUG)))
.orElse(new OpenReacConfig(false));
}

public boolean isDebug() {
return debug;
}
}
Loading

0 comments on commit 7178b42

Please sign in to comment.