Branch data Line data Source code
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 : 0 : cpwshort::cpwshort () : circuit (1) {
37 : 0 : type = CIR_CPWSHORT;
38 : 0 : }
39 : :
40 : : // Returns the coplanar short inductance.
41 : 0 : nr_double_t cpwshort::calcLend (nr_double_t frequency) {
42 : :
43 : : // get properties of substrate and coplanar open
44 [ # # ]: 0 : nr_double_t W = getPropertyDouble ("W");
45 [ # # ]: 0 : nr_double_t s = getPropertyDouble ("S");
46 [ # # ]: 0 : substrate * subst = getSubstrate ();
47 [ # # ]: 0 : nr_double_t er = subst->getPropertyDouble ("er");
48 [ # # ]: 0 : nr_double_t h = subst->getPropertyDouble ("h");
49 [ # # ]: 0 : nr_double_t t = subst->getPropertyDouble ("t");
50 [ # # ]: 0 : int backMetal = !strcmp (getPropertyString ("Backside"), "Metal");
51 : :
52 : : nr_double_t ZlEff, ErEff, ZlEffFreq, ErEffFreq;
53 [ # # ]: 0 : cpwline::analyseQuasiStatic (W, s, h, t, er, backMetal, ZlEff, ErEff);
54 : : cpwline::analyseDispersion (W, s, h, er, ZlEff, ErEff, frequency,
55 [ # # ]: 0 : ZlEffFreq, ErEffFreq);
56 : 0 : nr_double_t dl = (W / 2 + s) / 4;
57 : 0 : return dl * ErEffFreq / C0 * ZlEffFreq;
58 : : }
59 : :
60 : 0 : void cpwshort::initSP (void) {
61 : 0 : allocMatrixS ();
62 : 0 : checkProperties ();
63 : 0 : }
64 : :
65 : 0 : void cpwshort::calcSP (nr_double_t frequency) {
66 [ # # ][ # # ]: 0 : setS (NODE_1, NODE_1, ztor (calcZ (frequency)));
[ # # ]
67 : 0 : }
68 : :
69 : 0 : void cpwshort::checkProperties (void) {
70 : 0 : nr_double_t s = getPropertyDouble ("S");
71 : 0 : substrate * subst = getSubstrate ();
72 : 0 : nr_double_t t = subst->getPropertyDouble ("t");
73 [ # # ]: 0 : if (t >= s / 3) {
74 : : logprint (LOG_ERROR, "WARNING: Model for coplanar short valid for "
75 : 0 : "t < s/3 (s/3 = %g)\n", s / 3);
76 : : }
77 : 0 : }
78 : :
79 : 0 : nr_complex_t cpwshort::calcZ (nr_double_t frequency) {
80 : 0 : nr_double_t o = 2 * M_PI * frequency;
81 : 0 : nr_double_t l = calcLend (frequency);
82 : 0 : return nr_complex_t (0, l * o);
83 : : }
84 : :
85 : 0 : void cpwshort::initDC (void) {
86 : 0 : setVoltageSources (1);
87 : 0 : setInternalVoltageSource (1);
88 : 0 : allocMatrixMNA ();
89 [ # # ]: 0 : setY (NODE_1, NODE_1, 0);
90 [ # # ]: 0 : setB (NODE_1, VSRC_1, 1);
91 [ # # ]: 0 : setC (VSRC_1, NODE_1, 1);
92 [ # # ]: 0 : setD (VSRC_1, VSRC_1, 0);
93 [ # # ]: 0 : setE (VSRC_1, 0);
94 : 0 : }
95 : :
96 : 0 : void cpwshort::initAC (void) {
97 : 0 : setVoltageSources (0);
98 : 0 : allocMatrixMNA ();
99 : 0 : checkProperties ();
100 : 0 : }
101 : :
102 : 0 : void cpwshort::calcAC (nr_double_t frequency) {
103 [ # # ][ # # ]: 0 : setY (NODE_1, NODE_1, 1.0 / calcZ (frequency));
104 : 0 : }
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 =
117 : : { "CSHORT", 1, PROP_COMPONENT, PROP_NO_SUBSTRATE, PROP_LINEAR, PROP_DEF };
|