Beige Bag Software

Magnetics (Part 1) - Transformer Modeling

About the writer: Harvey Morehouse is a contractor/consultant with many years of experience using circuit analysis programs. His primary activities are in Reliability, Safety, Testability and Circuit Analysis.

Summary: This paper describes perfect and ideal transformers and provides the building blocks for constructing realistic models for simulations with multi-turn transformers and non-ideal inductors. This is not a magnetics primer, and assumes a basic knowledge of magnetics, especially in the parts to follow. The focus is on how to create models of real, lossy transformers of increasing complexity using an ideal transformer as a building block, and also non-ideal inductors.

Three transformers

There are three transformer primitive models useful in SPICE simulations. They are the perfect transformer, the ideal transformer, and the lossy transformer. The perfect transformer is simple, easy to model, however it is often the subject of misunderstanding.

Perfect Transformer: The perfect transformer consists of two lossless inductors which are magnetically coupled together. The primary has an inductance we will call Lp, and the secondary an inductance value of Ls. The coupling inductance or mutual inductance we can call Lm. The perfect transformer is the most easy to construct, however it is often the subject of misunderstanding. Refer to Reference 1 for more details.

The transformer equations familiar to all of us are:

V1 = V2 * n
I1 = I2 / n
Z1 = Z2 * n * n

Voltage V1 is the voltage impressed in the primary of a transformer, with a current of I1 resulting. V2 is the secondary transformed voltage, with a current of I2. (The coupling is assumed to be unity.)

These equations ONLY apply to an ideal transformer, however. This is the cause of some misunderstanding. For a perfect transformer there are other considerations. First, the turns ratio is the square root of Ls/Lp (or L2/L1) as shown in the reference.

Second, the effects of the primary (or secondary inductance) are NOT considered in the preceding equations. As an example, per Reference 1, create a test circuit similar to that shown in the following.

In the example circuit, the primary has a 16uH inductance, the secondary a 1uH inductance, and the turns ratio is 4, the square root of 16/1. The coefficient of coupling is again assumed to be unity as shown. Resultant analysis will show that that the voltage is transformed as expected, but the currents are not!!!

The reason for the apparent discrepancy is that the value of Ls has not been included in the familiar equations. The real equations that should be used are, for the perfect transformer:

V1 = V2 * n
I1 = I2 * (1 + Zl;/(s*L2)) / n
Z1 = Z2 * n * n / (1 + Zl/(s*L2))

Note that IF L2 in the above equations is very large (and consequently L1 to maintain the turns ratio), or the load Zl is very small compared to sL2, the results will approach those of an ideal transformer. There MAY be a range of frequencies and loads where a given perfect transformer will approach in performance that of an ideal transformer.

As an illustration of this confusion, several years ago a fellow worker was designing a circuit with an AC coupled transformer in a transistor collector. He specified to a transformer shop the turns ratio he wanted (no problem) as well as the frequencies over which he wished to use it, and the device transformed power (no problem) but he also specified he wanted a LOW primary inductance (BIG problem).

I became aware of this problem when the circuit with the prototype transformer failed to perform as expected and I was asked for my input. I pointed out that the designer REALLY wanted the primary impedance to be LARGE, so that the transformed load at the transformer primary would be essentially only the transformed impedance, consistent with size and weight considerations (and the fact that larger transformers tended to have larger winding resistances and stray capacitances). With this modification the secondary inductance exceeded the expected load impedance by a large factor, and it performed as expected.

Ideal Transformer: The ideal transformer is a lossless transformer. It differs from the perfect transformer as it will pass DC and all frequencies. It is of course unrealizable in the 'real world'; however it serves as a building block for building complex, non-ideal transformers. This will be done in subsequent parts of this article, but in this part of the paper we will consider only how to model the ideal transformer.

An ideal transformer can be modeled as shown in the following:

In this model the secondary current is reflected as the primary current and the primary voltage reflected as the secondary voltage, each with a multiplier of 'RATIO'. 'RATIO' being the reciprocal of the 'n' term as previously defined as the primary to secondary turns ratio. Components RP and RS are model elements added to prevent problems when the ideal transformer is used in an implementation, RS being arbitrarily large, and RS being arbitrarily small. VM is used as an ammeter to measure the secondary current. The depicted 'F' and 'E' elements are not shown in B2 SPICE format however the elements show clearly their relationships as to controlling and controlled nodes. In B2 SPICE format the circuit becomes:

