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>
|
2022-02-09 01:08:22 +00:00
|
|
|
|
|
|
|
#include <wx/string.h>
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-10-13 01:01:25 +00:00
|
|
|
#include "coax.h"
|
|
|
|
#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-10-13 01:01:25 +00:00
|
|
|
/**
|
2021-06-10 01:24:15 +00:00
|
|
|
* \f$ Z_0 = \frac{Z_{0_{\mathrm{vacuum}}}}{\sqrt{\epsilon_r}}\log_{10}\left( \frac{D_{\mathrm{out}}}{D_{\mathrm{in}}}\right) \f$
|
2020-10-13 01:01:25 +00:00
|
|
|
*
|
2020-08-07 00:09:33 +00:00
|
|
|
* \f$ \lambda_g = \frac{c}{f \cdot \sqrt{ \epsilon_r \cdot \mu_r}} \f$
|
2020-10-13 01:01:25 +00:00
|
|
|
*
|
2020-08-07 00:09:33 +00:00
|
|
|
* \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-10-13 01:01:25 +00:00
|
|
|
/**
|
2021-06-10 01:24:15 +00:00
|
|
|
* \f$ D_{\mathrm{in}} = D_{\mathrm{out}} \cdot e^{-\frac{Z_0*\sqrt{\epsilon_r}}{2\pi \cdot Z_{0_{\mathrm{vacuum}}}}} \f$
|
2020-10-13 01:01:25 +00:00
|
|
|
*
|
2021-06-10 01:24:15 +00:00
|
|
|
* \f$ D_{\mathrm{out}} = D_{\mathrm{in}} \cdot e^{ \frac{Z_0*\sqrt{\epsilon_r}}{2\pi \cdot Z_{0_{\mathrm{vacuum}}}}} \f$
|
2020-10-13 01:01:25 +00:00
|
|
|
*
|
2020-08-07 00:09:33 +00:00
|
|
|
* \f$ \lambda_g = \frac{c}{f \cdot \sqrt{ \epsilon_r \cdot \mu_r}} \f$
|
2020-10-13 01:01:25 +00:00
|
|
|
*
|
2020-08-07 00:09:33 +00:00
|
|
|
* \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] );
|
2021-10-10 15:03:24 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
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 );
|
2021-10-10 15:03:24 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
// 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;
|
2022-02-09 01:08:22 +00:00
|
|
|
wxString text;
|
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], "" );
|
2022-02-09 01:08:22 +00:00
|
|
|
setResult( 1, m_parameters[LOSS_CONDUCTOR_PRM], wxT( "dB" ) );
|
|
|
|
setResult( 2, m_parameters[LOSS_DIELECTRIC_PRM], wxT( "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 );
|
2021-10-10 15:03:24 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
if( m_parameters[CUTOFF_FREQUENCY_PRM] > m_parameters[FREQUENCY_PRM] )
|
2021-10-10 15:03:24 +00:00
|
|
|
{
|
2022-02-09 01:08:22 +00:00
|
|
|
text = wxT( "none" );
|
2021-10-10 15:03:24 +00:00
|
|
|
}
|
2011-08-05 19:53:42 +00:00
|
|
|
else
|
|
|
|
{
|
2022-02-09 01:08:22 +00:00
|
|
|
text = wxT( " 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] )
|
2022-02-09 01:08:22 +00:00
|
|
|
/ ( m - 1 ) );
|
2021-10-10 15:03:24 +00:00
|
|
|
|
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
|
|
|
{
|
2022-02-09 01:08:22 +00:00
|
|
|
text << wxString::Format( wxT( "H(n,%d) " ), m );
|
2011-08-05 19:53:42 +00:00
|
|
|
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] )
|
2021-10-10 15:03:24 +00:00
|
|
|
{
|
2022-02-09 01:08:22 +00:00
|
|
|
text = wxT( "none" );
|
2021-10-10 15:03:24 +00:00
|
|
|
}
|
2011-08-05 19:53:42 +00:00
|
|
|
else
|
|
|
|
{
|
2022-02-09 01:08:22 +00:00
|
|
|
text.Clear();
|
2021-10-10 15:03:24 +00:00
|
|
|
|
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
|
|
|
{
|
2022-02-09 01:08:22 +00:00
|
|
|
text << wxString::Format( wxT( "E(n,%d) " ), m );
|
2011-08-05 19:53:42 +00:00
|
|
|
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 );
|
|
|
|
}
|