Mercurial > templog
comparison 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 |
comparison
equal
deleted
inserted
replaced
271:11cebd6f0bfb | 272:af924d27140f |
---|---|
90 | 90 |
91 D("fridge on %s" % self.is_on()) | 91 D("fridge on %s" % self.is_on()) |
92 | 92 |
93 if self.is_on(): | 93 if self.is_on(): |
94 turn_off = False | 94 turn_off = False |
95 on_time = self.server.now() - self.fridge_on_clock | 95 on_percent = self.integrator.integrate() / params.overshoot_delay |
96 | 96 |
97 overshoot = params.overshoot_factor * self.integrator.integrate() | 97 overshoot = params.overshoot_factor * on_percent |
98 D("on_time %(on_time)f, overshoot %(overshoot)f" % locals()) | 98 D("on_time %(on_percent)f, overshoot %(overshoot)f" % locals()) |
99 | 99 |
100 if not params.nowort and wort is not None: | 100 if not params.nowort and wort is not None: |
101 if wort - overshoot < params.fridge_setpoint: | 101 if wort - overshoot < params.fridge_setpoint: |
102 max_div = self.OVERSHOOT_MAX_DIV | 102 max_div = self.OVERSHOOT_MAX_DIV |
103 overshoot_factor = params.overshoot_factor | 103 overshoot_factor = params.overshoot_factor |