KiCad PCB EDA Suite
TRANSLINE_IDENT Class Reference

A class to handle a list of parameters of a given transline. More...

#include <transline_ident.h>

Public Member Functions

 TRANSLINE_IDENT (enum TRANSLINE_TYPE_ID aType)
 
 ~TRANSLINE_IDENT ()
 
void AddPrm (TRANSLINE_PRM *aParam)
 
TRANSLINE_PRMGetPrm (unsigned aIdx) const
 
unsigned GetPrmsCount () const
 
void ReadConfig ()
 
void WriteConfig ()
 

Public Attributes

enum TRANSLINE_TYPE_ID m_Type
 
BITMAPS m_BitmapName
 
TRANSLINEm_TLine
 
wxArrayString m_Messages
 
bool m_HasPrmSelection
 

Private Attributes

std::vector< TRANSLINE_PRM * > m_prms_List
 

Detailed Description

A class to handle a list of parameters of a given transline.

Note
The first string of TRANSLINE_PRM (m_KeyWord) is a keyword in config file. It can contain only ASCII7 chars. The second string of TRANSLINE_PRM is a string translated for dialog so mark it for translation. Do not mark translatable m_DlgLabel that obviously cannot be translated, like "H" or "H_t".

Definition at line 101 of file transline_ident.h.

Constructor & Destructor Documentation

◆ TRANSLINE_IDENT()

TRANSLINE_IDENT::TRANSLINE_IDENT ( enum TRANSLINE_TYPE_ID  aType)

Definition at line 81 of file transline_ident.cpp.

