pcb_calculator: code rework: rename "sigma" member by "m_sigma", and "skindepth" by "m_skindepth"

This commit is contained in:
jean-pierre charras 2018-06-07 15:30:35 +02:00
parent 884dc1c3e8
commit 77477e4f10
9 changed files with 33 additions and 33 deletions

View File

@ -497,14 +497,14 @@ void C_MICROSTRIP::conductor_losses()
e_r_eff_o_0 = er_eff_o_0;
Z0_h_e = Z0_e_0 * sqrt( e_r_eff_e_0 ); /* homogeneous stripline impedance */
Z0_h_o = Z0_o_0 * sqrt( e_r_eff_o_0 ); /* homogeneous stripline impedance */
delta = skindepth;
delta = m_skindepth;
if( m_freq > 0.0 )
{
/* current distribution factor (same for the two modes) */
K = exp( -1.2 * pow( (Z0_h_e + Z0_h_o) / (2.0 * ZF0), 0.7 ) );
/* skin resistance */
R_s = 1.0 / (sigma * delta);
R_s = 1.0 / (m_sigma * delta);
/* correction for surface roughness */
R_s *= 1.0 + ( (2.0 / M_PI) * atan( 1.40 * pow( (rough / delta), 2.0 ) ) );
@ -561,7 +561,7 @@ void C_MICROSTRIP::dielectric_losses()
*/
void C_MICROSTRIP::attenuation()
{
skindepth = skin_depth();
m_skindepth = skin_depth();
conductor_losses();
dielectric_losses();
}
@ -840,7 +840,7 @@ void C_MICROSTRIP::get_c_microstrip_sub()
h = getProperty( H_PRM );
ht = getProperty( H_T_PRM );
t = getProperty( T_PRM );
sigma = 1.0/getProperty( RHO_PRM );
m_sigma = 1.0/getProperty( RHO_PRM );
tand = getProperty( TAND_PRM );
rough = getProperty( ROUGH_PRM );
}
@ -897,7 +897,7 @@ void C_MICROSTRIP::show_results()
setResult( 4, atten_dielectric_e, "dB" );
setResult( 5, atten_dielectric_o, "dB" );
setResult( 6, skindepth / UNIT_MICRON, "µm" );
setResult( 6, m_skindepth / UNIT_MICRON, "µm" );
}

View File

@ -65,7 +65,7 @@ void COAX::get_coax_sub()
mur = getProperty( MUR_PRM );
murC = getProperty( MURC_PRM );
tand = getProperty( TAND_PRM );
sigma = 1.0 / getProperty( RHO_PRM );
m_sigma = 1.0 / getProperty( RHO_PRM );
}
@ -116,7 +116,7 @@ double COAX::alphac_coax()
{
double ac, Rs;
Rs = sqrt( M_PI * m_freq * murC * MU0 / sigma );
Rs = sqrt( M_PI * m_freq * murC * MU0 / m_sigma );
ac = sqrt( er ) * ( ( (1 / din) + (1 / dout) ) / log( dout / din ) ) * (Rs / ZF0);
ac = ac * 20.0 / log( 10.0 );
return ac;

View File

@ -71,7 +71,7 @@ void COPLANAR::getProperties()
er = getProperty( EPSILONR_PRM );
murC = getProperty( MURC_PRM );
tand = getProperty( TAND_PRM );
sigma = 1.0 / getProperty( RHO_PRM );
m_sigma = 1.0 / getProperty( RHO_PRM );
Z0 = getProperty( Z0_PRM );
ang_l = getProperty( ANG_L_PRM );
}
@ -80,7 +80,7 @@ void COPLANAR::getProperties()
// -------------------------------------------------------------------
void COPLANAR::calc()
{
skindepth = skin_depth();
m_skindepth = skin_depth();
// other local variables (quasi-static constants)
double k1, kk1, kpk1, k2, k3, q1, q2, q3 = 0, qz, er0 = 0;
@ -175,7 +175,7 @@ void COPLANAR::calc()
// for now, the loss are limited to strip losses (no radiation
// losses yet) losses in neper/length
atten_cond = 20.0 / log( 10.0 ) * len
* ac_factor * sr_er0 * sqrt( M_PI * MU0 * m_freq / sigma );
* ac_factor * sr_er0 * sqrt( M_PI * MU0 * m_freq / m_sigma );
atten_dielectric = 20.0 / log( 10.0 ) * len
* ad_factor * m_freq * (sr_er_f * sr_er_f - 1) / sr_er_f;
@ -196,7 +196,7 @@ void COPLANAR::show_results()
setResult( 1, atten_cond, "dB" );
setResult( 2, atten_dielectric, "dB" );
setResult( 3, skindepth / UNIT_MICRON, "µm" );
setResult( 3, m_skindepth / UNIT_MICRON, "µm" );
}

