pcb_calculator: code rework: rename "tand" member to "m_tand" and m_name to m_Name

This commit is contained in:
jean-pierre charras 2018-06-07 15:44:20 +02:00
parent da0f956ca5
commit 51a128e323
10 changed files with 33 additions and 33 deletions

View File

@ -38,7 +38,7 @@
C_MICROSTRIP::C_MICROSTRIP() : TRANSLINE() C_MICROSTRIP::C_MICROSTRIP() : TRANSLINE()
{ {
m_name = "Coupled_MicroStrip"; m_Name = "Coupled_MicroStrip";
aux_ms = NULL; aux_ms = NULL;
// Initialize these variables mainly to avoid warnings from a static analyzer // Initialize these variables mainly to avoid warnings from a static analyzer
@ -544,11 +544,11 @@ void C_MICROSTRIP::dielectric_losses()
alpha_d_e = alpha_d_e =
( 20.0 * M_PI / ( 20.0 * M_PI /
log( 10.0 ) ) * log( 10.0 ) ) *
(m_freq / C0) * ( e_r / sqrt( e_r_eff_e_0 ) ) * ( (e_r_eff_e_0 - 1.0) / (e_r - 1.0) ) * tand; (m_freq / C0) * ( e_r / sqrt( e_r_eff_e_0 ) ) * ( (e_r_eff_e_0 - 1.0) / (e_r - 1.0) ) * m_tand;
alpha_d_o = alpha_d_o =
( 20.0 * M_PI / ( 20.0 * M_PI /
log( 10.0 ) ) * log( 10.0 ) ) *
(m_freq / C0) * ( e_r / sqrt( e_r_eff_o_0 ) ) * ( (e_r_eff_o_0 - 1.0) / (e_r - 1.0) ) * tand; (m_freq / C0) * ( e_r / sqrt( e_r_eff_o_0 ) ) * ( (e_r_eff_o_0 - 1.0) / (e_r - 1.0) ) * m_tand;
atten_dielectric_e = alpha_d_e * l; atten_dielectric_e = alpha_d_e * l;
atten_dielectric_o = alpha_d_o * l; atten_dielectric_o = alpha_d_o * l;
@ -841,7 +841,7 @@ void C_MICROSTRIP::get_c_microstrip_sub()
ht = getProperty( H_T_PRM ); ht = getProperty( H_T_PRM );
t = getProperty( T_PRM ); t = getProperty( T_PRM );
m_sigma = 1.0/getProperty( RHO_PRM ); m_sigma = 1.0/getProperty( RHO_PRM );
tand = getProperty( TAND_PRM ); m_tand = getProperty( TAND_PRM );
rough = getProperty( ROUGH_PRM ); rough = getProperty( ROUGH_PRM );
} }

View File

@ -40,7 +40,7 @@
COAX::COAX() : TRANSLINE() COAX::COAX() : TRANSLINE()
{ {
m_name = "Coax"; m_Name = "Coax";
// Initialize these variables mainly to avoid warnings from a static analyzer // Initialize these variables mainly to avoid warnings from a static analyzer
mur = 0.0; // magnetic permeability of substrate mur = 0.0; // magnetic permeability of substrate
@ -64,7 +64,7 @@ void COAX::get_coax_sub()
er = getProperty( EPSILONR_PRM ); er = getProperty( EPSILONR_PRM );
mur = getProperty( MUR_PRM ); mur = getProperty( MUR_PRM );
m_murC = getProperty( MURC_PRM ); m_murC = getProperty( MURC_PRM );
tand = getProperty( TAND_PRM ); m_tand = getProperty( TAND_PRM );
m_sigma = 1.0 / getProperty( RHO_PRM ); m_sigma = 1.0 / getProperty( RHO_PRM );
} }
@ -106,7 +106,7 @@ double COAX::alphad_coax()
{ {
double ad; double ad;
ad = (M_PI / C0) * m_freq * sqrt( er ) * tand; ad = (M_PI / C0) * m_freq * sqrt( er ) * m_tand;
ad = ad * 20.0 / log( 10.0 ); ad = ad * 20.0 / log( 10.0 );
return ad; return ad;
} }

View File

@ -34,7 +34,7 @@
COPLANAR::COPLANAR() : TRANSLINE() COPLANAR::COPLANAR() : TRANSLINE()
{ {
m_name = "CoPlanar"; m_Name = "CoPlanar";
backMetal = false; backMetal = false;
// Initialize these variables mainly to avoid warnings from a static analyzer // Initialize these variables mainly to avoid warnings from a static analyzer
@ -53,7 +53,7 @@ COPLANAR::COPLANAR() : TRANSLINE()
GROUNDEDCOPLANAR::GROUNDEDCOPLANAR() : COPLANAR() GROUNDEDCOPLANAR::GROUNDEDCOPLANAR() : COPLANAR()
{ {
m_name = "GrCoPlanar"; m_Name = "GrCoPlanar";
backMetal = true; backMetal = true;
} }
@ -70,7 +70,7 @@ void COPLANAR::getProperties()
er = getProperty( EPSILONR_PRM ); er = getProperty( EPSILONR_PRM );
m_murC = getProperty( MURC_PRM ); m_murC = getProperty( MURC_PRM );
tand = getProperty( TAND_PRM ); m_tand = getProperty( TAND_PRM );
m_sigma = 1.0 / getProperty( RHO_PRM ); m_sigma = 1.0 / getProperty( RHO_PRM );
Z0 = getProperty( Z0_PRM ); Z0 = getProperty( Z0_PRM );
ang_l = getProperty( ANG_L_PRM ); ang_l = getProperty( ANG_L_PRM );
@ -163,7 +163,7 @@ void COPLANAR::calc()
ac = ( M_PI + log( n * a ) ) / a + ( M_PI + log( n * b ) ) / b; ac = ( M_PI + log( n * a ) ) / a + ( M_PI + log( n * b ) ) / b;
} }
double ac_factor = ac / ( 4 * ZF0 * kk1 * kpk1 * (1 - k1 * k1) ); double ac_factor = ac / ( 4 * ZF0 * kk1 * kpk1 * (1 - k1 * k1) );
double ad_factor = ( er / (er - 1) ) * tand * M_PI / C0; double ad_factor = ( er / (er - 1) ) * m_tand * M_PI / C0;
// .................................................... // ....................................................

View File

@ -40,7 +40,7 @@
MICROSTRIP::MICROSTRIP() : TRANSLINE() MICROSTRIP::MICROSTRIP() : TRANSLINE()
{ {
m_name = "MicroStrip"; m_Name = "MicroStrip";
// Initialize these variables mainly to avoid warnings from a static analyzer // Initialize these variables mainly to avoid warnings from a static analyzer
h = 0.0; // height of substrate h = 0.0; // height of substrate
@ -363,7 +363,7 @@ double MICROSTRIP::dielectric_losses()
alpha_d = alpha_d =
( 20.0 * M_PI / ( 20.0 * M_PI /
log( 10.0 ) ) * log( 10.0 ) ) *
(m_freq / C0) * ( e_r / sqrt( e_r_eff_0 ) ) * ( (e_r_eff_0 - 1.0) / (e_r - 1.0) ) * tand; (m_freq / C0) * ( e_r / sqrt( e_r_eff_0 ) ) * ( (e_r_eff_0 - 1.0) / (e_r - 1.0) ) * m_tand;
return alpha_d; return alpha_d;
} }
@ -468,7 +468,7 @@ void MICROSTRIP::get_microstrip_sub()
t = getProperty( T_PRM ); t = getProperty( T_PRM );
m_sigma = 1.0 / getProperty( RHO_PRM ); m_sigma = 1.0 / getProperty( RHO_PRM );
m_murC = getProperty( MURC_PRM ); m_murC = getProperty( MURC_PRM );
tand = getProperty( TAND_PRM ); m_tand = getProperty( TAND_PRM );
rough = getProperty( ROUGH_PRM ); rough = getProperty( ROUGH_PRM );
} }

View File

@ -31,7 +31,7 @@
RECTWAVEGUIDE::RECTWAVEGUIDE() : TRANSLINE() RECTWAVEGUIDE::RECTWAVEGUIDE() : TRANSLINE()
{ {
m_name = "RectWaveGuide"; m_Name = "RectWaveGuide";
// Initialize these here variables mainly to avoid warnings from a static analyzer // Initialize these here variables mainly to avoid warnings from a static analyzer
mur = 0.0; // magnetic permeability of substrate mur = 0.0; // magnetic permeability of substrate
@ -174,7 +174,7 @@ double RECTWAVEGUIDE::alphad()
k_square = kval_square(); k_square = kval_square();
beta = sqrt( k_square - kc_square( 1, 0 ) ); beta = sqrt( k_square - kc_square( 1, 0 ) );
ad = (k_square * tand) / (2.0 * beta); ad = (k_square * m_tand) / (2.0 * beta);
ad = ad * 20.0 * log10( exp( 1. ) ); /* convert from Np/m to db/m */ ad = ad * 20.0 * log10( exp( 1. ) ); /* convert from Np/m to db/m */
return ad; return ad;
} }
@ -191,7 +191,7 @@ void RECTWAVEGUIDE::get_rectwaveguide_sub()
mur = getProperty( MUR_PRM ); mur = getProperty( MUR_PRM );
m_murC = getProperty( MURC_PRM ); m_murC = getProperty( MURC_PRM );
m_sigma = 1.0 / getProperty( RHO_PRM ); m_sigma = 1.0 / getProperty( RHO_PRM );
tand = getProperty( TAND_PRM ); m_tand = getProperty( TAND_PRM );
tanm = getProperty( TANM_PRM ); tanm = getProperty( TANM_PRM );
} }

