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

AMPL export : extended exporter #2604

Merged
merged 91 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
9379bef
add constructor with list instead of varargs
Jun 2, 2023
dbf18e0
WIP add ampl export version
Jun 2, 2023
4143d1a
refactor all writing to BasicAmplExporter
Jun 2, 2023
84987ea
match setVersion to return this
Jun 2, 2023
54fa975
AmplExportVersion is now an interface
Jun 2, 2023
8be12fe
missing author and licence
Jun 2, 2023
595b20b
typo in writeThreeWindingsTranformersMiddleBusesColumnsToFormatter
Jun 5, 2023
57cd659
integrating #2596 into this PR
Jun 5, 2023
73884d9
fix function accepting only implementation and not interface
Jun 7, 2023
8c67231
Accept version in parameters of AmplExport service
Jun 7, 2023
fc3adf0
add header file indicating version
Jun 12, 2023
38eba0a
fix test because of new version parameter
Jun 12, 2023
639bbd5
Merge remote-tracking branch 'origin/main' into ampl/export-slack
Jun 13, 2023
a0160f3
fix BasicAmplExporter according to b7f9c3df
Jun 13, 2023
261c0e0
clean
Jun 13, 2023
0770a2c
add networkUtil
Jun 7, 2023
54dd6c1
add getters for inheritance
Jun 7, 2023
7e559a9
added ExtendedAmplExporter
Jun 7, 2023
353c1f1
added new columns :
Jun 7, 2023
bde0378
wip tests
Jun 7, 2023
6e5cb2d
export is in busView
Jun 7, 2023
334e7e0
WIP tap tests
Jun 9, 2023
3e11f7b
clean public for tests
Jun 13, 2023
39060bf
fix constants typo
Aug 7, 2023
4e1c694
fix MVar to MVAr
Aug 9, 2023
96d8e90
fix MVar to MVAr
Aug 9, 2023
b96f2a9
Merge branch 'main' into ampl/export-slack
annetill Aug 31, 2023
0f27df1
Merge branch 'main' into ampl/export-slack
olperr1 Nov 2, 2023
43dabbb
formatting
pjeanmarie Nov 6, 2023
51a9598
SPDX clause missing
pjeanmarie Nov 6, 2023
20bc489
escape email to avoid javadoc warnings
pjeanmarie Nov 6, 2023
54cdc68
Add missing Override
pjeanmarie Nov 6, 2023
4db1b94
Improve switch case
pjeanmarie Nov 6, 2023
fa3aa31
To be consistent
pjeanmarie Nov 6, 2023
9a08421
Distinct columns headers from suffix
Nov 7, 2023
759507d
If we want to use valueOf which exist on enum, than there is not usag…
Nov 7, 2023
2331afe
Fix comment
Nov 10, 2023
5454e50
Light refacto
Nov 10, 2023
8f60ac3
Actual version of Ampl is 1.0 so use that instead of V1_LEGACY
Nov 10, 2023
c8dd384
Merge branch 'main' into ampl/export-slack
Nov 10, 2023
6d32105
Use exporter id instead of AmplExportVersion enum name in properties …
Nov 14, 2023
3234db3
Merge branch 'ampl/export-slack' into ampl/extended-exporter
Nov 15, 2023
aa351b4
Merge branch 'main' into ampl/export-slack
annetill Nov 15, 2023
39c09d2
Remove duplicate version instantiation of columns exporter, now it is…
Nov 16, 2023
5259117
Update comments for javadoc
Nov 16, 2023
8a64e54
Give a more specific name to the first columns extension
Nov 16, 2023
cfeaa23
Add ampl exporter version in ampl executor via AmplModelExecutionHand…
Nov 21, 2023
1c16e45
Merge branch 'main' into ampl/export-slack
olperr1 Nov 23, 2023
db125de
Merge branch 'ampl/export-slack' into ampl/extended-exporter
olperr1 Nov 23, 2023
d605507
Revert "fix MVar to MVAr"
olperr1 Nov 24, 2023
26fb1ca
Revert "fix MVar to MVAr"
olperr1 Nov 24, 2023
2dcdbf3
Revert "fix constants typo"
olperr1 Nov 24, 2023
7f8baa3
Merge branch 'main' into ampl/extended-exporter
olperr1 Nov 24, 2023
7c82c0b
Merge branch 'main' into ampl/extended-exporter
annetill Dec 15, 2023
e7effd5
Merge branch 'main' into ampl/extended-exporter
annetill Jan 9, 2024
dadb963
Merge branch 'main' into ampl/extended-exporter
annetill Jan 11, 2024
74281b1
Merge remote-tracking branch 'refs/remotes/origin/main' into ampl/ext…
p-arvy Sep 2, 2024
ab37a56
Refactor TUs
p-arvy Sep 2, 2024
23141d9
Small refactor
p-arvy Sep 2, 2024
626d1a2
Refactor table columns in extended ampl exporter
p-arvy Sep 2, 2024
906cd02
Add slack bus export for 3wt, dangling lines and tie lines buses in e…
p-arvy Sep 2, 2024
a2fe2c3
Add TUs for slack bus values in new extended ampl export
p-arvy Sep 2, 2024
c9c95c8
Small clean
p-arvy Sep 2, 2024
2222f61
Fix G/B per unitage in new ampl extended export for tap changer tables
p-arvy Sep 2, 2024
3f694eb
Merge branch 'refs/heads/main' into ampl/extended-exporter
p-arvy Sep 2, 2024
5c5e901
Improve TUs on remote regulating terminal
p-arvy Sep 2, 2024
dfc89a4
Add comment
p-arvy Sep 2, 2024
87d575e
Remove block of comments
p-arvy Sep 2, 2024
f1dd78e
Add TU
p-arvy Sep 2, 2024
5619c2d
Fix unused import
p-arvy Sep 2, 2024
ba29e11
Put extended version of the exporter as default version
p-arvy Sep 2, 2024
825e55d
Merge branch 'main' into ampl/extended-exporter
So-Fras Sep 5, 2024
c6fc222
Update version of iidm extensions
p-arvy Sep 11, 2024
1e643c1
Remove properties override in TUs
p-arvy Sep 11, 2024
0327b6a
Merge branch 'refs/heads/main' into ampl/extended-exporter
p-arvy Sep 11, 2024
661e9c1
initialize TableFormatterHelper
rolnico Sep 13, 2024
6e12d01
finish TableFormatterHelper
rolnico Sep 16, 2024
aafe76a
use record to lower number of method parameters
rolnico Sep 16, 2024
59a30f2
Merge branch 'main' into ampl/extended-exporter
So-Fras Sep 18, 2024
445c6ab
Merge branch 'main' into ampl/extended-exporter
So-Fras Sep 18, 2024
015b9ca
Use index constants instead of their numeric values
olperr1 Sep 19, 2024
fd0d55b
Merge branch 'nro/ampl-extended-exporter-with-position' into ampl/ext…
So-Fras Sep 20, 2024
4537070
Merge branch 'main' into ampl/extended-exporter
So-Fras Sep 20, 2024
7d60ce7
Rename ExtendedAmplExporter
p-arvy Sep 20, 2024
6378899
Modify extended ampl exporter javadoc
p-arvy Sep 20, 2024
97d728c
Add documentation about Ampl exporters
So-Fras Sep 24, 2024
55d7769
Fix typos
So-Fras Sep 24, 2024
02a787c
Update docs/grid_exchange_formats/ampl/export.md
So-Fras Sep 24, 2024
f0f05fa
Update docs/grid_exchange_formats/ampl/export.md
So-Fras Sep 24, 2024
ae08e3d
Fix typo following review
So-Fras Sep 24, 2024
d914f0b
Merge branch 'main' into ampl/extended-exporter
olperr1 Sep 24, 2024
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
5 changes: 5 additions & 0 deletions ampl-converter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,10 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>powsybl-iidm-extensions</artifactId>
p-arvy marked this conversation as resolved.
Show resolved Hide resolved
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ private AmplConstants() {
public static final String MINP = "minP (MW)";
public static final String MAXP = "maxP (MW)";
public static final String V_REGUL = "v regul.";
public static final String V_REGUL_BUS = "v regul. bus";
public static final String ACTIVE_POWER = "P (MW)";
public static final String REACTIVE_POWER = "Q (MVar)";
public static final String MIN_Q_MAX_P = "minQmaxP (MVar)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ private void writeHeaders() throws IOException {
try (Writer writer = new OutputStreamWriter(
dataSource.newOutputStream("_headers", "txt", append), StandardCharsets.UTF_8)
) {
columnsExporter.writeHeaderFile(writer);
writer.write("version " + config.getVersion().getExporterId() + "\n");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* 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/.
* SPDX-License-Identifier: MPL-2.0
*/
package com.powsybl.ampl.converter.util;

import com.powsybl.iidm.network.Bus;
import com.powsybl.iidm.network.Terminal;
import com.powsybl.iidm.network.VoltageLevel;
import com.powsybl.iidm.network.extensions.SlackTerminal;

/**
* @author Nicolas PIERRE {@literal <nicolas.pierre at artelys.com>}
*/
public final class NetworkUtil {

public static boolean isSlackBus(Bus bus) {
VoltageLevel vl = bus.getVoltageLevel();
SlackTerminal slackTerminal = vl.getExtension(SlackTerminal.class);
if (slackTerminal != null) {
Terminal terminal = slackTerminal.getTerminal();
return terminal.getBusView().getBus() == bus;
}
return false;
}

private NetworkUtil() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,13 @@
import com.powsybl.iidm.network.*;

import java.io.IOException;
import java.io.Writer;
import java.util.List;

/**
* @author Nicolas Pierre {@literal <nicolas.pierre at artelys.com>}
*/
public interface AmplColumnsExporter {

String VERSION_HEADER_NAME = "version";

String getExporterId();

default void writeHeaderFile(Writer headerFileWriter) throws IOException {
headerFileWriter.write(VERSION_HEADER_NAME + " " + getExporterId() + "\n");
}

List<Column> getRtcColumns();

List<Column> getPtcColumns();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
*/
public enum AmplExportVersion {

V1_0("1.0", BasicAmplExporter.getFactory());
V1_0("1.0", BasicAmplExporter::new),
p-arvy marked this conversation as resolved.
Show resolved Hide resolved
V1_1("1.1", ExtendedAmplExporterV1::new);

public interface Factory {
AmplColumnsExporter create(AmplExportConfig config, Network network, StringToIntMapper<AmplSubset> mapper,
Expand Down Expand Up @@ -63,6 +64,6 @@ public static AmplExportVersion fromExporterId(String exporterId) {
}

public static AmplExportVersion defaultVersion() {
return V1_0;
return V1_1;
}
}
Loading