guida pratica spice

annuncio pubblicitario
GUIDA PRATICA
SPICE
LINK UTILI
→ LT Spice download page (vai alla pagina)
→ User Guide (vai alla pagina)
→ Avvisi sul corso o variazioni d’orario (vai alla pagina)
Dott. Mauro Mangia
Scopo delle simulazioni
COMPONENTI PASSIVI:
sistema di equazioni differenziali
comportamento di un
circuito elettrico
COMPONENTI ATTIVI:
sistema di equazioni non lineari
SIMULAZIONI funzionali attraverso
l’ausilio di calcolatori
2
Il simulatore usato
Simulatore SPICE (Simulator Program with Integrated Circuit Emphasis)
Sviluppato per la prima volta negli anni sessanta presso l’università statunitense di
Berkeley. Nasce come applicazione gratuita (spesso sviluppata dagli stessi studenti).
L’aumentare della complessità dei circuiti a la necessità di modelli sempre più accurati
ha portato alla realizzazione di pacchetti software (non solo free) molto potenti basati
su accurati metodi numerici.
Pacchetti software presenti sul mercato
• OrCAD PSpice : Tra i più diffusi e sviluppati. E’ possibile scaricare una versione
student con funzionalità limitate (numero limitato ti transistor instanziabili, limite sul
tempo di osservazione della simulazione, …) .
• LTSPICE : pacchetto software completamente gratuito senza alcun limite nel
numero di transistori instanziabili e nel tempo di simulazione. (consigliato)
• vari…
3
Struttura del simulatore
text
editor
*.cir
SGE
*.sch
*.out
text
editor
*.dat
probe
SPICE
*.lib
Schematic Grafic Editor
4
Struttura di una Netlist
R1 = 100 Ohm
2
1
+
_
V1 = 6 V
R2 = 50 Ohm
0
*titolo file
.LIB
.INCLUDE
.TEMP
.OPTION
nome (obbligatorio)
sezione COMANDI
…
.MODEL
sezione MODELLI
.SUBCKT
…
.ENDS
V1 1 0 DC 6V
R1 1 2 100
R2 2 0 50
SUB-CIRCUITO
…
netlist
…
.OP
.TRAN
.DC
.AC
sezione ANALISI
…
.PROBE
.PRINT
sezione USCITE
…
.END
FINE
5
Componenti PASSIVI
Resistenza
n+
nota :
R<nome> <n+> <n-> [modello] <val>
<…> campo obbligatorio
[…] campo opzionale
n-
Capacità
n+
C<nome> <n+> <n-> [modello] <val> IC=<Vin>
Vin rappresenta la tensione iniziale del condensatore
(utile nell’analisi del comportamento in transitorio )
n-
Induttanza
n+
L<nome> <n+> <n-> [modello] <val> IC=<Iin>
Iin rappresenta la corrente iniziale nell’induttanza
(utile nell’analisi del comportamento in transitorio )
n-
6


0
con
0  t  Td1
I (t ) 
Tr
Tf
t Td 1



IIdeali
(It=
) 
Tc
1
PER
Iin  ( Ip  Iin) 1  e
con Td1  t  Td 2


PWL (0,0) (1m,1) (2m,0)
(3m,1) (4m,0)
n+


generatore di tensione

t TdDC
1 <value>
t Td 2
V<nome> <n+>
<n->




 [AC <amp> [<fase>]] [...]
I 1  Iin  ( Ip  Iin) 1  e Tc1  1  e Tc 2  con Td 2  t  Tstop

generatore
di corrente




PW
Iin
GENERATORI
n+
V
I<nome> <n+> <n-> DC <value> [AC <amp> [<fase>] ][...]
n-
n-
descrizione aggiuntiva
phase 
 Td

Ioff

Iamp

sen
2



- di tipo eponenziale

360



 <Td1>
1m
2
m
3
m
4
m
EXP(<Iin>
<Ip>
<Tc1>
<Td1>
<Td2>)
I (t )  
t Td
phase






df
 Ioff  Iamp  sen 2 freq  t  Td  
- di tipo impulsivo
e






 <Ip> <Td> <Tr> <Tf> <PW> <PER>)  360   
