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

transformer.cc

Go to the documentation of this file.
00001 // transformer.cc
00002 // SuperMix version 1.0  C++ source file
00003 //
00004 // Copyright (c) 1999 California Institute of Technology.
00005 // All rights reserved.
00006 //
00007 // Redistribution and use in source and binary forms for noncommercial
00008 // purposes are permitted provided that the above copyright notice and
00009 // this paragraph are duplicated in all such forms and that any
00010 // documentation and other materials related to such distribution and
00011 // use acknowledge that the software was developed by California
00012 // Institute of Technology. Redistribution and/or use in source or
00013 // binary forms is not permitted for any commercial purpose. Use of
00014 // this software does not include a permitted use of the Institute's
00015 // name or trademark for any purpose.
00016 //
00017 // DISCLAIMER:
00018 // THIS SOFTWARE AND/OR RELATED MATERIALS ARE PROVIDED "AS-IS" WITHOUT
00019 // WARRANTY OF ANY KIND INCLUDING ANY WARRANTIES OF PERFORMANCE OR
00020 // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE OR PURPOSE (AS SET
00021 // FORTH IN UCC 23212-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
00022 // LICENSED PRODUCT, HOWEVER USED.  IN NO EVENT SHALL CALTECH/JPL BE
00023 // LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING BUT NOT LIMITED TO
00024 // INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, INCLUDING ECONOMIC
00025 // DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF
00026 // WHETHER CALTECH/JPL SHALL BE ADVISED, HAVE REASON TO KNOW, OR IN
00027 // FACT SHALL KNOW OF THE POSSIBILITY.  THE USER BEARS ALL RISK
00028 // RELATING TO QUALITY AND PERFORMANCE OF THE SOFTWARE AND/OR RELATED
00029 // MATERIALS.
00030 //
00031 // Change history:
00032 // 10/29/99:  Default is now to shadow device::Z0
00033 // 9/27/99:   Added verbosity control for warning about impedance
00034 // 11/11/98:  Changed table access to new syntax
00035 // 9/18/98:   made constructors more efficient.
00036 // 7/28/98:   added <math.h> to includes, since SIScmplx.h doesn't
00037 // 12/29/97:  modified by FR for new sdata (with znorm)
00038 // 12/19/97:  modified by FR for matmath classes
00039 
00040 #include "transformer.h"
00041 #include "global.h"
00042 #include "error.h"
00043 #include <math.h>
00044 
00045 //
00046 // Default constructor
00047 //
00048 transformer::transformer() : 
00049   nport(2), Z1(&device::Z0), Z2(&device::Z0), is_verbose(false)
00050 { info.noise = info.active = info.source = false; }
00051 
00052 void transformer::recalc()
00053 {
00054   double znorm = device::Z0 ;
00055   Complex zz1 = Z1 ;
00056   Complex zz2 = Z2 ;
00057   double rr1 = real(zz1)/znorm ;
00058   double xx1 = imag(zz1)/znorm ;
00059   if(rr1 < Tiny) {
00060     if(is_verbose)
00061       error::warning(
00062       "Very small or negative input resistance for transformer") ;
00063     rr1 = Tiny;
00064   }
00065 
00066   double rr2 = real(zz2)/znorm ;
00067   double xx2 = imag(zz2)/znorm ;
00068   if(rr2 < Tiny) {
00069     if(is_verbose)
00070       error::warning(
00071       "Very small or negative output resistance for transformer") ;
00072     rr2 = Tiny;
00073   }
00074 
00075   double sr = sqrt(rr1/rr2) ;
00076   double zeta = 0.5*(sr - 1./sr) ;
00077   double psi = 0.5*(xx2*sr + xx1/sr) ;
00078   complex denom = sqrt(1.+zeta*zeta) + I*psi;
00079 
00080   complex S11 = (zeta + I*psi)/denom ;
00081   complex S22 = (-zeta + I*psi)/denom ;
00082   complex S12 = 1./denom ;  // = S21 from reciprocity
00083 
00084   data.set_znorm(znorm);  // which is Z0.  added 12/29/97.
00085   data.S[1][1] = S11;
00086   data.S[2][2] = S22;
00087   data.S[1][2] = S12;
00088   data.S[2][1] = S12;
00089 
00090   // Assume that data.C is already a zero matrix.
00091 }

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