pcb_calculator/transline/stripline: add missing conv from log to db.

From master branch
Fixes #15873
https://gitlab.com/kicad/code/kicad/-/issues/15873
This commit is contained in:
jean-pierre charras 2023-10-16 10:31:32 +02:00
parent afe2516d57
commit 5ad74d58f8
1 changed files with 6 additions and 3 deletions

View File

@ -30,6 +30,9 @@
#include "stripline.h" #include "stripline.h"
#include "units.h" #include "units.h"
// const to convert a attenuation / loss from log to decibel
const double LOG2DB = 20.0 / log( 10.0 );
STRIPLINE::STRIPLINE() : TRANSLINE() STRIPLINE::STRIPLINE() : TRANSLINE()
{ {
m_Name = "StripLine"; m_Name = "StripLine";
@ -38,7 +41,7 @@ STRIPLINE::STRIPLINE() : TRANSLINE()
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// calculate characteristic impedance and conductor loss // calculate characteristic impedance and conductor loss (in log/meter)
double STRIPLINE::lineImpedance( double height, double& ac ) double STRIPLINE::lineImpedance( double height, double& ac )
{ {
double ZL; double ZL;
@ -95,8 +98,8 @@ void STRIPLINE::calcAnalyze()
m_parameters[Z0_PRM] = 2.0 m_parameters[Z0_PRM] = 2.0
/ ( 1.0 / lineImpedance( 2.0 * a + t, ac1 ) / ( 1.0 / lineImpedance( 2.0 * a + t, ac1 )
+ 1.0 / lineImpedance( 2.0 * ( h - a ) - t, ac2 ) ); + 1.0 / lineImpedance( 2.0 * ( h - a ) - t, ac2 ) );
m_parameters[LOSS_CONDUCTOR_PRM] = m_parameters[PHYS_LEN_PRM] * 0.5 * ( ac1 + ac2 ); m_parameters[LOSS_CONDUCTOR_PRM] = LOG2DB * m_parameters[PHYS_LEN_PRM] * ( ac1 + ac2 );
m_parameters[LOSS_DIELECTRIC_PRM] = 20.0 / log( 10.0 ) * m_parameters[PHYS_LEN_PRM] m_parameters[LOSS_DIELECTRIC_PRM] = LOG2DB * m_parameters[PHYS_LEN_PRM]
* ( M_PI / C0 ) * m_parameters[FREQUENCY_PRM] * ( M_PI / C0 ) * m_parameters[FREQUENCY_PRM]
* sqrt( m_parameters[EPSILONR_PRM] ) * sqrt( m_parameters[EPSILONR_PRM] )
* m_parameters[TAND_PRM]; * m_parameters[TAND_PRM];