# Difference between revisions of "Transformers"

Line 1: | Line 1: | ||

== Transformers == | == Transformers == | ||

− | '''''How do I make a transformer in LTspice?'''''[[File:Xfmr_Basic.png|frame|right| | + | '''''How do I make a transformer in LTspice?'''''[[File:Xfmr_Basic.png|frame|right|<b style="text-align:center">Two lines were used to draw the core</b>]] |

Although it is very possible to make to make a dedicated subcircuit for a specific transformer, the preferred method of making a generic transformer when drafting a simulation schematic is to simply place a separate inductor for each separate transformer winding and then couple them all together magnetically via a single ''[[Mutual Inductance]] (K) statement'' placed as a [[SPICE Directive]] on the schematic. Note that inductors called out in a [[Mutual Inductance]] statement will be automatically given a phasing dot if one does not already exist. | Although it is very possible to make to make a dedicated subcircuit for a specific transformer, the preferred method of making a generic transformer when drafting a simulation schematic is to simply place a separate inductor for each separate transformer winding and then couple them all together magnetically via a single ''[[Mutual Inductance]] (K) statement'' placed as a [[SPICE Directive]] on the schematic. Note that inductors called out in a [[Mutual Inductance]] statement will be automatically given a phasing dot if one does not already exist. | ||

Line 24: | Line 24: | ||

'''''Okay, but calculating winding inductances is tedious. Is there some way to just enter a turns count for all the windings?''''' | '''''Okay, but calculating winding inductances is tedious. Is there some way to just enter a turns count for all the windings?''''' | ||

− | Yes, this can be done in any of a number of ways. For example, the values for each of the inductances may be directly parametrized via <font color="green"><b title="Lx node1 node2 {Lm*(Nx/Nm)**2}">curly braces</b></font> to be a function of turns ratios, or a subcircuit that accepts turns as a parameter may be used to encapsulate the windings implementation details. . | + | Yes, this can be done in any of a number of ways. For example, the values for each of the inductances may be directly parametrized via <font color="green"><b title="Lx node1 node2 {Lm*(Nx/Nm)**2}">curly braces</b></font> to be a function of turns ratios, or a subcircuit that accepts turns as a parameter may be used to encapsulate the windings implementation details. Here is a schematic of a circuit that is functionally equivalent to two mutually coupled inductors in LTspice: |

+ | |||

+ | [[File:Transformer Spice Model.png|center|Equivalent circuit to mutually coupled inductors in LTspice]] | ||

+ | <br style="clear: both" /> |

## Revision as of 22:56, 18 August 2009

## Transformers

**How do I make a transformer in LTspice?**

Although it is very possible to make to make a dedicated subcircuit for a specific transformer, the preferred method of making a generic transformer when drafting a simulation schematic is to simply place a separate inductor for each separate transformer winding and then couple them all together magnetically via a single *Mutual Inductance (K) statement* placed as a SPICE Directive on the schematic. Note that inductors called out in a Mutual Inductance statement will be automatically given a phasing dot if one does not already exist.

K1 L1 L2 L3 1 ; causes phasing dots to automatically appear on L1-L3 inductor symbols

When creating a new transformer this way, especially for use in a switched-mode power circuit, it is generally best to first specify the mutual coupling coefficient to be exactly unity. By starting with 100 percent coupling there will be no leakage inductance in any winding and this will minimize the likelihood of the windings ringing at extremely high frequencies (which can slow the simulation to a crawl at each switching edge). However, be aware that a mutual inductance value of plus (or minus) unity *may* lead to simulation difficulties if *Skip-the-initial-operating-point-solution* (UIC) is specified for the .tran command. Prevent this by specifying a realistic resistance for each inductor "winding" (ctrl-right-mouse-click). Note that when coupled inductors are used as transformer windings, individual winding inductances rather than turns ratios must be specified (inductance ratios should be proportional to the * square* of the turns ratios).

**I want to model leakage inductance - how should I do that?**

The most flexible method is to keep the windings' mutual inductance statement at unity and add a small discrete leakage inductance in series with each winding. This is the most straightforward way to model transformers with asymmetrical leakage inductances. However, if your transformer is electrically symmetrical, it may be more convenient to simply set the mutual inductance to a value less than one. For each winding the resulting leakage inductance will be (1-K) times that winding's inductance. Note that each winding's coupled inductance also will decrease to K times that winding's inductance, but for typical values of K (>>0.9) this effect will be very small.

**How about transformer saturation effects? Can LTspice model those?**

Yes, LTspice comes with a non-linear hysteretic core model built in! This is the 1991 model by John Chan et al. Compared to older core models, the Chan model is particularly robust, computationally efficient and compact, requiring only three parameters to define most any commonly encountered magnetic hysteresis loop.

Once the core material's generic magnetic properties are set, establishing the circuit-level non-linear inductance requires specifying three more parameters to set the geometry of the specific core and specifying one additional parameter for the core winding turn-count. The Chan inductor does not directly support Mutual Inductance, so unless only a single-winding inductor is being modeled, multiple windings must be added on via additional circuitry. The simplest way to do this is to construct an ideal, unity coupled transformer with as many windings as required and then put the Chan inductor directly in parallel with any one of the windings (taking care to set the turns to match that particular winding). Since the magnetic effects (including non-saturated inductance) are already modeled by the Chan inductor, the inductance of the transformer's parallel winding must be enough larger (>>10) not to significantly load the Chan inductance. As before, the inductances for the other windings should be scaled by the square of their individual turns ratios (with respect to the paralleled winding).

**Okay, but calculating winding inductances is tedious. Is there some way to just enter a turns count for all the windings?**

Yes, this can be done in any of a number of ways. For example, the values for each of the inductances may be directly parametrized via **curly braces** to be a function of turns ratios, or a subcircuit that accepts turns as a parameter may be used to encapsulate the windings implementation details. Here is a schematic of a circuit that is functionally equivalent to two mutually coupled inductors in LTspice: