pcb_calculator: code rework: rename "f" member by "m_freq"

This commit is contained in:
jean-pierre charras 2018-06-07 15:18:56 +02:00
parent 51473d9a30
commit 884dc1c3e8
9 changed files with 103 additions and 79 deletions

View File

@ -162,7 +162,7 @@ void C_MICROSTRIP::compute_single_line()
//aux_ms->t = t;
aux_ms->ht = 1e12; /* arbitrarily high */
aux_ms->f = f;
aux_ms->m_freq = m_freq;
aux_ms->murC = murC;
aux_ms->microstrip_Z0();
aux_ms->dispersion();
@ -450,7 +450,7 @@ void C_MICROSTRIP::er_eff_freq()
g = s / h; /* normalize line spacing */
/* normalized frequency [GHz * mm] */
f_n = f * h / 1e06;
f_n = m_freq * h / 1e06;
er_eff = er_eff_e_0;
P_1 = 0.27488 + ( 0.6315 + 0.525 / pow( 1.0 + 0.0157 * f_n, 20.0 ) ) * u - 0.065683 * exp(
@ -499,7 +499,7 @@ void C_MICROSTRIP::conductor_losses()
Z0_h_o = Z0_o_0 * sqrt( e_r_eff_o_0 ); /* homogeneous stripline impedance */
delta = skindepth;
if( f > 0.0 )
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 ) );
@ -509,14 +509,14 @@ void C_MICROSTRIP::conductor_losses()
R_s *= 1.0 + ( (2.0 / M_PI) * atan( 1.40 * pow( (rough / delta), 2.0 ) ) );
/* even-mode strip inductive quality factor */
Q_c_e = (M_PI * Z0_h_e * w * f) / (R_s * C0 * K);
Q_c_e = (M_PI * Z0_h_e * w * m_freq) / (R_s * C0 * K);
/* even-mode losses per unith length */
alpha_c_e = ( 20.0 * M_PI / log( 10.0 ) ) * f * sqrt( e_r_eff_e_0 ) / (C0 * Q_c_e);
alpha_c_e = ( 20.0 * M_PI / log( 10.0 ) ) * m_freq * sqrt( e_r_eff_e_0 ) / (C0 * Q_c_e);
/* odd-mode strip inductive quality factor */
Q_c_o = (M_PI * Z0_h_o * w * f) / (R_s * C0 * K);
Q_c_o = (M_PI * Z0_h_o * w * m_freq) / (R_s * C0 * K);
/* odd-mode losses per unith length */
alpha_c_o = ( 20.0 * M_PI / log( 10.0 ) ) * f * sqrt( e_r_eff_o_0 ) / (C0 * Q_c_o);
alpha_c_o = ( 20.0 * M_PI / log( 10.0 ) ) * m_freq * sqrt( e_r_eff_o_0 ) / (C0 * Q_c_o);
}
else
{
@ -544,11 +544,11 @@ void C_MICROSTRIP::dielectric_losses()
alpha_d_e =
( 20.0 * M_PI /
log( 10.0 ) ) *
(f / 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) ) * tand;
alpha_d_o =
( 20.0 * M_PI /
log( 10.0 ) ) *
(f / 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) ) * tand;
atten_dielectric_e = alpha_d_e * l;
atten_dielectric_o = alpha_d_o * l;
@ -583,9 +583,9 @@ void C_MICROSTRIP::line_angle()
/* odd-mode velocity */
v_o = C0 / sqrt( e_r_eff_o );
/* even-mode wavelength */
lambda_g_e = v_e / f;
lambda_g_e = v_e / m_freq;
/* odd-mode wavelength */
lambda_g_o = v_o / f;
lambda_g_o = v_o / m_freq;
/* electrical angles */
ang_l_e = 2.0 * M_PI * l / lambda_g_e; /* in radians */
ang_l_o = 2.0 * M_PI * l / lambda_g_o; /* in radians */
@ -717,7 +717,7 @@ void C_MICROSTRIP::Z0_dispersion()
g = s / h; /* normalize line spacing */
/* normalized frequency [GHz * mm] */
f_n = f * h / 1e06;
f_n = m_freq * h / 1e06;
e_r_eff_single_f = aux_ms->er_eff;
e_r_eff_single_0 = aux_ms->er_eff_0;
@ -853,7 +853,7 @@ void C_MICROSTRIP::get_c_microstrip_sub()
*/
void C_MICROSTRIP::get_c_microstrip_comp()
{
f = getProperty( FREQUENCY_PRM );
m_freq = getProperty( FREQUENCY_PRM );
}
@ -1006,8 +1006,8 @@ void C_MICROSTRIP::synthesize()
/* calculate physical length */
ang_l_e = getProperty( ANG_L_PRM );
ang_l_o = getProperty( ANG_L_PRM );
le = C0 / f / sqrt( er_eff_e ) * ang_l_e / 2.0 / M_PI;
lo = C0 / f / sqrt( er_eff_o ) * ang_l_o / 2.0 / M_PI;
le = C0 / m_freq / sqrt( er_eff_e ) * ang_l_e / 2.0 / M_PI;
lo = C0 / m_freq / sqrt( er_eff_o ) * ang_l_o / 2.0 / M_PI;
l = sqrt( le * lo );
setProperty( PHYS_LEN_PRM, l );

