From 51a128e32358912e6a08836283b8204daba96e2c Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 7 Jun 2018 15:44:20 +0200 Subject: [PATCH] pcb_calculator: code rework: rename "tand" member to "m_tand" and m_name to m_Name --- pcb_calculator/transline/c_microstrip.cpp | 8 ++++---- pcb_calculator/transline/coax.cpp | 6 +++--- pcb_calculator/transline/coplanar.cpp | 8 ++++---- pcb_calculator/transline/microstrip.cpp | 6 +++--- pcb_calculator/transline/rectwaveguide.cpp | 6 +++--- pcb_calculator/transline/stripline.cpp | 8 ++++---- pcb_calculator/transline/transline.cpp | 8 ++++---- pcb_calculator/transline/transline.h | 6 +++--- pcb_calculator/transline/twistedpair.cpp | 6 +++--- pcb_calculator/transline_ident.cpp | 4 ++-- 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/pcb_calculator/transline/c_microstrip.cpp b/pcb_calculator/transline/c_microstrip.cpp index 86b84280fa..9841322270 100644 --- a/pcb_calculator/transline/c_microstrip.cpp +++ b/pcb_calculator/transline/c_microstrip.cpp @@ -38,7 +38,7 @@ C_MICROSTRIP::C_MICROSTRIP() : TRANSLINE() { - m_name = "Coupled_MicroStrip"; + m_Name = "Coupled_MicroStrip"; aux_ms = NULL; // Initialize these variables mainly to avoid warnings from a static analyzer @@ -544,11 +544,11 @@ void C_MICROSTRIP::dielectric_losses() alpha_d_e = ( 20.0 * M_PI / 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 = ( 20.0 * M_PI / 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_o = alpha_d_o * l; @@ -841,7 +841,7 @@ void C_MICROSTRIP::get_c_microstrip_sub() ht = getProperty( H_T_PRM ); t = getProperty( T_PRM ); m_sigma = 1.0/getProperty( RHO_PRM ); - tand = getProperty( TAND_PRM ); + m_tand = getProperty( TAND_PRM ); rough = getProperty( ROUGH_PRM ); } diff --git a/pcb_calculator/transline/coax.cpp b/pcb_calculator/transline/coax.cpp index f369a020fa..626753d1ff 100644 --- a/pcb_calculator/transline/coax.cpp +++ b/pcb_calculator/transline/coax.cpp @@ -40,7 +40,7 @@ COAX::COAX() : TRANSLINE() { - m_name = "Coax"; + m_Name = "Coax"; // Initialize these variables mainly to avoid warnings from a static analyzer mur = 0.0; // magnetic permeability of substrate @@ -64,7 +64,7 @@ void COAX::get_coax_sub() er = getProperty( EPSILONR_PRM ); mur = getProperty( MUR_PRM ); m_murC = getProperty( MURC_PRM ); - tand = getProperty( TAND_PRM ); + m_tand = getProperty( TAND_PRM ); m_sigma = 1.0 / getProperty( RHO_PRM ); } @@ -106,7 +106,7 @@ double COAX::alphad_coax() { 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 ); return ad; } diff --git a/pcb_calculator/transline/coplanar.cpp b/pcb_calculator/transline/coplanar.cpp index 2c435851e2..4dc9746901 100644 --- a/pcb_calculator/transline/coplanar.cpp +++ b/pcb_calculator/transline/coplanar.cpp @@ -34,7 +34,7 @@ COPLANAR::COPLANAR() : TRANSLINE() { - m_name = "CoPlanar"; + m_Name = "CoPlanar"; backMetal = false; // Initialize these variables mainly to avoid warnings from a static analyzer @@ -53,7 +53,7 @@ COPLANAR::COPLANAR() : TRANSLINE() GROUNDEDCOPLANAR::GROUNDEDCOPLANAR() : COPLANAR() { - m_name = "GrCoPlanar"; + m_Name = "GrCoPlanar"; backMetal = true; } @@ -70,7 +70,7 @@ void COPLANAR::getProperties() er = getProperty( EPSILONR_PRM ); m_murC = getProperty( MURC_PRM ); - tand = getProperty( TAND_PRM ); + m_tand = getProperty( TAND_PRM ); m_sigma = 1.0 / getProperty( RHO_PRM ); Z0 = getProperty( Z0_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; } 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; // .................................................... diff --git a/pcb_calculator/transline/microstrip.cpp b/pcb_calculator/transline/microstrip.cpp index 785afd34c1..2bd81fe525 100644 --- a/pcb_calculator/transline/microstrip.cpp +++ b/pcb_calculator/transline/microstrip.cpp @@ -40,7 +40,7 @@ MICROSTRIP::MICROSTRIP() : TRANSLINE() { - m_name = "MicroStrip"; + m_Name = "MicroStrip"; // Initialize these variables mainly to avoid warnings from a static analyzer h = 0.0; // height of substrate @@ -363,7 +363,7 @@ double MICROSTRIP::dielectric_losses() alpha_d = ( 20.0 * M_PI / 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; } @@ -468,7 +468,7 @@ void MICROSTRIP::get_microstrip_sub() t = getProperty( T_PRM ); m_sigma = 1.0 / getProperty( RHO_PRM ); m_murC = getProperty( MURC_PRM ); - tand = getProperty( TAND_PRM ); + m_tand = getProperty( TAND_PRM ); rough = getProperty( ROUGH_PRM ); } diff --git a/pcb_calculator/transline/rectwaveguide.cpp b/pcb_calculator/transline/rectwaveguide.cpp index d48a78fe96..6965991b80 100644 --- a/pcb_calculator/transline/rectwaveguide.cpp +++ b/pcb_calculator/transline/rectwaveguide.cpp @@ -31,7 +31,7 @@ RECTWAVEGUIDE::RECTWAVEGUIDE() : TRANSLINE() { - m_name = "RectWaveGuide"; + m_Name = "RectWaveGuide"; // Initialize these here variables mainly to avoid warnings from a static analyzer mur = 0.0; // magnetic permeability of substrate @@ -174,7 +174,7 @@ double RECTWAVEGUIDE::alphad() k_square = kval_square(); 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 */ return ad; } @@ -191,7 +191,7 @@ void RECTWAVEGUIDE::get_rectwaveguide_sub() mur = getProperty( MUR_PRM ); m_murC = getProperty( MURC_PRM ); m_sigma = 1.0 / getProperty( RHO_PRM ); - tand = getProperty( TAND_PRM ); + m_tand = getProperty( TAND_PRM ); tanm = getProperty( TANM_PRM ); } diff --git a/pcb_calculator/transline/stripline.cpp b/pcb_calculator/transline/stripline.cpp index 2312d954be..5ff0bbeb5b 100644 --- a/pcb_calculator/transline/stripline.cpp +++ b/pcb_calculator/transline/stripline.cpp @@ -2,7 +2,7 @@ * stripline.cpp - stripline class definition * * Copyright (C) 2011 Michael Margraf - * 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 * it under the terms of the GNU General Public License as published by @@ -33,7 +33,7 @@ STRIPLINE::STRIPLINE() : TRANSLINE() { - m_name = "StripLine"; + m_Name = "StripLine"; // Initialize these variables mainly to avoid warnings from a static analyzer h = 0.0; // height of substrate @@ -61,7 +61,7 @@ void STRIPLINE::getProperties() er = getProperty( EPSILONR_PRM ); m_murC = getProperty( MURC_PRM ); - tand = getProperty( TAND_PRM ); + m_tand = getProperty( TAND_PRM ); m_sigma = 1.0 / getProperty( RHO_PRM ); Z0 = getProperty( Z0_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 ) ); 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 } diff --git a/pcb_calculator/transline/transline.cpp b/pcb_calculator/transline/transline.cpp index 1ba089eebb..c754f32deb 100644 --- a/pcb_calculator/transline/transline.cpp +++ b/pcb_calculator/transline/transline.cpp @@ -2,7 +2,7 @@ * TRANSLINE.cpp - base for a transmission line implementation * * Copyright (C) 2005 Stefan Jahn - * 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 * modify it under the terms of the GNU General Public License @@ -62,13 +62,13 @@ bool IsSelectedInDialog( enum PRMS_ID aPrmId ); TRANSLINE::TRANSLINE() { m_murC = 1.0; - m_name = (const char*) 0; + m_Name = nullptr; // Initialize these variables mainly to avoid warnings from a static analyzer m_freq = 0.0; // Frequency of operation er = 0.0; // dielectric constant - tand = 0.0; // Dielectric Loss Tangent - m_sigma = 0.0; // Conductivity of the metal + m_tand = 0.0; // Dielectric Loss Tangent + m_sigma = 0.0; // Conductivity of the metal m_skindepth = 0.0; // Skin depth } diff --git a/pcb_calculator/transline/transline.h b/pcb_calculator/transline/transline.h index a636fce5cd..ef5ab422cb 100644 --- a/pcb_calculator/transline/transline.h +++ b/pcb_calculator/transline/transline.h @@ -61,7 +61,7 @@ class TRANSLINE public: TRANSLINE(); virtual ~TRANSLINE(); - const char *m_name; + const char *m_Name; void setProperty( enum PRMS_ID aPrmId, double aValue); double getProperty( enum PRMS_ID aPrmId ); void setResult( int, double, const char* ); @@ -74,9 +74,9 @@ public: TRANSLINE(); protected: double m_freq; // Frequency of operation double er; /* dielectric constant */ - double tand; /* Dielectric Loss Tangent */ + double m_tand; // Dielectric Loss Tangent 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 skin_depth(); diff --git a/pcb_calculator/transline/twistedpair.cpp b/pcb_calculator/transline/twistedpair.cpp index f56fb89aa9..ab41eb5cb0 100644 --- a/pcb_calculator/transline/twistedpair.cpp +++ b/pcb_calculator/transline/twistedpair.cpp @@ -33,7 +33,7 @@ TWISTEDPAIR::TWISTEDPAIR() : TRANSLINE() { - m_name = "TwistedPair"; + m_Name = "TwistedPair"; // Initialize these variables mainly to avoid warnings from a static analyzer din = 0.0; // Inner diameter of conductor @@ -59,7 +59,7 @@ void TWISTEDPAIR::getProperties() er = getProperty( EPSILONR_PRM ); m_murC = getProperty( MURC_PRM ); - tand = getProperty( TAND_PRM ); + m_tand = getProperty( TAND_PRM ); m_sigma = 1.0 / getProperty( RHO_PRM ); twists = getProperty( TWISTEDPAIR_TWIST_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_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 } diff --git a/pcb_calculator/transline_ident.cpp b/pcb_calculator/transline_ident.cpp index 1e81706b73..d93c7ed257 100644 --- a/pcb_calculator/transline_ident.cpp +++ b/pcb_calculator/transline_ident.cpp @@ -446,7 +446,7 @@ TRANSLINE_IDENT::~TRANSLINE_IDENT() 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 ); for( unsigned ii = 0; ii < m_prms_List.size(); ii++ ) m_prms_List[ii]->ReadConfig( aConfig ); @@ -457,7 +457,7 @@ void TRANSLINE_IDENT::ReadConfig( 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 ); for( unsigned ii = 0; ii < m_prms_List.size(); ii++ ) m_prms_List[ii]->WriteConfig( aConfig );