My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cpwopen.cpp
Go to the documentation of this file.
1 /*
2  * cpwopen.cpp - coplanar waveguide open end 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: cpwopen.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 "cpwopen.h"
33 
34 cpwopen::cpwopen () : circuit (1) {
35  type = CIR_CPWOPEN;
36 }
37 
38 // Returns the coplanar open end capacitance.
39 nr_double_t cpwopen::calcCend (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) / 2;
55  return dl * ErEffFreq / C0 / ZlEffFreq;
56 }
57 
58 void cpwopen::initSP (void) {
59  allocMatrixS ();
60  checkProperties ();
61 }
62 
63 void cpwopen::calcSP (nr_double_t frequency) {
64  setS (NODE_1, NODE_1, ztor (1.0 / calcY (frequency)));
65 }
66 
68  nr_double_t W = getPropertyDouble ("W");
69  nr_double_t s = getPropertyDouble ("S");
70  nr_double_t g = getPropertyDouble ("G");
71  if (g <= W + s + s) {
72  logprint (LOG_ERROR, "WARNING: Model for coplanar open end valid for "
73  "g > 2b (2b = %g)\n", W + s + s);
74  }
75  nr_double_t ab = W / (W + s + s);
76  if (ab < 0.2 || ab > 0.8) {
77  logprint (LOG_ERROR, "WARNING: Model for coplanar open end valid for "
78  "0.2 < a/b < 0.8 (a/b = %g)\n", ab);
79  }
80 }
81 
82 nr_complex_t cpwopen::calcY (nr_double_t frequency) {
83  nr_double_t o = 2 * M_PI * frequency;
84  nr_double_t c = calcCend (frequency);
85  return rect (0, c * o);
86 }
87 
88 void cpwopen::initDC (void) {
89  allocMatrixMNA ();
90  setY (NODE_1, NODE_1, 0);
91 }
92 
93 void cpwopen::initAC (void) {
94  allocMatrixMNA ();
95  checkProperties ();
96 }
97 
98 void cpwopen::calcAC (nr_double_t frequency) {
99  setY (NODE_1, NODE_1, calcY (frequency));
100 }
101 
102 // properties
103 PROP_REQ [] = {
104  { "W", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
105  { "S", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
106  { "G", PROP_REAL, { 5e-3, PROP_NO_STR }, PROP_POS_RANGE },
107  { "Subst", PROP_STR, { PROP_NO_VAL, "Subst1" }, PROP_NO_RANGE },
108  PROP_NO_PROP };
109 PROP_OPT [] = {
110  { "Backside", PROP_STR, { PROP_NO_VAL, "Metal" },
111  PROP_RNG_STR2 ("Metal", "Air") },
112  PROP_NO_PROP };
113 struct define_t cpwopen::cirdef =