PULSE(<Iin>
t
t
0  t  Td
Td  t  Tstop
- di tipo lineare a tratti
PWL(Time, Val)
- di tipo sinusoidale
SIN(<Ioff> <Iamp> <freq> <Td> <df> <phase>)
nota :
per il comportamento in transitorio di un generatore di tensione sostituire V ad I.
7
GENERATORI
di tensione comandati
n+
comandati in tensione
E<nome> <n+> <n->
comandati in corrente
H<nome> <n+> <n->
V=(-)
n-
<nc+> <nc-> <g>
⇒V = g (Vnc+-Vnc-)
VALUE=<espressione>
⇒V = espressione
<Vname> <g>
⇒V = g Iname
VALUE=<espressione>
⇒V = espressione
<nc+> <nc-> <g>
⇒I = g (Vnc+-Vnc-)
VALUE=<espressione>
⇒ I = espressione
<Vname> <g>
⇒ I = g Iname
VALUE=<espressione>
⇒ I = espressione
di corrente comandati
n+
comandati in tensione
G<nome> <n+> <n->
comandati in corrente
F<nome> <n+> <n->
I=(-)
n-
8
Dispositivi ATTIVI
per tutti i dispositivi attivi bisogna istanziarne un modello con il comando .MODEL
Diodo
n+
I  I s (e
V
nVT
 1)
VT 
k T
q
I
 dI 
gd   
 c0
 dV V0 , Ic 0 nV0
D<nome> <n+> <n-> <nome modello> [area]
…
n-
.MODEL<nome modello> <tipo modello> [<PARAM>=<VALUE>]
(example .MODEL <nome modello> D n=1.1)
Transistor BJT
VBE
VT
I c  I s (e
 1); I B  I c /  F ; I E  I C  I B
Q<nome> <C> <B> <E> [<SUB>] <nome modello> [area]
…
.MODEL<nome modello> NPN(op PNP) [<PARAM>=<VALUE>]
9
Dispositivi ATTIVI
Transistor MOS
D
G
B
M<nome> <D> <G> <S> <B> <nome modello> [<PARAM>=<VALUE>]
…
.MODEL<nome modello> NMOS(op PMOS) LEVEL=<numero> [<PARAM>=<VALUE>]
S
livello 1
I DS


 '
W
 n
 2 L



VGS  VTN
0
 2 VGS  VTN VDS  VDS 2  0  VDS  VGS  VTN
n ' W
2 L
VGS  VTN 2
0  VGS  VTN  VDS
VTN  VTN0   n ( N  VDS  N )
fattore moltiplicativo
(1  VDS );  n '  n COX  n
 OX
tOX
10
comando .SUBCKT
.SUBCKT <nome> <p1> <p2> …<pn> [PARAM: <par>=<value>]]
…
.ENDS
Il comando permette la realizzazione di sottocircuiti all’interno della netlist caratterizzati da
una completa dissociazione dalla rete principale, nel senso che: 1) i nodi interni hanno
visibilità esclusivamente locale; 2) la funzionalità del sottocircuito può essere descritta
analiticamente o circuitalmente; 3) il sottocircuito può essere parametrizzato.
ESEMPIO: descrizione di un OPAMP
* Realizzazione OPAMP
inP
inN
+
-
Out
.SUBCKT OPAMP inP inN Out PARAMS: VUMP=10 VUMN=-10 AD=400K
E1 Out 0 VALUE={MAX(MIN(AD*v(inP,inN),VUMP),VUMN)}
.ENDS
Ving 1 0 DC 0 AC 1 sin(0 1 50 000)
XAMP 1 0 3 OPAMP PARAMS: AD=500K
Rload 3 0 1K
.DC LIN Ving -2.5 2.5 70m
.PROBE
.END
11
tipi di analisi
.OP punti di riposo del circuito
Perform a DC operating point solution with capacitances open circuited and
inductances short circuited. Usually a DC solution is performed as part of another
analysis in order to find the operating point of the circuit. Use .op if you wish only this
operating point to be found. The results will appear in a dialog box.
There is no guarantee that the operating point of a general nonlinear circuit can be
found with successive linear approximations as is done in Newton-Raphson iteration.
Should direct Newton iteration fail, LTspice tries a number of other methods to find an
operating point.
12
tipi di analisi
.DC analisi in continua
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.
.dc <srcnam> <Vstart> <Vstop> <Vincr>
+ [<srcnam2> <Vstart2> <Vstop2> <Vincr2>]
The <srcnam> is either an independent voltage or current source that is to be swept
from <Vstart> to <Vstop> in <Vincr> step sizes. In the following example, the default
MOS characteristic curves are plotted:
* example DC
M1 2 1 0 0 nmosD
Vgs 1 0 3.5
Vds 2 0 3.5
.dc Vds 3.5 0 -0.05 Vgs 0 3.5 0.5
.model nmosD NMOS Level=1
.save I(Vds)
.end
13
tipi di analisi
.AC analisi in frequenza a i piccoli segnali
The small signal(linear) AC portion of LTspice computes the AC complex node voltages
as a function of frequency. First, the DC operating point of the circuit is found. Next,
linearized small signal models for all of the nonlinear devices in the circuit are found for
this operating point. Finally, using independent voltage and current sources as the
driving signal, the resultant linearized circuit is solved in the frequency domain over the
specified range of frequencies. This mode of analysis is useful for filters, networks,
stability analyses, and noise considerations.
.AC <oct, dec, lin> <Nsteps> <StartFreq> <EndFreq>
The frequency is swept between frequencies StartFreq and EndFreq. The number of
steps is defined with the keyword "oct", "dec", or "lin" and Nsteps according to the
following table:
Keyword
Nsteps
Oct
Dec
Lin
No. of steps per octave
No. of steps per decade
Total number of linearly spaced steps between StartFreq and EndFreq
14
tipi di anailisi
.TRAN analisi in transitorio
Perform a transient analysis. This is the most direct simulation of a circuit. It basically
computes what happens when the circuit is powered up. Test signals are often applied
as independent sources.
.TRAN <Tstep> <Tstop> [Tstart [dTmax]] [modifiers]
.TRAN <Tstop> [modifiers]
The first form is the traditional .tran SPICE command. Tstep is the plotting increment
for the waveforms but is also used as an initial step-size guess. LTspice uses
waveform compression, so this parameter is of little value and can be omitted or set to
zero. Tstop is the duration of the simulation. Transient analyses always start at time
equal to zero. However, if Tstart is specified, the waveform data between zero and
Tstart is not saved. This is a means of managing the size of waveform files by allowing
startup transients to be ignored. The final parameter dTmax, is the maximum time step
to take while integrating the circuit equations. If Tstart or dTmax is specified, Tstep
must be specified.
15
Dott. Mauro Mangia
ARCES via Toffano 2/2 Bologna
[email protected]
[email protected]
www.unibo.it
Scarica