KiCad PCB EDA Suite
Loading...
Searching...
No Matches
common/transline_calculations/units.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1992-2011 jean-pierre.charras
3
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this package. If not, see <https://www.gnu.org/licenses/>.
17
*
18
*/
19
20
#ifndef TRANSLINE_CALCULATIONS_UNITS_H
21
#define TRANSLINE_CALCULATIONS_UNITS_H
22
23
24
#include <cmath>
25
26
27
#ifndef HAVE_CMATH_ASINH
28
inline
double
asinh
(
double
x )
29
{
30
return
log( x + sqrt( x * x + 1 ) );
31
}
32
#endif
33
34
#ifndef HAVE_CMATH_ACOSH
35
inline
double
acosh
(
double
x )
36
{
37
// must be x>=1, if not return Nan (Not a Number)
38
if
( x < 1.0 )
39
return
sqrt( -1.0 );
40
41
// return only the positive result (as sqrt does).
42
return
log( x + sqrt( x * x - 1.0 ) );
43
}
44
#endif
45
46
#ifndef HAVE_CMATH_ATANH
47
inline
double
atanh
(
double
x )
48
{
49
// must be x>-1, x<1, if not return Nan (Not a Number)
50
if
( !( x > -1.0 && x < 1.0 ) )
51
return
sqrt( -1.0 );
52
53
return
log( ( 1.0 + x ) / ( 1.0 - x ) ) / 2.0;
54
}
55
#endif
56
57
namespace
TRANSLINE_CALCULATIONS
58
{
59
constexpr
double
MU0
= 12.566370614e-7;
// magnetic constant
60
constexpr
double
E0
= 8.854e-12;
// permittivity of free space
61
constexpr
double
C0
= 299792458.0;
// speed of light in vacuum
62
63
// wave resistance in vacuum
64
//
65
// - From 1948 to 2019, Z₀ was defined to be exactly π*119.9169832 Ω (≈376.730_313_462 Ω).
66
//
67
// - The 2019 revision to SI changed it from a defined value to a measured value. In accordance
68
// with this, the "2018" revision (based on 2018 measurements, values published 2019, rationale
69
// published 2021) of the "CODATA Recommended Values of the Fundamental Physical Constants"
70
// (<https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=931443>) gave the accepted measured
71
// value as 376.730_313_668(57) Ω (the number in parenthesis is the margin of error).
72
//
73
// - The "2022" revision (based on 2022 measurements, values published 2024, rationale published
74
// 2025) of CODATA (<https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=958143>) gave the
75
// accepted measured value as 376.730_313_412(59) Ω.
76
//
77
// The most recent CODATA value can always be found at
78
// <https://physics.nist.gov/cgi-bin/cuu/Value?z0>.
79
//
80
// - From its first use in 2011 (pre-v4), KiCad used the value 376.730_313_469_585_043_649_63, which
81
// mysteriously doesn't quite match any of the above.
82
//
83
// - In 2021 (v6), KiCad updated to the 2018 CODATA value.
84
//
85
// - In 2026, KiCad updated to the 2022 CODATA value.
86
constexpr
double
ZF0
= 376.730313412;
87
88
// const to convert a attenuation / loss from log (Neper) to decibel
89
// (1 Np = 8.68589 dB)
90
const
double
LOG2DB
= 20.0 / log( 10.0 );
91
};
// namespace TRANSLINE_CALCULATIONS
92
93
#endif
// TRANSLINE_CALCULATIONS_UNITS_H
asinh
double asinh(double x)
Definition
common/transline_calculations/units.h:28
atanh
double atanh(double x)
Definition
common/transline_calculations/units.h:47
acosh
double acosh(double x)
Definition
common/transline_calculations/units.h:35
TRANSLINE_CALCULATIONS
Definition
common/transline_calculations/units.h:58
TRANSLINE_CALCULATIONS::MU0
constexpr double MU0
Definition
common/transline_calculations/units.h:59
TRANSLINE_CALCULATIONS::E0
constexpr double E0
Definition
common/transline_calculations/units.h:60
TRANSLINE_CALCULATIONS::LOG2DB
const double LOG2DB
Definition
common/transline_calculations/units.h:90
TRANSLINE_CALCULATIONS::C0
constexpr double C0
Definition
common/transline_calculations/units.h:61
TRANSLINE_CALCULATIONS::ZF0
constexpr double ZF0
Definition
common/transline_calculations/units.h:86
src
common
transline_calculations
units.h
Generated on Fri Jun 26 2026 00:05:33 for KiCad PCB EDA Suite by
1.13.2