Vous êtes sur la page 1sur 9

Using Linear Technology’s LTspice IV for Switching Mode

Power Supply Simulation: A Step-By-Step Guide


A P PLICATION N OT E AN012 September 2009 (Version 1.0)

Introduction LTspice Overview


One of the more challenging aspects of Switching Mode Power LTspice was created by Linear Technology as a way to make it
Supply (SMPS) design can be the simulation of the combined analog easy for Switching Mode Power Supply Designers, and designers
and digital functions included in a SMPS. Linear Technology has of similar analog/digital subsystems, to quickly and easily simulate
made this aspect of SMPS design much easier by providing a free, their designs. Older versions of SPICE were too cumbersome
powerful, easy to use and very fast version of the popular analog and inefficient when used for these types of design. (Refer to the
simulation program, SPICE. accompanying sidebar for more details). Because of its focus on
SMPS types of sub-modules LTspice has many advantages over
LTspice IV is a fourth generation switching regulator design program other versions. Most importantly it executes fast enough enough to
from Linear Technology. The program consists of a high performance be interactive. (Refer to the side bar on the next page for a summary
SPICE simulator extended with a mixed mode simulation capability of LTspice features and benefits).
that includes new intrinsic SPICE devices for macro-modeling Switch
Mode Power Supply (SMPS) controllers and regulators. The program LTspice includes a wide variety of pre-built designs that makes
includes an integrated hierarchical schematic capture program that it easy to start using LTspice right away. There are currently
allows users to edit example SMPS circuits or design new circuits. approximately fifteen hundred Linear Technology products modeled
An integrated waveform viewer displays the simulated waveforms and in LTspice. Also included are demonstration files that allow you to
allows further analysis of the simulation data. There is a large built-in watch step-load response, start-up and transient behavior on a
database for most of Linear Technology’s power ICs and many passive cycle-by-cycle basis.
components. The device database, schematic editing, simulation
control and waveform analysis are integrated into one program. Despite LTspice’s close association with SMPS design, it not a
SMPS specific SPICE but simply a SPICE program fast enough to
This application note provides a quick introduction to the use of simulate a SMPS interactively. The improved performance of the
LTspice in the design of a simple Switch Mode Power Supply. It gives SPICE simulation engine is a benefit for simulating general analog
a step-by-step guide to downloading, installing and using LTspice so circuits and should be of interest to all electronic engineers. With
the interested user can quickly and easily become familiar enough an installed base of over 2,000,000 licenses so far, LTspice has
with the program to use it on their own design. become the de facto standard SPICE simulator. A simple example of
the use of LTspice is shown in Figure 1 on the next page.
Topics in this application note are organized by task (Download/Install,
Schematic Capture and Simulation) and each topic is a stand-alone
The balance of this section of the app note will go over the
section, with a short introduction or overview, followed by the step-
process of downloading and installing LTspice. If you have already
by-step guidelines. The reader may skip over sections and go directly
downloaded and installed LTspice you can skip the following step-
to the topic of interest, or start at the beginning and follow each topic
by-step guide and go to the next section on Schematic Entry.
in order to quickly go through the entire design process, step-by-
step. Details that may be of interest to only a sub-set of readers are
Download and Install
included as side-bars which can be read or skipped as required to
LTspice is as easy to download and install as it is to use. Simply
make it easy to get just the information needed by the reader. The
navigate to the LTspice landing page at:
topics covered in this application note include the following:
www.linear.com/designtools/software/#Spice
1) Introduction and click on the Download LTspice link. A download page will open.
2) LTspice Overview
a. The Need for LTspice If you have not already registered for a MyLinear account now is a
b. Download and Install good time to do this. Simply click on the Register for a new MyLinear
c. Included Resources account link and follow the registration instructions. Return to the
i. Linear Technology Devices landing page once you are finished registering.
ii. Educational Examples
3) Schematic Capture Once you click on the download link a file download window will
a. Using existing examples open. Click Save and save the file to your desktop. It will be saved
b. Creating your own design as a Windows .EXE file and can be installed after it has been
4) Simulation downloaded. Double click on the .EXE file to install LTspice. Follow
a. Running Your First Design: Step-by-Step the install directions and after the install is complete the program
b. Observe Results should open. Once the program is open you are ready to move
i. Probes to the next section of the app note where we will introduce the
ii. Transient Response Schematic Capture capabilities of LTspice.

Linear Technology has several resources available for the reader


interested in more details. These resources are listed in the Reference
Section at the end of this app note.

AN012 September 2009 (Version 1.0)


Using Linear Technology’s LTspice IV for Switching Mode Power Supply Simulation: A Step-By-Step Guide

