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

deembed.cc

Go to the documentation of this file.
00001 // hemt.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 
00032 #include "deembed.h"
00033 #include "error.h"
00034 #include "matmath.h"
00035 
00036 deembed::deembed(nport & input, nport & output, nport & measured) : nport(2),
00037                in(&input), out(&output), meas(&measured)
00038 {
00039   if(in->size() !=2 || out->size() !=2 || meas->size() !=2)
00040     error::fatal("All circuits must be 2 ports in deembed constructor");
00041 
00042   info.noise = info.active = info.source = false;
00043 }
00044 
00045 Matrix deembed::scat_to_abcd(const sdata & sd)
00046 {
00047   Matrix s = sd.S;
00048   double z = sd.get_znorm();
00049   Matrix t(2);
00050 
00051   t[1][1] = ((1+s[1][1])*(1-s[2][2]) + s[1][2]*s[2][1])/(2 * s[2][1]);
00052   t[1][2] = ((1+s[1][1])*(1+s[2][2]) - s[1][2]*s[2][1]) * z / (2 * s[2][1]);
00053   t[2][1] = ((1-s[1][1])*(1-s[2][2]) - s[1][2]*s[2][1]) / (2 * z * s[2][1]);
00054   t[2][2] = ((1-s[1][1])*(1+s[2][2]) + s[1][2]*s[2][1])/(2 * s[2][1]);
00055 
00056   return t;
00057 }
00058 
00059 void deembed::recalc()
00060 {
00061   recalc_S();
00062   data.passive_noise(f, T);
00063 }
00064 
00065 void deembed::recalc_S()
00066 {
00067   Matrix dut(2);
00068   Matrix i_inv = inverse(scat_to_abcd(in->get_data()));
00069   Matrix o_inv = inverse(scat_to_abcd(out->get_data()));
00070 
00071   if(i_inv.Lsize != 2 || i_inv.Rsize != 2)
00072     error::warning("Inversion of input matrix in deembed failed");
00073 
00074   if(o_inv.Lsize != 2 || o_inv.Rsize != 2)
00075     error::warning("Inversion of output matrix in deembed failed");
00076 
00077   dut = i_inv * scat_to_abcd(meas->get_data()) * o_inv;
00078 
00079   complex A = dut[1][1];
00080   complex B = dut[1][2];
00081   complex C = dut[2][1];
00082   complex D = dut[2][2];
00083 
00084   data.set_znorm(Z0);
00085   double z = Z0;
00086 
00087   data.S[1][1] = (A + B/z - C*z - D)
00088                / (A + B/z + C*z + D);
00089 
00090   data.S[1][2] = 2.0 * (A*D - B*C) / (A + B/z + C*z + D);
00091 
00092   data.S[2][1] = 2.0 / (A + B/z + C*z + D);
00093 
00094   data.S[2][2] = (-A + B/z - C*z + D)
00095                / (A + B/z + C*z + D);
00096 }
00097  

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