KiCad PCB EDA Suite
transline.h
Go to the documentation of this file.
1 /*
2  * transline.h - base for a transmission line class definition
3  *
4  * Copyright (C) 2005 Stefan Jahn <stefan@lkcc.org>
5  * Modifications 2018 for Kicad: Jean-Pierre Charras
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU 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 #ifndef __TRANSLINE_H
25 #define __TRANSLINE_H
26 
27 #include <gal/color4d.h>
28 #include <wx/wx.h>
29 
30 #define TRANSLINE_OK 0
31 #define TRANSLINE_WARNING 1
32 #define TRANSLINE_ERROR 2
33 
34 // IDs for lines parameters used in calculation:
35 // (Used to retrieve these parameters from UI.
36 // DUMMY_PRM is used to skip a param line in dialogs. It is not really a parameter
37 enum PRMS_ID
38 {
39  UNKNOWN_ID = -1,
40  EPSILONR_PRM, // dielectric constant
41  TAND_PRM, // Dielectric Loss Tangent
42  RHO_PRM, // Conductivity of conductor
43  H_PRM, // height of substrate
44  TWISTEDPAIR_TWIST_PRM, // Twists per length
46  STRIPLINE_A_PRM, // Stripline : distance from line to top metal
47  T_PRM, // thickness of top metal
49  MUR_PRM, // magnetic permeability of substrate
51  MURC_PRM, // magnetic permeability of conductor
52  FREQUENCY_PRM, // Frequency of operation
53  Z0_PRM, // characteristic impedance
56  ANG_L_PRM, // Electrical length in angle
58  PHYS_DIAM_IN_PRM, // Inner diameter of cable
59  PHYS_S_PRM, // width of gap between line and ground
60  PHYS_DIAM_OUT_PRM, // Outer diameter of cable
61  PHYS_LEN_PRM, // Length of cable
63 };
64 
65 
66 // IDs for lines parameters used in calculation that are not given by the UI
68 {
70  SIGMA_PRM, // Conductivity of the metal
71  SKIN_DEPTH_PRM, // Skin depth
72  LOSS_DIELECTRIC_PRM, // Loss in dielectric (dB)
73  LOSS_CONDUCTOR_PRM, // Loss in conductors (dB)
74  CUTOFF_FREQUENCY_PRM, // Cutoff frequency for higher order modes
75  EPSILON_EFF_PRM, // Effective dielectric constant
77 };
78 
79 class TRANSLINE
80 {
81 public:
82  TRANSLINE();
83  virtual ~TRANSLINE();
84 
85  const char* m_Name;
86  void setProperty( enum PRMS_ID aPrmId, double aValue );
87  double getProperty( enum PRMS_ID aPrmId );
88 
89 
90  void getProperties( void );
91  void checkProperties( void );
92  void setResult( int, double, const char* );
93  void setResult( int, const char* );
94  bool isSelected( enum PRMS_ID aPrmId );
95 
96  void Init();
97  virtual void synthesize();
98  virtual void calc(){};
101  virtual void calcAnalyze(){};
104  virtual void calcSynthesize(){};
107  virtual void showAnalyze(){};
110  virtual void showSynthesize(){};
113  virtual void show_results(){};
114  void analyze();
115  KIGFX::COLOR4D errCol = KIGFX::COLOR4D( 1, 0.63, 0.63, 1 );
118 
119 protected:
121  double len; // length of line
122  double er_eff; // effective dielectric constant
123  double ang_l; // Electrical length in angle
124 
125  bool minimizeZ0Error1D( double* );
126  double skin_depth();
127  void ellipke( double, double&, double& );
128  double ellipk( double );
129  void setErrorLevel( PRMS_ID, char );
130 };
131 
132 #endif /* __TRANSLINE_H */
bool isSelected(enum PRMS_ID aPrmId)
Definition: transline.cpp:116
virtual void calcAnalyze()
Computation for analysis.
Definition: transline.h:101
bool minimizeZ0Error1D(double *)
@function minimizeZ0Error1D
Definition: transline.cpp:337
void Init()
Definition: transline.cpp:87
double ang_l
Definition: transline.h:123
double er_eff
Definition: transline.h:122
virtual ~TRANSLINE()
Definition: transline.cpp:82
void setResult(int, double, const char *)
Definition: transline.cpp:128
void setProperty(enum PRMS_ID aPrmId, double aValue)
Definition: transline.cpp:106
virtual void calcSynthesize()
Computation for synthesis.
Definition: transline.h:104
void checkProperties(void)
@function checkProperties
Definition: transline.cpp:161
virtual void showSynthesize()
Shows analysis results and checks for errors / warnings.
Definition: transline.h:110
double ellipk(double)
Definition: transline.cpp:312
virtual void show_results()
Shows results.
Definition: transline.h:113
void analyze()
Definition: transline.cpp:203
EXTRA_PRMS_ID
Definition: transline.h:67
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
PRMS_ID
Definition: transline.h:37
KIGFX::COLOR4D okCol
Definition: transline.h:117
virtual void showAnalyze()
Shows synthesis results and checks for errors / warnings.
Definition: transline.h:107
double getProperty(enum PRMS_ID aPrmId)
Definition: transline.cpp:135
void getProperties(void)
@function getProperties
Definition: transline.cpp:144
KIGFX::COLOR4D errCol
Definition: transline.h:115
double len
Definition: transline.h:121
const char * m_Name
Definition: transline.h:85
KIGFX::COLOR4D warnCol
Definition: transline.h:116
virtual void synthesize()
Definition: transline.cpp:212
void ellipke(double, double &, double &)
Definition: transline.cpp:251
double skin_depth()
@function skin_depth calculate skin depth
Definition: transline.cpp:229
void setErrorLevel(PRMS_ID, char)
@function setErrorLevel
Definition: transline.cpp:423
virtual void calc()
Definition: transline.h:98
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99