KiCad PCB EDA Suite
TRANSLINE_IDENT Class Reference

#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
 
wxBitmap * m_Icon
 
TRANSLINEm_TLine
 
wxArrayString m_Messages
 
bool m_HasPrmSelection
 

Private Attributes

std::vector< TRANSLINE_PRM * > m_prms_List
 

Detailed Description

Definition at line 94 of file transline_ident.h.

Constructor & Destructor Documentation

◆ TRANSLINE_IDENT()

TRANSLINE_IDENT::TRANSLINE_IDENT ( enum TRANSLINE_TYPE_ID  aType)

Definition at line 110 of file transline_ident.cpp.

111 {
112  m_Type = aType; // The type of transline handled
113  m_Icon = NULL; // An xpm icon to display in dialogs
114  m_TLine = NULL; // The TRANSLINE itself
115  m_HasPrmSelection = false; // true if selection of parameters must be enabled in dialog menu
116 
117  // Add common prms:
118  // Default values are for FR4
120  "Er", wxT( "εr" ),
121  _( "Substrate relative permittivity (dielectric constant)" ),
122  4.6, false ) );
124  "TanD", wxT( "tan δ" ),
125  _( "Dielectric loss (dissipation factor)" ),
126  2e-2, false ) );
127 
128  // Default value is for copper
130  "Rho", wxT( "ρ" ),
131  _( "Electrical resistivity or specific electrical resistance of conductor (ohm*meter)" ),
132  1.72e-8, false ) );
133 
134  // Default value is in GHz
136  "Frequency", _( "Frequency" ),
137  _( "Frequency of the input signal" ), 1.0, true ) );
138 
139 
140  switch( m_Type )
141  {
142  case MICROSTRIP_TYPE: // microstrip
143  m_TLine = new MICROSTRIP();
144  m_Icon = new wxBitmap( KiBitmap( microstrip_xpm ) );
145 
146  m_Messages.Add( wxString::Format( _( "Effective %s:" ), wxT( "εr" ) ) );
147  m_Messages.Add( _( "Conductor losses:" ) );
148  m_Messages.Add( _( "Dielectric losses:" ) );
149  m_Messages.Add( _( "Skin depth:" ) );
150 
152  "H", "H", _( "Height of substrate" ), 0.2, true ) );
154  "H_t", "H(top)", _( "Height of box top" ), 1e20, true ) );
156  "T", "T",
157  _( "Strip thickness" ), 0.035, true ) );
159  "Rough", _( "Roughness" ),
160  _( "Conductor roughness" ), 0.0, true ) );
162  "mu Rel S", wxString::Format( wxT( "μ(%s)" ), _( "substrate" ) ),
163  _( "Relative permeability (mu) of substrate" ), 1, false ) );
165  "mu Rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
166  _( "Relative permeability (mu) of conductor" ), 1,
167  false ) );
168 
170  "W", "W", _( "Line width" ), 0.2, true ) );
172  "L", "L", _( "Line length" ), 50.0, true ) );
173 
175  "Z0", "Z0", _( "Characteristic impedance" ), 50.0, true ) );
178  "Ang_l", "Ang_l", _( "Electrical length" ), 0.0, true ) );
179  break;
180 
181  case CPW_TYPE: // coplanar waveguide
182  m_TLine = new COPLANAR();
183  m_Icon = new wxBitmap( KiBitmap( cpw_xpm ) );
184  m_HasPrmSelection = true;
185 
186  m_Messages.Add( wxString::Format( _( "Effective %s:" ), wxT( "εr" ) ) );
187  m_Messages.Add( _( "Conductor losses:" ) );
188  m_Messages.Add( _( "Dielectric losses:" ) );
189  m_Messages.Add( _( "Skin depth:" ) );
190 
192  "H", "H", _( "Height of substrate" ), 0.2, true ) );
194  "T", "T", _( "Strip thickness" ), 0.035, true ) );
196  "mu Rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
197  _( "Relative permeability (mu) of conductor" ), 1,
198  false ) );
199 
201  "W", "W", _( "Line width" ), 0.2, true ) );
203  "S", "S", _( "Gap width" ), 0.2, true ) );
205  "L", "L", _( "Line length" ), 50.0, true ) );
206 
208  "Z0", "Z0", _( "Characteristic impedance" ), 50.0, true ) );
211  "Ang_l", "Ang_l", _( "Electrical length" ), 0.0, true ) );
212  break;
213 
214  case GROUNDED_CPW_TYPE: // grounded coplanar waveguide
215  m_TLine = new GROUNDEDCOPLANAR();
216  m_Icon = new wxBitmap( KiBitmap( cpw_back_xpm ) );
217  m_HasPrmSelection = true;
218 
219  m_Messages.Add( wxString::Format( _( "Effective %s:" ), wxT( "εr" ) ) );
220  m_Messages.Add( _( "Conductor losses:" ) );
221  m_Messages.Add( _( "Dielectric losses:" ) );
222  m_Messages.Add( _( "Skin depth:" ) );
223 
225  "H", "H", _( "Height of substrate" ), 0.2, true ) );
227  "T", "T", _( "Strip thickness" ), 0.035, true ) );
229  "mu Rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
230  _( "Relative permeability (mu) of conductor" ), 1,
231  false ) );
232 
234  "W", "W", _( "Line width" ), 0.2, true ) );
236  "S", "S", _( "Gap width" ), 0.2, true ) );
238  "L", "L", _( "Line length" ), 50.0, true ) );
239 
241  "Z0", "Z0", _( "Characteristic impedance" ), 50.0, true ) );
244  "Ang_l", "Ang_l", _( "Electrical length" ), 0, true ) );
245  break;
246 
247 
248  case RECTWAVEGUIDE_TYPE: // rectangular waveguide
249  m_TLine = new RECTWAVEGUIDE();
250  m_Icon = new wxBitmap( KiBitmap( rectwaveguide_xpm ) );
251  m_HasPrmSelection = true;
252 
253  m_Messages.Add( _( "ZF(H10) = Ey / Hx:" ) );
254  m_Messages.Add( wxString::Format( _( "Effective %s:" ), wxT( "εr" ) ) );
255  m_Messages.Add( _( "Conductor losses:" ) );
256  m_Messages.Add( _( "Dielectric losses:" ) );
257  m_Messages.Add( _( "TE-modes:" ) );
258  m_Messages.Add( _( "TM-modes:" ) );
259 
261  "mu Rel I", wxString::Format( wxT( "μ(%s)" ), _( "insulator" ) ),
262  _( "Relative permeability (mu) of insulator" ), 1, false ) );
264  "mu Rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
265  _( "Relative permeability (mu) of conductor" ), 1,
266  false ) );
267 
269  "a", "a", _( "Width of waveguide" ), 10.0, true ) );
271  "b", "b", _( "Height of waveguide" ), 5.0, true ) );
273  "L", "L", _( "Waveguide length" ), 50.0, true ) );
274 
276  "Z0", "Z0", _( "Characteristic impedance" ), 50.0, true ) );
279  "Ang_l", "Ang_l", _( "Electrical length" ), 0, true ) );
280  break;
281 
282  case COAX_TYPE: // coaxial cable
283  m_TLine = new COAX();
284  m_Icon = new wxBitmap( KiBitmap( coax_xpm ) );
285  m_HasPrmSelection = true;
286 
287  m_Messages.Add( wxString::Format( _( "Effective %s:" ), wxT( "εr" ) ) );
288  m_Messages.Add( _( "Conductor losses:" ) );
289  m_Messages.Add( _( "Dielectric losses:" ) );
290  m_Messages.Add( _( "TE-modes:" ) );
291  m_Messages.Add( _( "TM-modes:" ) );
292 
294  "mu Rel I", wxString::Format( wxT( "μ(%s)" ), _( "insulator" ) ),
295  _( "Relative permeability (mu) of insulator" ), 1, false ) );
297  "mu Rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
298  _( "Relative permeability (mu) of conductor" ), 1,
299  false ) );
300 
302  "Din", _( "Din" ),
303  _( "Inner diameter (conductor)" ), 1.0, true ) );
305  "Dout", _( "Dout" ),
306  _( "Outer diameter (insulator)" ), 8.0, true ) );
308  "L", "L", _( "Line length" ), 50.0, true ) );
309 
311  "Z0", "Z0", _( "Characteristic impedance" ), 50.0, true ) );
314  "Ang_l", "Ang_l", _( "Electrical length" ), 0.0, true ) );
315  break;
316 
317  case C_MICROSTRIP_TYPE: // coupled microstrip
318  m_TLine = new C_MICROSTRIP();
319  m_Icon = new wxBitmap( KiBitmap( c_microstrip_xpm ) );
320  m_HasPrmSelection = true;
321 
322  m_Messages.Add( wxString::Format( _( "Effective %s (even):" ), wxT( "εr" ) ) );
323  m_Messages.Add( wxString::Format( _( "Effective %s (odd):" ), wxT( "εr" ) ) );
324  m_Messages.Add( _( "Conductor losses (even):" ) );
325  m_Messages.Add( _( "Conductor losses (odd):" ) );
326  m_Messages.Add( _( "Dielectric losses (even):" ) );
327  m_Messages.Add( _( "Dielectric losses (odd):" ) );
328  m_Messages.Add( _( "Skin depth:" ) );
329 
331  "H", "H", _( "Height of substrate" ), 0.2, true ) );
333  "H_t", "H_t", _( "Height of box top" ), 1e20, true ) );
335  "T", "T", _( "Strip thickness" ), 0.035, true ) );
337  "Rough", _( "Roughness" ),
338  _( "Conductor roughness" ), 0.0, true ) );
340  "mu rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
341  _( "Relative permeability (mu) of conductor" ), 1,
342  false ) );
343 
345  "W", "W", _( "Line width" ), 0.2, true ) );
347  "S", "S", _( "Gap width" ), 0.2, true ) );
349  "L", "L", _( "Line length" ), 50.0, true ) );
350 
352  "Zeven", _( "Zeven" ),
353  _( "Even mode impedance (lines driven by common voltages)" ), 50.0, true ) );
355  "Zodd", _( "Zodd" ),
356  _( "Odd mode impedance (lines driven by opposite (differential) voltages)" ), 50.0, true ) );
358  "Ang_l", "Ang_l",
359  _( "Electrical length" ), 0.0, true ) );
360  break;
361 
362  case STRIPLINE_TYPE: // stripline
363  m_TLine = new STRIPLINE();
364  m_Icon = new wxBitmap( KiBitmap( stripline_xpm ) );
365 
366  m_Messages.Add( wxString::Format( _( "Effective %s:" ), wxT( "εr" ) ) );
367  m_Messages.Add( _( "Conductor losses:" ) );
368  m_Messages.Add( _( "Dielectric losses:" ) );
369  m_Messages.Add( _( "Skin depth:" ) );
370 
372  "H", "H", _( "Height of substrate" ), 0.2, true ) );
374  "a", "a", _( "Distance between strip and top metal" ), 0.2,
375  true ) );
377  "T", "T", _( "Strip thickness" ), 0.035, true ) );
379  "mu Rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
380  _( "Relative permeability (mu) of conductor" ), 1, false ) );
381 
383  "W", "W", _( "Line width" ), 0.2, true ) );
385  "L", "L", _( "Line length" ), 50.0, true ) );
386 
388  "Z0", "Z0", _( "Characteristic impedance" ), 50, true ) );
391  "Ang_l", "Ang_l", _( "Electrical length" ), 0, true ) );
392  break;
393 
394  case TWISTEDPAIR_TYPE: // twisted pair
395  m_TLine = new TWISTEDPAIR();
396  m_Icon = new wxBitmap( KiBitmap( twistedpair_xpm ) );
397  m_HasPrmSelection = true;
398 
399  m_Messages.Add( wxString::Format( _( "Effective %s:" ), wxT( "εr" ) ) );
400  m_Messages.Add( _( "Conductor losses:" ) );
401  m_Messages.Add( _( "Dielectric losses:" ) );
402  m_Messages.Add( _( "Skin depth:" ) );
403 
405  "Twists", _( "Twists" ),
406  _( "Number of twists per length" ), 0.0, false ) );
408  "mu Rel C", wxString::Format( wxT( "μ(%s)" ), _( "conductor" ) ),
409  _( "Relative permeability (mu) of conductor" ), 1,
410  false ) );
412  "ErEnv", wxString::Format( wxT( "εr(%s)" ), _( "environment" ) ),
413  _( "Relative permittivity of environment" ), 1,
414  false ) );
416  "Din", _( "Din" ),
417  _( "Inner diameter (conductor)" ), 1.0, true ) );
419  "Dout", _( "Dout" ),
420  _( "Outer diameter (insulator)" ), 8.0, true ) );
422  "L", "L", _( "Cable length" ), 50.0, true ) );
423 
425  "Z0", "Z0", _( "Characteristic impedance" ), 50.0, true ) );
428  "Ang_l", "Ang_l", _( "Electrical length" ), 0.0, true ) );
429  break;
430 
431  case END_OF_LIST_TYPE: // Not really used
432  break;
433  }
434 }
wxBitmap * m_Icon
void AddPrm(TRANSLINE_PRM *aParam)
wxArrayString m_Messages
enum TRANSLINE_TYPE_ID m_Type
const BITMAP_OPAQUE rectwaveguide_xpm[1]
#define NULL
const BITMAP_OPAQUE cpw_xpm[1]
Definition: cpw.cpp:804
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:104
const BITMAP_OPAQUE c_microstrip_xpm[1]
const BITMAP_OPAQUE stripline_xpm[1]
const BITMAP_OPAQUE cpw_back_xpm[1]
Definition: cpw_back.cpp:817
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
const BITMAP_OPAQUE twistedpair_xpm[1]
const BITMAP_OPAQUE coax_xpm[1]
#define _(s)
Definition: 3d_actions.cpp:33
TRANSLINE * m_TLine
const BITMAP_OPAQUE microstrip_xpm[1]

References _, AddPrm(), ANG_L_PRM, C_MICROSTRIP_TYPE, c_microstrip_xpm, COAX_TYPE, coax_xpm, cpw_back_xpm, CPW_TYPE, cpw_xpm, DUMMY_PRM, END_OF_LIST_TYPE, EPSILONR_PRM, Format(), FREQUENCY_PRM, GROUNDED_CPW_TYPE, H_PRM, H_T_PRM, KiBitmap(), m_HasPrmSelection, m_Icon, m_Messages, m_TLine, m_Type, MICROSTRIP_TYPE, microstrip_xpm, MUR_PRM, MURC_PRM, NULL, 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_TYPE, rectwaveguide_xpm, RHO_PRM, ROUGH_PRM, STRIPLINE_A_PRM, STRIPLINE_TYPE, stripline_xpm, T_PRM, TAND_PRM, TWISTEDPAIR_EPSILONR_ENV_PRM, TWISTEDPAIR_TWIST_PRM, TWISTEDPAIR_TYPE, twistedpair_xpm, Z0_E_PRM, Z0_O_PRM, and Z0_PRM.

◆ ~TRANSLINE_IDENT()

TRANSLINE_IDENT::~TRANSLINE_IDENT ( )

Definition at line 436 of file transline_ident.cpp.

