KiCad PCB EDA Suite
Loading...
Searching...
No Matches
common/transline_calculations/stripline.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2001 Gopal Narayanan <[email protected]>
3 * Copyright (C) 2002 Claudio Girardi <[email protected]>
4 * Copyright (C) 2005, 2006 Stefan Jahn <[email protected]>
5 * Modified for Kicad: 2018 Jean-Pierre Charras <jp.charras at wanadoo.fr>
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this package. If not, see <https://www.gnu.org/licenses/>.
20 */
21
24
25
26namespace TC = TRANSLINE_CALCULATIONS;
28
29
31{
33
34 const double f = GetParameter( TCP::FREQUENCY );
35 const double rawEpsR = GetParameter( TCP::EPSILONR );
36 const double rawTanD = GetParameter( TCP::TAND );
37
38 // Overlay dispersed values so helpers reading EPSILONR / TAND via GetParameter
39 // pick them up. Raw inputs are restored before return.
42
45
46 double ac1, ac2;
47 double t = GetParameter( TCP::T );
48 double a = GetParameter( TCP::STRIPLINE_A );
49 double h = GetParameter( TCP::H );
51 2.0 / ( 1.0 / lineImpedance( 2.0 * a + t, ac1 ) + 1.0 / lineImpedance( 2.0 * ( h - a ) - t, ac2 ) ) );
56
58 * GetParameter( TCP::FREQUENCY ) / TC::C0 ); // in radians
59
61
62 SetParameter( TCP::EPSILONR, rawEpsR );
63 SetParameter( TCP::TAND, rawTanD );
64}
65
66
71
72
74{
80
81 const double Z0 = GetParameter( TCP::Z0 );
82 const double ANG_L = GetParameter( TCP::ANG_L );
83 const double L = GetParameter( TCP::PHYS_LEN );
84 const double W = GetParameter( TCP::PHYS_WIDTH );
85
86 const bool Z0_invalid = !std::isfinite( Z0 ) || Z0 < 0;
87 const bool ANG_L_invalid = !std::isfinite( ANG_L ) || ANG_L < 0;
88 const bool L_invalid = !std::isfinite( L ) || L < 0;
89 const bool W_invalid = !std::isfinite( W ) || W <= 0;
90
91 bool invalid = false;
92
94 invalid = true;
95
105}
106
107
109{
115
116 const double Z0 = GetParameter( TCP::Z0 );
117 const double ANG_L = GetParameter( TCP::ANG_L );
118 const double L = GetParameter( TCP::PHYS_LEN );
119 const double W = GetParameter( TCP::PHYS_WIDTH );
120
121 const bool Z0_invalid = !std::isfinite( Z0 ) || Z0 < 0;
122 const bool ANG_L_invalid = !std::isfinite( ANG_L ) || ANG_L < 0;
123 const bool L_invalid = !std::isfinite( L ) || L < 0;
124 const bool W_invalid = !std::isfinite( W ) || W <= 0;
125
126 bool invalid = false;
127
129 invalid = true;
130
139}
140
141
142double STRIPLINE::lineImpedance( double aHeight, double& aAc ) const
143{
144 double ZL;
145 const double hmt = aHeight - GetParameter( TCP::T );
146
147 aAc = sqrt( GetParameter( TCP::FREQUENCY ) / GetParameter( TCP::SIGMA ) / 17.2 );
148
149 if( GetParameter( TCP::PHYS_WIDTH ) / hmt >= 0.35 )
150 {
152 + ( 2.0 * aHeight * log( ( 2.0 * aHeight - GetParameter( TCP::T ) ) / hmt )
153 - GetParameter( TCP::T ) * log( aHeight * aHeight / hmt / hmt - 1.0 ) )
154 / M_PI;
155 ZL = TC::ZF0 * hmt / sqrt( GetParameter( TCP::EPSILONR ) ) / 4.0 / ZL;
156
157 aAc *= 2.02e-6 * GetParameter( TCP::EPSILONR ) * ZL / hmt;
158 aAc *= 1.0 + 2.0 * GetParameter( TCP::PHYS_WIDTH ) / hmt
159 + ( aHeight + GetParameter( TCP::T ) ) / hmt / M_PI
160 * log( 2.0 * aHeight / GetParameter( TCP::T ) - 1.0 );
161 }
162 else
163 {
164 double tdw = GetParameter( TCP::T ) / GetParameter( TCP::PHYS_WIDTH );
165
168
169 double de = 1.0 + tdw / M_PI * ( 1.0 + log( 4.0 * M_PI / tdw ) ) + 0.236 * pow( tdw, 1.65 );
170
172 de *= GetParameter( TCP::T ) / 2.0;
173 else
174 de *= GetParameter( TCP::PHYS_WIDTH ) / 2.0;
175
176 ZL = TC::ZF0 / 2.0 / M_PI / sqrt( GetParameter( TCP::EPSILONR ) ) * log( 4.0 * aHeight / M_PI / de );
177
178 aAc *= 0.01141 / ZL / de;
179 aAc *= de / aHeight + 0.5 + tdw / 2.0 / M_PI + 0.5 / M_PI * log( 4.0 * M_PI / tdw ) + 0.1947 * pow( tdw, 0.65 )
180 - 0.0767 * pow( tdw, 1.65 );
181 }
182
183 return ZL;
184}
bool Synthesize(SYNTHESIZE_OPTS aOpts) override
Synthesis track geometry parameters to match given Z0.
void SetAnalysisResults() override
Sets the output values and status following analysis.
void SetSynthesisResults() override
Sets the output values and status following synthesis.
double lineImpedance(double aHeight, double &aAc) const
Calculate characteristic impedance and conductor loss (in db/meter)
void Analyse() override
Analyse track geometry parameters to output Z0 and Ang_L.
double GetDispersedEpsilonR(double aF) const
Dispersed permittivity at aF. Returns raw EPSILONR when the model is inactive.
double GetDispersedTanDelta(double aF) const
Dispersed loss tangent at aF. Returns raw TAND when the model is inactive.
double GetParameter(const TRANSLINE_PARAMETERS aParam) const
Gets the given calculation property.
void SetParameter(const TRANSLINE_PARAMETERS aParam, const double aValue)
Sets the given calculation property.
void SetSynthesisResult(TRANSLINE_PARAMETERS aParam, const double aValue, const TRANSLINE_STATUS aStatus=TRANSLINE_STATUS::OK)
Sets a synthesis result.
void UpdateDielectricModel()
Refit the Djordjevic-Sarkar model from the current parameter map.
double SkinDepth() const
Calculate skin depth.
bool MinimiseZ0Error1D(TRANSLINE_PARAMETERS aOptimise, TRANSLINE_PARAMETERS aMeasure, bool aRecalculateLength=false)
minimizeZ0Error1D
void SetAnalysisResult(TRANSLINE_PARAMETERS aParam, const double aValue, const TRANSLINE_STATUS aStatus=TRANSLINE_STATUS::OK)
Sets an analysis result.
static double UnitPropagationDelay(double aEpsilonEff)
Calculates the unit propagation delay (ps/cm) for the given effective permittivity.
TRANSLINE_PARAMETERS TCP
#define M_PI
SYNTHESIZE_OPTS
Options for specifying synthesis inputs, targets, or strategies.
TRANSLINE_PARAMETERS
All possible parameters used (as inputs or outputs) by the transmission line calculations.