LISO A program for Linear Simulation and Optimization of analog electronic circuits

Transcription

LISO A program for Linear Simulation and Optimization of analog electronic circuits
LISO
A program for Linear Simulation and Optimization of analog
electronic circuits
Gerhard Heinzel
Max-Planck-Institut f¨
ur Gravitationsphysik,
(Albert-Einstein-Institut),
Hannover, Germany
1
LISO was originally written to simulate electronic circuits, because other common circuit
analysis programs cannot:
- correctly predict the noise.
- optimize circuits for our purpose.
The circuit topology is fixed and must be
entered by the user.
A circuit can consist of resistors, capacitors,
inductors, transformers and voltage-feedback
op-amps.
LISO performs a small-signal AC analysis.
LISO was then extended to include:
- The computation of bode diagrams from
poles and zeroes.
- The frequency response of digital filters
- A powerful FITTING function for all these
computations
LISO was written in C on UNIX systems. It
is available for Linux, and DOS/Windows.
Versions for Sun/solaris, IBM/AIX etc. are
available on request.
There is a manual available (PDF, ≈ 65 pages).
The very latest extensions are not yet included
in the manual, but described in a README file.
LISO will analyze the circuit in many respects
(transfer functions, op-amp stability, noise, input impedance).
2
Linear circuit modelling
We get:
- one equation
- one equation
- one equation
and the same
and currents).
Using the complex frequency (Laplace variable)
s = iω = 2πif:
Iin = IL1 + IC1
IL1 + IC1 = IR1
for each node,
for each component,
for the input,
number of unknowns (voltages
(nout)
Unin − Unout = sL IL1
1
Unin − Unout =
IC1
sC
Unout = R IR1
IL1
nin
(nin)
Unin = 1
L1
(L1)
(C1)
(R1)
(input)
nout
C1
Iin
=⇒
IC1
R1
IR1
R + s2 RLC
Unout =
R + s L + s2 RLC
GND
3
Units and abbreviations
Entering circuits in LISO
All units used for input and output are SI units.
LISO uses the following units:
V (Volt), A (Ampere), Ω (Ohm), F (Farad),
√
H (Henry), s (second), Hz (Hertz), V/ Hz,
√
A/ Hz, V/s.
These units are not entered in the input file,
but used in the output.
The input file is an ASCII file;
one line represents one ‘instruction’.
The following abbreviations are used:
abbreviation
G
M
k
m
u
n
p
f
meaning
giga
mega
kilo
milli
micro
nano
pico
femto
value
109
106
103
10−3
10−6
10−9
10−12
10−15
Resistors:
r name value node1 node2
Capacitors:
c name value node1 node2
Inductors:
l name value node1 node2
Example:
l l1 47u nin nout
c c1 10n nin nout
r r1 50 nout gnd
4
First example
IL1
nin
L1
nout
C1
Iin
R1
IR1
-10
GND
45
-20
dB
l l1 47u nin nout
c c1 10n nin nout
r r1 50 nout gnd
90
0
-30
0
-40
-50
-45
-60
uinput nin 50
uoutput nout
freq log 100k 1M 1000
-70
100000
Frequency [Hz]
U[nout] dB
-90
1e+06
U[nout] Phase
5
Phase [Degree]
IC1
A transfer function can mathematically be specified by its poles and zeroes. This is done in
another mode of LISO, root mode.
Root mode is automatically entered when any
of the following instructions is encountered:
Example:
pole 1
zero 100
pole 10k 4
factor 1000
freq log 0.1 100k 1000
pole frequency [Q]
zero frequency [Q]
factor value
ffactor value
delay value
1000
Abs
100
If Q is given, a complex pole/zero is assumed.
Otherwise, a single real pole/zero is assumed.
factor is an overall gain factor (may be negative).
ffactor is for frequency scaling.
delay specifies a delay time (in seconds), which
causes extra phase shift.
complex
pole
pole
zero
10
1
0.1
0.1
1
10
100
1000
Frequency [Hz]
10000 100000
6
Fitting
Parameters
Fitting needs:
For each parameter there is one instruction:
- a model which can be a transfer function
computed by poles and zeroes (root mode), or
a transfer function computed from a circuit.
param name lower-limit upper-limit
- one or more parameters of the model, i.e.
variables which should be changed and which
influence the transfer function.
Typical parameters are pole frequencies and
Q-values (in root mode) and component values
(of circuits).
Example in root mode:
param pole0:f 0.1 10
param pole0:q 0.1 10
param factor 1 100
Example
param r1
param r2
param c2
in circuit mode:
100 100k
100 100k
10p 1u
- a data file which specifies the aim, i.e. the
desired transfer function. The data file can
be measured data, or can be produced in root
mode.
7
The data file “ex2.dat2” contains the following
measured data (as real and imaginary parts):
100
10
45
0.01
0
0.001
1
10
Frequency [Hz]
ex2.dat Abs
-45
100
ex2.dat Phase
It is fitted to a two-pole lowpass model with:
pole 1.5 4
factor -10
freq log 0.1 100 400
100
180
10
135
1
90
0.1
45
0.01
0
0.001
-45
0.0001
0.1
1
-90
100
10
Frequency [Hz]
man/ex2.dat Abs
man/ex2.dat Phase
TF Abs
TF Phase
param pole0:f 0.1 10
param pole0:q 0.1 10
param factor 1 100
fit ex2.dat reim rel
8
Phase [Degree]
0.1
Final chi^2=22.1193
time used: 0.122 sec
Abs
Abs
90
Phase [Degree]
135
1
0.0001
0.1
Best parameter estimates:
pole0:f = 913.9820913821m +- 11.48m (1.26%)
pole0:q = 2.9566226348 +- 227.9m (7.71%)
factor = -10.6520327332 +- -277.5m (2.6%)
Fitting algorithms include:
(1) ‘Direct Search Simulated Annealing’,
(2) ‘Controlled Random Search’,
(3) Nelder-Mead Simplex,
(4) Levenberg-Marquardt,
(5) Powell’s method for constrained optimization.
The most useful of these, (3) and (4), have been substantially improved for LISO.
LISO includes features for:
- limiting the range of parameters
- operating in logarithmic parameter space
- defining ‘dependent’ parameters with fixed relationships
- different weighting options for the data points.
They usually work even for difficult problems, such as situations with many local minima or up to 15
parameters.
9
Further features for electronic circuits:
- Operational amplifiers (op-amps) are defined in a library.
- transmission lines (e.g. coaxial cables) and transformers can be simulated.
- detailed noise calculations.
- input and output impedance.
- stability of each op-amp in the circuit.
- dynamical range of the circuit (limited by op-amp voltage, current or slew-rate)
Special fitting options for electronic circuits:
Basic fitting matches the transfer function. Often there are many equivalent solutions. Extended
fitting finds the unique solution with the maximal dynamical range, i.e. least noise with certain
requirements to the output range and op-amp stability.
10
Digital Filters
A digital filter transforms an input sequence xn, which is sampled with a sampling interval T , into an
output sequence yn by the relationship
yi = a0 xi + a1 xi−1 + · · · + an xi−n − b1 yi−1 − b2 yi−2 − · · · − bm yi−m.
(1)
The filter is called FIR (Finite Impulse Response) if m = 0, otherwise IIR. The transfer function of
this filter is given by
a0 + a1z −1 + · · · + anz −n
,
H(s) =
−1
−2
−m
1 + b1z
+ b2z
+ · · · + bmz
(2)
where
z = exp(sT ),
s = iω = 2πif.
(3)
Stability of the filter is determined only by the denominator of this equation. The filter is stable if
and only if all complex roots of the polynomial equation
z m + b1z m−1 + b2z m−2 + · · · + bm = 0
(4)
are within the unit circle, i.e. |z| ≤ 1.
11
Designing digital filters
We want a transfer function like
c0 + c1s−1 + · · · + cns−n
Hwhite(s) =
,
−1
−2
−m
1 + d1s + d2s + · · · + dms
(5)
The IIR filter, however, provides
a0 + a1e−sT + · · · + ane−nsT
HIIR(s) =
.
−sT
−2sT
−msT
1 + b1e
+ b2e
+ · · · + bme
(6)
The problem is to find ai and bi such that Hwhite and HIIR match as welll as possible. A perfect
match is, in general, impossible. The popular ‘bilinear transformation’ is just one of several possible
approximations. LISO uses its fitting algorithms to find a ‘best match’ that is often better than the
result from the bilinear transformation.
12
10
180
0
135
-10
90
-20
45
-30
0
-40
-45
-50
-90
-60
-135
-70
freq log 50 4.9k 1000
100
-180
1000
Frequency [Hz]
TF dB
TF Phase
13
Phase [Degree]
iir 10000
sampling frequency[Hz]
a0 0.00000000000000000000
a1 0.01866176931701097122
a2 -0.01487189645688845145
a3 -0.01806069495995100277
a4 0.01547297081394841990
b0 1.00000000000000000000
b1 -3.37077000169530816009
b2 4.46702567017721818843
b3 -2.79924760727097821089
b4 0.70419408750318834844
dB
Computing the frequency response of a filter:
This produces a file ‘name iir.fil’ with
- initial values for the ai, bi and
- fitting instructions.
Running ‘name iir.fil’ optimizes the ai and bi.
0
dB
pole 100 1
zero 300 1
pole 1000 2
iir 1e4 start 3 6
freq log 1 4.9k 1000
10
180
gain[dB]
135
-10
90
-20
45
-30
0
-40
-45
phase[deg.]
-50
-90
-60
-135
-70
100
-180
1000
Frequency [Hz]
ideal dB
ideal Phase
LISO dB
LISO Phase
bilinear dB
bilinear Phase
14
Phase [Degree]
Making a filter: