Qucs-core
0.0.19
|
00001 /* 00002 * cpwopen.cpp - coplanar waveguide open end class implementation 00003 * 00004 * Copyright (C) 2005, 2008 Stefan Jahn <stefan@lkcc.org> 00005 * 00006 * This is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2, or (at your option) 00009 * any later version. 00010 * 00011 * This software is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this package; see the file COPYING. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 * $Id$ 00022 * 00023 */ 00024 00025 #if HAVE_CONFIG_H 00026 # include <config.h> 00027 #endif 00028 00029 #include "component.h" 00030 #include "substrate.h" 00031 #include "cpwline.h" 00032 #include "cpwopen.h" 00033 00034 using namespace qucs; 00035 00036 cpwopen::cpwopen () : circuit (1) { 00037 type = CIR_CPWOPEN; 00038 } 00039 00040 // Returns the coplanar open end capacitance. 00041 nr_double_t cpwopen::calcCend (nr_double_t frequency) { 00042 00043 // get properties of substrate and coplanar open 00044 nr_double_t W = getPropertyDouble ("W"); 00045 nr_double_t s = getPropertyDouble ("S"); 00046 substrate * subst = getSubstrate (); 00047 nr_double_t er = subst->getPropertyDouble ("er"); 00048 nr_double_t h = subst->getPropertyDouble ("h"); 00049 nr_double_t t = subst->getPropertyDouble ("t"); 00050 int backMetal = !strcmp (getPropertyString ("Backside"), "Metal"); 00051 00052 nr_double_t ZlEff, ErEff, ZlEffFreq, ErEffFreq; 00053 cpwline::analyseQuasiStatic (W, s, h, t, er, backMetal, ZlEff, ErEff); 00054 cpwline::analyseDispersion (W, s, h, er, ZlEff, ErEff, frequency, 00055 ZlEffFreq, ErEffFreq); 00056 nr_double_t dl = (W / 2 + s) / 2; 00057 return dl * ErEffFreq / C0 / ZlEffFreq; 00058 } 00059 00060 void cpwopen::initSP (void) { 00061 allocMatrixS (); 00062 checkProperties (); 00063 } 00064 00065 void cpwopen::calcSP (nr_double_t frequency) { 00066 setS (NODE_1, NODE_1, ztor (1.0 / calcY (frequency))); 00067 } 00068 00069 void cpwopen::checkProperties (void) { 00070 nr_double_t W = getPropertyDouble ("W"); 00071 nr_double_t s = getPropertyDouble ("S"); 00072 nr_double_t g = getPropertyDouble ("G"); 00073 if (g <= W + s + s) { 00074 logprint (LOG_ERROR, "WARNING: Model for coplanar open end valid for " 00075 "g > 2b (2b = %g)\n", W + s + s); 00076 } 00077 nr_double_t ab = W / (W + s + s); 00078 if (ab < 0.2 || ab > 0.8) { 00079 logprint (LOG_ERROR, "WARNING: Model for coplanar open end valid for " 00080 "0.2 < a/b < 0.8 (a/b = %g)\n", ab); 00081 } 00082 } 00083 00084 nr_complex_t cpwopen::calcY (nr_double_t frequency) { 00085 nr_double_t o = 2 * pi * frequency; 00086 nr_double_t c = calcCend (frequency); 00087 return nr_complex_t (0, c * o); 00088 } 00089 00090 void cpwopen::initDC (void) { 00091 allocMatrixMNA (); 00092 setY (NODE_1, NODE_1, 0); 00093 } 00094 00095 void cpwopen::initAC (void) { 00096 allocMatrixMNA (); 00097 checkProperties (); 00098 } 00099 00100 void cpwopen::calcAC (nr_double_t frequency) { 00101 setY (NODE_1, NODE_1, calcY (frequency)); 00102 } 00103 00104 // properties 00105 PROP_REQ [] = { 00106 { "W", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE }, 00107 { "S", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE }, 00108 { "G", PROP_REAL, { 5e-3, PROP_NO_STR }, PROP_POS_RANGE }, 00109 { "Subst", PROP_STR, { PROP_NO_VAL, "Subst1" }, PROP_NO_RANGE }, 00110 PROP_NO_PROP }; 00111 PROP_OPT [] = { 00112 { "Backside", PROP_STR, { PROP_NO_VAL, "Metal" }, 00113 PROP_RNG_STR2 ("Metal", "Air") }, 00114 PROP_NO_PROP }; 00115 struct define_t cpwopen::cirdef = 00116 { "COPEN", 1, PROP_COMPONENT, PROP_NO_SUBSTRATE, PROP_LINEAR, PROP_DEF };