Problem simulating simple single phase bridge rectifier

I have very limited experience using KiCad and have never used it for simulations. As a first project I was trying to simulate a boost converter but ran into the “timestep too small” error.
So I decided to start even simpler with just a bridge rectifier with generic spice components.
But I still get the “timstep too small” error if I add a filter capacitor on the DC side. I have had some luck by playing with the component values or inserting a substantial current limiting resistor for the capacitor, but successful simulation still seems more the exception than the rule.
I’d be grateful to get some direction on schematic design for the simulator.

I’ using KiCad 7.0:


KiCad schematic
.model __D1 D
.model __D2 D
.model __D4 D
.model __D3 D
.save all
.probe alli
.tran 100n 40m
D1 Net-D1-A Net-D1-K __D1
D2 Net-D2-A Net-D1-K __D2
D4 GND Net-D2-A __D4
D3 GND Net-D1-A __D3
L1 Net-D1-A Net-L1-Pad2 100n
R2 Net-D1-K GND 53
C1 Net-C1-Pad1 GND 470u
R3 Net-D1-K Net-C1-Pad1 400
V1 Net-R1-Pad2 Net-D2-A AC 1 SIN( 0 325 50 0 0 1 )
R1 Net-L1-Pad2 Net-R1-Pad2 100m

Here somebody solved this same error. You may get some clues too: Mosfet simulation ends with error [SOLVED] - #8 by holger

Thank you for the quick response. The answer you refer to suggests to use a slower rise-time on a VPulse that is used to drive a gate. I’m using a VSin, which does not have a specified rise time, as far as I understand, because its a sinewave.

I have never used KiCad for simulation and last time I used PSPICE can be 10 years or more ago.
I think 100n can be some problem for Spice.
You have 50Hz so you want to see 20ms or more.
Then when diode starts to conduct you can assume 470u as having constant voltage for the moment. Diode just starts to conduct. Its serial (differential) R is still several ohms (assume 10 or more) so you have time constant in a range (L/R) of 10ns. To analyse what is going on Spice has to sample it several times during one time constant. So may be it starts to work with 100ps timestep. During 20ms you have 200 000 000 times 100ps. May be for Spice such timestep seems too small compared with expected end of simulation.

Thank you for your insight. Interestingly the simulation runs fine with 100us step time though. Increasing the inductance on the other hand gets me back to the small timestep error.
And shouldn’t ngspice reduce its time step automatically if it encounters such a problem? As I understand it thats the source of error: reducing the time step further and further until itgets too small.
According to the log we end up at 1.25e-19s, so well beyond the ps range.

When we simulate for high voltages (e.g. 300 V instead of 3.3 V), it may be useful to relax the precision requirements somewhat by selecting suitable options: add
.option reltol=0.01 abstol=10u chgtol=1e-11
to the Eeschema canvas, to become part of the netlist.
You also might choose the simulation command
.tran 10u 1
to get the full picture. Indeed ngspice chooses its own time steps, 10u is sort of minimum requirement only.

In addition: you are using the intrinsic (ngspice default) diode model parameters (by not giving any external model). These probably are not meant to be power diodes, but small signal diodes (which would explode under real conditions in your circuit). So better select a power diode model (search for a 500 V, 10 A diode spice model in the web).

1 Like

What holger said.
Consider that the ngspice sources are ideal, so with the 0.1 ohm resistor you’re limiting the current to 3250 A. Not really nice. The 100 nH inductor won’t help here.
Also be careful with diodes, the node sequence is almost always opposite. It’s not a big issue for this circuit (it’s symmetrical), but keep it in mind for the future.
A tip: always tick the “Show pin numbers” box for all parts when doing simulations. It saves a lot of time when selecting nodes in ngspice later, and also in genral debugging.

I have not used NG Spice but there is one potential simulation bug associated with a sinewave (less sure about a square wave) driving a bridge rectifier. This is mainly a bug when you do not have a significant inductor between the bridge and the filter capacitor, so current flow through the bridge is discontinuous.

That bug is as follows: What is the instantaneous voltage across each of the diodes when the instantaneous voltage is low and the diodes are not conducting? This is not likely to be a problem in a real bridge rectifier, but the simulator might run itself crazy trying to solve this question about which you probably do not care much.

To fix this potential issue it might help to put a resistor (or maybe a series RC if you prefer) in parallel with one of the diodes so that the simulator always has a basis for calculating common mode voltage between V1 and C1 when the diodes are not conducting.

Maybe this is not a problem, but it might be worth a try.

This part alone did not get my simulation to work, as you probably expected.

You were correct, once I found a suitable power diode model the simulationran fine. thank you very much!

That is ideed what happened, once I started using models of real diodes, thank you.

I already tried to bypass a diode with a resistor. It got the simulation to work with some values, but not reliably. It also seemed to require a quite low resistance.
But as Holger suggested, switching to a model of a power diode seems to be the solution here.