38 views

Skip to first unread message

Dec 30, 2022, 7:17:17 PM12/30/22

to scikit-rf

I am working with T-type matching network, which is basically two L type matching network. I am trying to verify if the optimization values from the scikit-rf is correct as mentioned. I am not sure how to verify those. I plotted smith chart of the same and looks fine to me. Any suggestions are most welcome.

I had Tx that connects to antenna and this is a matching network between them. I am trying to find optimal values for my C1, C2 and C3. I am attaching my code for reference.

import numpy as np

import matplotlib.pyplot as plt

import skrf as rf

from scipy.optimize import minimize

from matplotlib import style

from skrf import plotting

plt.rcParams['figure.figsize'] = 13,6

# Matching network for Antenna

# |------L1-----C1----|----C3-----L2----|

# | | |

# Z_0 C2 Z_L

# | | |

# GND

# Matching with Lumped Elements

# Let’s assume the load is 200 + 0j for a line Z_0 = 50 ohm at the frequency of 6 MHz.

Z_L = 200 + 0j

Z_0 = 50

f_0_str = '10MHz'

# frequency band centered on the frequency of interest

frequency = rf.Frequency(start=6, stop=16, npoints=401, unit='MHz')

# transmission line Media

line = rf.DefinedGammaZ0(frequency=frequency, z0=Z_0)

# load Network

load = line.load(rf.zl_2_Gamma0(Z_0, Z_L))

def matching_network_LCCCL_1(L1, C1, C2, C3, L2):

'L1, C1, C2, C3 and L2 in uH and pF'

return line.inductor(L1*1e-6)**line.capacitor(C1*1e-12)**line.shunt_capacitor(C2*1e-12)**line.capacitor(C3*1e-12)**line.inductor(L2*1e-6)**load

# Static inductor loads

# initial guess values

L1 = 3.2 # uH - Fixed static inductor load

C1 = 260 # pF

C2 = 260 # pF

C3 = 250 # pF

L2 = 3.2 # uH - Fixed static inductor load

x0 = (L1, C1, C2, C3, L2)

# bounds

L1_minmax = (3.2, 3.2) # uH

C1_minmax = (35, 1000) # pF

C2_minmax = (35, 1000) # pF

C3_minmax = (35, 1000) # pF

L2_minmax = (3.2, 3.2) # uH

# the objective functions minimize the return loss at the target frequency f_0

def optim_fun_1(x, f0=f_0_str):

_ntw = matching_network_LCCCL_1(*x)

print("Running optimization for values (L1, C1, C2, C3, L2) : ", x)

return np.abs(_ntw[f_0_str].s).ravel()

res1 = minimize(optim_fun_1, x0, bounds=(L1_minmax, C1_minmax, C2_minmax, C3_minmax, L2_minmax))

print(f'Optimum found for LCCCL network 1: \n L1={res1.x[0]} uH;\n C1={res1.x[1]} pF ;\n C2={res1.x[2]} pF ;\n C3={res1.x[3]} pF ; and\n L2={res1.x[4]} uH')

# printed Optimum results

# Optimum found for LCCCL network 1:

# L1=3.2 uH;

# C1=176.9325799674975 pF ;

# C2=156.43228266359162 pF ;

# C3=257.3454309200819 pF ; and

# L2=3.2 uH

ntw1 = matching_network_LCCCL_1(*res1.x)

ntw1.plot_s_mag(lw=2, label='LCCCL network 1')

plt.ylim(bottom=0)

plt.grid(True)

ntw1.plot_s_db(lw=2, label='LCCCL network 1')

plt.grid(True)

with style.context('seaborn-ticks'):

ntw1.plot_s_smith()

# plotting.add_markers_to_lines()

plt.xlabel('Real Part')

plt.ylabel('Imaginary Part')

plt.title('Smith Chart')

plt.legend(loc=5)

plt.show()

Jan 1, 2023, 10:57:45 AMJan 1

to scik...@googlegroups.com

Dear Jay,

This seems OK to me. I find with your code:

C1=183.56676526215574 pF ;

C2=154.9879989021653 pF ;

C3=307.9298055500741 pF ;

C2=154.9879989021653 pF ;

C3=307.9298055500741 pF ;

and indeed the network is matched at 10 MHz for these values as S11 is very very low (cf the S11 Cartesian plot vs frequency).

Julien

--

You received this message because you are subscribed to the Google Groups "scikit-rf" group.

To unsubscribe from this group and stop receiving emails from it, send an email to scikit-rf+...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/scikit-rf/2d9b5cd8-727e-4e1f-bd3a-f84512bc03b7n%40googlegroups.com.

Jan 16, 2023, 1:51:29 PMJan 16

to scikit-rf

