KiCad PCB EDA Suite
stripline.cpp
Go to the documentation of this file.
1/*
2 * stripline.cpp - stripline class definition
3 *
4 * Copyright (C) 2011 Michael Margraf <[email protected]>
5 * Modifications 2018 for Kicad: Jean-Pierre Charras
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this package; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 *
22 */
23
24
25#include <cmath>
26#include <cstdio>
27#include <cstdlib>
28#include <cstring>
29
30#include "stripline.h"
31#include "units.h"
32
34{
35 m_Name = "StripLine";
36 Init();
37}
38
39
40// -------------------------------------------------------------------
41// calculate characteristic impedance and conductor loss
42double STRIPLINE::lineImpedance( double height, double& ac )
43{
44 double ZL;
45 double hmt = height - m_parameters[T_PRM];
46
47 ac = sqrt( m_parameters[FREQUENCY_PRM] / m_parameters[SIGMA_PRM] / 17.2 );
48
49 if( m_parameters[PHYS_WIDTH_PRM] / hmt >= 0.35 )
50 {
52 + ( 2.0 * height * log( ( 2.0 * height - m_parameters[T_PRM] ) / hmt )
53 - m_parameters[T_PRM] * log( height * height / hmt / hmt - 1.0 ) )
54 / M_PI;
55 ZL = ZF0 * hmt / sqrt( m_parameters[EPSILONR_PRM] ) / 4.0 / ZL;
56
57 ac *= 2.02e-6 * m_parameters[EPSILONR_PRM] * ZL / hmt;
58 ac *= 1.0 + 2.0 * m_parameters[PHYS_WIDTH_PRM] / hmt
59 + ( height + m_parameters[T_PRM] ) / hmt / M_PI
60 * log( 2.0 * height / m_parameters[T_PRM] - 1.0 );
61 }
62 else
63 {
67 double de = 1.0 + tdw / M_PI * ( 1.0 + log( 4.0 * M_PI / tdw ) ) + 0.236 * pow( tdw, 1.65 );
69 de *= m_parameters[T_PRM] / 2.0;
70 else
71 de *= m_parameters[PHYS_WIDTH_PRM] / 2.0;
72 ZL = ZF0 / 2.0 / M_PI / sqrt( m_parameters[EPSILONR_PRM] )
73 * log( 4.0 * height / M_PI / de );
74
75 ac *= 0.01141 / ZL / de;
76 ac *= de / height + 0.5 + tdw / 2.0 / M_PI + 0.5 / M_PI * log( 4.0 * M_PI / tdw )
77 + 0.1947 * pow( tdw, 0.65 ) - 0.0767 * pow( tdw, 1.65 );
78 }
79
80 return ZL;
81}
82
83
84// -------------------------------------------------------------------
86{
88
90
91 double ac1, ac2;
92 double t = m_parameters[T_PRM];
93 double a = m_parameters[STRIPLINE_A_PRM];
94 double h = m_parameters[H_PRM];
95 m_parameters[Z0_PRM] = 2.0
96 / ( 1.0 / lineImpedance( 2.0 * a + t, ac1 )
97 + 1.0 / lineImpedance( 2.0 * ( h - a ) - t, ac2 ) );
100 * ( M_PI / C0 ) * m_parameters[FREQUENCY_PRM]
101 * sqrt( m_parameters[EPSILONR_PRM] )
103
106 / C0; // in radians
107}
108
109
111{
114
115 if( !std::isfinite( m_parameters[Z0_PRM] ) || m_parameters[Z0_PRM] < 0 )
117
118 if( !std::isfinite( m_parameters[ANG_L_PRM] ) || m_parameters[ANG_L_PRM] < 0 )
120
121 if( !std::isfinite( m_parameters[PHYS_LEN_PRM] ) || m_parameters[PHYS_LEN_PRM] < 0 )
123
124 if( !std::isfinite( m_parameters[PHYS_WIDTH_PRM] ) || m_parameters[PHYS_WIDTH_PRM] < 0 )
126
128 {
133 }
134}
135
137{
140
141 if( !std::isfinite( m_parameters[PHYS_LEN_PRM] ) || m_parameters[PHYS_LEN_PRM] < 0 )
143
144 if( !std::isfinite( m_parameters[PHYS_WIDTH_PRM] ) || m_parameters[PHYS_WIDTH_PRM] < 0 )
146
147 if( !std::isfinite( m_parameters[Z0_PRM] ) || m_parameters[Z0_PRM] < 0 )
149
150 if( !std::isfinite( m_parameters[ANG_L_PRM] ) || m_parameters[ANG_L_PRM] < 0 )
152
154 {
159 }
160}
161// -------------------------------------------------------------------
163{
164
168
170}
171
172
173#define MAX_ERROR 0.000001
174
175// -------------------------------------------------------------------
177{
179}
void showAnalyze() override
Shows synthesis results and checks for errors / warnings.
Definition: stripline.cpp:110
void calcAnalyze() override
Computation for analysis.
Definition: stripline.cpp:85
void show_results() override
Shows results.
Definition: stripline.cpp:162
void showSynthesize() override
Shows analysis results and checks for errors / warnings.
Definition: stripline.cpp:136
void calcSynthesize() override
Computation for synthesis.
Definition: stripline.cpp:176
double lineImpedance(double, double &)
Definition: stripline.cpp:42
void Init()
Definition: transline.cpp:90
void setResult(int, double, const char *)
Definition: transline.cpp:133
bool minimizeZ0Error1D(double *)
@function minimizeZ0Error1D
Definition: transline.cpp:349
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:131
const char * m_Name
Definition: transline.h:84
void setProperty(enum PRMS_ID aPrmId, double aValue)
Definition: transline.cpp:109
double skin_depth()
@function skin_depth calculate skin depth
Definition: transline.cpp:237
void setErrorLevel(PRMS_ID, char)
@function setErrorLevel
Definition: transline.cpp:435
@ LOSS_DIELECTRIC_PRM
Definition: transline.h:71
@ EPSILON_EFF_PRM
Definition: transline.h:74
@ LOSS_CONDUCTOR_PRM
Definition: transline.h:72
@ SIGMA_PRM
Definition: transline.h:69
@ SKIN_DEPTH_PRM
Definition: transline.h:70
@ FREQUENCY_PRM
Definition: transline.h:51
@ T_PRM
Definition: transline.h:46
@ STRIPLINE_A_PRM
Definition: transline.h:45
@ Z0_PRM
Definition: transline.h:52
@ TAND_PRM
Definition: transline.h:40
@ PHYS_LEN_PRM
Definition: transline.h:60
@ ANG_L_PRM
Definition: transline.h:55
@ EPSILONR_PRM
Definition: transline.h:39
@ H_PRM
Definition: transline.h:42
@ PHYS_WIDTH_PRM
Definition: transline.h:56
#define TRANSLINE_WARNING
Definition: transline.h:30
#define TRANSLINE_ERROR
Definition: transline.h:31
#define ZF0
Definition: units.h:62
#define C0
Definition: units.h:61
#define UNIT_MICRON
Definition: units_scales.h:35