Professional Documents
Culture Documents
net/publication/304021568
CITATIONS READS
4 1,225
2 authors:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Mike Brinson on 07 September 2016.
1
Bauman Moscow State Technical University, Kaluga branch
2
Centre for Communications Technology, London Metropolitan University, UK
1 / 13
About Qucs circuit simulator
Qucs is open-source cross-platform An example of microwave amplifier circuit simulation
free post-SPICE circuit simulator. with Qucs
Main features are:
New simulation kernel
Qucsator (SPICE
incompatible);
Advanced RF and microwave
circuits analysis:
S,Z,Y-matrix analysis,
impedance and SWR
analysis;
RF components: substrates,
transmission lines, RF
semiconductor devices.
Advanced postprocessor and Qucs development team: G.B. Torri (Project Leader,
visualization system for Nikhef); C. Girardi (Intel Corporation); M. Brin-
frequency domain analysis: son (London Metropolitan University); F. Salfelder
complex plane plots, Smith (Frankfurt University)
charts, Impedance chart;
Verilog-A support via ADMS
4 / 13
Ngspice and Xyce simulation techniques: Legacy Qucs circuit simulated
with Ngspice and Xyce
BJT_ngspice:ac.k
+ Rbm=0 Irb=0 Rc=0.137 Re=0.343 Rb=1.37
Q2N2222A_1 C2 + Cje=2.95e-11 Vje=0.75 Mje=0.33 Cjc=1.52e-11
C=0.1 uF 5
+ Vjc=0.75 Mjc=0.33 Xcjc=1 Cjs=0 Vjs=0.75
R1
+ Mjs=0 Fc=0.5 Tf=3.97e-10 Xtf=0 Vtf=0 Itf=0
C1 R=2 kOhm
+ Tr=8.5e-08 Kf=0 Af=1 Ptf=0 Xtb=1.5 Xti=3
C=0.1 uF
V2 + Eg=1.11 Tnom=26.85 )
R2 Netlist biulder
U=200 mV R1 0 _net0 2K
R4 Ngspice/Xyce output parser 0
f=4 kHz R=470 Ohm R2 0 _net2 470
R=Rload 100 1e3 1e4 1e5 1e6 1e7
C1 in _net0 0.1U
R3 _net0 _net3 24K frequency
C2 _net1 out 0.1U
R5 _net1 _net3 4.7K 2
Equation
V2 in 0 DC 0 SIN(0 200M 4K 0 0) AC 200M
Eqn1 transient ac simulation dc simulation R4 0 out {RLOAD}
BJT_ngspice:tran.v(out)
BJT_ngspice:tran.v(in)
VPr1 _net4 _net3 DC 0 AC 0 1
Rload=47k simulation V1 _net4 0 DC 12
K=out.v/in.v
.control
Pwr=(out.Vt*out.Vt)/Rload 0
AC1 DC1 set filetype=ascii
TR1 Type=lin echo "" > spice4qucs.cir.noise
Type=lin Start=100 Hz let Rload=47k -1
Start=0 Stop=10 MHz TRAN 1e-06 0.001 0
Stop=1 ms Points=2000 let Pwr=(V(out)*V(out))/Rload
write BJT_tran.txt VPr1#branch v(in) v(out) Pwr -2
destroy all 0 2e-4 4e-4 6e-4 8e-4 1e-3
reset time
time
AC LIN 2000 100 10MEG
let K=V(out)/V(in) 2
write BJT_ac.txt VPr1#branch v(in) v(out) K
destroy all
BJT_xyce:ac.V(OUT)
reset
exit 1
.endc
.END
0
100 1e3 1e4 1e5 1e6 1e7
FREQUENCY
5 / 13
Ngspice and Xyce simulation techniques: Realistic circuits simulation with
Ngspice and Xyce
This example shows realistic circuit simulation technique with Ngspice. BJT
audio amplifier is simulated in both frequency and time domain.
C11
R16 C=33n
R=330
D814D_4 C3 R26
C=22n R13 R=68
C4 14
R=120
C=500u R31 R28
R=1k V3
KS139A_1 R11 R=2 KT818A_1 12
U=25
R=39
R1 R5
KT814B_1 10
audio_amp_ngspice:ac.v(out)
R=1k R=15k
audio_amp_xyce:ac.V(OUT)
KT814A_1
8
KT3102A_2
R19
R=120 6
KT3102A_1 R29
C9 R=120
C=68n R18
D2D212A_2 R=68 4
R20
in
C6 C10 R=0.39
C=500u R9 R34 C=33n 2
R3 R4 R=10k R=10
R=1k R=27k out
R7 R8 0
R=68 R=1k 1 10 100 1e3 1e4 1e5 1e6
C8 R32
D2D212A_1 frequency
C=10u R23 R=8
C13
V1 R=0.39 FREQUENCY
C=1000p R21
U=1 V C7 R=68
C1 C=500u R10 R33
C=1000p
R=10k R=15 15
KT3107A_2
R22
KT815A_1 R=120
R30 10
KT3107A_1 R=120
R12 KT815B_1
5
audio_amp_ngspice:tran.v(out)
R=39 R27
R24 R=2 KT819A_1
R14 R=1k
KS139A_2 R=120
C2 0
R2 C=22n
R=1k R6
R=15k R25
C5 R=68 -5
D814D_1 C=500u V2
U=25
-10
C12
R17 C=33n
R=330
-15
ac simulation dc simulation transient 0 1e-4 2e-4 3e-4 4e-4 5e-4 6e-4 7e-4 8e-4 9e-4 1e-3
simulation time
AC1 DC1
Type=lin
Start=1 Hz TR1
Stop=1 MHz Type=lin
Points=200 Start=0
Stop=1 ms
6 / 13
Compact modeling with Qucs and Ngspice/Xyce: XSPICE macromodels
usage
Embedding of SPICE-model in Qucs libraries is allowed since Qucs-0.0.19
Applications of this feature:
Direct simulation of SPICE-defined components
XSPICE macromodels usage
LM358 XSPICE macromodel usage example (noninverting amplifier)
LM358 XSPICE macromodel
.SUBCKT LM358 1 2 3 4 5
*
2 C1 11 12 5.544E-12
transient C2 6 7 20.00E-12
LM358_test_ngspice:tran.v(out)
LM358_test_ngspice:tran.v(in)
DC 5 53 DX
simulation DE 54 5 DX
DLP 90 91 DX
V2 0 DLN 92 90 DX
U=5 V TR1 DP 4 3 DX
Type=lin EGND 99 0 POLY(2) (3,0) (4,0) 0 .5 .5
Start=0 FB 7 99 POLY(5) VB VC VE VLP VLN 0 15.91E6
in Stop=1 ms -2 + -20E6 20E6 20E6 -20E6
Points=200 GA 6 0 11 12 125.7E-6
out 0 2e-4 4e-4 6e-4 8e-4 1e-3 GCM 0 6 10 99 7.067E-9
time IEE 3 10 DC 10.04E-6
V1 HLIM 90 0 VLIM 1K
U=1 V time
Q1 11 2 13 QX
f=5 kHz ac simulation Q2 12 1 14 QX
2 R2 6 9 100.0E3
OP1 AC1 RC1 4 11 7.957E3
LM358_test_ngspice:ac.v(out)
R1
Type=log RC2 4 12 7.957E3
R=10k
V3 Start=1 Hz RE1 13 10 2.773E3
U=5 V Stop=10 MHz RE2 14 10 2.773E3
R2 1 REE 10 99 19.92E6
R=10k Points=141
RO1 8 5 50
RO2 7 99 50
RP 3 4 30.31E3
0 VB 9 0 DC 0
VC 3 53 DC 2.100
1 10 100 1e3 1e4 1e5 1e6 1e7 VE 54 4 DC .6
frequency VLIM 7 8 DC 0
VLP 91 0 DC 40
VLN 0 92 DC 40
.MODEL DX D(IS=800.0E-18)
.MODEL QX PNP(IS=800.0E-18 BF=250)
.ENDS
7 / 13
XSPICE analog circuit blocks
2 X 2
+
XA_mult_x21 XA_summer_x21
ig1=1.0 ig1=1.0 XA_hyst1
ig2=1.0 ig2=1.0 in_low=0.7
io1=0.0 io1=0.0 in_high=2.4
io2=0.0 io2=0.0 hyst=0.5
out_gain=1.0 out_gain=1.0 out_lower_limit=0.5
out_upper_limit=3.0
out_offset=0.0 out_offset=1.0
input_domain=0.01 8 / 13
Control system simulation with XSPICE and Qucs-S
PI-controller schematic
.MODEL
transient
simulation SpiceModel3
Line_1 =.MODEL int2 int(in_offset=0 gain=1
Line_2=+ out_lower_limit=-100 out_upper_limit=100 limit_range=1e-6 out_ic=0)
TR1
Type=lin
Start=0
Stop=10s PI-controller block
A_int_SE1
A=int1
.MODEL
A_gain_SE1
SpiceModel2
A=FBamp
Line_1 =.MODEL int1 int(in_offset=0 gain=5
A_Line 2=.model FBamp gain(gain=-1)
Line_2=+ out_lower_limit=-100 out_upper_limit=100 limit_range=1e-6 out_ic=0)
1
Step response (V)
0.5
0 2 4 6 8 10
Time (s)
9 / 13
User simulation construction with Nutmeg scripting language
ngspice/ac.z12
ngspice/ac.z21
alter R2=50
100 alter R1=100k
ngspice/ac.z22
ngspice/ac.z11
1
10
0.1 3
100 1e3 1e4 1e5
Frequency (Hz)
10 / 13
Spectrum analysis with Nutmeg scripting
You can use nutmeg operator with ”Ngspice Custom simulation” to obtain the
output spectrum
.INCLUDE directive allows to attach the whole unchanged SPICE libraires to the
schematic using new SPICE-compatible devices symbols.
signal
J1
NJF
J=J2P307G
Content of jm.lib library file
3e-4
frequency: 8e+06
2.5e-4
ngspice/ac.v(out): -8.73e-05-j3.03e-05
2e-4
ngspice/ac.v(out)
1.5e-4
1e-4
5e-5
12 / 13
Publications list