Qucs-core  0.0.18
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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$
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 cpwgap::cpwgap () : circuit (2) {
36  type = CIR_CPWGAP;
37 }
38 
39 void cpwgap::calcSP (nr_double_t frequency) {
40  setMatrixS (ytos (calcMatrixY (frequency)));
41 }
42 
43 matrix cpwgap::calcMatrixY (nr_double_t frequency) {
44 
45  nr_double_t W = getPropertyDouble ("W");
46  nr_double_t g = getPropertyDouble ("G");
48  nr_double_t er = subst->getPropertyDouble ("er");
49 
50  // calculate series capacitance
51  er = (er + 1) / 2;
52  nr_double_t p = g / 4 / W;
53  nr_double_t C = 2 * E0 * er * W / M_PI *
54  (p - std::sqrt (1 + p * p) + std::log ((1 + std::sqrt (1 + p * p)) / p));
55 
56  // build Y-parameter matrix
57  nr_complex_t y11 = nr_complex_t (0.0, 2.0 * M_PI * frequency * C);
58  matrix y (2);
59  y.set (0, 0, +y11);
60  y.set (0, 1, -y11);
61  y.set (1, 0, -y11);
62  y.set (1, 1, +y11);
63  return y;
64 }
65 
66 void cpwgap::initDC (void) {
67  allocMatrixMNA ();
68  clearY ();
69 }
70 
71 void cpwgap::calcAC (nr_double_t frequency) {
72  setMatrixY (calcMatrixY (frequency));
73 }
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 =
std::complex< nr_double_t > nr_complex_t
Definition: complex.h:31
#define PROP_POS_RANGE
Definition: netdefs.h:129
PROP_REQ[]
Definition: cpwgap.cpp:76
void clearY(void)
Definition: circuit.cpp:740
matrix ytos(matrix y, qucs::vector z0)
Admittance matrix to scattering parameters.
Definition: matrix.cpp:1133
substrate * subst
Definition: circuit.h:350
#define PROP_DEF
Definition: netdefs.h:189
nr_double_t getPropertyDouble(const char *)
Definition: object.cpp:176
#define C(c)
Definition: eqndefined.cpp:73
#define E0
Electric constant of vacuum .
Definition: constants.h:51
#define PROP_REAL
Definition: netdefs.h:174
substrate * getSubstrate(void)
Definition: circuit.cpp:332
#define PROP_NO_PROP
Definition: netdefs.h:122
#define PROP_NO_RANGE
Definition: netdefs.h:126
#define PROP_NO_STR
Definition: netdefs.h:125
#define PROP_LINEAR
Definition: netdefs.h:120
void calcSP(nr_double_t)
Definition: cpwgap.cpp:39
nr_complex_t sqrt(const nr_complex_t z)
Compute principal value of square root.
Definition: complex.cpp:271
void calcAC(nr_double_t)
Definition: cpwgap.cpp:71
#define PROP_COMPONENT
Definition: netdefs.h:116
void setMatrixY(matrix)
Definition: circuit.cpp:685
#define M_PI
Archimedes' constant ( )
Definition: consts.h:47
PROP_NO_SUBSTRATE
Definition: cpwgap.cpp:85
void setMatrixS(matrix)
Definition: circuit.cpp:643
PROP_OPT[]
Definition: cpwgap.cpp:81
void allocMatrixMNA(void)
Definition: circuit.cpp:267
#define PROP_STR
Definition: netdefs.h:175
y
Definition: parse_mdl.y:499
#define PROP_NO_VAL
Definition: netdefs.h:124
nr_complex_t log(const nr_complex_t z)
Compute principal value of natural logarithm of z.
Definition: complex.cpp:215
void initDC(void)
Definition: cpwgap.cpp:66
qucs::matrix calcMatrixY(nr_double_t)
Definition: cpwgap.cpp:43