82 {
83  m_Type = aType; // The type of transline handled
84  m_BitmapName = BITMAPS::INVALID_BITMAP; // The icon to display
85  m_TLine = nullptr; // The TRANSLINE itself
86  m_HasPrmSelection = false; // true if selection of parameters must be enabled in dialog menu
87 
88  // Add common prms:
89  // Default values are for FR4
91  "Er", wxT( "εr" ),
92  _( "Substrate relative permittivity (dielectric constant)" ),
93  4.6, false ) );
95  "TanD", wxT( "tan δ" ),
96  _( "Dielectric loss (dissipation factor)" ),
97  2e-2, false ) );
98 
99  // Default value is for copper
101  "Rho", wxT( "ρ" ),
102  _( "Electrical resistivity or specific electrical resistance of "
103  "conductor (ohm*meter)" ),
104  1.72e-8, false ) );
105 
106  // Default value is in GHz
108  "Frequency", _( "Frequency" ),
109  _( "Frequency of the input signal" ), 1.0, true ) );
110 
111 
112  switch( m_Type )
113  {
114  case MICROSTRIP_TYPE: // microstrip
115  m_TLine = new MICROSTRIP();
117 
118  m_Messages.Add( wxString::Format( _( "Effective %s:" ), wxT( "εr" ) ) );
119  m_Messages.Add( _( "Conductor losses:" ) );
120  m_Messages.Add( _( "Dielectric losses:" ) );
121  m_Messages.Add( _( "Skin depth:" ) );
122 
124  "H", "H", _( "Height of substrate" ), 0.2, true ) );
126  "H_t", "H(top)", _( "Height of box top" ), 1e20, true ) );
128  "T", "T",
129  _( "Strip thickness" ), 0.035, true ) );
131  "Rough", _( "Roughness" ),
132  _( "Conductor roughness" ), 0.0, true ) );
134  "mu Rel S", wxString::Format( wxT( "μ(%s)" ),
135  _( "substrate" ) ),
136  _( "Relative permeability (mu) of substrate" ), 1, false ) );
138  "mu Rel C", wxString::Format( wxT( "μ(%s)" ),
139  _( "conductor" ) ),
140  _( "Relative permeability (mu) of conductor" ), 1,
141  false ) );
142 
144  "W", "W", _( "Line width" ), 0.2, true ) );
146  "L", "L", _( "Line length" ), 50.0, true ) );
147 
149  "Z0", "Z0", _( "Characteristic impedance" ), 50.0, true ) );
152  "Ang_l", "Ang_l", _( "Electrical length" ), 0.0, true ) );
153  break;
154 
155  case CPW_TYPE: // coplanar waveguide
156  m_TLine = new COPLANAR();
158  m_HasPrmSelection = true;
159 
160  m_Messages.Add( wxString::Format( _( "Effective %s:" ), wxT( "εr" ) ) );
161  m_Messages.Add( _( "Conductor losses:" ) );
162  m_Messages.Add( _( "Dielectric losses:" ) );
163  m_Messages.Add( _( "Skin depth:" ) );
164 
166  "H", "H", _( "Height of substrate" ), 0.2, true ) );
168  "T", "T", _( "Strip thickness" ), 0.035, true ) );
170  "mu Rel C", wxString::Format( wxT( "μ(%s)" ),
171  _( "conductor" ) ),
172  _( "Relative permeability (mu) of conductor" ), 1,
173  false ) );
174 
176  "W", "W", _( "Line width" ), 0.2, true ) );
178  "S", "S", _( "Gap width" ), 0.2, true ) );
180  "L", "L", _( "Line length" ), 50.0, true ) );
181 
183  "Z0", "Z0", _( "Characteristic impedance" ), 50.0, true ) );
186  "Ang_l", "Ang_l", _( "Electrical length" ), 0.0, true ) );
187  break;
188 
189  case GROUNDED_CPW_TYPE: // grounded coplanar waveguide
190  m_TLine = new GROUNDEDCOPLANAR();
192  m_HasPrmSelection = true;
193 
194  m_Messages.Add( wxString::Format( _( "Effective %s:" ), wxT( "εr" ) ) );
195  m_Messages.Add( _( "Conductor losses:" ) );
196  m_Messages.Add( _( "Dielectric losses:" ) );
197  m_Messages.Add( _( "Skin depth:" ) );
198 
200  "H", "H", _( "Height of substrate" ), 0.2, true ) );
202  "T", "T", _( "Strip thickness" ), 0.035, true ) );
204  "mu Rel C", wxString::Format( wxT( "μ(%s)" ),
205  _( "conductor" ) ),
206  _( "Relative permeability (mu) of conductor" ), 1,
207  false ) );
208 
210  "W", "W", _( "Line width" ), 0.2, true ) );
212  "S", "S", _( "Gap width" ), 0.2, true ) );
214  "L", "L", _( "Line length" ), 50.0, true ) );
215 
217  "Z0", "Z0", _( "Characteristic impedance" ), 50.0, true ) );
220  "Ang_l", "Ang_l", _( "Electrical length" ), 0, true ) );
221  break;
222 
223 
224  case RECTWAVEGUIDE_TYPE: // rectangular waveguide
225  m_TLine = new RECTWAVEGUIDE();
227  m_HasPrmSelection = true;
228 
229  m_Messages.Add( _( "ZF(H10) = Ey / Hx:" ) );
230  m_Messages.Add( wxString::Format( _( "Effective %s:" ), wxT( "εr" ) ) );
231  m_Messages.Add( _( "Conductor losses:" ) );
232  m_Messages.Add( _( "Dielectric losses:" ) );
233  m_Messages.Add( _( "TE-modes:" ) );
234  m_Messages.Add( _( "TM-modes:" ) );
235 
237  "mu Rel I", wxString::Format( wxT( "μ(%s)" ),
238  _( "insulator" ) ),
239  _( "Relative permeability (mu) of insulator" ), 1, false ) );
241  "mu Rel C", wxString::Format( wxT( "μ(%s)" ),
242  _( "conductor" ) ),
243  _( "Relative permeability (mu) of conductor" ), 1,
244  false ) );
245 
247  "a", "a", _( "Width of waveguide" ), 10.0, true ) );
249  "b", "b", _( "Height of waveguide" ), 5.0, true ) );
251  "L", "L", _( "Waveguide length" ), 50.0, true ) );
252 
254  "Z0", "Z0", _( "Characteristic impedance" ), 50.0, true ) );
257  "Ang_l", "Ang_l", _( "Electrical length" ), 0, true ) );
258  break;
259 
260  case COAX_TYPE: // coaxial cable
261  m_TLine = new COAX();
263  m_HasPrmSelection = true;
264 
265  m_Messages.Add( wxString::Format( _( "Effective %s:" ), wxT( "εr" ) ) );
266  m_Messages.Add( _( "Conductor losses:" ) );
267  m_Messages.Add( _( "Dielectric losses:" ) );
268  m_Messages.Add( _( "TE-modes:" ) );
269  m_Messages.Add( _( "TM-modes:" ) );
270 
272  "mu Rel I", wxString::Format( wxT( "μ(%s)" ),
273  _( "insulator" ) ),
274  _( "Relative permeability (mu) of insulator" ), 1, false ) );
276  "mu Rel C", wxString::Format( wxT( "μ(%s)" ),
277  _( "conductor" ) ),
278  _( "Relative permeability (mu) of conductor" ), 1,
279  false ) );
280 
282  "Din", _( "Din" ),
283  _( "Inner diameter (conductor)" ), 1.0, true ) );
285  "Dout", _( "Dout" ),
286  _( "Outer diameter (insulator)" ), 8.0, true ) );
288  "L", "L", _( "Line length" ), 50.0, true ) );
289 
291  "Z0", "Z0", _( "Characteristic impedance" ), 50.0, true ) );
294  "Ang_l", "Ang_l", _( "Electrical length" ), 0.0, true ) );
295  break;
296 
297  case C_MICROSTRIP_TYPE: // coupled microstrip
298  m_TLine = new C_MICROSTRIP();
300  m_HasPrmSelection = true;
301 
302  m_Messages.Add( wxString::Format( _( "Effective %s (even):" ), wxT( "εr" ) ) );
303  m_Messages.Add( wxString::Format( _( "Effective %s (odd):" ), wxT( "εr" ) ) );
304  m_Messages.Add( _( "Conductor losses (even):" ) );
305  m_Messages.Add( _( "Conductor losses (odd):" ) );
306  m_Messages.Add( _( "Dielectric losses (even):" ) );
307  m_Messages.Add( _( "Dielectric losses (odd):" ) );
308  m_Messages.Add( _( "Skin depth:" ) );
309  m_Messages.Add( _( "Differential Impedance (Zd):" ) );
310 
312  "H", "H", _( "Height of substrate" ), 0.2, true ) );
314  "H_t", "H_t", _( "Height of box top" ), 1e20, true ) );
316  "T", "T", _( "Strip thickness" ), 0.035, true ) );
318  "Rough", _( "Roughness" ),
319  _( "Conductor roughness" ), 0.0, true ) );
321  "mu rel C", wxString::Format( wxT( "μ(%s)" ),
322  _( "conductor" ) ),
323  _( "Relative permeability (mu) of conductor" ), 1,
324  false ) );
325 
327  "W", "W", _( "Line width" ), 0.2, true ) );
329  "S", "S", _( "Gap width" ), 0.2, true ) );
331  "L", "L", _( "Line length" ), 50.0, true ) );
332 
334  "Zeven", _( "Zeven" ),
335  _( "Even mode impedance (lines driven by common voltages)" ),
336  50.0, true ) );
338  "Zodd", _( "Zodd" ),
339  _( "Odd mode impedance (lines driven by opposite "
340  "(differential) voltages)" ), 50.0, true ) );
342  "Ang_l", "Ang_l",
343  _( "Electrical length" ), 0.0, true ) );
344  break;
345 
346  case STRIPLINE_TYPE: // stripline
347  m_TLine = new STRIPLINE();
349 
350  m_Messages.Add( wxString::Format( _( "Effective %s:" ), wxT( "εr" ) ) );
351  m_Messages.Add( _( "Conductor losses:" ) );
352  m_Messages.Add( _( "Dielectric losses:" ) );
353  m_Messages.Add( _( "Skin depth:" ) );
354 
356  "H", "H", _( "Height of substrate" ), 0.2, true ) );
358  "a", "a", _( "Distance between strip and top metal" ), 0.2,
359  true ) );
361  "T", "T", _( "Strip thickness" ), 0.035, true ) );
363  "mu Rel C", wxString::Format( wxT( "μ(%s)" ),
364  _( "conductor" ) ),
365  _( "Relative permeability (mu) of conductor" ), 1, false ) );
366 
368  "W", "W", _( "Line width" ), 0.2, true ) );
370  "L", "L", _( "Line length" ), 50.0, true ) );
371 
373  "Z0", "Z0", _( "Characteristic impedance" ), 50, true ) );
376  "Ang_l", "Ang_l", _( "Electrical length" ), 0, true ) );
377  break;
378 
379  case TWISTEDPAIR_TYPE: // twisted pair
380  m_TLine = new TWISTEDPAIR();
382  m_HasPrmSelection = true;
383 
384  m_Messages.Add( wxString::Format( _( "Effective %s:" ), wxT( "εr" ) ) );
385  m_Messages.Add( _( "Conductor losses:" ) );
386  m_Messages.Add( _( "Dielectric losses:" ) );
387  m_Messages.Add( _( "Skin depth:" ) );
388 
390  "Twists", _( "Twists" ),
391  _( "Number of twists per length" ), 0.0, false ) );
393  "mu Rel C", wxString::Format( wxT( "μ(%s)" ),
394  _( "conductor" ) ),
395  _( "Relative permeability (mu) of conductor" ), 1,
396  false ) );
398  "ErEnv", wxString::Format( wxT( "εr(%s)" ),
399  _( "environment" ) ),
400  _( "Relative permittivity of environment" ), 1,
401  false ) );
403  "Din", _( "Din" ),
404  _( "Inner diameter (conductor)" ), 1.0, true ) );
406  "Dout", _( "Dout" ),
407  _( "Outer diameter (insulator)" ), 8.0, true ) );
409  "L", "L", _( "Cable length" ), 50.0, true ) );
410 
412  "Z0", "Z0", _( "Characteristic impedance" ), 50.0, true ) );
415  "Ang_l", "Ang_l", _( "Electrical length" ), 0.0, true ) );
416  break;
417 
418  case END_OF_LIST_TYPE: // Not really used
419  break;
420  }
421 }
void AddPrm(TRANSLINE_PRM *aParam)
A class to handle one parameter of transline.
wxArrayString m_Messages
enum TRANSLINE_TYPE_ID m_Type
#define _(s)
Definition: coax.h:30
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
TRANSLINE * m_TLine

