Transformers are a key component in many switching regulator designs, providing an isolation barrier in dangerous high power systems, allowing very high step-down or step-up ratios in high voltage designs and (with an extra winding) easily accommodating multiple or inverting outputs. Flyback, forward and SEPIC converters all make use of transformers. This article tells you what you need to know to add transformers to LTspice/SwitcherCAD III simulations.
About LTspice/SwitcherCAD III
LTspice/SwitcherCAD III is a powerful SPICE simulation tool with integrated schematic capture. Unlike many other free simulators, LTSpice is a general purpose tool and not limited. LTspice includes models for most of Linear Technology’s switch-mode DC/DC converters as well as a library of devices for general analog circuit simulation including op amps, comparators, linear regulators and discretes. LTspice/SwitcherCAD III is available for free download here.
Draw Each Winding as an Inductor
Figure 1 shows the basic technique. One simply draws each winding of the transformer as an inductor and couples the inductors with a SPICE directive called a K-statement (e.g., “K1 L1 L2 1”.)
To add the directive, choose SPICE Directive from the Edit menu. This allows you to place text on the schematic that is included in the SPICE netlist. Once the inductor is mentioned in a K-statement, LTspice uses an inductor symbol with a visible phasing dot to indicate each winding’s phasing.
Setting the turns ratio of the transformer is simply a matter of choosing the right inductor values. Remember, the inductance is proportional to the square of the turns ratio. In the example above, a turns ratio of 1:3 gives a 1:9 inductance ratio.
The last entry of the K-statement is the mutual coupling coefﬁcient. This is on a scale of 0 to 1 where 1 means perfect coupling between the inductors (i.e., no leakage inductance.) Leakage inductance is usually not desired in a practical circuit. For example, in transformers that are intended to store energy, such as in a ﬂyback converter, leakage inductance prevents the secondary from removing all of the energy stored by the primary. In a non-energy storage transformer, the leakage inductance’s impedance can limit how well the secondary can shield the core from the primary current setting a hard limit on how much energy can be transformed through the transformer. Either way, leakage inductance can cause undesired voltage spikes or ringing which can lead to a requirement for snubbing circuits and their associated energy losses. We’ll get back to leakage inductance later, but for an initial simulation, it’s easier and often sufﬁcient to ignore leakage inductance by setting the mutual coupling coefﬁcient to 1.
When you have a transformer with more than one primary and one secondary you have to make sure that all mutual inductances are included. Consider a transformer with four windings; L1, L2, L3 and L4. A common error is adding only three mutual couplings with three separate K-statements for such a transformer with four windings:
K1 L1 L2 1
K2 L2 L3 1
K3 L3 L4 1
LTspice will tell you that this transformer is impossible since it isn’t possible for L1 to be perfectly coupled to L2 and L2 perfectly coupled to L3 without some coupling between L1 and L3. Yes, it is possible for two inductors to have no mutual inductance yet have some coupling to a third, but there are limits on how well they can be coupled to that third. LTspice analyzes the mutual coupling coefﬁcient matrix and determines if your coupling coefﬁcients are physically realizable.
A transformer with four windings usually has six non-zero mutual inductances:
K1 L1 L2 1
K2 L1 L3 1
K3 L1 L4 1
K4 L2 L3 1
K5 L2 L4 1
K6 L3 L4 1
In general, the number of mutual inductances in a transformer with N windings is N • (N – 1)/2. Note that the number grows as N squared, just like the inductance of each individual winding is proportional to the square of the number of turns.
Permuting all the inductor names by hand to generate individual mutual coupling statements for each mutual inductance is tedious at best and tends to be error prone. A better approach is to use a single K-statement that mentions all the inductors that are wound on the same core and let LTspice do the work:
K1 L1 L2 L3 L4 1
LTspice understands this to mean that all these inductors are coupled to each other by the same mutual coupling coefﬁcient. Figure 2 shows this technique used in a transformer with four windings conﬁgured as an auto transformer by connecting the windings in series.
You may want to simulate the effects of leakage inductance in order to consider snubber designs or work out the commutation timing of a resonantly switched converter. There are two ways to add leakage inductance to your model. You can either put extra inductors in series with the leads of the winding inductors—a very direct approach—or use a mutual coupling coefﬁcient of less than one. The leakage inductance, LLEAK, can be related to the winding inductance, L, and coupling coefﬁcient, K, by the equation:
If K is close to 1, the two methods are electrically equivalent.
One note of caution: The modeling effort increases signiﬁcantly when leakage is added, because once you add leakage inductance to a simulation, you also need to model the capacitances that can ring with it and the losses that limit the Q of the ringing, in order to get any agreement between simulated and measured effects. For this reason, I usually recommend starting simulating without any leakage inductance and then add it later if you feel you need to investigate the non-ideal behavior due to leakage inductance in the transformer.
To simulate a transformer in your LTspice/SwitcherCAD III simulations, just draw each winding of the transformer as an individual inductor. Then add a SPICE directive of the form K1 L1 L2 L3 ... 1. to the schematic. That’s basically it!
For an example simulation file using coupled inductors in a SEPIC converter, visit the product page for the LTC1871 controller and click on the Simulate tab for a ready-to-run a demonstration circuit.