Closed jmcollin78 closed 1 year ago
Jean-Marc, I'd like to ask you to ensure that this feature does not prevet future versions of versatile_thermostat to use different variables for auto-regulation. The reason is that I don't think the ones that are available now are an optimal solution. When the new slope calculation is available (and slopes of different time frames can be calculated), the auto-regulation could be improved drastically, for example by allowing the overlay of short-term adaptations and also long-term offsets. I'd like to contribute to that, but if you create a specific structure required in configuration.yaml that will cause issues when the structure is changed in future versions, this would make it very complicated to add some optimisations.
I understand but many people needs to adapt their configuration. See the post of gunmalmg here https://github.com/jmcollin78/versatile_thermostat/issues/188 for example. I've got other people with very good regulation with those parameters:
kp: float = 0.4
ki: float = 0.08
k_ext: float = 0.0
offset_max: float = 5
stabilization_threshold: float = 0.1
accumulated_error_threshold: float = 50
What works fine is to set to 0 the k_ext and have a big accumulated_error_threshold. While error is not 0, the accumulated_error will grow up and regulation will finish by succeed.
So while I wait for an eventual modification of the algorithm, I have done this to allow people (and me as support) to test and adapt the parameter without having to republish something.
This is done now, documentated I will release soon. When I will have your algo, I will do an evolution to adapt this. It will be easy. No worry.
Thanks. How complicated is it for you to persist the accumulated error (or in other algos something similar like a EMA) on a reboot of HA? That would be great, as currently testing long term algos is very challenging.
Not so hard. I have this in mind. When temp = target, the error is reseted. So the normal state is when accumulated error = 0. So in a normal case (the temp will converge), persisting the error is accumulation is not useful. It is useful only in transitory mode.
You can see that because the accumualted_error
is published in the VTherm attributes so you can check its evolution.
I‘m currently not near a HA installation, but I think for being able to adjust to long term offsets it may not be resetted, as otherwise each time the preset changes and for a brief moment target temp and current temp are the same, anything that was built up in the past 6-17 hours is lost.
Here you can see what happens (using the „slow“ setting) to a long term offset of 1,0-1,5 degrees when HA restarts (at around 10:00).
When accumulation rests at target=current it has the same effect and completely counterproductive.
Please disable that setting for the slow mode and persist the accumulation, thanks.
ok it is clear. That mean, your accumulated error never goes to 0 but will stabilize to a value when error is 0. that is clear and I will remove that.
In 4.1.0 Release
Hello @maia ,
I've got an interesting case this morning here: https://github.com/jmcollin78/versatile_thermostat/discussions/191
Before 6:30 the VTherm have accumulated much error because target was 2° under the current temp. At 6:30, the target change to 18°, above the current temp. The user expect that the valve will open (slowly). But because of this accumulation of negative error, the regualted temps stays at 15,5°. I pretty sure it will finish by growing up.
This is the side effect of not reseting the accumulated_error
after a target temperature change that I remove in a previous release.
Do you agree with me that, this is mistake ? When changing the target temperature I should reset the accumulated_error because it is no more relevant. I think yes, but I want your opinion.
EDIT: this will be an issue with mobile average and that is why I'm curious of your algorithm. How to take the historical values but adapt to new conditions quickly.
@jmcollin78 Oh, that was the discussion about. I've seen it, but decided to unwatch the discussion as my french isn't good enough for comprehension.
Regarding the accumulated_error
, I understand the issue. And I'm not sure about the right answer that's suitable to all, but here is an attempt:
For now, the quick-fix might be to disable the reset of accumulated_error only for the slow
setting and keep it for the others?
Once you have the code ready for slope calculations I would draft a concept for something that mixes the 4 different time frame aspects mentioned in #200. Does github have a place for collaborative/wiki style edits? Then the 3-5 people who are interested enough might collaborate on a concept before coding it.
This is the strong setting. I will do a test with it with the reset to see if it solve the issue. And then you certainly right, some mode or algorithm needs to reset and some others no.
Once you have the code ready for slope calculation
For now I just don't start because of making many support.
Self-regulation algorithm have a fixed number of presets Light, Medium, Strong, Slow.
For many cases, we need to have a more flexible way to configure it. We need to specify our parameters.
I suggest being able to specify these parameters in the configuration.yaml file so that the configuration process will not be complexioned more than today.
The user choose "Expert" auto-regulation mode and then add a section into its configuration.yaml file.
Then those parameters are used by the self-regulation algorithm.
-- Note: this feature will enable some default configuration in the configuration.yaml file allowing for future use.