References _, AddPrm(), ANG_L_PRM, c_microstrip, C_MICROSTRIP_TYPE, coax, COAX_TYPE, cpw, cpw_back, CPW_TYPE, DUMMY_PRM, END_OF_LIST_TYPE, EPSILONR_PRM, Format(), FREQUENCY_PRM, GROUNDED_CPW_TYPE, H_PRM, H_T_PRM, INVALID_BITMAP, m_BitmapName, m_HasPrmSelection, m_Messages, m_TLine, m_Type, microstrip, MICROSTRIP_TYPE, MUR_PRM, MURC_PRM, PHYS_DIAM_IN_PRM, PHYS_DIAM_OUT_PRM, PHYS_LEN_PRM, PHYS_S_PRM, PHYS_WIDTH_PRM, PRM_TYPE_ELEC, PRM_TYPE_FREQUENCY, PRM_TYPE_PHYS, PRM_TYPE_SUBS, rectwaveguide, RECTWAVEGUIDE_TYPE, RHO_PRM, ROUGH_PRM, stripline, STRIPLINE_A_PRM, STRIPLINE_TYPE, T_PRM, TAND_PRM, twistedpair, TWISTEDPAIR_EPSILONR_ENV_PRM, TWISTEDPAIR_TWIST_PRM, TWISTEDPAIR_TYPE, Z0_E_PRM, Z0_O_PRM, and Z0_PRM.

