Closed MageDelfador closed 1 year ago
I don't know what I was thinking when I typed this, but thank God you spotted it!
I've been offline for personal reasons, but I'll take a look at this (test it) and merge it quickly.
Thanks for the PR
Actually I've been reading about this subject, and from what I can see, It can be true both ways, Some PID's work with the measurement, other with the error. But the "normal" is to do what you are doing, the kd use the delta error.
I'll test this out and if it's ok I'll merge it.
Tks
delta_error = error - last_error = (self._set_point - feedback_value) - (self._set_point - self._last_input) = self._last_input - feedback_value = -delta_input This is actually a question of positive and negative numbers.
If the value of the temperature sensor rises suddenly, the derivative term should reduce the power of the heater, that is, the derivative term should be a negative number at this time.
self._d_term = self._kd * delta_input / delta_time
self._kd
and delta_ time
is positive, so delta_ input
should be a negative number. But obviously, feedback_ value - self._ last_ Input
is a positive number.
Tks
use delta_error instead of delta_input