KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_coupled_stripline.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.TXT for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
21
22#include <cmath>
23
27
28
29namespace TC = TRANSLINE_CALCULATIONS;
31
32
33namespace
34{
35// Builds a coupled stripline instance with the fixture geometry described in the task spec.
36// b = 20 mil substrate, symmetric (strip centred), W = 8 mil, S = 8 mil, T = 0.7 mil,
37// εr = 4.3, tan δ = 0.02, σ = 5.8e7 S/m, f = 1 GHz, L = 100 mm.
38COUPLED_STRIPLINE MakeFixture()
39{
40 const double b = 20.0 * TC::UNIT_MIL;
41 const double w = 8.0 * TC::UNIT_MIL;
42 const double s = 8.0 * TC::UNIT_MIL;
43 const double t = 0.7 * TC::UNIT_MIL;
44
46 calc.SetParameter( TCP::EPSILONR, 4.3 );
47 calc.SetParameter( TCP::TAND, 0.02 );
48 calc.SetParameter( TCP::MUR, 1.0 );
49 calc.SetParameter( TCP::MURC, 1.0 );
50 calc.SetParameter( TCP::ROUGH, 0.0 );
51 calc.SetParameter( TCP::SIGMA, 5.8e7 );
52 calc.SetParameter( TCP::H, b );
54 calc.SetParameter( TCP::PHYS_S, s );
55 calc.SetParameter( TCP::T, t );
56 calc.SetParameter( TCP::PHYS_LEN, 100.0 * TC::UNIT_MM );
57 calc.SetParameter( TCP::FREQUENCY, 1.0e9 );
58 return calc;
59}
60} // namespace
61
62
63BOOST_AUTO_TEST_SUITE( CoupledStriplineLosses )
64
65
66BOOST_AUTO_TEST_CASE( DielectricLossIsFiniteAndSymmetric )
67{
68 COUPLED_STRIPLINE calc = MakeFixture();
69 calc.Analyse();
70
71 auto& results = calc.GetAnalysisResults();
72 const double loss_d_e = results.at(TCP::ATTEN_DILECTRIC_EVEN).first;
73 const double loss_d_o = results.at(TCP::ATTEN_DILECTRIC_ODD).first;
74
75 BOOST_TEST( loss_d_e > 0.0 );
76 BOOST_TEST( loss_d_o > 0.0 );
77
78 // Homogeneous TEM dielectric means even and odd modes see the same εr_eff
79 BOOST_TEST( std::fabs( loss_d_e - loss_d_o ) / loss_d_e < 0.001 );
80}
81
82
83BOOST_AUTO_TEST_CASE( DielectricLossMatchesClosedForm )
84{
85 COUPLED_STRIPLINE calc = MakeFixture();
86 calc.Analyse();
87
88 auto& results = calc.GetAnalysisResults();
89 const double loss_d_e = results.at(TCP::ATTEN_DILECTRIC_EVEN).first;
90
91 // α_d = π · f · √εr · tan δ / c (Np/m); total loss (dB) = α_d · L · LOG2DB
92 const double alpha_d = ( M_PI * 1.0e9 * std::sqrt( 4.3 ) * 0.02 ) / TC::C0;
93 const double expected_dB = alpha_d * ( 100.0 * TC::UNIT_MM ) * TC::LOG2DB;
94
95 BOOST_TEST( expected_dB == 0.378, boost::test_tools::tolerance( 0.01 ) );
96 BOOST_TEST( loss_d_e == expected_dB, boost::test_tools::tolerance( 0.03 ) );
97}
98
99
100BOOST_AUTO_TEST_CASE( ConductorLossIsPositive )
101{
102 COUPLED_STRIPLINE calc = MakeFixture();
103 calc.Analyse();
104
105 auto& results = calc.GetAnalysisResults();
106 const double loss_c_e = results.at(TCP::ATTEN_COND_EVEN).first;
107 const double loss_c_o = results.at(TCP::ATTEN_COND_ODD).first;
108
109 BOOST_TEST( loss_c_e > 0.0 );
110 BOOST_TEST( loss_c_o > 0.0 );
111
112 // Odd-mode conductor loss is higher than even mode at the same geometry since Z0_o < Z0_e;
113 // current density per conductor is higher in the odd mode.
114 BOOST_TEST( loss_c_o > loss_c_e );
115}
116
117
void Analyse() override
Analyse track geometry parameters to output Z0 and Ang_L.
void SetParameter(const TRANSLINE_PARAMETERS aParam, const double aValue)
Sets the given calculation property.
std::unordered_map< TRANSLINE_PARAMETERS, std::pair< double, TRANSLINE_STATUS > > & GetAnalysisResults()
Gets the output parameters following analysis.
TRANSLINE_PARAMETERS TCP
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(DielectricLossIsFiniteAndSymmetric)
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST(netlist.find("R_G1 ARM_OUT1 DIE_B R='0.001 / ((SW_STATE)") !=std::string::npos)
#define M_PI
TRANSLINE_PARAMETERS
All possible parameters used (as inputs or outputs) by the transmission line calculations.