◆ ~TRANSLINE_IDENT()

TRANSLINE_IDENT::~TRANSLINE_IDENT ( )

Definition at line 423 of file transline_ident.cpp.

424 {
425  delete m_TLine;
426 
427  for( auto& ii : m_prms_List )
428  delete ii;
429 
430  m_prms_List.clear();
431 }
std::vector< TRANSLINE_PRM * > m_prms_List
TRANSLINE * m_TLine

References m_prms_List, and m_TLine.

Member Function Documentation

◆ AddPrm()

void TRANSLINE_IDENT::AddPrm ( TRANSLINE_PRM aParam)
inline

Definition at line 108 of file transline_ident.h.

109  {
110  m_prms_List.push_back( aParam );
111  }
std::vector< TRANSLINE_PRM * > m_prms_List

References m_prms_List.

Referenced by TRANSLINE_IDENT().

◆ GetPrm()

TRANSLINE_PRM* TRANSLINE_IDENT::GetPrm ( unsigned  aIdx) const
inline

Definition at line 113 of file transline_ident.h.

114  {
115  if( aIdx < m_prms_List.size() )
116  return m_prms_List[aIdx];
117  else
118  return nullptr;
119  }
std::vector< TRANSLINE_PRM * > m_prms_List

References m_prms_List.

