示例#1
0
    def in_state(self, dt):
        # TODO: Does manual control work like this? Or is it perhaps a separate state?
        if self._context.pump_manual_mode:
            self._context.pump_speed = self._context.manual_target_speed
        else:
            # TODO: Figure out real correlation
            self._context.pump_speed = 30 * (self._context.temperature_rate / 50.0)

        # Handle "cooling too fast" error
        if self._context.pump_speed > 30:
            self._context.pump_speed = 30
            self._context.pump_overspeed = True
        else:
            self._context.pump_speed = int(self._context.pump_speed)
            self._context.pump_overspeed = False

        # Approach target temperature at set temperature rate
        # TODO: Should be based on pump speed somehow
        self._context.temperature = approaches.linear(self._context.temperature, self._context.temperature_limit,
                                                      self._context.temperature_rate / 60.0, dt)
示例#2
0
 def in_state(self, dt):
     self._context.position = approaches.linear(self._context.position, self._context.target,
                                                self._context.speed, dt)
 def in_state(self, dt):
     self._context.phase = approaches.linear(self._context.phase,
                                             self._context.target_phase,
                                             self._phase_locking_speed, dt)
 def in_state(self, dt):
     self._context.speed = approaches.linear(self._context.speed,
                                             self._context.target_speed,
                                             self._acceleration, dt)
 def in_state(self, dt):
     self._context.parking_position = approaches.linear(
         self._context.parking_position,
         self._context.target_parking_position, self._parking_speed, dt)
示例#6
0
 def in_state(self, dt):
     # Approach target temperature at set temperature rate
     self._context.temperature = approaches.linear(self._context.temperature, self._context.temperature_limit,
                                                   self._context.temperature_rate / 60.0, dt)