Post on 03-May-2015
Dott. Mauro Mangia
GUIDA PRATICA
SPICE
→ LT Spice download page (vai alla pagina)
→ User Guide (vai alla pagina)
→ Avvisi sul corso o variazioni d’orario (vai alla pagina)
LINK UTILI
Scopo delle simulazioni
2
comportamento di un circuito elettrico
COMPONENTI PASSIVI:sistema di equazioni differenziali
COMPONENTI ATTIVI:sistema di equazioni non lineari
SIMULAZIONI funzionali attraversol’ausilio di calcolatori
Il simulatore usato
3
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…
Struttura del simulatore
4
*.cir
*.sch
texteditor
SGE
Schematic Grafic Editor
SPICE
*.lib
*.out
*.dat
texteditor
probe
Struttura di una Netlist
5
*titolo file.LIB.INCLUDE.TEMP.OPTION…
.MODEL
.SUBCKT …
.ENDS… netlist…
.OP
.TRAN
.DC
.AC…
.PROBE
.PRINT…
.END
*titolo file.LIB.INCLUDE.TEMP.OPTION…
.MODEL
.SUBCKT …
.ENDS… netlist…
.OP
.TRAN
.DC
.AC…
.PROBE
.PRINT…
.END
sezione COMANDI
sezione MODELLI
sezione ANALISI
SUB-CIRCUITO
sezione USCITE
FINE
+_
V1 = 6 V
R1 = 100 Ohm
R2 = 50 Ohm
V1 1 0 DC 6VR1 1 2 100R2 2 0 50
V1 1 0 DC 6VR1 1 2 100R2 2 0 50
1 2
0
nome (obbligatorio)
Componenti PASSIVI
6
Resistenza
Induttanza
Capacità
n+
n-
n+
n-
n+
n-
R<nome> <n+> <n-> [modello] <val>
C<nome> <n+> <n-> [modello] <val> IC=<Vin>
L<nome> <n+> <n-> [modello] <val> IC=<Iin>
Vin rappresenta la tensione iniziale del condensatore(utile nell’analisi del comportamento in transitorio )
Iin rappresenta la corrente iniziale nell’induttanza(utile nell’analisi del comportamento in transitorio )
nota :<…> campo obbligatorio […] campo opzionale
nota :<…> campo obbligatorio […] campo opzionale
V<nome> <n+> <n-> DC <value> [AC <amp> [<fase>]] [...]
I<nome> <n+> <n-> DC <value> [AC <amp> [<fase>] ][...]
GENERATORI
7
Ideali
n-
n+
V
n+
n-
I
generatore di tensione
generatore di corrente
descrizione aggiuntiva
EXP(<Iin> <Ip> <Td1> <Tc1> <Td1> <Td2>)- di tipo eponenziale
PULSE(<Iin> <Ip> <Td> <Tr> <Tf> <PW> <PER>)- di tipo impulsivo
- di tipo lineare a trattiPWL(Time, Val)
1
1
1 2
1 2
0 0 1
( ) 1 1 2
( ) 1 1 2
t Td
Tc
t Td t Td
Tc Tc
con Td
Iin Ip Iin e con Td t Td
Iin Ip Iin e e con Td t Tstop
t
I =
nota :per il comportamento in transitorio di un generatore di tensione sostituire V ad I.
PER
TfTr
PW
Td
Iin
( )I t
t
- di tipo sinusoidaleSIN(<Ioff> <Iamp> <freq> <Td> <df> <phase>)
( )I t
t1m 2 m 3 m 4 m
1
PWL (0,0) (1m,1) (2m,0) (3m,1) (4m,0)
2 0360
( )
2360
t Td
dfstop
phaseIoff Iamp sen t Td
I tphase
Ioff Iamp sen freq t Td e Td t T
GENERATORI
8
di tensione comandati
n-
n+
V=(-)
n+
n-I=(-)
di corrente comandati
E<nome> <n+> <n->comandati in tensione
comandati in corrente
<nc+> <nc-> <g> ⇒V = g (Vnc+-Vnc-)
VALUE=<espressione> ⇒V = espressione
G<nome> <n+> <n->comandati in tensione <nc+> <nc-> <g> ⇒I = g (Vnc+-Vnc-)
VALUE=<espressione> ⇒ I = espressione
H<nome> <n+> <n-><Vname> <g> ⇒V = g Iname
VALUE=<espressione> ⇒V = espressione
comandati in correnteF<nome> <n+> <n->
<Vname> <g> ⇒ I = g Iname
VALUE=<espressione> ⇒ I = espressione
Dispositivi ATTIVI
9
Diodo
Transistor BJT
D<nome> <n+> <n-> <nome modello> [area]…
.MODEL<nome modello> <tipo modello> [<PARAM>=<VALUE>] (example .MODEL <nome modello> D n=1.1)
n+
n-
0 0
0
, 0
( 1)T
c
k TVT
q
V
n V cs d
V I
IdII I e g
dV nV
per tutti i dispositivi attivi bisogna istanziarne un modello con il comando .MODEL
( 1); / ;BE
T
V
Vc s B c F E C BI I e I I I I I
Q<nome> <C> <B> <E> [<SUB>] <nome modello> [area]…
.MODEL<nome modello> NPN(op PNP) [<PARAM>=<VALUE>]
Dispositivi ATTIVI
10
Transistor MOS
M<nome> <D> <G> <S> <B> <nome modello> [<PARAM>=<VALUE>]…
.MODEL<nome modello> NMOS(op PMOS) LEVEL=<numero> [<PARAM>=<VALUE>]
D
S
G B
livello 1
2
2
0
'2 0
2'
02
GS TN
nDS GS TN DS DS DS GS TN
nGS TN GS TN DS
V V
WI V V V V V V V
LW
V V V V VL
0( )
(1 ); '
TN TN n N DS N
OXDS n n OX n
OX
V V V
V Ct
fattore moltiplicativo
comando .SUBCKT
11
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.
.SUBCKT <nome> <p1> <p2> …<pn> [PARAM: <par>=<value>]]…
.ENDS
ESEMPIO: descrizione di un OPAMP
* Realizzazione OPAMP
.SUBCKT OPAMP inP inN Out PARAMS: VUMP=10 VUMN=-10 AD=400KE1 Out 0 VALUE={MAX(MIN(AD*v(inP,inN),VUMP),VUMN)}.ENDSVing 1 0 DC 0 AC 1 sin(0 1 50 000)XAMP 1 0 3 OPAMP PARAMS: AD=500KRload 3 0 1K.DC LIN Ving -2.5 2.5 70m.PROBE.END
inP
inN
Out+
-
tipi di analisi
12
.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.
tipi di analisi
13
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 DCM1 2 1 0 0 nmosDVgs 1 0 3.5Vds 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
.DC analisi in continua
tipi di analisi
14
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 NstepsOct No. of steps per octaveDec No. of steps per decadeLin Total number of linearly spaced steps between StartFreq and EndFreq
.AC analisi in frequenza a i piccoli segnali
tipi di anailisi
15
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.
.TRAN analisi in transitorio
Dott. Mauro MangiaARCES via Toffano 2/2 Bologna
mauro.mangia2@unibo.it
mmangia@arces.unibo.it
www.unibo.it