KiCad PCB EDA Suite
RECTWAVEGUIDE Class Reference

#include <rectwaveguide.h>

Inheritance diagram for RECTWAVEGUIDE:
TRANSLINE

Public Member Functions

 RECTWAVEGUIDE ()
 
void setProperty (enum PRMS_ID aPrmId, double aValue)
 
double getProperty (enum PRMS_ID aPrmId)
 
void getProperties (void)
 @function getProperties More...
 
void checkProperties (void)
 @function checkProperties More...
 
void setResult (int, double, const char *)
 
void setResult (int, const char *)
 
bool isSelected (enum PRMS_ID aPrmId)
 
void Init ()
 
virtual void synthesize ()
 
virtual void calc ()
 
void analyze ()
 

Public Attributes

const char * m_Name
 
KIGFX::COLOR4D errCol = KIGFX::COLOR4D( 1, 0.63, 0.63, 1 )
 
KIGFX::COLOR4D warnCol = KIGFX::COLOR4D( 1, 1, 0.57, 1 )
 
KIGFX::COLOR4D okCol = KIGFX::COLOR4D( 1, 1, 1, 1 )
 

Protected Member Functions

bool minimizeZ0Error1D (double *)
 @function minimizeZ0Error1D More...
 
double skin_depth ()
 @function skin_depth calculate skin depth More...
 
void ellipke (double, double &, double &)
 
double ellipk (double)
 
void setErrorLevel (PRMS_ID, char)
 @function setErrorLevel More...
 

Protected Attributes

double m_parameters [EXTRA_PRMS_COUNT]
 
double len
 

Private Member Functions

double kval_square ()
 
double kc_square (int, int)
 
double fc (int, int)
 
double alphac ()
 
double alphac_cutoff ()
 
double alphad ()
 
void get_rectwaveguide_sub ()
 
void get_rectwaveguide_comp ()
 
void get_rectwaveguide_phys ()
 
void get_rectwaveguide_elec ()
 
void show_results () override
 Shows results. More...
 
void calcAnalyze () override
 Computation for analysis. More...
 
void calcSynthesize () override
 Computation for synthesis. More...
 
void showAnalyze () override
 Shows synthesis results and checks for errors / warnings. More...
 
void showSynthesize () override
 Shows analysis results and checks for errors / warnings. More...
 

Private Attributes

double mur
 
double a
 
double b
 
double l
 
double Z0
 
double Z0EH
 
double ang_l
 
double er_eff
 
double mur_eff
 
double atten_dielectric
 
double atten_cond
 
double fc10
 

Detailed Description

Definition at line 33 of file rectwaveguide.h.

Constructor & Destructor Documentation

◆ RECTWAVEGUIDE()

RECTWAVEGUIDE::RECTWAVEGUIDE ( )

Definition at line 31 of file rectwaveguide.cpp.

31  : TRANSLINE(),
32  mur( 0.0 ), // magnetic permeability of substrate
33  a( 0.0 ), // width of waveguide
34  b( 0.0 ), // height of waveguide
35  l( 0.0 ), // length of waveguide
36  Z0( 0.0 ), // characteristic impedance
37  Z0EH( 0.0 ), // characteristic impedance of field quantities*/
38  ang_l( 0.0 ), // Electrical length in angle
39  er_eff( 0.0 ), // Effective dielectric constant
40  mur_eff( 0.0 ), // Effective mag. permeability
41  atten_dielectric( 0.0 ), // Loss in dielectric (dB)
42  atten_cond( 0.0 ), // Loss in conductors (dB)
43  fc10( 1.0 ) // Cutoff frequency for TE10 mode
44 {
45  m_Name = "RectWaveGuide";
46  Init();
47 }
double atten_cond
Definition: rectwaveguide.h:50
void Init()
Definition: transline.cpp:87
const char * m_Name
Definition: transline.h:85
double atten_dielectric
Definition: rectwaveguide.h:49

References TRANSLINE::Init(), and TRANSLINE::m_Name.

Member Function Documentation

◆ alphac()

double RECTWAVEGUIDE::alphac ( )
private

Definition at line 90 of file rectwaveguide.cpp.

91 {
92  double Rs, f_c;
93  double ac;
94  short m, n, mmax, nmax;
95  double* a = &m_parameters[PHYS_A_PRM];
96  double* b = &m_parameters[PHYS_B_PRM];
97  double* f = &m_parameters[FREQUENCY_PRM];
98  double* murc = &m_parameters[MURC_PRM];
99  double* sigma = &m_parameters[SIGMA_PRM];
100 
101  Rs = sqrt( M_PI * *f * *murc * MU0 / *sigma );
102  ac = 0.0;
103  mmax = (int) floor( *f / fc( 1, 0 ) );
104  nmax = mmax;
105 
106  /* below from Ramo, Whinnery & Van Duzer */
107 
108  /* TE(m,n) modes */
109  for( n = 0; n <= nmax; n++ )
110  {
111  for( m = 1; m <= mmax; m++ )
112  {
113  f_c = fc( m, n );
114  if( *f > f_c )
115  {
116  switch( n )
117  {
118  case 0:
119  ac += ( Rs / ( *b * ZF0 * sqrt( 1.0 - pow( ( f_c / *f ), 2.0 ) ) ) )
120  * ( 1.0 + ( ( 2 * *b / *a ) * pow( ( f_c / *f ), 2.0 ) ) );
121  break;
122 
123  default:
124  ac += ( ( 2. * Rs ) / ( *b * ZF0 * sqrt( 1.0 - pow( ( f_c / *f ), 2.0 ) ) ) )
125  * ( ( ( 1. + ( *b / *a ) ) * pow( ( f_c / *f ), 2.0 ) )
126  + ( ( 1. - pow( ( f_c / *f ), 2.0 ) )
127  * ( ( ( *b / *a )
128  * ( ( ( *b / *a ) * pow( m, 2. ) )
129  + pow( n, 2. ) ) )
130  / ( pow( ( *b * m / *a ), 2.0 )
131  + pow( n, 2.0 ) ) ) ) );
132  break;
133  }
134  }
135  }
136  }
137 
138  /* TM(m,n) modes */
139  for( n = 1; n <= nmax; n++ )
140  {
141  for( m = 1; m <= mmax; m++ )
142  {
143  f_c = fc( m, n );
144  if( *f > f_c )
145  {
146  ac += ( ( 2. * Rs ) / ( *b * ZF0 * sqrt( 1.0 - pow( ( f_c / *f ), 2.0 ) ) ) )
147  * ( ( ( pow( m, 2.0 ) * pow( ( *b / *a ), 3.0 ) ) + pow( n, 2. ) )
148  / ( ( pow( ( m * *b / *a ), 2. ) ) + pow( n, 2.0 ) ) );
149  }
150  }
151  }
152 
153  ac = ac * 20.0 * log10( exp( 1. ) ); /* convert from Np/m to db/m */
154  return ac;
155 }
#define MU0
Definition: units.h:61
#define PHYS_B_PRM
Definition: rectwaveguide.h:31
#define ZF0
Definition: units.h:63
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
double fc(int, int)
#define PHYS_A_PRM
Definition: rectwaveguide.h:30

