Control of compensation capacitor