soloam / ha-pid-controller

PID Controller to Home Assistant
MIT License
97 stars 12 forks source link

odd reset behavior when trying to adjust P and I #38

Open apazureck opened 1 year ago

apazureck commented 1 year ago

Hi,

For some reason the controller jumps back to min value when running for some time:

grafik

My settings:

P = 2 I = 0.01 D = 0 minimum = 25 maximum = 60

My settings:

set_point: "{{state_attr('climate.wohnzimmer_master', 'temperature')}}"
entity_id: input_number.eta_stellgroesse_vorlauf
precision: 0.01
minimum: "{{states('input_number.eta_pid_regler_minimum')}}"
maximum: "{{states('input_number.eta_pid_regler_maximum')}}"
unit_of_measurement: °C
p: "{{states('input_number.eta_pid_regler_p')}}"
i: "{{states('input_number.eta_pid_regler_i')}}"
d: "{{states('input_number.eta_pid_regler_d')}}"

My scenario:

Control my overall central heating temperature. As the flow temperature is higher than the room temperature I need the I part the most. For some reason it integrates up to 10 and then it resets the whole sensor to the minimum value of 25. Thus the temperature never rises correctly.

What could cause this behavior?

I am using version 1.1.5 (the latest on hacs)

soloam commented 1 year ago

That one is new to me! I admit that I've been having little to no time to make changes to this, a new born baby is consuming all of my spare time lol 😂.

I've seen that behavior / bug, happening when we change the set point, that should be fixed! But it shouldn't do that out of nowhere! What is the time between the spikes, before it drops?

Tks

apazureck commented 1 year ago

Hi,

No problem. Congratulations, I hope everybody is well and healthy. Thanks for the quick response!

What I am doing is, that I am changing the entity_id every minute by adding a random value of ${+/-} x*10^{-4}$ to trigger the pid controller. My temperature sensor triggers quite rarely, so the controller does not raise the flow temperature for quite some time. To check out the parameters this is not feasable, because unitl I got the parameters right, the winter will be over. But as you can see in my chart below the value sticks quite to the sensor value, so no jumps on the feedback value side.

The set point changes when my night temperature sets in, but that is not the case here. It is constant 20 °C. I cannot plot it in the chart, because it is a sensor attribute of my climate thermostat (The generic HA Thermostat).

The drops are in my opinion quite random.

I realized, that my precision is nonsense. I changed that to 1.

grafik

Maybe I'll check out your repo tonight and see if I can slap around some tests trying to reproduce the issue.

And also a nice touch would also be, if there was a possibility to set a start value for the output, because if you have an extremely slow system like my central heating system and you depend on the warmth then it is quite annoying if you want to change something and the output drops back from 35 °C flow temperature to 25 °C. When it is about 0 °C outside, this makes quite a drop in the room temperature.