Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

trlines.h

Go to the documentation of this file.
00001 // SuperMix version 1.0  C++ source file
00002 //
00003 // Copyright (c) 1999 California Institute of Technology.
00004 // All rights reserved.
00005 //
00006 // Redistribution and use in source and binary forms for noncommercial
00007 // purposes are permitted provided that the above copyright notice and
00008 // this paragraph are duplicated in all such forms and that any
00009 // documentation and other materials related to such distribution and
00010 // use acknowledge that the software was developed by California
00011 // Institute of Technology. Redistribution and/or use in source or
00012 // binary forms is not permitted for any commercial purpose. Use of
00013 // this software does not include a permitted use of the Institute's
00014 // name or trademark for any purpose.
00015 //
00016 // DISCLAIMER:
00017 // THIS SOFTWARE AND/OR RELATED MATERIALS ARE PROVIDED "AS-IS" WITHOUT
00018 // WARRANTY OF ANY KIND INCLUDING ANY WARRANTIES OF PERFORMANCE OR
00019 // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE OR PURPOSE (AS SET
00020 // FORTH IN UCC 23212-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
00021 // LICENSED PRODUCT, HOWEVER USED.  IN NO EVENT SHALL CALTECH/JPL BE
00022 // LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING BUT NOT LIMITED TO
00023 // INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, INCLUDING ECONOMIC
00024 // DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF
00025 // WHETHER CALTECH/JPL SHALL BE ADVISED, HAVE REASON TO KNOW, OR IN
00026 // FACT SHALL KNOW OF THE POSSIBILITY.  THE USER BEARS ALL RISK
00027 // RELATING TO QUALITY AND PERFORMANCE OF THE SOFTWARE AND/OR RELATED
00028 // MATERIALS.
00029 //
00030 // ************************************************************************
00031 // trlines.h
00032 //
00033 // JZ 9/23/97; FRR 9/17/98; JSW 6/3/99
00034 //
00035 // trlines.h holds classes related to transmission line
00036 // elements used in the linear circuit simulator.
00037 // This includes:
00038 //
00039 //   class dielectric : returns a complex dielectric constant.
00040 //         In general, may be a function of frequency and
00041 //         temperature.
00042 //   class const_diel : A simple class for a dielectric that
00043 //         is frequency and temperature independent. Inherits
00044 //         class dielectric.
00045 //   class trl_base : generic abstract class inherited by all
00046 //         concrete transmission line classes.
00047 //   class microstrip : uses surface impedance classes defined
00048 //         in surfaceZ.h to build real, lossy microstrips
00049 //   class cpw : ideal, lossless coplanar waveguide.
00050 //   class r_waveguide : real, lossy rectangular waveguide.
00051 //   class trline  : a concrete, generic transmission line in which
00052 //         phase length, power loss per wavelength, and impedance
00053 //         are controlled by parameters set by the user
00054 //
00055 // Change History:
00056 //
00057 // 5/30/00:   fixed zchar calculation in r_waveguide class
00058 // 4/13/00:   added lossy materials to r_waveguide
00059 // 4/6/00:    added a new constructor to const_diel
00060 // 3/28/00:   added class r_waveguide:losseless retangular waveguide
00061 // 11/16/99:  made wavelength() and percent_loss() part of trl_base()
00062 // 11/16/99:  major changes throughout
00063 // 10/29/99:  default trline impedance now shadows device::Z0
00064 // 9/29/99:   added bottom plane to class cpw (Only lossless calcs)
00065 // 8/23/99:   Removed useless dielectric default constructor
00066 // 6/3/99:    added coplanar waveguide class cpw (JSW) (Only lossless calcs)
00067 // 1/15/99:   changed the return types of void fcns in microstrip
00068 // 11/23/98:  changed trline to use same interface as pcircuit trl
00069 //            added #include <math.h> for double log(double)
00070 // 9/17/98:   added trline: a simple transmission line class
00071 // 9/17/98:   changed trl to trl_base; sped up member fcns
00072 // 9/16/98:   changed the names of some members
00073 // 7/28/98:   removed #include <math.h>, since it's unnecessary
00074 // 2/10/98:   modified by JZ
00075 //          - added Temp (temperature) parameter to class microstrip 
00076 //            This allows the temperature of a microstrip section to be
00077 //            arbitrary, not necessarily the same as device::T
00078 //          - introduced utility functions wavelength(), percent_loss()
00079 //            to calculate these quantities from the complex propagation
00080 //            constant.
00081 //
00082 // ************************************************************************
00083 //
00084 // class dielectric
00085 //
00086 // An abstract class from which other classes may be derived, it specifies
00087 // an interface to return a dielectric constant for use in transmission
00088 // line classes:
00089 //   epsilon(freq,Temp);  // returns the complex dielectric constant 
00090 //
00091 // ************************************************************************
00092 //
00093 // class const_diel
00094 //
00095 // A class which provides a concrete implementation of class dielectric, it
00096 // returns the dielectric constant given by parameters eps, tand:
00097 //   eps : real part of dielectric constant
00098 //   tand: loss tangent, such that -eps*tand is the imaginary part
00099 //
00100 // The default values for these parameters are 1 and 0, simulating vacuum.
00101 //
00102 // The simplest way to use this class is to assign constant values to
00103 // eps and tand, thus the name "const_diel". A more sophisticated use
00104 // would be to have these parameters shadow some other abstract
00105 // parameters (see abstract_real_parameter.h) which return values
00106 // dependent on device::f and device::T, etc.
00107 //
00108 // example declaration:
00109 //   const_diel quartz(3.78, 0.0001);
00110 //
00111 // ************************************************************************
00112 //
00113 // class trl_base
00114 //
00115 // All concrete transmission line classes in this header inherit trl_base.
00116 // A trl_base object is usable as a class nport object (i.e. can return S
00117 // (scattering) and C (noise correlation) matrices, and the b vector
00118 // (source wave amplitudes).
00119 //
00120 // The philosophy here is that the concrete transmission line classes (such
00121 // as microstrip) are responsible for storing their physical parameters and
00122 // using these to calculate their characteristic impedance and propagation
00123 // constant. The conversion of these quantities to the S and C matrices is
00124 // generic, and can therefore be handled by the trl_base class. Also, we
00125 // insist that all transmission line classes be able to return their
00126 // characteristic impedance and propagation constant to the user, so we
00127 // include virtual interface functions for these in this trl_base class.
00128 //
00129 // All classes derived from trl_base are therefore 2-port circuit elements
00130 // which also provide the following public functions:
00131 //
00132 //   complex Zchar(f,T);  // characteristic impedance at freq f and Temp T
00133 //   complex Kprop(f,T);  // propagation constant at f and T
00134 //
00135 // The sign convention on the propagation constant is that the phase of
00136 // a propagating wave goes as exp(-Kprop*length), so the real part of
00137 // Kprop is POSITIVE for a lossy transmission line.
00138 //
00139 // In addition, the following public static (global) functions are
00140 // provided:
00141 //
00142 //   double trl_base::wavelength(complex k);
00143 //     // returns the wavelength corresponding to a propagation constant k
00144 //
00145 //   double trl_base::percent_loss(complex k);
00146 //     // returns the power loss per wavelength in percent corresponding
00147 //     // to the propagation constant k. Loss requires k.real > 0. 
00148 //  
00149 // ************************************************************************
00150 //
00151 // class microstrip
00152 //
00153 // This is a concrete class representing a lossy microstrip transmission
00154 // line. The materials of the line are represented using class dielectric
00155 // for the dielectric materials and class surfimp for the conductors as
00156 // follows (cross-section through a microstrip is shown):
00157 //
00158 //
00159 //   superstrate()   <-- width -->              sub_thick
00160 //                   _____________              |
00161 //       ____________|///////////|______________v_
00162 //                        |
00163 //   substrate()          top_strip()    ground_plane()
00164 //       _______________________________/_________
00165 //       \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ^
00166 //                                              |
00167 //
00168 // The user must first create two objects derived from class dielectric to
00169 // describe the substrate and superstrate materials, as well as two objects 
00170 // derived from class surfimp (see surfaceZ.h) to specify the top strip and
00171 // groundplane conductors. These objects are then passed to the microstrip 
00172 // using the member functions:
00173 //
00174 //    superstrate(d1);  // dielectric d1 is the superstrate material
00175 //    substrate(d2);    // dielectric d2 is the substrate material
00176 //    top_strip(c1);    // surfimp (conductor) c1 is the top strip material
00177 //    ground_plane(c2); // surfimp (conductor) c2 is the groundplane
00178 //
00179 // The following member parameters are used the control other
00180 // characteristics of the microstrip:
00181 //  
00182 //    sub_thick;  // the substrate thickness
00183 //    width;      // the top strip line width
00184 //    length;     // the length of the microstrip line
00185 //    Temp;       // the temperature, if different from device::T
00186 //
00187 // The surfimp objects have their own member parameters which control
00188 // the thicknesses of the top strip and groundplane conductors.
00189 //
00190 // The following member functions are provided to examine the electrical
00191 // characteristics of the microstrip, in addition to Zchar() and Kprop(),
00192 // which are described in class trl_base.
00193 //
00194 //    complex Zser(f,T);  // series impedance at freq f and Temp T
00195 //    complex Ypar(f,T);  // parallel admittance at freq f and Temp T
00196 //
00197 // Attempting to calculate the electrical characteristics of a microstrip
00198 // with unphysical or uninitialized properties will result in a fatal
00199 // error, with one exception: if the length of the strip is 0, then its
00200 // 2-port response will be calculated without error, giving an S matrix
00201 // which has no effect, ie:
00202 //
00203 //        0  1           0  0 
00204 //   S =            C = 
00205 //        1  0           0  0
00206 //
00207 // This will be the result returned regardless of the settings of the other
00208 // parameters controlling the microstrip.
00209 //   
00210 // ************************************************************************
00211 //
00212 // class cpw
00213 //
00214 // This is a concrete class representing a coplanar waveguide. Currently
00215 // this class is lossless, noiseless, and assumes that the vacuum
00216 // superstrate is infinitely thick (i.e., that there is no cover plate).
00217 // The materials are represented using class dielectric for the substrate
00218 // material and class surfimp for the conductors as follows (cross-section
00219 // through a cpw is shown):
00220 //
00221 //                   vacuum
00222 //
00223 //            <-- space --><-- width -->   sub_thick    ground plane
00224 //       ______            _____________       |    ___/__
00225 //       /////|____________|///////////|_______v____|/////
00226 //                              |
00227 //          substrate()         top_strip()         bottom_plane()*
00228 //       __________________________________________/______ 
00229 //       \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\  ^  \\\\\\\\                .
00230 //                                             |
00231 //   *The bottom_plane need not be present
00232 //
00233 // The user must first create an object derived from class dielectric to
00234 // describe the substrate material, as well as objects derived from class
00235 // surfimp (see surfaceZ.h) to specify the top conductor and, if required,
00236 // the bottom plane conductor. The ground plane on either side of the
00237 // center top strip will use the same surfimp object as the center
00238 // conductor. These objects are then passed to the cpw object using the
00239 // member functions:
00240 //
00241 //    substrate(d);     // dielectric d is the substrate material
00242 //    top_strip(c1);    // surfimp (conductor) c1 is the top material
00243 //    bottom_plane(c2); // surfimp (conductor) c2 is the bottom plane
00244 //
00245 // If the function bottom_plane() is not called, the cpw will be calculated
00246 // without a conductive backing on the bottom surface of the substrate. If
00247 // called, the cpw will be calculated with a conductive backing.
00248 //
00249 // The following member parameters are used the control other
00250 // characteristics of the cpw line (note that the center conductor is
00251 // centered between the ground planes):
00252 //  
00253 //    sub_thick;  // the substrate thickness
00254 //    width;      // the top strip center conductor line width
00255 //    space;      // the gap between the center conductor each ground plane
00256 //    length;     // the length of the cpw line
00257 //    Temp;       // the temperature, if different from device::T
00258 //
00259 // The surfimp objects have their own member parameters which control
00260 // the thicknesses of the top and bottom conductors.
00261 //
00262 // The following member functions are provided to examine the electrical
00263 // characteristics of the cpw line, in addition to Zchar() and Kprop(),
00264 // which are described in class trl_base.
00265 //
00266 //    complex Zser(f,T);  // series impedance at freq f and Temp T
00267 //    complex Ypar(f,T);  // parallel admittance at freq f and Temp T
00268 //
00269 // Attempting to calculate the electrical characteristics of a cpw line
00270 // with unphysical or uninitialized properties will result in a fatal
00271 // error, with one exception: if the length of the strip is 0, then its
00272 // 2-port response will be calculated without error, giving an S matrix
00273 // which has no effect, ie:
00274 //
00275 //        0  1           0  0 
00276 //   S =            C = 
00277 //        1  0           0  0
00278 //
00279 // This will be the result returned regardless of the settings of the other
00280 // parameters controlling the cpw line.
00281 //
00282 // See Ghione, G. and Naldi, C.: IEEE Transactions on Microwave Theory and
00283 // Techniques, Vol MTT-35, No. 3, March 1987, pp 260 - 267.
00284 //
00285 // ************************************************************************
00286 //
00287 // class r_waveguide
00288 //
00289 // This is a concrete class representing a rectangular waveguide propagating
00290 // the TE10 mode. Currently this class can include real, lossy materials, but
00291 // it assumes the walls of the guide are perfectly smooth (no roughness
00292 // contribution to the loss), and the loss calculations are accurate only
00293 // when they result in the lossy part of the propagation constant << the
00294 // imaginary part, so the calculations may be very inaccurate near cutoff.
00295 // Below cutoff, the losses of the materials are ignored; in particular, the
00296 // characteristic impedance below cutoff will be purely imaginary, as it
00297 // would be for a lossless waveguide.
00298 //
00299 // The following figure shows the definitions of the parameters the user must
00300 // set:
00301 //
00302 //
00303 //                         <----- a ------>   |
00304 //                       //________________// v
00305 //                       /|                |/ 
00306 //              wall() ->/|     fill()     |/ b
00307 //                       /|                |/ 
00308 //                       /|________________|/
00309 //                       //////////////////// ^
00310 //                                            |
00311 //
00312 // Parameter a is assumed to be the long dimension of the guide and
00313 // consequently defines the cutoff frequency.
00314 //
00315 // The user may specify materials to be used in the guide by calling
00316 // member functions fill() and/or wall(). If these functions aren't
00317 // called, vacuum is assumed to fill the guide and the walls are assumed
00318 // to be perfect conductors. If these functions are to be called, the
00319 // user must first create an object derived from class dielectric to pass
00320 // to fill(), and/or an object derived from class surfimp (see surfaceZ.h)
00321 // to pass to wall().
00322 //
00323 //    fill(d);     // dielectric d fills the waveguide
00324 //    wall(c);     // surfimp (conductor) c forms the walls of the guide
00325 //
00326 // The following member parameters are used to set the remaining
00327 // characteristics of the rectangular waveguide:
00328 //  
00329 //    a;       // the long dimension of the guide cross section
00330 //    b;       // the short dimension of the guide cross section
00331 //    length;  // the length of the guide
00332 //    Temp;    // the temperature of the guide (default is device::T)
00333 //
00334 // The following member function is provided to examine the electrical
00335 // characteristics of the waveguide, in addition to Zchar() and Kprop(),
00336 // which are described in class trl_base.
00337 //
00338 //    double  fc(freq,Temp);     // the cutoff frequency of the guide
00339 //    complex Zwave(freq, Temp); // the wave impedance in the guide
00340 //
00341 // Note that fc() is a function of frequency and temperature, since the
00342 // dielectric constant of the fill material may be such a function. The
00343 // value of fc() in this case is not the true cutoff frequency, but the
00344 // cutoff frequency which would result assuming constant dielectric
00345 // properties given by the properties at the specified conditions. This
00346 // is the relevant value when calculating the propagation properties of
00347 // the guide at the given frequency and temperature.
00348 //
00349 // The Zchar() calculation returns the "Zpv" impedance, which relates wave
00350 // power and voltage between the top and bottom surfaces of the guide.
00351 // It is given by Zpv = 2*b/a*Zwave, where Zwave is the wave impedance
00352 // in the guide. If you need another version of the guide impedance,
00353 // consider:
00354 //
00355 //    Zpv = Zchar(); Zvi = Pi/4*Zpv;  Zpi = Pi/4*Zvi
00356 //
00357 // Attempting to calculate the electrical characteristics of a r_waveguide
00358 // with unphysical or uninitialized properties will result in a fatal
00359 // error, with one exception: if the length of the guide is 0, then its
00360 // 2-port response will be calculated without error, giving an S matrix
00361 // which has no effect, ie:
00362 //
00363 //        0  1           0  0 
00364 //   S =            C = 
00365 //        1  0           0  0
00366 //
00367 // This will be the result returned regardless of the settings of the other
00368 // parameters controlling the r_waveguide.
00369 //
00370 // ************************************************************************
00371 //
00372 // class trline
00373 //
00374 // This is a concrete class which can be used to represent any transmission
00375 // line whose electrical characteristics are known or can be caluclated.
00376 //
00377 // The following member parameters are used to set the characteristics of
00378 // the trline:
00379 //  
00380 //   freq;     // frequency for which the phase length is given
00381 //   theta;    // phase length of the line at freq, in radians
00382 //   loss;     // power loss per wavelength (between 0 and 1)
00383 //   zchar;    // characteristic impedance (may be complex)
00384 //   Temp;     // the temperature (shadow device::T by default)
00385 //
00386 // The calculations assume that the phase velocity and loss per wavelength
00387 // are independent of frequency (if the parameters values are held constant).
00388 // Since the phase velocity cannot be determined from the electrical
00389 // parameters above, the calculations assume that the phase velocity has a
00390 // numerical value equal to 2*Pi*freq, so that the wave number == 1.0 for
00391 // frequency == freq. This assumption leads to the following expression for
00392 // the complex propagation constant Kprop as a function of frequency f:
00393 //   Kprop(f) = (f/freq) * ( -ln(1-loss)/(4*Pi) + I );
00394 //
00395 // and a physical length given by:
00396 //   length = theta;
00397 //
00398 // Clearly this means that the function Kprop(f,T) gives results that are
00399 // pretty much meaningless as far as the absolute number returned.
00400 //
00401 // ************************************************************************
00402 
00403 #ifndef TRLINES_H
00404 #define TRLINES_H 1
00405 
00406 #include "math.h"
00407 #include "global.h"
00408 #include "units.h"
00409 #include "SIScmplx.h"
00410 #include "surfaceZ.h"
00411 #include "parameter.h"
00412 #include "parameter/complex_parameter.h"
00413 #include "nport.h"
00414 
00415 
00416 // ************************************************************************
00417 class dielectric {
00418 public:
00419   // This is the entire interface !
00420   virtual complex epsilon(double freq, double Temp)=0;
00421   complex epsilon() {return epsilon(device::f, device::T);}
00422 
00423   // Virtual destructor is necessary to ensure proper subclass destruction.
00424   virtual ~dielectric() { } 
00425 };
00426 
00427 
00428 // ************************************************************************
00429 class const_diel : public dielectric {
00430 public:
00431 
00432   // these parameters are dimensionless
00433   parameter eps ;    // dielectric constant
00434   parameter tand ;   // loss tangent
00435   
00436   // constructor initializes parameters with constant values:
00437   const_diel(double e = 1.0, double t = 0.0 ) : eps(e), tand(t) { }
00438 
00439   // The definition of epsilon() is simple: return eps*(1 - I*tand)
00440   // The -I ensures that wave attenuates as it propagates (recall
00441   // exp(+I omega t) time dependence, so propagation factor is
00442   // exp (-I * sqrt(epsilon) * (omega / c) * distance) 
00443   // const_dielectric ignores the freq and Temp arguments. 
00444   complex epsilon(double, double)
00445     { return eps.get()*complex(1., -tand.get()); }
00446   
00447   // Virtual destructor is necessary to ensure proper subclass destruction.
00448   virtual ~const_diel() { }
00449 };
00450 
00451 
00452 // ************************************************************************
00453 class trl_base : public nport
00454 {
00455 public:
00456 
00457   // These interfaces are included because we want all transmission line
00458   // classes to be able to report these parameters to the user
00459 
00460   // - characteristic impedance
00461   virtual complex Zchar(double freq, double Temp) = 0 ;
00462           complex Zchar() { return Zchar(device::f, device::T); }
00463 
00464   // - propagation constant
00465   virtual complex Kprop(double freq, double Temp) = 0;
00466           complex Kprop() { return Kprop(device::f, device::T); }
00467 
00468 
00469   // some utility functions to get wavelength and percent loss per wavelength
00470   // from a propagation constant (note that they are static functions).
00471 
00472   static double wavelength(complex prop_constant) ;
00473   static double percent_loss(complex prop_constant) ;
00474 
00475 
00476   // All trl_base devices have 2 ports.
00477   int size() { return 2; }
00478 
00479   // Constructor creates a sourceless nport object with 2 ports.
00480   trl_base() : nport(2) { info.source = false; }
00481 
00482   // Virtual destructor is necessary to ensure proper subclass destruction.
00483   virtual ~trl_base() { }
00484 
00485 protected:
00486   // This is where the S matrix etc. is calculated from the propagation
00487   // constant and characteristic impedance of the line.
00488   // Note that it should be called by recalc() in subclasses of trl_base.
00489   // Note also that if length == 0, then S11 = S22 = 0, S12 = S21 = 1
00490   // will always be the result, regardless of beta, zchar, znorm.
00491   void calc(complex beta, complex zchar, double length, double znorm) ;
00492 
00493 
00494 };
00495 
00496 // ************************************************************************
00497 class microstrip : public trl_base {
00498   
00499 public:
00500 
00501   // Microstrip length
00502   parameter length ;
00503 
00504   // Microstrip width
00505   parameter width;
00506 
00507   // Substrate thickness
00508   parameter sub_thick ;
00509 
00510   // Temperature -- shadows device::T by default
00511   parameter Temp ;
00512 
00513   // Constructor
00514   microstrip() ;
00515 
00516   // Functions to set the various materials.
00517   // Note that we pass objects by reference.
00518 
00519   microstrip & substrate(dielectric & d)   // substrate dielectric
00520     {sub = &d; return *this;}
00521   microstrip & superstrate(dielectric & d) // superstrate dielectric
00522     {super = &d; return *this;}
00523   microstrip & top_strip(surfimp & s)      // top strip surface impedance
00524     {top = &s; return *this;}
00525   microstrip & ground_plane(surfimp & s)   // ground plane surface impedance
00526     {ground = &s; return *this;}
00527 
00528   // Return characteristic impedance and propagation constant
00529   complex Kprop(double freq, double T);
00530   complex Zchar(double freq, double T);
00531 
00532   // Return series impedance and shunt admittance
00533   complex Zser(double freq, double T);
00534   complex Ypar(double freq, double T);
00535   
00536   // microstrips are "active" noise sources if not at device::T
00537   const nport::data_info & get_data_info()
00538   { info.active = (Temp != device::T); return info; }
00539   
00540   // Virtual destructor is necessary to ensure proper subclass destruction.
00541   virtual ~microstrip() { }
00542 
00543 
00544 protected:
00545   
00546   // Pointers to dielectric objects
00547   dielectric *sub ;  
00548   dielectric *super ;
00549 
00550   // pointers to surface impedance objects
00551   surfimp *top ;
00552   surfimp *ground ;
00553 
00554 
00555 private:
00556 
00557   // This function recalculates the microstrip properties
00558   void update(double freq, double Temp) ;
00559 
00560   // make sure to call update() before trusting these
00561   // These variables provide a simple way for update() return multiple values
00562   complex Zs;
00563   complex Yp;
00564   complex zchar;
00565   complex beta ;
00566 
00567   // The calculations are called here.
00568   void recalc_S()
00569     {
00570       if(length != 0.0) update(device::f,Temp);
00571       calc(beta, zchar, length, device::Z0);
00572     }
00573       
00574   void recalc()
00575     { recalc_S(); data.passive_noise(device::f,Temp); }
00576 } ;
00577 
00578 inline complex microstrip::Zser(double freq, double T)
00579 { update(freq,T); return Zs; }
00580 inline complex microstrip::Ypar(double freq, double T)
00581 { update(freq,T); return Yp; }
00582 inline complex microstrip::Kprop(double freq, double T)
00583 { update(freq,T); return beta; }
00584 inline complex microstrip::Zchar(double freq, double T)
00585 { update(freq,T); return zchar; }
00586 
00587 
00588 // ************************************************************************
00589 class cpw : public trl_base {
00590   
00591 public:
00592 
00593   // cpw length
00594   parameter length ;
00595 
00596   // conductor width
00597   parameter width;
00598 
00599   // conductor to ground spacing
00600   parameter space;
00601 
00602   // Substrate thickness
00603   parameter sub_thick ;
00604 
00605   // Temperature -- shadows device::T by default
00606   parameter Temp ;
00607 
00608   // Constructor
00609   cpw() ;
00610 
00611   // Functions to set materials:
00612   // note that we pass objects by reference
00613 
00614   cpw & substrate(dielectric & d)  // substrate dielectric
00615     {sub = &d; return *this;}
00616   cpw & top_strip(surfimp & s)      // top strip surface impedance
00617     {top = &s; return *this;}
00618 
00619   // If the function bottom_plane() is not called, the cpw will be calculated
00620   // without a conductive backing.  If it is called, the cpw will be calculated
00621   // with a conductive backing.
00622   cpw & bottom_plane(surfimp & s)   // conductive backing surface impedance
00623     {bottom = &s; return *this;}
00624 
00625   // Return characteristic impedance and propagation constant
00626   complex Kprop(double freq, double T);
00627   complex Zchar(double freq, double T);
00628 
00629   // Return series impedance and shunt admittance
00630   complex Zser(double freq, double T);
00631   complex Ypar(double freq, double T);
00632   
00633   // cpw lines are "active" noise sources if not at device::T
00634   const nport::data_info & get_data_info()
00635   { info.active = (Temp != device::T); return info; }
00636   
00637   // Virtual destructor is necessary to ensure proper subclass destruction.
00638   virtual ~cpw() { }
00639 
00640 protected:
00641 
00642   // Pointer to dielectric substrate.
00643   // Superstrate is assumed to be vacuum.
00644   dielectric *sub ;  
00645 
00646   // Pointer to surface impedance object for conductive plane.
00647   // If bottom==0, then no conductive backing is used in calculation.
00648   surfimp *top ;
00649   surfimp *bottom ;
00650 
00651 private:
00652 
00653   // This function recalculates the cpw electrical properties
00654   void update(double freq, double Temp) ;
00655 
00656   // make sure to call update() before trusting these
00657   // These variables provide a simple way for update() return multiple values
00658   complex zchar ;
00659   complex Zs;
00660   complex Yp;
00661   complex beta ;
00662   
00663   // "complete elliptical function ratio"
00664   // Compute ratio of complete elliptical function of the first kind over
00665   // the complete elliptical function of the first kind of the complement.
00666   // Current implementation is an approximation. Called by update().
00667   double cefr(double);
00668 
00669   // The calculations are called here.
00670   void recalc_S()
00671     {
00672       if(length != 0.0) update(device::f,Temp);
00673       calc(beta, zchar, length, device::Z0);
00674     }
00675       
00676   void recalc()
00677     { recalc_S(); data.C = 0.0; }  // noiseless
00678 
00679 } ;
00680 
00681 inline complex cpw::Kprop(double freq, double T)
00682 { update(freq,T); return beta; }
00683 inline complex cpw::Zchar(double freq, double T)
00684 { update(freq,T); return zchar; }
00685 inline complex cpw::Zser(double freq, double T)
00686 { update(freq,T); return Zs; }
00687 inline complex cpw::Ypar(double freq, double T)
00688 { update(freq,T); return Yp; }
00689 
00690 
00691 // ************************************************************************
00692 class r_waveguide : public trl_base
00693 {
00694 public:
00695 
00696   parameter a;       // waveguide long dimension
00697   parameter b;       // waveguide short dimension
00698   parameter length;  // waveguide physical length
00699   parameter Temp ;   // shadows device::T by default
00700 
00701   // Functions to set materials:
00702   // note that we pass objects by reference
00703   r_waveguide & fill(dielectric & d) { fill_ = &d; return *this; }
00704   r_waveguide & wall(surfimp & s)    { wall_ = &s; return *this; }
00705 
00706   // Return characteristic impedance and propagation constant
00707   complex Zwave(double freq, double Temp);
00708   complex Zchar(double freq, double Temp);
00709   complex Kprop(double freq, double Temp);
00710 
00711   // Return cutoff frequency - generates an error if a <= 0
00712   double fc(double freq, double Temp);
00713   double fc() { return fc(device::f,device::T); }
00714 
00715   // Constructor
00716   r_waveguide()
00717     : trl_base(), a(0.0), b(0.0), length(0.0), Temp(&device::T),
00718       fill_(0), wall_(0)
00719  { }
00720 
00721   // r_waveguides are "active" noise sources if not at device::T
00722   // and have loss; they are noiseless if lossless
00723   const nport::data_info & get_data_info();
00724   
00725   // Virtual destructor is necessary to ensure proper subclass destruction.
00726   virtual ~r_waveguide() { }
00727 
00728 
00729 protected:
00730 
00731   // Pointer to dielectric. If zero, assumes vacuum.
00732   dielectric *fill_ ;  
00733 
00734   // Pointer to surface impedance object for the walls. If zero,
00735   // assumes perfectly conducting (no loss).
00736   surfimp *wall_ ;
00737 
00738 
00739 private:
00740 
00741   // This function recalculates the electrical properties
00742   void update(double freq, double T);
00743 
00744   // make sure to call update() before trusting these
00745   // These variables provide a simple way for update() return multiple values
00746   complex zwave ;
00747   complex gamma ;
00748 
00749   // The calculations are called here.
00750   void recalc_S()
00751     {
00752       if(length != 0.0) update(device::f, Temp);
00753       calc(gamma, 2*b/a*zwave, length, device::Z0);
00754     }
00755       
00756   void recalc()
00757     { recalc_S(); data.C = 0.0; }  // noiseless
00758 };
00759 
00760 inline complex r_waveguide::Kprop(double freq, double T)
00761 { update(freq, T); return gamma; }
00762 inline complex r_waveguide::Zwave(double freq, double T)
00763 { update(freq, T); return zwave; }
00764 inline complex r_waveguide::Zchar(double freq, double T)
00765 { return 2.0*b/a * Zwave(freq,T); }  // Zpv version
00766 
00767 
00768 // ************************************************************************
00769 class trline : public trl_base
00770 {
00771 public:
00772 
00773   parameter         theta;    // phase length of the line at freq
00774   parameter         freq;     // frequency for which phase length is given
00775   parameter         loss;     // power loss per wavelength (between 0 and 1)
00776   complex_parameter zchar;    // characteristic impedance (may be complex)
00777   parameter         Temp;     // the temperature (shadow device::T by default)
00778 
00779 
00780   // member functions to set parameters (either directly or shadowing):
00781 
00782   trline & set_theta( double T ) { theta = T; return *this; }
00783   trline & set_theta( abstract_real_parameter * pT )
00784   { theta = pT; return *this; }
00785 
00786   trline & set_freq( double F ) { freq = F; return *this; }
00787   trline & set_freq( abstract_real_parameter * pF )
00788   { freq = pF; return *this; }
00789 
00790   trline & set_loss( double L ) { loss = L; return *this; }
00791   trline & set_loss( abstract_real_parameter * pL )
00792   { loss = pL; return *this; }
00793 
00794   trline & set_zchar( complex Z ) { zchar = Z; return *this; }
00795   trline & set_zchar( abstract_complex_parameter * pZ )
00796   { zchar = pZ; return *this; }
00797 
00798   trline & set_T(double t) { Temp = t; return *this; }
00799   trline & set_T(abstract_real_parameter * pt)
00800   { Temp = pt; return *this; }
00801 
00802   // functions required to be defined by trl_base:
00803   complex Zchar(double, double) { return zchar; }
00804   complex Kprop(double f, double)
00805   { return (f/freq)*complex(-log(1.0-loss)/(4*Pi), 1.0); }
00806   
00807 
00808   // Constructor gives a lossless, zero-length line
00809   // The default zchar is device::Z0, Temp is device::T
00810   trline()
00811     : trl_base(),
00812       theta(0), freq(0), loss(0), zchar(&Z0), Temp(&T)
00813   { }
00814 
00815   // Virtual destructor is necessary to ensure proper subclass destruction.
00816   virtual ~trline() { }
00817 
00818   // trlines are "active" noise sources if not at device::T
00819   const nport::data_info & get_data_info()
00820     {
00821       info.noise = (loss != 0.0); info.active = (Temp != device::T && loss != 0.0);
00822       return info;
00823     }
00824   
00825 
00826 private:
00827 
00828   void recalc_S()
00829     { calc(Kprop(device::f,device::T), zchar, theta, device::Z0); }
00830 
00831   void recalc()
00832     { recalc_S(); data.passive_noise(device::f,Temp); }
00833 
00834 };
00835 
00836 #endif  // TRLINES_H

Please direct comments and corrections to supermix@submm.caltech.edu
Go to the supermix home page
Generated by doxygen1.2.7