Capacitor charging energy storage calculation