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

opendssdirect crashes with bad linecode #122

Closed
4 tasks
wenbowangnrel opened this issue Mar 9, 2023 · 2 comments
Closed
4 tasks

opendssdirect crashes with bad linecode #122

wenbowangnrel opened this issue Mar 9, 2023 · 2 comments
Labels
engine Engine-related (hosted by DSS C-API) issue

Comments

@wenbowangnrel
Copy link

wenbowangnrel commented Mar 9, 2023

Versions

  • Python version: 3.10
  • Python architecture: x86
  • Operating system and version: Centos 7
  • OpenDSSDirect.py version number: 0.7.0

Bug

  • What is the current behavior? I can compile and solve a circuit with a bad linecode in opendssdirect.py. However, when I exit out of python, the process crashes.
Error in `python': corrupted size vs. prev_size: 0x000055beae3e0f00
======= Backtrace: =========
  • What is the expected behavior? What is the motivation / use case for changing the behavior? report error with bad line code

  • What are the steps to reproduce this bug? Please provide a minimal working example of the bug if possible.

New Linecode.3P_OH_Code14 units=km nphases=3 Rmatrix=(1.41380960769992 0.05921682180272659 0.05921682180272659 0.05921682180272659 | 0.05921682180272659 1.41380960769992 0.05921682180272659 0.05921682180272659 | 0.05921682180272659 0.05921682180272659 0.9286412517222888 0.05921682180272659 | 0.05921682180272659 0.05921682180272659 0.05921682180272659 1.41380960769992 ) Xmatrix=(0.9898149352620426 0.48526905804901355 0.4936812762615934 0.48526905804901366 | 0.48526905804901355 0.9898149352620426 0.48526905804901355 0.44141980330426694 | 0.4936812762615934 0.48526905804901355 0.9547751759569331 0.48526905804901366 | 0.48526905804901366 0.44141980330426694 0.48526905804901366 0.9898149352620426 ) normamps=95.0 emergamps=0.0

What is wrong with this linecode is that the nphases=3 indicates there are 3 conductors, but the Rmatrix has a 4*4 size, which expects there are 4 conductors, so there is a mismatch between these two attributes of a linecode.

Support Question

@PMeira
Copy link
Member

PMeira commented Mar 10, 2023

Hi, thanks for reporting. This is an engine bug, like most reported here. I'm considering moving such issues to our hub repo (https://github.com/dss-extensions/dss-extensions) for visibility in the future.

I could reproduce with the upstream OpenDSS too, although the access violation exception there may happen down the line. This issue is probably inherited from very old code: there was already a check but that relied on Object Pascal exceptions, which probably worked fine on older Delphi versions and on 32-bit systems.

For the engine on DSS Extensions, per my local branch it now should error out with a message like:

(#65534) Matrix Buffer in ParseAsSymMatrix too small. Check your input data, especially dimensions and number of phases.

Note that this still allows providing less elements than required (the unfilled elements are left as 0). We plan to add warnings someday, per dss-extensions/dss-extensions#16

As soon as the new DSS C-API and DSS Python versions are out, a new version of OpenDSSDirect.py should be out with this fix, github.com//issues/121 and misc OpenDSS updates. We'll probably release another version soon after with #78 and other niceties.

@PMeira PMeira added the engine Engine-related (hosted by DSS C-API) issue label Mar 10, 2023
@PMeira
Copy link
Member

PMeira commented Mar 28, 2023

Done and new packages uploaded to PyPI. We'll prepare a release message on GitHub soon too, for the moment see the relevant changes at https://github.com/dss-extensions/dss_python/blob/master/docs/changelog.md#0130

Sorry for the delay, some other issues needed more time to investigate.

@PMeira PMeira closed this as completed Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine Engine-related (hosted by DSS C-API) issue
Projects
None yet
Development

No branches or pull requests

2 participants