Hello,

Thanks for the confirmation. Is it possible to see the voltage across the capacitors by any chance ?

Jay

Jan 23, 2023, 12:35:11 PMJan 23

to scik...@googlegroups.com

Dear Jay,

Actually, yes it is possible, but using a different approach, using Circuit. You will find more documentation here:

and

You will find an example below

Julien

import skrf as rf

import matplotlib.pyplot as plt

import matplotlib.pyplot as plt

# Matching with Lumped Elements

# Let’s assume the load is 200 + 0j for a line Z_0 = 50 ohm at the frequency of 6 MHz.

Z_L = 200 + 0j

Z_0 = 50

# frequency band centered on the frequency of interest

frequency = rf.Frequency(start=6, stop=16, npoints=401, unit='MHz')

# transmission line Media

line = rf.DefinedGammaZ0(frequency=frequency, z0=Z_0)

frequency = rf.Frequency(start=6, stop=16, npoints=401, unit='MHz')

# transmission line Media

line = rf.DefinedGammaZ0(frequency=frequency, z0=Z_0)

# Static inductor loads

# initial guess values

L1 = 3.2 # uH - Fixed static inductor load

C1 = 260 # pF

C2 = 260 # pF

C3 = 250 # pF

L2 = 3.2 # uH - Fixed static inductor load

# initial guess values

L1 = 3.2 # uH - Fixed static inductor load

C1 = 260 # pF

C2 = 260 # pF

C3 = 250 # pF

L2 = 3.2 # uH - Fixed static inductor load

ntwk_C1 = line.capacitor(C1*1e-12, name='C1')

ntwk_C2 = line.capacitor(C2*1e-12, name='C2')

ntwk_C3 = line.capacitor(C3*1e-12, name='C3')

ntwk_L1 = line.inductor(L1*1e-6, name='L1')

ntwk_L2 = line.inductor(L2*1e-6, name='L2')

ntwk_load = line.resistor(Z_L, name='load')

tee = line.tee(name='tee')

port = rf.Circuit.Port(frequency, name='Port1', z0=50)

gnd1 = rf.Circuit.Ground(frequency, name='gnd1')

gnd2 = rf.Circuit.Ground(frequency, name='gnd2')

cir = [

[(port, 0), (ntwk_L1, 0)],

[(ntwk_L1, 1), (ntwk_C1, 0)],

[(ntwk_C1, 1), (tee, 0)],

[(ntwk_C2, 0), (tee, 1)],

[(ntwk_C3, 0), (tee, 2)],

[(ntwk_C2, 1), (gnd1, 0)],

[(ntwk_C3, 1), (ntwk_L2, 0)],

[(ntwk_L2, 1), (ntwk_load, 0)],

[(ntwk_load, 1), (gnd2, 0)]

]

cir = rf.Circuit(cir)

# Voltage at C2 vs frequency

power = [1] # W

phase = [0] # deg

voltages = cir.voltages(power, phase)

fig, ax = plt.subplots()

ax.plot(frequency.f_scaled, voltages[:, 6]) # 6 found from cir.connections_list

ntwk_C2 = line.capacitor(C2*1e-12, name='C2')

ntwk_C3 = line.capacitor(C3*1e-12, name='C3')

ntwk_L1 = line.inductor(L1*1e-6, name='L1')

ntwk_L2 = line.inductor(L2*1e-6, name='L2')

ntwk_load = line.resistor(Z_L, name='load')

tee = line.tee(name='tee')

port = rf.Circuit.Port(frequency, name='Port1', z0=50)

gnd1 = rf.Circuit.Ground(frequency, name='gnd1')

gnd2 = rf.Circuit.Ground(frequency, name='gnd2')

cir = [

[(port, 0), (ntwk_L1, 0)],

[(ntwk_L1, 1), (ntwk_C1, 0)],

[(ntwk_C1, 1), (tee, 0)],

[(ntwk_C2, 0), (tee, 1)],

[(ntwk_C3, 0), (tee, 2)],

[(ntwk_C2, 1), (gnd1, 0)],

[(ntwk_C3, 1), (ntwk_L2, 0)],

[(ntwk_L2, 1), (ntwk_load, 0)],

[(ntwk_load, 1), (gnd2, 0)]

]

cir = rf.Circuit(cir)

# Voltage at C2 vs frequency

power = [1] # W

phase = [0] # deg

voltages = cir.voltages(power, phase)

fig, ax = plt.subplots()

ax.plot(frequency.f_scaled, voltages[:, 6]) # 6 found from cir.connections_list

To view this discussion on the web visit https://groups.google.com/d/msgid/scikit-rf/13843ea6-b7b7-44bb-8a1d-d06088679289n%40googlegroups.com.

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu