Upload
others
View
7
Download
0
Embed Size (px)
Citation preview
INF5481 RF Circuit, Theory and DesignAssignment #2
Drawing smith charts with sage
I found some sage code here: http://www.sagenb.org/home/pub/502/ todraw a smith chart, with some minor modifications it also plots the admit-tance chart. The code below produces figure 1.
from numpy import pi, angle, sqrt # dealing with exact pi is extremely slow!
def Gamma(z):
return (z-1)/(z+1)# return the (complex) reflection coefficient
def Gammaxy(z):
’’’return the real and imaginary part
of the reflection coefficient as a tuple’’’
r = Gamma(z)
return (real(r), imag(r))
def Z_real(x):
’’’generate smith chart coordinates of constant real part;
these are complete circles’’’
r = Gammaxy(x)
radius = 0.5*(1 - r[0])
return circle((1-radius, 0), radius, color=’red’)
def Z_imag(y):
’’’generate smith chart coordinates of constant imaginary part;
these are circular arcs’’’
rx = lambda t: Gammaxy(t + 1j*y)[0]
ry = lambda t: Gammaxy(t + 1j*y)[1]
return parametric_plot((rx,ry),(0,50), color=’red’)
1
INF5481: Assignment #2
# draw an unlabeled Z smith chart
smithchart_Z = Z_real(0) + Z_real(1/3) + Z_real(1) + Z_real(3) + \
Z_imag(0) + Z_imag(1/3) + Z_imag(-1/3) + Z_imag(1) + \
Z_imag(-1) + Z_imag(3) + Z_imag(-3)
## Modified functions for admittance
def Y_real(x):
’’’generate smith chart coordinates of constant real part;
these are complete circles’’’
r = Gammaxy(x + 0j)
radius = 0.5*(1 - r[0])
return circle((radius-1, 0), radius, color=’blue’) # radius-1
def Y_imag(y):
’’’generate smith chart coordinates of constant imaginary part;
these are circular arcs’’’
rx = lambda t: -Gammaxy(t + 1j*y)[0] # -1 added
ry = lambda t: -Gammaxy(t + 1j*y)[1] # -1 added
return parametric_plot((rx,ry),(0,50), color=’blue’)
# draw an unlabeled Y smith chart
smithchart_Y = Y_real(0) + Y_real(1/3) + Y_real(1) + Y_real(3) + \
Y_imag(0) + Y_imag(1/3) + Y_imag(-1/3) + Y_imag(1) + \
Y_imag(-1) + Y_imag(3) + Y_imag(-3)
def Z(Gamma_d):
return (1 + Gamma_d)/(1 - Gamma_d)
def annote(Z, t, color=’black’):
xy = Gammaxy(Z)
p = point(xy, color=color)
p += text(’$’+t+’$’, xy, vertical_alignment=’bottom’,
horizontal_alignment=’left’, color=’black’,
fontsize=20)
return p
def Gamma(z):
try:
return (z - 1)/(z + 1)# return the (complex) reflection coefficient
except:
return (1 - 1/z)/(1 + 1/z)
Page 2 of 23
INF5481: Assignment #2
Figure 1: An empty Z and Y smith chart.
# p = text(’$%.2g$’ % (x), (r[0], 0), vertical_alignment=’top’,
# horizontal_alignment=’right’, color=’red’)
# p += circle((1-radius, 0), radius, color=’red’)
# if 0 < y: v_alignment = ’bottom’
# else: v_alignment = ’top’
# if 1 < abs(y): h_alignment = ’right’
# else: h_alignment = ’left’
# p = text(’$%.2g$’ % (y), (rx(0), ry(0)), vertical_alignment=v_alignment,
# horizontal_alignment=h_alignment, color=’red’)
# p = text(’$%.2g$’ % (x), (-r[0], -0.05), vertical_alignment=’top’,
# horizontal_alignment=’right’, color=’blue’)
# p += circle((radius-1, 0), radius, color=’blue’) # radius-1
# if 0 < -y: v_alignment = ’bottom’
Page 3 of 23
INF5481: Assignment #2
# else: v_alignment = ’top’
# if 1 < abs(y): h_alignment = ’right’
# else: h_alignment = ’left’
# p = text(’$%.2g$’ % (-y), (rx(0), ry(0)), vertical_alignment=v_alignment,
# horizontal_alignment=h_alignment, color=’blue’)
# parametric_plot((rx,ry),(0,50), color=’blue’)
In this exercise we will use Sage extensively, a few words of warnings: Sageuses i when outputting complex numbers (but accepts j in the input) andwhen outputting floating point numbers you specify the number of bits touse, instead of the number of significant digits, this can in some cases leadto odd rounding. In this exercise I have used 10 digits in the output. Tocreate the document I have used the LATEXpackage sagetex, which allowssage code to be embedded in the LATEXcode. Although it might not appearso, all exercises have been solved on paper using an ordinary smith chart.Sage is simply used to confirm the results and draw smith charts.
Problem 1
Z0 = 50 Ω
l0 = 0.4λZL = 60 + j75 Ω
Zin
Figure 2: Diagram for problem 1
We have a 50 Ω line connected to a complex load as shown in figure 2.Using a smith chart, we want to find ΓL, SWR, YL and Zin.
(a)
Normalize the load impedance and mark zL = ZL/Z0 on a smith chart. Readof the reflection coefficient at the load.
Page 4 of 23
INF5481: Assignment #2
(b)
Draw a circle that intersects with zL centered at z = 1 and read of thestanding wave ratio.
(c)
Use a ZY smith chart to read of the load admittance.
(d)
Rotate the load reflection coefficient from l = 0 to l = 0.4λ, read of the inputimpedance.
The solution is presented in section to .
Theory
We start with equation (3.2) and (3.3) from [?], which expresses the reflectioncoefficient and input impedance at a distance d from the load. Where we fornotation convenience refrain from dividing complex numbers into real andimaginary parts and using small letters for normalized impedance.
Γ(d) = ΓLe−j2βd (1)
Zin(d)
Z0
=1 + Γ(d)
1− Γ(d)(2)
from which is follows that
Γ(d) =
Zin(d)Z0− 1
Zin(d)Z0
+ 1(3)
(3) gives us a transformation from impedance to reflection coefficient and (2)goes back again. The transformation for admittance is straightforward from(2)
Yin(d)Z0 =1− Γ(d)
1 + Γ(d)(4)
(5)
Page 5 of 23
INF5481: Assignment #2
We also define transformation for SWR, from equation (3.12) and (3.13) in[?]
SWR =1 + |Γ(d)|1− |Γ(d)|
(6)
|Γ(d)| = SWR− 1
SWR + 1(7)
From the above formulas it is straightforward to go between impedance,admittance and SWR. The smith chart has the property that for every pointwe can read off the impedance, admittance and reflection coefficient in thefollowing manner
Impedance: Every point intersects with a constant resistance R and reactance Xline, these are shown as blue lines in 1. The normalized impedance isthen the sum of these components
Z
Z0
= R + jX
Admittance: The same is true for finding the admittance, but this time we follow theconstant conductance G and susceptance B. Normalized admittance isthen
Y Z0 = G+ jB
Reflection: We first measure the distance from the origin to the edge of the chart,on a A4 paper this is about 7.34 cm. Then measuring the distance dfrom the origin to the desired point. The angle θ can be found with aprotractor.
Γ =d
7.34 cmejθ
The above process is time consuming and prone to errors when carried outby hand, we will therefore let sage use the equations and show us the resultsusing the smith chart.
Solution
Reflection coefficient at load
We start by finding the load on the smith chart, to do this by hand wenormalize the impedance and follow the imaginary and real lines. In sage wefirst have to convert to impedance to a reflection coefficient.
Page 6 of 23
INF5481: Assignment #2
Z_0 = 50
Z_L = (60+75j)/Z_0
Gamma_L = Gamma(Z_L)
xy = Gammaxy(Z_L) # get real and imaginary parts of reflection coeff.
p1 = smithchart_Z # use Z chart
p1 += point(xy, color=’black’) # add point at load
p1 += text("$\Gamma_L$", xy, vertical_alignment=’bottom’,
color=’black’, fontsize=20)
p1 += Z_real(real(Z_L))
ΓL = 0.57ej0.84
= 0.38 + 0.42i
SWR
We now draw a circle through ΓL and measure the intersection where theimaginary part is 0, or according to (6)
def SWR(Gamma_d):
return (1 + abs(Gamma_d))/(1 - abs(Gamma_d))
r = abs(Gamma_L) # radius of circle
p1 += circle((0, 0), r)
Which results in figure 3 and SWR ≈ 3.6
ΓL
Figure 3: Smith chart for and
Page 7 of 23
INF5481: Assignment #2
Load admittance
We could just do YL = Z−1L , but lets do it the hard way. We start by plotting
the same point as we had before, but this time on the admittance chart.
p2 = smithchart_Y # use impedance chart
p2 += point(xy, color=’black’) # add point at load
p2 += text("$\Gamma_L$", xy, vertical_alignment=’bottom’,
color=’black’, fontsize=20)
We now have to find where this intersects with the constant conductance andsusceptance lines. Again, we could do this by hand, but using (4) we addthose lines to the chart
def Y(Gamma):
return (1 - Gamma)/(1 + Gamma)
Y_L = Y(Gamma_L)
p2 += Y_real(real(Y_L)) + Y_imag(imag(Y_L)) # add lines
which is YL ≈ (0.33−0.41i)/Z0 ≈ 0.0065−0.0081i ≈ 0.0065−0.0081i, whichis shown in figure 4
ΓL
Figure 4: Smith chart for
Input impedance
From (3) it is easy to see that this is just a rotation by the “electrical length”2βd, we can then go from reflection coefficient to impedance by using (2).
Page 8 of 23
INF5481: Assignment #2
def Z(Gamma_d):
return (1 + Gamma_d)/(1 - Gamma_d)
var(’lam’)
d = 0.4*lam
beta = 2*pi/lam
Gamma_in = Gamma_L*exp(-2j*beta*d) # rotate
Z_in = Z(Gamma_in)
xy = Gammaxy(Z_in)
p1 += point(xy)
p1 += text("$\Gamma_in$", xy, vertical_alignment=’top’,
horizontal_alignment=’left’, color=’black’,
fontsize=20)
p1 += Z_real(real(Z_in)) + Z_imag(imag(Z_in))
The alternative approach is to rotate by
2β · d = 22π
λ0.4λ
= 288,
which is a point at 360− (288−55) = 127 and read of the impedance fromthe constant resistance and reactance lines.
Zin = Z0(0.36 + 0.52i) = 18.+ 26.i
which is shown in figure 5
Page 9 of 23
INF5481: Assignment #2
ΓLΓin
Figure 5: Smith chart for
Page 10 of 23
INF5481: Assignment #2
Problem 2
l5 = λ/4
R1 = 85 ΩL2 = 2 nH
l3 = 0.15λl7 = λ/4
R4 = 33 ΩC8 = 2.2 pF
Zin
l6 = 0.4λ
Z0 = 50 Ω
Figure 6: Diagram for problem 2, all transmission lines are lossless and 50 Ω.
In a patent for a GSM900 receiver circuit working at 940 MHz, you findthe circuit diagram in figure 6. You decide to investigate the circuit usinga smith chart. Start at the load and work you way to the input, showintermediate steps and give the un-normalized input impedance Zin.
If you arrived around 30 Ω, can you think of a simpler circuit to transforma 85 Ω load to 30 Ω?
Theory
We first define the impedance of the different passive components
ZRZ0
=R
Z0
ZLZ0
=jωL
Z0
ZCZ0
=1
jωCZ0
,
transmission line 6 can be regarded as a transmission line without load
Zin(d) = Z0ZL + jZ0 tan(βd)
Z0 + jZL tan(βd)
Z6
Z0
=0 + jZ0 tan(βd)
Z0 + j0 · tan(βd)= j tan(βd) (8)
and transmission lines with length of λ/4 is equal to a rotation of 180.
Page 11 of 23
INF5481: Assignment #2
Solution
This is now an exercise in addition and taking the inverse of complex num-bers, sage is a lot better at this than me so
f = 940e6 # Hz, 1GHz
L_2 = 2e-9 # henry, L_2 = 4e-9
R_L = 85 # ohm
def annote(Z, t, color=’black’, vertical_alignment=’bottom’, horizontal_alignment=’left’):
xy = Gammaxy(Z)
p = point(xy, color=color)
p += text(’$’+t+’$’, xy, vertical_alignment=vertical_alignment,
horizontal_alignment=horizontal_alignment, color=color,
fontsize=20)
return p
p = Z_imag(0) + Z_real(0) + Y_real(0) + Y_imag(0)
omega = 2*pi*f # rad/s
Z_0 = 50 # ohm
#Z_A = 75/Z_0; Y_A = 1/Z_A
Z_A = R_L/Z_0; Y_A = 1/Z_A
p += annote(Z_A, ’A’)
p += Z_real(real(Z_A))
# B:
Z_2 = 1j*omega*L_2/Z_0
Y_2 = 1/Z_2
Y_B = Y_A + Y_2; Z_B = 1/Y_B
Gamma_B = Gamma(Z_B)
p += annote(Z_B, ’B’)
p += Y_real(real(Y_B)) + Y_imag(imag(Y_B))
# C:
#l_3 = 0.1
l_3 = 0.15
beta = 2*pi
Gamma_C = Gamma_B*exp(-2j*beta*l_3)
Z_C = Z(Gamma_C); Y_C = 1/Z_C
p += annote(Z_C, ’C’)
p += circle((0, 0), abs(Gamma_C))
# D:
R_4 = 33
Z_4 = R_4/Z_0; Y_4 = 1/Z_4 # = G_4 [Siemens]
Page 12 of 23
INF5481: Assignment #2
Y_D = Y_C + Y_4; Z_D = 1/Y_D
Gamma_D = Gamma(Z_D)
p += annote(Z_D, ’D’)
p += Y_real(real(Y_D)) + Y_imag(imag(Y_D))
We are now halfway, let’s see what we have done. The smith chart so far canbe found in figure 7.
We start by normalizing the load and finding it on the smith chart,
Z1
Z0
= 1.7ZAZ0
= 1.7
Y2Z0 =Z0
Z2
= −4.2i YBZ0 = Z0(YA + Y2) = 0.59− 4.2i
we can now read of the magnitude and phase of the reflection coefficient androtate it 2β · 0.15λ = 110. towards the generator
ΓB = 0.94ej2.7
ΓC = ΓBe−2jβl3 = 0.94ej0.80
this corresponds to
YCZ0 = 0.036− 0.42i
We view the resistor as parallel to YC , moving along the imaginary admit-tance line we obtain
Y4Y0
= 1.5 YDZ0 = (YC + Y4)Z0 = 1.6− 0.42i
ΓD = 0.27ej2.7
p = Z_imag(0) + Z_real(0) + Y_real(0) + Y_imag(0)
p += annote(Z_A, ’A’)
p += annote(Z_B, ’B’)
p += annote(Z_C, ’C’)
p += annote(Z_D, ’D’)
# # E:
l_5 = 1/4
Gamma_E = Gamma_D*exp(-2j*beta*l_5)
Page 13 of 23
INF5481: Assignment #2
A
B
C
D
Figure 7: Smith chart for the first part of exercise
Z_E = Z(Gamma_E);Y_E = 1/Z_E
p += annote(Z_E, ’E’)
p += circle((0, 0), abs(Gamma_E))
# F:
#l_6 = 0.1
l_6 = 0.4
Z_6 = 1j*tan(beta*l_6);Y_6 = 1/Z_6
Y_F = Y_E + Y_6; Z_F = 1/Y_F
Gamma_F = Gamma(Z_F)
p += annote(Z_F, ’F’)
p += Y_real(real(Y_F)) + Y_imag(imag(Y_F))
# G:
l_7 = 1/4
Gamma_G = Gamma_F*exp(-2j*beta*l_7)
Z_G = Z(Gamma_G)
p += annote(Z_G, ’G’)
p += circle((0, 0), abs(Gamma_G))
# In
#for C_8 in [2.2e-12, 2.21e-12]:
C_8 = 2.2e-12 # farad
Z_8 = 1/(1j*omega*C_8*Z_0)
Z_in = Z_8 + Z_G
p += annote(Z_in, ’Z_in’)
p += Z_real(real(Z_in)) + Z_imag(imag(Z_in))
Page 14 of 23
INF5481: Assignment #2
Continuing from point D to E, we see that we have a quarter wave trans-former, so we rotate ΓD by 180
ΓE = ΓDe−j180 = 0.27e−j0.49
Using (8) we find the impedance of the shorted transmission line, the admit-tance can then be read of the smith chart
YEZ0 = 0.60 + 0.16i
Z6
Z0
= j tan(βd) = −0.73i
Y6Z0 =Z0
Z6
= 1.4i YFZ0 = Z0(YE + Y6) = 0.60 + 1.5i
Finding the reflection coefficient of this point we rotate it by another 180
ΓF = 0.72ej−2.1
ΓG = ΓF e−j180 = 0.72ej1.1
ZGZ0
= 0.60 + 1.5i
We are finally ready to find the input impedance, as this is just C8 in serieswith ZG
Z8
Z0
=1
jωC8Z0
= −1.5i
Zin
Z0
=ZG + Z8
Z0
= 0.60 + 0.00071i
Zin = 30.+ 0.035iΩ
As an alterntive route to Zin = 30 Ω we could use a single λ/4 transformeror a FIXME: 45 Ω in shunt.
Page 15 of 23
INF5481: Assignment #2
A
B
C
D
E
F
G
Zin
Figure 8: Smith chart for the last part of exercise 2
Page 16 of 23
INF5481: Assignment #2
Problem 3
We now study the shorted and open transmission lines in figure 9.
(a)
Find the required length l0 to achieve an input impedance Zin = −25j Ω. Isyour answer unique?
(b)
Find the required length l1 to achieve an input admitance Yin = 0.04j Ω. Isyour answer unique?
Z0 = 50 Ω
l0 =?ZL = 0
Zin = −25j Ω
(a) Short circuit
Z0 = 50 Ω
l1 =?ZL =∞
Yin = 0.04j S
(b) Open
Figure 9: Diagrams for problem 3
Short circuit
Z_0 = 50
Z_L = 0/Z_0
Z_in = -25j/Z_0
Gamma_in = Gamma(Z_in)
angle = Gamma_in.argument()*180/pi
p = smithchart_Z
p += annote(Z_L, ’Z_L’)
p += annote(Z_in, ’Z_in’)
r = -angle.n(10)+180
Page 17 of 23
INF5481: Assignment #2
Γin = 1.0e−j130.
When rotating from ΓL to Γin we are moving towards the generator, so wehave to rotate by 180 + 130. = 310.. This is shown in figure 10 This is
ZL
Zin
Figure 10: Smith chart for exercise 3a
achieved with the length
2βl = 310.
l ≈ 0.43λ
Short circuit
We have the short circuit transmission line shown in figure 11, the objectiveis to find an l so that Yin = 0.04j S.
Moving along the transmission line is a rotation of the reflection coefficienttoward the load.
Z_0 = 50
Z_L = infinity/Z_0; Y_L = 1/Z_L
Y_in = 0.04j*Z_0 #2j
Z_in = 1/Y_in
Gamma_in = Gamma(Z_in)
angle = Gamma_in.argument()*180/pi
p = smithchart_Y
p += annote(Z_L, ’Y_L’)
p += annote(Z_in, ’Y_in’)
Page 18 of 23
INF5481: Assignment #2
Z0 = 50 Ω
lZL =∞
Yin = 0.04j S
Figure 11: Diagram for exercise 3b
We have first found the input reflection coefficient
Γin = 1.0e−j130.
When rotating from ΓL to Γin we are moving towards the generator, so wehave to rotate by 130.. This is shown in figure 12. This is archived with the
YL
Yin
Figure 12: Smith chart for exercise 3b
length
2βl = 130.
l ≈ 0.181λ
Page 19 of 23
INF5481: Assignment #2
Problem 4
We have the complex load in figure 13, which we want to match to Zin = 50 Ω.Use a smith chart to find the required values for L and C at 100 MHz.
L
Zload = 10 + 40j Ω
Zin = 50 Ω
C
Figure 13: Diagram for problem 4
Theory
Impedance is generally a complex quantity, so we have two equations andtwo unknowns
< (Zin) = 50 Ω
= (Zin) = 0
<(Zin
Z0
)= 1 (9)
=(Zin
Z0
)= 0 (10)
Solution
f = 100e6
omega = 2*pi*f
Z_0 = 50
Z_load = (10 + 40j)/Z_0;Y_load = 1/Z_load
Y_C = var(’Y_C’)
Y_A = Y_load + 1j*Y_C; Z_A = 1/Y_A
eq = [real(Z_A) == 50/Z_0]
s = solve(eq, Y_C, solution_dict=True)
Page 20 of 23
INF5481: Assignment #2
Y_C = s[1][Y_C]*1j
C = Y_C/(1j*omega*Z_0)
Z_A = Z_A(Y_C=Y_C/1j).n(64); Y_A = 1/Z_A
The above sage code solves (9) using the solve function, we will bellow visu-alize this process using the smith chart. We start by normalizing the load
Zload
Z0
= 0.20 + 0.80i YloadZ0 = 0.29− 1.2i.
This is in parallel with a capacitor, so the impedance looking from A (seefigure 13) into the load is
ZCZ0
=1
jωCZ0
YCZ0 = jωCZ0
YAZ0 = (Yload + YC)Z0
= 0.29 + j (ωCZ0 − 1.2) .
From this we see that the imaginary part can be changed by choosing C,from the smith chart we can see that the condition
<(ZAZ0
)= 1
<(
1
0.29− 1.2i+ YC
)= 1
is fulfilled when =(YA) ≈ 0.45. Sage gets (this actually has two solutions,but the first gives a negative inductance value, so we went for the secondone.)
YAZ0 = 0.29 + 0.46i
ZAZ0
= 1.0− 1.5i
This can now be used to find the capacitance
C =YCjωZ0
=1.632j
jωZ0
≈ 51.95 pF
Again, we first show some sage code before we visualize the solution onthe smith chart.
Page 21 of 23
INF5481: Assignment #2
Z_L = var(’Z_L’)
Z_in = Z_A + 1j*Z_L
eq = [imag(Z_in) == 0]
s = solve(eq, Z_L, solution_dict=True)
Z_L = s[0][Z_L]*1j; Y_L = 1/Z_L
L = Z_L/(1j*omega)*Z_0
Z_in = Z_in(Z_L=Z_L/1j); Y_in = 1/Z_in
The input impedance can be expressed as ZA in series with the inductor ZL
Zin = ZA + ZL
Zin = 1.0 + j
(−1.5 +
ZLZ0
)We try to find an ZL where the imaginary part of this equation is 0, thismoves the input impedance to the center and gives a match.
0 = −1.5 +ZLZ0
ZLZ0
= 1.5
Which gives an inductance of
L = 123.3 nH
Figure 14 shows the smith chart for this exercise.
p = Z_real(0) + Z_imag(0)
p += Z_real(real(Z_in)) + Z_imag(imag(Z_in))
p += annote(Z_in, ’Z_in’)
p += Z_real(real(Z_load)) + Z_imag(imag(Z_load))
p += Y_real(real(Y_load)) + Y_imag(imag(Y_load))
p += annote(real(Z_load), ’%.3g’ % (real(Z_load).n(10)), color=’red’)
p += annote(1j*imag(Z_load), ’%.3g’ % (imag(Z_load).n(10)), color=’red’)
p += annote(Z_load, ’Z_load’)
Page 22 of 23
INF5481: Assignment #2
p += Z_real(real(Z_A)) + Z_imag(imag(Z_A))
p += Y_real(real(Y_A)) + Y_imag(imag(Y_A))
p += annote(real(Z_A), ’%.3g’ % (real(Z_A).n(10)), color=’red’, vertical_alignment=’top’, horizontal_alignment=’right’)
p += annote(1j*imag(Z_A), ’%.3g’ % (imag(Z_A).n(10)), color=’red’)
p += annote(1/real(1/Z_A), ’%.3g’ % (real(1/Z_A).n(10)), color=’blue’, vertical_alignment=’top’, horizontal_alignment=’right’)
p += annote(-1j*1/imag(1/Z_A), ’%.3g’ % (imag(1/Z_A).n(10)), color=’blue’)
p += annote(Z_A, ’Z_A’)
Zin0.2
0.8
Zload
1
−1.55
0.294
0.456
ZA
Figure 14: Smith chart for problem 4. Where Z0 is arbitrarily chosen as 50 Ω
As a sanity check
#L = 123.3e-9
#C = 51.95e-12
omega = 2*pi*100e6
def p(z1, z2):
return z1*z2/(z1 + z2)
Z_in = 1j*omega*L + p(1/(1j*omega*C), 10+40j)
returns 50. + 0.12i.
Page 23 of 23