diff py/fridge.py @ 272:af924d27140f

scale integrate by delay time namedtuple for StepIntegrator
author Matt Johnston <matt@ucc.asn.au>
date Wed, 11 Nov 2015 21:58:38 +0800
parents 11cebd6f0bfb
children 6848907f85be
line wrap: on
line diff
--- a/py/fridge.py	Wed Nov 11 00:20:20 2015 +0800
+++ b/py/fridge.py	Wed Nov 11 21:58:38 2015 +0800
@@ -92,10 +92,10 @@
 
         if self.is_on():
             turn_off = False
-            on_time = self.server.now() - self.fridge_on_clock
+            on_percent = self.integrator.integrate() / params.overshoot_delay
 
-            overshoot = params.overshoot_factor * self.integrator.integrate()
-            D("on_time %(on_time)f, overshoot %(overshoot)f" % locals())
+            overshoot = params.overshoot_factor * on_percent
+            D("on_time %(on_percent)f, overshoot %(overshoot)f" % locals())
 
             if not params.nowort and wort is not None:
                 if wort - overshoot < params.fridge_setpoint: