620 likes | 1.11k Views
TECHNICAL WORKSHOP MARATHON 2012. CIRCUIT ANALYSIS USING NGSPICE. VISHNU V 2 nd Year M.Tech VLSI and Embedded Systems Govt. Model Engineering College, Thrikkakara. CONTENTS. SIMULATING A CIRCUIT IN NGSPICE EXAMPLE CIRCUIT NETLIST CREATION USING gEDA SCHEMATIC EDITOR
E N D
TECHNICAL WORKSHOP MARATHON 2012 CIRCUIT ANALYSIS USING NGSPICE VISHNU V 2nd Year M.Tech VLSI and Embedded Systems Govt. Model Engineering College, Thrikkakara
CONTENTS • SIMULATING A CIRCUIT IN NGSPICE • EXAMPLE CIRCUIT • NETLIST CREATION USING gEDA SCHEMATIC EDITOR • ANALYSIS OF BASIC CIRCUITS • HIGH PASS CIRCUIT AND DIFFERENTIATOR • LOW PASS CIRCUIT AND INTEGRATOR • RECTIFIER CIRCUITS • CLIPPER CIRCUITS • CLAMPER CIRCUITS
Simulating a Circuit using NGSPICE Steps • Mark the nodes present in the circuit using numbers or symbols (Try to mark Ground node by '0') • Write the netlist (use texteditors such as gedit or vi editor etc)for the circuit satisfying all the rules and regulations. • Save the netlist using .cir or .net extension. 3
Simulating a Circuit using NGSPICE • Open ngspice command window by typing ngspice in terminal(bash,sash etc) • Give the name of the saved netlist in ngspice command window.
EXAMPLE CIRCUIT Simulation of a simple RC filter using NGSPICE
EXAMPLE CIRCUIT • Here there are three nodes • n0 • n1 • 0 • Also the components present are • A sinusoidal voltage source • A 3.3nF capacitor • A 1k resistor
Writing NETLIST • Title Line (First Line ) A simple RC High pass filter • Component connections V1 n0 0 SIN(0 10 1kHz) C1 n0 n1 3.3nF R n1 0 1k
Writing NETLIST • Control Lines .CONTROL TRAN 0.01ms 10ms PLOT V(n0) V(n1) • END Lines .ENDC .END
Total NETLIST A Simple RC High pass filter V1 n0 0 SIN(0 10 1kHz) C1 n0 n1 3.3nF R n1 0 1k .CONTROL TRAN 0 0.01ms 10ms PLOT V( n0) V(n1) .ENDC .END
SIMULATION STEPS Terminal Save the above file asrc_filter.cir STEP 1 : Open Terminal and typengspice Open Terminal and Type ngspice Ngspice command terminal opens
SIMULATION STEPS STEP 2 : Give the file name of the netlist we have written ierc_filter.cir Give the file name of the netlist and press enter
SIMULATION STEPS TRANSIENT ANALYSIS OUTPUT BASH TERMINAL WAVE FORM WINDOW
ANALYSIS OF WAVEFORM Analyse the waveform I N P U T OUTPUT
PART II NETLIST CREATION USING gEDA SCHEMATIC EDITOR
STEPS • Draw the schematic of the circuit using gEDA schematic editor • Save the file with extension .sch • Convert .sch file to.net file using gnetlister. Command : gnetlist -g spice -o rc_filter.net rc_filter.sch
DRAWING CIRCUIT IN gEDA SCHEMATIC EDITOR SAVE THE ABOVE SCHEMATIC AS rc_filter.sch
CONVERING SCHEMATIC TO NETLIST Output File name Schematic Name gnetlist -g spice -o rc_filter.net rc_filter.sch
NETLIST OBTAINED FROM SCHEMATIC rc_filter.net
SIMULATING THE NETLIST Name of the NETLIST created using gnetlister
SIMULATING THE NETLIST : TRANSIENT ANALYSIS Final Value Indicates Transient Analysis Increment value
SIMULATING THE NETLIST : TRANSIENT ANALYSIS PLOT V(2) V(1)
ANALYSIS OF THE WAVEFORM GREEN COLOUR : INPUT WAVE RED COLOUR: OUTPUT WAVEFORM
REASONS • The Circuit is a High pass filter, so it passes only high frequency signals. • We have given an input sinusoidal waveform of Amplitude = 10V and Frequency = 1kHz • Cut off frequency of the high pass filter is given by, cutoff frequency= 1/(2*pi*R*C) Here in this case Cutoff frequency (3 dB frequency ) = 48.22kHZ So, Give input sine wave frequency >= 48.22 kHz
MODIFIED NETLIST A Simple RC High pass filter V1 n0 0 SIN(0 10 500kHz) C1 n0 n1 3.3nF R n1 0 1k .CONTROL TRAN 0.0001ms 0.1ms PLOT n0 n1 .ENDC .END NEW INPUT FREQUENCY
AC ANALYSIS OF HIGH PASS FILTER FOR AC ANALYSIS THE CONTROL SIGNAL IS .AC <sweep type> <points value> <start frequency> <end frequency> (sweep type is either LIN,OCT or DEC) Examples .AC LIN 16 60 600KHz .AC DEC 20 1 10kHz
NETLIST FOR AC ANALYSIS OF HIGH PASS FILTER A Simple RC High pass filter V1 n0 0 SIN(0 10 500kHz) C1 n0 n1 3.3nF R n1 0 1k .CONTROL AC LIN 1000 0.1Hz 1000kHz PLOT V(n1) .ENDC .END AC ANALYSIS
NETLIST FOR AC ANALYSIS OF HIGH PASS FILTER A Simple RC High pass filter V1 n0 0 SIN(0 10 500kHz) C1 n0 n1 3.3nF R n1 0 1k .CONTROL AC DEC 10 100Hz 10000kHz PLOT DB(V(n1)/V(n0)) .ENDC .END AC ANALYSIS
HOW A HIGH PASS FILTER CAN BE CONVERTED TO A DIFFERENTIATOR CIRCUIT
HIGH PASS FILTER AS DIFFERENTIATOR The Condition in which a high pass filter acts as a differentiator circuit is given by RC << 0.0016T ; Where T = Time period of the input signal Question ? Design a Differentiator Circuit which takes a pulse waveform of frequency 1 kHz and perform its transient analysis using NGSPICE.... Take the capacitor value as C = 3.3nF
DIFFERENTIATOR TRANSIENT RESPONSE With RESISTOR VALUE, R = 47k
DIFFERENTIATOR TRANSIENT RESPONSE With RESISTOR VALUE, R = 10k
RECTIFIER CIRCUIT WRITE THE NETLIST AND PLOT THE WAVEFORMS
CLIPPER CIRCUITS POSITIVE CLIPPER CLIPPING LEVEL : +5V WRITE NETLIST AND OBTAIN THE OUTPUT WAVEFORM
CLIPPER CIRCUITS DOUBLE CLIPPER CLIPPING LEVELS : +5V and -5V WRITE NETLIST AND OBTAIN THE OUTPUT WAVEFORM
r DOUBLE CLIPPER OUTPUT WAVEFORM +5V -5V
CLAMPER CIRCUITS SIMPLE POSITIVE CLAMPER CIRCUIT
LAB SESSION EXPERIMENTS • RC HIGH PASS CIRCUIT AND DIFFERENTIATOR • RC LOW PASS CIRCUIT AND INTEGRATOR • RECTIFIER CIRCUITS • CLIPPER CIRCUITS • CLAMPER CIRCUITS