From 81ca78b0e35183e697308b6804ed6ea26622836d Mon Sep 17 00:00:00 2001 From: andresmmera Date: Sat, 3 Oct 2015 11:16:34 +0200 Subject: [PATCH] Ring resonator and cap coupled filters added to Qucs-filter Two bandpass filter topologies were added: the side coupled ring resonator and the capacitively coupled shunt resonators topology. In addition to this, some improvements were made concering the user interface. Specifically, it is included a preview window so as to let the user to have a quick image of how the filter will look like. Moreover, the topology combobox was shortened by including a new checkbox which allows to enable/disable the microstrip implementation. This halves the size of the aforementioned combobox. References: [1] Quarter Wavelength Side-Coupled Ring Resonator for Bandpass filters. Mohd Khairul Mohd Salleh. IEEE TRANSACTIONS ON MICROWAVE THEORY AND TECHNIQUES. VOL. 56, NO. 1, JANUARY 2008 [2] Microwave engineering. David M Pozar. John Wiley and Sons. 4th Edition. Pages 443-448 Quarter wavelength ring resonator filter It was added a Quarter wavelength ring resonator filter to the Qucs filter synthesis tool. References: [1] Quarter Wavelength Side-Coupled Ring Resonator for Bandpass filters. Mohd Khairul Mohd Salleh. IEEE TRANSACTIONS ON MICROWAVE THEORY AND TECHNIQUES. VOL. 56, NO. 1, JANUARY 2008 New filter topology + improvements 1) It was added the capacitively coupled shunt resonators synthesis 2) The Qucs-Filter interface was restructured in the sense of that every gui component is placed into a (vertical/horizontal) layout box. Moreover, it was a added a display to visualize the layout of the filter. New layout images added The aspect radio of most svg images was modified 1) It was a problem with the visualization of several images. The solution was found by changing the aspect ratio. Fixed wrong connection It was found a bug in the schematic generated by Qucs-Filter when using LC notch filters (Tee topology). The last horizontal wire on the right of the schematic was being placed wrongly when the order of the filter was an odd number. Added combobox for microstrip implementation The number of available filters is growing and the 'Realization' combobox seems to be quite saturated. In this sense, it was added a checkbox to indicate microstrip implementation. This new feature halves the number of entries... Added some comments... Updated images Disabled microstrip implementation for the new filters --- qucs/qucs-filter/CMakeLists.txt | 2 + qucs/qucs-filter/Makefile.am | 3 +- qucs/qucs-filter/bitmaps/CCoupled.svg | 478 +++++++++ qucs/qucs-filter/bitmaps/CCoupled_Lines.svg | 606 +++++++++++ .../bitmaps/CCoupled_Lines_Microstrip.svg | 998 ++++++++++++++++++ .../bitmaps/CCoupled_Microstrip.svg | 700 ++++++++++++ .../bitmaps/CCoupled_Shunt_Resonators.svg | 773 ++++++++++++++ qucs/qucs-filter/bitmaps/LC_Ladder_Pi_BPF.svg | 704 ++++++++++++ qucs/qucs-filter/bitmaps/LC_Ladder_Pi_HPF.svg | 412 ++++++++ qucs/qucs-filter/bitmaps/LC_Ladder_Pi_LPF.svg | 415 ++++++++ .../bitmaps/LC_Ladder_Pi_Notch.svg | 642 +++++++++++ .../qucs-filter/bitmaps/LC_Ladder_Tee_BPF.svg | 560 ++++++++++ .../qucs-filter/bitmaps/LC_Ladder_Tee_HPF.svg | 398 +++++++ .../qucs-filter/bitmaps/LC_Ladder_Tee_LPF.svg | 367 +++++++ .../bitmaps/LC_Ladder_Tee_Notch.svg | 698 ++++++++++++ .../qucs-filter/bitmaps/LC_cauer_bandpass.svg | 938 ++++++++++++++++ qucs/qucs-filter/bitmaps/LC_cauer_lowpass.svg | 522 +++++++++ qucs/qucs-filter/bitmaps/LC_cauer_notch.svg | 784 ++++++++++++++ .../bitmaps/Quarterwave_Bandpass_Ideal.svg | 983 +++++++++++++++++ .../Quarterwave_Bandpass_Microstrip.svg | 862 +++++++++++++++ .../bitmaps/Quarterwave_Notch_Ideal.svg | 843 +++++++++++++++ .../bitmaps/Quarterwave_Notch_Microstrip.svg | 722 +++++++++++++ .../bitmaps/Quarterwave_Side_Coupled_Ring.svg | 587 ++++++++++ .../bitmaps/Stepped_Impedance_Ideal.svg | 426 ++++++++ .../bitmaps/Stepped_Impedance_Microstrip.svg | 396 +++++++ .../qucs-filter/ccoupled_shunt_resonators.cpp | 117 ++ qucs/qucs-filter/ccoupled_shunt_resonators.h | 37 + qucs/qucs-filter/lc_filter.cpp | 4 +- qucs/qucs-filter/qucsfilter.cpp | 247 +++-- qucs/qucs-filter/qucsfilter.h | 9 +- qucs/qucs-filter/qucsfilter.qrc | 23 + qucs/qucs-filter/qw_coupled_ring_filter.cpp | 152 +++ qucs/qucs-filter/qw_coupled_ring_filter.h | 37 + 33 files changed, 15373 insertions(+), 72 deletions(-) create mode 100644 qucs/qucs-filter/bitmaps/CCoupled.svg create mode 100644 qucs/qucs-filter/bitmaps/CCoupled_Lines.svg create mode 100644 qucs/qucs-filter/bitmaps/CCoupled_Lines_Microstrip.svg create mode 100644 qucs/qucs-filter/bitmaps/CCoupled_Microstrip.svg create mode 100644 qucs/qucs-filter/bitmaps/CCoupled_Shunt_Resonators.svg create mode 100644 qucs/qucs-filter/bitmaps/LC_Ladder_Pi_BPF.svg create mode 100644 qucs/qucs-filter/bitmaps/LC_Ladder_Pi_HPF.svg create mode 100644 qucs/qucs-filter/bitmaps/LC_Ladder_Pi_LPF.svg create mode 100644 qucs/qucs-filter/bitmaps/LC_Ladder_Pi_Notch.svg create mode 100644 qucs/qucs-filter/bitmaps/LC_Ladder_Tee_BPF.svg create mode 100644 qucs/qucs-filter/bitmaps/LC_Ladder_Tee_HPF.svg create mode 100644 qucs/qucs-filter/bitmaps/LC_Ladder_Tee_LPF.svg create mode 100644 qucs/qucs-filter/bitmaps/LC_Ladder_Tee_Notch.svg create mode 100644 qucs/qucs-filter/bitmaps/LC_cauer_bandpass.svg create mode 100644 qucs/qucs-filter/bitmaps/LC_cauer_lowpass.svg create mode 100644 qucs/qucs-filter/bitmaps/LC_cauer_notch.svg create mode 100644 qucs/qucs-filter/bitmaps/Quarterwave_Bandpass_Ideal.svg create mode 100644 qucs/qucs-filter/bitmaps/Quarterwave_Bandpass_Microstrip.svg create mode 100644 qucs/qucs-filter/bitmaps/Quarterwave_Notch_Ideal.svg create mode 100644 qucs/qucs-filter/bitmaps/Quarterwave_Notch_Microstrip.svg create mode 100644 qucs/qucs-filter/bitmaps/Quarterwave_Side_Coupled_Ring.svg create mode 100644 qucs/qucs-filter/bitmaps/Stepped_Impedance_Ideal.svg create mode 100644 qucs/qucs-filter/bitmaps/Stepped_Impedance_Microstrip.svg create mode 100644 qucs/qucs-filter/ccoupled_shunt_resonators.cpp create mode 100644 qucs/qucs-filter/ccoupled_shunt_resonators.h create mode 100644 qucs/qucs-filter/qw_coupled_ring_filter.cpp create mode 100644 qucs/qucs-filter/qw_coupled_ring_filter.h diff --git a/qucs/qucs-filter/CMakeLists.txt b/qucs/qucs-filter/CMakeLists.txt index 6964fe4683..71aef5da75 100644 --- a/qucs/qucs-filter/CMakeLists.txt +++ b/qucs/qucs-filter/CMakeLists.txt @@ -63,6 +63,8 @@ SET(QUCS-FILTER_SRCS stepz_filter.cpp tl_filter.cpp quarterwave_filter.cpp + qw_coupled_ring_filter.cpp + ccoupled_shunt_resonators.cpp ) SET(QUCS-FILTER_HDRS diff --git a/qucs/qucs-filter/Makefile.am b/qucs/qucs-filter/Makefile.am index 86219ef79b..6374bcecee 100644 --- a/qucs/qucs-filter/Makefile.am +++ b/qucs/qucs-filter/Makefile.am @@ -44,6 +44,8 @@ qucsfilter_SOURCES = \ main.cpp \ qf_poly.cpp \ quarterwave_filter.cpp \ + qw_coupled_ring_filter.cpp \ + ccoupled_shunt_resonators.cpp \ qrc_qucsfilter.cpp qrc_qucsfilter.cpp: qucsfilter.qrc @@ -61,7 +63,6 @@ noinst_HEADERS = \ qf_poly.h \ qf_filter.h \ qf_cauer.h \ - quarterwave_filter.h \ qf_matrix.h SUFFIXES = .moc.cpp diff --git a/qucs/qucs-filter/bitmaps/CCoupled.svg b/qucs/qucs-filter/bitmaps/CCoupled.svg new file mode 100644 index 0000000000..56128ec977 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/CCoupled.svg @@ -0,0 +1,478 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/CCoupled_Lines.svg b/qucs/qucs-filter/bitmaps/CCoupled_Lines.svg new file mode 100644 index 0000000000..9b78089190 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/CCoupled_Lines.svg @@ -0,0 +1,606 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/CCoupled_Lines_Microstrip.svg b/qucs/qucs-filter/bitmaps/CCoupled_Lines_Microstrip.svg new file mode 100644 index 0000000000..3ab04cd869 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/CCoupled_Lines_Microstrip.svg @@ -0,0 +1,998 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/CCoupled_Microstrip.svg b/qucs/qucs-filter/bitmaps/CCoupled_Microstrip.svg new file mode 100644 index 0000000000..7a2a69fa16 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/CCoupled_Microstrip.svg @@ -0,0 +1,700 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/CCoupled_Shunt_Resonators.svg b/qucs/qucs-filter/bitmaps/CCoupled_Shunt_Resonators.svg new file mode 100644 index 0000000000..bedc296cf8 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/CCoupled_Shunt_Resonators.svg @@ -0,0 +1,773 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/LC_Ladder_Pi_BPF.svg b/qucs/qucs-filter/bitmaps/LC_Ladder_Pi_BPF.svg new file mode 100644 index 0000000000..8ebcfdb96e --- /dev/null +++ b/qucs/qucs-filter/bitmaps/LC_Ladder_Pi_BPF.svg @@ -0,0 +1,704 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/LC_Ladder_Pi_HPF.svg b/qucs/qucs-filter/bitmaps/LC_Ladder_Pi_HPF.svg new file mode 100644 index 0000000000..14ad25a1ba --- /dev/null +++ b/qucs/qucs-filter/bitmaps/LC_Ladder_Pi_HPF.svg @@ -0,0 +1,412 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/LC_Ladder_Pi_LPF.svg b/qucs/qucs-filter/bitmaps/LC_Ladder_Pi_LPF.svg new file mode 100644 index 0000000000..3a873914cb --- /dev/null +++ b/qucs/qucs-filter/bitmaps/LC_Ladder_Pi_LPF.svg @@ -0,0 +1,415 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/LC_Ladder_Pi_Notch.svg b/qucs/qucs-filter/bitmaps/LC_Ladder_Pi_Notch.svg new file mode 100644 index 0000000000..216ad72463 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/LC_Ladder_Pi_Notch.svg @@ -0,0 +1,642 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/LC_Ladder_Tee_BPF.svg b/qucs/qucs-filter/bitmaps/LC_Ladder_Tee_BPF.svg new file mode 100644 index 0000000000..f5400d78d4 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/LC_Ladder_Tee_BPF.svg @@ -0,0 +1,560 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/LC_Ladder_Tee_HPF.svg b/qucs/qucs-filter/bitmaps/LC_Ladder_Tee_HPF.svg new file mode 100644 index 0000000000..fa738028d5 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/LC_Ladder_Tee_HPF.svg @@ -0,0 +1,398 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/LC_Ladder_Tee_LPF.svg b/qucs/qucs-filter/bitmaps/LC_Ladder_Tee_LPF.svg new file mode 100644 index 0000000000..1a933d8bf5 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/LC_Ladder_Tee_LPF.svg @@ -0,0 +1,367 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/LC_Ladder_Tee_Notch.svg b/qucs/qucs-filter/bitmaps/LC_Ladder_Tee_Notch.svg new file mode 100644 index 0000000000..4108611604 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/LC_Ladder_Tee_Notch.svg @@ -0,0 +1,698 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/LC_cauer_bandpass.svg b/qucs/qucs-filter/bitmaps/LC_cauer_bandpass.svg new file mode 100644 index 0000000000..9ce1df6d10 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/LC_cauer_bandpass.svg @@ -0,0 +1,938 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/LC_cauer_lowpass.svg b/qucs/qucs-filter/bitmaps/LC_cauer_lowpass.svg new file mode 100644 index 0000000000..020534302b --- /dev/null +++ b/qucs/qucs-filter/bitmaps/LC_cauer_lowpass.svg @@ -0,0 +1,522 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/LC_cauer_notch.svg b/qucs/qucs-filter/bitmaps/LC_cauer_notch.svg new file mode 100644 index 0000000000..f80a3a2130 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/LC_cauer_notch.svg @@ -0,0 +1,784 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/Quarterwave_Bandpass_Ideal.svg b/qucs/qucs-filter/bitmaps/Quarterwave_Bandpass_Ideal.svg new file mode 100644 index 0000000000..e621d3aaf7 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/Quarterwave_Bandpass_Ideal.svg @@ -0,0 +1,983 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/Quarterwave_Bandpass_Microstrip.svg b/qucs/qucs-filter/bitmaps/Quarterwave_Bandpass_Microstrip.svg new file mode 100644 index 0000000000..0cd3dae80e --- /dev/null +++ b/qucs/qucs-filter/bitmaps/Quarterwave_Bandpass_Microstrip.svg @@ -0,0 +1,862 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/Quarterwave_Notch_Ideal.svg b/qucs/qucs-filter/bitmaps/Quarterwave_Notch_Ideal.svg new file mode 100644 index 0000000000..80b93f4a5e --- /dev/null +++ b/qucs/qucs-filter/bitmaps/Quarterwave_Notch_Ideal.svg @@ -0,0 +1,843 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/Quarterwave_Notch_Microstrip.svg b/qucs/qucs-filter/bitmaps/Quarterwave_Notch_Microstrip.svg new file mode 100644 index 0000000000..1c3cf55eff --- /dev/null +++ b/qucs/qucs-filter/bitmaps/Quarterwave_Notch_Microstrip.svg @@ -0,0 +1,722 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/Quarterwave_Side_Coupled_Ring.svg b/qucs/qucs-filter/bitmaps/Quarterwave_Side_Coupled_Ring.svg new file mode 100644 index 0000000000..840bf5cb68 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/Quarterwave_Side_Coupled_Ring.svg @@ -0,0 +1,587 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/Stepped_Impedance_Ideal.svg b/qucs/qucs-filter/bitmaps/Stepped_Impedance_Ideal.svg new file mode 100644 index 0000000000..2a71a089f6 --- /dev/null +++ b/qucs/qucs-filter/bitmaps/Stepped_Impedance_Ideal.svg @@ -0,0 +1,426 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + + + + + Z=Z2 + L=L2 + + + + + + + + + + + + + + + + Z=Z1 + L=L1 + + + + + + + + + + + + + + + + Z=Z3 + L=L3 + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/bitmaps/Stepped_Impedance_Microstrip.svg b/qucs/qucs-filter/bitmaps/Stepped_Impedance_Microstrip.svg new file mode 100644 index 0000000000..67b6de79fe --- /dev/null +++ b/qucs/qucs-filter/bitmaps/Stepped_Impedance_Microstrip.svg @@ -0,0 +1,396 @@ + + + + + + image/svg+xml + + + + + + Qt Svg Document + Generated with Qt + + + + + + + + + + + + W=W3 + L=L3 + + + + + + + + + + + + W=W2 + L=L2 + + + + + + + + + + + + W=W1 + L=L1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qucs/qucs-filter/ccoupled_shunt_resonators.cpp b/qucs/qucs-filter/ccoupled_shunt_resonators.cpp new file mode 100644 index 0000000000..1eb87361ef --- /dev/null +++ b/qucs/qucs-filter/ccoupled_shunt_resonators.cpp @@ -0,0 +1,117 @@ +/* + * ccoupled_shunt_resonators.cpp - Capacitively coupled shunt resonators filter filter implementation + * + * copyright (C) 2015 Andres Martinez-Mera + * + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this package; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "ccoupled_shunt_resonators.h" + +#include +#include + + +/* +References: +Microwave engineering. David M Pozar. John Wiley and Sons. 4th Edition. Pages 443-448 +*/ + +CCoupled_Shunt_Resonator_Filter::CCoupled_Shunt_Resonator_Filter() +{ +} + +// ----------------------------------------------------------------------- +// This function generates the schematic +QString* CCoupled_Shunt_Resonator_Filter::createSchematic(tFilter *Filter, tSubstrate *Substrate, bool isMicrostrip) +{ +//Design equations +double f0 = Filter->Frequency+0.5*(Filter->Frequency2-Filter->Frequency);//Central frequency +double delta = (Filter->Frequency2-Filter->Frequency)/f0; +double w0 = 2*pi*f0; +double lambda0 = 3e8/f0; +int N=Filter->Order; +double Z0 = Filter->Impedance;//Reference impedance +double J[N+1], C[N+1], g[N+1], deltaC[N], l[N]; +double fstart = Filter->Frequency-1e9; +double fstop = Filter->Frequency2+1e9; +if (fstart < 0) fstart = 0; + +int x = 90;//Index for drawing the schematic +QString *wirestr= new QString("<0 -30 60 -30 "" 0 0 0 "">\n"); +QString *s = new QString("\n"); + *s += "\n"; + *s += QString("\n").arg(Filter->Impedance); + *s += QString("\n"); + + for(int i = 0; i < N; i++)//Component calculation + { + g[i] = getNormValue(i, Filter); + if (i == 0)//First element + { + J[i]= sqrt(pi*delta/(4*g[i]))/Z0; + C[i] = J[i]/(w0*sqrt(1-Z0*Z0*J[i]*J[i])); + *s += QString("\n").arg(x).arg(C[i]); + x+=60; + continue; + } + + J[i]= (0.25*pi*delta/sqrt(g[i]*g[i-1]))/Z0; + C[i] = J[i]/w0; + deltaC[i-1] = -C[i-1]-C[i]; + l[i-1] = (Z0*w0*deltaC[i-1]/(2*pi))*lambda0; + if (l[i-1] < 0) l[i-1] += lambda0/4; + *wirestr += QString("<%1 -30 %2 -30 "" 0 0 0 "">\n").arg(x-30).arg(x+30); + *s += QString("\n").arg(x).arg(Filter->Impedance).arg(l[i-1]); + *s += QString("\n").arg(x); + x += 60; + *s += QString("\n").arg(x).arg(C[i]); + x += 60; + } + +g[N] = getNormValue(N, Filter); +J[N] = sqrt(pi*delta/(4*g[N-1]*g[N]))/Z0; +C[N] = J[N]/(w0*sqrt(1-Z0*Z0*J[N]*J[N])); +deltaC[N-1] = -C[N]-C[N-1]; +l[N-1] = (Z0*w0*deltaC[N-1]/(2*pi))*lambda0; +if (l[N-1] < 0) l[N-1] +=lambda0/4; + + //Wiring + *wirestr += QString("<%1 -30 %2 -30 "" 0 0 0 "">\n").arg(x-30).arg(x+30); + *s += QString("\n").arg(x).arg(Filter->Impedance).arg(l[N-1]); + *s += QString("\n").arg(x); + x += 60; + *s += QString("\n ").arg(x).arg(C[N]); + x += 60; + *wirestr += QString("<%1 -30 %2 -30 "" 0 0 0 "">\n").arg(x-30).arg(x+30); + *s += QString("\n").arg(x+30).arg(Filter->Impedance); + *s += QString("\n").arg(x+30); + + *s += QString("<.SP SP1 1 70 150 0 67 0 0 \"lin\" 1 \"%1\" 1 \"%2\" 1 \"300\" 1 \"no\" 0 \"1\" 0 \"2\" 0 \"no\" 0 \"no\" 0>\n").arg(num2str(fstart)).arg(num2str(fstop)); + *s += QString("\n"); + *s += "\n"; + + *s += "\n"; + *s += wirestr; + *s += "\n" ; + return s; +} diff --git a/qucs/qucs-filter/ccoupled_shunt_resonators.h b/qucs/qucs-filter/ccoupled_shunt_resonators.h new file mode 100644 index 0000000000..962e30c4f4 --- /dev/null +++ b/qucs/qucs-filter/ccoupled_shunt_resonators.h @@ -0,0 +1,37 @@ +/* + * ccoupled_shunt_resonators.h - Capacitively coupled shunt resonators filter definition + * + * copyright (C) 2015 Andres Martinez-Mera + * + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this package; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * + */ +#ifndef CCOUPLED_SHUNT_RESONATOR_FILTER_H +#define CCOUPLED_SHUNT_RESONATOR_FILTER_H + + +#include "tl_filter.h" + +// Quarter wave side coupled ring filter +class CCoupled_Shunt_Resonator_Filter : public TL_Filter { +public: + CCoupled_Shunt_Resonator_Filter(); + + static QString* createSchematic(tFilter*, tSubstrate*, bool); +}; + +#endif diff --git a/qucs/qucs-filter/lc_filter.cpp b/qucs/qucs-filter/lc_filter.cpp index d060c77721..5be5a7c74d 100644 --- a/qucs/qucs-filter/lc_filter.cpp +++ b/qucs/qucs-filter/lc_filter.cpp @@ -162,7 +162,7 @@ QString* LC_Filter::createSchematic(tFilter *Filter, bool piType) else Value2 = 10.0 * Filter->Frequency; *s += QString("<.SP SP1 1 70 %1 0 67 0 0 \"log\" 1 \"%2Hz\" 1 \"%3Hz\" 1 \"201\" 1 \"no\" 0 \"1\" 0 \"2\" 0>\n").arg(yc).arg(num2str(Value)).arg(num2str(Value2)); - *s += QString("\n").arg(yc+10); + *s += QString("\n").arg(yc+10); *s += "\n"; *s += "\n"; @@ -256,7 +256,7 @@ QString* LC_Filter::createSchematic(tFilter *Filter, bool piType) } else { if(Filter->Order & 1) - *s += QString("<%1 240 %2 240 \"\" 0 0 0>\n").arg(x+170).arg(x+210); + *s += QString("<%1 240 %2 240 \"\" 0 0 0>\n").arg(x+30).arg(x+70); else *s += QString("<%1 240 %2 240 \"\" 0 0 0>\n").arg(x+110).arg(x+210); } diff --git a/qucs/qucs-filter/qucsfilter.cpp b/qucs/qucs-filter/qucsfilter.cpp index 587436acac..9b03c8a667 100644 --- a/qucs/qucs-filter/qucsfilter.cpp +++ b/qucs/qucs-filter/qucsfilter.cpp @@ -44,6 +44,8 @@ #include "cline_filter.h" #include "stepz_filter.h" #include "quarterwave_filter.h" +#include "qw_coupled_ring_filter.h" +#include "ccoupled_shunt_resonators.h" #include "qf_poly.h" #include "qf_filter.h" @@ -96,12 +98,9 @@ QucsFilter::QucsFilter() all = new QGridLayout(); all->setSpacing(3); - // assign layout to central widget - centralWidget->setLayout(all); - // ........................................................... box1 = new QGroupBox(tr("Filter"), this); - all->addWidget(box1,0,0); + QHBoxLayout *hbox = new QHBoxLayout(); gbox1 = new QGridLayout(); gbox1->setSpacing(3); @@ -113,115 +112,120 @@ QucsFilter::QucsFilter() ComboRealize = new QComboBox(this); ComboRealize->addItem("LC ladder (pi type)"); ComboRealize->addItem("LC ladder (tee type)"); - ComboRealize->addItem("C-coupled transmission lines"); - ComboRealize->addItem("Microstrip end-coupled"); - ComboRealize->addItem("Coupled transmission lines"); - ComboRealize->addItem("Coupled microstrip"); + ComboRealize->addItem("End coupled transmission lines"); + ComboRealize->addItem("Parallel coupled transmission lines"); ComboRealize->addItem("Stepped-impedance"); - ComboRealize->addItem("Stepped-impedance microstrip"); - ComboRealize->addItem("Quarter wave"); - ComboRealize->addItem("Quarter wave microstrip"); + ComboRealize->addItem("Quarter wave resonators"); + ComboRealize->addItem("Quarter wave side coupled ring resonator"); + ComboRealize->addItem("Capacitively coupled shunt resonators"); ComboRealize->addItem("Equation-defined"); gbox1->addWidget(ComboRealize, 0,1); connect(ComboRealize, SIGNAL(activated(int)), SLOT(slotRealizationChanged(int))); + //Synthesize Microstrip + MicrostripcheckBox=new QCheckBox("Microstrip implementation"); + MicrostripcheckBox->setChecked(false); + MicrostripcheckBox->setEnabled(false); + gbox1->addWidget(MicrostripcheckBox, 1,0); + connect(MicrostripcheckBox, SIGNAL(clicked()), SLOT(on_MicrostripcheckBox_clicked())); + QLabel *Label1 = new QLabel(tr("Filter type:"), this); - gbox1->addWidget(Label1, 1,0); + gbox1->addWidget(Label1, 2,0); ComboType = new QComboBox(this); ComboType->addItem("Bessel"); ComboType->addItem("Butterworth"); ComboType->addItem("Chebyshev"); ComboType->addItem("Cauer"); - gbox1->addWidget(ComboType, 1,1); + gbox1->addWidget(ComboType, 2,1); connect(ComboType, SIGNAL(activated(int)), SLOT(slotTypeChanged(int))); QLabel *Label2 = new QLabel(tr("Filter class:"), this); - gbox1->addWidget(Label2, 2,0); + gbox1->addWidget(Label2, 3,0); ComboClass = new QComboBox(this); ComboClass->addItem(tr("Low pass")); ComboClass->addItem(tr("High pass")); ComboClass->addItem(tr("Band pass")); ComboClass->addItem(tr("Band stop")); - gbox1->addWidget(ComboClass, 2,1); + gbox1->addWidget(ComboClass, 3,1); connect(ComboClass, SIGNAL(activated(int)), SLOT(slotClassChanged(int))); IntVal = new QIntValidator(1, 200, this); DoubleVal = new QDoubleValidator(this); LabelOrder = new QLabel(tr("Order:"), this); - gbox1->addWidget(LabelOrder, 3,0); + gbox1->addWidget(LabelOrder, 4,0); EditOrder = new QLineEdit("3", this); EditOrder->setValidator(IntVal); - gbox1->addWidget(EditOrder, 3,1); + gbox1->addWidget(EditOrder, 4,1); LabelStart = new QLabel(tr("Corner frequency:"), this); - gbox1->addWidget(LabelStart, 4,0); + gbox1->addWidget(LabelStart, 5,0); EditCorner = new QLineEdit("1", this); EditCorner->setValidator(DoubleVal); - gbox1->addWidget(EditCorner, 4,1); + gbox1->addWidget(EditCorner, 5,1); ComboCorner = new QComboBox(this); ComboCorner->addItem("Hz"); ComboCorner->addItem("kHz"); ComboCorner->addItem("MHz"); ComboCorner->addItem("GHz"); ComboCorner->setCurrentIndex(3); - gbox1->addWidget(ComboCorner, 4,2); + gbox1->addWidget(ComboCorner, 5,2); LabelStop = new QLabel(tr("Stop frequency:"), this); - gbox1->addWidget(LabelStop, 5,0); + gbox1->addWidget(LabelStop, 6,0); EditStop = new QLineEdit("2", this); EditStop->setValidator(DoubleVal); - gbox1->addWidget(EditStop, 5,1); + gbox1->addWidget(EditStop, 6,1); ComboStop = new QComboBox(this); ComboStop->addItem("Hz"); ComboStop->addItem("kHz"); ComboStop->addItem("MHz"); ComboStop->addItem("GHz"); ComboStop->setCurrentIndex(3); - gbox1->addWidget(ComboStop, 5,2); + gbox1->addWidget(ComboStop, 6,2); LabelBandStop = new QLabel(tr("Stop band frequency:"), this); - gbox1->addWidget(LabelBandStop, 6,0); + gbox1->addWidget(LabelBandStop, 7,0); EditBandStop = new QLineEdit("3", this); EditBandStop->setValidator(DoubleVal); - gbox1->addWidget(EditBandStop, 6,1); + gbox1->addWidget(EditBandStop, 7,1); ComboBandStop = new QComboBox(this); ComboBandStop->addItem("Hz"); ComboBandStop->addItem("kHz"); ComboBandStop->addItem("MHz"); ComboBandStop->addItem("GHz"); ComboBandStop->setCurrentIndex(3); - gbox1->addWidget(ComboBandStop, 6,2); + gbox1->addWidget(ComboBandStop, 7,2); LabelRipple = new QLabel(tr("Pass band ripple:"), this); - gbox1->addWidget(LabelRipple, 7,0); + gbox1->addWidget(LabelRipple, 8,0); EditRipple = new QLineEdit("1", this); EditRipple->setValidator(DoubleVal); - gbox1->addWidget(EditRipple, 7,1); + gbox1->addWidget(EditRipple, 8,1); LabelRipple_dB = new QLabel("dB", this); - gbox1->addWidget(LabelRipple_dB, 7,2); + gbox1->addWidget(LabelRipple_dB, 8,2); LabelAtten = new QLabel(tr("Stop band attenuation:"), this); - gbox1->addWidget(LabelAtten, 8,0); + gbox1->addWidget(LabelAtten, 9,0); EditAtten = new QLineEdit("20", this); EditAtten->setValidator(DoubleVal); - gbox1->addWidget(EditAtten, 8,1); + gbox1->addWidget(EditAtten, 9,1); LabelAtten_dB = new QLabel("dB", this); - gbox1->addWidget(LabelAtten_dB, 8,2); + gbox1->addWidget(LabelAtten_dB, 9,2); LabelImpedance = new QLabel(tr("Impedance:"), this); - gbox1->addWidget(LabelImpedance, 9,0); + gbox1->addWidget(LabelImpedance, 10,0); EditImpedance = new QLineEdit("50", this); EditImpedance->setValidator(DoubleVal); - gbox1->addWidget(EditImpedance, 9,1); + gbox1->addWidget(EditImpedance, 10,1); LabelOhm = new QLabel("Ohm", this); - gbox1->addWidget(LabelOhm, 9,2); + gbox1->addWidget(LabelOhm, 10,2); // ........................................................... + box2 = new QGroupBox(tr("Microstrip Substrate"), this); box2->setEnabled(false); - all->addWidget(box2,0,1); gbox2 = new QGridLayout(); gbox2->setSpacing(3); @@ -276,16 +280,42 @@ QucsFilter::QucsFilter() QSpacerItem *mySpacer=new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding); gbox2->addItem(mySpacer, 5, 0, 1, -1); + QSize sz; + boxImage = new QGroupBox(tr("Preview"), this); + gboxImage = new QGridLayout(); + boxImage->setLayout(gboxImage); + QString s1 = ":/bitmaps/LC_Ladder_Pi_LPF.svg"; + imgLayout = new QSvgWidget(s1); + sz = imgLayout->size(); + imgLayout->setFixedSize(.5*sz); + gboxImage->addWidget(imgLayout); + + + // ........................................................... + QVBoxLayout *vboxButtons = new QVBoxLayout(); QPushButton *ButtonGo = new QPushButton(tr("Calculate and put into Clipboard"), this); connect(ButtonGo, SIGNAL(clicked()), SLOT(slotCalculate())); - all->addWidget(ButtonGo, 1, 0, 1, -1); + vboxButtons->addWidget(ButtonGo); LabelResult = new QLabel(this); ResultState = 100; slotShowResult(); LabelResult->setAlignment(Qt::AlignHCenter); - all->addWidget(LabelResult, 2, 0, 1, -1); + vboxButtons->addWidget(LabelResult); + + QVBoxLayout *vbox_all = new QVBoxLayout(); + QVBoxLayout *vboxRealisation = new QVBoxLayout(); + QVBoxLayout *vboxMicrostrip = new QVBoxLayout(); + + vboxRealisation->addWidget(box1); + hbox->addLayout(vboxRealisation); + vboxMicrostrip->addWidget(box2); + vboxMicrostrip->addWidget(boxImage); + hbox->addLayout(vboxMicrostrip); + vbox_all->addLayout(hbox); + vbox_all->addLayout(vboxButtons); + centralWidget->setLayout(vbox_all); // ------- finally set initial state -------- slotTypeChanged(0); @@ -363,32 +393,27 @@ QString * QucsFilter::calculateFilter(struct tFilter * Filter) Substrate.minWidth = EditMinWidth->text().toDouble() / 1e3; Substrate.maxWidth = EditMaxWidth->text().toDouble() / 1e3; + bool isMicrostrip = MicrostripcheckBox->isChecked(); switch(ComboRealize->currentIndex()) { - case 2: // C-coupled transmission line filter - s = Line_Filter::createSchematic(Filter, &Substrate, false); - return s; - case 3: // microstrip end-coupled filter - s = Line_Filter::createSchematic(Filter, &Substrate, true); - return s; - case 4: // coupled transmission line filter - s = CoupledLine_Filter::createSchematic(Filter, &Substrate, false); + case 2: // End coupled transmission line filter + s = Line_Filter::createSchematic(Filter, &Substrate, isMicrostrip); return s; - case 5: // coupled microstrip line filter - s = CoupledLine_Filter::createSchematic(Filter, &Substrate, true); + case 3: // Parallel coupled transmission line filter + s = CoupledLine_Filter::createSchematic(Filter, &Substrate, isMicrostrip); return s; - case 6: // stepped-impedance transmission line filter - s = StepImpedance_Filter::createSchematic(Filter, &Substrate, false); + case 4: // stepped-impedance transmission line filter + s = StepImpedance_Filter::createSchematic(Filter, &Substrate, isMicrostrip); return s; - case 7: // stepped-impedance microstrip line filter - s = StepImpedance_Filter::createSchematic(Filter, &Substrate, true); + case 5: // Quarter wave transmission line filter + s = QuarterWave_Filter::createSchematic(Filter, &Substrate, isMicrostrip); return s; - case 8: // Quarter wave transmission line filter - s = QuarterWave_Filter::createSchematic(Filter, &Substrate, false); + case 6: // Quarter wave side coupled ring resonator transmission + s = QW_Coupled_Ring_Filter::createSchematic(Filter, &Substrate, isMicrostrip); return s; - case 9: // Quarter wave microstrip line filter - s = QuarterWave_Filter::createSchematic(Filter, &Substrate, true); + case 7: // Capacitively coupled shunt resonators + s = CCoupled_Shunt_Resonator_Filter::createSchematic(Filter, &Substrate, isMicrostrip); return s; - case 10: // equation defined filter + case 8: // equation defined filter s = Equation_Filter::createSchematic(Filter); return s; @@ -517,6 +542,7 @@ void QucsFilter::slotShowResult() // ************************************************************ void QucsFilter::slotTypeChanged(int index) { + FlushImage(); switch(index) { case TYPE_BESSEL: case TYPE_BUTTERWORTH: @@ -556,6 +582,7 @@ void QucsFilter::slotTypeChanged(int index) // ************************************************************ void QucsFilter::slotClassChanged(int index) { + FlushImage(); switch(index) { case CLASS_LOWPASS: case CLASS_HIGHPASS: @@ -582,18 +609,79 @@ void QucsFilter::slotClassChanged(int index) } } +//--------------------------------------------------------- +// This function updates the preview window +void QucsFilter::FlushImage() +{ + QString s1; + bool isMicrostrip = MicrostripcheckBox->isChecked(); + bool isCauer = (ComboType->currentIndex() == 3); + switch(ComboRealize->currentIndex()) + { + case 0://LC pi + switch(ComboClass->currentIndex()) + { + case 0: (isCauer) ? s1 = ":/bitmaps/LC_cauer_lowpass.svg" : s1 = ":/bitmaps/LC_Ladder_Pi_LPF.svg"; break; + case 1: s1 = ":/bitmaps/LC_Ladder_Pi_HPF.svg"; break; + case 2: (isCauer) ? s1 = ":/bitmaps/LC_cauer_bandpass.svg" : s1 = ":/bitmaps/LC_Ladder_Pi_BPF.svg"; break; + case 3: (isCauer) ? s1 = ":/bitmaps/LC_cauer_notch.svg" : s1 = ":/bitmaps/LC_Ladder_Pi_Notch.svg";break; + } + break; + case 1://LC Tee + switch(ComboClass->currentIndex()) + { + case 0: (isCauer) ? s1 = ":/bitmaps/LC_cauer_lowpass.svg" : s1 = ":/bitmaps/LC_Ladder_Tee_LPF.svg"; break; + case 1: s1 = ":/bitmaps/LC_Ladder_Tee_HPF.svg"; break; + case 2: (isCauer) ? s1 = ":/bitmaps/LC_cauer_bandpass.svg" : s1 = ":/bitmaps/LC_Ladder_Tee_BPF.svg"; break; + case 3: (isCauer) ? s1 = ":/bitmaps/LC_cauer_notch.svg" : s1 = ":/bitmaps/LC_Ladder_Tee_Notch.svg";break; + } + break; + case 2: + (isMicrostrip) ? s1 = ":/bitmaps/CCoupled_Microstrip.svg" : s1 = ":/bitmaps/CCoupled.svg"; + break; + case 3: + (isMicrostrip) ? s1 = ":/bitmaps/CCoupled_Lines_Microstrip.svg" : s1 = ":/bitmaps/CCoupled_Lines.svg"; + break; + case 4: + (isMicrostrip) ? s1 = ":/bitmaps/Stepped_Impedance_Microstrip.svg" : s1 = ":/bitmaps/Stepped_Impedance_Ideal.svg"; + break; + case 5: + switch(ComboClass->currentIndex()) + { + case 2: (isMicrostrip) ? s1 = ":/bitmaps/Quarterwave_Bandpass_Microstrip.svg" : s1 = ":/bitmaps/Quarterwave_Bandpass_Ideal.svg"; break; + case 3: (isMicrostrip) ? s1 = ":/bitmaps/Quarterwave_Notch_Microstrip.svg" : s1 = ":/bitmaps/Quarterwave_Notch_Ideal.svg";break; + } + break; + case 6: + s1 = ":/bitmaps/Quarterwave_Side_Coupled_Ring.svg"; + break; + case 7: + s1 = ":/bitmaps/CCoupled_Shunt_Resonators.svg"; + break; + } + imgLayout->load(s1); +} + // ************************************************************ void QucsFilter::slotRealizationChanged(int index) { + FlushImage(); if(index < 2) // set to LC ladder type? + { + MicrostripcheckBox->setEnabled(false); + MicrostripcheckBox->setChecked(false); ComboClass->setEnabled(true); - else if(index < 6) { // set to "transmission line" types? + } + else + { + MicrostripcheckBox->setEnabled(true); + if(index <= 3) { // set to "transmission line" types? // set to bandpass fixed ComboClass->setCurrentIndex(CLASS_BANDPASS); slotClassChanged(CLASS_BANDPASS); ComboClass->setEnabled(false); } - else if(index < 8) { // set to "stepped impedance" types? + else if(index < 5) { // set to "stepped impedance" types? // set to lowpass fixed ComboClass->setCurrentIndex(CLASS_LOWPASS); slotClassChanged(CLASS_LOWPASS); @@ -601,20 +689,45 @@ void QucsFilter::slotRealizationChanged(int index) } else ComboClass->setEnabled(true); - - if((index == 3)||(index == 5)||(index == 7)||(index == 9)) - box2->setEnabled(true); - else - box2->setEnabled(false); - - if ((index == 8)||(index == 9)) + } + if (index == 5)//Quarter wave coupled resonator { ComboClass->setCurrentIndex(CLASS_BANDPASS); slotClassChanged(CLASS_BANDPASS); } + if (index == 6)//Quarter wave ring + { + ComboClass->setEnabled(false); + ComboType->setEnabled(false); + EditOrder->setEnabled(false); + LabelStart->setText("1st transmission zero frequency:"); + LabelStop->setText("Central frequency:"); + } + else + { + ComboType->setEnabled(true); + EditOrder->setEnabled(true); + LabelStart->setText(tr("Corner frequency:")); + LabelStop->setText(tr("Stop frequency:")); + } + if ((index == 6)||(index == 7)) + { + MicrostripcheckBox->setEnabled(false);//Microstrip implementation does not work... + ComboClass->setCurrentIndex(CLASS_BANDPASS); + slotClassChanged(CLASS_BANDPASS); + ComboClass->setEnabled(false); + } +} + +void QucsFilter::on_MicrostripcheckBox_clicked() +{ + FlushImage(); + bool microcheck = MicrostripcheckBox->isChecked(); + box2->setEnabled(microcheck); } -// ************************************************************ + +// ********************************************************** void QucsFilter::slotTakeEr(const QString& Text) { // If the ComboBox text was a material property, the material name diff --git a/qucs/qucs-filter/qucsfilter.h b/qucs/qucs-filter/qucsfilter.h index 0b00a96421..0019ab8154 100644 --- a/qucs/qucs-filter/qucsfilter.h +++ b/qucs/qucs-filter/qucsfilter.h @@ -21,6 +21,7 @@ #include #include #include +#include class QGridLayout; class QComboBox; @@ -57,6 +58,8 @@ private slots: void slotShowResult(); void slotRealizationChanged(int); void slotTakeEr(const QString&); + void FlushImage(); + void on_MicrostripcheckBox_clicked(); private: void setError(const QString&); @@ -64,8 +67,8 @@ private slots: int ResultState; - QGridLayout *all, *gbox1, *gbox2; - QGroupBox *box1, *box2; + QGridLayout *all, *gbox1, *gbox2, *gboxImage; + QGroupBox *box1, *box2, *boxImage; QComboBox *ComboRealize, *ComboType, *ComboClass, *ComboCorner, *ComboStop, *ComboBandStop, *ComboEr; QLineEdit *EditOrder, *EditCorner, *EditStop, *EditRipple, *EditImpedance, *EditThickness, *EditHeight, *EditMinWidth, *EditMaxWidth; QLineEdit *EditAtten, *EditBandStop; @@ -73,6 +76,8 @@ private slots: QLabel *LabelAtten, *LabelAtten_dB, *LabelBandStop, *LabelOrder, *LabelImpedance, *LabelOhm; QIntValidator *IntVal; QDoubleValidator *DoubleVal; + QSvgWidget *imgLayout; + QCheckBox * MicrostripcheckBox; }; #endif diff --git a/qucs/qucs-filter/qucsfilter.qrc b/qucs/qucs-filter/qucsfilter.qrc index baa3194268..e6597130a2 100644 --- a/qucs/qucs-filter/qucsfilter.qrc +++ b/qucs/qucs-filter/qucsfilter.qrc @@ -1,5 +1,28 @@ bitmaps/big.qucs.xpm + bitmaps/LC_Ladder_Pi_LPF.svg + bitmaps/LC_Ladder_Pi_HPF.svg + bitmaps/LC_Ladder_Pi_BPF.svg + bitmaps/LC_Ladder_Pi_Notch.svg + bitmaps/LC_Ladder_Tee_LPF.svg + bitmaps/LC_Ladder_Tee_HPF.svg + bitmaps/LC_Ladder_Tee_BPF.svg + bitmaps/LC_Ladder_Tee_Notch.svg + bitmaps/CCoupled.svg + bitmaps/CCoupled_Lines.svg + bitmaps/CCoupled_Lines_Microstrip.svg + bitmaps/CCoupled_Microstrip.svg + bitmaps/Quarterwave_Bandpass_Ideal.svg + bitmaps/Quarterwave_Bandpass_Microstrip.svg + bitmaps/Quarterwave_Notch_Ideal.svg + bitmaps/Quarterwave_Notch_Microstrip.svg + bitmaps/Quarterwave_Side_Coupled_Ring.svg + bitmaps/Stepped_Impedance_Ideal.svg + bitmaps/Stepped_Impedance_Microstrip.svg + bitmaps/CCoupled_Shunt_Resonators.svg + bitmaps/LC_cauer_lowpass.svg + bitmaps/LC_cauer_bandpass.svg + bitmaps/LC_cauer_notch.svg diff --git a/qucs/qucs-filter/qw_coupled_ring_filter.cpp b/qucs/qucs-filter/qw_coupled_ring_filter.cpp new file mode 100644 index 0000000000..63ae6cc49c --- /dev/null +++ b/qucs/qucs-filter/qw_coupled_ring_filter.cpp @@ -0,0 +1,152 @@ +/* + * qw_coupled_ring_filter.cpp - Quarter wavelength side coupled ring filter implementation + * + * copyright (C) 2015 Andres Martinez-Mera + * + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this package; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "qw_coupled_ring_filter.h" + +#include +#include + + +/* +References: +Quarter Wavelength Side-Coupled Ring Resonator for Bandpass filters. Mohd Khairul Mohd Salleh, Gaƫtan Prigent, Olivier Pigaglio, and Raymond Crampagne. IEEE TRANSACTIONS ON MICROWAVE THEORY AND TECHNIQUES. VOL. 56, NO. 1, JANUARY 2008 +*/ + +QW_Coupled_Ring_Filter::QW_Coupled_Ring_Filter() +{ +} + +// ----------------------------------------------------------------------- +QString* QW_Coupled_Ring_Filter::createSchematic(tFilter *Filter, tSubstrate *Substrate, bool isMicrostrip) +{ + // Design equations + double f0 = Filter->Frequency+0.5*(Filter->Frequency2-Filter->Frequency);//Central frequency + double ftz = Filter->Frequency;//First transmission zero + double Z0 = Filter->Impedance;//Reference impedance + double Ze = 60;//Even mode impedance (fixed term) + double lambda0 = LIGHTSPEED/f0; + double y = 0.01; // Bandpass ripple (dB) + double Ye = 1/Ze; + double x = -pow(10,(-y/20)); + double rf = ftz/f0;//Ratio between the first transmission zero and the central frequency + double TZ = (sin(pi*ftz/(2*f0))*sin(pi*ftz/(2*f0)))/(1 + cos(pi*ftz/(2*f0))*cos(pi*ftz/(2*f0))); + double theta_tz = pi*ftz/(2*f0); + double SQ = sqrt((1-x*x)*(TZ*TZ-1)*(TZ*TZ-1)*Z0*Z0); + double R = -Ye*Z0*(Z0*(x*x-2)+2*SQ); + double Q = 2*TZ*TZ*Ye*Z0*(Z0*(x*x-2)+SQ); + double P = 4*x*Z0*TZ*TZ*TZ -Ye*Z0*Z0*(TZ*TZ*TZ*TZ)*(x*x-2) + 4*TZ*x*(SQ-Z0); + double Zr = (2*TZ*x + TZ*TZ*Ye*Z0 + Ye*(-Z0+SQ-x*sqrt((P+Q+R)/(Ye*x*x))))/(2*x*Ye); + double Yue = TZ/Zr;//Unit element capacitance + double Yo = Yue*Ye/(2*Ye-Yue); + double Zo = 1/Yo; //Impedance of the odd mode + double l4 = lambda0/4; + double fstart = Filter->Frequency-1e9; + double fstop = Filter->Frequency2+1e9; + double width, er_eff, gap; + + if (Zo < 1) + { + QMessageBox::warning(0, QObject::tr("Error"), + QObject::tr("Please reduce the bandwidth between the attenuation poles\n")); + return NULL; + } + + if (fstart < 0) fstart = 0; + // create the Qucs schematic + QString *s = new QString("\n"); + *s += QString("\n"); + *s += QString("\n").arg(Z0); + *s += QString("\n"); + *s += QString("\n"); + *s += QString("<.SP SP1 1 -50 310 0 80 0 0 \"lin\" 1 \"%1\" 1 \"%2\" 1 \"300\" 1 \"no\" 0 \"1\" 0 \"2\" 0 \"no\" 0 \"no\" 0>\n").arg(num2str(fstart)).arg(num2str(fstop)); + + if (isMicrostrip)//Microstrip implementation + { + TL_Filter::getMicrostrip(Filter->Impedance, f0, Substrate, width, er_eff); + *s += QString("\n").arg(width).arg(l4/sqrt(er_eff)); + *s += QString("\n").arg(width).arg(l4/sqrt(er_eff)); + + sythesizeCoupledMicrostrip(Zo, Ze, f0, Substrate, width, gap, er_eff); + /*if((width < 1e-7) || (gap < 1e-7)) + { + QMessageBox::critical(0, "Error", "Filter can't be created."); + delete s; + return NULL; + }*/ + //Coupled lines + *s += QString("\n").arg(num2str(width)).arg(num2str(l4/sqrt(er_eff))).arg(num2str(gap)); + *s += QString("\n").arg(num2str(width)).arg(num2str(l4/sqrt(er_eff))).arg(num2str(gap)); + + //Microstrip open end + *s += QString("\n").arg(num2str(width)); + *s += QString("\n").arg(num2str(width)); + + *s += QString("\n").arg(Substrate->er).arg(num2str(Substrate->height)).arg(num2str(Substrate->thickness)).arg(Substrate->tand).arg(Substrate->resistivity).arg(Substrate->roughness); + } + else//Ideal transmission line implementation + { + *s += QString("\n").arg(Zr).arg(l4); + *s += QString("\n").arg(Zr).arg(l4); + *s += QString("\n").arg(Ze).arg(Zo).arg(l4); + *s += QString("\n").arg(Ze).arg(Zo).arg(l4); + + + } + *s += QString("\n"); + *s += QString("\n"); + *s += QString("\n"); + + + *s += QString("\n"); + *s += QString("<-100 30 -100 40 "" 0 0 0 "">\n"); + *s += QString("<-100 30 40 30 "" 0 0 0 "">\n"); + *s += QString("<100 -40 100 30 "" 0 0 0 "">\n"); + *s += QString("<100 -40 160 -40 "" 0 0 0 "">\n"); + *s += QString("<220 -40 280 -40 "" 0 0 0 "">\n"); + *s += QString("<280 -40 280 30 "" 0 0 0 "">\n"); + *s += QString("<280 90 280 140 "" 0 0 0 "">\n"); + *s += QString("<230 140 280 140 "" 0 0 0 "">\n"); + *s += QString("<100 140 170 140 "" 0 0 0 "">\n"); + *s += QString("<100 90 100 140 "" 0 0 0 "">\n"); + *s += QString("<340 30 470 30 "" 0 0 0 "">\n"); + + if (!isMicrostrip)//The microstrip coupled lines component is wider than the ideal coupled lines, so additional wires are required + { + *s += QString("<-100 30 80 30 "" 0 0 0 "">\n"); + *s += QString("<300 30 470 30 "" 0 0 0 "">\n"); + } + *s += QString("\n"); + + + *s += "\n"; + *s += QString("Frequency)).arg(num2str(Filter->Frequency2)); + *s += QString("Impedance matching %3 Ohm\">\n").arg(Filter->Impedance); + *s += "\n"; + + return s; +} diff --git a/qucs/qucs-filter/qw_coupled_ring_filter.h b/qucs/qucs-filter/qw_coupled_ring_filter.h new file mode 100644 index 0000000000..f37d8202fd --- /dev/null +++ b/qucs/qucs-filter/qw_coupled_ring_filter.h @@ -0,0 +1,37 @@ +/* + * qw_coupled_ring_filter.h - Quarter wavelength filter definition + * + * copyright (C) 2015 Andres Martinez-Mera + * + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this package; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * + */ +#ifndef QW_COUPLED_RING_FILTER_H +#define QW_COUPLED_RING_FILTER_H + + +#include "tl_filter.h" + +// Quarter wave side coupled ring filter +class QW_Coupled_Ring_Filter : public TL_Filter { +public: + QW_Coupled_Ring_Filter(); + + static QString* createSchematic(tFilter*, tSubstrate*, bool); +}; + +#endif