ScratMan / HASmartThermostat

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

Question about autotune and cycle error #18

Closed clipse2004 closed 2 years ago

clipse2004 commented 2 years ago

Hi, I just don't get any values displayed from Autotune. The following is always reported:

[custom_components.smart_thermostat.climate] Obtained current control output. 0.00 (error = 0.00, dt = 0.00, p=0.00, i=0.00, d=0.00) [custom_components.smart_thermostat.climate] Request turning off switch.thermostat_wohnzimmer_power (MainThread) [custom_components.smart_thermostat.climate] Reject request turning off switch.thermostat_wohnzimmer_power: Cycle is too short

i read that you should set min_cycle_duration to avoid this error, but this did not work for me either. My config looks like this:

  • platform: smart_thermostat name: Smart Thermostat - Wohnzimmer heater: switch.thermostat_wohnzimmer_power target_sensor: sensor.average_wohnzimmer min_temp: 8 max_temp: 28 ac_mode: false target_temp: 24 keep_alive: seconds: 60 away_temp: 22 comfort_temp: 25 boost_temp: 26 sleep_temp: 21.5 home_temp: 23 target_temp_step: 0.5 min_cycle_duration: 00:15:00 pwm: 00:15:00 autotune: "ziegler-nichols"

additionally I had tried it once with "sampling_period", unfortunately also nothing. I have installed the current beta 3. can you tell me where the error lies? the fritz thermostats have an interval of 15 minutes, so that should fit or not?

big thanks for your help!

ScratMan commented 2 years ago

Hello,

I suppose you misunderstood the usage of the min_cycle_duration parameter. This parameter is used to avoid switching on or off the heater for short periods. For example if the PWM is set to 10 minutes and the PID output is 1%, the heater will switch on for 6 seconds and then switch off. This can be an issue for heating systems with slow start time, like boilers for example that can take from several seconds to few minutes to heat. Setting the min_cycle_duration to 2 minutes will then allow switching the heater on, but it will keep it on for 2 minutes before switching it back off. It leads to more power than what the PID requested, but it will ensure the heater actually heats the room and prevent damaging the heating system.

In your configuration, as the PWM is set to 15 minutes, same as the minimum cycle, it won't heat at all. If your heater require a minimum cycle time (and 15 minutes seems to be very long), you should select a longer PWM duration.

Additionally, the autotune is not ready yet, I'm still trying to make it work, and I don't recommend using it for the moment.