References a, b, fc(), FREQUENCY_PRM, TRANSLINE::m_parameters, MU0, MURC_PRM, PHYS_A_PRM, PHYS_B_PRM, SIGMA_PRM, and ZF0.

Referenced by calcAnalyze(), and calcSynthesize().

◆ alphac_cutoff()

double RECTWAVEGUIDE::alphac_cutoff ( )
private

Definition at line 161 of file rectwaveguide.cpp.

162 {
163  double acc;
164 
165  acc = sqrt( kc_square( 1, 0 ) - kval_square() );
166  acc = 20 * log10( exp( 1.0 ) ) * acc;
167  return acc;
168 }
double kval_square()
double kc_square(int, int)

References kc_square(), and kval_square().

Referenced by calcAnalyze(), and calcSynthesize().

◆ alphad()

double RECTWAVEGUIDE::alphad ( )
private

Definition at line 174 of file rectwaveguide.cpp.

175 {
176  double k_square, beta;
177  double ad;
178 
179  k_square = kval_square();
180  beta = sqrt( k_square - kc_square( 1, 0 ) );
181 
182  ad = ( k_square * m_parameters[TAND_PRM] ) / ( 2.0 * beta );
183  ad = ad * 20.0 * log10( exp( 1. ) ); /* convert from Np/m to db/m */
184  return ad;
185 }
double kval_square()
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
double kc_square(int, int)

References kc_square(), kval_square(), TRANSLINE::m_parameters, and TAND_PRM.

Referenced by calcAnalyze(), and calcSynthesize().

◆ analyze()

void TRANSLINE::analyze ( )
inherited

Definition at line 203 of file transline.cpp.

204 {
205  getProperties();
206  checkProperties();
207  calcAnalyze();
208  showAnalyze();
209  show_results();
210 }
virtual void calcAnalyze()
Computation for analysis.
Definition: transline.h:101
void checkProperties(void)
@function checkProperties
Definition: transline.cpp:161
virtual void show_results()
Shows results.
Definition: transline.h:113
virtual void showAnalyze()
Shows synthesis results and checks for errors / warnings.
Definition: transline.h:107
void getProperties(void)
@function getProperties
Definition: transline.cpp:144

References TRANSLINE::calcAnalyze(), TRANSLINE::checkProperties(), TRANSLINE::getProperties(), TRANSLINE::show_results(), and TRANSLINE::showAnalyze().

Referenced by PCB_CALCULATOR_FRAME::OnTranslineAnalyse().

◆ calc()

virtual void TRANSLINE::calc ( )
inlinevirtualinherited

Definition at line 98 of file transline.h.

98 {};

◆ calcAnalyze()

void RECTWAVEGUIDE::calcAnalyze ( )
overrideprivatevirtual

Computation for analysis.

Reimplemented from TRANSLINE.

Definition at line 242 of file rectwaveguide.cpp.

243 {
244  double lambda_g;
245  double k_square;
246 
247  k_square = kval_square();
248 
249  if( kc_square( 1, 0 ) <= k_square )
250  {
251  /* propagating modes */
252 
253  // Z0 definition using fictive voltages and currents
255  2.0 * ZF0 * sqrt( m_parameters[MUR_PRM] / m_parameters[EPSILONR_PRM] )
257  / sqrt( 1.0 - pow( ( fc( 1, 0 ) / m_parameters[FREQUENCY_PRM] ), 2.0 ) );
258 
259  /* calculate electrical angle */
260  lambda_g = 2.0 * M_PI / sqrt( k_square - kc_square( 1, 0 ) );
262  2.0 * M_PI * m_parameters[PHYS_LEN_PRM] / lambda_g; /* in radians */
266  ( 1.0 - pow( fc( 1, 0 ) / m_parameters[FREQUENCY_PRM], 2.0 ) );
267  }
268  else
269  {
270  /* evanascent modes */
271  m_parameters[Z0_PRM] = 0;
272  m_parameters[ANG_L_PRM] = 0;
276  }
277 }
double kval_square()
#define PHYS_B_PRM
Definition: rectwaveguide.h:31
double alphac_cutoff()
#define ZF0
Definition: units.h:63
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
double fc(int, int)
double kc_square(int, int)
#define PHYS_A_PRM
Definition: rectwaveguide.h:30

