28
3/4/2015 [email protected] 1 An introduction to SPICE BY: Muhammad Ahtsham

WinSpice Tutorial 1

Embed Size (px)

Citation preview

Page 2: WinSpice Tutorial 1

3/4/2015 [email protected] 2

Page 3: WinSpice Tutorial 1

3/4/2015 [email protected] 3

Page 4: WinSpice Tutorial 1

3/4/2015 [email protected] 4

SPICE is the acronym of Simulation program with integrated

circuit Emphasis.

The concept of SPICE developed after Electronic Workbench that

is the software to develop the circuit graphically and then simulate

the required result.

Workbench software is reliable and acquires less time in order to

simulate any circuit but its needs to draw circuit as well.

SPICE is a simulation program that does not require to draw any

circuit rather it requires to write net list in a particular and

specified manner.

Page 5: WinSpice Tutorial 1

3/4/2015 [email protected] 5

SPICE does not need any graphical interface.

SPICE evaluate or simulate the result through text-file description.

SPICE is fairly easy to use for simple circuits, and its non-graphic

interface actually lends itself toward the analysis of circuits that

can be difficult to draw.

Text file means that you can type the net list in a specified manner

through the basic text editor programs such as Notepad and Word

pad.

Page 6: WinSpice Tutorial 1

3/4/2015 [email protected] 6

Page 7: WinSpice Tutorial 1

3/4/2015 [email protected] 7

The origin of SPICE traces back to another circuit simulation

program called CANCER in 1960s.

The CANCER software continued to be improved till the upper

age of 1970s.

The CANCER software was then rewritten and renamed as SPICE

and its first version was published in 1972 for public domain.

The version 2 of spice was published in a public domain in 1975.

Instrumental in the decision to release SPICE as a public-domain

computer program was professor Donald Pederson of Berkeley,

who believed that all significant technical progress happens when

information is freely shared.

Page 8: WinSpice Tutorial 1

3/4/2015 [email protected] 8

A major improvement came about in March of 1985

with version 3 of SPICE (also released under public

domain).

Now SPICE is written in the C language rather than

FORTRAN, version 3 incorporated additional transistor

types (the MESFET, for example), and switch elements.

Version 3 also allowed the use of alphabetical node

labels rather than only numbers.

Instructions written for version 2 of SPICE should still

run in version 3, though.

Page 9: WinSpice Tutorial 1

3/4/2015 [email protected] 9

Programming a circuit simulation with SPICE is much like

programming in any other computer language.

Commands are typed as text in a file, save that file to the

computer's hard drive, and then process the contents of that file

with a program (compiler or interpreter) that understands such

commands.

Page 10: WinSpice Tutorial 1

3/4/2015 [email protected] 10

Page 11: WinSpice Tutorial 1

3/4/2015 [email protected] 11

DC Analysis

AC Small-Signal Analysis

Transient Analysis

Pole-Zero Analysis

Small-Signal Distortion Analysis

Sensitivity Analysis

Noise Analysis

Analysis At Different Temperatures

Page 12: WinSpice Tutorial 1

3/4/2015 [email protected] 12

Page 13: WinSpice Tutorial 1

3/4/2015 [email protected] 13

Download any SPICE software as PSPICE, LTSPICE, Win SPICE

etc.

Compose a new net list with a text editing program Commonly

Notepad or WordPad).

Save that net list to a file with a name of your choice.

Run SPICE on that net list and observe the results.

If the results contain errors, start up the text editing program again

and modify the net list.

Page 14: WinSpice Tutorial 1

3/4/2015 [email protected] 14

Run SPICE again and observe the new results.

Once you've "debugged" your net list and are getting good results,

run SPICE again, only this time redirecting the output to a new file

instead of just observing it on the computer screen.

Start up a text editing program or a word processor program and

open the SPICE output file you just created. Modify that file to suit

your formatting needs and either save those changes to disk and/or

print them out on paper.

The extension ".cir" as not mandatory as it also work on ".txt" or

".inp" extensions.

Page 15: WinSpice Tutorial 1

3/4/2015 [email protected] 15

The net list file format required by SPICE is quite simple. A net list

file is nothing more than a plain ASCII text file containing multiple

lines of text, each line describing either a circuit component or

special SPICE command.

There are two types of circuits i.e. DC and AC circuits.

In this tutorial we will learn how to write net list of DC circuit.

NOTE: We will use Win SPICE in this tutorial. You can get a free trail

of Win SPICE at www.winspice.com

Page 16: WinSpice Tutorial 1

3/4/2015 [email protected] 16

There are 5 steps to write the net list of

SPICE.1. Comments; tells us of what circuit the net list is

being written.

2. Declaration of circuit components along with their

types and values.

3. To give input.

4. To print output.

5. End Statement.

Note: From step 3 to 5, it is necessary to place dot (.)

at the beginning of the statement.

Page 17: WinSpice Tutorial 1

3/4/2015 [email protected] 17

Comments may be included into the net list in two ways:

1. On a single line, using “*” as the first character.

2. After a command line, element line, model line, etc., using “;”.

Examples:

*----------------Example 1--------------*

*----------------Components----------*

*----------------Input-------------------*

Etc.

Page 18: WinSpice Tutorial 1

3/4/2015 [email protected] 18

Page 19: WinSpice Tutorial 1

3/4/2015 [email protected] 19

*-----DC Fist Example-----*

Node 1

Node 0

General Form of writing source:Name of component +ve –ve type ValueV1 1 0 dc 10V

General form of writing Resistor:Name of Resistor +ve –ve ValueR1 1 0 10k

General form of giving input to SPICE:. Type name of source V0 Vf sweep .dc V1 10V 10V 1

General form of printing output to SPICE:. Print dc I(name of according source).Print dc I(V1)

End Statement:.End

Page 20: WinSpice Tutorial 1

3/4/2015 [email protected] 20

*-----Example 1-1-----*

V1 1 0 DC 10V

R1 1 0 10k

.DC V1 10V 10V 1

.PRINT DC I(V1)

.END

*-----Example 1-1-----*

I1 0 1 DC 1MA

R1 1 0 100k

.DC I1 1MA 1MA

.PRINT DC V(1)

.END

Page 21: WinSpice Tutorial 1

3/4/2015 [email protected] 21

Va 1 3 dc 12

Ia 0 2 dc 1

R1 1 2 80

R2 1 0 70

R3 2 3 60

R4 3 0 90

.dc Va 0 12 2

.dc Ia 0 1 0

.print dc v(1) v(2) v(3)

.end

Page 22: WinSpice Tutorial 1

3/4/2015 [email protected] 22

V1 1 0 dc 24

V2 3 0 dc 15

R1 1 2 10k

R2 2 3 8.1k

R3 2 0 4.7k

.dc V1 0 24 8

.dc V2 0 15 5

.print dc v(1) v(2) v(3)

.end

Page 23: WinSpice Tutorial 1

3/4/2015 [email protected] 23

Vs1 4 3 dc 5

Vs2 2 1 dc 2

Is 5 6 dc 1m

R1 2 7 1k

R2 7 6 1k

R3 6 5 1k

R4 5 4 1k

R5 3 2 1k

R6 6 0 1k

R7 4 0 1k

R8 2 0 1k

R9 7 0 1k

.dc Vs1 0 5 0

.dc Vs2 0 0 0

.dc Ia 0 1 0

.print dc v(1) v(7)

.end

Page 24: WinSpice Tutorial 1

3/4/2015 [email protected] 24

VCVS — Voltage Controlled Voltage Source

The output voltage is given by a voltage gain Av multiplied by an input voltage

v1. Such a source in SPICE is called an E source. (Fig a)

VCCS — Voltage Controlled Current Source

The output current is given by a trans conductance Gm multiplied by an input

voltage v1. Such a source in SPICE is called a G source. (Fig b)

CCVS — Current Controlled Voltage Source

The output voltage is given by a trans resistance Rm multiplied by an input

current i1. Such a source in SPICE is called an F source. (Fig c)

CCCS — Current Controlled Current Source

The output current is given by a current gain Ai multiplied by an input current

i1. Such a source in SPICE is called an H source. (Fig d)

Page 25: WinSpice Tutorial 1

3/4/2015 [email protected] 25

Voltage controlled voltage source:Ename N1 N2 NC1 NC2 Value

Voltage controlled current source:Gname N1 N2 NC1 NC2 Value

Current controlled voltage source:Hname N1 N2 Vcontrol Value

Current controlled current source:Fname N1 N2 Vcontrol Value

N1 and N2 are the positive and negative terminals of the dependent source, respectively.

NC1 and NC2 are the positive and negative terminals of the controlling voltage source, respectively.

Page 26: WinSpice Tutorial 1

3/4/2015 [email protected] 26

V1 1 0 dc 5R1 1 2 68R2 2 0 10R3 3 0 100

G_Gm 0 3 2 0 0.5

.dc V1 5 5 1

.print dc v(1) v(2) v(3)

.end

Page 27: WinSpice Tutorial 1

3/4/2015 [email protected] 27

V1 1 0 dc 5R1 1 2 80R2 2 0 90R3 3 4 10R4 4 0 57

E_a 2 3 2 0 0.5

.dc V1 5 5 1

.print dc v(1) v(2) v(3)

.end

Page 28: WinSpice Tutorial 1

3/4/2015 [email protected] 28

For History and Procedure of Spice Please visit 1st Tutorial

For DC circuit Analysis please visit 1st Tutorial

For AC circuit Analysis please visit the 2nd Tutorial

For Learning output of Spice please visit 3rd Tutorial