Search This Blog

Friday, April 9, 2010

Simulation: Basics of SPICE Modeling (Matrix Templates) - 2 of 6

Introduction
This is a continuation of the SPICE modeling series.  I will attempt to explain how SPICE uses Matrix Templates to create a main matrix to perform the calculation.

SPICE Templates
Before I explain how voltage sources are used I should first explain how SPICE knows where to put information based on node numbers.

Each component in SPICE has an associated Matrix template that is added to a final matrix that performs the final calculation.  As repeated from the last SPICE tutorial: [G][U]=[K] are the [G], conductance matrix, [U], unknowns matrix, and [K], knowns matrix, or the matrix with the known sources (voltage and current sources).

The initial matrix for the conductances starts with inserting the conductances between the nodes first.  Each row and column corresponds with a particular node number.  So we can easily construct the matrix by summing the conductances between the nodes.


where n is the total number of nodes (not including ground)

So any components connected to node 1 will be summed at G11=1/R1+1/R2+ ... +1/Rn.

Now that you see how this first matrix works you can can understand how the templates can work.  For example, the resistor template has a node A and node B connection points with a resistance R.  Below is the matrix template



Now of course the template won't have the words node A and node B in them.  So if the resistor was between nodes 3 and 6 then you would add T11 to G33, T22 to G66, T12 to G36, and T21 to G63 of the main matrix.

So you follow this for all the components.  All components have some sort of matrix template.  Below I will the capacitive and current sources.  Inductor templates use a voltage source so we will talk about that later.


Add to the Conductance Matrix


Add to the Knowns Matrix

where
 
and


And for the current source it's simply adding the below matrix to the knowns table:



Conclusion
That's it for SPICE templates.  Again, each component has it's own matrix template.  This is the basics of how SPICE adds components in a netlist to a large matrix.

No comments:

Post a Comment