GRIDAPPSD / GOSS-GridAPPS-D

14 stars 27 forks source link

cim-graph error when checking if PowerElectronicsConnections exist in IEEE123 model #1771

Closed Tylores closed 4 weeks ago

Tylores commented 3 months ago

Describe the bug DEBUG:main:<class 'cimgraph.data_profile.rc4_2021.gridappsd_cim_profile_rc4_2021.PowerElectronicsConnection'> DEBUG:main:Traceback (most recent call last): File "/home/tylor/dev/micro-apps/micro-apps/power_factor/power_factor.py", line 491, in app = PowerFactor(gapps, sim) File "/home/tylor/dev/micro-apps/micro-apps/power_factor/power_factor.py", line 289, in init self.mrids, self.electronics = get_power_electronics(self.mrids) File "/home/tylor/dev/micro-apps/micro-apps/power_factor/power_factor.py", line 219, in get_power_electronics if not network.graph[PowerElectronicsConnection]: KeyError: <class 'cimgraph.data_profile.rc4_2021.gridappsd_cim_profile_rc4_2021.PowerElectronicsConnection'>

To Reproduce

        cim_profile = 'rc4_2021'
        cim = importlib.import_module('cimgraph.data_profile.' + cim_profile)
        mrid = "_C1C3E687-6FFD-C753-582B-632A27E28507"

        feeder = cim.Feeder(mRID=mrid)
        params = ConnectionParameters(
            url="http://localhost:8889/bigdata/namespace/kb/sparql",
            cim_profile=cim_profile)

        bg = BlazegraphConnection(params)
        network = FeederModel(
            connection=bg,
            container=feeder,
            distributed=False)
        utils.get_all_data(network)

        electronics = {}
        if not network.graph[PowerElectronicsConnection]:

Additional context Other models appear to work fine or at least don't crash when there is no connection found.

craig8 commented 3 months ago

@AAndersn this is a top level api for the network.graph calls we can easily handle the case where there is non-defined and return None as a response. This would probably be the best course, but I thought I would give you a heads up if that's the way you wanted this to work.

@afisher1 @poorva1209 your input would be valuable as well.

poorva1209 commented 4 weeks ago

Not an issue anymore. It was an API usage error.