Qucs-core  0.0.18
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
msopen.cpp
Go to the documentation of this file.
1 /*
2  * msopen.cpp - microstrip open end class implementation
3  *
4  * Copyright (C) 2004, 2008 Stefan Jahn <stefan@lkcc.org>
5  * Copyright (C) 2004 Michael Margraf <Michael.Margraf@alumni.TU-Berlin.DE>
6  *
7  * This is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this package; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  *
22  * $Id$
23  *
24  */
25 
26 #if HAVE_CONFIG_H
27 # include <config.h>
28 #endif
29 
30 #include "component.h"
31 #include "substrate.h"
32 #include "msline.h"
33 #include "msopen.h"
34 
35 using namespace qucs;
36 
37 msopen::msopen () : circuit (1) {
38  type = CIR_MSOPEN;
39 }
40 
41 // Returns the microstrip open end capacitance.
42 nr_double_t msopen::calcCend (nr_double_t frequency, nr_double_t W,
43  nr_double_t h, nr_double_t t, nr_double_t er,
44  char * SModel, char * DModel,
45  const char * Model) {
46 
47  nr_double_t ZlEff, ErEff, WEff, ZlEffFreq, ErEffFreq;
48  msline::analyseQuasiStatic (W, h, t, er, SModel, ZlEff, ErEff, WEff);
49  msline::analyseDispersion (WEff, h, er, ZlEff, ErEff, frequency, DModel,
50  ZlEffFreq, ErEffFreq);
51 
52  W /= h;
53  nr_double_t dl = 0;
54  /* Kirschning, Jansen and Koster */
55  if (!strcmp (Model, "Kirschning")) {
56  nr_double_t Q6 = qucs::pow (ErEffFreq, 0.81);
57  nr_double_t Q7 = qucs::pow (W, 0.8544);
58  nr_double_t Q1 = 0.434907 *
59  (Q6 + 0.26) / (Q6 - 0.189) * (Q7 + 0.236) / (Q7 + 0.87);
60  nr_double_t Q2 = qucs::pow (W, 0.371) / (2.358 * er + 1.0) + 1.0;
61  nr_double_t Q3 = qucs::atan (0.084 * qucs::pow (W, 1.9413 / Q2)) *
62  0.5274 / qucs::pow (ErEffFreq, 0.9236) + 1.0;
63  nr_double_t Q4 = 0.0377 * (6.0 - 5.0 * qucs::exp (0.036 * (1.0 - er))) *
64  qucs::atan (0.067 * qucs::pow (W, 1.456)) + 1.0;
65  nr_double_t Q5 = 1.0 - 0.218 * qucs::exp (-7.5 * W);
66  dl = Q1 * Q3 * Q5 / Q4;
67  }
68  /* Hammerstad */
69  else if (!strcmp (Model, "Hammerstad")) {
70  dl = 0.102 * (W + 0.106) / (W + 0.264) *
71  (1.166 + (er + 1) / er * (0.9 + qucs::log (W + 2.475)));
72  }
73  return dl * h * qucs::sqrt (ErEffFreq) / C0 / ZlEffFreq;
74 }
75 
76 void msopen::calcSP (nr_double_t frequency) {
77  setS (NODE_1, NODE_1, ztor (1.0 / calcY (frequency)));
78 }
79 
80 nr_complex_t msopen::calcY (nr_double_t frequency) {
81 
82  /* how to get properties of this component, e.g. W */
83  nr_double_t W = getPropertyDouble ("W");
84  char * SModel = getPropertyString ("MSModel");
85  char * DModel = getPropertyString ("MSDispModel");
86  char * Model = getPropertyString ("Model");
87 
88  /* how to get properties of the substrate, e.g. Er, H */
90  nr_double_t er = subst->getPropertyDouble ("er");
91  nr_double_t h = subst->getPropertyDouble ("h");
92  nr_double_t t = subst->getPropertyDouble ("t");
93 
94  /* local variables */
96  nr_double_t o = 2 * M_PI * frequency;
97 
98  /* Alexopoulos and Wu */
99  if (!strcmp (Model, "Alexopoulos")) {
100  nr_double_t ZlEff, ErEff, WEff, ZlEffFreq, ErEffFreq;
101  msline::analyseQuasiStatic (W, h, t, er, SModel, ZlEff, ErEff, WEff);
102  msline::analyseDispersion (WEff, h, er, ZlEff, ErEff, frequency, DModel,
103  ZlEffFreq, ErEffFreq);
104 
105  if (fabs (er - 9.9) > 0.2) {
106  logprint (LOG_ERROR, "WARNING: Model for microstrip open end defined "
107  "for er = 9.9 (er = %g)\n", er);
108  }
109 
110  nr_double_t c1, c2, l2, r2;
111  c1 = (1.125 * qucs::tanh (1.358 * W / h) - 0.315) *
112  h / 2.54e-5 / 25 / ZlEffFreq * 1e-12;
113  c2 = (6.832 * qucs::tanh (0.0109 * W / h) + 0.919) *
114  h / 2.54e-5 / 25 / ZlEffFreq * 1e-12;
115  l2 = (0.008285 * qucs::tanh (0.5665 * W / h) + 0.0103) *
116  h / 2.54e-5 / 25 * ZlEffFreq * 1e-9;
117  r2 = (1.024 * qucs::tanh (2.025 * W / h)) * ZlEffFreq;
118  y = nr_complex_t (0, c1 * o) + 1.0 / nr_complex_t (r2, l2 * o - 1 / c2 / o);
119  }
120  else {
121  nr_double_t c = calcCend (frequency, W, h, t, er, SModel, DModel, Model);
122  y = nr_complex_t (0, c * o);
123  }
124  return y;
125 }
126 
127 void msopen::initDC (void) {
128  allocMatrixMNA ();
129  setY (NODE_1, NODE_1, 0);
130 }
131 
132 void msopen::calcAC (nr_double_t frequency) {
133  setY (NODE_1, NODE_1, calcY (frequency));
134 }
135 
136 // properties
137 PROP_REQ [] = {
138  { "W", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
139  { "Subst", PROP_STR, { PROP_NO_VAL, "Subst1" }, PROP_NO_RANGE },
140  { "MSDispModel", PROP_STR, { PROP_NO_VAL, "Kirschning" }, PROP_RNG_DIS },
141  { "MSModel", PROP_STR, { PROP_NO_VAL, "Hammerstad" }, PROP_RNG_MOD },
142  { "Model", PROP_STR, { PROP_NO_VAL, "Kirschning" },
143  PROP_RNG_STR3 ("Kirschning", "Hammerstad", "Alexopoulos") },
144  PROP_NO_PROP };
145 PROP_OPT [] = {
146  PROP_NO_PROP };
147 struct define_t msopen::cirdef =
std::complex< nr_double_t > nr_complex_t
Definition: complex.h:31
#define PROP_POS_RANGE
Definition: netdefs.h:129
void calcAC(nr_double_t)
Definition: msopen.cpp:132
substrate * subst
Definition: circuit.h:350
#define PROP_DEF
Definition: netdefs.h:189
void initDC(void)
Definition: msopen.cpp:127
nr_double_t getPropertyDouble(const char *)
Definition: object.cpp:176
nr_complex_t pow(const nr_complex_t z, const nr_double_t d)
Compute power function with real exponent.
Definition: complex.cpp:238
#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
nr_complex_t atan(const nr_complex_t z)
Compute complex arc tangent.
Definition: complex.cpp:117
#define PROP_NO_RANGE
Definition: netdefs.h:126
#define PROP_NO_STR
Definition: netdefs.h:125
#define PROP_RNG_MOD
Definition: netdefs.h:169
#define PROP_LINEAR
Definition: netdefs.h:120
h
Definition: parse_vcd.y:214
PROP_OPT[]
Definition: msopen.cpp:145
#define PROP_RNG_DIS
Definition: netdefs.h:166
nr_complex_t sqrt(const nr_complex_t z)
Compute principal value of square root.
Definition: complex.cpp:271
nr_complex_t tanh(const nr_complex_t z)
Compute complex hyperbolic tangent.
Definition: complex.cpp:153
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
eqn::constant * c1
static nr_double_t calcCend(nr_double_t, nr_double_t, nr_double_t, nr_double_t, nr_double_t, char *, char *, const char *)
Definition: msopen.cpp:42
eqn::constant * c2
#define M_PI
Archimedes' constant ( )
Definition: consts.h:47
void setY(int, int, nr_complex_t)
Definition: circuit.cpp:452
void allocMatrixMNA(void)
Definition: circuit.cpp:267
PROP_REQ[]
Definition: msopen.cpp:137
#define PROP_STR
Definition: netdefs.h:175
y
Definition: parse_mdl.y:499
#define NODE_1
Definition: circuit.h:34
#define C0
speed of light in vacuum ( )
Definition: constants.h:47
static void analyseQuasiStatic(nr_double_t, nr_double_t, nr_double_t, nr_double_t, char *, nr_double_t &, nr_double_t &, nr_double_t &)
Definition: msline.cpp:115
nr_complex_t exp(const nr_complex_t z)
Compute complex exponential.
Definition: complex.cpp:205
#define LOG_ERROR
Definition: logging.h:28
void setS(int, int, nr_complex_t)
Definition: circuit.cpp:587
nr_complex_t calcY(nr_double_t)
Definition: msopen.cpp:80
#define PROP_NO_VAL
Definition: netdefs.h:124
PROP_NO_SUBSTRATE
Definition: msopen.cpp:148
static void analyseDispersion(nr_double_t, nr_double_t, nr_double_t, nr_double_t, nr_double_t, nr_double_t, char *, nr_double_t &, nr_double_t &)
Definition: msline.cpp:229
#define PROP_RNG_STR3(s1, s2, s3)
Definition: netdefs.h:147
char * getPropertyString(const char *)
Definition: object.cpp:159
void calcSP(nr_double_t)
Definition: msopen.cpp:76
void logprint(int level, const char *format,...)
Definition: logging.c:37
nr_complex_t log(const nr_complex_t z)
Compute principal value of natural logarithm of z.
Definition: complex.cpp:215