Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

39 rindas
2.1KB

  1. from modules import cbpi
  2. from modules.core.controller import KettleController, FermenterController
  3. from modules.core.props import Property
  4. @cbpi.fermentation_controller
  5. class Hysteresis(FermenterController):
  6. heater_offset_min = Property.Number("Heater Offset ON", True, 0, description="Offset as decimal number when the heater is switched on. Should be greater then 'Heater Offset OFF'. For example a value of 2 switches on the heater if the current temperature is 2 degrees below the target temperature")
  7. heater_offset_max = Property.Number("Heater Offset OFF", True, 0, description="Offset as decimal number when the heater is switched off. Should be smaller then 'Heater Offset ON'. For example a value of 1 switches off the heater if the current temperature is 1 degree below the target temperature")
  8. cooler_offset_min = Property.Number("Cooler Offset ON", True, 0, description="Offset as decimal number when the cooler is switched on. Should be greater then 'Cooler Offset OFF'. For example a value of 2 switches on the cooler if the current temperature is 2 degrees above the target temperature")
  9. cooler_offset_max = Property.Number("Cooler Offset OFF", True, 0, description="Offset as decimal number when the cooler is switched off. Should be less then 'Cooler Offset ON'. For example a value of 1 switches off the cooler if the current temperature is 1 degree above the target temperature")
  10. def stop(self):
  11. super(FermenterController, self).stop()
  12. self.heater_off()
  13. self.cooler_off()
  14. def run(self):
  15. while self.is_running():
  16. target_temp = self.get_target_temp()
  17. temp = self.get_temp()
  18. if temp + float(self.heater_offset_min) <= target_temp:
  19. self.heater_on(100)
  20. if temp + float(self.heater_offset_max) >= target_temp:
  21. self.heater_off()
  22. if temp >= target_temp + float(self.cooler_offset_min):
  23. self.cooler_on(100)
  24. if temp <= target_temp + float(self.cooler_offset_max):
  25. self.cooler_off()
  26. self.sleep(1)