Qucs-core
0.0.19
|
00001 /* 00002 * cpwshort.cpp - coplanar waveguide short 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 "cpwshort.h" 00033 00034 using namespace qucs; 00035 00036 cpwshort::cpwshort () : circuit (1) { 00037 type = CIR_CPWSHORT; 00038 } 00039 00040 // Returns the coplanar short inductance. 00041 nr_double_t cpwshort::calcLend (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) / 4; 00057 return dl * ErEffFreq / C0 * ZlEffFreq; 00058 } 00059 00060 void cpwshort::initSP (void) { 00061 allocMatrixS (); 00062 checkProperties (); 00063 } 00064 00065 void cpwshort::calcSP (nr_double_t frequency) { 00066 setS (NODE_1, NODE_1, ztor (calcZ (frequency))); 00067 } 00068 00069 void cpwshort::checkProperties (void) { 00070 nr_double_t s = getPropertyDouble ("S"); 00071 substrate * subst = getSubstrate (); 00072 nr_double_t t = subst->getPropertyDouble ("t"); 00073 if (t >= s / 3) { 00074 logprint (LOG_ERROR, "WARNING: Model for coplanar short valid for " 00075 "t < s/3 (s/3 = %g)\n", s / 3); 00076 } 00077 } 00078 00079 nr_complex_t cpwshort::calcZ (nr_double_t frequency) { 00080 nr_double_t o = 2 * pi * frequency; 00081 nr_double_t l = calcLend (frequency); 00082 return nr_complex_t (0, l * o); 00083 } 00084 00085 void cpwshort::initDC (void) { 00086 setVoltageSources (1); 00087 setInternalVoltageSource (1); 00088 allocMatrixMNA (); 00089 setY (NODE_1, NODE_1, 0); 00090 setB (NODE_1, VSRC_1, 1); 00091 setC (VSRC_1, NODE_1, 1); 00092 setD (VSRC_1, VSRC_1, 0); 00093 setE (VSRC_1, 0); 00094 } 00095 00096 void cpwshort::initAC (void) { 00097 setVoltageSources (0); 00098 allocMatrixMNA (); 00099 checkProperties (); 00100 } 00101 00102 void cpwshort::calcAC (nr_double_t frequency) { 00103 setY (NODE_1, NODE_1, 1.0 / calcZ (frequency)); 00104 } 00105 00106 // properties 00107 PROP_REQ [] = { 00108 { "W", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE }, 00109 { "S", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE }, 00110 { "Subst", PROP_STR, { PROP_NO_VAL, "Subst1" }, PROP_NO_RANGE }, 00111 PROP_NO_PROP }; 00112 PROP_OPT [] = { 00113 { "Backside", PROP_STR, { PROP_NO_VAL, "Metal" }, 00114 PROP_RNG_STR2 ("Metal", "Air") }, 00115 PROP_NO_PROP }; 00116 struct define_t cpwshort::cirdef = 00117 { "CSHORT", 1, PROP_COMPONENT, PROP_NO_SUBSTRATE, PROP_LINEAR, PROP_DEF };