My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cpwgap.cpp
Go to the documentation of this file.
1 /*
2  * cpwgap.cpp - coplanar waveguide gap 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: cpwgap.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 "cpwgap.h"
32 
33 cpwgap::cpwgap () : circuit (2) {
34  type = CIR_CPWGAP;
35 }
36 
37 void cpwgap::calcSP (nr_double_t frequency) {
38  setMatrixS (ytos (calcMatrixY (frequency)));
39 }
40 
41 matrix cpwgap::calcMatrixY (nr_double_t frequency) {
42 
43  nr_double_t W = getPropertyDouble ("W");
44  nr_double_t g = getPropertyDouble ("G");
45  substrate * subst = getSubstrate ();
46  nr_double_t er = subst->getPropertyDouble ("er");
47 
48  // calculate series capacitance
49  er = (er + 1) / 2;
50  nr_double_t p = g / 4 / W;
51  nr_double_t C = 2 * E0 * er * W / M_PI *
52  (p - sqrt (1 + p * p) + log ((1 + sqrt (1 + p * p)) / p));
53 
54  // build Y-parameter matrix
55  nr_complex_t y11 = rect (0.0, 2.0 * M_PI * frequency * C);
56  matrix y (2);
57  y.set (0, 0, +y11);
58  y.set (0, 1, -y11);
59  y.set (1, 0, -y11);
60  y.set (1, 1, +y11);
61  return y;
62 }
63 
64 void cpwgap::initDC (void) {
65  allocMatrixMNA ();
66  clearY ();
67 }
68 
69 void cpwgap::calcAC (nr_double_t frequency) {
70  setMatrixY (calcMatrixY (frequency));
71 }
72 
73 // properties
74 PROP_REQ [] = {
75  { "W", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
76  { "G", PROP_REAL, { 5e-4, PROP_NO_STR }, PROP_POS_RANGE },
77  { "Subst", PROP_STR, { PROP_NO_VAL, "Subst1" }, PROP_NO_RANGE },
78  PROP_NO_PROP };
79 PROP_OPT [] = {
80  { "S", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
81  PROP_NO_PROP };
82 struct define_t cpwgap::cirdef =