Frequency response using SPICE

In summary, the conversation discusses the use of Spice OPUS to plot the frequency response of a power supply. The netlist is provided, which includes components such as resistors, diodes, and capacitors. The individual is having trouble varying the frequency of the input and is seeking assistance with performing a frequency response analysis. It is mentioned that an AC directive is needed when defining the source for a frequency domain analysis.
  • #1
ranger
Gold Member
1,687
2
I'm trying to plot the frequency response of a power supply I've designed. Here
is the netlist (made using Spice OPUS):
Code:
PowerSupply

v1 4 5 dc 0 sin(0 34 60)

D1 4 2 1N4007
D2 0 5 1N4007
D3 5 2 1N4007
D4 0 4 1N4007

c1 2 0 1000u
c2 2 0 100n
cout out 0 100n

radj adj 0 5k
r1 out adj 240

x 2 adj out LM317

.include parts.lib
.control
set units=degree
destroy all

tran 0.01ms 100ms
plot v(4,5) v(out)  vs (time*1000)

destroy all

[b]ac dec 10 60Hz 7000Hz
plot ac1.v(out) vs ac1.frequency[/b]

.endc
.end
The first plot, I'm doing a time domain analysis (this works fine). However, I am having some trouble with varying the frequency of the input. I have bold my attempt at this. But something is definitely wrong here. I get in excess of 6000v when I vary the frequency. When I designed the circuit I was aiming for about 29v (which is what the time domain plot shows).
Can some please assist me in doing a frequency response analysis.

Thanks.
 
Engineering news on Phys.org
  • #2
Wow, no one here uses spice? Well it was a rather simple mistake. It turns out that to do a frequency response, I need to have the AC directive when defining the source (frequency domain).
 
  • #3


SPICE (Simulation Program with Integrated Circuit Emphasis) is a powerful tool that can be used to analyze and simulate electronic circuits. One of the features of SPICE is the ability to plot the frequency response of a circuit.

To plot the frequency response of your power supply, you will need to use the AC analysis feature in SPICE. This allows you to vary the frequency of the input signal and observe the output response.

In your netlist, you have included the command "ac dec 10 60Hz 7000Hz" which is the correct command to perform an AC analysis. However, you have not specified the output node for the AC analysis. In your plot command, you have specified "ac1.v(out)" which is incorrect. The correct syntax for plotting the output voltage in an AC analysis is "ac1.v(out)".

Additionally, you have not specified the type of analysis you want to perform. In this case, you want to plot the voltage gain, so you should use the command "plot ac1.mag(v(out))" to plot the magnitude of the output voltage.

Another issue is that you have not specified the input signal source for the AC analysis. In this case, you will need to include a voltage source with a small AC voltage at the input of your circuit. This can be done by adding a line "v2 0 4 ac 0.1" to your netlist, which will create a 0.1V AC voltage source at the input.

Once you have made these changes, your netlist should look like this:

PowerSupply

v1 4 5 dc 0 sin(0 34 60)

D1 4 2 1N4007
D2 0 5 1N4007
D3 5 2 1N4007
D4 0 4 1N4007

c1 2 0 1000u
c2 2 0 100n
cout out 0 100n

radj adj 0 5k
r1 out adj 240

v2 0 4 ac 0.1

x 2 adj out LM317

.include parts.lib
.control
set units=degree
destroy all

tran 0.01ms 100ms
plot v(4,5) v(out) vs (time*1000)

destroy all

ac
 

What is SPICE?

SPICE (Simulation Program with Integrated Circuit Emphasis) is a computer program used for simulating and analyzing the behavior of electronic circuits. It is widely used in the field of electrical engineering and is known for its accuracy and versatility.

How does SPICE calculate frequency response?

SPICE uses mathematical algorithms to solve the circuit equations and simulate the behavior of the circuit at different frequencies. It takes into account the effects of various components such as resistors, capacitors, and inductors to provide an accurate frequency response.

What is the purpose of frequency response analysis using SPICE?

Frequency response analysis using SPICE helps to understand how a circuit will behave at different frequencies. It allows engineers to identify any potential problems or limitations in a circuit's performance and make necessary adjustments to improve its overall functionality.

What types of circuits can be analyzed using SPICE for frequency response?

SPICE can analyze various types of electronic circuits, including analog, digital, and mixed-signal circuits. It is particularly useful for analyzing complex circuits with multiple components and nonlinear elements.

Can SPICE accurately predict the frequency response of a circuit in real-life?

While SPICE provides highly accurate simulations, it is important to note that the results may not always match the real-life performance of a circuit. Factors such as manufacturing tolerances and environmental conditions can affect the behavior of a circuit. Therefore, it is recommended to use SPICE as a tool for initial design and then verify the results through physical testing.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Electromagnetism
Replies
2
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
10K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
10K
Back
Top