I’m using the PID Climate component together with the Dallas component for temperature measures and the Slow PWM component for controlling the output to a Triac via a zero crossing optocoupler. It works kind of fine but the derivative part is causing a high noice in the output.
To slow down the temperature variations I have done the following:
- Used the moving average filter on the Dallas sensor.
The sample rate is once every second and the moving average is 120 seconds and I release new values to the PID every 5 second.
I have set the decimal points to 5 but I don’t think this will affect the PID. - In the PID I’m averaging the output every 1 sample and the derivative every 5 sample
- The PWM window is set to 1 second and I’m in the 50Hz mains network so I would get a 0.5% output accuracy
But I still see to many variations on the output. What would be the best approach? Shall I for a start move the PID averaging on the derivative up streams to the sensor, i.e. increasing the moving window 5 times to 5*120=600 seconds. I tried that but it resulted in the PID acted as an on-off switch
The thinking was that from an auto tuning perspective it would be the best to have the same latency in auto tuning as in operation.
I’m also thinking about adding forced mode to the sensor, would that be better for the PID controller?
The problem with a noisy output signal is that (except for being ugly) it’s very hard to get 100% effect when needed
What experiences do you have?
P.S. In this setup I’m using the PID to control the temperature of a floor with a heating cable in concrete so it would be quite a slow system
This is how it looks like with 5 seconds intervals:
And over time the heating looks like this:
Dallas sensor:
dallas:
- pin: GPIO3
update_interval: 1s
sensor:
# Dallas temperature sensor
- platform: dallas
address: 0xbd3c01d075eac628
name: "temperature_sensor"
id: temperature_sensor
accuracy_decimals: 5
filters:
- sliding_window_moving_average:
window_size: 120
send_every: 5
PWD:
output:
- platform: slow_pwm
pin: GPIO1
id: my_slow_pwm
period: 1s
inverted: True
restart_cycle_on_state_change: False
PID:
climate:
- platform: pid
id: pid_climate
name: "PID Climate Controller"
sensor: temperature_sensor
default_target_temperature: 19°C
heat_output: my_slow_pwm
visual:
temperature_step:
current_temperature: 0.01
target_temperature: 0.1
control_parameters:
kp: 0.87308
ki: 0.00026
kd: 737.09644
derivative_averaging_samples: 1
output_averaging_samples: 5