Wifi Problems when Notebook not connected to power source
First thing is to reset the SMC. Shutdown your Mac, the press &amp; hold ShiftCtrlOptionPower for 10 seconds, then boot normally. 

When you see a behavior change due to changes in power supply (plugging in a MacBook for example), chances are it's an SMC issue.

You can get more info by reviewing Resetting Your SMC