KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_calculator/transline/rectwaveguide.cpp
Go to the documentation of this file.
1/*
2 * rectwaveguide.cpp - rectangular waveguide UI wrapper
3 *
4 * Copyright (C) 2001 Gopal Narayanan <[email protected]>
5 * Copyright (C) 2005, 2006 Stefan Jahn <[email protected]>
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or (at
11 * your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this package; see the file COPYING. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 *
23 */
24
25#include <cmath>
26
27#include "rectwaveguide.h"
28#include "units.h"
29
30
32{
33 m_Name = "RectWaveGuide";
34 Init();
35}
36
37
59
60
62{
63 m_calc.Analyse();
64}
65
66
71
72
74{
75 std::unordered_map<TRANSLINE_PARAMETERS, std::pair<double, TRANSLINE_STATUS>>& results =
76 m_calc.GetAnalysisResults();
77
80
87}
88
89
91{
92 std::unordered_map<TRANSLINE_PARAMETERS, std::pair<double, TRANSLINE_STATUS>>& results =
93 m_calc.GetSynthesisResults();
94
95 if( isSelected( PHYS_A_PRM ) )
97
98 if( isSelected( PHYS_B_PRM ) )
100
102
109}
110
111
113{
114 std::unordered_map<TRANSLINE_PARAMETERS, std::pair<double, TRANSLINE_STATUS>>& results =
115 m_calc.GetAnalysisResults();
116
117 // Field-quantity impedance Z0EH = Ey / Hx for TE10 above cutoff, matching the legacy
118 // "ZF(H10) = Ey / Hx:" row. In terms of the analysis outputs, Z0EH = ZF0 / sqrt(eps_eff)
119 // (eps_eff = 1 - (fc/f)^2 here). Below cutoff eps_eff is 0 and we fall back to zero.
120 const double epsEff = results[TRANSLINE_PARAMETERS::EPSILON_EFF].first;
121 const double z0eh = ( epsEff > 0.0 ) ? 376.730313668 / std::sqrt( epsEff ) : 0.0;
122
123 setResult( 0, z0eh, "Ohm" );
124 setResult( 1, results[TRANSLINE_PARAMETERS::EPSILON_EFF].first, "" );
125 setResult( 2, results[TRANSLINE_PARAMETERS::LOSS_CONDUCTOR].first, "dB" );
126 setResult( 3, results[TRANSLINE_PARAMETERS::LOSS_DIELECTRIC].first, "dB" );
127
128 std::string teText = m_calc.GetTEModes();
129 std::string tmText = m_calc.GetTMModes();
130
131 if( teText.empty() )
132 teText = "none";
133
134 if( tmText.empty() )
135 tmText = "none";
136
137 setResult( 4, teText.c_str() );
138 setResult( 5, tmText.c_str() );
139}
void calcSynthesize() override
Computation for synthesis.
void show_results() override
Shows results.
void showAnalyze() override
Shows synthesis results and checks for errors / warnings.
void getProperties() override
@function getProperties
void calcAnalyze() override
Computation for analysis.
void showSynthesize() override
Shows analysis results and checks for errors / warnings.
bool isSelected(enum PRMS_ID aPrmId)
void Init()
Definition transline.cpp:76
void setResult(int, double, const char *)
double m_parameters[EXTRA_PRMS_COUNT]
Definition transline.h:142
virtual void getProperties()
@function getProperties
const char * m_Name
Definition transline.h:93
static char convertParameterStatusCode(TRANSLINE_STATUS aStatus)
Converts a TRANSLINE_PARAMETER status to a PCB Calculation status.
void setProperty(enum PRMS_ID aPrmId, double aValue)
void setErrorLevel(PRMS_ID, char)
@function setErrorLevel
@ SIGMA_PRM
Definition transline.h:71
@ DIELECTRIC_MODEL_PRM
Definition transline.h:77
@ EPSILONR_SPEC_FREQ_PRM
Definition transline.h:78
@ FREQUENCY_PRM
Definition transline.h:53
@ MURC_PRM
Definition transline.h:52
@ MUR_PRM
Definition transline.h:50
@ Z0_PRM
Definition transline.h:54
@ TAND_PRM
Definition transline.h:42
@ PHYS_LEN_PRM
Definition transline.h:62
@ ANG_L_PRM
Definition transline.h:57
@ EPSILONR_PRM
Definition transline.h:41