Skip to content

FIX: Filtersolutions lumped element example update #325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@ def convert_examples_into_notebooks(app):
"template.py",
"gui_manipulation.py",
"electrothermal.py",
# TODO: Remove the following example when 2025.1 is released, currently the latest version is 24.1.
"lumped_element.py",
# TODO: Remove once EMIT examples are moved into extensions.
"interference_type.py",
"interference.py",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions examples/high_frequency/radiofrequency_mmwave/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ These examples use PyAEDT to show some radio frequency and millimeter wave appli
:align: center

This example shows how to use PyAEDT to use the FilterSolutions module to design and visualize the frequency
response of a band-pass Butterworth filter.

response of a band-pass Butterworth filter and export the lumped element model to HFSS.

.. grid-item-card:: Flex cable CPWG
:padding: 2 2 2 2
Expand Down
93 changes: 76 additions & 17 deletions examples/high_frequency/radiofrequency_mmwave/lumped_element.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# # Lumped element filter design
#
# This example shows how to use PyAEDT to use the ``FilterSolutions`` module to design and
# visualize the frequency response of a band-pass Butterworth filter.
# visualize the frequency response of a band-pass Butterworth filter and export the lumped element model to HFSS.
#
# Keywords: **filter solutions**

# ## Perform imports and define constants
#
# Perform required imports.


import ansys.aedt.core
import ansys.aedt.core.filtersolutions
import matplotlib.pyplot as plt
from ansys.aedt.core.filtersolutions_core.attributes import (
FilterClass, FilterImplementation, FilterType)
from ansys.aedt.core.filtersolutions_core.ideal_response import \
FrequencyResponseColumn
from ansys.aedt.core.filtersolutions_core.attributes import FilterType, FilterClass
from ansys.aedt.core.filtersolutions_core.ideal_response import FrequencyResponseColumn
from ansys.aedt.core.filtersolutions_core.export_to_aedt import ExportFormat


# Define constants.

Expand All @@ -38,44 +40,101 @@ def format_plot():
#
# Create a lumped element filter design and assign the class, type, frequency, and order.

design = ansys.aedt.core.FilterSolutions(
version=AEDT_VERSION, implementation_type=FilterImplementation.LUMPED
)
design.attributes.filter_class = FilterClass.BAND_PASS
design.attributes.filter_type = FilterType.BUTTERWORTH
design.attributes.pass_band_center_frequency = "1G"
design.attributes.pass_band_width_frequency = "500M"
design.attributes.filter_order = 5
lumped_design = ansys.aedt.core.filtersolutions.LumpedDesign(version=AEDT_VERSION)
lumped_design.attributes.filter_class = FilterClass.BAND_PASS
lumped_design.attributes.filter_type = FilterType.BUTTERWORTH
lumped_design.attributes.pass_band_center_frequency = "1G"
lumped_design.attributes.pass_band_width_frequency = "500M"
lumped_design.attributes.filter_order = 5

# ## Plot frequency response of filter
#
# Plot the frequency response of the filter without any transmission zeros.

freq, mag_db = design.ideal_response.frequency_response(
freq, mag_db = lumped_design.ideal_response.frequency_response(
FrequencyResponseColumn.MAGNITUDE_DB
)
plt.plot(freq, mag_db, linewidth=2.0, label="Without Tx Zero")
format_plot()
plt.show()

# <img src="_static/ideal_filter_response.png" width="400">


# ## Add a transmission zero to filter design
#
# Add a transmission zero that yields nulls separated by two times the pass band width (1 GHz).
# Plot the frequency response of the filter with the transmission zero.

design.transmission_zeros_ratio.append_row("2.0")
freq_with_zero, mag_db_with_zero = design.ideal_response.frequency_response(
lumped_design.transmission_zeros_ratio.append_row("2.0")
freq_with_zero, mag_db_with_zero = lumped_design.ideal_response.frequency_response(
FrequencyResponseColumn.MAGNITUDE_DB
)
plt.plot(freq, mag_db, linewidth=2.0, label="Without Tx Zero")
plt.plot(freq_with_zero, mag_db_with_zero, linewidth=2.0, label="With Tx Zero")
format_plot()
plt.show()

# <img src="_static/filter_response_added_zeros.png" width="400">

# ## Generate netlist for designed filter
#
# Generate and print the netlist for the designed filter with the added transmission zero to
# the filter.

netlist = design.topology.circuit_response()
netlist = lumped_design.topology.netlist()
print("Netlist: \n", netlist)

# ## Printed output:
# Netlist:
# *
# V1 1 0 AC 1 PULSE 0 1 0 1.592E-13 0
# R0 1 2 50
# *
# * Dummy Resistors Required For Spice
# * Have Been Added to Net List.
# *
# L1 2 0 6.674E-09
# C2 2 0 3.796E-12
# C3 2 3 1.105E-12
# L4 3 4 2.292E-08
# L5 4 5 8.53E-09
# C5 5 0 7.775E-12
# L6 4 6 3.258E-09
# C6 6 0 2.97E-12
# C7 4 7 1.105E-12
# Rq7 4 7 5E+10
# L8 7 8 2.292E-08
# L9 8 0 6.674E-09
# C10 8 0 3.796E-12
# R11 8 0 50
# *
# .AC DEC 200 2E+08 5E+09
# .PLOT AC VDB(8) -80 0
# .PLOT AC VP(8) -200 200
# .PLOT AC VG(8) 0 5E-09
# .TRAN 5E-11 1E-08 0
# .PLOT TRAN V(8) -0.09 0.1
# .END

# ## Export lumped element model of the filter to HFSS
#
# Export the designed filter with the added transmission zero to
# HFSS with the defined export parameters.

lumped_design.export_to_aedt.schematic_name = "LumpedElementFilter"
lumped_design.export_to_aedt.simulate_after_export_enabled = True
lumped_design.export_to_aedt.smith_plot_enabled = True
lumped_design.export_to_aedt.table_data_enabled = True
lumped_design.export_to_aedt.export_design(export_format=ExportFormat.DIRECT_TO_AEDT)

# <img src="_static/exported_filter_to_desktop.png" width="400">









Loading