NREL / ditto

DiTTo is a Distribution Transformation Tool that aims at providing an open source framework to convert various distribution systems modeling formats.
https://nrel.github.io/ditto/
BSD 3-Clause "New" or "Revised" License
67 stars 35 forks source link

Ditto conversion from CYME to DSS seems to break when there are multiple sources #427

Open JennyAppiah opened 8 months ago

JennyAppiah commented 8 months ago

It seems that when using ditto to convert from CYME to DSS, we hit the following error when there are multiple sources:

Traceback (most recent call last): File "C:\Users\userXX\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\userXX\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\userXX\OneDrive\Projects\Atlas 2023\Atlas\venv\Scripts\ditto-cli.exe__main.py", line 7, in File "C:\Users\userXX\OneDrive\Projects\Atlas 2023\Atlas\venv\lib\site-packages\click\core.py", line 1157, in call return self.main(*args, kwargs) File "C:\Users\userXX\OneDrive\Projects\Atlas 2023\Atlas\venv\lib\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) File "C:\Users\userXX\OneDrive\Projects\Atlas 2023\Atlas\venv\lib\site-packages\click\core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "C:\Users\userXX\OneDrive\Projects\Atlas 2023\Atlas\venv\lib\site-packages\click\core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "C:\Users\userXX\OneDrive\Projects\Atlas 2023\Atlas\venv\lib\site-packages\click\core.py", line 783, in invoke return callback(*args, *kwargs) File "C:\Users\userXX\OneDrive\Projects\Atlas 2023\Atlas\venv\lib\site-packages\click\decorators.py", line 33, in new_func return f(get_current_context(), args, **kwargs) File "C:\Users\userXX\OneDrive\Projects\Atlas 2023\Atlas\venv\lib\site-packages\ditto\cli.py", line 173, in convert Converter( File "C:\Users\userXX\OneDrive\Projects\Atlas 2023\Atlas\venv\lib\site-packages\ditto\converter.py", line 246, in convert self.reader.parse(self.m) File "C:\Users\userXX\OneDrive\Projects\Atlas 2023\Atlas\venv\lib\site-packages\ditto\readers\cyme\read.py", line 920, in parse modifier = system_structure_modifier(model) File "C:\Users\userXX\OneDrive\Projects\Atlas 2023\Atlas\venv\lib\site-packages\ditto\modify\system_structure.py", line 68, in init raise ValueError("Mupltiple sourcebus found: {srcs}".format(srcs=srcs)) ValueError: Mupltiple sourcebus found: ['A_src' 'B_src' 'C_src' 'D_src'] (venv) PS C:\Users\userXX\OneDrive\Projects\Atlas 2023\Atlas>

tarekelgindy commented 8 months ago

So this issue that is a result of the CYME reader attempting to identify the voltages of individual components after parsing is complete. This is performed by doing a graph traversal to identify components with voltages assigned to them (typically transformers) and updating component voltages upstream and downstream of those devices. This process assumes that a single source exists.

If setting of component voltages is not a priority, a workaround would be avoid doing this step by commenting out or removing https://github.com/NREL/ditto/blob/master/ditto/readers/cyme/read.py#L920 to https://github.com/NREL/ditto/blob/master/ditto/readers/cyme/read.py#L922.

However a more long terms solution should include either accounting for the possibility of multiple sources in the graph traversal or removing the requirement to set voltages in CYME reader. My preference is the first one, and will require a bit of time for development. But suggestions are welcome!