Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
FilterDesignTool.h
1/*
2 * Copyright (C) 2019-2025 Andrés Martínez Mera - andresmmera@protonmail.com
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#ifndef FILTERDESIGNTOOL_H
19#define FILTERDESIGNTOOL_H
20#include <QCheckBox>
21#include <QComboBox>
22#include <QGridLayout>
23#include <QGroupBox>
24#include <QHBoxLayout>
25#include <QLabel>
26#include <QLineEdit>
27#include <QMessageBox>
28#include <QPushButton>
29#include <QSpinBox>
30#include <QWidget>
31
32#include "../../Schematic/Network.h"
33#include "../../Misc/general.h" // Get scale function
34
35#include "CanonicalFilter.h"
36#include "CapacitivelyCoupledShuntResonatorsFilter.h"
37#include "CoupledLineBandpassFilter.h"
39#include "EllipticFilter.h"
40#include "EndCoupled.h"
41#include "QuarterWaveFilters.h"
42#include "SteppedImpedanceFilter.h"
43
44/*#include "Filtering/CoupledLineHarmonicRejectionSIRBandpassFilter.h"*/
45
46#define LC_LADDER 0
47#define LC_DIRECT_COUPLED 1
48#define STEPPED_IMPEDANCE 2
49#define QUARTERWAVE 3
50#define CAPACITIVELY_COUPLED_RESONATORS 4
51#define COUPLED_LINES 5
52#define END_COUPLED 6
53#define SEMILUMPED 7
54
55#define COUPLED_LINE_SIR 9
56
57class FilterDesignTool : public QWidget {
58 Q_OBJECT
59public:
60 FilterDesignTool(QWidget* parent = nullptr);
62 void design();
63
64private slots:
65 void UpdateDesignParameters();
66 void ResposeComboChanged();
67 void ImplementationComboChanged(int);
68 void EllipticTypeChanged();
69
73 void openResonatorValuesDialog();
74
90 void setAdjustableResonatorVariables_DirectCoupled();
91
92private:
93 // ************************** FILTER DESIGN ***************************
94 QWidget* SetupFilterDesignGUI();
95 QComboBox *FilterResponseTypeCombo,
96 *FilterImplementationCombo, *FC_ScaleCombobox, *BW_ScaleCombobox,
97 *SemiLumpedImplementationCombo;
98 QComboBox *EllipticType;
99 QComboBox *DC_CouplingTypeCombo;
100 QDoubleSpinBox *FCSpinbox, *BWSpinbox, *RippleSpinbox, *StopbandAttSpinbox,
101 *MinimumZ_Spinbox, *MaximumZ_Spinbox, *ImpedanceRatio_Spinbox;
102 QSpinBox* OrderSpinBox;
103
104 QLineEdit* SourceImpedanceLineEdit;
105
106 QComboBox* TopologyCombo; // 1st series or 1st shunt configuration
107
108 QLabel *StopbandAttLabel, *StopbandAttdBLabel, *EllipticTypeLabel,
109 *RippleLabel, *RippledBLabel, *DC_CouplingLabel, *MaximumZ_Unit_Label,
110 *MinimumZ_Unit_Label, *SemiLumpedImplementationLabel,
111 *ImpedanceRatio_Label;
112
113 QLabel * ClassLabel;
114 QComboBox *FilterClassCombo;
115
116 QLabel *RLlabel, *RLlabelOhm, *PhaseErrorLabel, *PhaseErrorLabelDeg,
117 *MinimumZLabel, *MaximumZLabel, *FC_Label, *BW_Label; // Zverev mode
118 QStringList DefaultFilterResponses;
119
120 // Transmission line implementation
121 QLabel* TL_Implementation_Label;
122 QComboBox* TL_Implementation_Combo;
123
124 // Filter specs
125 struct FilterSpecifications Filter_SP;
126 SchematicContent SchContent;
127
128 // Direct-coupled filters only. Adjust resonator elements
129 QPushButton* ResonatorValuesButton_DC;
130 std::vector<double> resonatorValues;
131 std::vector<QString> resonatorScaleValues;
132
133 // Widgets for the resonator values in Direct-Coupled filters
134 std::vector<QDoubleSpinBox *> ResonatorSpinboxes; // Value
135 std::vector<QComboBox*> ResonatorScaleComboboxes; // Scale
136
137
138 // Substrate
139 MS_Substrate MS_Subs;
140
141 QStringList setItemsResponseTypeCombo();
142 double getScale(QString); // Gets the scale from the comboboxes
143
144 // Add trace to simulate
145 QLabel* traceNameLabel;
146 QLineEdit* traceNameLineEdit;
147
148 // Set UI settings depending on filter topology
149 void setSettings_LC_Ladder();
150 void setSettings_LC_Direct_Coupled();
151 void setSettings_Stepped_Z_LPF();
152 void setSettings_Quarterwavelength_BPF_BSF();
153 void setSettings_EndCoupled_BPF();
154 void setSettings_CCoupledShuntResonators_BPF();
155 void setSettings_Semilumped();
156 void setSettings_SideCoupled_BPF();
157
163 void adjustRelativeBW(double max_rel_bw);
164
170 double getResonatorComponentValueHint(double freq, ComponentType component);
171
172public:
173 void synthesize();
174 void set_MS_Subs(MS_Substrate MS_Subs);
175
176signals:
177 void updateSchematic(SchematicContent);
178 void updateSimulation(SchematicContent);
179};
180
181#endif // FILTERDESIGNTOOL_H
Synthesis of different types of Direct Coupled filters.
Definition FilterDesignTool.h:57
Definition SchematicContent.h:33
Definition structures.h:115
Definition structures.h:92