Breaking it down – The .SUBCKT

Having done so many simulation examples, ever wondered how complex actual circuits can be? When you go on to design a circuit with some application it won’t be just one amplifier or one rectifier. It’ll have dozens of blocks. How do you fit all that in one schematic? Well you can’t – at least not without getting totally mixed up with where each block is. Thats where hierarchical design comes in. This means that you break down a system into blocks. Break these blocks down even further till you get the simplest ones – like a tree branching out and having leaves at the end. The advantage of this is that most of the time, these “leaves” will repeat across your circuit and with a hierarchical design, these circuits need to be defined just once and reused again.

I hope you have read my previous tutorial on symbol creation in gschem as well as other tutorials on SPICE. You can get these tutorials by pointing your mouse to the Tutorials menu at the top and then selecting SPICE. You need the symbol of the previous tutorial to go through this one. Click Here to go to the symbols creation tutorial.

We will first look at a few op-amp circuits. I will be using LM741 for the examples. You can get the model (and many others) from Texas Instruments. Next we’ll build a two-stage BJT amplifier using a single BJT amplifier as a building block. Just like last time, I will explain only what is new. So lets begin, with my favorite part of analog circuits – operational amplifiers :)

Read more of this post

Simulating Circuits in the CLI

My previous tutorial on EDA in FEL showed you how to simulate circuits using gspiceui with the gnucap simulator. This time I’ll show you to do the same using the command line interface (CLI) with the ngspice simulator. I had a few doubts regarding the use of ngspice and got them cleared in FEL mailing lists. We’ll not look at gnucap for now because I have to learn to use it myself. Alright so lets begin! :)

Prerequisites and References

These are the same as http://ashwith.wordpress.com/2010/09/10/circuit-simulation-in-gnulinux-lets-begin/

Do go through that tutorial first if you haven’t already.

In addition to this, you need to be familiar with SPICE netlists. Check the ngspice manual. It has a well explained, detailed description with a few examples in the end. To get started quickly go through this tutorial http://www.seas.upenn.edu/~jan/spice/spice.overview.html

I got some help with ngspice at the FEL mailing list as well. You can sign up here  https://admin.fedoraproject.org/mailman/listinfo/electronic-lab.

gschem > gnetlist > ngspice > gwave

Read more of this post

Follow

Get every new post delivered to your Inbox.

Join 74 other followers

%d bloggers like this: