Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for the AC and SP analyses #690

Closed
wants to merge 137 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
94fc8e0
Merge branch 'release-0.0.19' into develop
felix-salfelder Sep 9, 2016
6fa7177
Merge pull request #499 from in3otd/issue_498
andresmmera Sep 22, 2016
57c3f61
Merge pull request #622 from Qucs/release-0.0.19
guitorri Dec 1, 2016
98ddde0
Added a Tutorial to design RF-Amplifiers using S-Parameter techniques…
gobers Nov 29, 2016
cc41a0f
added the example shematics and display files to the S-Parameter-Amp …
gobers Nov 30, 2016
a8c8104
Add new tutorial to makefiles
in3otd Dec 5, 2016
7be18a6
Merge pull request #620 from gogobers/stut
in3otd Jan 21, 2017
e076085
Merge pull request #642 from Qucs/release-0.0.19
guitorri Jan 22, 2017
d084f70
osx: merge patch, around multiple Qt installs
guitorri Jan 26, 2017
ab56a8d
osx: add back path to official qt binaries
guitorri Jan 28, 2017
dee8639
Merge pull request #647 from guitorri/fix-qt-osx-configure
guitorri Jan 28, 2017
f94d9a4
travis: OSX drop Qt4 installer use brew bottle
guitorri Jan 28, 2017
1c72384
Merge pull request #649 from guitorri/ci-osx-sierra
guitorri Jan 29, 2017
31c2d35
Circular waveguide component added
andresmmera Sep 13, 2015
d940a3d
filter: s/fabs/std:abs/g to fix warnings
guitorri Jan 30, 2017
6914464
activefilter: s/fabs/std:abs/g to fix warnings
guitorri Jan 30, 2017
a88bfcd
Merge branch 'rebase_CircWG' into develop
ra3xdh Jan 31, 2017
d8ce6e9
Added stripline synthesis/analysis code to Qucs Transcalc
andresmmera Apr 30, 2016
cd51964
Merge branch 'rebase_Transcalc-Stripline_to_develop' into develop
ra3xdh Feb 2, 2017
cfde55a
Extend EDD to 20 branches max.
ra3xdh Feb 1, 2017
7fb808e
Correct EDD description in docs
ra3xdh Feb 1, 2017
6c17575
Merge pull request #658 from ra3xdh/new_EDD
guitorri Feb 3, 2017
3e3e262
Merge pull request #655 from guitorri/fix-warnings-fabs
in3otd Feb 6, 2017
1bf9d77
qucs: s/absFilePath/absoluteFilePath/
guitorri Jan 31, 2017
4318df8
qucs: s/absPath/absolutePath/
guitorri Jan 31, 2017
9b3c1e8
qucs: use correct entryList overload
guitorri Jan 31, 2017
83369cf
qucs: s/isOn/isChecked/
guitorri Jan 31, 2017
2ba905e
qucs: rewrite addTo as addAction
guitorri Jan 31, 2017
575be8b
qucs: replace QMouseEvent state by button
guitorri Jan 31, 2017
3350f9f
qucs: replace s/dirPath(true)/absolutePath()/
guitorri Jan 31, 2017
2e7abd4
qucs: replace s/dirPath()/path()/
guitorri Jan 31, 2017
11989cf
qucs: replace QComboBox insertItem by addItem
guitorri Jan 31, 2017
7760b4f
qucs: replace setCurrentItem by setCurrentIndex
guitorri Jan 31, 2017
61b8e6a
qucs: replace s/currentItem()/currentIndex()/ when possible
guitorri Jan 31, 2017
0bf86eb
qucs: replace s/currentPage/currentWidget
guitorri Jan 31, 2017
586322f
qucs: s/setOn/setChecked
guitorri Jan 31, 2017
79672e5
qucs: s/>message/>showMessage/
guitorri Jan 31, 2017
2ace871
qucs: s/insertSeparator/addSeparator/
guitorri Jan 31, 2017
1e18c5a
qucs: replace .data by .value where possible
guitorri Jan 31, 2017
4c6da82
qucs: s/lineStep/singleStep
guitorri Jan 31, 2017
8ab07bd
qucs: s/findRev/lastIndexOf
guitorri Jan 31, 2017
fe9a6ab
qucs: s/setCurrentItem/setCurrentIndex/ when possible
guitorri Jan 31, 2017
8c094fb
qucs: diagramdialog use addWidget
guitorri Jan 31, 2017
99716dc
qucs: arrowdialog use addWidget
guitorri Jan 31, 2017
1663bf5
qucs: vasettingsdialog use addWidget
guitorri Jan 31, 2017
218364e
qucs: filldialog use addWidget
guitorri Jan 31, 2017
c9bbb74
qucs: sweepdialog use addWidget, small tweaks
guitorri Jan 31, 2017
c2bf2c1
sweepdialog: add some documentation
guitorri Jan 31, 2017
00f46f0
markerdialog: port addMulti*
guitorri Jan 31, 2017
26988e2
qucs: use setCaseSensitivity
guitorri Jan 31, 2017
11f0040
qucs: s/insertItem(tr/addItem(tr/
guitorri Jan 31, 2017
cd9af7f
qucs: ComboBox use addItem
guitorri Jan 31, 2017
68da3a9
mouseactions: fix addAction context menu
guitorri Jan 31, 2017
4ab2dab
qucs: port baseName and extension
guitorri Jan 31, 2017
626653f
qucs: s/setMenuText/setText
guitorri Jan 31, 2017
4ed185f
qucs: s/.read(/.readAll(/
guitorri Jan 31, 2017
5eb3007
qucs: s/findIndex/indexOf
guitorri Jan 31, 2017
d61e137
qucs: port setPaletteBackgroundColor
guitorri Jan 31, 2017
322b342
qucs: port paletteBackgroundColor
guitorri Jan 31, 2017
1563f59
qucs: port setPaletteForegroundColor
guitorri Jan 31, 2017
58c0442
libcomp: avoid dangling else
guitorri Jan 31, 2017
1ba6267
qucs: fix drawText
guitorri Jan 31, 2017
8fe6c40
packagedialog: port readBlock and writeBlock
guitorri Jan 31, 2017
52b060f
packagedialog: port at(##)
guitorri Jan 31, 2017
ac6f192
packagedialog: fix getSaveFileName, getOpenFileName
guitorri Jan 31, 2017
08fc3a0
qucs: use toPlainText
guitorri Jan 31, 2017
4b6c662
libdialog: use fileName
guitorri Jan 31, 2017
c08dd20
libdialog: use toPlainText
guitorri Jan 31, 2017
f6959a3
libdialog: use writeRawData
guitorri Jan 31, 2017
4b6983b
spicedialog: use itemText
guitorri Jan 31, 2017
ce9dd72
qucs_actions: use read and write
guitorri Jan 31, 2017
5575498
main: use fileName
guitorri Jan 31, 2017
5cb10f9
main: drop use of .ascii
guitorri Jan 31, 2017
0a0f32a
main: use homePath
guitorri Jan 31, 2017
66c659a
main: setMainWidget no longuer needed
guitorri Jan 31, 2017
15fa444
vasettingsdial: fix getOpenFileName
guitorri Jan 31, 2017
db56b9e
qucs_init: use addPermanentWidget
guitorri Jan 31, 2017
36864be
changedialog: port remainig issues
guitorri Jan 31, 2017
8ae812c
sweepdialog: use setColumnStretch
guitorri Jan 31, 2017
b42411e
savedial: use erase
guitorri Jan 31, 2017
9ba4713
components: use split correctly
guitorri Jan 31, 2017
1d4bc33
digisett: fix addButton and split
guitorri Jan 31, 2017
812e2ba
printer: fix use of Aborted
guitorri Jan 31, 2017
f066020
misc: fix use of split
guitorri Jan 31, 2017
5773893
actions: use setPointSizeF
guitorri Jan 31, 2017
2d26d31
qucsdoc: fix addAction
guitorri Feb 1, 2017
cd44439
qucs_actions: replace reparent
guitorri Feb 1, 2017
b960b9f
main: replace locale
guitorri Feb 1, 2017
a57a9ee
octave_win: convert Qstring to char *
guitorri Feb 1, 2017
9ba9770
qucs_init: fix messed up tr strings
guitorri Feb 1, 2017
bddd3b6
qucs: convert Qstring to char *
guitorri Feb 1, 2017
b4318ab
printer: update to setOptions
guitorri Feb 1, 2017
a6301de
qucs-help: update setVisible
guitorri Feb 1, 2017
5c9bce4
cmake: add -DQT_DEPRECATED_WARNINGS
guitorri Feb 2, 2017
33d8439
fix s/convertSeparators/toNativeSeparators
guitorri Feb 2, 2017
3b9a60b
autotools: add -DQT_DEPRECATED_WARNINGS
guitorri Feb 2, 2017
b6602a5
autotools:mac: add warning flags
guitorri Feb 2, 2017
c6b571c
qucs: s/convertSeparators/toNativeSeparators/
guitorri Feb 6, 2017
d7cb399
qucs_init: remove setCheckable
guitorri Feb 7, 2017
34e0bf5
ArrowDialog: fix deprecated QDialog signature
guitorri Feb 7, 2017
39fe896
savedialog: fix QDialog
guitorri Feb 7, 2017
c0a9086
markerdialog: fix QDialog
guitorri Feb 7, 2017
fba408b
diagramdialog: fix QDialog
guitorri Feb 7, 2017
ceb8b8f
spicedialog: fix QDialog
guitorri Feb 7, 2017
c799024
graphicstextdialog: fix QDialog
guitorri Feb 7, 2017
c85be24
diagramdialog: fix QSlider
guitorri Feb 7, 2017
9302d90
diagramdialog: fix QGridLayout
guitorri Feb 8, 2017
9a29ba6
arrowdialog: fix QGridLayout
guitorri Feb 8, 2017
14e8c21
filldialog: fix QGridLayout
guitorri Feb 8, 2017
2e9f7d1
savedialog: fix V and H layout
guitorri Feb 8, 2017
2ff0313
mouseactions: fix QMouseEvent
guitorri Feb 8, 2017
107ecc0
qucs: fix argc() and argv()
guitorri Feb 8, 2017
ecba220
spicedialog: fix QMessageBox
guitorri Feb 8, 2017
0c8ef46
simmessage: fix toAscii
guitorri Feb 8, 2017
8ba9d11
Merge pull request #662 from guitorri/fix-warnings-qt3support
in3otd Feb 19, 2017
c7b1883
Remove qucs-edit.
guitorri Feb 6, 2016
a2254db
qucsedit: remove hardcoded reference
guitorri Jan 30, 2017
39df04e
main: set main editor, load/save user editor
guitorri Jan 30, 2017
099307c
Move .xpm icon code to bitmaps
guitorri Jan 30, 2017
c61fcd6
editor: let editFile handle also slotTextNew
guitorri Jan 30, 2017
07dbd75
handle open text from Contents tab
guitorri Jan 30, 2017
aa2cac0
slotTextNew, update comment
guitorri Feb 10, 2017
72b5d2d
Improve handling of built-in or external editor
guitorri Feb 10, 2017
9d4b134
Merge pull request #652 from guitorri/remove-qucs-edit
in3otd Feb 19, 2017
31f80c2
Added documentation for the rectangular and circular waveguides
Mar 18, 2017
b27c514
Correct handling of mouse buttons modifiers
in3otd May 6, 2017
deb4663
Remove parent from non-top-level layout to avoid warning
in3otd May 6, 2017
bd1b518
Merge branch 'in3otd-small_gui_stuff' into develop
felix-salfelder May 6, 2017
81d72d7
Fix spurious new line in examples/opamp_gyrator.sch
chgans May 16, 2017
39951ce
Merge pull request #685 from chgans/fix-example-1
ra3xdh May 16, 2017
a82a158
Qucsactivefilter: Legendre filter added
Apr 2, 2017
e488ca3
Fixed autotools build
ra3xdh Jun 4, 2017
861dc89
Added note on Legendre filter in documentation
ra3xdh Jun 7, 2017
ef2ca50
Correct typo
ra3xdh Jun 25, 2017
0701c02
Use dB magnitude response for all topologies
ra3xdh Jun 25, 2017
73cfa71
Merge pull request #688 from ra3xdh/legendre
in3otd Jun 25, 2017
befa336
Merge pull request #680 from andresmmera/Waveguide-Documentation
ra3xdh Jun 26, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ CMakeLists.txt.user
# except in the examples/ directory
!examples/*.sch
!examples/*.dpl
!qucs-doc/tutorial/sparameteramp/*/*.sch
!qucs-doc/tutorial/sparameteramp/*/*.dpl

# Xcode #
#########
Expand Down
19 changes: 9 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ python:
virtualenv:
system_site_packages: true

# Force OSX 10.10 as Qt 4.8.7 installer does not work with OSX 10.11
osx_image: xcode6.4
# Qt 4.8.7 official installer works up to OSX 10.10 or xcode6.4
# Use rebuilt (with Qt3Support) homebrew bottle for OSX 10.12 or xcode8.2
osx_image: xcode8.2

matrix:
exclude:
Expand Down Expand Up @@ -122,14 +123,12 @@ install:
brew install adms;
fi

# Install official Qt (185MB)
# Homebrew Qt binary has no Qt3Support (build from souce takes hours)
# The Qt4 brew bottles from github.com/cartr/homebrew-qt4 do not include Qt3Support
# Below is a rebuild bottle that does include Qt3Support, skip-relocate to manually install into cellar
- if [[ $OSX ]]; then
QT_VERSION=4.8.7 ;
curl -L -O http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-opensource-mac-${QT_VERSION}.dmg ;
hdiutil mount qt-opensource-mac-${QT_VERSION}.dmg ;
sudo installer -pkg /Volumes/Qt\ 4.8.7/Qt.mpkg -target / ;
hdiutil unmount /Volumes/Qt\ 4.8.7 ;
curl -L -O https://dl.bintray.com/guitorri/qucs/qt-4.8.7_3.sierra.bottle.2.tar.gz ;
tar -C $(brew --cellar) -xvf qt-4.8.7_3.sierra.bottle.2.tar.gz ;
brew link --force qt ;
fi

script:
Expand Down Expand Up @@ -176,7 +175,7 @@ script:
- echo ${CONFIGURE_FLAGS}
- echo ${DISTCHECK_CONFIGURE_FLAGS}
- ./configure --disable-dependency-tracking --with-gtest=/tmp/gtest ${CONFIGURE_FLAGS}
- if [ "$OSX" = true ]; then
- if [[ $OSX ]]; then
make;
make qucscheck;
else
Expand Down
1 change: 1 addition & 0 deletions qucs-core/src/components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ SET( COMPONENTS_SRC
capacitor.cpp
cccs.cpp
ccvs.cpp
circline.cpp
circulator.cpp
coaxline.cpp
coupler.cpp
Expand Down
4 changes: 2 additions & 2 deletions qucs-core/src/components/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ libcomponent_la_SOURCES = attenuator.cpp dcblock.cpp open.cpp vccs.cpp \
vvnoise.cpp ivnoise.cpp coupler.cpp coaxline.cpp vprobe.cpp vam.cpp \
vpm.cpp tswitch.cpp relais.cpp short.cpp twistedpair.cpp tline4p.cpp \
vexp.cpp iexp.cpp mutualx.cpp vfile.cpp ifile.cpp rfedd.cpp \
rectline.cpp rlcg.cpp hybrid.cpp ctline.cpp ecvs.cpp
rectline.cpp rlcg.cpp hybrid.cpp ctline.cpp ecvs.cpp circline.cpp

pkginclude_HEADERS = component.h components.h component_id.h

Expand All @@ -52,7 +52,7 @@ noinst_HEADERS = attenuator.h dcblock.h open.h vccs.h biastee.h circulator.h \
tswitch.h relais.h short.h twistedpair.h tline4p.h vexp.h iexp.h \
mutualx.h vfile.h ifile.h rfedd.h rectline.h components.h rlcg.h \
hybrid.h ctline.h ecvs.h \
component.h components.h component_id.h
component.h components.h component_id.h circline.h

AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/math

Expand Down
294 changes: 294 additions & 0 deletions qucs-core/src/components/circline.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
/*
* circline.cpp - Circular waveguide TE11 mode implementation
*
* copyright (C) 2015 Andres Martinez-Mera <andresmartinezmera@gmail.com>
*
* This 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, or (at your option)
* any later version.
*
* This software 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.
*
*
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif

#include "component.h"
#include "circline.h"

/*
References:
Microwave Engineering. David M Pozar. John Wiley and Sons. 4th Edition. Pg 121-130
Fundation for Microwave Engineering. IEEE Press. Robert E. Collin. 2d edition. Pg 194-198
1992
*/


using namespace qucs;

circline::circline () : circuit (2) {
alpha = beta = fc_low = fc_high = 0.0;
zl = 0.0;
type = CIR_CIRCULAR;
}

void circline::calcResistivity (const char * const Mat, nr_double_t T) {
if (!strcmp (Mat, "Copper")) {
if (T < 7) {
rho = 2e-11;
}
else if (T < 15) {
rho = 6.66667e-17 * qucs::pow (T, 5.0) - 3.88549e-15 * qucs::pow (T, 4.0) +
9.82267e-14 * qucs::pow (T, 3.0) - 1.29684e-12 * qucs::pow (T, 2.0) +
8.68341e-12 * T - 2.72120e-12;
}
else if (T < 45) {
rho = 6.60731e-15 * qucs::pow (T, 3.0) - 1.14812e-13 * qucs::pow (T, 2.0) -
1.11681e-12 * T + 4.23709e-11;
}
else if (T < 100) {
rho = -6.53059e-15 * qucs::pow (T, 3.0) + 1.73783e-12 * qucs::pow (T, 2.0) -
8.73888e-11 * T + 1.37016e-9;
}
else if (T < 350) {
rho = 1.00018e-17 * qucs::pow (T, 3.0) - 8.72408e-15 * qucs::pow (T, 2.0) +
7.06020e-11 * T - 3.51125e-9;
}
else {
rho = 0.000000020628;
}
// in ADS iT_K is forced T_Ko Cu_300K:
//rho = 1.7e-8;
}
else if (!strcmp (Mat, "StainlessSteel")) {
rho = 7.4121e-17 * qucs::pow (T, 4.0) - 5.3504e-14 * qucs::pow (T, 3.0) +
1.2902e-11 * qucs::pow (T, 2.0) - 2.9186e-10 * T +4.9320e-7;
}
else if (!strcmp (Mat, "Gold")) {
if (T < 20) {
rho = 0.00000000024;
}
else if (T < 65) {
rho = 2e-12 * qucs::pow (T, 2.0) - 8e-11 * T + 1e-9;
}
else if (T < 80) {
rho = 5e-13 * qucs::pow (T, 3.0) - 1e-10 * qucs::pow (T, 2.0) + 9e-9 * T - 2e-7;
}
else if (T < 300) {
rho = 8e-11 * T - 1e-10;
}
else {
rho = 2.4e-8;
}
}
}

/*! Compute propagation constant

According to [1] table 3.2 p 128
Wawe number in vacuum is:
\f[
k=\omega\sqrt{\mu\varepsilon}=\omega\sqrt{\mu_r \varepsilon_r \mu_0 \varepsilon_0}
\f]
Where \f$\omega=2\pi f\f$, \f$f\f$ is the frequency, $\f\mu\f$ the magnetic permeability,
\f$\varepsilon_r\f$ the permitivity. Using well known formula \f$c^2\mu_0\varepsilon_0=1\f$, we found:
\f[
k=\frac{\omega}{c} std::sqrt{\mu_r \varepsilon_r}
\f]
In general case \f$k_c\f$ is:
\f[
k_c = p_{nm}/a
\f]
where p_{nm} are given in Table 3.3 (Pg 123) and in table 3.4 (126) for the TE and TM modes, respectively.
The propagation constant is:
\f[
\beta = \sqrt{k^2 - k_c^2}
\f]
Loss could be divised in dielectric and resistive loss.
Dielectric loss are computed using:
\f[
\alpha_d = \frac{k^2 \tan \delta}{2\beta}
\f]
The attenuation constant for he TE11
\f[
\alpha_c= \frac{rs}{ak\eta\beta} \left( k_c^2 + \frac{k^2}{p'_{11}}\right)
\f]
Wave impedance is for TE11:
\f[
Z = \frac{k Z_0}{\beta}
where Z_0 = \sqrt{\frac{\mu_0 \mu_r}{\epsilon_0 \epsilon_r}}
\f]
*/
void circline::calcPropagation (nr_double_t frequency) {
nr_double_t er = getPropertyDouble ("er");//Dielectric permittivity
nr_double_t mur = getPropertyDouble ("mur");//Dielectric permeability
nr_double_t tand = getPropertyDouble ("tand");//Dielectric loss
nr_double_t a = getPropertyDouble ("a");//Radius

/* wave number */
nr_double_t k0;
nr_double_t kc;

nr_double_t ad, ac, rs;

// check cutoff frequency

if (frequency >= fc_high) {
logprint (LOG_ERROR, "WARNING: Operating frequency (%g) outside TE11 "
"band (%g <= TE11 <= %g) or outside non propagative mode "
"<= %g\n", frequency, fc_low, fc_high, fc_low);
}
// calculate wave number
k0 = (2.0 * pi * frequency * std::sqrt (E0 * er * MU0*mur));
kc = pe11 / a;//TE11 mode

// calculate losses only for propagative mode
if (frequency >= fc_low) {
// calculate beta
beta = std::sqrt (sqr (k0) - sqr (kc));//Propagation constant

// dielectric
ad = (sqr(k0) * tand) / (2.0 * beta);
// resistive
rs = std::sqrt (pi * frequency * mur * MU0 * rho);
ac = (rs/(a*k0*Z0*std::sqrt(mur/er)*beta))*(kc*kc + (k0*k0)/(pe11*pe11 - 1));//Conductor attenuation for the TE11 mode
alpha = (ad + ac);

// wave impedance for TE11
zl = (k0 * Z0* std::sqrt(mur/er)) / beta;

} else {//Evanescent modes
beta = 0;
alpha = std::sqrt (- (sqr (k0) - sqr (kc)));
// wave impedance
zl = (k0 * Z0 * std::sqrt(mur/er)) / nr_complex_t (0, alpha) ;
//Evanescent modes have an imaginary propagation constant, so they do not carry energy (they vanish). Eq. 203 Collins
}
}

/*! Compute noise parameter */
void circline::calcNoiseSP (nr_double_t) {
nr_double_t l = getPropertyDouble ("L");//Length
if (l < 0) return;
// calculate noise using Bosma's theore
nr_double_t T = getPropertyDouble ("Temp");
matrix s = getMatrixS ();
matrix e = eye (getSize ());
setMatrixN (celsius2kelvin (T) / T0 * (e - s * transpose (conj (s))));
}

/*! Check validity of parameter and compute cutoff frequencies
\note do not check validity of epsr or mur because some research stuff could use epsr < 1 (plasma)
*/
void circline::initCheck (void) {
nr_double_t a = getPropertyDouble ("a");//Radius
nr_double_t epsr = getPropertyDouble ("er");//Relative permittivity
nr_double_t mur = getPropertyDouble ("mur");//Relative permeability

if (a < 0) logprint (LOG_ERROR, "ERROR: The radius, 'a', must be positive!.\n");// checking if the radius is > 0
fc_low = (pe11*C0)/(2*pi*a*std::sqrt(mur*epsr));// Below this frequency, the modes do not propagate (evanescent modes)
fc_high = (pm01*C0)/(2*pi*a*std::sqrt(mur*epsr));//In most cases, the circular waveguide operation is limited to TE11.
//So, it is of interest to determine the range in which only TE11 is propagating.
//When using circular waveguides, the upper cutoff frequency is given by the TM01 mode
rho = getPropertyDouble ("rho");//Resitivity
nr_double_t T = getPropertyDouble ("Temp");//Temperature
calcResistivity (getPropertyString ("Material"), celsius2kelvin (T));//Temperature calculation
}

void circline::saveCharacteristics (nr_complex_t) {
setCharacteristic ("Zl", real (zl));
}

/*! initialize S-parameters */
void circline::initSP (void) {
// allocate S-parameter matrix
allocMatrixS ();
initCheck ();
}

/*! Compute S parameter use generic transmission line formulae */
void circline::calcSP (nr_double_t frequency) {
nr_double_t l = getPropertyDouble ("L");

// calculate propagation constants
calcPropagation (frequency);

// calculate S-parameters Reference: http://qucs.sourceforge.net/tech/node61.html
nr_complex_t z = zl / z0;
nr_complex_t y = 1.0 / z;
nr_complex_t g = nr_complex_t (alpha, beta);
nr_complex_t n = 2.0 * cosh (g * l) + (z + y) * sinh (g * l);
nr_complex_t s11 = (z - y) * sinh (g * l) / n;
nr_complex_t s21 = 2.0 / n;
setS (NODE_1, NODE_1, s11); setS (NODE_2, NODE_2, s11);
setS (NODE_1, NODE_2, s21); setS (NODE_2, NODE_1, s21);

}

/* ! Compute DC
\note below cut off it is an open circuit
*/
void circline::initDC (void) {
allocMatrixMNA ();
// open circuit
clearY ();
}

/*! init AC */
void circline::initAC (void) {
setVoltageSources (0);
allocMatrixMNA ();
initCheck ();
}

/*! calc propagation using classical transmission line formulae */
void circline::calcAC (nr_double_t frequency) {
nr_double_t l = getPropertyDouble ("L");

// calculate propagation constants
calcPropagation (frequency);

// calculate Y-parameters
nr_complex_t g = nr_complex_t (alpha, beta);
nr_complex_t y11 = coth (g * l) / zl;
nr_complex_t y21 = -cosech (g * l) / zl;
setY (NODE_1, NODE_1, y11); setY (NODE_2, NODE_2, y11);
setY (NODE_1, NODE_2, y21); setY (NODE_2, NODE_1, y21);
}

/*! Compute noise */
void circline::calcNoiseAC (nr_double_t) {
nr_double_t l = getPropertyDouble ("L");
if (l < 0) return;
// calculate noise using Bosma's theorem
nr_double_t T = getPropertyDouble ("Temp");
setMatrixN (4.0 * celsius2kelvin (T) / T0 * real (getMatrixY ()));
}

// properties
PROP_REQ [] = {
{ "a", PROP_REAL, { 2.86e-2, PROP_NO_STR }, PROP_POS_RANGEX },
{ "L", PROP_REAL, { 1500e-3, PROP_NO_STR }, PROP_NO_RANGE },
{ "er", PROP_REAL, { 1, PROP_NO_STR }, PROP_RNGII (1, 100) },
{ "mur", PROP_REAL, { 1, PROP_NO_STR }, PROP_RNGII (1, 100) },
{ "tand", PROP_REAL, { 4e-4, PROP_NO_STR }, PROP_POS_RANGE },
{ "rho", PROP_REAL, { 0.022e-6, PROP_NO_STR }, PROP_POS_RANGE },
PROP_NO_PROP };
PROP_OPT [] = {
{ "Temp", PROP_REAL, { 26.85, PROP_NO_STR }, PROP_MIN_VAL (K) },
{ "Material", PROP_STR, { PROP_NO_VAL, "unspecified" },
PROP_RNG_STR4 ("unspecified", "Copper", "StainlessSteel", "Gold") },
PROP_NO_PROP };
struct define_t circline::cirdef =
{ "CIRCLINE", 2, PROP_COMPONENT, PROP_NO_SUBSTRATE, PROP_LINEAR, PROP_DEF };
Loading