comparison py/fridge.py @ 469:de4abcbe8f46

make fridge air range a parameter
author Matt Johnston <matt@ucc.asn.au>
date Thu, 25 Apr 2013 21:03:53 +0800
parents fa79666fb375
children a0ea542256ba
comparison
equal deleted inserted replaced
467:fa79666fb375 469:de4abcbe8f46
4 import gevent 4 import gevent
5 5
6 class Fridge(gevent.Greenlet): 6 class Fridge(gevent.Greenlet):
7 7
8 OVERSHOOT_MAX_DIV = 1800.0 # 30 mins 8 OVERSHOOT_MAX_DIV = 1800.0 # 30 mins
9 FRIDGE_AIR_MIN_RANGE = 3 # ÂșC
10 FRIDGE_AIR_MAX_RANGE = 3
11 9
12 def __init__(self, server): 10 def __init__(self, server):
13 gevent.Greenlet.__init__(self) 11 gevent.Greenlet.__init__(self)
14 self.server = server 12 self.server = server
15 self.setup_gpio() 13 self.setup_gpio()
60 """ this is the main fridge control logic """ 58 """ this is the main fridge control logic """
61 wort, fridge = self.server.current_temps() 59 wort, fridge = self.server.current_temps()
62 60
63 params = self.server.params 61 params = self.server.params
64 62
65 fridge_min = params.fridge_setpoint - self.FRIDGE_AIR_MIN_RANGE 63 fridge_min = params.fridge_setpoint - params.fridge_range_lower
66 fridge_max = params.fridge_setpoint + self.FRIDGE_AIR_MAX_RANGE 64 fridge_max = params.fridge_setpoint + params.fridge_range_upper
67 65
68 wort_min = params.fridge_setpoint 66 wort_min = params.fridge_setpoint
69 wort_max = params.fridge_setpoint + params.fridge_difference 67 wort_max = params.fridge_setpoint + params.fridge_difference
70 68
71 off_time = self.server.now() - self.fridge_off_clock 69 off_time = self.server.now() - self.fridge_off_clock