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. If not, see <https://www.gnu.org/licenses/>.
20 *
21 */
22
23#include <cmath>
24
25#include "rectwaveguide.h"
26#include "units.h"
27
28
30{
31 m_Name = "RectWaveGuide";
32 Init();
33}
34
35
57
58
60{
61 m_calc.Analyse();
62}
63
64
69
70
72{
73 std::unordered_map<TRANSLINE_PARAMETERS, std::pair<double, TRANSLINE_STATUS>>& results =
74 m_calc.GetAnalysisResults();
75
78
85}
86
87
89{
90 std::unordered_map<TRANSLINE_PARAMETERS, std::pair<double, TRANSLINE_STATUS>>& results =
91 m_calc.GetSynthesisResults();
92
93 if( isSelected( PHYS_A_PRM ) )
95
96 if( isSelected( PHYS_B_PRM ) )
98
100
107}
108
109
111{
112 std::unordered_map<TRANSLINE_PARAMETERS, std::pair<double, TRANSLINE_STATUS>>& results =
113 m_calc.GetAnalysisResults();
114
115 // Field-quantity impedance Z0EH = Ey / Hx for TE10 above cutoff, matching the legacy
116 // "ZF(H10) = Ey / Hx:" row. In terms of the analysis outputs, Z0EH = ZF0 / sqrt(eps_eff)
117 // (eps_eff = 1 - (fc/f)^2 here). Below cutoff eps_eff is 0 and we fall back to zero.
118 const double epsEff = results[TRANSLINE_PARAMETERS::EPSILON_EFF].first;
119 const double z0eh = ( epsEff > 0.0 ) ? 376.730313668 / std::sqrt( epsEff ) : 0.0;
120
121 setResult( 0, z0eh, "Ohm" );
122 setResult( 1, results[TRANSLINE_PARAMETERS::EPSILON_EFF].first, "" );
123 setResult( 2, results[TRANSLINE_PARAMETERS::LOSS_CONDUCTOR].first, "dB" );
124 setResult( 3, results[TRANSLINE_PARAMETERS::LOSS_DIELECTRIC].first, "dB" );
125
126 std::string teText = m_calc.GetTEModes();
127 std::string tmText = m_calc.GetTMModes();
128
129 if( teText.empty() )
130 teText = "none";
131
132 if( tmText.empty() )
133 tmText = "none";
134
135 setResult( 4, teText.c_str() );
136 setResult( 5, tmText.c_str() );
137}
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:74
void setResult(int, double, const char *)
double m_parameters[EXTRA_PRMS_COUNT]
Definition transline.h:140
virtual void getProperties()
@function getProperties
const char * m_Name
Definition transline.h:91
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:69
@ DIELECTRIC_MODEL_PRM
Definition transline.h:75
@ EPSILONR_SPEC_FREQ_PRM
Definition transline.h:76
@ FREQUENCY_PRM
Definition transline.h:51
@ MURC_PRM
Definition transline.h:50
@ MUR_PRM
Definition transline.h:48
@ Z0_PRM
Definition transline.h:52
@ TAND_PRM
Definition transline.h:40
@ PHYS_LEN_PRM
Definition transline.h:60
@ ANG_L_PRM
Definition transline.h:55
@ EPSILONR_PRM
Definition transline.h:39