Unexpected behavior with transmisssion line #940
-
Describe the bug To Reproduce
Expected behavior Data import skrf as rf
from numpy import tan
import matplotlib.pyplot as plt
rf.stylely()
Z_0 = 50
Z_L = 75
L = 10e-3 #m
# the necessary Frequency description
freq = rf.Frequency(start=1, stop=30, unit='GHz', npoints=290)
# The combination of a transmission line + a load can be created
# using the convenience delay_load method
# important: all the Network must have the parameter "name" defined
tline_media = rf.DefinedGammaZ0(freq, z0=Z_0)
port1 = rf.Circuit.Port(freq, 'port1', z0=Z_0)
# piece of transmission line and series impedance
trans_line = tline_media.line(L, unit='m', name='trans_line')
load = tline_media.resistor(Z_L, name='delay_load')
# ground network (short)
ground = rf.Circuit.Ground(freq, name='ground')
# connexion list
cnx = [
[(port1, 0), (trans_line, 0)],
[(trans_line, 1), (load, 0)],
[(load, 1), (ground, 0)]
]
# building the circuit
cir = rf.Circuit(cnx)
# getting the resulting Network from the 'network' parameter:
ntw = cir.network
beta = 2*3.14*freq.f/3e8
z_in = Z_0*(Z_L+1j*Z_0*tan(beta*L))/(Z_0+1j*Z_L*tan(beta*L))
plt.plot(freq.f, z_in, label="z11 expected")
ntw.plot_z_mag() System
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Dear @Patarimi , Indeed, by default, DefineGammaZ0 uses a lossless propagation constant (1j). If you want to describe a physical transmission line with a frequency dependant propagation constant, you have to specify the parameter Also, pay attention to plot the same quantity : NB : while it's perfectly fine to build the circuit using the import skrf as rf
from numpy import tan, abs
import matplotlib.pyplot as plt
rf.stylely()
Z_0 = 50
Z_L = 75
L = 10e-3 #m
freq = rf.Frequency(start=1, stop=30, unit='GHz', npoints=290)
tline_media = rf.DefinedGammaZ0(freq, gamma=1j*freq.w/rf.c, z0=Z_0)
# Equivalent way #2
# ntw = trans_line ** tline_media.load(rf.load_impedance_2_reflection_coefficient(Z_0, Z_L))
# Equivalent way #3
ntw = tline_media.delay_load(rf.load_impedance_2_reflection_coefficient(Z_0, Z_L), d=L, unit='m')
# note that small difference between 3.14 and pi and 3e8 and c will lead to slight difference in the curves
beta = 2*rf.pi*freq.f/rf.c
z_in = Z_0*(Z_L + 1j*Z_0*tan(beta*L))/(Z_0 + 1j*Z_L*tan(beta*L))
plt.plot(freq.f, abs(z_in), label="z11 expected")
ntw.plot_z_mag() |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer. Everything works as expected now ! |
Beta Was this translation helpful? Give feedback.
Dear @Patarimi ,
Indeed, by default, DefineGammaZ0 uses a lossless propagation constant (1j).
If you want to describe a physical transmission line with a frequency dependant propagation constant, you have to specify the parameter
gamma
(the imaginary part for the propagation part)Also, pay attention to plot the same quantity :
z_in
is complex, so if you plotz_mag
you should plotabs(z_in)
NB : while it's perfectly fine to build the circuit using the
Circuit
class, scikit-rf also comes with some convenient functions to cascade simple Networks, so your code can be simplified to: