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

Add CGMES post-processor to import short-circuit data #2368

Merged
merged 3 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright (c) 2022, 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.cgmes.shorcircuit;

import com.google.auto.service.AutoService;
import com.powsybl.cgmes.conversion.CgmesImportPostProcessor;
import com.powsybl.iidm.network.Network;
import com.powsybl.triplestore.api.TripleStore;

/**
* @author Miora Vedelago <miora.ralambotiana at rte-france.com>
*/
@AutoService(CgmesImportPostProcessor.class)
public class CgmesShortCircuitPostProcessor implements CgmesImportPostProcessor {

@Override
public String getName() {
return "shortcircuit";
}

@Override
public void process(Network network, TripleStore tripleStore) {
new CgmesShortCircuitImporter(new CgmesShortCircuitModel(tripleStore), network).importShortcircuitData();
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.powsybl.cgmes.shortcircuit; /**
/**
* Copyright (c) 2021, 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.cgmes.shortcircuit;

import com.powsybl.cgmes.conformity.Cgmes3Catalog;
import com.powsybl.cgmes.conformity.CgmesConformity1Catalog;
Expand All @@ -24,6 +25,7 @@
import org.junit.Assert;
import org.junit.Test;

import java.util.List;
import java.util.Properties;

/**
Expand All @@ -34,16 +36,10 @@ public class CgmesImporterTest {

@Test
public void testImportCgmesGeneratorShortCircuitData() {
Properties p = new Properties();
p.put(CgmesImport.POST_PROCESSORS, List.of("shortcircuit"));
Network network = new CgmesImport().importData(CgmesConformity1Catalog.miniBusBranch().dataSource(),
NetworkFactory.findDefault(), new Properties());

CgmesModelExtension cgmesModelExtension = network.getExtension(CgmesModelExtension.class);
Assert.assertNotNull(cgmesModelExtension);
CgmesModel cgmesModel = cgmesModelExtension.getCgmesModel();
Assert.assertNotNull(cgmesModel);

CgmesShortCircuitModel cgmesScModel = new CgmesShortCircuitModel(cgmesModel.tripleStore());
new CgmesShortCircuitImporter(cgmesScModel, network).importShortcircuitData();
NetworkFactory.findDefault(), p);

Generator generator = network.getGenerator("392ea173-4f8e-48fa-b2a3-5c3721e93196");
Assert.assertNotNull(generator);
Expand All @@ -60,7 +56,7 @@ public void testImportCgmesGeneratorShortCircuitData() {
@Test
public void testImportCgmes3GeneratorShortCircuitData() {
Network network = new CgmesImport().importData(Cgmes3Catalog.miniGrid().dataSource(),
NetworkFactory.findDefault(), new Properties());
NetworkFactory.findDefault(), new Properties());

CgmesModelExtension cgmesModelExtension = network.getExtension(CgmesModelExtension.class);
Assert.assertNotNull(cgmesModelExtension);
Expand All @@ -85,7 +81,7 @@ public void testImportCgmes3GeneratorShortCircuitData() {
@Test
public void testImportCgmesBranchModelBusbarSectionShortCircuitData() {
Network network = new CgmesImport().importData(CgmesConformity1ModifiedCatalog.smallGridBusBranchWithBusbarSectionsAndIpMax().dataSource(),
NetworkFactory.findDefault(), new Properties());
NetworkFactory.findDefault(), new Properties());

CgmesModelExtension cgmesModelExtension = network.getExtension(CgmesModelExtension.class);
Assert.assertNotNull(cgmesModelExtension);
Expand All @@ -108,7 +104,7 @@ public void testImportCgmesBranchModelBusbarSectionShortCircuitData() {
@Test
public void testImportCgmesBusbarSectionShortCircuitData() {
Network network = new CgmesImport().importData(CgmesConformity1Catalog.miniNodeBreaker().dataSource(),
NetworkFactory.findDefault(), new Properties());
NetworkFactory.findDefault(), new Properties());

CgmesModelExtension cgmesModelExtension = network.getExtension(CgmesModelExtension.class);
Assert.assertNotNull(cgmesModelExtension);
Expand All @@ -128,7 +124,7 @@ public void testImportCgmesBusbarSectionShortCircuitData() {
@Test
public void testImportCgmes3BusbarSectionShortCircuitData() {
Network network = new CgmesImport().importData(Cgmes3Catalog.microGrid().dataSource(),
NetworkFactory.findDefault(), new Properties());
NetworkFactory.findDefault(), new Properties());

CgmesModelExtension cgmesModelExtension = network.getExtension(CgmesModelExtension.class);
Assert.assertNotNull(cgmesModelExtension);
Expand Down