Qucs-core  0.0.19
cpwgap.cpp
Go to the documentation of this file.
00001 /*
00002  * cpwgap.cpp - coplanar waveguide gap 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 "cpwgap.h"
00032 
00033 using namespace qucs;
00034 
00035 cpwgap::cpwgap () : circuit (2) {
00036   type = CIR_CPWGAP;
00037 }
00038 
00039 void cpwgap::calcSP (nr_double_t frequency) {
00040   setMatrixS (ytos (calcMatrixY (frequency)));
00041 }
00042 
00043 matrix cpwgap::calcMatrixY (nr_double_t frequency) {
00044 
00045   nr_double_t W = getPropertyDouble ("W");
00046   nr_double_t g = getPropertyDouble ("G");
00047   substrate * subst = getSubstrate ();
00048   nr_double_t er = subst->getPropertyDouble ("er");
00049 
00050   // calculate series capacitance
00051   er = (er + 1) / 2;
00052   nr_double_t p = g / 4 / W;
00053   nr_double_t C = 2 * E0 * er * W / pi *
00054     (p - std::sqrt (1 + p * p) + std::log ((1 + std::sqrt (1 + p * p)) / p));
00055 
00056   // build Y-parameter matrix
00057   nr_complex_t y11 = nr_complex_t (0.0, 2.0 * pi * frequency * C);
00058   matrix y (2);
00059   y.set (0, 0, +y11);
00060   y.set (0, 1, -y11);
00061   y.set (1, 0, -y11);
00062   y.set (1, 1, +y11);
00063   return y;
00064 }
00065 
00066 void cpwgap::initDC (void) {
00067   allocMatrixMNA ();
00068   clearY ();
00069 }
00070 
00071 void cpwgap::calcAC (nr_double_t frequency) {
00072   setMatrixY (calcMatrixY (frequency));
00073 }
00074 
00075 // properties
00076 PROP_REQ [] = {
00077   { "W", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
00078   { "G", PROP_REAL, { 5e-4, PROP_NO_STR }, PROP_POS_RANGE },
00079   { "Subst", PROP_STR, { PROP_NO_VAL, "Subst1" }, PROP_NO_RANGE },
00080   PROP_NO_PROP };
00081 PROP_OPT [] = {
00082   { "S", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
00083   PROP_NO_PROP };
00084 struct define_t cpwgap::cirdef =
00085   { "CGAP", 2, PROP_COMPONENT, PROP_NO_SUBSTRATE, PROP_LINEAR, PROP_DEF };