Exemplo n.º 1
0
 def check_temperature(self):
     temperature = ThermalSensor.get_current_temperature()
     logger.info("[Cooling] Temperature: %.2f" % temperature)
     if temperature < 2:
         logger.info("[Cooling] Temperature is lower than 20 degrees")
         self.serial_comunication.turn_off_chiller()
         logger.info("[Cooling] Turning off water on chiller")
         self.process.state = fermentation.STATES.get('chill_must')
         self.process.save()
         logger.info("[Cooling] Cooling stage completed! "
                     "New state: chill_must")
Exemplo n.º 2
0
 def warm_must(self):
     temperature = ThermalSensor.get_current_temperature()
     logger.info("[Boiling] Temperature: %.2f" % temperature)
     if temperature < self.process.recipe.boiling_temperature:
         logger.info("[Boiling] Temperature less than actual " "heat temperature")
         self.serial_comunication.turn_on_resistor()
     else:
         logger.info("[Boiling] Temperature reached!")
         self.process.state = STATES.get("add_hops")
         self.process.boiling_stop_time = timezone.now() + timedelta(minutes=self.process.recipe.boiling_duration)
         logger.info("[Boining] State changed! New state: add_hops")
     self.process.save()
Exemplo n.º 3
0
 def maintain_temperature(self):
     temperature = ThermalSensor.get_current_temperature()
     if self.freezer_temperature - 2 <= temperature \
             <= self.freezer_temperature + 2:
         logger.info("[Fermentation] Temperature on range")
         self.process.state = STATES.get('process_end')
         logger.info("[Fermentation] State changed! "
                     "New state: process_end")
     else:
         logger.info("[Fermentation] Temperature not on range")
         self.process.state = STATES.get('chill_must')
         pass
     self.process.save()
Exemplo n.º 4
0
 def chill_must(self):
     self.serial_comunication.turn_on_freezer(self.freezer_temperature)
     logger.info('[Fermentation] Cooling must on the freezer')
     temperature = ThermalSensor.get_current_temperature()
     if temperature > self.freezer_temperature:
         logger.info("[Fermentation] Fermentation temperature not reached")
         self.process.state = STATES.get('chill_must')
         # Decrease temperature
         pass
     else:
         logger.info("[Fermentation] Temperature reached!")
         self.process.state = STATES.get('maintain_temperature')
         logger.info("[Fermentation] State changed! "
                     "New state: maintain_temperature")
     self.process.save()
Exemplo n.º 5
0
    def heating(self):
        self.serial_comunication.turn_on_resistor(
            self.process.recipe.boiling_temperature)
        logger.info("[Brewery] Function defined: heating")
        temperature = ThermalSensor.get_current_temperature()

        logger.info("[Brewery] Temperature: %.2f" % temperature)
        if temperature < self.process.actual_heat.temperature:
            logger.info("[Brewery] Temperature less than actual "
                        "heat temperature")
            self.serial_comunication.turn_on_resistor(
                self.process.actual_heat.temperature)
        else:
            logger.info("[Brewery] Temperature greater than "
                        "actual_heat temperature")
            self.process.actual_heat_time = timezone.now()
            self.process.state = STATES.get('heat_controll')
            logger.info("[Brewery] State changed! New state: heat_controll")
        self.process.save()
Exemplo n.º 6
0
    def initial_boiling(self):
        boiling_temperature = self.process.recipe.initial_boiling_temperature
        self.serial_comunication.turn_on_resistor(boiling_temperature)
        temperature = ThermalSensor.get_current_temperature()
        logger.info("[Brewery] Temperature: %.2f" % temperature)

        if temperature < boiling_temperature:
            logger.info("[Brewery] Actual temperature is lower "
                        "than %.2f" % boiling_temperature)
            self.serial_comunication.turn_on_resistor(boiling_temperature)
            pass
        else:
            logger.info("[Brewery] Actual temperature is greater "
                        "than %.2f" % boiling_temperature)
            self.serial_comunication.turn_off_resistor(1)
            self.process.state = STATES.get('insert_malt')
            self.serial_comunication.activate_alarm()
            logger.info("[Brewery] State changed! New state: insert_malt")
        self.process.save()