An AC source was provided as an input V1, and a load resistance as R1. The turns ratio is in this case 0.1. The netlist for this circuit is:

* B2 Spice
************************
* B2 Spice default format (same as Berkeley Spice 3F format)


***** main circuit
F1 N2 0 VAm1 10
E1 3 0 N2 0 10
VAm1 3 4 0
RP N2 0 1e10
RS 4 N1 1e-9
V1 N2 0 DC 0 SIN( 0 10 10K 0 0) AC 10
R1 N1 0 1


.OPTIONS gmin = 1E-12 reltol = 1E-4 itl1 = 500 itl4 = 500
+ rshunt = 1G
. TRAN 10u 1m 0 1u uic
.IC
.END

Performing a transient analysis on this circuit shows that the transformer output voltage is ten times the transformer input voltage, and the transformer input current is ten times the transformer output current.

The above graph output shows the primary to secondary step-up turns ratio of 10 for the voltage, and the secondary to primary current step-down ratio also of 10.

Similarly, for the output currents, the following graph shows the relationship between the input and output currents show the output current being ten times that of the input current.

Close examination shows the input and output voltages and current maximums are not exactly 10 and 100 volts and amperes, as expected. This is due to the plotted curve sampling point not being exactly at the maximum excursions, as well as to computational and rounding errors.

Interestingly enough, the current plot seems to show an erroneous 180-degree phase shift between the primary and secondary currents. This occurs because of the transformer primitive being modeled as a two-port device, with 'positive' currents entering input and output terminals.

This could be eliminated and complying with the external device 'dot' convention by reversing the sense of the model device measuring output current, VAm1, and changing the gain of the 'F' to a negative value. Alternately, if it were expected that this current would be widely used in the final product, one could just remember to multiply any printed and plotted magnitude current magnitude curves by negative one. However, because a final realizable lossy model with a core and parasitic elements is expected to be the final 'product' of this effort, with multiple primitives being used to make the final output, it seems worthwhile to maintain the definitions and to rely on external ammeters and/or plots of currents through external elements to be directly performed without any mental gymnastics required in using the model current sense.

In the test circuit, a ground is added to both input and output, however this is not required in the subcircuit, as it is expected that ground references would be determined by external components. One could easily add a large resistance between the 'primary' and the 'secondary' in the subcircuit to eliminate the need for a secondary ground point in the SPICE schematic representation, and perhaps to simulate inter-winding resistance, eliminating the secondary ground reference.

Having created a working model, it is best to add this model (less of course, elements V1 and R1) as a subcircuit to the library. Whether it should be parameterized or not will be discussed in part 2. In order to facilitate usage, and to make its nature clearer in a schematic view, the transformer depiction(s) should be altered slightly from that of the 'standard' transformer. The normal two winding transformer symbol named 'transformer' is shown as follows:

Several additions are suggested for the new transformer symbol. First is the addition of winding polarity dots, which should be added to show the relationships of the impressed and induced voltages. This is desirable to aid in the creation of multi-winding transformers with the desired winding polarities. Second, the winding turns ratio would be nice to indicate with an 'n' and a '1' showing the primary with 'n' turns and the secondary with one. It should be noted that in the creation of multi-winding transformers the individual transformer primitives would often have different turns ratios. But for building block purposes, a symbol such as the following is suggested.

Lastly is an indication of the core type. In this case, if the subcircuit is to be used as a building block for a 'real' transformer nothing more need be done. It is expected that this will be the case; at least after the design topology has been 'proven' using an ideal transformer composed of the interconnection of ideal transformer primitives. (Note that an ideal transformer primitive used alone in a flyback power supply model is useless in itself, as it relies on energy stored in the magnetic field to power the load when the primary winding is non-conducting. It could be used in a forward converter, however.)