View File

@ -75,7 +75,7 @@ void COAX::get_coax_sub()
*/
void COAX::get_coax_comp()
{
f = getProperty( FREQUENCY_PRM );
m_freq = getProperty( FREQUENCY_PRM );
}
@ -106,7 +106,7 @@ double COAX::alphad_coax()
{
double ad;
ad = (M_PI / C0) * f * sqrt( er ) * tand;
ad = (M_PI / C0) * m_freq * sqrt( er ) * tand;
ad = ad * 20.0 / log( 10.0 );
return ad;
}
@ -116,7 +116,7 @@ double COAX::alphac_coax()
{
double ac, Rs;
Rs = sqrt( M_PI * f * murC * MU0 / sigma );
Rs = sqrt( M_PI * m_freq * murC * MU0 / sigma );
ac = sqrt( er ) * ( ( (1 / din) + (1 / dout) ) / log( dout / din ) ) * (Rs / ZF0);
ac = ac * 20.0 / log( 10.0 );
return ac;
@ -144,7 +144,7 @@ void COAX::analyze()
Z0 = ( ZF0 / 2 / M_PI / sqrt( er ) ) * log( dout / din );
}
lambda_g = ( C0 / (f) ) / sqrt( er * mur );
lambda_g = ( C0 / (m_freq) ) / sqrt( er * mur );
/* calculate electrical angle */
ang_l = (2.0 * M_PI * l) / lambda_g; /* in radians */
@ -187,7 +187,7 @@ void COAX::synthesize()
setProperty( PHYS_DIAM_OUT_PRM, dout );
}
lambda_g = ( C0 / (f) ) / sqrt( er * mur );
lambda_g = ( C0 / (m_freq) ) / sqrt( er * mur );
/* calculate physical length */
l = (lambda_g * ang_l) / (2.0 * M_PI); /* in m */
setProperty( PHYS_LEN_PRM, l );
@ -213,14 +213,14 @@ void COAX::show_results()
n = 1;
fc = C0 / (M_PI * (dout + din) / (double) n);
if( fc > f )
if( fc > m_freq )
strcpy( text, "none" );
else
{
strcpy( text, "H(1,1) " );
m = 2;
fc = C0 / ( 2 * (dout - din) / (double) (m - 1) );
while( (fc <= f) && (m<10) )
while( (fc <= m_freq) && ( m < 10 ) )
{
sprintf( txt, "H(n,%d) ", m );
strcat( text, txt );
@ -232,12 +232,12 @@ void COAX::show_results()
m = 1;
fc = C0 / (2 * (dout - din) / (double) m);
if( fc > f )
if( fc > m_freq )
strcpy( text, "none" );
else
{
strcpy( text, "" );
while( (fc <= f) && (m<10) )
while( (fc <= m_freq) && ( m < 10 ) )
{
sprintf( txt, "E(n,%d) ", m );
strcat( text, txt );

View File

@ -61,7 +61,7 @@ GROUNDEDCOPLANAR::GROUNDEDCOPLANAR() : COPLANAR()
// -------------------------------------------------------------------
void COPLANAR::getProperties()
{
f = getProperty( FREQUENCY_PRM );
m_freq = getProperty( FREQUENCY_PRM );
w = getProperty( PHYS_WIDTH_PRM );
s = getProperty( PHYS_S_PRM );
len = getProperty( PHYS_LEN_PRM );
@ -170,16 +170,16 @@ void COPLANAR::calc()
double sr_er_f = sr_er0;
// add the dispersive effects to er0
sr_er_f += (sr_er - sr_er0) / ( 1 + G * pow( f / fte, -1.8 ) );
sr_er_f += (sr_er - sr_er0) / ( 1 + G * pow( m_freq / fte, -1.8 ) );
// 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 * f / sigma );
* ac_factor * sr_er0 * sqrt( M_PI * MU0 * m_freq / sigma );
atten_dielectric = 20.0 / log( 10.0 ) * len
* ad_factor * f * (sr_er_f * sr_er_f - 1) / sr_er_f;
* ad_factor * m_freq * (sr_er_f * sr_er_f - 1) / sr_er_f;
ang_l = 2.0 * M_PI * len * sr_er_f * f / C0; /* in radians */
ang_l = 2.0 * M_PI * len * sr_er_f * m_freq / C0; /* in radians */
er_eff = sr_er_f * sr_er_f;
Z0 = zl_factor / sr_er_f;
@ -225,14 +225,36 @@ void COPLANAR::synthesize()
/* required value of Z0 */
Z0_dest = Z0;
double ang_l_tmp = getProperty( ANG_L_PRM );
// compute inital coplanar parameters. This function modify Z0 and ang_l
// (set to NaN in some cases)
calc();
if( std::isnan( Z0 ) ) // cannot be synthesized with current parameters
{
Z0 = Z0_dest;
ang_l= ang_l_tmp;
if( isSelected( PHYS_WIDTH_PRM ) )
{
setProperty( PHYS_WIDTH_PRM, NAN );
}
else
{
setProperty( PHYS_S_PRM, NAN );
}
setProperty( PHYS_LEN_PRM, NAN );
/* print results in the subwindow */
show_results();
return;
}
/* Newton's method */
iteration = 0;
/* compute coplanar parameters */
calc();
Z0_current = Z0;
error = fabs( Z0_dest - Z0_current );
while( error > MAX_ERROR )
@ -270,6 +292,7 @@ void COPLANAR::synthesize()
calc();
Z0_current = Z0;
error = fabs( Z0_dest - Z0_current );
if( iteration > 100 )
break;
}
@ -278,7 +301,7 @@ void COPLANAR::synthesize()
setProperty( PHYS_S_PRM, s );
/* calculate physical length */
ang_l = getProperty( ANG_L_PRM );
len = C0 / f / sqrt( er_eff ) * ang_l / 2.0 / M_PI; /* in m */
len = C0 / m_freq / sqrt( er_eff ) * ang_l / 2.0 / M_PI; /* in m */
setProperty( PHYS_LEN_PRM, len );
/* compute coplanar parameters */

View File

@ -300,7 +300,7 @@ void MICROSTRIP::dispersion()
u = w / h;
/* normalized frequency [GHz * mm] */
f_n = f * h / 1e06;
f_n = m_freq * h / 1e06;
P = e_r_dispersion( u, e_r, f_n );
/* effective dielectric constant corrected for dispersion */
@ -326,7 +326,7 @@ double MICROSTRIP::conductor_losses()
e_r_eff_0 = er_eff_0;
delta = skindepth;
if( f > 0.0 )
if( m_freq > 0.0 )
{
/* current distribution factor */
K = exp( -1.2 * pow( Z0_h_1 / ZF0, 0.7 ) );
@ -336,8 +336,8 @@ double MICROSTRIP::conductor_losses()
/* correction for surface roughness */
R_s *= 1.0 + ( (2.0 / M_PI) * atan( 1.40 * pow( (rough / delta), 2.0 ) ) );
/* strip inductive quality factor */
Q_c = (M_PI * Z0_h_1 * w * f) / (R_s * C0 * K);
alpha_c = ( 20.0 * M_PI / log( 10.0 ) ) * f * sqrt( e_r_eff_0 ) / (C0 * Q_c);
Q_c = (M_PI * Z0_h_1 * w * m_freq) / (R_s * C0 * K);
alpha_c = ( 20.0 * M_PI / log( 10.0 ) ) * m_freq * sqrt( e_r_eff_0 ) / (C0 * Q_c);
}
else
{
@ -363,7 +363,7 @@ double MICROSTRIP::dielectric_losses()
alpha_d =
( 20.0 * M_PI /
log( 10.0 ) ) *
(f / 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) ) * tand;
return alpha_d;
}
@ -434,7 +434,7 @@ void MICROSTRIP::line_angle()
/* velocity */
v = C0 / sqrt( e_r_eff * mur_eff );
/* wavelength */
lambda_g = v / f;
lambda_g = v / m_freq;
/* electrical angles */
ang_l = 2.0 * M_PI * l / lambda_g; /* in radians */
}
@ -479,7 +479,7 @@ void MICROSTRIP::get_microstrip_sub()
*/
void MICROSTRIP::get_microstrip_comp()
{
f = getProperty( FREQUENCY_PRM );
m_freq = getProperty( FREQUENCY_PRM );
}
@ -610,7 +610,7 @@ void MICROSTRIP::synthesize()
setProperty( PHYS_WIDTH_PRM, w );
/* calculate physical length */
ang_l = getProperty( ANG_L_PRM );
l = C0 / f / sqrt( er_eff * mur_eff ) * ang_l / 2.0 / M_PI; /* in m */
l = C0 / m_freq / sqrt( er_eff * mur_eff ) * ang_l / 2.0 / M_PI; /* in m */
setProperty( PHYS_LEN_PRM, l );
/* compute microstrip parameters */

View File

@ -57,7 +57,7 @@ double RECTWAVEGUIDE::kval_square()
{
double kval;
kval = 2.0* M_PI* f* sqrt( mur* er ) / C0;
kval = 2.0* M_PI * m_freq * sqrt( mur * er ) / C0;
return kval * kval;
}
@ -93,33 +93,33 @@ double RECTWAVEGUIDE::alphac()
double ac;
short m, n, mmax, nmax;
Rs = sqrt( M_PI * f * murC * MU0 / sigma );
Rs = sqrt( M_PI * m_freq * murC * MU0 / sigma );
ac = 0.0;
mmax = (int) floor( f / fc( 1, 0 ) );
mmax = (int) floor( m_freq / fc( 1, 0 ) );
nmax = mmax;
/* below from Ramo, Whinnery & Van Duzer */
/* TE(m,n) modes */
for( n = 0; n<= nmax; n++ )
for( n = 0; n <= nmax; n++ )
{
for( m = 1; m <= mmax; m++ )
{
f_c = fc( m, n );
if( f > f_c )
if( m_freq > f_c )
{
switch( n )
{
case 0:
ac += ( Rs / ( b * ZF0 * sqrt( 1.0 - pow( (f_c / f), 2.0 ) ) ) ) *
( 1.0 + ( (2 * b / a) * pow( (f_c / f), 2.0 ) ) );
ac += ( Rs / ( b * ZF0 * sqrt( 1.0 - pow( (f_c / m_freq), 2.0 ) ) ) ) *
( 1.0 + ( (2 * b / a) * pow( (f_c / m_freq), 2.0 ) ) );
break;
default:
ac += ( (2. * Rs) / ( b * ZF0 * sqrt( 1.0 - pow( (f_c / f), 2.0 ) ) ) ) *
( ( ( 1. + (b / a) ) * pow( (f_c / f), 2.0 ) ) +
ac += ( (2. * Rs) / ( b * ZF0 * sqrt( 1.0 - pow( (f_c / m_freq), 2.0 ) ) ) ) *
( ( ( 1. + (b / a) ) * pow( (f_c / m_freq), 2.0 ) ) +
( ( 1. -
pow( (f_c / f),
pow( (f_c / m_freq),
2.0 ) ) *
( ( (b / a) * ( ( (b / a) * pow( m, 2. ) ) + pow( n, 2. ) ) ) /
( pow( (b * m / a),
@ -131,14 +131,14 @@ double RECTWAVEGUIDE::alphac()
}
/* TM(m,n) modes */
for( n = 1; n<= nmax; n++ )
for( n = 1; n <= nmax; n++ )
{
for( m = 1; m<= mmax; m++ )
{
f_c = fc( m, n );
if( f > f_c )
if( m_freq > f_c )
{
ac += ( (2. * Rs) / ( b * ZF0 * sqrt( 1.0 - pow( (f_c / f), 2.0 ) ) ) ) *
ac += ( (2. * Rs) / ( b * ZF0 * sqrt( 1.0 - pow( (f_c / m_freq), 2.0 ) ) ) ) *
( ( ( pow( m, 2.0 ) * pow( (b / a), 3.0 ) ) + pow( n, 2. ) ) /
( ( pow( (m * b / a), 2. ) ) + pow( n, 2.0 ) ) );
}
@ -203,7 +203,7 @@ void RECTWAVEGUIDE::get_rectwaveguide_sub()
*/
void RECTWAVEGUIDE::get_rectwaveguide_comp()
{
f = getProperty( FREQUENCY_PRM );
m_freq = getProperty( FREQUENCY_PRM );
}
@ -256,14 +256,14 @@ void RECTWAVEGUIDE::analyze()
/* propagating modes */
// Z0 definition using fictive voltages and currents
Z0 = 2.0* ZF0* sqrt( mur / er ) * (b / a) / sqrt( 1.0 - pow( (fc( 1, 0 ) / f), 2.0 ) );
Z0 = 2.0* ZF0* sqrt( mur / er ) * (b / a) / sqrt( 1.0 - pow( (fc( 1, 0 ) / m_freq), 2.0 ) );
/* calculate electrical angle */
lambda_g = 2.0 * M_PI / sqrt( k_square - kc_square( 1, 0 ) );
ang_l = 2.0 * M_PI * l / lambda_g; /* in radians */
atten_cond = alphac() * l;
atten_dielectric = alphad() * l;
er_eff = ( 1.0 - pow( fc( 1, 0 ) / f, 2.0 ) );
er_eff = ( 1.0 - pow( fc( 1, 0 ) / m_freq, 2.0 ) );
}
else
{
@ -305,13 +305,13 @@ void RECTWAVEGUIDE::synthesize()
if( isSelected( PHYS_S_PRM ) )
{
/* solve for b */
b = Z0 * a * sqrt( 1.0 - pow( fc( 1, 0 ) / f, 2.0 ) ) / ( 2.0 * ZF0 * sqrt( mur / er ) );
b = Z0 * a * sqrt( 1.0 - pow( fc( 1, 0 ) / m_freq, 2.0 ) ) / ( 2.0 * ZF0 * sqrt( mur / er ) );
setProperty( PHYS_S_PRM, b );
}
else if( isSelected( PHYS_WIDTH_PRM ) )
{
/* solve for a */
a = sqrt( pow( 2.0 * ZF0 * b / Z0, 2.0 ) + pow( C0 / (2.0 * f), 2.0 ) );
a = sqrt( pow( 2.0 * ZF0 * b / Z0, 2.0 ) + pow( C0 / (2.0 * m_freq), 2.0 ) );
setProperty( PHYS_WIDTH_PRM, a );
}
@ -329,7 +329,7 @@ void RECTWAVEGUIDE::synthesize()
lambda_g = 2.0 * M_PI / beta;
atten_cond = alphac() * l;
atten_dielectric = alphad() * l;
er_eff = ( 1.0 - pow( (fc( 1, 0 ) / f), 2.0 ) );
er_eff = ( 1.0 - pow( (fc( 1, 0 ) / m_freq), 2.0 ) );
}
else
{
@ -360,18 +360,18 @@ void RECTWAVEGUIDE::show_results()
setResult( 3, atten_dielectric, "dB" );
// show possible TE modes (H modes)
if( f < fc( 1, 0 ) )
if( m_freq < fc( 1, 0 ) )
strcpy( text, "none" );
else
{
strcpy( text, "" );
for( m = 0; m<= max; m++ )
for( m = 0; m <= max; m++ )
{
for( n = 0; n<= max; n++ )
for( n = 0; n <= max; n++ )
{
if( (m == 0) && (n == 0) )
continue;
if( f >= ( fc( m, n ) ) )
if( m_freq >= ( fc( m, n ) ) )
{
sprintf( txt, "H(%d,%d) ", m, n );
if( (strlen( text ) + strlen( txt ) + 5) < MAXSTRLEN )
@ -388,7 +388,7 @@ void RECTWAVEGUIDE::show_results()
setResult( 4, text );
// show possible TM modes (E modes)
if( f < fc( 1, 1 ) )
if( m_freq < fc( 1, 1 ) )
strcpy( text, "none" );
else
{
@ -397,7 +397,7 @@ void RECTWAVEGUIDE::show_results()
{
for( n = 1; n<= max; n++ )
{
if( f >= fc( m, n ) )
if( m_freq >= fc( m, n ) )
{
sprintf( txt, "E(%d,%d) ", m, n );
if( (strlen( text ) + strlen( txt ) + 5) < MAXSTRLEN )

View File

@ -52,7 +52,7 @@ STRIPLINE::STRIPLINE() : TRANSLINE()
// -------------------------------------------------------------------
void STRIPLINE::getProperties()
{
f = getProperty( FREQUENCY_PRM );
m_freq = getProperty( FREQUENCY_PRM );
w = getProperty( PHYS_WIDTH_PRM );
len = getProperty( PHYS_LEN_PRM );
h = getProperty( H_PRM);
@ -75,7 +75,7 @@ double STRIPLINE::lineImpedance( double height, double& ac )
double ZL;
double hmt = height - t;
ac = sqrt( f / sigma / 17.2 );
ac = sqrt( m_freq / sigma / 17.2 );
if( w / hmt >= 0.35 )
{
ZL = w +
@ -119,9 +119,9 @@ 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) * f * sqrt( er ) * tand;
atten_dielectric = 20.0 / log( 10.0 ) * len * (M_PI / C0) * m_freq * sqrt( er ) * tand;
ang_l = 2.0* M_PI* len* sqrt( er ) * f / C0; // in radians
ang_l = 2.0* M_PI* len* sqrt( er ) * m_freq / C0; // in radians
}
@ -199,7 +199,7 @@ void STRIPLINE::synthesize()
setProperty( PHYS_WIDTH_PRM, w );
/* calculate physical length */
ang_l = getProperty( ANG_L_PRM );
len = C0 / f / sqrt( er_eff ) * ang_l / 2.0 / M_PI; /* in m */
len = C0 / m_freq / sqrt( er_eff ) * ang_l / 2.0 / M_PI; /* in m */
setProperty( PHYS_LEN_PRM, len );
/* compute parameters */

View File

@ -65,7 +65,7 @@ TRANSLINE::TRANSLINE()
m_name = (const char*) 0;
// Initialize these variables mainly to avoid warnings from a static analyzer
f = 0.0; // Frequency of operation
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
@ -122,7 +122,7 @@ double TRANSLINE::getProperty( enum PRMS_ID aPrmId )
double TRANSLINE::skin_depth()
{
double depth;
depth = 1.0 / sqrt( M_PI * f * murC * MU0 * sigma );
depth = 1.0 / sqrt( M_PI * m_freq * murC * MU0 * sigma );
return depth;
}

View File

@ -72,12 +72,13 @@ public: TRANSLINE();
virtual void analyze() { };
protected:
double f; /* Frequency of operation */
double m_freq; // Frequency of operation
double er; /* dielectric constant */
double tand; /* Dielectric Loss Tangent */
double sigma; /* Conductivity of the metal */
double murC; /* magnetic permeability of conductor */
double skindepth; /* Skin depth */
double skin_depth();
void ellipke( double, double&, double& );
double ellipk( double );

View File

@ -52,7 +52,7 @@ TWISTEDPAIR::TWISTEDPAIR() : TRANSLINE()
// -------------------------------------------------------------------
void TWISTEDPAIR::getProperties()
{
f = getProperty( FREQUENCY_PRM );
m_freq = getProperty( FREQUENCY_PRM );
din = getProperty( PHYS_DIAM_IN_PRM );
dout = getProperty( PHYS_DIAM_OUT_PRM );
len = getProperty( PHYS_LEN_PRM );
@ -80,9 +80,9 @@ void TWISTEDPAIR::calc()
atten_cond = 10.0 / log( 10.0 ) * len / skindepth / sigma / M_PI / Z0 / (din - skindepth);
atten_dielectric = 20.0 / log( 10.0 ) * len * M_PI / C0* f* sqrt( er_eff ) * tand;
atten_dielectric = 20.0 / log( 10.0 ) * len * M_PI / C0* m_freq * sqrt( er_eff ) * tand;
ang_l = 2.0* M_PI* len* sqrt( er_eff ) * f / C0; // in radians
ang_l = 2.0* M_PI* len* sqrt( er_eff ) * m_freq / C0; // in radians
}
@ -174,7 +174,7 @@ void TWISTEDPAIR::synthesize()
setProperty( PHYS_DIAM_OUT_PRM, dout );
/* calculate physical length */
ang_l = getProperty( ANG_L_PRM );
len = C0 / f / sqrt( er_eff ) * ang_l / 2.0 / M_PI; /* in m */
len = C0 / m_freq / sqrt( er_eff ) * ang_l / 2.0 / M_PI; /* in m */
setProperty( PHYS_LEN_PRM, len );
/* compute parameters */