Diapositiva 1 - MOS-AK

advertisement
A novel PSS analysis implementation reusing the TRAN
analysis of Ngspice circuit simulator
Authors
Stefano Perticaroli, Fabrizio Palma and Paolo Nenzi
perticaroli@die.uniroma1.it , palma@die.uniroma1.it , nenzi@die.uniroma1.it
Sapienza
Università
Telecommunications
di
Roma
(I)
–
Department
of
Information,
Electronics
and
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Outline
• Periodic Steady State analysis and the Ngspice framework
• algorithm description of proposed implementation
• integration of algorithm reusing the TRAN analysis
• some benchmark examples of the analysis
• future developments
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
2
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Periodic Steady State analysis and the Ngspice framework
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
3
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
PSS is a RF dedicated analysis needed when:
• large signal / non-linear behavior of a periodic dynamical system has to be
investigated;
• accurate prediction of harmonic content and harmonic related parameters are
required;
0.18um CMOS LNA
0.5um CMOS mixer
non autonomous circuits
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
45nm CMOS fully integrated PLL
autonomous circuits
4
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
The PSS solution of a circuit (if exists) can be reached in general by means of:
• transient shooting (TS);
preferred for
• highly non linear circuits
• large circuits
• harmonic balance (HB);
• mixed domain techniques (MDT).
non autonomous circuits
Unknows: nodes voltages
branches currents at PSS.
autonomous circuits
and
Knowns: amplitudes and frequencies
of driving signals and IC set.
Stefano Perticaroli et al.
Unknows: nodes voltages, branches
currents and also working frequency
at PSS.
Knowns: only IC set.
MOS-AK Workshop April 7/8 2011 Paris
5
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
In the proposed implementation the TS is considered.
circuit system-equation in
space state TD form [1]
d
f  v t  , t   q  v t   i  v t   u t   0
dt
PSS solution is reached when:
u(t) input sources
v(t) nodes voltages
q(v(t)) resistive currents
i(v(t)) nodes charges or fluxes
They are all RN vectors
(1)
v T  t   v  t   0, t R
(2)
In autonomous circuits also period T is an unknown -> no closed form solution
exists.
In any numerical formulation a residual error e v TEST  t   v  t   e , t  R.
must be accepted:
tilde expresses quantities subject to numerical quantization
(3)
The problem becomes to find an iterative algorithm capable to decrease residual
error under an acceptable tolerance. Many algorithms have been proposed to
address this problem in time domain [2-3].
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
6
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
The Ngspice circuit simulator is an open source project written in C and based on
the well known Spice3f5 code, on Cider (for accurate DSIM) and on Xspice (for
event driven sim.) [4].
As a result the Ngspice code is robust and comes with a comprehensive
documentation.
My research field concerns the study the study of phase noise in electronic
integrated oscillators:
• development of noise models based on Floquet's state eigenvectors;
• investigation of innovative noise/power reduction techniques in integrated CMOS
processes.
So I decided to implement my own PSS algorithm focusing in particular on the
autonomous circuits case with the target to obtain a numerical evaluation of
stability and noise response of such systems.
In fact at the present there are no open source implementation of a TS PSS
algorithm (QUCS implements HB for non autonomous circuits only) .
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
7
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Algorithm description of proposed implementation
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
8
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
START
transient stabilization
evolution
NON AUTONOMOUS
CASE
set pseudo-state
vector reference
shooting code
block
transient evolution
for input period
NO
convergence ?
YES
END
Stefano Perticaroli et al.
postprocessing
MOS-AK Workshop April 7/8 2011 Paris
9
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
AUTONOMOUS CASE
START
transient stabilization
evolution
set pseudo-state
vector reference
shooting code
block
transient evolution
for estimated period
NO
convergence ?
estimated period
update
YES
END
Stefano Perticaroli et al.
postprocessing
MOS-AK Workshop April 7/8 2011 Paris
10
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
In stabilization transient the average of time steps tavg is computed.
If guessed frequency is not entered as input parameter Finp, then
Fest[1]=(tavg * 10)^-1 is chosen as initial guess for shooting.
1000 steps
effective sabilization
This empirical assumption is derived
from a large number of simulations
and is found to be quite accurate if
accepted number of time steps are at
least above 1000.
To avoid starting point issue the following criterion is used
If Finp>1.2*(Dtavg*10)^-1 || Finp<0.8*(Dtavg*10)^-1
then Fest[1]=(Dtavg*10)^-1
else Fest[1]=Finp
Figure: voltage transient in stabilization of VdP oscillator with 2421 accepted
time steps.
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
11
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
On exiting from stabilization the first pseudo-state vector (PSV)
reference is taken directly as the RHS[k] (RHSold pointer).
(CKTmatrix pointer)
MNA formulation used in Ngspice – k is transient step index
G[k ] B 
RHS[k ]  RHS[k  1]
 C

