spice algorithm
Post on 10-Feb-2018
220 Views
Preview:
TRANSCRIPT
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 1/32
Department of Electrical and Electronic EngineeringImperial College London
EE 2.3: Semiconductor Modell ing in SPICECourse homepage:http://www.imperial.ac.uk/people/paul.mitcheson/teaching
SPICE algorithms and internals
Paul D. Mitchesonpaul.mitcheson@imperial.ac.ukRoom 1111, EEE
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 1
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 2/32
Aims and Objectives
1.1.
1.2.
Course Aims
• To show how SPICE solves circuit problems• To explain the three main SPICE semiconductor models
Learning Objectives
By the end of these lectures you should be able to:• Understand the internal operation of 3 types of simulation in SPICE• Know what the SPICE model parameters mean and how they relate to physical
quantities
• Appreciate the issue of simulation convergence and how the semiconductor modelsused try to improve convergence• Be able to use your own custom semiconductor models in SPICE (see study group
sheet)
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 2
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 3/32
2. Syllabus• SPICE internals and algorithms• SPICE semiconductor models
o Diodeo BJT
o MOSFET
3. Problem SheetAn exercise done in SPICE in the labs which gets you used to the SPICE model parameters, and shows you some of the dynamic effects of devices that you have seen thetheory for in the first part of the course.
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 3
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 4/32
4. Recommended Reading
This part of the devices course is relatively self contained. If, however, you want to knowmore about SPICE, the following are good books:
• “Semiconductor Device Modelling with SPICE” , Giuseppe Massobrio and PaoloAntognetti, McGraw-Hill Inc.
• “Inside SPICE, overcoming the obstacles of circuit simulation” , Ron Kielkowski,McGraw-Hill Inc.
• “SPICE for circuits and electronics using PSpice”, Muhammad H. Rashid, Prentice
Hall
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 4
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 5/32
5. Introduction
• You received an introduction to SPICE in the first year design project. Briefly, toremind you of the history and development of the software:
• SPICE (Simulation Program with Integrated Circuit Emphasis) is a well-known
circuit simulator computer program which began with a mainframe program written atUC Berkeley by Lawrence Nagel (and others) during his PhD.
• The SPICE solver or “engine” (the core part of the program i.e. the part that solves thecircuit equations) is free software but it is command line driven and is thus regardedas difficult to use.
• Commercial versions (mostly based on the 2G7 release of the Berkeley program[PSpice is based on 2G7]) are available which provide a graphical interface and up to
date component libraries
• In this part of the course we will look briefly at the internal workings of SPICE, thesemiconductor models that are used and how they relate to the device theory you havealready studied.
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 5
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 6/32
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 7/32
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 8/32
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 9/32
SPICE always tries to solve for nodal voltages which satisfy KCL by forming an equationof the form:
[ ] [ ] [ ] I V G =×
The current matrix is known. This is important.
• Mostly the entry in the current matrix will be zero – as KCL requires currents into anode sum to zero),
• It will be non-zero if an active device, such as a current source, is present. In otherwords, the I matrix lists the current being actively injected into each node.
Changing the current source for a voltage source makes it harder to solve(!)
Let’s try doing the same thing with voltage sources:
[ ] [ ] [ ]V I R =×
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 9
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 10/32
Consider the circuit below and the equivalent nodal equations
Figure 2 Simple circuit with voltageexcitation
05
211 =
−+−
V V I
05105
32212 =−++− V V V V V
0
105
323 =−− V V V
• We cannot form the matrix equations – the voltages at the nodes (other than n1)are not known – we do not know the [V] matrix in its entirety and thus cannot
perform Gaussian elimination!
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 10
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 11/32
Therefore, we would like to analyse circuits with current sources instead of voltage
sources because the [I] matrix is always known, and we can therefore solve the circuit
using Gaussian elimination. This is a special property about current excited circuits.
Remarkable but true!
So how do we cope with a voltage source in the circuit? After all, power supplies andbatteries are voltage sources, not current sources!
Use a Norton Equivalent circuit argument. Although it is not always clear how to
do this as we will now see.
It is clear that in the case of Figure 2 on the last slide, the voltage source and currentsource could easily be converted into a Norton equivalent source. But….
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 11
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 12/32
How can you convert this circuit with branches into a Norton source?
Figure 3 Tricky to convert to a Norton source?
Figure 4 Not really!
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 12
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 13/32
6.2. Solving circuits with non-linear elements
Let’s look at a simple circuit with a diode present. What happens to the matrix equationthat SPICE has to work with?
Consider the following circuit with just 1 unknown node:
0exp2
5 11 =++−t v
V Is
V
This single nodal KCL equation is a transcendental (meaning it is an equation involving
terms other than simple polynomials which generally cannot be rearranged so that thevariable becomes the subject of the equation) and thus the equation can only be solvednumerically.
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 13
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 14/32
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 15/32
Let’s remind ourselves how this works. The Newton-Raphson algorithm is as follows:
)('
)(1
n
nnn
V F
V F V V −=+
• Where V n+1 is the voltage at the next iteration and V n is the voltage at the currentiteration. This does not mean the voltage at node n or node n+1.
• For the simple circuit above:
11
1 5.0exp5)( V V
V I V F
t
s −⎟⎟ ⎠
⎞⎜⎜⎝
⎛ −=
Therefore we have:
5.0exp
5.0exp5
1
1
11
11 1
−⎟⎟ ⎠
⎞⎜⎜⎝
⎛ −
−⎟⎟ ⎠ ⎞⎜⎜
⎝ ⎛ −
−=+
t
s
t
s
V
V V I
V V V I
V V
n
n
n
n
nn
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 15
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 16/32
6.3. Bringing it all togetherSo, in a slightly larger circuit, let’s see what happens:
Firstly, all voltage sources are replaced with current sources to give a circuit that looks
something like the example below:
Figure 5 Solve using Gaussian Elimination and Newton-Raphson
The equations are:
0
5
3 12 =−
+V V
0exp
1052212 =⎟⎟ ⎠
⎞⎜⎜⎝
⎛ ++
−
t
sV
V I
V V V
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 16
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 17/32
These can be formed into the following matrix equations:
⎥⎥
⎦
⎤
⎢⎢
⎣
⎡
⎟⎟ ⎠
⎞⎜⎜⎝
⎛ =⎥⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡
−
−
t
sV
V I V
V 2exp
3
2
1
3.02.0
2.02.0
• To solve these matrix equations, SPICE first uses Gaussian elimination to form thefollowing matrices:
⎥⎥
⎦
⎤
⎢⎢
⎣
⎡
−⎟⎟ ⎠
⎞⎜⎜⎝
⎛ =⎥⎦
⎤⎢⎣
⎡⎥⎦
⎤⎢⎣
⎡
−
−3exp
3
2
1
1.00
2.02.02
t
sV
V I V
V
• Then, Newton-Raphson will be used to solve the transcendental equation for V 2, before back substitution is used to find V 1.
• We now have an idea how SPICE can solve with resistors, but what about L and C?
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 17
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 18/32
How are inductors and capacitors solved in a DC bias point simulation?
Simple - Capacitors are set open circuit and inductors to short circuit.
You now know the basics of how SPICE solves operating point (static DC analysis)
problems!
The topic of Newton-Raphson brings us nicely onto the next topic…
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 18
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 19/32
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 20/32
• There are limits that must be set by the SPICE user for the accuracy of the simulations
(or, as you have done up to now, you can simply accept the default values). Theimportant parameters are:
RELTOL – Fractional tolerance of voltages and currentsVNTOL – Node voltage toleranceABSTOL – Current branch toleranceITL1 – The number of iterations allowed for a bias point calculation
• If we only have tolerances on voltages, non-linear elements may cause problems with branch currents
• The ABSTOL parameter was introduced in SPICE version 2 to overcome this problem
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 20
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 21/32
Thus, the flow of the program is thus:
1. If number of iterations > ITL1, break
2. Do Newton-Raphson iteration to solve for nodal voltages
3. Check the solutions against VNTOL and RELTOL
4. If solution not converged within parameters, goto 2, else goto 5
5. Check branch currents (known from the nodal voltages) against ABSTOL and
RELTOL
6. If not converged, goto 1 else finish
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 21
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 22/32
7.2. Convergence Problems – An example
• Let’s consider SPICE trying to solve the following simple circuit DC bias analysiswith the Newton-Raphson algorithm and see where we might run into trouble.
• We’ll do Newton-Raphson graphically to see how the problems might arise.
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 22
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 23/32
Figure 6 Initial guess
V12V11
Figure 7 First iteration
V12V11
V13 Figure 8 Second iteration
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 23
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 24/32
• Imagine that the first guess had been at a lowervoltage. Then the tangent at the first iteration
would be almost vertical and the algorithm canget stuck.
• There are convergence problems associatedwith very high conductance
• There are convergence problems associatedwith very high resistance
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 24
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 25/32
7.3. The GMIN Convergence Parameter
• GMIN is a pure conductance and one is placed in parallel with every pn junctionimplemented in SPICE.
• Designed to stop divide by zero errors when simulating the exponentials of pn
junctions, and to reduce the problem that an iteration may take the next voltageiteration far from the final solution.
Figure 9 pn junction with GMIN convergence parameter
• This means that the slope of the exponential of the diode in reverse bias is at leastequal to GMIN.
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 25
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 26/32
• In addition, GMIN is the minimum conductance allowed between any twoneighbouring nodes in SPICE. If you set a resistance between two nodes with a
conductance of less than GMIN, the simulator will not run.
• Be careful when you set GMIN -• Think before you simulate! Will it alter the outcome of the simulation?
7.4. Setting the convergence parameters
Alter the convergence parameters in
Tools|PSpice|Options
• Why alter the defaults?
• Think about the simulation you arerunning
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 26
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 27/32
How do the other sorts of simulation work in SPICE?
7.5. DC sweep simulations
• An extension to the bias point simulation.
• The steady state solutions to a circuit are simulated for a range of DC voltages of achosen voltage source in the circuit
• For the first voltage value to be simulated, SPICE does iterations to find the bias pointin the normal way.
• The outcome of this simulation is then used as the starting points for the nodalvoltages for the first value in the DC sweep and so on…
• Problems can arise in convergence when a voltage changes particularly quickly.
• There is also an ITL2 parameter
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 27
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 28/32
7.6. AC Simulations
• So far, we have seen SPICE effectively solve linear and non-linear elements in DCsimulations.
• Performing an AC simulation is not so different from a DC simulation!
• This is because SPICE does not simulate non-linear elements in the AC simulation -no Newton-Raphson
• When you do an AC simulation in SPICE to get a bode plot of a circuit’s frequency
response, the simulator makes linearised small-signal models of any non-lineardevices. These are essentially the same models as you have seen in your analogueelectronics course.
• SPICE solves the nodal equations in almost exactly the same way as it would for a
DC simulation – only now the program cannot set inductances to short circuits andcapacitors to open circuit. They simply become complex impedances.
• Consequently, at each given frequency, SPICE solves the matrix equations of the
form [G][V]=[I], where the matrices now become complex.EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 28
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 29/32
Example of an AC solution
05
3 21 =−
+−V V
05105
32212 =−++− V V V V V
0505 3
23 =−−
V jV V
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
=
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡
−−
−−
−
0
0
3
502.02.00
2.05.02.0
02.02.0
3
2
1
V
V
V
j and solve using Gaussian elimination…
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 29
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 30/32
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 31/32
7.7. Large signal Transient Simulations
• These are the most complex type of simulation because they show the completesemiconductor models realistically at all operating points – the full non-linear modelsare used (as in a DC bias point simulation – and therefore Newton-Raphson is heavilyused)
• In contrast to the DC bias point simulations, capacitors and inductors cannot be set toopen and short circuit respectively.
• SPICE makes heavy use of numerical integration in these simulations. The exactdetail of these simulations is however beyond the scope of this course for the time wehave.
So, what models does SPICE use internally for its semiconductor devices and how do theyrelate to the understanding you already have of semiconductor devices? We will look atthe three most common devices, the p-n diode, the BJT and the MOSFET, starting nexttime.
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 31
7/22/2019 SPICE Algorithm
http://slidepdf.com/reader/full/spice-algorithm 32/32
8.
9.
Summary of this Lecture
• SPICE likes to work with current excited circuits. Voltage excited circuits go thoughThevenin to Norton transformation
• This allows Gaussian elimination to be used to solve the matrices
• Newton-Raphson is used to solve equations with non-linear elements (such as diodes)
• Convergence aids are used to control simulation accuracy and to slightly modify non-linear devices to improve convergence
• The DC sweep and AC simulations are simple extensions to the DC bias pointsimulation. The transient simulation is more complex and beyond the scope of thiscourse.
Next time….
• We will look at the SPICE diode model
EE2.3 Semiconductor Modelling in SPICE / PDM – v1.0 32
top related