Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Microstrip.h
1/*
2 * Copyright (C) 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 MICROSTRIP_H
19#define MICROSTRIP_H
20
21#include "../../Schematic/structures.h"
22#include <cmath>
23#include <iostream>
24#include <string>
25
27private:
28 // Constants
29 static constexpr double Z_FIELD =
30 376.730313668; // Impedance of free space (ohms)
31 static constexpr double PI = 3.14159265358979323846;
32 static constexpr double MAX_ERROR = 1e-7;
33
34public:
35 // Results structure for microstrip calculations
37 double width; // microstrip width (mm)
38 double length; // microstrip length (mm)
39 double gap; // for coupled lines (mm)
40 double er_eff; // effective permittivity
41 double zl; // characteristic impedance (ohms)
42 double zl_even; // even mode impedance (ohms)
43 double zl_odd; // odd mode impedance (ohms)
44 int iterations; // number of iterations used
45
47 };
48
49 MS_Substrate Substrate;
50 SynthesisResults Results;
51
52public:
53 MicrostripClass() = default;
54 ~MicrostripClass() = default;
55
56 // Calculates the impedance and relative effective permittivity of a
57 // microstrip line.
58 void calcMicrostrip(double width, double freq, double& er_eff, double& zl);
59
60 // Synthesizes microstrip width for given characteristic impedance.
61 bool synthesizeMicrostrip(double Z0, double e_length, double freq);
62
63 // Calculates additional line length for microstrip open end.
64 double getMicrostripOpen(double Wh, double er, double er_eff);
65
66 // Synthesizes coupled microstrip dimensions for given even and odd mode
67 // impedances.
68 bool synthesizeCoupledMicrostrip(double zl_even, double zl_odd, double length,
69 double freq);
70
71 // Calculates even and odd mode parameters for coupled microstrip lines.
72 void calcCoupledMicrostrip(double width, double gap, double freq,
73 double& zl_even, double& zl_odd,
74 double& er_eff_even, double& er_eff_odd);
75
76 // Prints results in a formatted way
77 void printResults(const std::string& title = "Results");
78
79private:
80 // Helper function for dispersion calculations (Kirschning model)
81 static double dispersionKirschning(double er, double Wh, double freq,
82 double& er_eff, double& zl);
83};
84
85#endif // MICROSTRIP_H
Definition Microstrip.h:26
Definition structures.h:92
Definition Microstrip.h:36