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

Error when importing cgm with substation in EQ_BD #2878

Open
phiedw opened this issue Jan 29, 2024 · 1 comment · May be fixed by #2968
Open

Error when importing cgm with substation in EQ_BD #2878

phiedw opened this issue Jan 29, 2024 · 1 comment · May be fixed by #2968
Labels

Comments

@phiedw
Copy link
Contributor

phiedw commented Jan 29, 2024

Describe the current behavior

When importing a cgm that contains a substation in the EQ_BD file, there is an error saying the substation is present in both networks when the merge is attempted:

com.powsybl.commons.PowsyblException: The following object(s) of type SubstationImpl exist(s) in both networks: [xxx]

Describe the expected behavior

The merge should happen with no exception, and the resulting network should contain the substation.

Describe the steps

This is the code that is run for the exception to occur. The filename points to a zipped cgm, that contains an EQ_BD file that has a substation in it.
CGM.zip

Network.read(Paths.get(new File(CsaProfileCracCreatorTest.class.getResource(filename).getFile()).toString()), LocalComputationManager.getDefault(), Suppliers.memoize(ImportConfig::load).get(), new Properties());

Environment

powsybl 6.2.0-RC1

Relevant Log Output

com.powsybl.commons.PowsyblException: The following object(s) of type SubstationImpl exist(s) in both networks: [b1859991-5a57-4f24-8763-7f83046d0984]

at com.powsybl.iidm.network.impl.NetworkImpl.checkMergeability(NetworkImpl.java:1022)
at com.powsybl.iidm.network.impl.NetworkImpl.merge(NetworkImpl.java:978)
at com.powsybl.iidm.network.impl.NetworkImpl.merge(NetworkImpl.java:146)
at com.powsybl.iidm.network.impl.NetworkFactoryImpl.merge(NetworkFactoryImpl.java:28)
at com.powsybl.iidm.network.impl.NetworkFactoryImpl.merge(NetworkFactoryImpl.java:36)
at com.powsybl.iidm.network.Network.merge(Network.java:517)
at com.powsybl.cgmes.conversion.CgmesImport.importData(CgmesImport.java:155)
at com.powsybl.iidm.network.Network.read(Network.java:127)
at com.powsybl.iidm.network.Network.read(Network.java:134)
at com.powsybl.iidm.network.Network.read(Network.java:148)
at com.powsybl.iidm.network.Network.read(Network.java:162)

Extra Information

No response

@phiedw phiedw added the bug label Jan 29, 2024
@zamarrenolm zamarrenolm linked a pull request Apr 5, 2024 that will close this issue
7 tasks
@zamarrenolm
Copy link
Member

For this test case the substation in the boundary is empty and is not referred by any of the IGMs, so it could be safely removed from the boundary.

An alternative workaround would be to import the instance files as a single, assembled model, instead of importing it as a separate set of IGMs that are then merged (the default behaviour when importing). This comes at a cost: you end up with all the equipment inside a single network, instead of having a Network that has 2 Subnetworks. To read the CGM.zip using this parameter you can use:

Properties importParams = new Properties();
importParams.put(CgmesImport.IMPORT_CGM_WITH_SUBNETWORKS, "false");
Network network = Network.read(new GenericReadOnlyDataSource(Path.of("CGM.zip")), importParams);

Another alternative would be to modify the Network::merge method to ignore duplicates when other network is merged, instead of not allowing it and throwing an exception, but that is a really big change in the merge feature. I will propose it in a separate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants