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; see the file COPYING. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 */
23
26
27
28namespace TC = TRANSLINE_CALCULATIONS;
30
31
33{
35
36 const double f = GetParameter( TCP::FREQUENCY );
37 const double rawEpsR = GetParameter( TCP::EPSILONR );
38 const double rawTanD = GetParameter( TCP::TAND );
39
40 // Overlay dispersed values so helpers reading EPSILONR / TAND via GetParameter
41 // pick them up. Raw inputs are restored before return.
44
47
48 double ac1, ac2;
49 double t = GetParameter( TCP::T );
50 double a = GetParameter( TCP::STRIPLINE_A );
51 double h = GetParameter( TCP::H );
53 2.0 / ( 1.0 / lineImpedance( 2.0 * a + t, ac1 ) + 1.0 / lineImpedance( 2.0 * ( h - a ) - t, ac2 ) ) );
58
60 * GetParameter( TCP::FREQUENCY ) / TC::C0 ); // in radians
61
63
64 SetParameter( TCP::EPSILONR, rawEpsR );
65 SetParameter( TCP::TAND, rawTanD );
66}
67
68
73
74
76{
82
83 const double Z0 = GetParameter( TCP::Z0 );
84 const double ANG_L = GetParameter( TCP::ANG_L );
85 const double L = GetParameter( TCP::PHYS_LEN );
86 const double W = GetParameter( TCP::PHYS_WIDTH );
87
88 const bool Z0_invalid = !std::isfinite( Z0 ) || Z0 < 0;
89 const bool ANG_L_invalid = !std::isfinite( ANG_L ) || ANG_L < 0;
90 const bool L_invalid = !std::isfinite( L ) || L < 0;
91 const bool W_invalid = !std::isfinite( W ) || W <= 0;
92
93 bool invalid = false;
94
96 invalid = true;
97
107}
108
109
111{
117
118 const double Z0 = GetParameter( TCP::Z0 );
119 const double ANG_L = GetParameter( TCP::ANG_L );
120 const double L = GetParameter( TCP::PHYS_LEN );
121 const double W = GetParameter( TCP::PHYS_WIDTH );
122
123 const bool Z0_invalid = !std::isfinite( Z0 ) || Z0 < 0;
124 const bool ANG_L_invalid = !std::isfinite( ANG_L ) || ANG_L < 0;
125 const bool L_invalid = !std::isfinite( L ) || L < 0;
126 const bool W_invalid = !std::isfinite( W ) || W <= 0;
127
128 bool invalid = false;
129
131 invalid = true;
132
141}
142
143
144double STRIPLINE::lineImpedance( double aHeight, double& aAc ) const
145{
146 double ZL;
147 const double hmt = aHeight - GetParameter( TCP::T );
148
149 aAc = sqrt( GetParameter( TCP::FREQUENCY ) / GetParameter( TCP::SIGMA ) / 17.2 );
150
151 if( GetParameter( TCP::PHYS_WIDTH ) / hmt >= 0.35 )
152 {
154 + ( 2.0 * aHeight * log( ( 2.0 * aHeight - GetParameter( TCP::T ) ) / hmt )
155 - GetParameter( TCP::T ) * log( aHeight * aHeight / hmt / hmt - 1.0 ) )
156 / M_PI;
157 ZL = TC::ZF0 * hmt / sqrt( GetParameter( TCP::EPSILONR ) ) / 4.0 / ZL;
158
159 aAc *= 2.02e-6 * GetParameter( TCP::EPSILONR ) * ZL / hmt;
160 aAc *= 1.0 + 2.0 * GetParameter( TCP::PHYS_WIDTH ) / hmt
161 + ( aHeight + GetParameter( TCP::T ) ) / hmt / M_PI
162 * log( 2.0 * aHeight / GetParameter( TCP::T ) - 1.0 );
163 }
164 else
165 {
166 double tdw = GetParameter( TCP::T ) / GetParameter( TCP::PHYS_WIDTH );
167
170
171 double de = 1.0 + tdw / M_PI * ( 1.0 + log( 4.0 * M_PI / tdw ) ) + 0.236 * pow( tdw, 1.65 );
172
174 de *= GetParameter( TCP::T ) / 2.0;
175 else
176 de *= GetParameter( TCP::PHYS_WIDTH ) / 2.0;
177
178 ZL = TC::ZF0 / 2.0 / M_PI / sqrt( GetParameter( TCP::EPSILONR ) ) * log( 4.0 * aHeight / M_PI / de );
179
180 aAc *= 0.01141 / ZL / de;
181 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 )
182 - 0.0767 * pow( tdw, 1.65 );
183 }
184
185 return ZL;
186}
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.