View File

@ -4,7 +4,7 @@
* Copyright (C) 2001 Gopal Narayanan <gopal@astro.umass.edu>
* Copyright (C) 2002 Claudio Girardi <claudio.girardi@ieee.org>
* Copyright (C) 2005, 2006 Stefan Jahn <stefan@lkcc.org>
* Modified for Kicad: 2015 Jean-Pierre Charras <jp.charras at wanadoo.fr>
* Modified for Kicad: 2018 Jean-Pierre Charras <jp.charras at wanadoo.fr>
*
* 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
@ -324,14 +324,14 @@ double MICROSTRIP::conductor_losses()
double K, R_s, Q_c, alpha_c;
e_r_eff_0 = er_eff_0;
delta = skindepth;
delta = m_skindepth;
if( m_freq > 0.0 )
{
/* current distribution factor */
K = exp( -1.2 * pow( Z0_h_1 / ZF0, 0.7 ) );
/* skin resistance */
R_s = 1.0 / (sigma * delta);
R_s = 1.0 / (m_sigma * delta);
/* correction for surface roughness */
R_s *= 1.0 + ( (2.0 / M_PI) * atan( 1.40 * pow( (rough / delta), 2.0 ) ) );
@ -374,7 +374,7 @@ double MICROSTRIP::dielectric_losses()
*/
void MICROSTRIP::attenuation()
{
skindepth = skin_depth();
m_skindepth = skin_depth();
atten_cond = conductor_losses() * l;
atten_dielectric = dielectric_losses() * l;
@ -466,7 +466,7 @@ void MICROSTRIP::get_microstrip_sub()
h = getProperty( H_PRM );
ht = getProperty( H_T_PRM );
t = getProperty( T_PRM );
sigma = 1.0 / getProperty( RHO_PRM );
m_sigma = 1.0 / getProperty( RHO_PRM );
murC = getProperty( MURC_PRM );
tand = getProperty( TAND_PRM );
rough = getProperty( ROUGH_PRM );
@ -514,7 +514,7 @@ void MICROSTRIP::show_results()
setResult( 1, atten_cond, "dB" );
setResult( 2, atten_dielectric, "dB" );
setResult( 3, skindepth/UNIT_MICRON, "µm" );
setResult( 3, m_skindepth/UNIT_MICRON, "µm" );
}

View File

@ -93,7 +93,7 @@ double RECTWAVEGUIDE::alphac()
double ac;
short m, n, mmax, nmax;
Rs = sqrt( M_PI * m_freq * murC * MU0 / sigma );
Rs = sqrt( M_PI * m_freq * murC * MU0 / m_sigma );
ac = 0.0;
mmax = (int) floor( m_freq / fc( 1, 0 ) );
nmax = mmax;
@ -190,7 +190,7 @@ void RECTWAVEGUIDE::get_rectwaveguide_sub()
er = getProperty( EPSILONR_PRM );
mur = getProperty( MUR_PRM );
murC = getProperty( MURC_PRM );
sigma = 1.0 / getProperty( RHO_PRM );
m_sigma = 1.0 / getProperty( RHO_PRM );
tand = getProperty( TAND_PRM );
tanm = getProperty( TANM_PRM );
}

View File

