Capacitor measurement and substitution