Qucs-core  0.0.18
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cpwshort.cpp
Go to the documentation of this file.
1 /*
2  * cpwshort.cpp - coplanar waveguide short 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 "cpwshort.h"
33 
34 using namespace qucs;
35 
36 cpwshort::cpwshort () : circuit (1) {
37  type = CIR_CPWSHORT;
38 }
39 
40 // Returns the coplanar short inductance.
41 nr_double_t cpwshort::calcLend (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) / 4;
57  return dl * ErEffFreq / C0 * ZlEffFreq;
58 }
59 
60 void cpwshort::initSP (void) {
61  allocMatrixS ();
62  checkProperties ();
63 }
64 
65 void cpwshort::calcSP (nr_double_t frequency) {
66  setS (NODE_1, NODE_1, ztor (calcZ (frequency)));
67 }
68 
70  nr_double_t s = getPropertyDouble ("S");
72  nr_double_t t = subst->getPropertyDouble ("t");
73  if (t >= s / 3) {
74  logprint (LOG_ERROR, "WARNING: Model for coplanar short valid for "
75  "t < s/3 (s/3 = %g)\n", s / 3);
76  }
77 }
78 
79 nr_complex_t cpwshort::calcZ (nr_double_t frequency) {
80  nr_double_t o = 2 * M_PI * frequency;
81  nr_double_t l = calcLend (frequency);
82  return nr_complex_t (0, l * o);
83 }
84 
85 void cpwshort::initDC (void) {
88  allocMatrixMNA ();
89  setY (NODE_1, NODE_1, 0);
90  setB (NODE_1, VSRC_1, 1);
91  setC (VSRC_1, NODE_1, 1);
92  setD (VSRC_1, VSRC_1, 0);
93  setE (VSRC_1, 0);
94 }
95 
96 void cpwshort::initAC (void) {
98  allocMatrixMNA ();
99  checkProperties ();
100 }
101 
102 void cpwshort::calcAC (nr_double_t frequency) {
103  setY (NODE_1, NODE_1, 1.0 / calcZ (frequency));
104 }
105 
106 // properties
107 PROP_REQ [] = {
108  { "W", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
109  { "S", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
110  { "Subst", PROP_STR, { PROP_NO_VAL, "Subst1" }, PROP_NO_RANGE },
111  PROP_NO_PROP };
112 PROP_OPT [] = {
113  { "Backside", PROP_STR, { PROP_NO_VAL, "Metal" },
114  PROP_RNG_STR2 ("Metal", "Air") },
115  PROP_NO_PROP };
116 struct define_t cpwshort::cirdef =
std::complex< nr_double_t > nr_complex_t
Definition: complex.h:31
#define PROP_POS_RANGE
Definition: netdefs.h:129
l
Definition: parse_vcd.y:213
void calcAC(nr_double_t)
Definition: cpwshort.cpp:102
substrate * subst
Definition: circuit.h:350
#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
void setD(int, int, nr_complex_t)
Definition: circuit.cpp:373
PROP_REQ[]
Definition: cpwshort.cpp:107
#define PROP_REAL
Definition: netdefs.h:174
substrate * getSubstrate(void)
Definition: circuit.cpp:332
void setInternalVoltageSource(bool i)
Definition: circuit.h:184
t
Definition: parse_vcd.y:290
#define PROP_NO_PROP
Definition: netdefs.h:122
void setVoltageSources(int)
Definition: circuit.cpp:607
#define PROP_NO_RANGE
Definition: netdefs.h:126
#define PROP_NO_STR
Definition: netdefs.h:125
void setB(int, int, nr_complex_t)
Definition: circuit.cpp:349
void allocMatrixS(void)
Definition: circuit.cpp:251
#define PROP_LINEAR
Definition: netdefs.h:120
h
Definition: parse_vcd.y:214
#define VSRC_1
Definition: circuit.h:40
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
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 setE(int, nr_complex_t)
Definition: circuit.cpp:385
void checkProperties(void)
Definition: cpwshort.cpp:69
#define M_PI
Archimedes' constant ( )
Definition: consts.h:47
void initAC(void)
Definition: cpwshort.cpp:96
void setY(int, int, nr_complex_t)
Definition: circuit.cpp:452
void allocMatrixMNA(void)
Definition: circuit.cpp:267
#define PROP_STR
Definition: netdefs.h:175
void calcSP(nr_double_t)
Definition: cpwshort.cpp:65
void initSP(void)
placehoder for S-Parameter initialisation function
Definition: cpwshort.cpp:60
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
nr_double_t calcLend(nr_double_t)
Definition: cpwshort.cpp:41
void setS(int, int, nr_complex_t)
Definition: circuit.cpp:587
#define PROP_NO_VAL
Definition: netdefs.h:124
PROP_OPT[]
Definition: cpwshort.cpp:112
void setC(int, int, nr_complex_t)
Definition: circuit.cpp:361
char * getPropertyString(const char *)
Definition: object.cpp:159
void logprint(int level, const char *format,...)
Definition: logging.c:37
nr_complex_t calcZ(nr_double_t)
Definition: cpwshort.cpp:79
void initDC(void)
Definition: cpwshort.cpp:85
PROP_NO_SUBSTRATE
Definition: cpwshort.cpp:117