Perhaps your device has certain power management features when you go on battery such as increasing the amount of time the device is idle. You can run the following command from the terminal to see if power management is enabled or not:
Look for a line that says something similar to this:
You can try this command to disable power management on the device:
This will only work once probably until the device state changes (you plug back in/out or reboot). If this works for the fix to be permanent you may have to set up a script of some kind for when your battery is active. (Which is easy but I do not remember how offhand). Also note your device may be wlan1 or etc if you have more than one wireless card.
sudo iwconfig wlan0 power off
Information about the iwconfig command and it's power management function:
power Used to manipulate power management scheme parameters and mode.
To set the period between wake ups, enter period `value'. To
set the timeout before going back to sleep, enter timeout
`value'. To set the generic level of power saving, enter saving
`value'. You can also add the min and max modifiers. By
default, those values are in seconds, append the suffix m or u
to specify values in milliseconds or microseconds. Sometimes,
those values are without units (number of beacon periods, dwell,
percentage or similar).
off and on disable and reenable power management. Finally, you
may set the power management mode to all (receive all packets),
unicast (receive unicast packets only, discard multicast and
broadcast) and multicast (receive multicast and broadcast only,
discard unicast packets).
iwconfig eth0 power period 2
iwconfig eth0 power 500m unicast
iwconfig eth0 power timeout 300u all
iwconfig eth0 power saving 3
iwconfig eth0 power off
iwconfig eth0 power min period 2 power max period 4