Closed HermesHonshappo closed 1 year ago
With better screenshots, showing both the heating cycles and the PID outputs:
Yesterday, with 2023.2.1 and my regular PID gains (so a high Kp, resulting in a very negative PID_p during night) PID_i does not decrease during the night
This night, with 2022.1.1 and the PID gains that were in the climate.yaml (so a much lower Kp, and a higher Ki). PID_i does decrease during the night
It seems PID_i is only updated when control_output is > 0%. Last night, each time PID_i decreased was when control-output went slightly above zero (probably because of a temp sensor update, and PID_d slightly overpowering the negative value of PID_p)
This means that it's not related to a specific version, but to the value of control_output. If control_output=0, then PID_i doesn't decrease. But if control_output = 0.1%, then PID_i decreases
The 2 days summarized in the graph below:
I'm not sure if this is normal or not...
That's normal behaviour, see here: https://github.com/ScratMan/HASmartThermostat/issues/130#issuecomment-1436010137
Mmmk, I read the wikipedia about integral windup. It sounds a bit strange to me, as it seems to create the behavior that this measure is trying to avoid.
What I am observing is that when I have Kp high enough for a quick system response, then the control_output is zero during the night. Slowly over a few days, PID_i increases more than it decreases. This happens for a few days, until the system overshoots seriously one day when it starts the day with a PID_i that is already at 50% at the beginning of the heat cycle.
This is what happened on march 2nd, when the cycle started with a PID_i still at 47% from the day before. PID_i rose to 60% while the temp was still below target, and then it overshot badly, until temp was high enough for PID_p to negate PID_i. What's bad imho is that when PID_p was low enough to stop the heating completely, PID_i stopped decreasing. So it stayed stuck at 52.7% (flat period around noon in the graph)
But I admit I know zilch about PID controllers, so why not, I guess. Not having this measure might result in even worse integral windups. It could be worse.
Would you have any suggestion on how to mitigate this behavior? From the top of my head, here's what I could think about:
You could increase ke so that the ke * (target_temp - outdoor_temp) is half of the expected integral value. Then clear the integral and wait for the system to be stabilized.
Describe the bug I have a target temperature that changes twice a day. It does to sleep temp at 6PM, and then back to day temp at 3AM During the dat shift, PID_II increases and decreases as it should. However, at night, when the target temp suddenly drops, PID_I doesn't decrease anymore. Which means that the next heat cycle starts with a very high value of PID_I
Tested both in latest version, and I did a rollback in 2022.2.1 yesterday This night the sqystem ran with version 2022.2.1, and this behavior didn't show up
In 2023.2.1 (yesterday)
This is the graph with the target temp (purple line).
If I superpose the PID_I graph, you can see that PID_I doesn't move at all (flat line) during the low target temp period. When the target temp goes back up, then PID-I starts to increase again, but starting on the value it had hours ago.
So yesterday evening I did a downgrade to 2022.2.1, and here are the same graphs for last night:
As you can see PID_I dropped back during the night. Not down to zero, but it did decrease steadily during the whole period
One thing important: when I restarted in 2022.2.1 last evening, it restarted with the old gain values (that were in climate.yaml). So that may or may not have affected the results. I have now put the correct values and am keeping 2022.2.1 for one more cycle, to see if the cause is the version, or it it was the values used I am not sure if this is linked to the version, or if this is a behavior that shows up when the PID output is zero because of highly negative PID-P values
Important EDIT: this does not seem linked to the version, but to the value of "control_output". See update in post below
To Reproduce Steps to reproduce the behavior: Set a scheduler to have 12 hours at a high temp, then 12 hours at a low temp Monitor PID_I values
Expected behavior A clear and concise description of what you expected to happen.
Desktop (please complete the following information):
Additional context
Keep in mind that I have multiple smart_thermostats. I remember it was a key element in previous issue identified and solved (#121)
Here is the smart_thermostat config