Search This Blog

Monday, April 5, 2010

Simulation: Basics of SPICE Modeling (Current Sources) - 1 of 6

Introduction
There has been a few people that have talked to me recently about SPICE modeling.  It seems a lot of people use it but no one really knows how it works.  There are a number of books available that explain how it works.  One of the better (and older to today's standards) books is the Inside SPICE: Overcoming The Obstacles of Circuit Simulation.  This is a great book detailing the workings of the basic SPICE simulation.  There is a link to amazon below for it.  I will attempt to explain the first part of a series of posts about SPICE software.  This one will discuss the basics of Nodal Analysis (NA).


Nodal Analysis (NA)
Nodal Analysis is just as it sounds, the standard current summation at the various interconnection nodes.  Electrical Engineers learn this in their first circuits class.  NA is all that's needed to do DC and AC SPICE simulations.  I will discuss here how to perform basic Nodal Analysis.

You should note that in this method you can only have Current Sources and Resistors in the circuit.  In order to use voltage sources you must use Modified Nodal Analysis and to use the capacitors and inductors you must use companion models with numeric integration techniques.  But both of these are based off this first simulation style of Nodal Analysis.  I will discuss the prior techniques in later posts...


Figure 1: Basic Nodal Analysis Example

As you can notice in Figure 1, this circuit has a current source, and resistors.  You can do the node voltage technique to analyze this circuit.  This is what SPICE uses.  So to analyze this, find the two nodal equations:


Node 1


Node 2

Now you see that we have 2 unknowns and two equations.  The next step is to set up the matrices.  You will end up with 3 main matrices, a conductances matrix, unknowns matrix, and a knowns matrix.  After you separate the matrices you should get something that looks like this:




So the matrices with the 1/R-Values is the Conductances Matrix [G] and the matrix with voltages is the unknowns matrix [V] while the right-hand side matrix is the knowns matrix [I].  So how do you get results?  You have to do matrix manipulation.  The best way to do this is to do take the inverse of the G-matrix and multiply it to both sides.

Step 1:


Step 2:


Once you perform this calculation, you have solved for the unknowns V1 and V2.  And that's it.  I provided above the solution in the schematic.  You can use these numbers to test it yourself.  

If you want to do quick analysis of this, place it in MS Excel and use the MMINVERSE and MMULT commands.  Google this and you should find plenty on it.  I may post a blog later on using these.

Conclusion
It's amazing how simple this method is.  Everything else is based off this method.  Even the MNA is based on this method.  I will continue and show you guys the MNA method in the next post.

This is the one I have.  But there is a newer version below

This is the second edition.












--------------------
Justin Coulston
justin.coulston@gmail.com

No comments:

Post a Comment