LCOV - code coverage report
Current view: top level - src/components/microstrip - cpwopen.cpp (source / functions) Hit Total Coverage
Test: qucs-core-0.0.19 Code Coverage Lines: 0 47 0.0 %
Date: 2015-01-05 16:01:02 Functions: 0 10 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 34 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * cpwopen.cpp - coplanar waveguide open end class implementation
       3                 :            :  *
       4                 :            :  * Copyright (C) 2005, 2008 Stefan Jahn <stefan@lkcc.org>
       5                 :            :  *
       6                 :            :  * This is free software; you can redistribute it and/or modify
       7                 :            :  * it under the terms of the GNU General Public License as published by
       8                 :            :  * the Free Software Foundation; either version 2, or (at your option)
       9                 :            :  * any later version.
      10                 :            :  *
      11                 :            :  * This software is distributed in the hope that it will be useful,
      12                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14                 :            :  * GNU General Public License for more details.
      15                 :            :  *
      16                 :            :  * You should have received a copy of the GNU General Public License
      17                 :            :  * along with this package; see the file COPYING.  If not, write to
      18                 :            :  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
      19                 :            :  * Boston, MA 02110-1301, USA.
      20                 :            :  *
      21                 :            :  * $Id$
      22                 :            :  *
      23                 :            :  */
      24                 :            : 
      25                 :            : #if HAVE_CONFIG_H
      26                 :            : # include <config.h>
      27                 :            : #endif
      28                 :            : 
      29                 :            : #include "component.h"
      30                 :            : #include "substrate.h"
      31                 :            : #include "cpwline.h"
      32                 :            : #include "cpwopen.h"
      33                 :            : 
      34                 :            : using namespace qucs;
      35                 :            : 
      36                 :          0 : cpwopen::cpwopen () : circuit (1) {
      37                 :          0 :   type = CIR_CPWOPEN;
      38                 :          0 : }
      39                 :            : 
      40                 :            : // Returns the coplanar open end capacitance.
      41                 :          0 : nr_double_t cpwopen::calcCend (nr_double_t frequency) {
      42                 :            : 
      43                 :            :   // get properties of substrate and coplanar open
      44         [ #  # ]:          0 :   nr_double_t W =  getPropertyDouble ("W");
      45         [ #  # ]:          0 :   nr_double_t s =  getPropertyDouble ("S");
      46         [ #  # ]:          0 :   substrate * subst = getSubstrate ();
      47         [ #  # ]:          0 :   nr_double_t er = subst->getPropertyDouble ("er");
      48         [ #  # ]:          0 :   nr_double_t h  = subst->getPropertyDouble ("h");
      49         [ #  # ]:          0 :   nr_double_t t  = subst->getPropertyDouble ("t");
      50         [ #  # ]:          0 :   int backMetal  = !strcmp (getPropertyString ("Backside"), "Metal");
      51                 :            : 
      52                 :            :   nr_double_t ZlEff, ErEff, ZlEffFreq, ErEffFreq;
      53         [ #  # ]:          0 :   cpwline::analyseQuasiStatic (W, s, h, t, er, backMetal, ZlEff, ErEff);
      54                 :            :   cpwline::analyseDispersion  (W, s, h, er, ZlEff, ErEff, frequency,
      55         [ #  # ]:          0 :                                ZlEffFreq, ErEffFreq);
      56                 :          0 :   nr_double_t dl = (W / 2 + s) / 2;
      57                 :          0 :   return dl * ErEffFreq / C0 / ZlEffFreq;
      58                 :            : }
      59                 :            : 
      60                 :          0 : void cpwopen::initSP (void) {
      61                 :          0 :   allocMatrixS ();
      62                 :          0 :   checkProperties ();
      63                 :          0 : }
      64                 :            : 
      65                 :          0 : void cpwopen::calcSP (nr_double_t frequency) {
      66 [ #  # ][ #  # ]:          0 :   setS (NODE_1, NODE_1, ztor (1.0 / calcY (frequency)));
         [ #  # ][ #  # ]
      67                 :          0 : }
      68                 :            : 
      69                 :          0 : void cpwopen::checkProperties (void) {
      70                 :          0 :   nr_double_t W = getPropertyDouble ("W");
      71                 :          0 :   nr_double_t s = getPropertyDouble ("S");
      72                 :          0 :   nr_double_t g = getPropertyDouble ("G");
      73         [ #  # ]:          0 :   if (g <= W + s + s) {
      74                 :            :     logprint (LOG_ERROR, "WARNING: Model for coplanar open end valid for "
      75                 :          0 :               "g > 2b (2b = %g)\n", W + s + s);
      76                 :            :   }
      77                 :          0 :   nr_double_t ab = W / (W + s + s);
      78 [ #  # ][ #  # ]:          0 :   if (ab < 0.2 || ab > 0.8) {
      79                 :            :     logprint (LOG_ERROR, "WARNING: Model for coplanar open end valid for "
      80                 :          0 :               "0.2 < a/b < 0.8 (a/b = %g)\n", ab);
      81                 :            :   }
      82                 :          0 : }
      83                 :            : 
      84                 :          0 : nr_complex_t cpwopen::calcY (nr_double_t frequency) {
      85                 :          0 :   nr_double_t o = 2 * M_PI * frequency;
      86                 :          0 :   nr_double_t c = calcCend (frequency);
      87                 :          0 :   return nr_complex_t (0, c * o);
      88                 :            : }
      89                 :            : 
      90                 :          0 : void cpwopen::initDC (void) {
      91                 :          0 :   allocMatrixMNA ();
      92         [ #  # ]:          0 :   setY (NODE_1, NODE_1, 0);
      93                 :          0 : }
      94                 :            : 
      95                 :          0 : void cpwopen::initAC (void) {
      96                 :          0 :   allocMatrixMNA ();
      97                 :          0 :   checkProperties ();
      98                 :          0 : }
      99                 :            : 
     100                 :          0 : void cpwopen::calcAC (nr_double_t frequency) {
     101                 :          0 :   setY (NODE_1, NODE_1, calcY (frequency));
     102                 :          0 : }
     103                 :            : 
     104                 :            : // properties
     105                 :            : PROP_REQ [] = {
     106                 :            :   { "W", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
     107                 :            :   { "S", PROP_REAL, { 1e-3, PROP_NO_STR }, PROP_POS_RANGE },
     108                 :            :   { "G", PROP_REAL, { 5e-3, PROP_NO_STR }, PROP_POS_RANGE },
     109                 :            :   { "Subst", PROP_STR, { PROP_NO_VAL, "Subst1" }, PROP_NO_RANGE },
     110                 :            :   PROP_NO_PROP };
     111                 :            : PROP_OPT [] = {
     112                 :            :   { "Backside", PROP_STR, { PROP_NO_VAL, "Metal" },
     113                 :            :     PROP_RNG_STR2 ("Metal", "Air") },
     114                 :            :   PROP_NO_PROP };
     115                 :            : struct define_t cpwopen::cirdef =
     116                 :            :   { "COPEN", 1, PROP_COMPONENT, PROP_NO_SUBSTRATE, PROP_LINEAR, PROP_DEF };

Generated by: LCOV version 1.11