Peak and frequency regulation of lithium batteries