I’m trying to simulate the output of a full bridge rectifier with output filter but the simulator keeps failing with timestep too small, which I understand is a false error but rather indicates a problem with the model. I have only used standard KiCAD components and the model seems pretty straight-forward. Have I reached the limit of what NGSpice can model ?
If you have chosen the diode from library Simulation_SPICE: its model is too simple. Capacitances are missing, and this may create problems for transient simulations. Either use a realistic model (e.g. 1N4007) or edit the basic model:
Double click onto diode symbol–>Simulation Model …–>Parameter Table–> Capacitance–> Junction Capacitance cjo Value 10p
Do this for all 4 diodes. This is what I get afterwards:
I’ve implemented the second stage of the voltage converter, a bucking of the output of the filtered full bridge rectifier with a p-channel mosfet, driven by an n-channel mosfet which is driven by a voltage voltage source with 1% duty cycle.
Again, NGSpice fails to converge with the “timestep too small” error. I am running at 20ns interval. I have used standard KiCAD spice components and D5 has the diode capacitance adjustment to 10pF as D1-D4. I have tried deleting each of the discrete components without much luck, after 1ms (the time delay of the pulse source), spice fails.
For the pulse source: t,delay = 1ms, y1 = 0, y2 = 5, tr = 1u, tf = 1u, tw = 10u, per = 1.2m np = 1000
Built in MOS models in KiCad 7 have a bad threshold parameter vto=0V.
Double click onto the NMOS, Simulation Model…, Simulation Model Editor, Parameter table, DC: enter 4 into value column of parameter vto. For the PMOS, enter -4 into the value column.
For V2, set y2=15
If you simulate with high voltages, relaxing some limit specifications may help. Put the line .options chgtol=1e-11 into a text box onto the Eeschema canvas.
If this does not help, put your project into a zip file and upload it here.
I had caught that the thresholds were set to 0. I had set them to 1 and -1V respectively. I adjusted them to 4 / -4V as per your suggestion and have added the text. The simulation runs for 2ms rather than 1ms , then fails with the timestep too small error.
With KiCad 8.0.1 (using ngspice-42) on MS Windows, your example runs out of the box.
My setting on the canvas is .options chgtol=1e-11 method=gear abstol=100n
due to avoid trap ringing. abstol is required when simulating currents and power dissipation of all devices (KiCad 8!) during transient simulation.
If you are going to simulate more, I suggest to upgrade.
Concerning the circuit, what is the inductor L1 with 840H ? This thing delays the voltage ramp, and when you switch off the clock it contains so much energy that you create ringing in the kV range, nice plot, but very unrealistical. Better just use a large capacitor, the rest is to be handled by the converter.
A good idea is always to seperate things: run the rectifier separately (you have done that), and then the converter (with a constant voltage supply), and when both are ready, put them together. With L1 at 840H this then yields surprises though.
Unfortunately I am running on MacOS Big Sur, so KiCAD 8 is not possible, it seems. Fortunately, the simulation runs as well with your additional parameters !!
I am trying to simulate the basic principal of operation of the Power Integration LinkSwitch-TN2 LNK3205. Of course, the LNK320x includes feedback and control (which I am not simulating) to make adjust the switching such that the output voltage is constant.
PI recommends this circuit above 1W, which is my maximum power level. As you, I don’t see the reason for the LC circuit on the output of the rectifier circuit, especially with such a high cutoff frequency; the input voltage is smoother without it. But I’m not that experienced with this family of components, so I figured I’d simulate it. In the end, the inductor probably isn’t appropriate for my low power levels.
Thanks for your help in getting the simulation working !!