Fix Generator vmin_pu/vmax_pu setters not persisting to C engine#106
Open
matheusduartedm wants to merge 1 commit intoPauloRadatz:masterfrom
Open
Fix Generator vmin_pu/vmax_pu setters not persisting to C engine#106matheusduartedm wants to merge 1 commit intoPauloRadatz:masterfrom
matheusduartedm wants to merge 1 commit intoPauloRadatz:masterfrom
Conversation
The GeneratorsF C API calls (indices 11 and 13) for writing Vmaxpu and Vminpu do not actually write to the active Generator object in the C library — they only echo the parameter back. This causes silent data corruption in power flow results. Replace the broken C API calls with text command workarounds that correctly persist values via `Generator.<name>.Vmaxpu=<value>` and `Generator.<name>.Vminpu=<value>`. Read operations (indices 10/12) remain unchanged as they work correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
|
Hi @matheusduartedm, thank you so much for reporting this issue. I replicated it on my side. I will work on fixing it in the OpenDSS source code. Please let me know if you have seen this in other properties. Again, thank you so much. |
Owner
|
I just noticed that this type of issues is not related to generators and C++ version. It is in some elements and also in Delphi. I will need to work on the OpenDSS source codes (Delphi and C++). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dss.generators.vmin_puanddss.generators.vmax_puproperty setters callGeneratorsFwith C API indices 11/13, but the C library handler for those indices doesn't write to the active Generator object — it only echoes the parameter back. This causes silent data corruption in power flow results (OpenDSS uses defaults 0.90/1.10 instead of the intended values)._vmax_pu_writeand_vmin_pu_writewith text command workarounds (Generator.<name>.Vmaxpu=<value>/Vminpu=<value>), following the same pattern used elsewhere (e.g.,LoadShapesV.py,SettingsV.py).Reproduction
After this fix, the text command correctly returns
0.0.Root cause
The bug is in the OpenDSS C library (
libOpenDSSC.so), not in py-dss-interface's Python code. TheGeneratorsFfunction handler for parameter indices 11 and 13 reads the argument but doesn't assign it to the active Generator'sVmaxpu/Vminpufields. The equivalentDSSLoadsFhandler (indices 29/35) works correctly for loads.Test plan
vmin_pu=0.0,vmax_pu=2.0, confirmed via text command read-backtest_generators.py(note: test suite has pre-existing setup issues on Linux due to missing.soinlinux/cpp/directory — not related to this change)