The Need for LTspice LTspice Features and Capabilities

Analog circuit simulation has been inseparable from analog IC LTspice is a new SPICE that was developed to simulate analog
design. SPICE simulators are the only way to check circuitry prior circuits fast enough to make simulation of complex SMPS systems
to integration onto a chip. Further, the SPICE simulation allows interactive. Incorporated into the new SPICE are circuit elements to
measurements of currents and voltages that are virtually impossible model practical board level components. Capacitors and inductors
to do any other way. can be modeled with series resistance and other parasitic aspects
The success of these analog circuit simulators has made circuit of their behavior without using sub-circuits or internal nodes.
simulation spread to board level circuit design.
Modern switch mode power supplies include controller logic with
It is easier in many cases to simulate rather than breadboard, and multiple modes of operation. For example, devices may change
the ability to analyze the circuit in the simulation for performance and from pulse switch modulation to burst-mode or to cycle skipping
problems speeds the design of well-understood, robust circuits. depending on the circuit’s operation.

Certain analog functions are extremely difficult to simulate with An original new mixed-mode compiler and simulator were written into
commercially available SPICE simulators. Switch-mode power LTspice that allows these products to be realistically modeled in a
supplies have fast high frequency switching square waves as well computationally fast manner.
as slow overall loop response. This means simulations must run for
thousands to hundreds of thousands of cycles in order to see the Due to the mixed mode simulation capability and many other
overall response of a switching regulator. Commercially available enhancements over previous SPICE programs, the simulation speed
SPICE’s simply take too long for this to be a useful simulation is greatly improved while simulation accuracy is retained. Detailed
method. Simulation times for a switch-mode power supply must be cycle-by-cycle SMPS simulations can be performed and analyzed
in minutes not hours for a simulator to be useful. in minutes. A user can get a detailed simulation of power systems
with a few mouse clicks without knowing anything about the device,
There have been analog circuit simulation methods that have shown SPICE or the schematic capture program. Pre-drafted demo circuits
some success in speeding up switch mode power supply simulation can be used as a starting point to build the custom circuit to fit
but at a cost of making simplifying assumptions which don’t allow different power supply requirements.
arbitrary control logic and fully simulate the complexity of the
switching waveforms. A new SPICE with integrated logic primitives A simulation circuit element was developed for power MOSFET’s
that perform the switch mode control provides a better answer. It that accurately exhibits their usual gate charge behavior without
can give fast simulation times, yield detailed waveforms, and still using sub-circuits or internal nodes. Reducing the number of nodes
allows the flexibility for arbitrary circuit modifications. the simulator needs to solve significantly reduces the computation
required for a given simulation without compromising the accuracy
or detail of the switching waveforms. Another benefit is that
convergence problems are easier to avoid since they, like the board
level component the model, have finite impedance at all frequencies.

Figure 1: LTspice Example Showing Transient Response for a Simple Switching Power Supply Circuit

AN012 September 2009 (Version 1.0)


Using Linear Technology’s LTspice IV for Switching Mode Power Supply Simulation: A Step-By-Step Guide

Schematic Capture with LTspice


The User Guide included with LTspice has a wealth of details on
LTspice has a built-in Schematic Capture program that can be the various commands used with the Schematic Editor so these will
used to create target design for simulation. A design from a not be repeated here. Refer to the Reference Section at the end
different Schematic Capture program can be read-in or a complete of this app note for the web address for the LTspice User Guide. In
design created with-in LTspice. The easiest way to use the LTspice the remainder of this section we will give a step-by-step guide to
Schematic Capture system is to modify an example circuit provided creating a simple schematic as a way to demonstrate how easy it
by Linear Technology. There are over 1500 symbols included within is to get started with LTspice. Simply open the program and follow
LTspice and they cover most of the LTC power ICs, op amps, along as described.
comparators and many other general purpose devices. You can
even draw your own symbols for devices you wish to import into the Opening and Editing a Schematic
program. When you invoke LTspice IV you will get the start-up window shown
in Figure 2 below. From this window you can create your own
Unlike many schematic capture programs, this one was written schematic, import a complete schematic or bring in an existing
explicitly for running SPICE simulations. This means that if you click schematic as a starting point.
on an object, the default behavior is to plot the voltage on that wire
or current through that component, not select the object for editing In our example we will load one of the many schematics provided
or some other editing behavior which would then invalidate the by LTC for an existing product. In a previous app note on using
simulation just performed. Hence, when you wish to move, mirror, LTC Switching Power Supply modules with Xilinx Virtex-5 FPGAs
rotate, drag or delete objects, first select the move, drag or delete we discussed the LTC4601 (see the Reference Section for a link to
command. Then you can select an object by clicking on it. You can that app note). We will pull up the test jig included in LTspice for the
select multiple objects by dragging a box about them. The program LTC4601 to see how we might use the Schematic Capture tools to
will stay in the move, drag, or delete mode until the right mouse modify the schematic.
button is clicked or the Esc key is pressed. All schematic edits can
be undone or redone. To load an existing jig simply click on the File command in the upper
left of the LTspice window. A dialog box, like the one shown in Figure
3 will open. In the Look-in pull down menu at the top of the box
LTspice Program Note: select jigs. Then type in the first few digits of the part number you
Because LTspice is primarily a simulation tool the default action are interested in (4601 in this case) and you will end up with a set of
when an element is selected is to plot the voltage on it or the options you can select from. Select the 4601, as done in Figure 3
current through it- not to select it for an editing command. and click Open.
The user should select the editing command first (to override
the simulation default). This should become clear during the
following editing examples.

