ScratMan / HASmartThermostat

Smart Thermostat with PID controller for HomeAssistant
353 stars 50 forks source link

Assign a minimum output value #79

Closed crux2006 closed 3 months ago

crux2006 commented 2 years ago

Hello. Thank you very much for presenting a wonderful thermostat system to us. I give my thanks...

I think it would be useful if there was a feature to prevent operation under a certain output value in the thermostat settings... I give an example. If it is below 10% output value, deactivate the system.

I had a problem like this today. At the determined target temperature, the combi was turned on every time with an average output value of 8% or 10%. Since the min_cycle_duration was set to 00:01:30, it caused the combi boiler to run for 1.5 minutes continuously, so the house temperature, which was set at 22, rose to 22.2 and hovered over the target temperature all the time...

It would be very helpful if you could do some research on it.

ScratMan commented 1 year ago

Hi, which version are you using ? normally, since release 2021.12.5, if the output is below the minimum cycle duration, the pwm is stretched to maintain the correct on/off ratio. So the temperature may overshoot a bit the target but it should oscillate around it, not remaining over the setpoint for very long time. Or maybe your Ki or Ke is a bit too high.

crux2006 commented 1 year ago

hvac_modes: heat, off min_temp: 7 max_temp: 28 target_temp_step: 0.1 preset_modes: none, away, eco, boost, comfort, home, sleep, activity current_temperature: 23.2 temperature: 23 hvac_action: idle preset_mode: none away_temp: 20 eco_temp: 22.8 boost_temp: 24.5 comfort_temp: 23.8 home_temp: 23.5 sleep_temp: 22 activity_temp: 21 control_output: 0 Kp: 120 Ki: 0 Kd: 15000 Ke: 1.5 time_to_on: 387 time_to_off: 15 pid_mode: auto pid_p: -24 pid_i: 0 pid_d: 0 pid_e: 12.6 pid_dt: 180.84581112861633 autotune_status: off autotune_sample_time: 0 autotune_tuning_rule: none autotune_set_point: 0 autotune_peak_count: 0 autotune_buffer_full: 0 autotune_buffer_length: 0 friendly_name: Smart Thermostat supported_features: 17

Yaml configuration:

Version 2022.2.1 .... I made a great effort to keep the temperature constant in the house. I could not use Auto mode for some reason. However, with the setting I made, I can keep the temperature constant with 15 minutes pwm times with almost 0.1 bounce, but this causes the boiler to turn on and off constantly. For this reason, I set the pwm time to 30 min. For now, this is better, but there are a few problems... First of all, even at values like 1% or 5% of the output value I mentioned, it causes the boiler to turn on continuously. These turn ons cause short short turn ons with min_cycle_duration. Neither the honeycombs warm up, nor does it contribute to the temperature of the house. I only have to listen to the noise of the boiler turning on and off for 5 minutes.

I also have trouble adjusting the Ki value. If I give the Ki value less, it slowly swells, even when it reaches the desired temperature, it causes high output levels even if the temperature is at the desired level because it slowly decreases. I don't understand your logic, why doesn't the Ki level drop even when it reaches the desired temperature. It always gives high values. Even if the house temperature exceeds the desired temperature, the Ki value does not drop. Is this a bug? Or is it my incompetence? I admire your integration. You've been the solution to my heating needs for two seasons. Thank you very much.

ScratMan commented 1 year ago

Hi, the purpose the integral pid_i part, adjusted by the Ki gain, is to compensate the losses of the room. Consider you're heating a single room, the surrounding rooms will be colder than the heated one. The heat will slowly diffuse across the walls to the surrounding rooms ; these are thermal losses. It's constant and directly linked to the temperature difference between the heated room temperature and the surrounding rooms temperature. Bigger difference leads to more losses. The integral is there to compensate these losses : it creates a "continuous" heating to compensate the continuous losses and maintain the temperature at the correct level.

Looking at the pid_x values, it looks like the Kp and external temperature compensation gain Ke is high, 1.5 is a big gain while Ki is 0. I would rather decrease KP to 80, Ke to 0.6 and use Ki near 0.01. Set Kd to 0 for the moment not to disturb the integral stabilization. Ki and Ke acts in similar way, adding constant heating to compensate constant losses ; except that the Ki depends on the time to have a slow reaction time to compensate intrinsic losses of the building while Ke reacts immediately to outdoor temperature changes to anticipate future internal temperature drops.

Please note that if your boiler uses water temperature adjustment system based on the outdoor temperature, it replaces the external temperature compensation, so Ke of the thermostat should be 0.

crux2006 commented 1 year ago

I am following what you said, I will try it for a day or two... Is it a natural result that the integral is inflated even when it reaches the desired temperature level? I was surprised by this. I thought that it would only inflate as long as there was an error, and it would drop when it reached the desired level. My request: to heat up as soon as possible during heating, to keep it at a constant temperature when it reaches the desired point, to keep it constant without deviating 0.1 degrees... I have almost achieved this...Thanks to your system...Thank you...What will be my gain if I apply what you have written? Please show me a way for the system not to work under 10%...I can change the codes...Just tell me.

crux2006 commented 1 year ago

By the way, there is no outside temperature sensor in my boiler....The boiler is old system, on-off procedure