KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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
33// const to convert a attenuation / loss from log to decibel
34const double LOG2DB = 20.0 / log( 10.0 );
35
37{
38 m_Name = "StripLine";
39 Init();
40}
41
42
43// -------------------------------------------------------------------
44// calculate characteristic impedance and conductor loss (in log/meter)
45double STRIPLINE::lineImpedance( double height, double& ac )
46{
47 double ZL;
48 double hmt = height - m_parameters[T_PRM];
49
50 ac = sqrt( m_parameters[FREQUENCY_PRM] / m_parameters[SIGMA_PRM] / 17.2 );
51
52 if( m_parameters[PHYS_WIDTH_PRM] / hmt >= 0.35 )
53 {
55 + ( 2.0 * height * log( ( 2.0 * height - m_parameters[T_PRM] ) / hmt )
56 - m_parameters[T_PRM] * log( height * height / hmt / hmt - 1.0 ) )
57 / M_PI;
58 ZL = ZF0 * hmt / sqrt( m_parameters[EPSILONR_PRM] ) / 4.0 / ZL;
59
60 ac *= 2.02e-6 * m_parameters[EPSILONR_PRM] * ZL / hmt;
61 ac *= 1.0 + 2.0 * m_parameters[PHYS_WIDTH_PRM] / hmt
62 + ( height + m_parameters[T_PRM] ) / hmt / M_PI
63 * log( 2.0 * height / m_parameters[T_PRM] - 1.0 );
64 }
65 else
66 {
70 double de = 1.0 + tdw / M_PI * ( 1.0 + log( 4.0 * M_PI / tdw ) ) + 0.236 * pow( tdw, 1.65 );
72 de *= m_parameters[T_PRM] / 2.0;
73 else
74 de *= m_parameters[PHYS_WIDTH_PRM] / 2.0;
75 ZL = ZF0 / 2.0 / M_PI / sqrt( m_parameters[EPSILONR_PRM] )
76 * log( 4.0 * height / M_PI / de );
77
78 ac *= 0.01141 / ZL / de;
79 ac *= de / height + 0.5 + tdw / 2.0 / M_PI + 0.5 / M_PI * log( 4.0 * M_PI / tdw )
80 + 0.1947 * pow( tdw, 0.65 ) - 0.0767 * pow( tdw, 1.65 );
81 }
82
83 return ZL;
84}
85
86
87// -------------------------------------------------------------------
89{
91
93
94 double ac1, ac2;
95 double t = m_parameters[T_PRM];
96 double a = m_parameters[STRIPLINE_A_PRM];
97 double h = m_parameters[H_PRM];
98 m_parameters[Z0_PRM] = 2.0
99 / ( 1.0 / lineImpedance( 2.0 * a + t, ac1 )
100 + 1.0 / lineImpedance( 2.0 * ( h - a ) - t, ac2 ) );
103 * ( M_PI / C0 ) * m_parameters[FREQUENCY_PRM]
104 * sqrt( m_parameters[EPSILONR_PRM] )
106
109 / C0; // in radians
110}
111
112
114{
117
118 if( !std::isfinite( m_parameters[Z0_PRM] ) || m_parameters[Z0_PRM] < 0 )
120
121 if( !std::isfinite( m_parameters[ANG_L_PRM] ) || m_parameters[ANG_L_PRM] < 0 )
123
124 if( !std::isfinite( m_parameters[PHYS_LEN_PRM] ) || m_parameters[PHYS_LEN_PRM] < 0 )
126
127 if( !std::isfinite( m_parameters[PHYS_WIDTH_PRM] ) || m_parameters[PHYS_WIDTH_PRM] < 0 )
129
131 {
136 }
137}
138
140{
143
144 if( !std::isfinite( m_parameters[PHYS_LEN_PRM] ) || m_parameters[PHYS_LEN_PRM] < 0 )
146
147 if( !std::isfinite( m_parameters[PHYS_WIDTH_PRM] ) || m_parameters[PHYS_WIDTH_PRM] < 0 )
149
150 if( !std::isfinite( m_parameters[Z0_PRM] ) || m_parameters[Z0_PRM] < 0 )
152
153 if( !std::isfinite( m_parameters[ANG_L_PRM] ) || m_parameters[ANG_L_PRM] < 0 )
155
157 {
162 }
163}
164// -------------------------------------------------------------------
166{
167
171
173}
174
175
176#define MAX_ERROR 0.000001
177
178// -------------------------------------------------------------------
180{
182}
void showAnalyze() override
Shows synthesis results and checks for errors / warnings.
Definition: stripline.cpp:113
void calcAnalyze() override
Computation for analysis.
Definition: stripline.cpp:88
void show_results() override
Shows results.
Definition: stripline.cpp:165
void showSynthesize() override
Shows analysis results and checks for errors / warnings.
Definition: stripline.cpp:139
void calcSynthesize() override
Computation for synthesis.
Definition: stripline.cpp:179
double lineImpedance(double, double &)
Definition: stripline.cpp:45
void Init()
Definition: transline.cpp:87
void setResult(int, double, const char *)
Definition: transline.cpp:130
bool minimizeZ0Error1D(double *)
@function minimizeZ0Error1D
Definition: transline.cpp:346
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:106
double skin_depth()
@function skin_depth calculate skin depth
Definition: transline.cpp:234
void setErrorLevel(PRMS_ID, char)
@function setErrorLevel
Definition: transline.cpp:432
const double LOG2DB
Definition: stripline.cpp:34
@ 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