My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cpwshort.cpp
Go to the documentation of this file.
1 /*
2  * cpwshort.cpp - coplanar waveguide short class implementation
3  *
4  * Copyright (C) 2005, 2008 Stefan Jahn <stefan@lkcc.org>
5  *
6  * This is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this package; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  * $Id: cpwshort.cpp 1825 2011-03-11 20:42:14Z ela $
22  *
23  */
24 
25 #if HAVE_CONFIG_H
26 # include <config.h>
27 #endif
28 
29 #include "component.h"
30 #include "substrate.h"
31 #include "cpwline.h"
32 #include "cpwshort.h"
33 
34 cpwshort::cpwshort () : circuit (1) {
35  type = CIR_CPWSHORT;
36 }
37 
38 // Returns the coplanar short inductance.
39 nr_double_t cpwshort::calcLend (nr_double_t frequency) {
40 
41  // get properties of substrate and coplanar open
42  nr_double_t W = getPropertyDouble ("W");
43  nr_double_t s = getPropertyDouble ("S");
44  substrate * subst = getSubstrate ();
45  nr_double_t er = subst->getPropertyDouble ("er");
46  nr_double_t h = subst->getPropertyDouble ("h");
47  nr_double_t t = subst->getPropertyDouble ("t");
48  int backMetal = !strcmp (getPropertyString ("Backside"), "Metal");
49 
50  nr_double_t ZlEff, ErEff, ZlEffFreq, ErEffFreq;
51  cpwline::analyseQuasiStatic (W, s, h, t, er, backMetal, ZlEff, ErEff);
52  cpwline::analyseDispersion (W, s, h, er, ZlEff, ErEff, frequency,
53  ZlEffFreq, ErEffFreq);
54  nr_double_t dl = (W / 2 + s) / 4;
55  return dl * ErEffFreq / C0 * ZlEffFreq;
56 }
57 
58 void cpwshort::initSP (void) {
59  allocMatrixS ();
60  checkProperties ();
61 }
62 
63 void cpwshort::calcSP (nr_double_t frequency) {
64  setS (NODE_1, NODE_1, ztor (calcZ (frequency)));
65 }
66 
68  nr_double_t s = getPropertyDouble ("S");
69  substrate * subst = getSubstrate ();
70  nr_double_t t = subst->getPropertyDouble ("t");
71  if (t >= s / 3) {
72  logprint (LOG_ERROR, "WARNING: Model for coplanar short valid for "
73  "t < s/3 (s/3 = %g)\n", s / 3);
74  }
75 }
76 
77 nr_complex_t cpwshort::calcZ (nr_double_t frequency) {
78  nr_double_t o = 2 * M_PI * frequency;
79  nr_double_t l = calcLend (frequency);
80  return rect (0, l * o);
81 }
82 
83 void cpwshort::initDC (void) {
86  allocMatrixMNA ();
87  setY (NODE_1, NODE_1, 0);
88  setB (NODE_1, VSRC_1, 1);
89  setC (VSRC_1, NODE_1, 1);
90  setD (VSRC_1, VSRC_1, 0);
91  setE (VSRC_1, 0);
92 }
93 
94 void cpwshort::initAC (void) {
96  allocMatrixMNA ();
97  checkProperties ();
98 }
99 
100 void cpwshort::calcAC (nr_double_t frequency) {
101  setY (NODE_1, NODE_1, 1.0 / calcZ (frequency));
102 }
103 
104 // properties
105 PROP_REQ [] = {
106  { "W", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
107  { "S", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
108  { "Subst", PROP_STR, { PROP_NO_VAL, "Subst1" }, PROP_NO_RANGE },
109  PROP_NO_PROP };
110 PROP_OPT [] = {
111  { "Backside", PROP_STR, { PROP_NO_VAL, "Metal" },
112  PROP_RNG_STR2 ("Metal", "Air") },
113  PROP_NO_PROP };
114 struct define_t cpwshort::cirdef =