Sunteți pe pagina 1din 15

Qucs

Test Report
SPICE to Qucs conversion: Test File 5

Mike Brinson

Copyright
c 2007 Mike Brinson <mbrin72043@yahoo.co.uk>

Permission is granted to copy, distribute and/or modify this document under the
terms of the GNU Free Documentation License, Version 1.1 or any later version
published by the Free Software Foundation. A copy of the license is included in
the section entitled GNU Free Documentation License.
Introduction
Title
SPICE 2g6 and 3f5 inductors.

SPICE specification
Format: SPICE 2g61 :

Linear form: LX N+ N- value [ IC = INCOND]

Nonlinear form: LX N+ N- [POLY] value [L1 [ L2 ....] ] [IC =


INCOND ]

Coupled (mutual) inductors: KX L1 L2 Kvalue

Notes:
1. Characters [ and ] enclose optional items

2. Inductors begin with letter L.

3. X denotes name of inductor

4. N+ and N- are the positive and negative nodes respectively.

5. Value is the inductor value in Henries.

6. L1 and L2 are the names of the two coupled inductors.

7. Kvalue is the coefficient of coupling; 0 < Kvalue and Kvalue < 1.

8. The dot convention is used to denote coupling direction by placing a dot


on the first node of each inductor.

9. Equations:

Inductors may be nonlinear functions of current, where

L(I) = value + L1 I + L2 I 2 + .....Ln I n

and L1, L2, L3 .......... are the coefficients of a polynomial describing the
element value. Also n <= 20.
1
See sections 6.2 and 6.3, SPICE 2g6 users guide.

1
Format: SPICE 3f52 :

Linear inductors: LX N+ N- value [ IC = INCOND ]

Coupled (mutual) inductors: KX L1 L2 Kvalue

Notes: 1 to 8 above.

Test code
SPICE code: File S2Q_test5-_a.cir

SPICE t o Qucs s y n t a x f i l e
SPICE 2 g6 and 3 f 5 i n d u c t a n c e
DC and AC t e s t s
. s u b c k t S2Q t e s t 5 a po1 , po2 , po3
v1 1 0 dc 1v
l 1 1 po1 1mH
r 1 po1 0 1k

v2 2 0 ac 1v
l 2 2 po2 1mH
r 2 po2 0 1k

v3 3 0 dc 1v ac 1v
l 3 3 po3 1mH
r 3 po3 0 1k

. ends
. end

SPICE code: File S2Q_test5_b.cir

SPICE t o Qucs s y n t a x f i l e
SPICE 2 g6 and 3 f 5 i n d u c t a n c e
DC and t r a n s i e n t tests
. s u b c k t S2Q t e s t 5 a po1 , po2 , po3 , po4 , po5 , po6 , po7
v1 1 0 dc 1v
l 1 1 po1 1mH i c=0mA
r 1 po1 0 1k

v2 2 0 dc 0v
l 2 2 po2 1mH i c=10mA
r 2 po2 0 1k
2
See sections 3.1.7 and 3.1.8, SPICE 3f6 users guide.

2

v3 3 0 dc 1v
l 3 3 po3 1mH IC=0mA
r 3 po3 0 1k

v4 4 0 dc 0v p u l s e ( 0 1 0 . 1u 0 . 1u 0 . 1u 10u 20u )
l 4 4 po4 1mH i c=0mA
r 4 po4 0 1k

v5 5 0 dc 1v p u l s e ( 0 1 0 . 1u 0 . 1u 0 . 1u 10u 20u )
l 5 5 po5 1mH i c=0mA
r 5 po5 0 1k

v6 6 0 dc 1v p u l s e ( 0 1 0 . 1u 0 . 1u 0 . 1u 10u 20u )
l 6 6 po6 1mH i c= 1mA
r 6 po6 0 1k

v7 7 0 dc 0v p u l s e ( 0 1 0 . 1u 0 . 1u 0 . 1u 10u 20u )
l 7 7 po7 1mH i c=1mA
r 7 po7 0 1k

. ends
. end

