Uploaded by joaocarlos.marra

LTSpiceIntro

advertisement
Introduction to LTspice
Acknowledgment: LTspice material based in part by
Devon Rosner (6.101 TA 2014), Engineer, Linear Technology
6.101 Spring 2020
Lecture 4
SPICE
• Simulation Program with Integrated
Circuit Emphasis
• Developed in 1973 by Laurence Nagel at
UC Berkeley’s Electronics Research
Laboratory
• Dependent on user defined device
models
6.101 Spring 2020
Lecture 4
2
Netlists
Components
Commands
6.101 Spring 2020
Lecture 4
3
LTspice
• Developed in 1998 by Mike Engelhardt at Linear
Technology Corporation
• GUI, simulator, and schematic -> netlist for SPICE
• FREE and comes with tons of models
Ltspice makes this
You do this
6.101 Spring 2020
Lecture 4
4
Getting Started
THAT’S IT!
These buttons are where you will live
6.101 Spring 2020
Lecture 4
5
Component to Menu Item Matchup
6.101 Spring 2020
Lecture 4
6
Net Labels
By labeling nets you can avoid a giant mess of wires. Always use
these for at least your power supplies. When you start making
large circuits, your power supplies will provide energy all over your
schematic.
6.101 Spring 2020
Lecture 4
7
Adding Other Components
Devices besides basic resistors, capacitors, and
inductors are found from this button
6.101 Spring 2020
Lecture 4
8
Op-Amps
There are no “ideal” op-amps in reality. BUT, there are in LTspice.
PAY CLOSE
ATTENTION
TO THE TEXT
You must
literally include
.lib opamp.sub
in your netlist
or schematic
as a SPICE
directive.
6.101 Spring 2020
Lecture 4
9
Op-Amps
Though listed as “ideal” there are still 2 parameters
you can tweak.
Open Loop Gain: As this
number approaches infinity,
the Op Amp becomes more
“ideal”. Look at some Op Amp
data sheets to see some real
open loop gains.
Gain Bandwidth: As this
number approaches infinity,
the Op Amp becomes more
“ideal”. To check if this is high
enough, multiply your desired
Closed Loop Gain by your
highest desired output
frequency.
6.101 Spring 2020
Lecture 4
10
Op-Amps
To more accurately model a real Op Amp not available in LTspice,
UniversalOpamp2 has many tweakable parameters.
Open loop gain, gain
bandwidth, slew rate, current
limit, rail-rail voltage, input
voltage offset, phase margin,
Rin, etc.
6.101 Spring 2020
Lecture 4
11
Editing Components
Just right click the
component
6.101 Spring 2020
Lecture 4
12
Editing Components
But what
about this?
This is the basic voltage source menu.
Use this for DC sources such as power
supplies or bias voltages.
6.101 Spring 2020
Lecture 4
13
Editing Components
Voltage sources can produce many test signals.
PWL can be used to construct any signal.
6.101 Spring 2020
Lecture 4
14
Selecting Device Model
There are no “ideal” BJT’s, MOSFET’s, etc. You can select a model
(provided by LTspice), download models, or create your own.
6.101 Spring 2020
Lecture 4
15
Simulation: Transient
Transient simulation gives Voltage and/or Current
vs.time.
These are transient
parameters for
a voltage source
6.101 Spring 2020
Lecture 4
16
Simulation: Transient
This is all you
really need
6.101 Spring 2020
Lecture 4
17
Random Tangent: Parameters
This is a
parameter
6.101 Spring 2020
You MUST define all of your parameters.
The “list” command allows you to choose
multiple values (simulation simulates each
value separately).
Lecture 4
18
What Should My Circuit Do?
• The very first step to any simulation is to know how
your circuit should behave. Simulation is a verification
tool NOT A CIRCUIT SOLVER.
• So how should this circuit behave?
6.101 Spring 2020
Lecture 4
19
Here’s Where You Write the Solution
6.101 Spring 2020
Lecture 4
20
Here’s Where You Write the Solution
i2
i1
vo
vx
i3
A DOUBLE POLE!!
6.101 Spring 2020
Lecture 4
21
Expected Behavior
• Double pole is at:
• We expect frequencies up to this point to be
large, but frequencies above to quickly drop
off due to the -40 dB/decade characteristic
of the double pole
6.101 Spring 2020
Lecture 4
22
Transient Simulation
Hover over the desired
voltage node to be probed and
click when you see this symbol
**This is the current probe
6.101 Spring 2020
Lecture 4
23
Transient Simulation
1 kHz
10 kHz
100 kHz
1 MHz
6.101 Spring 2020
Lecture 4
24
AC Simulation
AC simulation gives Voltage and/or Current
vs.frequency.
6.101 Spring 2020
Lecture 4
This is the AC
parameter.
Just set the
amplitude to 1
25
AC Simulation
6.101 Spring 2020
Lecture 4
26
Extra Fun: Math in LTspice
Remember:
6.101 Spring 2020
Lecture 4
27
Transient Simulation
It’s the same as before!
6.101 Spring 2020
Lecture 4
28
Even More Fun
*Note: You can try out some math functions in the simulator
window, too! (ex: V(Vo)/V(Vi)).
6.101 Spring 2020
Lecture 4
29
AC Simulation
6.101 Spring 2020
Lecture 4
30
Temperature as a Variable
• PTAT current source
6.101 Spring 2020
Lecture 4
31
Temperature as a Variable
6.101 Spring 2020
Lecture 4
32
Including External Models
• PFET model
• Includes
parameters to
describe MOS
device physics
6.101 Spring 2020
Lecture 4
33
Making Things Pretty
6.101 Spring 2020
Lecture 4
34
Making Things Pretty
6.101 Spring 2020
Lecture 4
35
Making Things Pretty
Bob Reay of Linear Technology has provided a nifty tool on his website to
give LTspice circuits an even better makeover:
http://reaylabs.com/tools/SchematicViewer/SchematicViewer.html
Before:
6.101 Spring 2020
Lecture 4
36
Making Things Pretty
Bob Reay of Linear Technology has provided a nifty tool on his website to
give LTspice circuits an even better makeover:
http://reaylabs.com/tools/SchematicViewer/SchematicViewer.html
After:
6.101 Spring 2020
Lecture 4
37
LTspice Secrets
Many aspects and functions of LTspice are not documented. You
can learn lots of interesting undocumented capabilities of LTspice
from:
http://ltwiki.org/?title=Undocumented_LTspice
Of particular interest should be B-sources. These allow you to
make devices such as non-linear resistors whose value is
determined from a function of voltage, current, if statements,
constants, etc. Though you cannot build these, they may be useful
to model a part not available in LTspice, or to model a special
function in your circuit you have not designed yet.
6.101 Spring 2020
Lecture 4
38
Questions??
6.101 Spring 2020
Lecture 4
39
M odes
View
F8 – Drag
F9 – Undo
Shift+F9 – Redo
Ctrl+Z – Zoom Area
Ctrl+B – Zoom Back
F8 – Drag
F9 – Undo
Shift+F9 – Redo
Ctrl+Z – Zoom Area
Ctrl+B – Zoom Back
Ctrl+G – Toggle Grid
‘0’ – Clear
Ctrl+W – Attribute Window
Ctrl+A – Attribute Editor
Ctrl+G – Toggle Grid
U – Mark Unncon. Pins
A – Mark Text Anchors
R – Rectangle
C – Circle
L – Line
A – Arc
C – Capacitor
L – Inductor
D – Diode
Ctrl+E – Mirror
Ctrl+R – Rotate
Ctrl+E – Mirror
Ctrl+R – Rotate
F4 – Label Net
F2 – Component
T – Text
S – Spice Directive
T – Text
Ctrl+H – Halt Simulation
Ctrl+H – Halt Simulation
R – Resistor
G – GND
Ctrl+Click - Average
Ctrl+Click – Attr. Edit
analog.com
LTspice
Ctrl+H – Halt Simulation
Ctrl+R – Run Simulation
Ctrl+G – Goto Line #
Use ASCII .raw files. (Degrades performance!)
Run in batch mode.
-ascii
-b
Convert a binary .raw file to Fast Access Format
Convert a schematic to a netlist
Prevent use of WINE(Linux) workarounds
Convert a schematic to a PCB netlist
Store user preferences in the registry
Start simulating the schematic on open
Allow MOSFET’s to have up to 7 nodes in subcircuit
Executes one step of the uninstallation process
Force use of WINE(Linux) workarounds
-FastAccess
-netlist
-nowine
-PCBnetlist
-registry
-Run
-uninstall
-wine
-SOI
Encrypt a model library
-encrypt
-big or -max Start as a maximized window
Short Description
Flag
Command Line Switches
Ctrl+Y – Vertical Autorange
Atl+Click – Power
Ctrl+A – Add Trace
Ctrl+E – Zoom Extents
Space – Zoom Fit
Ctrl+B – Zoom Back
Ctrl+Z – Zoom Area
Shift+F9 – Redo
Shift+F9 – Redo
F7 – Move
F7 – Move
F9 – Undo
F6 – Duplicate
F6 – Duplicate
1e-9
FALSE 0
1.602176462e-19
1.3806503e-23
TRUE 1
Q
K
1e-3
1e-6
3.14159265358979323846
2.7182818284590452354
Mil 25.4e-6
M
K
1e3
n
u
1e9
G
Meg 1e6
Pi
E
1e-12
1e-15
f
p
1e12
Constants
Write Selected Nodes to a .WAV file
Do a Nonlinear Transient Analysis
Find the DC Small-Signal Transfer Function
Temperature Sweeps
Define a Subcircuit
Parameter Sweeps
Save Operating Point to Disk
Limit the Quantity of Saved Data
User-Defined Parameters
Set Simulator Options
Find the DC Operating Point
Perform a Noise Analysis
Supply Hints for Initial DC Solution
Compute Network Parameters in a .AC Analysis
Define a SPICE Model
Evaluate User-Defined Electrical Quantities
Load a Previously Solved DC Solution
Include a Library
Include another File
Set Initial Conditions
Declare Global Nodes
Download a File Given the URL
User Defined Functions
Compute a Fourier Component
End of Subcircuit Definition
End of Netlist
Perform a DC Source Sweep Analysis
Annotate Subcircuit Pin Names on Port Currents
Perform a Small Signal AC Analysis
Suffix
T
Suffix
.WAVE
.TRAN
.TF
.TEMP
.SUBCKT
.STEP
.SAVEBIAS
.SAVE
.PARAM
.OPTIONS
.OP
.NOISE
.NODESET
.NET
.MODEL
.MEASURE
.LOADBIAS
.LIB
.INCLUDE
.IC
.GLOBAL
.FERRET
.FUNC
.FOUR
.ENDS
.END
.BACKANNO
.AC
.DC
F9 – Undo
Netlist
F5 – Delete
F5 – Delete
Waveform
Simulator Directives – Dot Commands
Command
Short Description
F5 – Delete
ESC – Exit Mode
Symbol
LTspice HotKeys
F3 – Draw Wire
ESC – Exit Mode
Schematic
©2018 Analog Devices, Inc. All rights reserved. Trademarks and
registered trademarks are the property of their respective owners.
Ahead of What’s Possible is a trademark of Analog Devices.
LTspice-6/18(E)
Pl a ce
LTSPICE SHORTCUTS ON A MAC
11/5/2013 REV 3
a
b
g
l
s
t
w
DRAW CIRCLE
BUS TERMINATION
GROUND
DRAW LINE
ADD SPICE DIRECTIVE (right click for HELP ME EDIT)
ADD TEXT COMMENT
DRAW BOX
z
z
z
z
z
z
z
H
L
N
O
Q
S
Z
⇧z Z
z
M
⌥z M
z
W
⌥z W
z
P
⇧z P
HIDE LTSPICE
SPICE LOG
NEW SCHEMATIC
OPEN
QUIT LTSPICE
SAVE
UNDO
REDO
MINIMIZE
MINIMIZE ALL
CLOSE
CLOSE ALL
PRINT
page seupt
F2
F3
F4
F5
F6
F7
F8
F9
COMPONENT
WIRE
NET NAME
DELETE
DUPLICATE
MOVE (CNTRL-R to rotate, CNTRL-E to mirror)
DRAG (CNTRL-R to rotate, CNTRL-E to mirror)
UNDO
REDO
⇧F9
SPACE BAR
2 FINGER PINCH
2 FINGER SPREAD
ZOOM TO FIT
ZOOM IN
ZOOM OUT
Here are the modifier key symbols you may see in OS X menus:
z
⌥
⇧
COMMAND
ALT OR OPTION
SHIFT
Download