added a ac speed controll function