437 {
438  delete m_TLine;
439  delete m_Icon;
440 
441  for( auto& ii : m_prms_List )
442  delete ii;
443 
444  m_prms_List.clear();
445 }
wxBitmap * m_Icon
std::vector< TRANSLINE_PRM * > m_prms_List
TRANSLINE * m_TLine

References m_Icon, m_prms_List, and m_TLine.

Member Function Documentation

◆ AddPrm()

void TRANSLINE_IDENT::AddPrm ( TRANSLINE_PRM aParam)
inline

Definition at line 111 of file transline_ident.h.

112  {
113  m_prms_List.push_back( aParam );
114  }
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 117 of file transline_ident.h.

118  {
119  if( aIdx < m_prms_List.size() )
120  return m_prms_List[aIdx];
121  else
122  return NULL;
123  }
#define NULL
std::vector< TRANSLINE_PRM * > m_prms_List

References m_prms_List, and NULL.

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

◆ GetPrmsCount()

unsigned TRANSLINE_IDENT::GetPrmsCount ( ) const
inline

◆ ReadConfig()

void TRANSLINE_IDENT::ReadConfig ( )

Definition at line 448 of file transline_ident.cpp.

449 {
450  auto cfg = static_cast<PCB_CALCULATOR_SETTINGS*>( Kiface().KifaceSettings() );
451  std::string name( m_TLine->m_Name );
452 
453  if( cfg->m_TransLine.param_values.count( name ) )
454  {
455  wxASSERT( cfg->m_TransLine.param_units.count( name ) );
456 
457  for( auto& p : m_prms_List )
458  {
459  try
460  {
461  p->m_Value = cfg->m_TransLine.param_values.at( name ).at( p->m_KeyWord );
462  p->m_UnitSelection = cfg->m_TransLine.param_units.at( name ).at( p->m_KeyWord );
463  }
464  catch( ... )
465  {}
466  }
467  }
468 }
std::vector< TRANSLINE_PRM * > m_prms_List
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
const char * m_Name
Definition: transline.h:85
const char * name
Definition: DXF_plotter.cpp:59
TRANSLINE * m_TLine

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