References alphac(), alphac_cutoff(), alphad(), ANG_L_PRM, EPSILON_EFF_PRM, EPSILONR_PRM, fc(), FREQUENCY_PRM, kc_square(), kval_square(), LOSS_CONDUCTOR_PRM, LOSS_DIELECTRIC_PRM, TRANSLINE::m_parameters, MUR_PRM, PHYS_A_PRM, PHYS_B_PRM, PHYS_LEN_PRM, Z0_PRM, and ZF0.

◆ calcSynthesize()

void RECTWAVEGUIDE::calcSynthesize ( )
overrideprivatevirtual

Computation for synthesis.

Reimplemented from TRANSLINE.

Definition at line 282 of file rectwaveguide.cpp.

283 {
284  double lambda_g, k_square, beta;
285 
286  if( isSelected( PHYS_B_PRM ) )
287  {
288  /* solve for b */
291  * sqrt( 1.0 - pow( fc( 1, 0 ) / m_parameters[FREQUENCY_PRM], 2.0 ) )
292  / ( 2.0 * ZF0 * sqrt( m_parameters[MUR_PRM] / m_parameters[EPSILONR_PRM] ) );
293  }
294  else if( isSelected( PHYS_A_PRM ) )
295  {
296  /* solve for a */
298  sqrt( pow( 2.0 * ZF0 * m_parameters[PHYS_B_PRM] / m_parameters[Z0_PRM], 2.0 )
299  + pow( C0 / ( 2.0 * m_parameters[FREQUENCY_PRM] ), 2.0 ) );
300  }
301 
302  k_square = kval_square();
303  beta = sqrt( k_square - kc_square( 1, 0 ) );
304  lambda_g = 2.0 * M_PI / beta;
305  m_parameters[PHYS_LEN_PRM] = ( m_parameters[ANG_L_PRM] * lambda_g ) / ( 2.0 * M_PI ); /* in m */
306 
307  if( kc_square( 1, 0 ) <= k_square )
308  {
309  /*propagating modes */
310  beta = sqrt( k_square - kc_square( 1, 0 ) );
311  lambda_g = 2.0 * M_PI / beta;
315  ( 1.0 - pow( ( fc( 1, 0 ) / m_parameters[FREQUENCY_PRM] ), 2.0 ) );
316  }
317  else
318  {
319  /*evanascent modes */
320  m_parameters[Z0_PRM] = 0;
321  m_parameters[ANG_L_PRM] = 0;
325  }
326 }
bool isSelected(enum PRMS_ID aPrmId)
Definition: transline.cpp:116
double kval_square()
#define PHYS_B_PRM
Definition: rectwaveguide.h:31
double alphac_cutoff()
#define ZF0
Definition: units.h:63
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
#define C0
Definition: units.h:62
double fc(int, int)
double kc_square(int, int)
#define PHYS_A_PRM
Definition: rectwaveguide.h:30

References alphac(), alphac_cutoff(), alphad(), ANG_L_PRM, C0, EPSILON_EFF_PRM, EPSILONR_PRM, fc(), FREQUENCY_PRM, TRANSLINE::isSelected(), kc_square(), kval_square(), LOSS_CONDUCTOR_PRM, LOSS_DIELECTRIC_PRM, TRANSLINE::m_parameters, MUR_PRM, PHYS_A_PRM, PHYS_B_PRM, PHYS_LEN_PRM, Z0_PRM, and ZF0.

◆ checkProperties()

void TRANSLINE::checkProperties ( void  )
inherited

@function checkProperties

Checks the input parameters (ie: negative length). Does not check for incompatibility between values as this depends on the line shape.

Definition at line 161 of file transline.cpp.