@ -62,7 +62,7 @@ void STRIPLINE::getProperties()
er = getProperty( EPSILONR_PRM );
murC = getProperty( MURC_PRM );
tand = getProperty( TAND_PRM );
sigma = 1.0 / getProperty( RHO_PRM );
m_sigma = 1.0 / getProperty( RHO_PRM );
Z0 = getProperty( Z0_PRM );
ang_l = getProperty( ANG_L_PRM );
}
@ -75,7 +75,7 @@ double STRIPLINE::lineImpedance( double height, double& ac )
double ZL;
double hmt = height - t;
ac = sqrt( m_freq / sigma / 17.2 );
ac = sqrt( m_freq / m_sigma / 17.2 );
if( w / hmt >= 0.35 )
{
ZL = w +
@ -110,7 +110,7 @@ double STRIPLINE::lineImpedance( double height, double& ac )
// -------------------------------------------------------------------
void STRIPLINE::calc()
{
skindepth = skin_depth();
m_skindepth = skin_depth();
er_eff = er; // no dispersion
@ -135,7 +135,7 @@ void STRIPLINE::show_results()
setResult( 1, atten_cond, "dB" );
setResult( 2, atten_dielectric, "dB" );
setResult( 3, skindepth / UNIT_MICRON, "µm" );
setResult( 3, m_skindepth / UNIT_MICRON, "µm" );
}

View File

@ -68,8 +68,8 @@ TRANSLINE::TRANSLINE()
m_freq = 0.0; // Frequency of operation
er = 0.0; // dielectric constant
tand = 0.0; // Dielectric Loss Tangent
sigma = 0.0; // Conductivity of the metal
skindepth = 0.0; // Skin depth
m_sigma = 0.0; // Conductivity of the metal
m_skindepth = 0.0; // Skin depth
}
@ -122,7 +122,7 @@ double TRANSLINE::getProperty( enum PRMS_ID aPrmId )
double TRANSLINE::skin_depth()
{
double depth;
depth = 1.0 / sqrt( M_PI * m_freq * murC * MU0 * sigma );
depth = 1.0 / sqrt( M_PI * m_freq * murC * MU0 * m_sigma );
return depth;
}

View File

@ -2,7 +2,7 @@
* transline.h - base for a transmission line class definition
*
* Copyright (C) 2005 Stefan Jahn <stefan@lkcc.org>
* 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
@ -75,9 +75,9 @@ protected:
double m_freq; // Frequency of operation
double er; /* dielectric constant */
double tand; /* Dielectric Loss Tangent */
double sigma; /* Conductivity of the metal */
double m_sigma; // Conductivity of the metal
double murC; /* magnetic permeability of conductor */
double skindepth; /* Skin depth */
double m_skindepth; // Skin depth
double skin_depth();
void ellipke( double, double&, double& );

View File

@ -60,7 +60,7 @@ void TWISTEDPAIR::getProperties()
er = getProperty( EPSILONR_PRM );
murC = getProperty( MURC_PRM );
tand = getProperty( TAND_PRM );
sigma = 1.0 / getProperty( RHO_PRM );
m_sigma = 1.0 / getProperty( RHO_PRM );
twists = getProperty( TWISTEDPAIR_TWIST_PRM );
er_env = getProperty( TWISTEDPAIR_EPSILONR_ENV_PRM );
Z0 = getProperty( Z0_PRM );
@ -71,14 +71,14 @@ void TWISTEDPAIR::getProperties()
// -------------------------------------------------------------------
void TWISTEDPAIR::calc()
{
skindepth = skin_depth();
m_skindepth = skin_depth();
double tw = atan( twists * M_PI * dout ); // pitch angle
er_eff = er_env + (0.25 + 0.0007 * tw * tw) * (er - er_env);
Z0 = ZF0 / M_PI / sqrt( er_eff ) * acosh( dout / din );
atten_cond = 10.0 / log( 10.0 ) * len / skindepth / sigma / M_PI / Z0 / (din - 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;
@ -96,7 +96,7 @@ void TWISTEDPAIR::show_results()
setResult( 1, atten_cond, "dB" );
setResult( 2, atten_dielectric, "dB" );
setResult( 3, skindepth / UNIT_MICRON, "µm" );
setResult( 3, m_skindepth / UNIT_MICRON, "µm" );
}