Вы находитесь на странице: 1из 9

LTspice IV: Overview and Demo

ECE 464: P OWER E LECTRONICS


U NIVERSITY OF I LLINOIS AT U RBANA -C HAMPAIGN

C ONTENTS
I

Introduction

II

User Interface

II-A

Keyboard Shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

II-B

Unit Convention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

III

IV

Creating the Circuit

III-A

Passive Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

III-B

Voltage Controlled Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

III-C

SPICE directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Simulation Results

IV-A

Fourier Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

IV-B

Exporting Waveforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

I. I NTRODUCTION
LTspice IV is a circuit simulator that allows you to build and simulate different schematics. Its very useful for a variety of
situations, and can be used for ideal as well as real components. The purpose of this tutorial pdf is to provide a basic overview
of how LTspice can be used for ECE 464 and 469 and demonstrate a basic switched-mode power converter- in this case, a
buck converter nominally set to step down from 20 to 15V, with 15W and switching at 1 MHz. Please note - understanding
the operation of a buck converter will help explain the motivation for circuit creation and the waveforms observed, but is not
necessary to understand how to use LTspice.
For more advanced topics not covered here, a plethora of documentation and help is available on various forums and e-boards,
so Google away!
Downloading LTSpice
Windows version: LTspiceIV.exe
Linux users: Download the Windows version above and open with Wine.
Mac OS X version: LTspiceIV v2.dmg or LTSPICE W WINE.dmg or follow the same instructions for Linux users.
II. U SER I NTERFACE
The menu bar in LTspice will appear like Fig.1. In this case, a new file has already been created, which makes certain
buttons and functions clickable.

Fig. 1.

Heres a quick overview of the buttons and menu items that will be relevant, from left to right. More details will be provided
in the relevant sections of the tutorial.

Running man: Run simulation - based on instructions

Magnifying glasses: Zoom in, pan, zoom out, and zoom out to fit all data/components

Graphs: Select traces to view and autorange graphs.

Windows: Tile, Cascade, or Close windows

Pencil: Draw a wire

Ground: Add a ground

Boxed A: Label a net

Resistor: Add a resistor

Cap: Add a capacitor

Inductor: Add an inductor

Diode: Add a diode

AND gate: Add a component - opens up a window that looks like Fig. 2. The items surrounded by brackets are subfolders
with more components to select from.

Hands: Move and Drag - both move selected items around the schematic. The difference is that Move does not necessarily
maintain electrical connections, while Drag does, distorting wires around to fit.

Arrows: Undo and Redo

Es: Rotate and Flip Horizontally

Aa: Text comment

.op: SPICE directive

Fig. 2.

A. Keyboard Shortcuts
For many of the above buttons, there are some handy keyboard shortcuts that can save you some time:

F1: Help menu

F2: Add a component

F3: Draw a line

F4: Label net

F5: Delete (also Ctrl+X)

F6: Duplicate (also Ctrl+C)

F7: Move

F8: Drag

F9: Undo

shift+F9: Redo

R: Add resistor

C: Add capacitor

L: Add inductor

D: Add diode
G: Add ground

S: SPICE directive

Ctrl+R: Rotate

Ctrl+E: Flip Horizontally

Ctrl+A: Add Trace (for graphing results)

ESC: Cancel

B. Unit Convention
When assigning values, use the following convention for prefixes:

f: femto

p: pico

n: nano

u: micro

m: milli

k: kilo

meg: mega

g: giga

Its the standard prefix convention with the exception of mega - make sure you use meg instead of m (e.g.- 10MEGHz
instead of 10MHz for 10 megahertz.)
Units (volts, hertz, ohms) are automatically assumed, but adding them does not negatively affect anything.
American and European conventions are both valid - 1.8k and 1k8 are both acceptable values for a 1.8k resistor.
III. C REATING THE C IRCUIT
This section will detail how to build the buck converter circuit and set up the simulation commands.
A. Passive Components
Lets begin with the passive components - the voltage source, input and output capacitor, inductor, diode, and load resistor.
The voltage source (and current source, if needed) can be found under the component menu, and everything else can be easily
added using the menu bar or keyboard shortcuts.
To label the components with a name beyond an enumerated system, you can right click on the label and change the name
(ie- change the input capacitor from C1 to Cin).
If you right click any of the components, youll come up with a menu that looks like one of Fig. 3. For the voltage source,
this menu is accessed by right clicking the source and clicking Advanced. From here, you can see that you can provide
basic values of each component as well as parasitics, if this is known. Alternatively, if there is a specific part that you want
to use, clicking the button saying Select

(a) Diode

or Pick New Diode will open a database of parts to select from.

(b) Capacitor
Fig. 3.

(c) Inductor
Component Details

For now, lets give the following values to the components:

Input Voltage: 20 V
Inductor: 7.5 H

Input Capacitor: 10 F

Output Capacitor: 500 nF

(d) Resistor

Load Resistor: 15

We will use an ideal voltage source with no series resistances. Lets also add labels to the nodes, clearly denoting the input,
output, switching, and ground nodes. At this point, the circuit looks like Fig. 4.

Fig. 4.

B. Voltage Controlled Switch


In this demo circuit, we will use an ideal switch with some on state resistance. Instead of using a particular transistor model,
we instead use the voltage controlled switch, labeled sw under the component listing. This is a four terminal device as
seen in Fig. 5. As the name suggests, the switch is open or closed, depending on the voltage across the positive and negative
terminals.

Fig. 5.

To create the switching waveform that we need, we need a voltage source that creates a square wave. Lets add a second
voltage source to go across the switchs control terminals. Pulling up the advanced menu as in Fig. 6, we can see that there
are a variety of functions that we can generate with a voltage source. For the periodic square wave, select PULSE.
This function has the voltage source switch between two values. For now, set the values as such:

