def _findgear(self, velocity, throttle, gear):
        """ Finds the nearest gear in the appropriate range for the
        currently commanded vehicle state (throttle, velocity).
        
        This is intended to be called recursively.
        """

        self.run_iteration()
        
        objectives = self.get_objectives()
        overspeed = objectives['overspeed'].evaluate(self.parent)
        underspeed = objectives['underspeed'].evaluate(self.parent)
        
        if overspeed:
            gear += 1
            
            if gear in 4:
                self.raise_exception("Transmission gearing cannot " \
                "achieve acceleration and speed required by EPA " \
                "test.", RuntimeError)
            
        elif underspeed:
            gear -= 1
            
            # Note, no check needed for low gearing -- we allow underspeed 
            # while in first gear.
                
        else:
            return gear
            
        self.set_parameter_by_name('gear', gear)
        gear = self._findgear(velocity, throttle, gear)        

        return gear
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/contrib/enginedesign/openmdao.examples.enginedesign/openmdao/examples/enginedesign/driving_sim.py/SimEconomy._findgear/operator `>` -> `in`