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

circuit Class Reference

Class circuit creates lists of devices to be connected, how to connect them, and how to arrange the ports of the final device. More...

#include <circuit.h>

Inheritance diagram for circuit::

nport device List of all members.

Public Methods

 circuit ()
 The default constructor initializes with 0 ports and empty lists/stacks. More...

 ~circuit ()
 A destructor is necessary to free "class connection" instances. More...

 circuit (const circuit &c)
 Copy a circuit. More...

int size ()
 The number of ports this device has. More...

const nport::data_infoget_data_info ()
 Noise and source status. More...

void connect (nport &, int, nport &, int)
 Connect two ports. More...

int add_port (nport &, int)
 Allow the user to specify the order of the ports in the final circuit. More...

port pop_port ()
 Removes the most recently added port to the circuit. More...

circuit& operator= (const circuit &c)
 Assignment operator. More...


Public Attributes

parameter Temp
 The temperature of this circuit. More...


Private Methods

void build_tree ()
 Build the connection tree. More...

void calc (bool noise)
 Calculate this circuit's data by performing all connections, etc. More...

void recalc ()
 The function for calculating sdata. More...

void recalc_S ()
 If the following function is implemented, it should only calculate the S matrix and B vector parts of data, leaving the C matrix part stale. More...


Private Attributes

nportSet devset
 We need a set of devices to use for connections. More...

portStack constack
 We need a stack of connections to be performed. More...

portVector labels
 A vector of port labels so that final data will be in desired order. More...

nporttree_base
 Base of the tree of connections. More...

bool tree_is_built
 This boolean remembers if the tree has already been built. More...

std::stack<connection *> del_stack
 Keep a stack of connection class instances to be freed by destructor. More...


Detailed Description

Class circuit creates lists of devices to be connected, how to connect them, and how to arrange the ports of the final device.

It then uses class connection to connect the devices and store the results in its own member data.

Definition at line 75 of file circuit.h.


Constructor & Destructor Documentation

circuit::circuit ( )
 

The default constructor initializes with 0 ports and empty lists/stacks.

Definition at line 54 of file circuit.cc.

circuit::~circuit ( )
 

A destructor is necessary to free "class connection" instances.

Definition at line 81 of file circuit.cc.

circuit::circuit ( const circuit & c )
 

Copy a circuit.

Most of the lists are copied. The elements in the lists are *not* copied.

Parameters:
c   the circuit to be copied

Definition at line 58 of file circuit.cc.


Member Function Documentation

int circuit::add_port ( nport & dev,
int index )
 

Allow the user to specify the order of the ports in the final circuit.

The parameters of device and port index specify a port. The first time add_port is called specifies the first port and returns the new index to that port, 1. The second time specifies the second port and returns its new index, 2. Etc.

Definition at line 138 of file circuit.cc.

Referenced by cascade::add(), fet::construct(), radial_stub::radial_stub(), mixer::balancer::rebuild(), and mixer::analyzer::rebuild().

void circuit::build_tree ( ) [private]
 

Build the connection tree.

Uses lists to create temporary class connection devices. Since each instance of class connection holds pointers to the devices it is to connect, the connections form a tree. The tips of the branches are the nports created by the user. The rest of the tree is connection instances created by this function.

Definition at line 166 of file circuit.cc.

Referenced by calc(), and get_data_info().

void circuit::calc ( bool noise ) [private]
 

Calculate this circuit's data by performing all connections, etc.

Parameters:
noise   ignore noise if this is false to save time

Definition at line 303 of file circuit.cc.

Referenced by recalc(), and recalc_S().

void circuit::connect ( nport & dev1,
int index1,
nport & dev2,
int index2 )
 

Connect two ports.

This is the main function that the user calls to build up the lists of devices and connections to be made. The integer parameters are the port indices.

Definition at line 94 of file circuit.cc.

Referenced by cascade::add(), fet::construct(), radial_stub::radial_stub(), mixer::balancer::rebuild(), and mixer::analyzer::rebuild().

const nport::data_info & circuit::get_data_info ( ) [virtual]
 

Noise and source status.

Returns:
info about the sdata of the device

Reimplemented from nport.

Definition at line 284 of file circuit.cc.

Referenced by cascade::get_data_info().

circuit & circuit::operator= ( const circuit & c )
 

Assignment operator.

Most of the lists are copied. The elements in the lists are *not* copied.

Parameters:
c   the circuit to be copied

Definition at line 66 of file circuit.cc.

port circuit::pop_port ( ) [inline]
 

Removes the most recently added port to the circuit.

It returns a port object identifying the port supplied to add_port() for the port just removed. The next port added with a subsequent add_port will be given the index previously assigned to this deleted port. If no calls to add_port() have been made, calling pop_port will result in a fatal error.

Returns:
the port most recently added to the circuit

Definition at line 195 of file circuit.h.

Referenced by cascade::add().

void circuit::recalc ( ) [inline, private, virtual]
 

The function for calculating sdata.

recalc() should do the following:

  • (1) Read device::f, device::Z0, and, by default, device::T to get the operating conditions for the response calculation.
  • (2) Calculate the S, C, and B matrix values and store them to nport::data, with all values normalized using device::Z0.
  • (3) Store the normalizing impedance to nport::data by calling data.set_znorm().

Reimplemented from nport.

Definition at line 126 of file circuit.h.

void circuit::recalc_S ( ) [inline, private, virtual]
 

If the following function is implemented, it should only calculate the S matrix and B vector parts of data, leaving the C matrix part stale.

Reimplemented from nport.

Definition at line 127 of file circuit.h.

int circuit::size ( ) [inline, virtual]
 

The number of ports this device has.

Returns:
the number of ports

Reimplemented from nport.

Definition at line 159 of file circuit.h.


Member Data Documentation

parameter circuit::Temp
 

The temperature of this circuit.

The default shadows device::T. The temperature is passed to subelements using device::T, so any subelement may override with its own explicit Temp value.

Definition at line 136 of file circuit.h.

portStack circuit::constack [private]
 

We need a stack of connections to be performed.

Definition at line 82 of file circuit.h.

std::stack< connection *> circuit::del_stack [private]
 

Keep a stack of connection class instances to be freed by destructor.

Definition at line 117 of file circuit.h.

nportSet circuit::devset [private]
 

We need a set of devices to use for connections.

Definition at line 79 of file circuit.h.

portVector circuit::labels [private]
 

A vector of port labels so that final data will be in desired order.

For example, we would want to define labels so that an amplifier gain will be S21 rather than S12.

Definition at line 89 of file circuit.h.

nport * circuit::tree_base [private]
 

Base of the tree of connections.

Calling tree_base->get_data() causes all of the connections to be computed by recursively calling get_data up all of the branches. Remember that data returned by tree_base->get_data() is not necessarily in the proper order desired by the user.

Definition at line 108 of file circuit.h.

bool circuit::tree_is_built [private]
 

This boolean remembers if the tree has already been built.

We only want to build the tree once, not every time we recalculate.

Definition at line 114 of file circuit.h.


The documentation for this class was generated from the following files:

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