# Simulating simple SMPS model

I'm trying to simulate using ngspice/kicad a very simple switch mode power supply model, as below.

I would expect that the coupled inductors to model a transformer with a 10:1 (primary:secondary) winding ratio and as such I would expect around 34V on the secondary output (V1=340V DC). However, what I get from simulation as as below.

The output waveform (one in cyan) hardly does anything. Why ? What am I missing to make the coupled inductors behave more like a real transformer ?

• I am unable to reproduce your results using CircuitLab. Please run your simulation again and to determine the voltage waveform across L1 and the current waveform through L1. Commented Mar 7, 2021 at 23:34
• Do you have the correct "Alternate Node Sequence" set for both the diode and the MOSFET? Commented Mar 8, 2021 at 1:10
• The cuernt through the inductor is the red trace on the figure and the voltage at node N3 (shows V across inductor) is the blue trace. The alternate node sequence for the diode I had as "2 1" and for the FET it was "2 1 3" (the model file says: Node 1 -> Drain, Node 2 -> Gate, Node 3 -> Source). I think this is correct. Commented Mar 8, 2021 at 7:29

Given your comment to Tony Stewart's answer you are thinking that you are using an ideal transformer, i.e. two coupled, linear inductors, which is not the case here (also the reason why Math Keeps Me Busy couldn't replicate your results).

The waveforms you're showing don't resemble any linear coupling I know and, sure enough, a quick test in both Ngspice and LTspice with simple coupled inductors proved that the waveforms do not even come close to what you're showing. Reversing the polarity has no effect here since it's a resistive load, no nonlinear diode.

So I added a Chan core with some wet finger™ values and the mystery is solved: you must have used a non-linear core in your simulation. I didn't have the MOSFET and diode you are using, but that doesn't matter.

• Thank you for your helpful hints. In response to this I checked the spice netlist generated by kicad and found that the inductor values where all wrong. Having solved that the results I see are as I was expecting. Commented Mar 9, 2021 at 17:49

Unless you allow enough time for the transformer to reverse its flux, using one of many methods, the average DC current will saturate it and the core inductance drops like a rock and gets hot. Try a Centre tapped Vdc with bipolar switches. Other ways using tertiary winding to cancel the flux on the primary.

• Please excuse my ignorance. How does "saturation" come into the picture ? I'm simulating in spice, so the inductors are ideal, and thus I believe there is no "saturation" to speakof. Could you also please explain a little more what you meant with "allow enough time ..." ? If I change the on-time of the switch from 500us to just 10us, the output waveform doesn't materially change. Commented Mar 7, 2021 at 19:45
• maybe your transformer is reversed. I was referring to DCM time duration Commented Mar 7, 2021 at 19:48
• I tried to reverse the polarity of either inductor, but that just results in what I would expect: the polarity of the output waveform is just reversed. I also tried to reverse the inductance (primary 0.2mH, secondary 20mH) but that, surprisingly, doesn't change the results at all! Commented Mar 8, 2021 at 7:30
• The function of each part must be verified by voltage and impedance to conform to reference design spec.’s incl ESR, DCR and isolation until debugging has found the flaw. Commented Mar 8, 2021 at 13:39