◆ WriteConfig()

void TRANSLINE_IDENT::WriteConfig ( )

Definition at line 471 of file transline_ident.cpp.

472 {
473  auto cfg = static_cast<PCB_CALCULATOR_SETTINGS*>( Kiface().KifaceSettings() );
474  std::string name( m_TLine->m_Name );
475 
476  for( auto& param : m_prms_List )
477  {
478  if( !std::isfinite( param->m_Value ) )
479  param->m_Value = 0;
480 
481  cfg->m_TransLine.param_values[ name ][ param->m_KeyWord ] = param->m_Value;
482  cfg->m_TransLine.param_units[ name ][ param->m_KeyWord ] = param->m_UnitSelection;
483  }
484 }
std::vector< TRANSLINE_PRM * > m_prms_List
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
const char * m_Name
Definition: transline.h:85
const char * name
Definition: DXF_plotter.cpp:59
TRANSLINE * m_TLine

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

Member Data Documentation

◆ m_HasPrmSelection

bool TRANSLINE_IDENT::m_HasPrmSelection

◆ m_Icon

wxBitmap* TRANSLINE_IDENT::m_Icon

Definition at line 98 of file transline_ident.h.

Referenced by TRANSLINE_IDENT(), and ~TRANSLINE_IDENT().

◆ m_Messages

wxArrayString TRANSLINE_IDENT::m_Messages

◆ 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 97 of file transline_ident.h.

Referenced by TRANSLINE_IDENT().


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