View File

@ -2,7 +2,7 @@
* stripline.cpp - stripline class definition * stripline.cpp - stripline class definition
* *
* Copyright (C) 2011 Michael Margraf <michael.margraf@alumni.tu-berlin.de> * Copyright (C) 2011 Michael Margraf <michael.margraf@alumni.tu-berlin.de>
* Modifications 2011 for Kicad: Jean-Pierre Charras * Modifications 2018 for Kicad: Jean-Pierre Charras
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -33,7 +33,7 @@
STRIPLINE::STRIPLINE() : TRANSLINE() STRIPLINE::STRIPLINE() : TRANSLINE()
{ {
m_name = "StripLine"; m_Name = "StripLine";
// Initialize these variables mainly to avoid warnings from a static analyzer // Initialize these variables mainly to avoid warnings from a static analyzer
h = 0.0; // height of substrate h = 0.0; // height of substrate
@ -61,7 +61,7 @@ void STRIPLINE::getProperties()
er = getProperty( EPSILONR_PRM ); er = getProperty( EPSILONR_PRM );
m_murC = getProperty( MURC_PRM ); m_murC = getProperty( MURC_PRM );
tand = getProperty( TAND_PRM ); m_tand = getProperty( TAND_PRM );
m_sigma = 1.0 / getProperty( RHO_PRM ); m_sigma = 1.0 / getProperty( RHO_PRM );
Z0 = getProperty( Z0_PRM ); Z0 = getProperty( Z0_PRM );
ang_l = getProperty( ANG_L_PRM ); ang_l = getProperty( ANG_L_PRM );
@ -119,7 +119,7 @@ void STRIPLINE::calc()
( 1.0 / lineImpedance( 2.0 * a + t, ac1 ) + 1.0 / lineImpedance( 2.0 * (h - a) - t, ac2 ) ); ( 1.0 / lineImpedance( 2.0 * a + t, ac1 ) + 1.0 / lineImpedance( 2.0 * (h - a) - t, ac2 ) );
atten_cond = len * 0.5 * (ac1 + ac2); atten_cond = len * 0.5 * (ac1 + ac2);
atten_dielectric = 20.0 / log( 10.0 ) * len * (M_PI / C0) * m_freq * sqrt( er ) * tand; atten_dielectric = 20.0 / log( 10.0 ) * len * (M_PI / C0) * m_freq * sqrt( er ) * m_tand;
ang_l = 2.0* M_PI* len* sqrt( er ) * m_freq / C0; // in radians ang_l = 2.0* M_PI* len* sqrt( er ) * m_freq / C0; // in radians
} }

View File

@ -2,7 +2,7 @@
* TRANSLINE.cpp - base for a transmission line implementation * TRANSLINE.cpp - base for a transmission line implementation
* *
* Copyright (C) 2005 Stefan Jahn <stefan@lkcc.org> * Copyright (C) 2005 Stefan Jahn <stefan@lkcc.org>
* Modified for Kicad: 2011 jean-pierre.charras * Modified for Kicad: 2018 jean-pierre.charras
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -62,13 +62,13 @@ bool IsSelectedInDialog( enum PRMS_ID aPrmId );
TRANSLINE::TRANSLINE() TRANSLINE::TRANSLINE()
{ {
m_murC = 1.0; m_murC = 1.0;
m_name = (const char*) 0; m_Name = nullptr;
// Initialize these variables mainly to avoid warnings from a static analyzer // Initialize these variables mainly to avoid warnings from a static analyzer
m_freq = 0.0; // Frequency of operation m_freq = 0.0; // Frequency of operation
er = 0.0; // dielectric constant er = 0.0; // dielectric constant
tand = 0.0; // Dielectric Loss Tangent m_tand = 0.0; // Dielectric Loss Tangent
m_sigma = 0.0; // Conductivity of the metal m_sigma = 0.0; // Conductivity of the metal
m_skindepth = 0.0; // Skin depth m_skindepth = 0.0; // Skin depth
} }

View File

