Qucs-core
0.0.19
|
00001 /* 00002 * msmbend.cpp - microstrip mitered bend class implementation 00003 * 00004 * Copyright (C) 2004, 2008 Stefan Jahn <stefan@lkcc.org> 00005 * Copyright (C) 2004 Michael Margraf <Michael.Margraf@alumni.TU-Berlin.DE> 00006 * 00007 * This is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2, or (at your option) 00010 * any later version. 00011 * 00012 * This software is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this package; see the file COPYING. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, 00020 * Boston, MA 02110-1301, USA. 00021 * 00022 * $Id$ 00023 * 00024 */ 00025 00026 #if HAVE_CONFIG_H 00027 # include <config.h> 00028 #endif 00029 00030 #include "component.h" 00031 #include "substrate.h" 00032 #include "msmbend.h" 00033 00034 using namespace qucs; 00035 00036 msmbend::msmbend () : circuit (2) { 00037 type = CIR_MSMBEND; 00038 } 00039 00040 void msmbend::calcSP (nr_double_t frequency) { 00041 setMatrixS (ztos (calcMatrixZ (frequency))); 00042 } 00043 00044 matrix msmbend::calcMatrixZ (nr_double_t frequency) { 00045 00046 /* how to get properties of this component, e.g. W */ 00047 nr_double_t W = getPropertyDouble ("W"); 00048 00049 /* how to get properties of the substrate, e.g. Er, H */ 00050 substrate * subst = getSubstrate (); 00051 nr_double_t er = subst->getPropertyDouble ("er"); 00052 nr_double_t h = subst->getPropertyDouble ("h"); 00053 00054 /* local variables */ 00055 nr_complex_t z11, z21; 00056 nr_double_t L, C, Wh = W / h; 00057 00058 // check validity 00059 if ((Wh < 0.2) || (Wh > 6.0)) { 00060 logprint (LOG_ERROR, "WARNING: Model for microstrip mitered bend defined " 00061 "for 0.2 <= W/h <= 6.0\n"); 00062 } 00063 if ((er < 2.36) || (er > 10.4)) { 00064 logprint (LOG_ERROR, "WARNING: Model for microstrip mitered bend defined " 00065 "for 2.36 <= er <= 10.4\n"); 00066 } 00067 if (frequency * h > 12e6) { 00068 logprint (LOG_ERROR, "WARNING: Model for microstrip mitered bend defined " 00069 "for freq*h <= 12MHz\n"); 00070 } 00071 00072 // capacitance in pF 00073 C = W * ((3.93 * er + 0.62) * Wh + (7.6 * er + 3.80)); 00074 // inductance in nH 00075 L = 440.0 * h * (1.0 - 1.062 * qucs::exp (-0.177 * qucs::pow (Wh, 0.947))); 00076 00077 // calculate Z-parameters 00078 z21 = nr_complex_t (0.0, -0.5e12 / (pi * frequency * C)); 00079 z11 = nr_complex_t (0.0, 2e-9 * pi * frequency * L) + z21; 00080 matrix z (2); 00081 z.set (0, 0, z11); 00082 z.set (0, 1, z21); 00083 z.set (1, 0, z21); 00084 z.set (1, 1, z11); 00085 return z; 00086 } 00087 00088 void msmbend::initDC (void) { 00089 // a DC short (voltage source V = 0 volts) 00090 setVoltageSources (1); 00091 setInternalVoltageSource (1); 00092 allocMatrixMNA (); 00093 clearY (); 00094 voltageSource (VSRC_1, NODE_1, NODE_2); 00095 } 00096 00097 void msmbend::initAC (void) { 00098 setVoltageSources (0); 00099 allocMatrixMNA (); 00100 } 00101 00102 void msmbend::calcAC (nr_double_t frequency) { 00103 setMatrixY (ztoy (calcMatrixZ (frequency))); 00104 } 00105 00106 // properties 00107 PROP_REQ [] = { 00108 { "W", PROP_REAL, { 1e-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 PROP_NO_PROP }; 00113 struct define_t msmbend::cirdef = 00114 { "MMBEND", 2, PROP_COMPONENT, PROP_NO_SUBSTRATE, PROP_LINEAR, PROP_DEF };