# Connecting a capacitor to a voltage supply in series without a resistor

When connecting a capacitor directly to a voltage supply (without a resistor), is it correct to expect a surge in current at the instant when the capacitor and the battery are connected, then current immediately drops to zero because the capacitor is fully charged up?

I tried to do a simulation with only a voltage supply and an ideal capacitor (no resistor) and run a transient simulation. I then plotted the current flowing into the capacitor against time. The plot showed that current was always at 0 A. No surge in current was observed.

So would a surge in current happen in a real experiment? If so, does it mean that the simulation fails to represent the real circuit behaviour.

Thanks.

• Most simulation programs before starting transient analysis perform DC analysis (at DC capacitor is an open circuit). And then based on this result starts the transient analysis . So you need to inform the simulation to skip the initial operating point calculation. What simulation program do you use?
– G36
Commented Dec 10, 2022 at 21:20
• I set the initial condition of the cap to 0 V. I used spectre. Commented Dec 10, 2022 at 21:26

You can't run a simulation like this with ideal components - the operating conditions before and after the switch is closed have to be "differentiable" before and after the switch transient occurs or else the simulation doesn't converge; you have a discontinuity using an ideal capacitor and ideal voltage source. Like others have said, you need to include impedance in series with the ideal components (which would model real life components and provide a meaningful transient analysis). Simply adding a series resistor (ESR) will get you a textbook first-order response. The current spike (surge) will be the applied voltage divided by the ESR. If you want to get fancy, you can also include a series inductor (ESL) with the resistor to simulate a second-order response. If you have a real capacitor that you are trying to simulate, you can obtain the ESR and ESL from the datasheet.

The surge will only happen if:

• you complete the loop on the "other" sides of battery and capacitor
• If your sim does not start at the stable operation point
• The battery and the capacitor already had two terminals connected. The circuit was a closed circuit. How can I check whether the operation point was stable and how can I ensure the operation point is stable? Commented Dec 10, 2022 at 21:28
• That depends on your software..I dont know spectre. Commented Dec 10, 2022 at 21:31
• It is typical for circuit analysis programs to start by finding a "steady state" solution, with the power supplies on. Then it does the "transient solution". So if you're simulating a plain old voltage source, you're basically simulating the supply having been on forever. You need to use a voltage source that's generating a pulse that switches at t = 0, or you need to set up the simulation to start up with all power supplies off. Commented Dec 10, 2022 at 22:55
• @Underdog in LTslice you can add "uic" to the tran statement to simulate without precalculated operation point. Commented Dec 10, 2022 at 23:41
• You can also use a voltage controlled switch driven by a delayed pulse to show the charging current. And you need to add realistic ESR to the power supply (battery) and the capacitor. Also expand the plot to see the detail of the fast transition. Commented Dec 11, 2022 at 0:15

then current immediately drops to zero because the capacitor is fully charged up?

Yes, if a capacitor is connected directly to a voltage source the voltage exponentially increases to match the voltage source. During this time the current drops to zero exponentially. The interesting thing is it still has an RC time constant in the real world because of resistance in the capacitor and in the wires, if there were no resistance the current would be infinite.

So what you might need to do to replicate the real world in the simulation is add some series resistance and said the initial conditions of the capacitor to zero, some solvers look at the initial conditions and say oh it's connected to a voltage source and pre-charge the capacitor (this is called DC operating point by the way).

If the simulator doesn't have a way to set the initial conditions you could run a Transit simulation with a pwm source and produce a step input and that would give you the correct results also

One problem though is in inrush current with real supplies for things like DC to DC converters too much capacitance can pull down the supply and prevent it from starting up with batteries this doesn't happen

• How about the current? Will there be a current surge immediately after the connection between the cap and the voltage supply is made? Consider that ESR is insignificant. Commented Dec 10, 2022 at 22:03
• Yes and then it decays exponentially. In the real world, Wires have resistance there's no material that does not have resistance. An ideal case things are super conducting so the cap charges instantaneously. Also with batteries they have series resistance so the capital charge slower than in a simulation, you should also find the series resistance of the battery and put it in the simulation if you want to have a realistic simulation Commented Dec 10, 2022 at 22:10
• But then this current surge was not observed in simulation. So would it be possible that the simulation fails to represent the real circuit behaviour? Commented Dec 10, 2022 at 22:20
• Yep that's what I've been trying to tell you, I gave you ideas for making it work Commented Dec 10, 2022 at 23:25