AC method to measure the capacitance of capacitor