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 const double A = GetParameter( TCP::STRIPLINE_A );
86 const double T = GetParameter( TCP::T );
87 const double H = GetParameter( TCP::H );
88
89 const bool Z0_invalid = !std::isfinite( Z0 ) || Z0 < 0;
90 const bool ANG_L_invalid = !std::isfinite( ANG_L ) || ANG_L < 0;
91 const bool L_invalid = !std::isfinite( L ) || L < 0;
92 const bool W_invalid = !std::isfinite( W ) || W <= 0;
93 const bool ATH_invalid = !std::isfinite( A ) || !std::isfinite( T ) || A + T >= H;
94
102}
103
104
106{
112
113 const double Z0 = GetParameter( TCP::Z0 );
114 const double ANG_L = GetParameter( TCP::ANG_L );
115 const double L = GetParameter( TCP::PHYS_LEN );
116 const double W = GetParameter( TCP::PHYS_WIDTH );
117
118 const bool Z0_invalid = !std::isfinite( Z0 ) || Z0 < 0;
119 const bool ANG_L_invalid = !std::isfinite( ANG_L ) || ANG_L < 0;
120 const bool L_invalid = !std::isfinite( L ) || L < 0;
121 const bool W_invalid = !std::isfinite( W ) || W <= 0;
122
123 bool invalid = false;
124
126 invalid = true;
127
136}
137
138
139double STRIPLINE::lineImpedance( double aHeight, double& aAc ) const
140{
141 double ZL;
142 const double hmt = aHeight - GetParameter( TCP::T );
143
144 aAc = sqrt( GetParameter( TCP::FREQUENCY ) / GetParameter( TCP::SIGMA ) / 17.2 );
145
146 if( GetParameter( TCP::PHYS_WIDTH ) / hmt >= 0.35 )
147 {
149 + ( 2.0 * aHeight * log( ( 2.0 * aHeight - GetParameter( TCP::T ) ) / hmt )
150 - GetParameter( TCP::T ) * log( aHeight * aHeight / hmt / hmt - 1.0 ) )
151 / M_PI;
152 ZL = TC::ZF0 * hmt / sqrt( GetParameter( TCP::EPSILONR ) ) / 4.0 / ZL;
153
154 aAc *= 2.02e-6 * GetParameter( TCP::EPSILONR ) * ZL / hmt;
155 aAc *= 1.0 + 2.0 * GetParameter( TCP::PHYS_WIDTH ) / hmt
156 + ( aHeight + GetParameter( TCP::T ) ) / hmt / M_PI
157 * log( 2.0 * aHeight / GetParameter( TCP::T ) - 1.0 );
158 }
159 else
160 {
161 double tdw = GetParameter( TCP::T ) / GetParameter( TCP::PHYS_WIDTH );
162
165
166 double de = 1.0 + tdw / M_PI * ( 1.0 + log( 4.0 * M_PI / tdw ) ) + 0.236 * pow( tdw, 1.65 );
167
169 de *= GetParameter( TCP::T ) / 2.0;
170 else
171 de *= GetParameter( TCP::PHYS_WIDTH ) / 2.0;
172
173 ZL = TC::ZF0 / 2.0 / M_PI / sqrt( GetParameter( TCP::EPSILONR ) ) * log( 4.0 * aHeight / M_PI / de );
174
175 aAc *= 0.01141 / ZL / de;
176 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 )
177 - 0.0767 * pow( tdw, 1.65 );
178 }
179
180 return ZL;
181}
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 H(x, y, z)
Definition md5_hash.cpp:17
#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.