have new heating progress bar always display, not just when heating. earlier code simplification was not clearly tested. caused lots of problems. fixing.

pull/60/merge
jbruce 2022-05-12 21:40:03 -04:00
rodzic bbea1aaf04
commit 3d0ced062c
2 zmienionych plików z 18 dodań i 19 usunięć

Wyświetl plik

@ -480,31 +480,33 @@ class PID():
window_size = 100
error = float(setpoint - ispoint)
icomp = (error * timeDelta * (1/self.ki))
self.iterm += (error * timeDelta * (1/self.ki))
dErr = (error - self.lastErr) / timeDelta
output = self.kp * error + self.iterm + self.kd * dErr
out4logs = output
output = sorted([-1 * window_size, output, window_size])[1]
self.lastErr = error
self.lastNow = now
# not actively cooling, so
if output < 0:
output = 0
output = float(output / window_size)
# this removes the need for config.stop_integral_windup
# it turns the controller into a binary on/off switch
# any time it's outside the window defined by
# config.pid_control_window
icomp = 0
output = 0
out4logs = 0
dErr = 0
if error < (-1 * config.pid_control_window):
log.info("kiln outside pid control window, max cooling")
output = 0
if error > (1 * config.pid_control_window):
elif error > (1 * config.pid_control_window):
log.info("kiln outside pid control window, max heating")
output = 1
else:
icomp = (error * timeDelta * (1/self.ki))
self.iterm += (error * timeDelta * (1/self.ki))
dErr = (error - self.lastErr) / timeDelta
output = self.kp * error + self.iterm + self.kd * dErr
output = sorted([-1 * window_size, output, window_size])[1]
out4logs = output
output = float(output / window_size)
self.lastErr = error
self.lastNow = now
self.pidstats = {
'time': time.mktime(now.timetuple()),

Wyświetl plik

@ -559,10 +559,7 @@ $(document).ready(function()
}
$('#act_temp').html(parseInt(x.temperature));
if (x.heat > 0.0) {
$('#heat').html('<div class="bar" style="height:'+x.pidstats.out*70+'%;"></div>')
}
$('#heat').html('<div class="bar" style="height:'+x.pidstats.out*70+'%;"></div>')
if (x.cool > 0.5) { $('#cool').addClass("ds-led-cool-active"); } else { $('#cool').removeClass("ds-led-cool-active"); }
if (x.air > 0.5) { $('#air').addClass("ds-led-air-active"); } else { $('#air').removeClass("ds-led-air-active"); }
if (x.temperature > hazardTemp()) { $('#hazard').addClass("ds-led-hazard-active"); } else { $('#hazard').removeClass("ds-led-hazard-active"); }