Open petergoldthorpe opened 4 years ago
Thanks for the detailed issue.
I think in your code where you use model.name
, you are instead doing store.name
, and that what is giving this error. Can you try print(store.elements)
? That should return a list of "models".
Sure, I've tried printing the commands from my code. The output is as follows:
>>>print(model)
<ditto.store.Store(elements=0, models=5) object at 0x14b3337dbb0>
>>>print(model.elements)
[]
>>>print(model.models)
(<ditto.models.power_source.PowerSource object at 0x0000014B3337D5B0>, ... ) #tuple of length 5
>>>for idx, mod in enumerate(model.models):
>>> try:
>>> print(idx, mod.name)
>>> except AttributeError as e:
>>> print(idx, 'No name:', e)
0 Vsource.source
1 No name: 'Position' object has no attribute 'name'
2 sourcebus_src
3 sourcebus
4 No name: 'Position' object has no attribute 'name'
These print statements are executed before the NetworkAnalyzer is initialized. The KeyError is thrown as described earlier.
I should also mention that I am using Python 3.8.3 and the latest version of DiTTo.
I'm also running into the same key error issue when trying to call build_networkx() for the ephasor conversion test.
same issue when trying to use build_networkx()
Hi, I'm a colleague of @frederikgeth. We're trying to use DiTTo for a project that uses the metrics command with an opendss file, and we are running into the following error. We've narrowed down the problem to an issue with instantiating the
NetworkAnalyzer
model, and have been table to replicate for a test case that comes packaged with DiTTo. The test case is located at./tests/readers/opendss/Powersource/test_powersource.dss
I have been using PyCharm to debug. My code is as follows:
Which throws the following error
The same error is thrown when using the
model.set_names()
method. We have used the traceback to find the error in the./ditto/network/network.py
file.Here the code throws a
KeyError
. Theedge_equipment
is a dictionary of tuples, and the code fails when it attempts to call a tuple which contains'Vsource.source'
as the first element. No such element exists in theedge_equipment
dictionary.In the
./tests/readers/opendss/Powersource/test_powersource.py
there is a function which reads in an OpenDSS file and asserts thatThis assertion passes with no error on my machine, but I still encounter the
KeyError
when using my own code as when I printmodel.name
I encounter:Any advice would be welcome. Kind regards, Peter