Branch data Line data Source code
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$
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 : : using namespace qucs;
34 : :
35 : 0 : cpwgap::cpwgap () : circuit (2) {
36 : 0 : type = CIR_CPWGAP;
37 : 0 : }
38 : :
39 : 0 : void cpwgap::calcSP (nr_double_t frequency) {
40 [ # # ][ # # ]: 0 : setMatrixS (ytos (calcMatrixY (frequency)));
[ # # ][ # # ]
[ # # ]
41 : 0 : }
42 : :
43 : 0 : matrix cpwgap::calcMatrixY (nr_double_t frequency) {
44 : :
45 [ # # ]: 0 : nr_double_t W = getPropertyDouble ("W");
46 [ # # ]: 0 : nr_double_t g = getPropertyDouble ("G");
47 [ # # ]: 0 : substrate * subst = getSubstrate ();
48 [ # # ]: 0 : nr_double_t er = subst->getPropertyDouble ("er");
49 : :
50 : : // calculate series capacitance
51 : 0 : er = (er + 1) / 2;
52 : 0 : nr_double_t p = g / 4 / W;
53 : : nr_double_t C = 2 * E0 * er * W / M_PI *
54 : 0 : (p - std::sqrt (1 + p * p) + std::log ((1 + std::sqrt (1 + p * p)) / p));
55 : :
56 : : // build Y-parameter matrix
57 : 0 : nr_complex_t y11 = nr_complex_t (0.0, 2.0 * M_PI * frequency * C);
58 [ # # ]: 0 : matrix y (2);
59 [ # # ]: 0 : y.set (0, 0, +y11);
60 [ # # ]: 0 : y.set (0, 1, -y11);
61 [ # # ]: 0 : y.set (1, 0, -y11);
62 [ # # ]: 0 : y.set (1, 1, +y11);
63 : 0 : return y;
64 : : }
65 : :
66 : 0 : void cpwgap::initDC (void) {
67 : 0 : allocMatrixMNA ();
68 : 0 : clearY ();
69 : 0 : }
70 : :
71 : 0 : void cpwgap::calcAC (nr_double_t frequency) {
72 [ # # ]: 0 : setMatrixY (calcMatrixY (frequency));
73 : 0 : }
74 : :
75 : : // properties
76 : : PROP_REQ [] = {
77 : : { "W", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
78 : : { "G", PROP_REAL, { 5e-4, PROP_NO_STR }, PROP_POS_RANGE },
79 : : { "Subst", PROP_STR, { PROP_NO_VAL, "Subst1" }, PROP_NO_RANGE },
80 : : PROP_NO_PROP };
81 : : PROP_OPT [] = {
82 : : { "S", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
83 : : PROP_NO_PROP };
84 : : struct define_t cpwgap::cirdef =
85 : : { "CGAP", 2, PROP_COMPONENT, PROP_NO_SUBSTRATE, PROP_LINEAR, PROP_DEF };
|