@ -61,7 +61,7 @@ class TRANSLINE
public: TRANSLINE(); public: TRANSLINE();
virtual ~TRANSLINE(); virtual ~TRANSLINE();
const char *m_name; const char *m_Name;
void setProperty( enum PRMS_ID aPrmId, double aValue); void setProperty( enum PRMS_ID aPrmId, double aValue);
double getProperty( enum PRMS_ID aPrmId ); double getProperty( enum PRMS_ID aPrmId );
void setResult( int, double, const char* ); void setResult( int, double, const char* );
@ -74,9 +74,9 @@ public: TRANSLINE();
protected: protected:
double m_freq; // Frequency of operation double m_freq; // Frequency of operation
double er; /* dielectric constant */ double er; /* dielectric constant */
double tand; /* Dielectric Loss Tangent */ double m_tand; // Dielectric Loss Tangent
double m_sigma; // Conductivity of the metal double m_sigma; // Conductivity of the metal
double m_murC; /* magnetic permeability of conductor */ double m_murC; // magnetic permeability of conductor
double m_skindepth; // Skin depth double m_skindepth; // Skin depth
double skin_depth(); double skin_depth();

View File

@ -33,7 +33,7 @@
TWISTEDPAIR::TWISTEDPAIR() : TRANSLINE() TWISTEDPAIR::TWISTEDPAIR() : TRANSLINE()
{ {
m_name = "TwistedPair"; m_Name = "TwistedPair";
// Initialize these variables mainly to avoid warnings from a static analyzer // Initialize these variables mainly to avoid warnings from a static analyzer
din = 0.0; // Inner diameter of conductor din = 0.0; // Inner diameter of conductor
@ -59,7 +59,7 @@ void TWISTEDPAIR::getProperties()
er = getProperty( EPSILONR_PRM ); er = getProperty( EPSILONR_PRM );
m_murC = getProperty( MURC_PRM ); m_murC = getProperty( MURC_PRM );
tand = getProperty( TAND_PRM ); m_tand = getProperty( TAND_PRM );
m_sigma = 1.0 / getProperty( RHO_PRM ); m_sigma = 1.0 / getProperty( RHO_PRM );
twists = getProperty( TWISTEDPAIR_TWIST_PRM ); twists = getProperty( TWISTEDPAIR_TWIST_PRM );
er_env = getProperty( TWISTEDPAIR_EPSILONR_ENV_PRM ); er_env = getProperty( TWISTEDPAIR_EPSILONR_ENV_PRM );
@ -80,7 +80,7 @@ void TWISTEDPAIR::calc()
atten_cond = 10.0 / log( 10.0 ) * len / m_skindepth / m_sigma / M_PI / Z0 / (din - m_skindepth); atten_cond = 10.0 / log( 10.0 ) * len / m_skindepth / m_sigma / M_PI / Z0 / (din - m_skindepth);
atten_dielectric = 20.0 / log( 10.0 ) * len * M_PI / C0* m_freq * sqrt( er_eff ) * tand; atten_dielectric = 20.0 / log( 10.0 ) * len * M_PI / C0* m_freq * sqrt( er_eff ) * m_tand;
ang_l = 2.0* M_PI* len* sqrt( er_eff ) * m_freq / C0; // in radians ang_l = 2.0* M_PI* len* sqrt( er_eff ) * m_freq / C0; // in radians
} }

View File

@ -446,7 +446,7 @@ TRANSLINE_IDENT::~TRANSLINE_IDENT()
void TRANSLINE_IDENT::ReadConfig( wxConfigBase* aConfig ) void TRANSLINE_IDENT::ReadConfig( wxConfigBase* aConfig )
{ {
wxString text = wxString::FromUTF8( m_TLine->m_name ); wxString text = wxString::FromUTF8( m_TLine->m_Name );
aConfig->SetPath( text ); aConfig->SetPath( text );
for( unsigned ii = 0; ii < m_prms_List.size(); ii++ ) for( unsigned ii = 0; ii < m_prms_List.size(); ii++ )
m_prms_List[ii]->ReadConfig( aConfig ); m_prms_List[ii]->ReadConfig( aConfig );
@ -457,7 +457,7 @@ void TRANSLINE_IDENT::ReadConfig( wxConfigBase* aConfig )
void TRANSLINE_IDENT::WriteConfig( wxConfigBase* aConfig ) void TRANSLINE_IDENT::WriteConfig( wxConfigBase* aConfig )
{ {
wxString text = wxString::FromUTF8( m_TLine->m_name ); wxString text = wxString::FromUTF8( m_TLine->m_Name );
aConfig->SetPath( text ); aConfig->SetPath( text );
for( unsigned ii = 0; ii < m_prms_List.size(); ii++ ) for( unsigned ii = 0; ii < m_prms_List.size(); ii++ )
m_prms_List[ii]->WriteConfig( aConfig ); m_prms_List[ii]->WriteConfig( aConfig );