Switching under energy constraints