logic error in duty cycling

master^2
James Gao 2015-02-22 13:40:38 -08:00
rodzic 3328cad4b7
commit 23f2cbc9a4
1 zmienionych plików z 7 dodań i 5 usunięć

Wyświetl plik

@ -155,13 +155,15 @@ class Profile(threading.Thread):
setpoint = frac * (temp1 - temp0) + temp0 setpoint = frac * (temp1 - temp0) + temp0
self.pid.setPoint(setpoint) self.pid.setPoint(setpoint)
pid_out = -1
temp = self.therm.temperature.temp temp = self.therm.temperature.temp
if temp == -1: if temp == -1:
continue #skip invalid temperature readings continue #skip invalid temperature readings
elif temp - setpoint > 50: elif temp - setpoint > 20:
self.regulator.off() self.regulator.off()
self.duty_cycle = True self.duty_cycle = True
elif self.duty_cycle and temp - setpoint < -20: elif self.duty_cycle:
if temp - setpoint < -10:
self.regulator.ignite() self.regulator.ignite()
self.duty_cycle = False self.duty_cycle = False
else: else: