My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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: msopen.cpp 1825 2011-03-11 20:42:14Z ela $
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 msopen::msopen () : circuit (1) {
36  type = CIR_MSOPEN;
37 }
38 
39 // Returns the microstrip open end capacitance.
40 nr_double_t msopen::calcCend (nr_double_t frequency, nr_double_t W,
41  nr_double_t h, nr_double_t t, nr_double_t er,
42  char * SModel, char * DModel,
43  const char * Model) {
44 
45  nr_double_t ZlEff, ErEff, WEff, ZlEffFreq, ErEffFreq;
46  msline::analyseQuasiStatic (W, h, t, er, SModel, ZlEff, ErEff, WEff);
47  msline::analyseDispersion (WEff, h, er, ZlEff, ErEff, frequency, DModel,
48  ZlEffFreq, ErEffFreq);
49 
50  W /= h;
51  nr_double_t dl = 0;
52  /* Kirschning, Jansen and Koster */
53  if (!strcmp (Model, "Kirschning")) {
54  nr_double_t Q6 = pow (ErEffFreq, 0.81);
55  nr_double_t Q7 = pow (W, 0.8544);
56  nr_double_t Q1 = 0.434907 *
57  (Q6 + 0.26) / (Q6 - 0.189) * (Q7 + 0.236) / (Q7 + 0.87);
58  nr_double_t Q2 = pow (W, 0.371) / (2.358 * er + 1.0) + 1.0;
59  nr_double_t Q3 = atan (0.084 * pow (W, 1.9413 / Q2)) *
60  0.5274 / pow (ErEffFreq, 0.9236) + 1.0;
61  nr_double_t Q4 = 0.0377 * (6.0 - 5.0 * exp (0.036 * (1.0 - er))) *
62  atan (0.067 * pow (W, 1.456)) + 1.0;
63  nr_double_t Q5 = 1.0 - 0.218 * exp (-7.5 * W);
64  dl = Q1 * Q3 * Q5 / Q4;
65  }
66  /* Hammerstad */
67  else if (!strcmp (Model, "Hammerstad")) {
68  dl = 0.102 * (W + 0.106) / (W + 0.264) *
69  (1.166 + (er + 1) / er * (0.9 + log (W + 2.475)));
70  }
71  return dl * h * sqrt (ErEffFreq) / C0 / ZlEffFreq;
72 }
73 
74 void msopen::calcSP (nr_double_t frequency) {
75  setS (NODE_1, NODE_1, ztor (1.0 / calcY (frequency)));
76 }
77 
78 nr_complex_t msopen::calcY (nr_double_t frequency) {
79 
80  /* how to get properties of this component, e.g. W */
81  nr_double_t W = getPropertyDouble ("W");
82  char * SModel = getPropertyString ("MSModel");
83  char * DModel = getPropertyString ("MSDispModel");
84  char * Model = getPropertyString ("Model");
85 
86  /* how to get properties of the substrate, e.g. Er, H */
87  substrate * subst = getSubstrate ();
88  nr_double_t er = subst->getPropertyDouble ("er");
89  nr_double_t h = subst->getPropertyDouble ("h");
90  nr_double_t t = subst->getPropertyDouble ("t");
91 
92  /* local variables */
93  nr_complex_t y;
94  nr_double_t o = 2 * M_PI * frequency;
95 
96  /* Alexopoulos and Wu */
97  if (!strcmp (Model, "Alexopoulos")) {
98  nr_double_t ZlEff, ErEff, WEff, ZlEffFreq, ErEffFreq;
99  msline::analyseQuasiStatic (W, h, t, er, SModel, ZlEff, ErEff, WEff);
100  msline::analyseDispersion (WEff, h, er, ZlEff, ErEff, frequency, DModel,
101  ZlEffFreq, ErEffFreq);
102 
103  if (fabs (er - 9.9) > 0.2) {
104  logprint (LOG_ERROR, "WARNING: Model for microstrip open end defined "
105  "for er = 9.9 (er = %g)\n", er);
106  }
107 
108  nr_double_t c1, c2, l2, r2;
109  c1 = (1.125 * tanh (1.358 * W / h) - 0.315) *
110  h / 2.54e-5 / 25 / ZlEffFreq * 1e-12;
111  c2 = (6.832 * tanh (0.0109 * W / h) + 0.919) *
112  h / 2.54e-5 / 25 / ZlEffFreq * 1e-12;
113  l2 = (0.008285 * tanh (0.5665 * W / h) + 0.0103) *
114  h / 2.54e-5 / 25 * ZlEffFreq * 1e-9;
115  r2 = (1.024 * tanh (2.025 * W / h)) * ZlEffFreq;
116  y = rect (0, c1 * o) + 1.0 / rect (r2, l2 * o - 1 / c2 / o);
117  }
118  else {
119  nr_double_t c = calcCend (frequency, W, h, t, er, SModel, DModel, Model);
120  y = rect (0, c * o);
121  }
122  return y;
123 }
124 
125 void msopen::initDC (void) {
126  allocMatrixMNA ();
127  setY (NODE_1, NODE_1, 0);
128 }
129 
130 void msopen::calcAC (nr_double_t frequency) {
131  setY (NODE_1, NODE_1, calcY (frequency));
132 }
133 
134 // properties
135 PROP_REQ [] = {
136  { "W", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
137  { "Subst", PROP_STR, { PROP_NO_VAL, "Subst1" }, PROP_NO_RANGE },
138  { "MSDispModel", PROP_STR, { PROP_NO_VAL, "Kirschning" }, PROP_RNG_DIS },
139  { "MSModel", PROP_STR, { PROP_NO_VAL, "Hammerstad" }, PROP_RNG_MOD },
140  { "Model", PROP_STR, { PROP_NO_VAL, "Kirschning" },
141  PROP_RNG_STR3 ("Kirschning", "Hammerstad", "Alexopoulos") },
142  PROP_NO_PROP };
143 PROP_OPT [] = {
144  PROP_NO_PROP };
145 struct define_t msopen::cirdef =