Vinitial[V]: 1

Von[V]: -1

Tdelay[s]: 0.75u

Trise[s]: 0

Tfall[s]: 0

Ton[s]: 0.25u

Fig. 6.

Tperiod[s]: 1u

Ncycles: 1000

This creates a PULSE command detailing that the voltage source will start with a value of 1 (so the switch is closed), and
change to -1 at t=.75s for a duration of .25s, with a period of 1s for 1000 cycles, or 1ms.
Why is a pulse between 1 and -1 sufficient for the voltage switch? This will be because of the model used for the switch.
LTspice requires a .model command detailing how the switch operates. This brings us to our next topic of SPICE directives.
C. SPICE directives
All active devices (diodes, transistors, switches, etc.) require models to define the device physics and properties. For this
demo, we can safely use the default diode model and not worry about entering a specific model or selecting a part from the
database.
The switch requires a model in order for a simulation to run - trying to run a simulation without a switch model returns
an error! To add a model, click the button for SPICE directive and type in .model SW SW(). This indicates that the model
for any devices with value SW (which includes the switch were using!) will assume the default model SW with all default
parameters.
You can find the parameters of the switch model in the help menu. There are a variety of parameters we can define for this
particular switch, but for now, lets only specify a lower on-state resistance; the other parameters will automatically use the
default values listed. Right click the directive you typed in previously and change it so it reads .model SW SW(Ron=500u).
NOTE: One of the default parameters is a threshold voltage of 0V. This indicates that the switch will close with any positive
voltage across the control terminals, and open with a negative voltage, explaining why the PULSE between 1 and -1 is sufficient
for this example.
You also need a SPICE directive to indicate the simulation that will be run. You can type this in directly using the SPICE
directive option, but under Simulate in the menu, there is an option labeled Edit Simulation Cmd. Using this, we can take
advantage of the template LTspice offers to construct the simulation directive. In this example, we want to look at the transient
simulation, up to 1ms.
In the command window that pops up (like in Fig. 7), enter 1m in the Stop Time box - the other boxes can be safely ignored
for now.

Fig. 7.

After entering in the SPICE directives and setting everything up, your circuit may look something like Fig. 8. This example
file can also be found here. Please note! Directive and command lines will be placed directly on the schematic, so arrange
them in such a way to avoid clutter and make things clear!

Fig. 8.

IV. S IMULATION R ESULTS


This section will detail how to view waveforms following the simulation run.
To run the simulation, simply press the Run button. The first time you run it, no waveform is selected as default, so instead
you simply get a black window. When you click the Pick Visible Traces button in the menu, or select Visible Traces from

the Plot Settings menu, the window in Fig. 9. The available options are the voltage at a particular node compared to ground
or the current through a device.
Please note: the nodes are based upon the labels you give. If there are no labels, the nodes will be enumerated n001, n002,
etc. It is much easier to work with if you have the significant nodes labeled. Please note: positive current is defined as the
current into the top node of a device in the default orientation.
For now, ctrl+click V(vin) and V(vout) to select both, and lets see what that looks like.

Fig. 9.

Fig. 10a shows the voltage results below. Nothing too interesting with regards to the input voltage, and we dont care too
much about the transient results before the system settles to a periodic steady state solution. We can zoom in using either the
magnifying glass button, or by clicking the axes to change the range. Zooming in, we can find the image from Fig. 10b. If
you ctrl+click the trace name, you pull up information on the average and RMS value of the signal for the current interval
defined by the graph.
Note: Ive re-sized the graph window and changed the trace color by right clicking on the signal name at the top of the
graph to make the screen easier to view here in this demo, but the default color of the second trace is blue.
If necessary, additional graph panes can be added from Plot SettingsAdd Plot Pane, and the horizontal axes can be
synced to look at the same time interval.
(Similarly, you can observe the current waveforms - for the sake of brevity, those screenshots are omitted. )
Examining the signal waveforms can allow you to observe and analyze how the converter operates. It also lets you check if
KCL and KVL for periodic steady state circuits is maintained. Checking the current through the output capacitor, for example,
can let you see that the average current in a period is nearly 0. The fact that it isnt could indicate that the system is still
settling to a steady state, but depending on what time interval youre looking at, if the average current is a couple orders of
magnitude lower than the RMS value, the system can reasonably be assumed to be in periodic steady state.
What about the voltage across the inductor? We will need to look at Vout-Vx (or Vx-Vout, whichever orientation you prefer
as long as you stay consistent) to see that. Under Plot Settings then Add trace, you can enter an expression to graph. This
allows us to look at voltage across nodes, as well as the power dissipated/sourced by relevant devices (voltage source, load
resistor).
A. Fourier Analysis
For some signals, visualizing and understanding the frequency content will help greatly. LTspice allows you to take signals
and run a Fast Fourier transform (FFT) to generate a frequency response curve for signals. Fig. IV-A shows two current
waveforms (through the load resistor and output capacitor) in the time domain and frequency domain.

(a)

(b)
Fig. 10.

To do this, you will find FFT under the View menu. Here, you can select specifics like which waveform to include
(although it looks like expressions you generate are not available to select), and the time range. Because of the initial transience,
its important to specify a time interval where the system is in periodic steady state!

(a)

(b)
Fig. 11.

B. Exporting Waveforms
If you would like access to the data to plot in Matlab, you can export the information. Under the File menu, you will find
Export. If you are in the time domain graphs, you can select any of the voltage/current waveforms for any node/device in
the schematic or any currently plotted expressions. If you are exporting fft data, you can only select from waveform signals
that you included then.

Вам также может понравиться