|
|
@ -21,16 +21,16 @@ class TiciFanController(BaseFanController): |
|
|
|
self.controller = PIDController(k_p=0, k_i=4e-3, k_f=1, rate=(1 / DT_HW)) |
|
|
|
self.controller = PIDController(k_p=0, k_i=4e-3, k_f=1, rate=(1 / DT_HW)) |
|
|
|
|
|
|
|
|
|
|
|
def update(self, cur_temp: float, ignition: bool) -> int: |
|
|
|
def update(self, cur_temp: float, ignition: bool) -> int: |
|
|
|
self.controller.neg_limit = -(100 if ignition else 30) |
|
|
|
self.controller.pos_limit = 100 if ignition else 30 |
|
|
|
self.controller.pos_limit = -(30 if ignition else 0) |
|
|
|
self.controller.neg_limit = 30 if ignition else 0 |
|
|
|
|
|
|
|
|
|
|
|
if ignition != self.last_ignition: |
|
|
|
if ignition != self.last_ignition: |
|
|
|
self.controller.reset() |
|
|
|
self.controller.reset() |
|
|
|
|
|
|
|
|
|
|
|
error = 75 - cur_temp |
|
|
|
error = cur_temp - 75 |
|
|
|
fan_pwr_out = -int(self.controller.update( |
|
|
|
fan_pwr_out = int(self.controller.update( |
|
|
|
error=error, |
|
|
|
error=error, |
|
|
|
feedforward=np.interp(cur_temp, [60.0, 100.0], [0, -100]) |
|
|
|
feedforward=np.interp(cur_temp, [60.0, 100.0], [0, 100]) |
|
|
|
)) |
|
|
|
)) |
|
|
|
|
|
|
|
|
|
|
|
self.last_ignition = ignition |
|
|
|
self.last_ignition = ignition |
|
|
|