Figure 2: LTspice Starting Window

AN012 September 2009 (Version 1.0)


Using Linear Technology’s LTspice IV for Switching Mode Power Supply Simulation: A Step-By-Step Guide

Simple Editing Commands


Some of the basic editing commands are given below along with
the step by step descriptions of how to do them using the example
design from Figure 4. Simply follow along and make the changes
described under each command and you will be able to begin
modifying the jig most appropriate for your specific application.

Delete a Wire or a Circuit Element


Select the delete command with a click on Edit and then on the
pull down menu click on Delete. The cursor will now show as a
scissors icon. You can position the scissors on a wire or component
and then click on it. The wire or element will be deleted. As an
example position the cursor over the wire above R3 on the top left
of the diagram (the wire going to Vin) and click on it. The wire will be
deleted. Notice only a segment of the wire is deleted- each segment
Figure 3: Add Schematic Dialog Window is considered a separate element. Now position the cursor over
R3 and click on it. The resistor will be deleted. To get the elements
The selected schematic will fill the included schematic shown in deleted back, simply select the Edit command and then Undo. Do
Figure 4 below. This jig is set-up to evaluate the start-up transient this twice and the jig will be returned to its original state.
for the power supply based on the input voltage V1 in the upper
left corner as annotated by the text in the lower right corner (.tran
750u startup is the simulation command that will be used, but more Add a Wire
on that in the next section). Let’s review a few simple Schematic To add a wire click on the Edit command and then click on the
Editing commands to see how easy it is to make modifications to the Draw Wire command. The cursor will turn into a cross-hair. When
existing design. Then we will move to the Simulation Section of the you click a wire will start. As you move the cursor around the wire
app note. will follow on each click. Press the esc key to stop the Draw Wire

Figure 4: LTM4601 Jig Schematic

AN012 September 2009 (Version 1.0)


Using Linear Technology’s LTspice IV for Switching Mode Power Supply Simulation: A Step-By-Step Guide

command. Notice that if you click on a terminal or another wire a connection will be made to the wire being drawn. Experiment with the Draw
Wire command by connecting the PLLIN terminal to the Vin wire. Once you have finished exploring the Draw Wire command use the Undo
command to return the jig to its original state.

Add a Circuit Element


Adding a circuit element in LTspice is similar to adding a wire, but you pick the type of element to add from the Edit menu. First click on Edit and
you will see selections for various components- resistors, capacitors, diodes, etc. Just click on the component you want to add and the cursor
will take on the shape of the selected component. When you click the component will be added to the schematic. The cursor will keep the
component shape so you can add as many copies as you like.

If you put a component next to a terminal or wire connection the component will be automatically connected to the circuit. Try this with a
capacitor. Select Edit, Add Capacitor and then place the capacitor just below the wire connection to R4 on the left hand side of the schematic.
Once the capacitor is placed, press the esc key to end the Add Capacitor command. The added capacitor will now be connected into the
circuit.

Modify Element Characteristics


Now you need to edit the capacitor characteristics. Right click on the capacitor icon (when the cursor shows as the pointing hand) and a dialog
box will come up so you can change the element characteristics. One of the easiest ways to do this is to select the capacitor type from the
included component database. Just click on the Select Capacitor button and the database will come up. As shown in Figure 5, you can scroll
down to the capacitor you want- for example the KEMET 100 uF Tantalum 2.5V and 0.070 Ohm R- and then click on the OK button. The
capacitor will now show the key characteristics on the schematic (110u and the Tantalum symbol of an arc for the lower capacitor line).

Figure 5: Selecting a Capacitor