162 {
163  // Do not check for values that are results of anylzing / synthesizing
164  // Do not check for transline specific incompatibilities ( like " conductor height sould be lesser than dielectric height")
165  if( !std::isfinite( m_parameters[EPSILONR_PRM] ) || m_parameters[EPSILONR_PRM] <= 0 )
167 
168  if( !std::isfinite( m_parameters[TAND_PRM] ) || m_parameters[TAND_PRM] < 0 )
170 
171  if( !std::isfinite( m_parameters[RHO_PRM] ) || m_parameters[RHO_PRM] < 0 )
173 
174  if( !std::isfinite( m_parameters[H_PRM] ) || m_parameters[H_PRM] < 0 )
176 
177  if( !std::isfinite( m_parameters[TWISTEDPAIR_TWIST_PRM] )
180 
181  if( !std::isfinite( m_parameters[STRIPLINE_A_PRM] ) || m_parameters[STRIPLINE_A_PRM] <= 0 )
183 
184  if( !std::isfinite( m_parameters[H_T_PRM] ) || m_parameters[H_T_PRM] <= 0 )
186 
187  // How can we check ROUGH_PRM ?
188 
189  if( !std::isfinite( m_parameters[MUR_PRM] ) || m_parameters[MUR_PRM] < 0 )
191 
192  if( !std::isfinite( m_parameters[TWISTEDPAIR_EPSILONR_ENV_PRM] )
195 
196  if( !std::isfinite( m_parameters[MURC_PRM] ) || m_parameters[MURC_PRM] < 0 )
198 
199  if( !std::isfinite( m_parameters[FREQUENCY_PRM] ) || m_parameters[FREQUENCY_PRM] <= 0 )
201 }
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
#define TRANSLINE_WARNING
Definition: transline.h:31
void setErrorLevel(PRMS_ID, char)
@function setErrorLevel
Definition: transline.cpp:423

References EPSILONR_PRM, FREQUENCY_PRM, H_PRM, H_T_PRM, TRANSLINE::m_parameters, MUR_PRM, MURC_PRM, RHO_PRM, TRANSLINE::setErrorLevel(), STRIPLINE_A_PRM, TAND_PRM, TRANSLINE_WARNING, TWISTEDPAIR_EPSILONR_ENV_PRM, and TWISTEDPAIR_TWIST_PRM.

Referenced by TRANSLINE::analyze(), and TRANSLINE::synthesize().

◆ ellipk()

double TRANSLINE::ellipk ( double  k)
protectedinherited

Definition at line 312 of file transline.cpp.

313 {
314  double r, lost;
315 
316  ellipke( k, r, lost );
317  return r;
318 }
void ellipke(double, double &, double &)
Definition: transline.cpp:251

References TRANSLINE::ellipke().

Referenced by COPLANAR::calcAnalyze().

◆ ellipke()

void TRANSLINE::ellipke ( double  arg,
double &  k,
double &  e 
)
protectedinherited

Definition at line 251 of file transline.cpp.

252 {
253  int iMax = 16;
254 
255  if( arg == 1.0 )
256  {
257  k = INFINITY; // infinite
258  e = 0;
259  }
260  else if( std::isinf( arg ) && arg < 0 )
261  {
262  k = 0;
263  e = INFINITY; // infinite
264  }
265  else
266  {
267  double a, b, c, fr, s, fk = 1, fe = 1, t, da = arg;
268  int i;
269  if( arg < 0 )
270  {
271  fk = 1 / sqrt( 1 - arg );
272  fe = sqrt( 1 - arg );
273  da = -arg / ( 1 - arg );
274  }
275  a = 1;
276  b = sqrt( 1 - da );
277  c = sqrt( da );
278  fr = 0.5;
279  s = fr * c * c;
280  for( i = 0; i < iMax; i++ )
281  {
282  t = ( a + b ) / 2;
283  c = ( a - b ) / 2;
284  b = sqrt( a * b );
285  a = t;
286  fr *= 2;
287  s += fr * c * c;
288  if( c / a < NR_EPSI )
289  break;
290  }
291 
292  if( i >= iMax )
293  {
294  k = 0;
295  e = 0;
296  }
297  else
298  {
299  k = M_PI_2 / a;
300  e = M_PI_2 * ( 1 - s ) / a;
301  if( arg < 0 )
302  {
303  k *= fk;
304  e *= fe;
305  }
306  }
307  }
308 }
#define M_PI_2
Definition: transline.cpp:37
#define NR_EPSI
Definition: transline.cpp:245
#define INFINITY
Definition: transline.cpp:32

References INFINITY, M_PI_2, and NR_EPSI.

Referenced by TRANSLINE::ellipk().

◆ fc()

double RECTWAVEGUIDE::fc ( int  m,
int  n 
)
private

Definition at line 79 of file rectwaveguide.cpp.

80 {
81  return sqrt( kc_square( m, n ) / m_parameters[MUR_PRM] / m_parameters[EPSILONR_PRM] ) * C0 / 2.0
82  / M_PI;
83 }
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
#define C0
Definition: units.h:62
double kc_square(int, int)

References C0, EPSILONR_PRM, kc_square(), TRANSLINE::m_parameters, and MUR_PRM.

Referenced by alphac(), calcAnalyze(), calcSynthesize(), and show_results().

◆ get_rectwaveguide_comp()

void RECTWAVEGUIDE::get_rectwaveguide_comp ( )
private

Definition at line 208 of file rectwaveguide.cpp.

209 {
211 }
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
double getProperty(enum PRMS_ID aPrmId)
Definition: transline.cpp:135

References FREQUENCY_PRM, TRANSLINE::getProperty(), and TRANSLINE::m_parameters.

◆ get_rectwaveguide_elec()

void RECTWAVEGUIDE::get_rectwaveguide_elec ( )
private

Definition at line 219 of file rectwaveguide.cpp.

220 {
223 }
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
double getProperty(enum PRMS_ID aPrmId)
Definition: transline.cpp:135

References ANG_L_PRM, TRANSLINE::getProperty(), TRANSLINE::m_parameters, and Z0_PRM.

◆ get_rectwaveguide_phys()

void RECTWAVEGUIDE::get_rectwaveguide_phys ( )
private

Definition at line 231 of file rectwaveguide.cpp.

232 {
236 }
#define PHYS_B_PRM
Definition: rectwaveguide.h:31
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
double getProperty(enum PRMS_ID aPrmId)
Definition: transline.cpp:135
#define PHYS_A_PRM
Definition: rectwaveguide.h:30

References TRANSLINE::getProperty(), TRANSLINE::m_parameters, PHYS_A_PRM, PHYS_B_PRM, and PHYS_LEN_PRM.

◆ get_rectwaveguide_sub()

void RECTWAVEGUIDE::get_rectwaveguide_sub ( )
private

◆ getProperties()

void TRANSLINE::getProperties ( void  )
inherited

@function getProperties

Get all properties from the UI. Computes some extra ones.

Definition at line 144 of file transline.cpp.

145 {
146  int i;
147  for( i = 0; i < DUMMY_PRM; ++i )
148  {
149  m_parameters[i] = getProperty( (PRMS_ID) i );
151  }
155 }
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
PRMS_ID
Definition: transline.h:37
double getProperty(enum PRMS_ID aPrmId)
Definition: transline.cpp:135
#define TRANSLINE_OK
Definition: transline.h:30
double skin_depth()
@function skin_depth calculate skin depth
Definition: transline.cpp:229
void setErrorLevel(PRMS_ID, char)
@function setErrorLevel
Definition: transline.cpp:423

References DUMMY_PRM, EPSILON_EFF_PRM, TRANSLINE::getProperty(), TRANSLINE::m_parameters, RHO_PRM, TRANSLINE::setErrorLevel(), SIGMA_PRM, TRANSLINE::skin_depth(), SKIN_DEPTH_PRM, and TRANSLINE_OK.

Referenced by TRANSLINE::analyze(), and TRANSLINE::synthesize().

◆ getProperty()

double TRANSLINE::getProperty ( enum PRMS_ID  aPrmId)
inherited

Definition at line 135 of file transline.cpp.

136 {
137  return GetPropertyInDialog( aPrmId );
138 }
double GetPropertyInDialog(enum PRMS_ID aPrmId)

References GetPropertyInDialog().

Referenced by get_rectwaveguide_comp(), get_rectwaveguide_elec(), get_rectwaveguide_phys(), get_rectwaveguide_sub(), and TRANSLINE::getProperties().

◆ Init()

void TRANSLINE::Init ( void  )
inherited

Definition at line 87 of file transline.cpp.

88 {
89  wxColour wxcol = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
90  okCol = KIGFX::COLOR4D( wxcol );
91  okCol.r = wxcol.Red() / 255.0;
92  okCol.g = wxcol.Green() / 255.0;
93  okCol.b = wxcol.Blue() / 255.0;
94  int i;
95  // Initialize these variables mainly to avoid warnings from a static analyzer
96  for( i = 0; i < EXTRA_PRMS_COUNT; ++i )
97  {
98  m_parameters[i] = 0;
99  }
100 }
double g
Green component.
Definition: color4d.h:367
double b
Blue component.
Definition: color4d.h:368
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
KIGFX::COLOR4D okCol
Definition: transline.h:117
double r
Red component.
Definition: color4d.h:366
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99

References KIGFX::COLOR4D::b, EXTRA_PRMS_COUNT, KIGFX::COLOR4D::g, TRANSLINE::m_parameters, TRANSLINE::okCol, and KIGFX::COLOR4D::r.

Referenced by C_MICROSTRIP::C_MICROSTRIP(), COAX::COAX(), COPLANAR::COPLANAR(), MICROSTRIP::MICROSTRIP(), RECTWAVEGUIDE(), STRIPLINE::STRIPLINE(), TRANSLINE::TRANSLINE(), and TWISTEDPAIR::TWISTEDPAIR().

◆ isSelected()

bool TRANSLINE::isSelected ( enum PRMS_ID  aPrmId)
inherited

◆ kc_square()

double RECTWAVEGUIDE::kc_square ( int  m,
int  n 
)
private

Definition at line 68 of file rectwaveguide.cpp.

69 {
70  return pow( ( m * M_PI / m_parameters[PHYS_A_PRM] ), 2.0 )
71  + pow( ( n * M_PI / m_parameters[PHYS_B_PRM] ), 2.0 );
72 }
#define PHYS_B_PRM
Definition: rectwaveguide.h:31
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
#define PHYS_A_PRM
Definition: rectwaveguide.h:30

References TRANSLINE::m_parameters, PHYS_A_PRM, and PHYS_B_PRM.

Referenced by alphac_cutoff(), alphad(), calcAnalyze(), calcSynthesize(), fc(), and show_results().

◆ kval_square()

double RECTWAVEGUIDE::kval_square ( )
private

Definition at line 53 of file rectwaveguide.cpp.

54 {
55  double kval;
56 
57  kval = 2.0 * M_PI * m_parameters[FREQUENCY_PRM]
59 
60  return kval * kval;
61 }
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
#define C0
Definition: units.h:62

References C0, EPSILONR_PRM, FREQUENCY_PRM, TRANSLINE::m_parameters, and MUR_PRM.

Referenced by alphac_cutoff(), alphad(), calcAnalyze(), calcSynthesize(), and show_results().

◆ minimizeZ0Error1D()

bool TRANSLINE::minimizeZ0Error1D ( double *  aVar)
protectedinherited

@function minimizeZ0Error1D

Tries to find a parameter that minimizes the error ( on Z0 ). This function only works with a single parameter. Calls calcAnalyze several times until the error is acceptable. While the error is unnacceptable, changes slightly the parameter.

This function does not change Z0 / Angl_L.

Parameters
avarParameter to synthesize
Returns
'true' if error < MAX_ERROR, else 'false'

Definition at line 337 of file transline.cpp.

338 {
339  double Z0_dest, Z0_current, Z0_result, angl_l_dest, increment, slope, error;
340  int iteration;
341 
342  if( !std::isfinite( m_parameters[Z0_PRM] ) )
343  {
344  *aVar = NAN;
345  return false;
346  }
347 
348  if( ( !std::isfinite( *aVar ) ) || ( *aVar == 0 ) )
349  {
350  *aVar = 0.001;
351  }
352 
353  /* required value of Z0 */
354  Z0_dest = m_parameters[Z0_PRM];
355 
356  /* required value of angl_l */
357  angl_l_dest = m_parameters[ANG_L_PRM];
358 
359  /* Newton's method */
360  iteration = 0;
361 
362  /* compute parameters */
363  calcAnalyze();
364  Z0_current = m_parameters[Z0_PRM];
365 
366  error = fabs( Z0_dest - Z0_current );
367 
368  while( error > MAX_ERROR )
369  {
370  iteration++;
371  increment = *aVar / 100.0;
372  *aVar += increment;
373  /* compute parameters */
374  calcAnalyze();
375  Z0_result = m_parameters[Z0_PRM];
376  /* f(w(n)) = Z0 - Z0(w(n)) */
377  /* f'(w(n)) = -f'(Z0(w(n))) */
378  /* f'(Z0(w(n))) = (Z0(w(n)) - Z0(w(n+delw))/delw */
379  /* w(n+1) = w(n) - f(w(n))/f'(w(n)) */
380  slope = ( Z0_result - Z0_current ) / increment;
381  slope = ( Z0_dest - Z0_current ) / slope - increment;
382  *aVar += slope;
383  if( *aVar <= 0.0 )
384  *aVar = increment;
385  /* find new error */
386  /* compute parameters */
387  calcAnalyze();
388  Z0_current = m_parameters[Z0_PRM];
389  error = fabs( Z0_dest - Z0_current );
390 
391  if( iteration > 100 )
392  break;
393  }
394 
395  /* Compute one last time, but with correct length */
396  m_parameters[Z0_PRM] = Z0_dest;
397  m_parameters[ANG_L_PRM] = angl_l_dest;
400  / 2.0 / M_PI; /* in m */
401  calcAnalyze();
402 
403  /* Restore parameters */
404  m_parameters[Z0_PRM] = Z0_dest;
405  m_parameters[ANG_L_PRM] = angl_l_dest;
408  / 2.0 / M_PI; /* in m */
409  return error <= MAX_ERROR;
410 }
virtual void calcAnalyze()
Computation for analysis.
Definition: transline.h:101
#define MAX_ERROR
Definition: transline.cpp:320
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
#define C0
Definition: units.h:62

References ANG_L_PRM, C0, TRANSLINE::calcAnalyze(), EPSILON_EFF_PRM, FREQUENCY_PRM, TRANSLINE::m_parameters, MAX_ERROR, PHYS_LEN_PRM, and Z0_PRM.

Referenced by COPLANAR::calcSynthesize(), TWISTEDPAIR::calcSynthesize(), STRIPLINE::calcSynthesize(), and MICROSTRIP::calcSynthesize().

◆ setErrorLevel()

void TRANSLINE::setErrorLevel ( PRMS_ID  aP,
char  aErrorLevel 
)
protectedinherited

@function setErrorLevel

set an error / warning level for a given parameter.

See also
TRANSLINE_OK
TRANSLINE_WARNING
TRANSLINE_ERROR
Parameters
aPparameter
aErrorLevelError level

Definition at line 423 of file transline.cpp.

424 {
425  switch( aErrorLevel )
426  {
427  case( TRANSLINE_WARNING ):
429  break;
430  case( TRANSLINE_ERROR ):
432  break;
433  default:
435  break;
436  }
437 }
void SetPropertyBgColorInDialog(enum PRMS_ID aPrmId, const KIGFX::COLOR4D *aCol)
Function SetPropertyBgColorInDialog Set the background color of a parameter.
KIGFX::COLOR4D okCol
Definition: transline.h:117
KIGFX::COLOR4D errCol
Definition: transline.h:115
#define TRANSLINE_ERROR
Definition: transline.h:32
KIGFX::COLOR4D warnCol
Definition: transline.h:116
#define TRANSLINE_WARNING
Definition: transline.h:31

References TRANSLINE::errCol, TRANSLINE::okCol, SetPropertyBgColorInDialog(), TRANSLINE_ERROR, TRANSLINE_WARNING, and TRANSLINE::warnCol.

Referenced by TRANSLINE::checkProperties(), TRANSLINE::getProperties(), TWISTEDPAIR::showAnalyze(), COAX::showAnalyze(), STRIPLINE::showAnalyze(), COPLANAR::showAnalyze(), showAnalyze(), MICROSTRIP::showAnalyze(), C_MICROSTRIP::showAnalyze(), TWISTEDPAIR::showSynthesize(), STRIPLINE::showSynthesize(), COAX::showSynthesize(), COPLANAR::showSynthesize(), showSynthesize(), MICROSTRIP::showSynthesize(), and C_MICROSTRIP::showSynthesize().

◆ setProperty()

◆ setResult() [1/2]

void TRANSLINE::setResult ( int  line,
double  value,
const char *  text 
)
inherited

Definition at line 128 of file transline.cpp.

129 {
130  SetResultInDialog( line, value, text );
131 }
void SetResultInDialog(int line, const char *text)

References SetResultInDialog().

Referenced by TWISTEDPAIR::show_results(), STRIPLINE::show_results(), COAX::show_results(), COPLANAR::show_results(), show_results(), MICROSTRIP::show_results(), and C_MICROSTRIP::show_results().

◆ setResult() [2/2]

void TRANSLINE::setResult ( int  line,
const char *  text 
)
inherited

Definition at line 124 of file transline.cpp.

125 {
126  SetResultInDialog( line, text );
127 }
void SetResultInDialog(int line, const char *text)

References SetResultInDialog().

◆ show_results()

void RECTWAVEGUIDE::show_results ( )
overrideprivatevirtual

Shows results.

Reimplemented from TRANSLINE.

Definition at line 376 of file rectwaveguide.cpp.

377 {
378  int m, n, max = 6;
379  char text[MAXSTRLEN], txt[32];
380 
381  // Z0EH = Ey / Hx (definition with field quantities)
382  Z0EH = ZF0 * sqrt( kval_square() / ( kval_square() - kc_square( 1, 0 ) ) );
383  setResult( 0, Z0EH, "Ohm" );
384 
388 
389  // show possible TE modes (H modes)
390  if( m_parameters[FREQUENCY_PRM] < fc( 1, 0 ) )
391  strcpy( text, "none" );
392  else
393  {
394  strcpy( text, "" );
395  for( m = 0; m <= max; m++ )
396  {
397  for( n = 0; n <= max; n++ )
398  {
399  if( ( m == 0 ) && ( n == 0 ) )
400  continue;
401  if( m_parameters[FREQUENCY_PRM] >= ( fc( m, n ) ) )
402  {
403  sprintf( txt, "H(%d,%d) ", m, n );
404  if( ( strlen( text ) + strlen( txt ) + 5 ) < MAXSTRLEN )
405  strcat( text, txt );
406  else
407  {
408  strcat( text, "..." );
409  m = n = max + 1; // print no more modes
410  }
411  }
412  }
413  }
414  }
415  setResult( 4, text );
416 
417  // show possible TM modes (E modes)
418  if( m_parameters[FREQUENCY_PRM] < fc( 1, 1 ) )
419  strcpy( text, "none" );
420  else
421  {
422  strcpy( text, "" );
423  for( m = 1; m <= max; m++ )
424  {
425  for( n = 1; n <= max; n++ )
426  {
427  if( m_parameters[FREQUENCY_PRM] >= fc( m, n ) )
428  {
429  sprintf( txt, "E(%d,%d) ", m, n );
430  if( ( strlen( text ) + strlen( txt ) + 5 ) < MAXSTRLEN )
431  strcat( text, txt );
432  else
433  {
434  strcat( text, "..." );
435  m = n = max + 1; // print no more modes
436  }
437  }
438  }
439  }
440  }
441  setResult( 5, text );
442 }
double kval_square()
void setResult(int, double, const char *)
Definition: transline.cpp:128
#define MAXSTRLEN
#define ZF0
Definition: units.h:63
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
double fc(int, int)
double kc_square(int, int)

References EPSILON_EFF_PRM, fc(), FREQUENCY_PRM, kc_square(), kval_square(), LOSS_CONDUCTOR_PRM, LOSS_DIELECTRIC_PRM, TRANSLINE::m_parameters, MAXSTRLEN, TRANSLINE::setResult(), Z0EH, and ZF0.

◆ showAnalyze()

void RECTWAVEGUIDE::showAnalyze ( )
overrideprivatevirtual

Shows synthesis results and checks for errors / warnings.

Reimplemented from TRANSLINE.

Definition at line 354 of file rectwaveguide.cpp.

355 {
358 
359  // Check for errors
360  if( !std::isfinite( m_parameters[Z0_PRM] ) || m_parameters[Z0_PRM] < 0 )
362 
363  if( !std::isfinite( m_parameters[ANG_L_PRM] ) || m_parameters[ANG_L_PRM] < 0 )
365 
366  // Check for warnings
367  if( !std::isfinite( m_parameters[PHYS_A_PRM] ) || m_parameters[PHYS_A_PRM] <= 0 )
369 
370  if( !std::isfinite( m_parameters[PHYS_B_PRM] ) || m_parameters[PHYS_B_PRM] <= 00 )
372 }
void setProperty(enum PRMS_ID aPrmId, double aValue)
Definition: transline.cpp:106
#define PHYS_B_PRM
Definition: rectwaveguide.h:31
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
#define TRANSLINE_ERROR
Definition: transline.h:32
#define PHYS_A_PRM
Definition: rectwaveguide.h:30
#define TRANSLINE_WARNING
Definition: transline.h:31
void setErrorLevel(PRMS_ID, char)
@function setErrorLevel
Definition: transline.cpp:423

References ANG_L_PRM, TRANSLINE::m_parameters, PHYS_A_PRM, PHYS_B_PRM, TRANSLINE::setErrorLevel(), TRANSLINE::setProperty(), TRANSLINE_ERROR, TRANSLINE_WARNING, and Z0_PRM.

◆ showSynthesize()

void RECTWAVEGUIDE::showSynthesize ( )
overrideprivatevirtual

Shows analysis results and checks for errors / warnings.

Reimplemented from TRANSLINE.

Definition at line 328 of file rectwaveguide.cpp.

329 {
330  if( isSelected( PHYS_A_PRM ) )
332 
333  if( isSelected( PHYS_B_PRM ) )
335 
337 
338  // Check for errors
339  if( !std::isfinite( m_parameters[PHYS_A_PRM] ) || m_parameters[PHYS_A_PRM] <= 0 )
341 
342  if( !std::isfinite( m_parameters[PHYS_B_PRM] ) || m_parameters[PHYS_B_PRM] <= 00 )
344 
345  // Check for warnings
346  if( !std::isfinite( m_parameters[Z0_PRM] ) || m_parameters[Z0_PRM] < 0 )
348 
349  if( !std::isfinite( m_parameters[ANG_L_PRM] ) || m_parameters[ANG_L_PRM] < 0 )
351 }
bool isSelected(enum PRMS_ID aPrmId)
Definition: transline.cpp:116
void setProperty(enum PRMS_ID aPrmId, double aValue)
Definition: transline.cpp:106
#define PHYS_B_PRM
Definition: rectwaveguide.h:31
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120
#define TRANSLINE_ERROR
Definition: transline.h:32
#define PHYS_A_PRM
Definition: rectwaveguide.h:30
#define TRANSLINE_WARNING
Definition: transline.h:31
void setErrorLevel(PRMS_ID, char)
@function setErrorLevel
Definition: transline.cpp:423

References ANG_L_PRM, TRANSLINE::isSelected(), TRANSLINE::m_parameters, PHYS_A_PRM, PHYS_B_PRM, PHYS_LEN_PRM, TRANSLINE::setErrorLevel(), TRANSLINE::setProperty(), TRANSLINE_ERROR, TRANSLINE_WARNING, and Z0_PRM.

◆ skin_depth()

double TRANSLINE::skin_depth ( )
protectedinherited

@function skin_depth calculate skin depth

$ \frac{1}{\sqrt{ \pi \cdot f \cdot \mu \cdot \sigma }} $

Definition at line 229 of file transline.cpp.

230 {
231  double depth;
232  depth = 1.0
233  / sqrt( M_PI * m_parameters[FREQUENCY_PRM] * m_parameters[MURC_PRM] * MU0
234  * m_parameters[SIGMA_PRM] );
235  return depth;
236 }
#define MU0
Definition: units.h:61
double m_parameters[EXTRA_PRMS_COUNT]
Definition: transline.h:120

References FREQUENCY_PRM, TRANSLINE::m_parameters, MU0, MURC_PRM, and SIGMA_PRM.

Referenced by C_MICROSTRIP::attenuation(), MICROSTRIP::attenuation(), STRIPLINE::calcAnalyze(), COPLANAR::calcAnalyze(), and TRANSLINE::getProperties().

◆ synthesize()

void TRANSLINE::synthesize ( )
virtualinherited

Definition at line 212 of file transline.cpp.

213 {
214  getProperties();
215  checkProperties();
216  calcSynthesize();
217  showSynthesize();
218  show_results();
219 }
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
virtual void show_results()
Shows results.
Definition: transline.h:113
void getProperties(void)
@function getProperties
Definition: transline.cpp:144

References TRANSLINE::calcSynthesize(), TRANSLINE::checkProperties(), TRANSLINE::getProperties(), TRANSLINE::show_results(), and TRANSLINE::showSynthesize().

Referenced by PCB_CALCULATOR_FRAME::OnTranslineSynthetize().

Member Data Documentation

◆ a

double RECTWAVEGUIDE::a
private

Definition at line 41 of file rectwaveguide.h.

Referenced by alphac().

◆ ang_l

double RECTWAVEGUIDE::ang_l
private

Definition at line 46 of file rectwaveguide.h.

◆ atten_cond

double RECTWAVEGUIDE::atten_cond
private

Definition at line 50 of file rectwaveguide.h.

◆ atten_dielectric

double RECTWAVEGUIDE::atten_dielectric
private

Definition at line 49 of file rectwaveguide.h.

◆ b

double RECTWAVEGUIDE::b
private

Definition at line 42 of file rectwaveguide.h.

Referenced by alphac().

◆ er_eff

double RECTWAVEGUIDE::er_eff
private

Definition at line 47 of file rectwaveguide.h.

◆ errCol

KIGFX::COLOR4D TRANSLINE::errCol = KIGFX::COLOR4D( 1, 0.63, 0.63, 1 )
inherited

Definition at line 115 of file transline.h.

Referenced by TRANSLINE::setErrorLevel().

◆ fc10

double RECTWAVEGUIDE::fc10
private

Definition at line 51 of file rectwaveguide.h.

◆ l

double RECTWAVEGUIDE::l
private

Definition at line 43 of file rectwaveguide.h.

◆ len

double TRANSLINE::len
protectedinherited

Definition at line 121 of file transline.h.

Referenced by TRANSLINE::TRANSLINE().

◆ m_Name

◆ m_parameters

double TRANSLINE::m_parameters[EXTRA_PRMS_COUNT]
protectedinherited

Definition at line 120 of file transline.h.

Referenced by alphac(), COAX::alphac_coax(), alphad(), COAX::alphad_coax(), C_MICROSTRIP::attenuation(), MICROSTRIP::attenuation(), TWISTEDPAIR::calcAnalyze(), COAX::calcAnalyze(), STRIPLINE::calcAnalyze(), COPLANAR::calcAnalyze(), calcAnalyze(), TWISTEDPAIR::calcSynthesize(), COPLANAR::calcSynthesize(), COAX::calcSynthesize(), STRIPLINE::calcSynthesize(), calcSynthesize(), C_MICROSTRIP::calcSynthesize(), MICROSTRIP::calcSynthesize(), TRANSLINE::checkProperties(), C_MICROSTRIP::compute_single_line(), MICROSTRIP::conductor_losses(), C_MICROSTRIP::conductor_losses(), C_MICROSTRIP::delta_u_thickness(), MICROSTRIP::dielectric_losses(), C_MICROSTRIP::dielectric_losses(), MICROSTRIP::dispersion(), C_MICROSTRIP::er_eff_freq(), C_MICROSTRIP::er_eff_static(), fc(), get_rectwaveguide_comp(), get_rectwaveguide_elec(), get_rectwaveguide_phys(), get_rectwaveguide_sub(), TRANSLINE::getProperties(), TRANSLINE::Init(), kc_square(), kval_square(), C_MICROSTRIP::line_angle(), MICROSTRIP::line_angle(), STRIPLINE::lineImpedance(), MICROSTRIP::microstrip_Z0(), TRANSLINE::minimizeZ0Error1D(), MICROSTRIP::mur_eff_ms(), TWISTEDPAIR::show_results(), STRIPLINE::show_results(), COAX::show_results(), COPLANAR::show_results(), show_results(), MICROSTRIP::show_results(), C_MICROSTRIP::show_results(), TWISTEDPAIR::showAnalyze(), COAX::showAnalyze(), STRIPLINE::showAnalyze(), COPLANAR::showAnalyze(), showAnalyze(), MICROSTRIP::showAnalyze(), C_MICROSTRIP::showAnalyze(), STRIPLINE::showSynthesize(), TWISTEDPAIR::showSynthesize(), COAX::showSynthesize(), COPLANAR::showSynthesize(), showSynthesize(), MICROSTRIP::showSynthesize(), C_MICROSTRIP::showSynthesize(), TRANSLINE::skin_depth(), C_MICROSTRIP::syn_fun(), MICROSTRIP::synth_width(), C_MICROSTRIP::synth_width(), TRANSLINE::TRANSLINE(), C_MICROSTRIP::Z0_dispersion(), and C_MICROSTRIP::Z0_even_odd().

◆ mur

double RECTWAVEGUIDE::mur
private

Definition at line 40 of file rectwaveguide.h.

◆ mur_eff

double RECTWAVEGUIDE::mur_eff
private

Definition at line 48 of file rectwaveguide.h.

◆ okCol

KIGFX::COLOR4D TRANSLINE::okCol = KIGFX::COLOR4D( 1, 1, 1, 1 )
inherited

Definition at line 117 of file transline.h.

Referenced by TRANSLINE::Init(), and TRANSLINE::setErrorLevel().

◆ warnCol

KIGFX::COLOR4D TRANSLINE::warnCol = KIGFX::COLOR4D( 1, 1, 0.57, 1 )
inherited

Definition at line 116 of file transline.h.

Referenced by TRANSLINE::setErrorLevel().

◆ Z0

double RECTWAVEGUIDE::Z0
private

Definition at line 44 of file rectwaveguide.h.

◆ Z0EH

double RECTWAVEGUIDE::Z0EH
private

Definition at line 45 of file rectwaveguide.h.

Referenced by show_results().


The documentation for this class was generated from the following files: