Switch-mode controller based on maximum power point tracking