Summary
The above commands should be enough to allow you to create your own simple schematics. Review the other commands in the Edit pull down
window and try them out. In a few minutes you should be able to create any schematic you need. Don’t forget to look over the supplied jigs and
educational circuits. In most cases the majority of your work has been done already- you just need to make changes.

Now let’s move on to the main use of LTspice- Simulation- in the next section.

AN012 September 2009 (Version 1.0)


Using Linear Technology’s LTspice IV for Switching Mode Power Supply Simulation: A Step-By-Step Guide

associated with the schematic will be executed. In this case the


Simulation with LTspice
simulation commands are for transient analysis (as indicated by
the text displayed on the schematic- right click on the schematic
Once the schematic has been created it is easy to simulate the capture window and click on the edit simulation cmd button to see
design using LTspice. Simulation with LTspice is interactive and the details. The Transient Analysis tab has data entered so it is the
very fast. This allows the user to efficiently experiment with various active command. We will cover all the key commands later in this
settings and designs if you try something and it doesn’t respond section). The simulation will run and tracks progress in the status line
how you expect it you have not wasted much time and can quickly at the bottom of the window. When simulation is completed (after
make changes. This iterative design approach also makes it easy to 720us in this example) we can select the points on the schematic to
learn the tool a step at a time. In the following sections we will cover display in the upper window.
running simulations, displaying simulation results and then quickly
describe the variety of simulations supported by LTspice. Many of For our example, let’s look at the output voltage and the input
the features of the tool will need to be left for the reader to explore voltage to see how the output varies based on the input voltage
on their own, but the balance of this section should provide the ramp-up. Click on the schematic window to make sure it is active.
reader with the necessary basic concepts to make this possible. Use the cursor and place it near the wire connected to the Vin signal
on the upper right of the LTM4601 symbol. The cursor will change
Running and Displaying Simulation Results to a probe icon when it is positioned over a node where the voltage
Use the included schematic for the 4601 by opening it up as can be measured. Click on the selected node and the voltage will
described in the previous section. Click on the Simulate pull- be displayed in the simulation window. Do the same on the Vout
down menu and you will see a set of commands- the one we are signal to display it in the window as well. You should have a display
interested in is Run. Click on Run and the simulation commands similar to the one shown in Figure 6, below.

Figure 6: Simulation results for Vin and Vout in the Example Circuit

AN012 September 2009 (Version 1.0)


Using Linear Technology’s LTspice IV for Switching Mode Power Supply Simulation: A Step-By-Step Guide

Measuring current is easy as well. Just position the cursor over a component and tit turns into a current measuring probe. On the example circuit
position the probe over the capacitor between the Vosns+ and Vosns- signals and click. The current across the capacitor is displayed in the
upper window. Notice that the signal is switching so fast it is difficult to see easily. You can zoom-in on the signal to see it better by positioning
the cursor on the bottom axis label. The cursor icon switched to a ruler. Right click and you will get a menu of commands. Select the Zoom Area
command and then select the beginning of the display (from 0us to 160us) by clicking on the upper left of the display and then at the top of the
160us point in the display. The display will zoom to the section selected. You should see a display similar to that shown in Figure 7 below.


Figure 7: Zoomed Display of Current thru C2

You can easily edit the signals displayed in the upper window. Click on the upper window and then position the cursor over the signal label at
the top of the window. The cursor will switch to the pointing hand icon when you are positioned correctly. Right click to bring up the edit window
for the signal. You can change display characteristics or delete the signal by clicking on the Delete This Trace button. If you delete I(C2) and then
change the display via the Zoom to Fit command (by Right Clicking on the bottom axis label and selecting Zoom to Fit) you should get back to
the display shown in Figure 6.

AN012 September 2009 (Version 1.0)


Using Linear Technology’s LTspice IV for Switching Mode Power Supply Simulation: A Step-By-Step Guide

Overview of Simulation Commands DC Transfer Analysis


There are a variety of powerful simulation commands available in This is an analysis mode that finds the DC small signal transfer
LTspice. We can only provide an overview in this app note but a function of a node voltage or branch current due to small variations
much more detailed description can be found in the User Guide of an independent source.
listed in the Reference Section of this document.
Noise Analysis
If you right click on the Schematic Capture window and select Edit This is a frequency domain analysis that computes the noise due to
Simulation Cmds the Simulation Command window, as seen in Johnson, shot and flicker noise. The output data is noise spectral
Figure 8 below, comes up. Each tab is a different command and density per unit square root bandwidth.
the commands can be enabled by selecting the tab and entering
the desired command parameters via check boxes or value boxes. DC Operating Point
Once the command is entered clicking OK will store the command. Perform a DC solution with capacitances open circuited and
The command can be displayed on the Schematic Capture window inductances short circuited. Usually a DC solution is performed as
by placing the cursor (which shows a text placement icon after the part of another analysis in order to find the operating point of the
Simulation Command window closes) on the schematic and then circuit. Use .op if you wish only this operating point to be found. The
clicking to locate the text ( if it is a change to an existing command results will appear in a dialog box. After an OP simulation, when you
the current text is just changed, with the position retained). point at a node or current the OP solution will appear on the status
bar.

