Are you familiar with scripting If not I can fool around later, but the idea is to grab the state of the AC Adapter and then depending on the state you can run a command which will change the CPU throttle.
Determing the state of the AC Adapter:
Code:
cat /proc/acpi/ac_adapter/ACAD/state
state: on-line
As you can see the state is on-line meaning it's plugged in. You can create the script in two ways: Look for the adapter to be "on-line" or look for the adapter to be "off-line" (not I'm not 100% if it'll be "off-line" just an assumption). Once the script is made and tested you can run it on a schedule (using cron), say every 5 minutes or 10 minutes, and it'll proceed to check if the adapter is present and then throttle based on the state.