pspice sub circuit tutorial

21
1 Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html PSpice Subcircuit Tutorial d(O_o)b //Simulation for PSpice 9.2

Upload: tariqul-islam-ponir

Post on 03-Oct-2014

890 views

Category:

Documents


20 download

TRANSCRIPT

Page 1: PSpice Sub Circuit Tutorial

1

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

PSpice Subcircuit Tutorial d(O_o)b

//Simulation for PSpice 9.2

Page 2: PSpice Sub Circuit Tutorial

2

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

This tutorial will show how to draw subcircuits in PSpice Circuit Simulation Software.

A subcircuit is a portion of a circuit. It can be a branch, one or more loops/mesh. In PSpice

subcircuit is mainly used to write complex circuits. Consider a circuit so large that it cannot be

drawn in a single Schematic window. So several subcircuits are drawn in several window and all of

them are, then, collected together in a single window.

For the sake of our tutorial we will consider a circuit that has a recurring mesh. We will create a

subcircuit of that mesh and draw the circuit with our subcircuit part.

Let’s begin. Shall we?

Look at the circuit in the next page. This is the circuit that I’m going to work with. Now, try to guess

how many recurring mesh are there in that circuit.

Page 3: PSpice Sub Circuit Tutorial

3

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

A Simple Circuit

Page 4: PSpice Sub Circuit Tutorial

4

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

Well, there are 4 mesh that are recurring (R14 and R15 can be interchanged. And so, if you guessed

3 then that guess is wrong). So we will turn this mesh into a subcircuit.

This is where the actual tutorial begins. Buckle up guys. O_O

Step 1: Drawing the subcircuit.

Draw the mesh as usual. The mesh should look like this-

Now the two parts that are to be added to the circuit are generally called input/output interface.

Their part names are IF_IN and IF_OUT.

These parts look like this-

Page 5: PSpice Sub Circuit Tutorial

5

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

IF_IN: IF_OUT:

I have added them to the circuit like this (Two of them are input and two of them are output):

You can if you wish make all of them are input or all of them are output or put input and output

arbitrarily. They have no effect on the calculation but will have effect on the part symbol (that I’ve

described in the later part of the tutorial).

Page 6: PSpice Sub Circuit Tutorial

6

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

Now, on to labeling these interfaces… To label them double click on a input/output interface part.

And put an arbitrary value/word in the box.

I’ve labeled them like this:

Now we have finally drawn the subcircuit as it should be. Step 1 is done.

Page 7: PSpice Sub Circuit Tutorial

7

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

Step 2: Creating the Subcircuit

This step requires some clicking in the toolbar.

Firs save the *.sch file. I always save subcircuit files in a dedicated location. Give it any name you

like. Follow the picture if you like (1>2>3>4 and note the location where you saved it. )-

Page 8: PSpice Sub Circuit Tutorial

8

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

The next work will be to get the *.sub file. To create it, click on “Tools” then “Create Subcircuit”.

And you are done. See the picture if you need to…

Now in the location where you have saved the *.sch file, you should get a whole bunch of files

including a *.sub file. Both of them will have the same but different extensions.

Page 9: PSpice Sub Circuit Tutorial

9

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

Step 3: Including the Subcircuit in the Library

(This step is optional in some versions of PSpice. In my version it isn’t needed. So I can’t guarantee

this process is correct.)

Now to do this, you have to add the *.sub file to the library. Click on “Analysis” then “Library and

Include Files…”

“Library and Include Files…” window should appear.

Page 10: PSpice Sub Circuit Tutorial

10

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

Here, you have to add the file to the library. In the “File Name” box include the file. I have included

along with the location. Like: “D:\Subcircuit\Special Subcircuit.sub” without the inverted commas

and click either “Add Library*” of “Add Library”.

“Add Library*” adds the file globally (i.e. It’s permanently added to schematics) and “Add Library”

adds the file locally. There is no way to check if the addition was successful or not..

Step 4: Symbolizing the Subcircuit

This step is short but important. In this step we will give this subcircuit a model name (that will be

used to summon this subcircuit in the schematic window) and add to a library. Click on “File” then

“Symbolize” then give it a suitable name (In my case I gave it SpSub) and click “OK”. Look at the

picture if you need to:

Page 11: PSpice Sub Circuit Tutorial

11

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

If it’s done then a new dialogue box should appear where you will be asked to add this part to a

library file. Usual practice is to add it to a *.slb file in UserLib directory

(Usually C:\Program Files\Orcad\PSpice\UserLib). If there is no file in that directory, just give it an

arbitrary name and click “Open”. Remember the filename should have a slb extension (In my case

hyperlib.slb). Look the picture if necessary:

Page 12: PSpice Sub Circuit Tutorial

12

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

Yay! We have created our Subcircuit successfully. :D

Page 13: PSpice Sub Circuit Tutorial

13

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

Step X: Editing the Symbol

Now. The symbol that you have created may need some editing. To edit the symbol click “File” then

“Edit Library” -

A new window should appear. Here, click on “File” then “Open” and open the slb file (hyperlib.slb

in my case), that you created, in editing window –

Page 14: PSpice Sub Circuit Tutorial

14

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

Now click on “Part” then “Get”. In the get window click on the part that you want to edit (SpSub in

my case).

Page 15: PSpice Sub Circuit Tutorial

15

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

Once opened you should get a part that look like this:

Page 16: PSpice Sub Circuit Tutorial

16

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

Not, there’s not much to edit. Just to show that, IF_IN parts are on the left side of the parts. And

IF_OUT parts on the right side. You can move the 101 and 102 wands in the left dotted box. Don’t

take them outside this box. Otherwise the IF_IN parts will actually get detached from the circuit -_-.

In this circuit 101 and 102 are sequentially drawn. You can make them 102 101 sequence too….

Now, click “Part” then “Attributes”. You should get an attributes window. Here I’ve made some

changes and they see what affect they have on the symbol:

Look at ‘REFDES=SpSub?’ line. This ‘?’ mark is important. If you put this part in the schematic

window this ‘?’ mark will be turned into numeric subscript i.e. SpSub1, SpSub2 etc.

I’m leaving it to this. Play with the other options if you like.

Page 17: PSpice Sub Circuit Tutorial

17

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

Now save the symbol “File” then “Save”. (If any dialogue box appears then there are errors in the

symbol. Don’t save it without correcting the errors).

Close the Symbol Window “File” then “Close”.

And you are done editing.

Call the subcircuit using the name that you used to symbolize it. (SpSub in my case)

Not, let’s get back to the main circuit (Page 3).

In the next few pages there are several drawings to the main circuit. Look at them one by one and

draw it with the subcircuit. If you feel like it, design shorter circuits to play with.

Page 18: PSpice Sub Circuit Tutorial

18

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

Subcircuits are marked in this picture. One is left for the reader.

Page 19: PSpice Sub Circuit Tutorial

19

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

The Circuit with currents and voltages

Page 20: PSpice Sub Circuit Tutorial

20

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

Circuit Drawn with the help of Subcircuit

Page 21: PSpice Sub Circuit Tutorial

21

Downloaded from http://hyperactve.blogspot.com/2011/12/pspice-92-subcircuit-tutorial.html

This tutorial is prepared by Tariqul Islam.

And distribute it as you like.

I don’t care.

d(O_o)b