Skip to content

Commit 4c6672e

Browse files
committed
Remove decaying the derivative (again)
1 parent 602ab8f commit 4c6672e

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

custom_components/sat/pid.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@
1717
_LOGGER = logging.getLogger(__name__)
1818
timestamp = _timestamp # keep public name for tests
1919

20-
DERIVATIVE_DECAY = 0.8
2120
DERIVATIVE_ALPHA1 = 0.8
2221
DERIVATIVE_ALPHA2 = 0.6
2322
DERIVATIVE_RAW_CAP = 5.0
24-
INTEGRAL_MAX_INTERVAL = 900.0
25-
DERIVATIVE_MAX_INTERVAL = 180.0
2623

2724
STORAGE_VERSION = 1
2825
STORAGE_KEY_INTEGRAL = "integral"
@@ -209,11 +206,7 @@ def _update_integral(self, state: TemperatureState) -> None:
209206
if self.ki is None:
210207
return
211208

212-
# Cap the integration interval so long gaps don't over-accumulate.
213-
delta_time = min(delta_time, INTEGRAL_MAX_INTERVAL)
214209
self._integral += self.ki * state.error * delta_time
215-
216-
# Clamp integral to the heating curve bounds.
217210
self._integral = clamp_to_range(self._integral, self._heating_curve.value)
218211

219212
# Record the timestamp used for this integration step.
@@ -247,12 +240,6 @@ def _update_derivative(self, state: TemperatureState) -> None:
247240
self._last_derivative_updated = state.last_changed.timestamp()
248241
return
249242

250-
if delta_time > DERIVATIVE_MAX_INTERVAL:
251-
self._raw_derivative *= DERIVATIVE_DECAY
252-
self._last_temperature = state.current
253-
self._last_derivative_updated = state.last_changed.timestamp()
254-
return
255-
256243
derivative = -temperature_delta / delta_time
257244

258245
# Apply the first low-pass filter.

0 commit comments

Comments
 (0)