D

(N+M)x(N+M) matrix where N is nodes
number and M is independent sources
number
(N+M)x1 knows vector
(4)
(N+M)x1 solutions vector
RHS contains:
• portion of solution due to components without memory;
• independent sources.
State vector should contain only state variables, however is
straightforward to demonstrate a pseudo-state vector can be used to
infer steady state condition [6].
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
12
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
During every accepted time step of transient evolution the sum of
difference between current PSV and reference of PSV, the PSVe, is
computed.
The 2-norm of PSVe is called shooting_error and is referred to the
aforementioned residual error e for convergence test.
Transient time steps in the estimated period are not constant:
T2
T
VdP oscillator - Transient evolution
1
capacitor voltage [V]
vref
2
t=Test/k3
1
0
t=Test/k1
t=Test/k2
-2
2.165
2.17
2.175
2.18
Figure: time steps progression along the estimated period.
inductor current [A]
t=Test/k4
-1
2.185
2.19
T3
-5
x 10
0.05
to reference
The way {Tx} and {kx} sets are chosen heavily influences:
• convergence
accuracy;
0
• convergence trend (monotonic, oscillating, etc.);
-0.05
• algorithm
speed. 2.17
2.165
2.175
2.18
2.185
Stefano Perticaroli et al. 2
2.19
-5
x 10
MOS-AK Workshop April 7/8 2011 Paris
13
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
At every two last steps of transient evolution (just before to reach the
current estimated period) also the error gradient vector (EGV) is
computed.
capacitor voltage [V]
VdP oscillator - Transient evolution
vref
2
1
0
-1
-2
2.165
2.17
2.175
2.18
2.185
2.19
-5
0.05
0
-0.05
2.165
1-norm error with respect to reference
iref
inductor current [A]
x 10
2.17
2.175
2.18
2.185
2.19
-5
x 10
EGV is used to predict the
right minimum on the
shooting_error
scalar
function.
Once the right minimum is
detected the estimated
frequency for next shooting
iteration is updated using
the signed 1-norm of PSVe
as follows:
2
1
Fest[k+1]=Fest[k]+f(PSVe)/t
for k>=1
0
-1
-2
2.165
2.17
2.175
2.18
2.185
time [s]
2.19
-5
x 10
Figure: vdP oscillator voltage, current and error evolution in transient.
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
f(PSVe) is the ratio between PSVe evaluated at last
step and maximum of PSVe in the estimated period
14
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Instead of using a canonical local convergence criterion based only on the
fulfillment of condition
voltage_error <= ( max(V)*rel_tol+v_abstol)*tr_tol*steady_coeff
OR
current_error <= ( max(I)*rel_tol+i_abstol)*tr_tol*steady_coeff
at every node or branch, also a logic AND with a global convergence criterion
(GCC) on PSVe is added as
PSVe <= SkN(( max(V[k] OR I[k])*rel_tol+(v_abstol OR i_abstol))*tr_tol*steady_coeff) / N
( global convergence error GCE)
where k is node index and N is total nodes number.
For default in Ngspice it results:
rel_tol=1e-3
v_abstol=1e-6 V
i_abstol=1e-9 A
tr_tol=7
steady_coeff=1e-3
Stefano Perticaroli et al.
inserted for PSS only
MOS-AK Workshop April 7/8 2011 Paris
15
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
After convergence is reached:
• circuit is evolved one time more for the predicted frequency now with
CONSTANT time steps;
• results are stored for Time Domain plotting.
When all TD results are gathered they are passed to a FFT routine
which further stores results for Frequency Domain plotting.
algorithm end
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
16
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Integration of the algorithm reusing the TRAN analysis
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
17
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
For inserting PSS analysis into the Ngspice project:
• 4 new files have been created
 3 files relate to setting the analysis
 1 core file contains the whole analysis (DCPss.c)
