2011-08-05 19:53:42 +00:00
|
|
|
/*
|
|
|
|
* coax.cpp - coaxial class implementation
|
|
|
|
*
|
|
|
|
* 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>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this package; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* coax.c - Puts up window for microstrip and
|
|
|
|
* performs the associated calculations
|
|
|
|
*/
|
2012-09-21 17:02:54 +00:00
|
|
|
#include <cmath>
|
2019-12-05 14:03:15 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cstring>
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <coax.h>
|
2020-08-07 00:09:33 +00:00
|
|
|
#include <units.h>
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
COAX::COAX() : TRANSLINE()
|
|
|
|
{
|
2018-06-07 13:44:20 +00:00
|
|
|
m_Name = "Coax";
|
2020-08-07 00:09:33 +00:00
|
|
|
Init();
|
2011-08-05 19:53:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
double COAX::alphad_coax()
|
|
|
|
{
|
|
|
|
double ad;
|
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
ad = ( M_PI / C0 ) * m_parameters[FREQUENCY_PRM] * sqrt( m_parameters[EPSILONR_PRM] )
|
|
|
|
* m_parameters[TAND_PRM];
|
2011-08-05 19:53:42 +00:00
|
|
|
ad = ad * 20.0 / log( 10.0 );
|
|
|
|
return ad;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
double COAX::alphac_coax()
|
|
|
|
{
|
|
|
|
double ac, Rs;
|
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
Rs = sqrt( M_PI * m_parameters[FREQUENCY_PRM] * m_parameters[MURC_PRM] * MU0
|
|
|
|
/ m_parameters[SIGMA_PRM] );
|
|
|
|
ac = sqrt( m_parameters[EPSILONR_PRM] )
|
|
|
|
* ( ( ( 1 / m_parameters[PHYS_DIAM_IN_PRM] ) + ( 1 / m_parameters[PHYS_DIAM_OUT_PRM] ) )
|
|
|
|
/ log( m_parameters[PHYS_DIAM_OUT_PRM] / m_parameters[PHYS_DIAM_IN_PRM] ) )
|
|
|
|
* ( Rs / ZF0 );
|
2011-08-05 19:53:42 +00:00
|
|
|
ac = ac * 20.0 / log( 10.0 );
|
|
|
|
return ac;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
/**
|
|
|
|
* \f$ Z_0 = \frac{Z_{0_{\mathrm{vaccum}}}}{\sqrt{\epsilon_r}}\log_{10}\left( \frac{D_{\mathrm{out}}}{D_{\mathrm{in}}}\right) \f$
|
|
|
|
*
|
|
|
|
* \f$ \lambda_g = \frac{c}{f \cdot \sqrt{ \epsilon_r \cdot \mu_r}} \f$
|
|
|
|
*
|
|
|
|
* \f$ L_{[\mathrm{rad}]} = \frac{ 2\pi\cdot L_{[\mathrm{m}]}}{\lambda_g} \f$
|
|
|
|
* */
|
|
|
|
void COAX::calcAnalyze()
|
2011-08-05 19:53:42 +00:00
|
|
|
{
|
|
|
|
double lambda_g;
|
|
|
|
|
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
m_parameters[Z0_PRM] =
|
|
|
|
( ZF0 / 2 / M_PI / sqrt( m_parameters[EPSILONR_PRM] ) )
|
|
|
|
* log( m_parameters[PHYS_DIAM_OUT_PRM] / m_parameters[PHYS_DIAM_IN_PRM] );
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
lambda_g = ( C0 / ( m_parameters[FREQUENCY_PRM] ) )
|
|
|
|
/ sqrt( m_parameters[EPSILONR_PRM] * m_parameters[MUR_PRM] );
|
|
|
|
/* calculate electrical angle */
|
|
|
|
m_parameters[ANG_L_PRM] =
|
|
|
|
( 2.0 * M_PI * m_parameters[PHYS_LEN_PRM] ) / lambda_g; /* in radians */
|
|
|
|
}
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
/**
|
|
|
|
* \f$ D_{\mathrm{in}} = D_{\mathrm{out}} \cdot e^{-\frac{Z_0*\sqrt{\epsilon_r}}{2\pi \cdot Z_{0_{\mathrm{vaccum}}}}} \f$
|
|
|
|
*
|
|
|
|
* \f$ D_{\mathrm{out}} = D_{\mathrm{in}} \cdot e^{ \frac{Z_0*\sqrt{\epsilon_r}}{2\pi \cdot Z_{0_{\mathrm{vaccum}}}}} \f$
|
|
|
|
*
|
|
|
|
* \f$ \lambda_g = \frac{c}{f \cdot \sqrt{ \epsilon_r \cdot \mu_r}} \f$
|
|
|
|
*
|
|
|
|
* \f$ L_{[\mathrm{m}]} = \frac{ \lambda_g cdot L_{[\mathrm{m}]}}{2\pi} \f$
|
|
|
|
* */
|
|
|
|
void COAX::calcSynthesize()
|
|
|
|
{
|
|
|
|
double lambda_g;
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
if( isSelected( PHYS_DIAM_IN_PRM ) )
|
|
|
|
{
|
|
|
|
/* solve for din */
|
|
|
|
m_parameters[PHYS_DIAM_IN_PRM] =
|
|
|
|
m_parameters[PHYS_DIAM_OUT_PRM]
|
|
|
|
/ exp( m_parameters[Z0_PRM] * sqrt( m_parameters[EPSILONR_PRM] ) / ZF0 * 2 * M_PI );
|
|
|
|
}
|
|
|
|
else if( isSelected( PHYS_DIAM_OUT_PRM ) )
|
|
|
|
{
|
|
|
|
/* solve for dout */
|
|
|
|
m_parameters[PHYS_DIAM_OUT_PRM] =
|
|
|
|
m_parameters[PHYS_DIAM_IN_PRM]
|
|
|
|
* exp( m_parameters[Z0_PRM] * sqrt( m_parameters[EPSILONR_PRM] ) / ZF0 * 2 * M_PI );
|
|
|
|
}
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
lambda_g = ( C0 / ( m_parameters[FREQUENCY_PRM] ) )
|
|
|
|
/ sqrt( m_parameters[EPSILONR_PRM] * m_parameters[MUR_PRM] );
|
|
|
|
/* calculate physical length */
|
|
|
|
m_parameters[PHYS_LEN_PRM] = ( lambda_g * m_parameters[ANG_L_PRM] ) / ( 2.0 * M_PI ); /* in m */
|
2011-08-05 19:53:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
void COAX::showAnalyze()
|
2011-08-05 19:53:42 +00:00
|
|
|
{
|
2020-08-07 00:09:33 +00:00
|
|
|
setProperty( Z0_PRM, m_parameters[Z0_PRM] );
|
|
|
|
setProperty( ANG_L_PRM, m_parameters[ANG_L_PRM] );
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
// Check for errors
|
|
|
|
if( !std::isfinite( m_parameters[Z0_PRM] ) || m_parameters[Z0_PRM] < 0 )
|
|
|
|
{
|
|
|
|
setErrorLevel( Z0_PRM, TRANSLINE_ERROR );
|
|
|
|
}
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
if( !std::isfinite( m_parameters[ANG_L_PRM] ) || m_parameters[ANG_L_PRM] < 0 )
|
|
|
|
{
|
|
|
|
setErrorLevel( ANG_L_PRM, TRANSLINE_ERROR );
|
|
|
|
}
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
// Find warnings to display - physical parameters
|
|
|
|
if( !std::isfinite( m_parameters[PHYS_DIAM_IN_PRM] ) || m_parameters[PHYS_DIAM_IN_PRM] <= 0.0 )
|
|
|
|
{
|
|
|
|
setErrorLevel( PHYS_DIAM_IN_PRM, TRANSLINE_WARNING );
|
|
|
|
}
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
if( !std::isfinite( m_parameters[PHYS_DIAM_OUT_PRM] )
|
|
|
|
|| m_parameters[PHYS_DIAM_OUT_PRM] <= 0.0 )
|
|
|
|
{
|
|
|
|
setErrorLevel( PHYS_DIAM_OUT_PRM, TRANSLINE_WARNING );
|
|
|
|
}
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
if( m_parameters[PHYS_DIAM_IN_PRM] > m_parameters[PHYS_DIAM_OUT_PRM] )
|
2011-08-05 19:53:42 +00:00
|
|
|
{
|
2020-08-07 00:09:33 +00:00
|
|
|
setErrorLevel( PHYS_DIAM_IN_PRM, TRANSLINE_WARNING );
|
|
|
|
setErrorLevel( PHYS_DIAM_OUT_PRM, TRANSLINE_WARNING );
|
2011-08-05 19:53:42 +00:00
|
|
|
}
|
2020-08-07 00:09:33 +00:00
|
|
|
|
|
|
|
if( !std::isfinite( m_parameters[PHYS_LEN_PRM] ) || m_parameters[PHYS_LEN_PRM] < 0.0 )
|
|
|
|
{
|
|
|
|
setErrorLevel( PHYS_LEN_PRM, TRANSLINE_WARNING );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void COAX::showSynthesize()
|
|
|
|
{
|
|
|
|
if( isSelected( PHYS_DIAM_IN_PRM ) )
|
|
|
|
setProperty( PHYS_DIAM_IN_PRM, m_parameters[PHYS_DIAM_IN_PRM] );
|
2011-08-05 19:53:42 +00:00
|
|
|
else if( isSelected( PHYS_DIAM_OUT_PRM ) )
|
2020-08-07 00:09:33 +00:00
|
|
|
setProperty( PHYS_DIAM_OUT_PRM, m_parameters[PHYS_DIAM_OUT_PRM] );
|
|
|
|
setProperty( PHYS_LEN_PRM, m_parameters[PHYS_LEN_PRM] );
|
|
|
|
|
|
|
|
// Check for errors
|
|
|
|
if( !std::isfinite( m_parameters[PHYS_DIAM_IN_PRM] ) || m_parameters[PHYS_DIAM_IN_PRM] <= 0.0 )
|
2011-08-05 19:53:42 +00:00
|
|
|
{
|
2020-08-07 00:09:33 +00:00
|
|
|
if( isSelected( PHYS_DIAM_IN_PRM ) )
|
|
|
|
setErrorLevel( PHYS_DIAM_IN_PRM, TRANSLINE_ERROR );
|
|
|
|
else
|
|
|
|
setErrorLevel( PHYS_DIAM_IN_PRM, TRANSLINE_WARNING );
|
2011-08-05 19:53:42 +00:00
|
|
|
}
|
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
if( !std::isfinite( m_parameters[PHYS_DIAM_OUT_PRM] )
|
|
|
|
|| m_parameters[PHYS_DIAM_OUT_PRM] <= 0.0 )
|
|
|
|
{
|
|
|
|
if( isSelected( PHYS_DIAM_OUT_PRM ) )
|
|
|
|
setErrorLevel( PHYS_DIAM_OUT_PRM, TRANSLINE_ERROR );
|
|
|
|
else
|
|
|
|
setErrorLevel( PHYS_DIAM_OUT_PRM, TRANSLINE_WARNING );
|
|
|
|
}
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
if( m_parameters[PHYS_DIAM_IN_PRM] > m_parameters[PHYS_DIAM_OUT_PRM] )
|
|
|
|
{
|
|
|
|
if( isSelected( PHYS_DIAM_IN_PRM ) )
|
|
|
|
setErrorLevel( PHYS_DIAM_IN_PRM, TRANSLINE_ERROR );
|
|
|
|
else if( isSelected( PHYS_DIAM_OUT_PRM ) )
|
|
|
|
setErrorLevel( PHYS_DIAM_OUT_PRM, TRANSLINE_ERROR );
|
|
|
|
}
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
if( !std::isfinite( m_parameters[PHYS_LEN_PRM] ) || m_parameters[PHYS_LEN_PRM] < 0.0 )
|
|
|
|
{
|
|
|
|
setErrorLevel( PHYS_LEN_PRM, TRANSLINE_ERROR );
|
|
|
|
}
|
|
|
|
// Check for warnings
|
|
|
|
if( !std::isfinite( m_parameters[Z0_PRM] ) || m_parameters[Z0_PRM] < 0 )
|
|
|
|
{
|
|
|
|
setErrorLevel( Z0_PRM, TRANSLINE_WARNING );
|
|
|
|
}
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
if( !std::isfinite( m_parameters[ANG_L_PRM] ) || m_parameters[ANG_L_PRM] < 0 )
|
|
|
|
{
|
|
|
|
setErrorLevel( ANG_L_PRM, TRANSLINE_WARNING );
|
|
|
|
}
|
|
|
|
}
|
2011-08-05 19:53:42 +00:00
|
|
|
/*
|
|
|
|
* show_results() - show results
|
|
|
|
*/
|
|
|
|
void COAX::show_results()
|
|
|
|
{
|
2016-04-16 09:57:42 +00:00
|
|
|
int m, n;
|
2020-08-07 00:09:33 +00:00
|
|
|
char text[256], txt[256];
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
m_parameters[LOSS_DIELECTRIC_PRM] = alphad_coax() * m_parameters[PHYS_LEN_PRM];
|
|
|
|
m_parameters[LOSS_CONDUCTOR_PRM] = alphac_coax() * m_parameters[PHYS_LEN_PRM];
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
setResult( 0, m_parameters[EPSILONR_PRM], "" );
|
|
|
|
setResult( 1, m_parameters[LOSS_CONDUCTOR_PRM], "dB" );
|
|
|
|
setResult( 2, m_parameters[LOSS_DIELECTRIC_PRM], "dB" );
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
n = 1;
|
|
|
|
m_parameters[CUTOFF_FREQUENCY_PRM] =
|
|
|
|
C0
|
|
|
|
/ ( M_PI * ( m_parameters[PHYS_DIAM_OUT_PRM] + m_parameters[MUR_PRM] ) / (double) n );
|
|
|
|
if( m_parameters[CUTOFF_FREQUENCY_PRM] > m_parameters[FREQUENCY_PRM] )
|
2011-08-05 19:53:42 +00:00
|
|
|
strcpy( text, "none" );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy( text, "H(1,1) " );
|
2020-08-07 00:09:33 +00:00
|
|
|
m = 2;
|
|
|
|
m_parameters[CUTOFF_FREQUENCY_PRM] =
|
|
|
|
C0
|
|
|
|
/ ( 2 * ( m_parameters[PHYS_DIAM_OUT_PRM] - m_parameters[MUR_PRM] )
|
|
|
|
/ (double) ( m - 1 ) );
|
|
|
|
while( ( m_parameters[CUTOFF_FREQUENCY_PRM] <= m_parameters[FREQUENCY_PRM] ) && ( m < 10 ) )
|
2011-08-05 19:53:42 +00:00
|
|
|
{
|
|
|
|
sprintf( txt, "H(n,%d) ", m );
|
|
|
|
strcat( text, txt );
|
|
|
|
m++;
|
2020-08-07 00:09:33 +00:00
|
|
|
m_parameters[CUTOFF_FREQUENCY_PRM] =
|
|
|
|
C0
|
|
|
|
/ ( 2 * ( m_parameters[PHYS_DIAM_OUT_PRM] - m_parameters[MUR_PRM] )
|
|
|
|
/ (double) ( m - 1 ) );
|
2011-08-05 19:53:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
setResult( 3, text );
|
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
m = 1;
|
|
|
|
m_parameters[CUTOFF_FREQUENCY_PRM] =
|
|
|
|
C0 / ( 2 * ( m_parameters[PHYS_DIAM_OUT_PRM] - m_parameters[MUR_PRM] ) / (double) m );
|
|
|
|
if( m_parameters[CUTOFF_FREQUENCY_PRM] > m_parameters[FREQUENCY_PRM] )
|
2011-08-05 19:53:42 +00:00
|
|
|
strcpy( text, "none" );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy( text, "" );
|
2020-08-07 00:09:33 +00:00
|
|
|
while( ( m_parameters[CUTOFF_FREQUENCY_PRM] <= m_parameters[FREQUENCY_PRM] ) && ( m < 10 ) )
|
2011-08-05 19:53:42 +00:00
|
|
|
{
|
|
|
|
sprintf( txt, "E(n,%d) ", m );
|
|
|
|
strcat( text, txt );
|
|
|
|
m++;
|
2020-08-07 00:09:33 +00:00
|
|
|
m_parameters[CUTOFF_FREQUENCY_PRM] =
|
|
|
|
C0
|
|
|
|
/ ( 2 * ( m_parameters[PHYS_DIAM_OUT_PRM] - m_parameters[MUR_PRM] )
|
|
|
|
/ (double) m );
|
2011-08-05 19:53:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
setResult( 4, text );
|
|
|
|
}
|