-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add methods for CGMES validation (#1042)
Add methods for CGMES validation. CGMES conversion context extension. Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
- Loading branch information
Showing
9 changed files
with
193 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...onversion/src/main/java/com/powsybl/cgmes/conversion/CgmesConversionContextExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copyright (c) 2019, 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.conversion; | ||
|
||
import com.powsybl.commons.extensions.AbstractExtension; | ||
import com.powsybl.iidm.network.Network; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* @author Miora Ralambotiana <miora.ralambotiana at rte-france.com> | ||
*/ | ||
public class CgmesConversionContextExtension extends AbstractExtension<Network> { | ||
|
||
private final Context context; | ||
|
||
public CgmesConversionContextExtension(Context context) { | ||
this.context = Objects.requireNonNull(context); | ||
} | ||
|
||
public Context getContext() { | ||
return context; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "CgmesConversionContext"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...rsion/src/test/java/com/powsybl/cgmes/conversion/CgmesConversionContextExtensionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Copyright (c) 2019, 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.conversion; | ||
|
||
import com.powsybl.cgmes.conformity.test.CgmesConformity1Catalog; | ||
import com.powsybl.iidm.network.Network; | ||
import org.junit.Test; | ||
|
||
import java.util.Properties; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
/** | ||
* @author Miora Ralambotiana <miora.ralambotiana at rte-france.com> | ||
*/ | ||
public class CgmesConversionContextExtensionTest { | ||
|
||
@Test | ||
public void test() { | ||
Properties properties = new Properties(); | ||
properties.put(CgmesImport.STORE_CGMES_CONVERSION_CONTEXT_AS_NETWORK_EXTENSION, "true"); | ||
Network network = new CgmesImport().importData(CgmesConformity1Catalog.microGridBaseCaseBE().dataSource(), properties); | ||
CgmesConversionContextExtension extension = network.getExtension(CgmesConversionContextExtension.class); | ||
assertNotNull(extension); | ||
assertTrue(extension.getContext().config().storeCgmesConversionContextAsNetworkExtension()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.