Some Additional LTspice Commands


LTspice has a full range of other commands and options. A couple
of the most interesting ones include:

Encrypted Libraries
LTspice supports the use of Vendor Encrypted Libraries to protect
sensitive design information. Such libraries would be supplied by a
third party.

Wave
LTspice can convert waveform outputs to .wav audio files so you can
listen to the results. This is a big help with audio processing circuits.

Step
This command causes an analysis to be repeatedly performed while
stepping the temperature, a model parameter, a global parameter,
or an independent source. Steps may be linear, logarithmic, or
specified as a list of values.

Param
Figure 8: LTspice Simulation Commands The param directive allows the creation of user defined variables.
This is useful for associating a name with a value for the sake of
Transient Analysis clarity and parameterized sub-circuits so that abstract circuits can
Perform a transient analysis. This is the most direct simulation of be saved in libraries. A large number of standard arithmetic and logic
a circuit. It basically computes what happens when the circuit is functions are available to create very powerful expressions.
powered up. Test signals are often applied as independent sources.
Measure
AC Analysis This command is used to find values from simulation results so they
The small signal (linear) AC portion of LTspice computes the AC can be saved for further analysis or as a record of key results.
complex node voltages as a function of frequency. First, the DC
operating point of the circuit is found. Next, linearized small signal Control Panel
models for all of the nonlinear devices in the circuit are found for The LTspice control panel allows you to customize many of the
this operating point. Finally, using independent voltage and current aspects of LTspice. Click on the Tools menu and select Control
sources as the driving signal, the resultant linearized circuit is solved Panel from the pull down menu. You will see a list similar to that
in the frequency domain over the specified range of frequencies. shown in Figure 9.
This mode of analysis is useful for filters, networks, stability analyses,
and noise considerations.

DC Analysis
This performs a DC analysis while sweeping the DC value of a
source. It is useful for computing the DC transfer function of an
amplifier or plotting the characteristic curves of a transistor for model
verification.

AN012 September 2009 (Version 1.0)


Using Linear Technology’s LTspice IV for Switching Mode Power Supply Simulation: A Step-By-Step Guide

Click on the tab to access the desired group of settings. You can
experiment with various settings and then restore the defaults by
clicking on the Reset to Default Values if you need to recover the
initial settings.

Summary
LTspice has many powerful commands and options. We have only
been able to cover a few of them in this app note but it should give
you an appreciation for the power of this easy to use tool.

Figure 9: Control Panel for LTspice

Conclusion
This application note has provided a step-by-step guide to LTspice. It demonstrated how to download, install, use the schematic editor and
run simple simulations. This should provide you with enough background to make it easy to use LTspice to simulate your own Switching Mode
Power Supply or any of a host of circuits using Linear Technology products.

For the reader who wants additional levels of detail on the Linear Technology products used in this app note a list of valuable documents is given
in the Reference section at the end of this document.

References
1) LTspice Landing Page - http://www.linear.com/designtools/software/#Spice
2) LTspice User Guide - http://ltspice.linear.com/software/scad3.pdf
3) LTspice Getting Started Guide - http://www.linear.com/designtools/software/LTspiceGettingStartedGuide.pdf
4) Powering a Virtex-5 FPGA with LTC Power Devices App Note - http://www.nuhorizons.com/application_notes/application.asp?id=14
5) LTC Demo Circuits - http://www.linear.com/designtools/software/demo_circuits.jsp

Notice Of Disclaimer

Nu Horizons is disclosing this Application Note to you “AS-IS” with no warranty of any kind. This Application Note is one possible implementation
of this feature, application, or standard, and is subject to change without further notice from Nu Horizons. You are responsible for obtaining
any rights you may require in connection with your use or implementation of this Application Note. Nu Horizons makes no representations or
warranties, whether express or implied, statutory or otherwise, including, without limitation, implied warranties of merchantability, noninfringement,
or fitness for a particular purpose. In no event will Nu Horizons be liable for any loss of data, lost profits, or for any special, incidental,
consequential, or indirect damages arising from your use of this application note.

AN012 September 2009 (Version 1.0)

Vous aimerez peut-être aussi