Qucs-core  0.0.18
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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$
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 using namespace qucs;
35 
36 cpwopen::cpwopen () : circuit (1) {
37  type = CIR_CPWOPEN;
38 }
39 
40 // Returns the coplanar open end capacitance.
41 nr_double_t cpwopen::calcCend (nr_double_t frequency) {
42 
43  // get properties of substrate and coplanar open
44  nr_double_t W = getPropertyDouble ("W");
45  nr_double_t s = getPropertyDouble ("S");
47  nr_double_t er = subst->getPropertyDouble ("er");
48  nr_double_t h = subst->getPropertyDouble ("h");
49  nr_double_t t = subst->getPropertyDouble ("t");
50  int backMetal = !strcmp (getPropertyString ("Backside"), "Metal");
51 
52  nr_double_t ZlEff, ErEff, ZlEffFreq, ErEffFreq;
53  cpwline::analyseQuasiStatic (W, s, h, t, er, backMetal, ZlEff, ErEff);
54  cpwline::analyseDispersion (W, s, h, er, ZlEff, ErEff, frequency,
55  ZlEffFreq, ErEffFreq);
56  nr_double_t dl = (W / 2 + s) / 2;
57  return dl * ErEffFreq / C0 / ZlEffFreq;
58 }
59 
60 void cpwopen::initSP (void) {
61  allocMatrixS ();
62  checkProperties ();
63 }
64 
65 void cpwopen::calcSP (nr_double_t frequency) {
66  setS (NODE_1, NODE_1, ztor (1.0 / calcY (frequency)));
67 }
68 
70  nr_double_t W = getPropertyDouble ("W");
71  nr_double_t s = getPropertyDouble ("S");
72  nr_double_t g = getPropertyDouble ("G");
73  if (g <= W + s + s) {
74  logprint (LOG_ERROR, "WARNING: Model for coplanar open end valid for "
75  "g > 2b (2b = %g)\n", W + s + s);
76  }
77  nr_double_t ab = W / (W + s + s);
78  if (ab < 0.2 || ab > 0.8) {
79  logprint (LOG_ERROR, "WARNING: Model for coplanar open end valid for "
80  "0.2 < a/b < 0.8 (a/b = %g)\n", ab);
81  }
82 }
83 
84 nr_complex_t cpwopen::calcY (nr_double_t frequency) {
85  nr_double_t o = 2 * M_PI * frequency;
86  nr_double_t c = calcCend (frequency);
87  return nr_complex_t (0, c * o);
88 }
89 
90 void cpwopen::initDC (void) {
91  allocMatrixMNA ();
92  setY (NODE_1, NODE_1, 0);
93 }
94 
95 void cpwopen::initAC (void) {
96  allocMatrixMNA ();
97  checkProperties ();
98 }
99 
100 void cpwopen::calcAC (nr_double_t frequency) {
101  setY (NODE_1, NODE_1, calcY (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  { "G", PROP_REAL, { 5e-3, PROP_NO_STR }, PROP_POS_RANGE },
109  { "Subst", PROP_STR, { PROP_NO_VAL, "Subst1" }, PROP_NO_RANGE },
110  PROP_NO_PROP };
111 PROP_OPT [] = {
112  { "Backside", PROP_STR, { PROP_NO_VAL, "Metal" },
113  PROP_RNG_STR2 ("Metal", "Air") },
114  PROP_NO_PROP };
115 struct define_t cpwopen::cirdef =
std::complex< nr_double_t > nr_complex_t
Definition: complex.h:31
#define PROP_POS_RANGE
Definition: netdefs.h:129
nr_complex_t calcY(nr_double_t)
Definition: cpwopen.cpp:84
substrate * subst
Definition: circuit.h:350
void calcSP(nr_double_t)
Definition: cpwopen.cpp:65
#define PROP_DEF
Definition: netdefs.h:189
#define PROP_RNG_STR2(s1, s2)
Definition: netdefs.h:145
nr_double_t getPropertyDouble(const char *)
Definition: object.cpp:176
#define PROP_REAL
Definition: netdefs.h:174
substrate * getSubstrate(void)
Definition: circuit.cpp:332
t
Definition: parse_vcd.y:290
#define PROP_NO_PROP
Definition: netdefs.h:122
#define PROP_NO_RANGE
Definition: netdefs.h:126
#define PROP_NO_STR
Definition: netdefs.h:125
void allocMatrixS(void)
Definition: circuit.cpp:251
void calcAC(nr_double_t)
Definition: cpwopen.cpp:100
void initDC(void)
Definition: cpwopen.cpp:90
#define PROP_LINEAR
Definition: netdefs.h:120
h
Definition: parse_vcd.y:214
void checkProperties(void)
Definition: cpwopen.cpp:69
static void analyseDispersion(nr_double_t, nr_double_t, nr_double_t, nr_double_t, nr_double_t, nr_double_t, nr_double_t, nr_double_t &, nr_double_t &)
Definition: cpwline.cpp:349
PROP_NO_SUBSTRATE
Definition: cpwopen.cpp:116
nr_complex_t ztor(const nr_complex_t z, nr_complex_t zref)
Converts impedance to reflexion coefficient.
Definition: complex.cpp:581
#define PROP_COMPONENT
Definition: netdefs.h:116
void initAC(void)
Definition: cpwopen.cpp:95
#define M_PI
Archimedes' constant ( )
Definition: consts.h:47
PROP_REQ[]
Definition: cpwopen.cpp:105
nr_double_t calcCend(nr_double_t)
Definition: cpwopen.cpp:41
void setY(int, int, nr_complex_t)
Definition: circuit.cpp:452
void initSP(void)
placehoder for S-Parameter initialisation function
Definition: cpwopen.cpp:60
void allocMatrixMNA(void)
Definition: circuit.cpp:267
#define PROP_STR
Definition: netdefs.h:175
static void analyseQuasiStatic(nr_double_t, nr_double_t, nr_double_t, nr_double_t, nr_double_t, int, nr_double_t &, nr_double_t &)
Definition: cpwline.cpp:287
#define NODE_1
Definition: circuit.h:34
#define C0
speed of light in vacuum ( )
Definition: constants.h:47
#define LOG_ERROR
Definition: logging.h:28
void setS(int, int, nr_complex_t)
Definition: circuit.cpp:587
#define PROP_NO_VAL
Definition: netdefs.h:124
char * getPropertyString(const char *)
Definition: object.cpp:159
void logprint(int level, const char *format,...)
Definition: logging.c:37
PROP_OPT[]
Definition: cpwopen.cpp:111