The anticipated use of this simple device is to construct more complex devices, especially with a real magnetic core material, however it itself could be useful in building a 'real' transformer with a single primary and secondary winding. When all of the ideal transformer elements have been added, by interconnecting ideal transformer primitive(s), a core, and parasitic elements (as will be shown in the next part of this article, a representation of the transformer to indicate that it is air-gapped, saturable or (essentially) linear with a magnetic core material may be appropriate. For this case, the primitive transformer (meaning generally the transformer constructed only of perfect transformer model elements), is sufficiently shown as in the following should be sufficient:

The symbol was created using the B2 SPICE database editor and first duplicating and then altering, renaming and saving the symbol as 'transformer_primitive'.

Using it one can build multiple winding transformers. This is done by creating a subcircuit of the device. By paralleling or placing in series input and/or output windings, transformers with multiple winding combinations in the primaries and secondaries can be created, creating more complex subcircuits. Moreover, it is not difficult to add a lossy core model, winding resistances, leakage inductances, stray capacitances, all of which can tailor the device to more nearly perform as would a 'real' transformer. This then creates a model for a specific real transformer. The external elements modify the ideal characteristics to create a realistic device, as well as do parameterized inputs to the subcircuits. This will be covered in a later part.

There IS a single drawback to using this as a basis of our transformer models, however. Namely that it will pass DC. IF there is some DC voltage impressed, it will be transformed. Some care may need to be taken to account for this if it is the case.

Lossy Transformer: The lossy transformer can be constructed using a perfect transformer, or an ideal transformer. Alternately, one can create it using one of many transformer models described in textbooks. This paper, in subsequent parts, will show how to build a realistic, real-world transformer from ideal transformers with the inclusion of lossy elements added to the ideal transformer model.

One may model 'real' transformers in many ways. Textbooks models of real transformers are often quite complex, with many elements. However, when there are more than three or four windings, the models become very cumbersome, increasing in what seems to be a geometric nature as the number of windings increase. So much so that most persons are tempted to never use them, save perhaps for a homework assignment! (Note that many of these models rely on an ideal transformer to achieve isolation, however they do not consider how to do this from a SPICE modeling viewpoint and not pass DC.)

Creating multiwinding transformers with an ideal transformer at their 'core' is much easier, as the lossy, parasitic elements can be added later as needed and as appropriate. The modeling can be done in stages, first with an ideal transformer and later refined.

The next part will describe the process used to build more and more complex transformers using the ideal transformer as a building block. Center tapped windings, multiple outputs will be considered. Subsequently, it will be shown how to add elements to the models created to simulate the effects of losses and undesirable parasitic. The last part will show how to create a transformer (or inductor) which exhibits core losses and hysteresis effects using a much more realizable method than the Giles-Atherson core model.

Other Methods

It should be noted that there IS another reasonable way of creating non-ideal multi-winding lossy transformer and lossy inductor SPICE models. This is by use of the Magnetics Designer ™ program sold by Intusoft. Using a 'fill in the blanks' method one can design a transformer and get a lossy SPICE model for the device as well as construction/specification details using the provided list of core materials. The library can be extended by the addition of new core materials.

If one can afford it this is the best way to get a realistic model of a lossy inductor and/or transformer. (It would be desirable in this case to create new symbols for the lossy transformer model, but this in itself is not a daunting task.) It is recommended even if one uses the method used in this paper for preliminary device modeling, and often in conjunction with it, as a more realistic estimate of a realizable inductance value(s) (for the cores in the provided or user extended magnetic core material data) with construction information for the realization. But because the design is often iterative in nature, it is useful in conjunction WITH the method shown in this paper. Details regarding the software are available at http://www.intusoft.com/mag.htm, unless or until it is relocated, but it may be found in that event by going directly to the Intusoft web site and following the Magnetics Designer ™ links.

References

1.Perfect Transformer vs Ideal Transformer, Spectrum Microsoft newsletter, Spring/Summer 1999.

 

 

 


Beige Bag Software, Inc., 623 W. Huron, Suite 2, Ann Arbor, MI, 48103
(phone) 734.332.0487 (fax) 734.332.0392 (email) info@beigebag.com
© 2005-2010 Beige Bag Software, Inc