From 4eb2dad70d4f405ec43d3929e4fcf2afb6a17e04 Mon Sep 17 00:00:00 2001 From: andresmmera Date: Mon, 17 Jun 2024 17:27:00 +0200 Subject: [PATCH] Add MOPEN to MS QW BSF In this commit an MS open circuit is added to the QW BSF as it was missing. It models the fringing effects of the stub. --- qucs-filter/filter.cpp | 24 ++++++++++++++++++++++++ qucs-filter/filter.h | 2 ++ qucs-filter/quarterwave_filter.cpp | 11 ++++++++--- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/qucs-filter/filter.cpp b/qucs-filter/filter.cpp index e2307618..f8881a44 100644 --- a/qucs-filter/filter.cpp +++ b/qucs-filter/filter.cpp @@ -415,6 +415,30 @@ QString Filter::getMS_Via(double height, int x, int y, int rotate) return code; } +QString Filter::getMS_Open(double width, int x, int y, int rotate) +{ + QString code; + switch (rotate) + { + case 0: // No rotation + code = QString("\n").arg(x).arg(y).arg(QString::number(width*1e3, 'f', 2)); + break; + + case 1: // CTRL+R + code = QString("\n").arg(x).arg(y).arg(QString::number(width*1e3, 'f', 2)); + break; + + case 2: // 2 x (CTRL+R) + code = QString("\n").arg(x).arg(y).arg(QString::number(width*1e3, 'f', 2)); + break; + + case 3: // 3 x (CTRL+R) + code = QString("\n").arg(x).arg(y).arg(QString::number(width*1e3, 'f', 2)); + break; + } + return code; +} + QString Filter::getWireString(int x1, int y1, int x2, int y2) { return QString("<%1 %2 %3 %4 \"\" 0 0 0>\n").arg(x1).arg(y1).arg(x2).arg(y2); diff --git a/qucs-filter/filter.h b/qucs-filter/filter.h index a861f469..9c6fddbf 100644 --- a/qucs-filter/filter.h +++ b/qucs-filter/filter.h @@ -70,6 +70,8 @@ public: static QString getTeeString(int x, int y, double width1, double width2, double width3); static QString getWireString(int x1, int x2, int x3, int x4); static QString getMS_Via(double height, int x, int y, int rotate); + static QString getMS_Open(double width, int x, int y, int rotate); + protected: static QString num2str(double); diff --git a/qucs-filter/quarterwave_filter.cpp b/qucs-filter/quarterwave_filter.cpp index d48751c6..d664fd03 100644 --- a/qucs-filter/quarterwave_filter.cpp +++ b/qucs-filter/quarterwave_filter.cpp @@ -92,7 +92,11 @@ QString *QuarterWave_Filter::createSchematic(tFilter *Filter, tSubstrate *Substr c_s += getLineString(isMicrostrip, W_line, L_line, x, 180, 0); // Series line c_s += getTeeString(x+ 60 + x_space, 180, W_line, W_line, W_res); - c_s += getLineString(isMicrostrip, W_res, L_res, x+60 + x_space, 60, 1); // Shunt quarter-wavelength resonator + c_s += getLineString(isMicrostrip, W_res, L_res, x + 60 + x_space, 60, 1); // Shunt quarter-wavelength resonator + + if (Filter->Class == CLASS_BANDSTOP){// If MS bandstop, add MOPEN + c_s += getMS_Open(W_res, x + 60 + x_space, 0, 1); // MS open + } w_s += getWireString(x+30, 180, x+30+x_space, 180); w_s += getWireString(x+60 + x_space, 90, x+60 + x_space, 150); @@ -106,14 +110,15 @@ QString *QuarterWave_Filter::createSchematic(tFilter *Filter, tSubstrate *Substr w_s += getWireString(x+30, 180, x+90+2*x_space, 180);// Join series lines w_s += getWireString(x+60 + x_space, 90, x+60 + x_space, 180); // Join middle point with the stub } - if (Filter->Class == CLASS_BANDPASS) // If bandpass, shunt resonators + if (Filter->Class == CLASS_BANDPASS){ + // If bandpass, shunt resonators if (isMicrostrip){ c_s += getMS_Via(0.5, x+40 + x_space, 30, 2); // MS via diameter = 0.5 mm } else{ c_s += QString("\n").arg(x + 60 + x_space); } - + } x += 120 + 2 * x_space; }