• 7 files have been modified
DCPss.c is based on the DCTran.c and has currently around 1400 code lines.
Being a ‘copy’ of the TRAN analysis, the PSS can be easily extended to run
also event driven (Xspice) circuits.
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
18
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
DCTran.c flow
DCPss.c flow
start:
load initial conditions
call DCop;
DCop converged?
If yes goto next_time else goto resume
PSS algorithm does not alter the ‘normal’
transient flow, it only adds:
next_time:
restore time_delta;
Breakpoint hit?
If yes goto resume else continue
call DCop;
DCop converged?
If yes goto next_time else goto resume
- set a Breakpoint for next shooting
evaluation
resume:
if called by Breakpoint resolves it otherwise
decrease time_delta;
call DCop;
DCop converged?
If yes goto next_time else goto resume
• performs post-processing
Stefano Perticaroli et al.
• initial evolution for stabilization_time
• when in shooting cycle:
- progressively decrease time_delta as
circuit time get near to Breakpoint
- check if convergence is reached
MOS-AK Workshop April 7/8 2011 Paris
19
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
A netlsit example
Colpitt's Oscillator Circuit
* Colpitt is an harmonic oscillator (LC based) which use
* a capacitive partition of resonator to feed the single
* active device.
* Models:
.model qnl npn(level=1 bf=80 rb=100 ccs=2pf tf=0.3ns tr=6ns cje=3pf cjc=2pf
va=50)
r1
q1
vcc
rl
c1
c2
l1
re
vee
1
2
4
4
2
4
4
3
6
0
1 3
0
2
3
3
2
6
0
1
qnl
5
750
500p
4500p
5uH
4.65k
dc -10 pwl 0 0 1e-9 -10
*.tran 30n 12u
.pss 4e6 100e-6 3 1024 11 uic 50 1e-3
Syntax: .pss input_frequency stabilization time osc_node_or_branch time_points harmonics_number initial_conditions maximum_sc_iter steady_coeff
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
20
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Some benchmark examples of the analysis
(simulations run on a Linux virtual machine host so
their absolute runtimes are not significant)
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
21
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Example 1: three stages ring oscillator with buffered output
• BSIM3v3 device models
• CKTmatrix has size 8
• voltage supply is 1.8V
high harmonic content
is expected
Figure: three stages ring oscillator with buffered output circuit schematic.
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
22
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Time Domain plot
Predicted frequency:
3.86429 GHz
(for GCE<1e-5 relative
frequency error < 4.2e-5)
PSS at all nodes
fundamental
DC solution
Predicted voltage amplitude:
2 * 1.1V (bout node)
harmonics
Frequency Domain plot
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
23
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
PSS: stab_time is 500ns, 37 iterations in 1 min 08 sec with a gce
9.38e-6
9
3.9
3 stages ring oscillator - convergence trend
x 10
3.8
freq. [Hz]
3.7
3.6
3.5
3.4
3.3
3.2
0
10
20
30
0
10
20
30
40
50
60
70
40
50
60
70
2.5
glob. err.
2
1.5
1
0.5
0
shooting iteration
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
24
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Example 2: complementary crossed pair oscillator
• BSIM4v4 device models
• CKTmatrix has size 10
realistic model of
• voltage supply is 1.2V
integrated inductor
Figure: circuit schematic.
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
25
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Time Domain plot
Predicted frequency:
559.223692 MHz
Single ended node voltage at resonator
and inductor current
(for GCE<1e-5 relative
frequency error < 1.8e-6)
fundamental
Predicted current amplitude:
2 * 7.5mA (inductor branch)
null DC solution
Frequency Domain plot
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
26
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
PSS: stab_time 500ns, 37 iterations in 48 sec with a gce 4.78e-6
8
5.6
double cross quad oscillator - convergence trend
x 10
5.4
freq. [Hz]
5.2
5
4.8
4.6
4.4
4.2
0
5
10
15
20
25
30
35
40
0
5
10
15
20
shooting iteration
25
30
35
40
0.5
glob. err.
0.4
0.3
0.2
0.1
0
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
27
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Example 3: van der Pol oscillator
• polynomial vccs with c3 as high as c1
• CKTmatrix has size 3
• low merit factor resonator (Q=10)
VC node
Figure: van der Pol oscillator circuit schematic.
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
28
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Time Domain plot
Predicted frequency:
4.589762247 MHz
(for GCE<1e-5 relative
frequency error < 1.76e-6)
inductor current
and capacitor voltage
fundamental
Predicted voltage amplitude:
2 * 698mV (VC node)
7° harmonic
null DC solution
Frequency Domain plot
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
29
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
PSS: stab_time 150us, 46 iterations in 21 sec with a gce 3.36e-6
6
van der Pol oscillator - convergence trend
x 10
4.59
freq. [Hz]
4.58
4.57
4.56
4.55
5
10
15
20
5
10
15
20
25
30
35
40
45
30
35
40
45
0.04
glob. err.
0.03
0.02
0.01
0
-0.01
Stefano Perticaroli et al.
25
shooting iteration
MOS-AK Workshop April 7/8 2011 Paris
30
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Example 4: Colpitts oscillator
• SPICE2 qnl bjt model
• CKTmatrix has size 8
• high merit factor resonator (Q=100) and two voltage supplies
Figure: Colpitts oscillator circuit schematic.
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
31
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Time Domain plot
inductor current
and node 4 voltage
Predicted frequency:
3.34359 MHZ
(for GCE<1e-5 relative
frequency error < 8e-5)
fundamental
Predicted current amplitude:
2 * 23.2mA (inductor branch)
DC solution
Frequency Domain plot
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
32
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
PSS: stab_time 100us, 47 iterations in 28 sec with a gce 1.25e-5
6
3.4
Colpitts oscillator - convergence trend
x 10
3.2
freq. [Hz]
3
2.8
2.6
2.4
2.2
0
5
10
15
20
25
30
35
40
45
50
0
5
10
15
20
25
shooting iteration
30
35
40
45
50
3.5
3
glob. err.
2.5
2
1.5
1
0.5
0
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
33
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Future developments
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
34
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Short term – April 2011:
• autonomous case extension
• code optimization based on statistic tests on several circuits
Mid term – summer 2011:
• first public release in the Ngspice project
Long term –2012:
• introduction of accelerated PSS algorithm
• development of Phase Noise analysis based on the result of PSS
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
35
A novel PSS analysis implementation reusing the TRAN analysis of Ngspice
circuit simulator
Bibliography
[1] K. Kundert et al., Fast simulation algorithms for RF circuits, IEE CICC Conference 1996
[2] R. Gilmore et al., Nonlinear circuits analysis using harmonic balance technique, IJMMW-CAD, Vol. 1,
No. 1, 1991
[3] R. Telichevsky et al., Efficient Steady-State Analysis based on matrix-free Krylov subspace methods,
DAC Porc., 1995
[4] http://ngspice.sourceforge.net
[5] M. J. Grimble, Robust Industrial Control Systems, John Wiley and Sons 2006
Stefano Perticaroli et al.
MOS-AK Workshop April 7/8 2011 Paris
36
Download