Closed metab0t closed 7 months ago
When I add more monitors to observe the same variable, I notice that the last monitor is always inconsistent.
Monitor: pv_currents1, shape: (24, 18), samplecount: 24
Monitor: pv_currents2, shape: (24, 18), samplecount: 24
Monitor: pv_currents3, shape: (24, 18), samplecount: 24
Monitor: pv_currents4, shape: (24, 18), samplecount: 24
Monitor: pv_currents5, shape: (24, 18), samplecount: 24
Monitor: pv_currents6, shape: (24, 18), samplecount: 24
Monitor: pv_currents7, shape: (24, 18), samplecount: 24
Monitor: pv_currents8, shape: (24, 18), samplecount: 24
Monitor: pv_currents1, shape: (60, 18), samplecount: 60
Monitor: pv_currents2, shape: (60, 18), samplecount: 60
Monitor: pv_currents3, shape: (60, 18), samplecount: 60
Monitor: pv_currents4, shape: (60, 18), samplecount: 60
Monitor: pv_currents5, shape: (60, 18), samplecount: 60
Monitor: pv_currents6, shape: (60, 18), samplecount: 60
Monitor: pv_currents7, shape: (60, 18), samplecount: 60
Monitor: pv_currents8, shape: (60, 18), samplecount: 60
Monitor: pv_currents1, shape: (36, 18), samplecount: 36
Monitor: pv_currents2, shape: (36, 18), samplecount: 36
Monitor: pv_currents3, shape: (36, 18), samplecount: 36
Monitor: pv_currents4, shape: (36, 18), samplecount: 36
Monitor: pv_currents5, shape: (36, 18), samplecount: 36
Monitor: pv_currents6, shape: (36, 18), samplecount: 36
Monitor: pv_currents7, shape: (36, 18), samplecount: 36
Monitor: pv_currents8, shape: (60, 18), samplecount: 60
It seems to be something related to the Disable
function, it's actually disabling the monitor, not the InvControl
.
Investigating now; the behavior is consistent with the official OpenDSS, so it's not a bug we introduced here.
You can check right after the dssc.Disable("InvControl.VoltWatt")
:
dssc.Disable("InvControl.VoltWatt")
elem = dssc.ActiveDSSElement
print(elem.Name, elem.Properties['enabled'].Val)
Sidenote: I see you already edited the post, but InvControl
needs at least one Storage or PVSystem element, otherwise it will crash the official OpenDSS. On DSS-Extensions, it will just not do anything useful.
Oh, and the sample count doesn't change when the monitor is disabled since it doesn't get any new sample and it is not cleared. You could force clear the monitors with a command reset monitors
and the monitor should stay empty if disabled.
I got it. The Disable
function actually disables the last monitor instead of InvControl
.
So should it be considered a bug?
How should the user disable the InvControl
?
The solution is to activate the element firstly 😢
dssc.SetActiveElement("InvControl.VoltWatt")
dssc.Disable("InvControl.VoltWatt")
Found the issue. Funnily enough, I had accidentally fixed it in my current private some weeks ago.
For some context, there are two variables Name
in the scope, and the Pascal compiler uses the wrong one (which is the circuit name). This (typically) results in the active element not being changed, thus disabling the latest active element, the monitor in your example.
We can fix that and prepare a new release soon, plus add some tests. Since this is not in the Python code, it will take a bit longer.
The solution is to activate the element firstly 😢
Yeah, that kinda defeats the purpose of the function. In Python, it may be preferable to use dssengine.Text.Command = 'InvControl.VoltWatt.enabled=n'
for the time being (one function call instead of two).
From the code history, the Enable
and Disable
functions never worked properly in the official COM implementation. I can report that in the forum.
Thank you for the timely reply and plan to fix!
dssengine.Text.Command = 'InvControl.VoltWatt.enabled=n'
for the time being (one function call instead of two).
Or maybe dssengine.Text.Command = 'disable InvControl.VoltWatt
is more clear.
Thank you for the timely reply and plan to fix!
And thank you for reporting this, @metab0t
EDIT: Reported to the official forum at https://sourceforge.net/p/electricdss/discussion/experts/thread/6c00144a5d/
Sorry, forgot to close this. The fix is out since the 0.15.0 beta. We should announce 0.15.1 later today (already on PyPI).
I test the following code on a simple test case and I found that the data from monitor is not updated if I disable a InvControl and solve again.
DSS file saved as
pvinverter.dss
Python file saved as
test.py
The output is:
It is very strange that the size of data from three monitors are inconsistent in the last solution.
@PMeira Is this behavior a bug?