Skip to content

Commit

Permalink
Add CGMES post-processor to import short-circuit data (#2368)
Browse files Browse the repository at this point in the history
Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>
  • Loading branch information
miovd committed Nov 15, 2022
1 parent 0a9d7b8 commit 8171d4c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 14 deletions.
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

0 comments on commit 8171d4c

Please sign in to comment.