SPICE code: File S2Q_test5_c.cir

SPICE t o Qucs s y n t a x f i l e
SPICE 2 g6 and 3 f 5 mutual i n d u c t a n c e
AC t e s t s
. s u b c k t s2q t e s t 5 c po1 po2
v1 1 0 ac 240
r 1 1 2 1Ohm
l 1 2 0 100mH
l 2 3 0 100mH
k23 l 1 l 2 0 . 999
r 2 3 po1 1Ohm
r l po1 0 150

r 1 1 1 21 1Ohm
l 1 1 21 0 100mH
l 2 1 0 31 100mH
k231 l 1 1 l 2 1 0 . 999
r 2 1 31 po2 1Ohm
r l 1 po2 0 150
. ends
. end

SPICE code: File S2Q_test5_d.cir

3
SPICE t o Qucs s y n t a x f i l e
SPICE 2 g6 and 3 f 5 mutual i n d u c t a n c e
Transient t e s t
. s u b c k t s2q t e s t 5 c po1
v1 1 0 s i n ( 0 240 5 0 )
r 1 1 2 1Ohm
l 1 2 0 100mH
l 2 3 0 100mH
k23 l 1 l 2 0 . 999
r 2 3 po1 1Ohm
r l po1 0 150
. ends
. end

SPICE code: File S2Q_test5_e.cir


SPICE t o Qucs s y n t a x f i l e
SPICE 2 g6 and 3 f 5 mutual i n d u c t a n c e
T r a n s i e n t t e s t two s e t s of c o u p l i n g
. s u b c k t s2q t e s t 5 c po1 po2
v1 1 0 s i n ( 0 240 5 0 )
r 1 1 2 1Ohm
l 1 2 0 100mH
l 2 3 0 100mH
l 3 0 4 100mH
k12 l 1 l 2 0 . 999
k13 l 1 l 3 0 . 999
k23 l 2 l 3 0 . 999
r 2 3 po1 1Ohm
r l 1 po1 0 150
r 3 4 po2 1Ohm
r l 2 po2 0 150
. ends
. end

History of simulation results


April 17 2007, Simulation tests by Mike Brinson
Summary:
File s2q 5 a: All DC and AC results correct.
File s2q 5 b: All DC and transient results correct. NOTE: Outputs po4.V,
po5.V, po6.V and po7.V have a value of 0.513 added to the DC source
values. This corresponds to the DC value of the pulse sources. Changing,
for example, time parameter TD changes this value.

4
X1
File=s2q_test5_a.cir
P01 P02
PO1 PO2

spice
P03 dc simulation
PO3
DC1
Ref
ac simulation
AC1
Type=log
Start=1 Hz
Stop=100 kHz
Points=100

Figure 1: April 17: Inductor DC and AC test schematic for file s2q 5 a.cir

File s2q 5 c: All results appear to be correct.

File s2Q 5 d: All results appear to be correct.

File s2q 5 e: All results appear to be correct.

Inductive coupled networks with more than three coupling coefficients have
not been tested.

SPICE 2g6 non-linear inductors have not been tested. Future


implementation of Qucs nonlinear controlled sources will allow simulation
of current dependent inductors.

5
1
1

P02.v

P01.v
0
0.9

-1
1 10 100 1e3 1e4 1e5 0 2e4 4e4 6e4 8e4 1e5
acfrequency acfrequency

1
P03.v

number P01.V P02.V P03.V


0.9 1 1 0 1

1 10 100 1e3 1e4 1e5


acfrequency

Figure 2: April 17: Inductor DC and AC tests results for file s2q 5 a.cir

# Qucs 0 . 0 . 12 / media / hda2 /S2Q t e s t 5 p r j / t e s t s2q 5 a . s c h

. Def : s2q t e s t 5 a c i r netPO1 netPO2 netPO3 r e f