Referenced by PANEL_TRANSLINE::GetPrmValue(), PANEL_TRANSLINE::SetPrmBgColor(), PANEL_TRANSLINE::SetPrmValue(), PANEL_TRANSLINE::TransfDlgDataToTranslineParams(), and PANEL_TRANSLINE::TranslineTypeSelection().

◆ GetPrmsCount()

unsigned TRANSLINE_IDENT::GetPrmsCount ( ) const
inline

◆ ReadConfig()

void TRANSLINE_IDENT::ReadConfig ( )

Definition at line 434 of file transline_ident.cpp.

435 {
436  auto cfg = static_cast<PCB_CALCULATOR_SETTINGS*>( Kiface().KifaceSettings() );
437  std::string name( m_TLine->m_Name );
438 
439  if( cfg->m_TransLine.param_values.count( name ) )
440  {
441  wxASSERT( cfg->m_TransLine.param_units.count( name ) );
442 
443  for( auto& p : m_prms_List )
444  {
445  try
446  {
447  p->m_Value = cfg->m_TransLine.param_values.at( name ).at( p->m_KeyWord );
448  p->m_UnitSelection = cfg->m_TransLine.param_units.at( name ).at( p->m_KeyWord );
449  }
450  catch( ... )
451  {}
452  }
453  }
454 }
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
std::vector< TRANSLINE_PRM * > m_prms_List
const char * m_Name
Definition: transline.h:84
const char * name
Definition: DXF_plotter.cpp:56
TRANSLINE * m_TLine

References Kiface(), TRANSLINE::m_Name, m_prms_List, m_TLine, and name.

◆ WriteConfig()

void TRANSLINE_IDENT::WriteConfig ( )

Definition at line 457 of file transline_ident.cpp.

458 {
459  auto cfg = static_cast<PCB_CALCULATOR_SETTINGS*>( Kiface().KifaceSettings() );
460  std::string name( m_TLine->m_Name );
461 
462  for( auto& param : m_prms_List )
463  {
464  if( !std::isfinite( param->m_Value ) )
465  param->m_Value = 0;
466 
467  cfg->m_TransLine.param_values[ name ][ param->m_KeyWord ] = param->m_Value;
468  cfg->m_TransLine.param_units[ name ][ param->m_KeyWord ] = param->m_UnitSelection;
469  }
470 }
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
std::vector< TRANSLINE_PRM * > m_prms_List
const char * m_Name
Definition: transline.h:84
const char * name
Definition: DXF_plotter.cpp:56
TRANSLINE * m_TLine

References Kiface(), TRANSLINE::m_Name, m_prms_List, m_TLine, and name.

Member Data Documentation

◆ m_BitmapName

BITMAPS TRANSLINE_IDENT::m_BitmapName

Definition at line 131 of file transline_ident.h.

Referenced by TRANSLINE_IDENT().

◆ m_HasPrmSelection

bool TRANSLINE_IDENT::m_HasPrmSelection

Definition at line 136 of file transline_ident.h.

Referenced by TRANSLINE_IDENT(), and PANEL_TRANSLINE::TranslineTypeSelection().

◆ m_Messages

wxArrayString TRANSLINE_IDENT::m_Messages

Definition at line 133 of file transline_ident.h.

Referenced by TRANSLINE_IDENT(), and PANEL_TRANSLINE::TranslineTypeSelection().

◆ m_prms_List

std::vector<TRANSLINE_PRM*> TRANSLINE_IDENT::m_prms_List
private

◆ m_TLine

◆ m_Type

enum TRANSLINE_TYPE_ID TRANSLINE_IDENT::m_Type

Definition at line 130 of file transline_ident.h.

Referenced by TRANSLINE_IDENT().


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