Quarter-Wave Bandstop Filter Design - simple#
This tutorial tells you how to design a simple quarter-wave bandstop stub filter with simpleEMS. This filter stops the frequencies in one band and passes the others.
Note
You must have simpleEMS and openEMS on your computer. See Installation.
Make a file with the name quarterwave_bandstop_filter.py.
Import the modules#
Import QuarterWaveFilterParams, BandStopQuarterWaveFilter, and
setup_simulation from simpleEMS.
from simpleEMS import QuarterWaveFilterParams, BandStopQuarterWaveFilter
from simpleEMS import setup_simulation
QuarterWaveFilterParams holds the parameters of the filter and of the
simulation.
BandStopQuarterWaveFilter makes the filter.
setup_simulation makes the CSXCAD geometry and the FDTD solver. It also sets
the frequency range of the simulation.
Set the parameters#
params = QuarterWaveFilterParams(
substrate_eps_r=3.3,
substrate_tand=0.001,
substrate_thickness_mm=1.6,
min_freq=0.5e9,
max_freq=3e9,
centre_freq=1.5e9,
bandwidth_freq=1e9,
filter_type="bandstop",
filter_response="butterworth",
filter_order=3,
)
QuarterWaveFilterParams holds the centre frequency, the bandwidth, the type
of response, the order of the filter, and the properties of the substrate.
Set up the simulation#
sim = setup_simulation(params)
setup_simulation prepares the FDTD solver and the CSXCAD geometry. It returns
a SimSetup with the CSX, FDTD, and freqs attributes.
Build the filter#
filter = BandStopQuarterWaveFilter(params, sim)
filter.print_and_save_params(params)
ports = filter.build_band_stop_quarter_wave_filter()
filter.create_mesh()
filter.write_and_show_structure(sim)
These commands build the substrate, the ground plane, the series lines, the stubs, the ports, and the mesh. Then they show the structure in AppCSXCAD. Close the AppCSXCAD window to continue. The filter is now ready for the simulation.
Run the simulation#
filter.run_simulation(sim)
This command runs the openEMS solver. Wait until the solver stops.
Show the results#
sim_data = filter.compute_sim_data(sim, ports)
filter.plot_s_param(sim_data.freqs, sim_data.s11, sim_data.s21)
filter.show_plots()
These commands show the S11 and the S21 curves. Use them to examine the stopband of the filter.
Export the results#
You can write the model to the Gerber format. Send these files to a PCB manufacturer.
filter.export_gerber(sim)
Complete script#
The complete script is below. It designs the filter, runs the simulation, and shows the results.
#!/usr/bin/env python3
"""Quarter-wave band-stop stub filter design example at 2.45 GHz."""
# IMPORTS
from simpleEMS import QuarterWaveFilterParams, BandStopQuarterWaveFilter
from simpleEMS import setup_simulation
# IMPORTS
# PARAMS
params = QuarterWaveFilterParams(
substrate_eps_r=3.3,
substrate_tand=0.001,
substrate_thickness_mm=1.6,
min_freq=0.5e9,
max_freq=3e9,
centre_freq=1.5e9,
bandwidth_freq=1e9,
filter_type="bandstop",
filter_response="butterworth",
filter_order=3,
)
# PARAMS
# SETUP
sim = setup_simulation(params)
# SETUP
# BUILD
filter = BandStopQuarterWaveFilter(params, sim)
filter.print_and_save_params(params)
ports = filter.build_band_stop_quarter_wave_filter()
filter.create_mesh()
filter.write_and_show_structure(sim)
# BUILD
# SIMULATE
filter.run_simulation(sim)
# SIMULATE
# PPROCESS
sim_data = filter.compute_sim_data(sim, ports)
filter.plot_s_param(sim_data.freqs, sim_data.s11, sim_data.s21)
filter.show_plots()
# PPROCESS
# EXPORT
filter.export_gerber(sim)
# EXPORT