. Def : S2Q TEST5 A r e f netPO1 netPO2 netPO3
Vac : V3 n e t 3 c n e t 1 U=1V
Vac : V2 n e t 2 c n e t 0 U=1V
Vdc : V1 n e t 1 r e f U=1V
L : L1 n e t 1 netPO1 L=1mH
R: R1 netPO1 r e f R=1k
Vdc : V2 c n e t 0 r e f U=0
L : L2 n e t 2 netPO2 L=1mH
R: R2 netPO2 r e f R=1k
Vdc : V3 c n e t 1 r e f U=1V
L : L3 n e t 3 netPO3 L=1mH
R: R3 netPO3 r e f R=1k
. Def : End
Sub : X1 r e f netPO1 netPO2 netPO3 Type=S2Q TEST5 A
. Def : End

Sub : X1 P01 P02 P03 gnd Type=s2q t e s t 5 a c i r


.AC:AC1 Type= l o g Start=1 Hz Stop=100 kHz P o i n t s=100 N o i s e=no
.DC:DC1 Temp=26 . 85 r e l t o l=0 . 001 a b s t o l=1 pA v n t o l=1 uV
saveOPs=no MaxIter=150 s a v e A l l=no c o n v H e l p e r=none S o l v e r=CroutLU

Figure 3: April 17: s2q 5 a Qucs netlist

6
X1
File=s2q_test5_b.cir
dc simulation po1
PO1 PO2
po2

DC1
P1 P2
po3 p04
PO3 PO4

P3 P4
spice
transient po5 po6
simulation PO5 PO6

TR1 P5 P6
Type=lin po7
Start=0 PO7
Stop=21u
IntegrationMethod=Gear P7 Ref
Order=6
reltol=0.01
abstol=100 pA
vntol=100 uV

Figure 4: April 17: Inductor DC and transient test schematic for file s2q 5 b.cir

7
number po1.V po2.V po3.V p04.V po5.V po6.V po7.V
1 1 0 1 0.513 1.51 1.51 0.513

1 0 1
po1.Vt

po2.Vt

po3.Vt
0.5 -5 0.5

0 -10 0
0 5e-6 1e-5 1.5e-5 2e-5 0 5e-6 1e-5 1.5e-5 2e-5 0 5e-6 1e-5 1.5e-5 2e-5
time time time

1 2 2
p04.Vt

po5.Vt

po6.Vt

0.5 1
0

0 0
0 5e-6 1e-5 1.5e-5 2e-5 0 5e-6 1e-5 1.5e-5 2e-5 0 5e-6 1e-5 1.5e-5 2e-5
time time time

1
po7.Vt

0.5

0
0 5e-6 1e-5 1.5e-5 2e-5
time

Figure 5: April 17: Inductor DC and transient tests results for file s2q 5 b.cir

8
# Qucs 0 . 0 . 12 / media / hda2 /S2Q t e s t 5 p r j / t e s t s2q 5 b . s c h

. Def : s2q t e s t 5 b c i r netPO1 netPO2 netPO3 netPO4 netPO5 netPO6


netPO7 r e f
. Def : S2Q TEST5 A r e f netPO1 netPO2 netPO3 netPO4 netPO5 netPO6
netPO7
Vrect : V7 n e t 7 c n e t 3 U=1 Td=0 . 1u Tr=0 . 1u Tf=0 . 1u TH=1 . 02 e 05
TL=9 . 7 e 06
Vrect : V6 n e t 6 c n e t 2 U=1 Td=0 . 1u Tr=0 . 1u Tf=0 . 1u TH=1 . 02 e 05
TL=9 . 7 e 06
Vrect : V5 n e t 5 c n e t 1 U=1 Td=0 . 1u Tr=0 . 1u Tf=0 . 1u TH=1 . 02 e 05
TL=9 . 7 e 06
Vrect : V4 n e t 4 c n e t 0 U=1 Td=0 . 1u Tr=0 . 1u Tf=0 . 1u TH=1 . 02 e 05
TL=9 . 7 e 06
Vdc : V1 n e t 1 r e f U=1V
L : L1 n e t 1 netPO1 L=1mH I=0mA
R: R1 netPO1 r e f R=1k
Vdc : V2 n e t 2 r e f U=0V
L : L2 n e t 2 netPO2 L=1mH I=10mA
R: R2 netPO2 r e f R=1k
Vdc : V3 n e t 3 r e f U=1V
L : L3 n e t 3 netPO3 L=1mH I=0mA
R: R3 netPO3 r e f R=1k
Vdc : V4 c n e t 0 r e f U=0
L : L4 n e t 4 netPO4 L=1mH I=0mA
R: R4 netPO4 r e f R=1k
Vdc : V5 c n e t 1 r e f U=1
L : L5 n e t 5 netPO5 L=1mH I=0mA
R: R5 netPO5 r e f R=1k
Vdc : V6 c n e t 2 r e f U=1
L : L6 n e t 6 netPO6 L=1mH I=1mA
R: R6 netPO6 r e f R=1k
Vdc : V7 c n e t 3 r e f U=0
L : L7 n e t 7 netPO7 L=1mH I=1mA
R: R7 netPO7 r e f R=1k
. Def : End
Sub : X1 r e f netPO1 netPO2 netPO3 netPO4 netPO5 netPO6 netPO7
Type=S2Q TEST5 A
. Def : End

.DC:DC1 Temp=26 . 85 r e l t o l=0 . 001 a b s t o l=1 pA v n t o l=1 uV saveOPs=no


MaxIter=150 s a v e A l l=no c o n v H e l p e r=none S o l v e r=CroutLU
.TR: TR1 Type= l i n Start=0 Stop=21u P o i n t s=100 I n t e g r a t i o n M e t h o d=Gear
Order=6 I n i t i a l S t e p=1 ns MinStep=1 e 16 MaxIter=150 r e l t o l=0 . 01
a b s t o l=100 pA v n t o l=100 uV Temp=26 . 85 L T E r e l t o l=1 e3
LTEabstol=1 e6 LTEfactor=1 S o l v e r=CroutLU relaxTSR=no
i n i t i a l D C=y e s MaxStep=0
Sub : X1 po1 po2 po3 p04 po5 po6 po7 gnd Type=s2q t e s t 5 b c i r

Figure 6: April 17: s2q 5 b Qucs netlist


9
X1
dc simulation po1 File=s2q_test5_c.cir
po2
PO1 PO2
DC1 spice

Ref

ac simulation
Equation
AC1
Type=log Eqn1
Start=1 Hz vpo1=abs(po1.v)
Stop=10 MHz phase_vpo1=phase(po1.v)
Points=100 phase_vpo2=rad2deg(unwrap(angle(po2.v)))
vpo2=abs(po2.v)
real_vpo1=real(po1.v)
real_vpo2=real(po2.v)
imag_vpo1=imag(po1.v)
imag_vpo2=imag(po2.v)

Figure 7: April 17: Mutual inductance AC test schematic for file s2q 5 c.cir

number po1.V
1 0

100
200 200
imag_vpo1
real_vpo1
vpo1

0
100
100

-100
0
0
1 10 100 1e3 1e4 1e5 1e6 1e7 1 10 100 1e3 1e4 1e5 1e6 1e7
1 10 100 1e3 1e4 1e5 1e6 1e7 acfrequency acfrequency
acfrequency

0
100
200
imag_vpo2
real_vpo2

-100
vpo2

0
100

-200
-100
0
1 10 100 1e3 1e4 1e5 1e6 1e7 1 10 100 1e3 1e4 1e5 1e6 1e7 1 10 100 1e3 1e4 1e5 1e6 1e7
acfrequency acfrequency acfrequency

100 -100
acfrequency po1.v vpo1 vpo2
26 236 / 3.47 236 236
30.5 236 / 2.95 236 236
phase_vpo1

phase_vpo2

35.9 236 / 2.5 236 236


0 42.3 236 / 2.12 236 236
-200 49.8 236 / 1.8 236 236
58.6 237 / 1.52 237 237
68.9 237 / 1.28 237 237
81.1 237 / 1.08 237 237
-100
95.5 237 / 0.904 237 237
-300 112 237 / 0.753 237 237
1 10 100 1e3 1e4 1e5 1e6 1e7 1 10 100 1e3 1e4 1e5 1e6 1e7 132 237 / 0.623 237 237
acfrequency acfrequency 156 237 / 0.509 237 237

Figure 8: April 17: Mutual inductance tests results for file s2q 5 c.cir

10
# Qucs 0 . 0 . 12 / media / hda2 /S2Q t e s t 5 p r j / t e s t s2q 5 c . s c h

. Def : s2q t e s t 5 c c i r netPO1 netPO2 r e f


. Def : S2Q TEST5 C r e f netPO1 netPO2
L : K231 c n e t 3 r e f L=0 . 0999
L : K23 c n e t 1 r e f L=0 . 0999
Vac : V1 n e t 1 c n e t 0 U=240
Vdc : V1 c n e t 0 r e f U=0
R: R1 n e t 1 n e t 2 R=1Ohm
L : L1 n e t 2 c n e t 1 L=0 . 0001
L : L2 n e t 3 c n e t 2 L=0 . 0001
Tr : K23 c n e t 1 c n e t 2 r e f r e f T=1
R: R2 n e t 3 netPO1 R=1Ohm
R:RL netPO1 r e f R=150
R: R11 n e t 1 n e t 2 1 R=1Ohm
L : L11 n e t 2 1 c n e t 3 L=0 . 0001
L : L21 r e f c n e t 4 L=0 . 0001
Tr : K231 c n e t 3 c n e t 4 n e t 3 1 r e f T=1
R: R21 n e t 3 1 netPO2 R=1Ohm
R: RL1 netPO2 r e f R=150
. Def : End
Sub : X1 r e f netPO1 netPO2 Type=S2Q TEST5 C
. Def : End

.DC:DC1 Temp=26 . 85 r e l t o l=0 . 001 a b s t o l=1 pA v n t o l=1


uV saveOPs=no MaxIter=150 s a v e A l l=no c o n v H e l p e r=none S o l v e r=CroutLU
.AC:AC1 Type= l o g Start=1 Hz Stop=10 MHz P o i n t s=100 N o i s e=no
Sub : X1 po1 po2 gnd Type=s2q t e s t 5 c c i r
Eqn : Eqn1 vpo1=abs ( po1 . v ) phase vpo1=phase ( po1 . v )
phase vpo2=rad2deg ( unwrap ( a n g l e ( po2 . v ) ) ) vpo2=abs ( po2 . v )
r e a l vpo1= r e a l ( po1 . v ) r e a l vpo2= r e a l ( po2 . v ) imag vpo1=imag ( po1 . v )
imag vpo2=imag ( po2 . v ) Export=y e s

Figure 9: April 17: s2q 5 c Qucs netlist

11
dc simulation X1
File=s2q_test5_d.cir
vpo1
DC1 PO1
spice

Ref

transient
simulation
TR1
Type=lin
Start=0
Stop=100 ms
IntegrationMethod=Trapezoidal

Figure 10: April 17: Mutual inductance transient test schematic for file s2q 5 d.cir

number vpo1.V
1 0

200
time vpo1.Vt
0.0341 -235
vpo1.Vt

0.0342 -237
0.0343 -238 0
0.0344 -239
0.0345 -240
0.0346 -241
0.0347 -241 -200
0.0348 -242
0.0349 -242 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1
0.035 -242 time
0.0351 -241
0.0352 -240

Figure 11: April 17: Mutual inductance transient tests results for file s2q 5 d.cir

12
# Qucs 0 . 0 . 12 / media / hda2 /S2Q t e s t 5 p r j / t e s t s2q d . s c h

. Def : s2q t e s t 5 d c i r netPO1 r e f


. Def : S2Q TEST5 C r e f netPO1
L : K23 c n e t 1 r e f L=0 . 0999
Vac : V1 n e t 1 c n e t 0 U=240 f=50 Phase=0 Theta=0
Vdc : V1 c n e t 0 r e f U=0
R: R1 n e t 1 n e t 2 R=1Ohm
L : L1 n e t 2 c n e t 1 L=0 . 0001
L : L2 n e t 3 c n e t 2 L=0 . 0001
Tr : K23 c n e t 1 c n e t 2 r e f r e f T=1
R: R2 n e t 3 netPO1 R=1Ohm
R:RL netPO1 r e f R=150
. Def : End
Sub : X1 r e f netPO1 Type=S2Q TEST5 C
. Def : End

Sub : X1 vpo1 gnd Type=s2q t e s t 5 d c i r


.DC:DC1 Temp=26 . 85 r e l t o l=0 . 001 a b s t o l=1 pA
v n t o l=1 uV saveOPs=no MaxIter=150 s a v e A l l=no
c o n v H e l p e r=none S o l v e r=CroutLU
.TR: TR1 Type= l i n Start=0 Stop=100 ms P o i n t s=1000
I n t e g r a t i o n M e t h o d= T r a p e z o i d a l Order=2 I n i t i a l S t e p=1 ns
MinStep=1 e 16 MaxIter=150 r e l t o l=0 . 001 a b s t o l=1 pA
v n t o l=1 uV Temp=26 . 85 L T E r e l t o l=1 e3 LTEabstol=1 e6
LTEfactor=1 S o l v e r=CroutLU relaxTSR=no i n i t i a l D C=y e s MaxStep=0

Figure 12: April 17: s2q 5 d Qucs netlist

X1
dc simulation po1
File=s2q_test5_e.cir
po2
PO1 PO2
DC1 spice

Ref

transient
simulation
TR1
Type=lin
Start=0
Stop=100 ms

Figure 13: April 17: Mutual inductance transient test schematic for file s2q 5 e.cir

13
number po1.V po2.V
1 0 0

200 200
po1.Vt

po2.Vt
0 0

-200 -200

0 0.02 0.04 0.06 0.08 0.1 0 0.02 0.04 0.06 0.08 0.1
time time

Figure 14: April 17: Mutual inductance transient tests results for file s2q 5 e.cir

# Qucs 0 . 0 . 12 / media / hda2 /S2Q t e s t 5 p r j / t e s t s2q 5 e . s c h

. Def : s2q t e s t 5 e c i r netPO1 netPO2 r e f


. Def : S2Q TEST5 C r e f netPO1 netPO2
Vac : V1 n e t 1 c n e t 0 U=240 f=50 Phase=0 Theta=0
Vdc : V1 c n e t 0 r e f U=0
R: R1 n e t 1 n e t 2 R=1Ohm
MUT2: K12K13K23 n e t 2 r e f n e t 4 r e f n e t 3 r e f L1=0 . 1 L2=0 . 1
L3=0 . 1 k12=0 . 999 k13=0 . 999 k23=0 . 999
R: R2 n e t 3 netPO1 R=1Ohm
R: RL1 netPO1 r e f R=150
R: R3 n e t 4 netPO2 R=1Ohm
R: RL2 netPO2 r e f R=150
. Def : End
Sub : X1 r e f netPO1 netPO2 Type=S2Q TEST5 C
. Def : End

Sub : X1 po1 po2 gnd Type=s2q t e s t 5 e c i r


.DC:DC1 Temp=26 . 85 r e l t o l=0 . 001 a b s t o l=1 pA v n t o l=1 uV saveOPs=no
MaxIter=150 s a v e A l l=no c o n v H e l p e r=none S o l v e r=CroutLU
.TR: TR1 Type= l i n Start=0 Stop=100 ms P o i n t s=1000
I n t e g r a t i o n M e t h o d= T r a p e z o i d a l Order=2 I n i t i a l S t e p=1 ns
MinStep=1 e 16 MaxIter=150 r e l t o l=0 . 001 a b s t o l=1 pA v n t o l=1 uV
Temp=26 . 85 L T E r e l t o l=1 e3 LTEabstol=1 e6 LTEfactor=1
S o l v e r=CroutLU relaxTSR=no i n i t i a l D C=y e s MaxStep=0

Figure 15: April 17: s2q 5 e Qucs netlist

14

S-ar putea să vă placă și