kopia lustrzana https://github.com/jamesgao/kiln_controller
logic error in duty cycling
rodzic
3328cad4b7
commit
23f2cbc9a4
|
@ -155,15 +155,17 @@ 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:
|
||||||
self.regulator.ignite()
|
if temp - setpoint < -10:
|
||||||
self.duty_cycle = False
|
self.regulator.ignite()
|
||||||
|
self.duty_cycle = False
|
||||||
else:
|
else:
|
||||||
pid_out = self.pid.update(temp)
|
pid_out = self.pid.update(temp)
|
||||||
if pid_out < 0: pid_out = 0
|
if pid_out < 0: pid_out = 0
|
||||||
|
|
Ładowanie…
Reference in New Issue