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

lna.cc

Go to the documentation of this file.
00001 // Build a two-stage low noise amplifier, and simulate it
00002 // from 4 to 8 GHz.
00003 
00004 // Look at the example filter.annotated.cc for more detailed comments
00005 // concerning the objects and functions used.
00006 
00007 #include "supermix.h"
00008  
00009 int main()
00010 {
00011   // Set the global temperature and normalization impedance.
00012   device::T = 4.2 * Kelvin;
00013   device::Z0 = 50. * Ohm;
00014 
00015   // ==========================================================================
00016   // Building the circuit:
00017 
00018   // Declare the components to be used to make the amplifier.
00019   // There are two of each because this will be a two-stage amplifier.
00020 
00021   // fets are 2-ports, with a common-source configuration (see fet.h)
00022   fhx13x   t1, t2;      // Field-effect transistors made by Fujitsu (see hemt.h).
00023   inductor lg1, lg2;    // Gate tuning inductors.
00024   resistor rd1, rd2;    // Drain bias resistors.
00025 
00026   // Set the parameter values for the components.
00027   lg1.L = 2.5 * nHenry;
00028   lg1.series();         // series is the default, but who can remember such things
00029   lg2.L = 1.4 * nHenry;
00030   lg2.series();
00031   rd1.R = 100.0 * Ohm;
00032   rd1.parallel();
00033   rd2.R = 55. * Ohm;
00034   rd2.parallel();
00035   
00036   // Connect the components into a circuit.
00037   circuit amp;
00038   int input = amp.add_port(lg1, 1);  // Input test port
00039   amp.connect(lg1, 2, t1, 1);        // Make the connections...
00040   amp.connect(t1, 2, rd1, 1);
00041   amp.connect(rd1, 2, lg2, 1);
00042   amp.connect(lg2, 2, t2, 1);
00043   amp.connect(t2, 2, rd2, 1);
00044   int output = amp.add_port(rd2, 2); // Output test port
00045 
00046 
00047   // ==========================================================================
00048   // Now display the response of our amplifier:
00049 
00050   // The scattering and noise matrix results will be held in an sdata instance.
00051   sdata response;
00052 
00053   // Set options for formatted output. We'll print numbers right-justified,
00054   // fixed point.
00055   cout << fixed << right;
00056 
00057   cout << endl << "2 stage cryogenic low-noise amplifier" << endl << endl;
00058 
00059   // Here you also see what you need to do to set a specific output field width;
00060   // using setw() only affects the very next number output, so you have to call
00061   // it over and over again (kind of inconvenient, but that's C++).
00062   cout << setw(8) << "Freq" << "  "  
00063        << setw(8) << "S21(dB)" << "  "  
00064        << setw(8) << "S22(dB)" << "  "  
00065        << setw(8) << "Tn(K)" << "  "  
00066        << setw(8) << "NF(dB)" << endl << endl;
00067 
00068   // Loop through frequency, simulating the amplifier and printing results.
00069   for(double freq = 4.0; freq <=8.0; freq += 0.5)
00070   {
00071     // Set the frequency, then calculate and save the response.
00072     device::f = freq * GHz;
00073     response = amp.get_data();
00074 
00075     // Print out the frequency, gain, output match, noise temp, and noise figure.
00076     // See sdata.h for details about the member functions called.
00077     // Note use of units.
00078     cout << fixed << setprecision(4) 
00079          << setw(8) << device::f/GHz << "  "
00080          << setw(8) << response.SdB(output,input) << "  " 
00081          << setw(8) << response.SdB(output,output) << "  "
00082          << setw(8) << response.tn(output,input)/Kelvin << "  " 
00083          << setw(8) << response.NF(output,input) << "  "
00084          << endl;
00085   }
00086 }

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