Building a Circuit in SPICE -- Why am I getting this error?

In summary: V1.In summary, the student is trying to create a circuit using Spice but is having trouble getting an error message to go away. The problem may be with the line that reads: .dc lin 500 100 10kThe student is trying to do a DC sweep from 500 Volts down to 100 Volts with a stepsize of 10,000 Volts.
  • #1
Const@ntine
285
18

Homework Statement


I've got the following Circuit:
pXfIx3nP02b9lEL71boaaKXePbeO1Y9_3Q7SwskU9dwndImJhrRzatc8LfpHk2zb6_z6nqHYKFa0ivA&owa=outlook.live.jpg

And I have to make it in Spice.

2. The attempt at a solution
So far I've got:

Circuit Of Ex1
*Circuit Topology
V1 1 0 dc 10
R1 1 2 4.7k
R2 2 0 4.7k
V2 2 0 ac 5
*Types Of Analysis
.dc lin 500 100 10k
*Output Statements
.probe
*Termination Control Statement
.end

Problem is, I get this when I run it:

*Circuit Topology
V1 1 0 dc 10
R1 1 2 4.7k
R2 2 0 4.7k
V2 2 0 ac 5
*Types Of Analysis
.dc lin 500 100 10k
--------$
ERROR -- Must be 'I' or 'V'
*Output Statements
.probe
*Termination Control Statement
.end

What does the ERROR part mean, and what am I doing wrong?

Thanks for the help!
 

Attachments

  • pXfIx3nP02b9lEL71boaaKXePbeO1Y9_3Q7SwskU9dwndImJhrRzatc8LfpHk2zb6_z6nqHYKFa0ivA&owa=outlook.live.jpg
    pXfIx3nP02b9lEL71boaaKXePbeO1Y9_3Q7SwskU9dwndImJhrRzatc8LfpHk2zb6_z6nqHYKFa0ivA&owa=outlook.live.jpg
    25.6 KB · Views: 738
Last edited by a moderator:
Physics news on Phys.org
  • #2
Not sure (I don't often write netlists since I tend to use the graphical interface of LTSpice to "assemble" circuits), but I'd take a look at the line:
Techno_Knight said:
.dc lin 500 100 10k
since the start, stop, and stepsize appear to be a bit strange to me. Are you really doing a DC sweep from 500 Volts down to 100 Volts with a stepsize of 10,000 Volts?
 
  • Like
Likes berkeman
  • #3
gneill said:
Not sure (I don't often write netlists since I tend to use the graphical interface of LTSpice to "assemble" circuits), but I'd take a look at the line:

since the start, stop, and stepsize appear to be a bit strange to me. Are you really doing a DC sweep from 500 Volts down to 100 Volts with a stepsize of 10,000 Volts?
I don't really know what that means, as I never did Electronics in the previous semester, due to health issues. I'm going through the book now, but I'm not there yet. I showed my program to the Post-Grads responsible for the current Electronics Lab that the assignment is for, and they fixed some stuff (I had V1 at ac at first), but left that unchanged. If I lower these numbers, will the error go away? Although I don't understand what the error exactly is.
 
  • #4
As I said, I'm not sure myself what triggered the error, but the values on that line stood out to me as being "off".

The line is an instruction to the simulation to perform a DC sweep of one of the sources. The format for a single source is:

.dc [<oct,dec,lin>] <Source> <Start> <Stop> [<Incr>]

Where:
Source is the name of the source to be swept
Start is the starting value of the source
Stop is the end value of the source
Incr is the increment (stepsize) for the values to take on between Start and Stop

I notice now that you didn't specify a Source name in your command, so that may indeed be why it complained about not finding an 'I' (current source name) or a 'V' (voltage source name).
 
  • #5
gneill said:
As I said, I'm not sure myself what triggered the error, but the values on that line stood out to me as being "off".

The line is an instruction to the simulation to perform a DC sweep of one of the sources. The format for a single source is:

.dc [<oct,dec,lin>] <Source> <Start> <Stop> [<Incr>]

Where:
Source is the name of the source to be swept
Start is the starting value of the source
Stop is the end value of the source
Incr is the increment (stepsize) for the values to take on between Start and Stop

I notice now that you didn't specify a Source name in your command, so that may indeed be why it complained about not finding an 'I' (current source name) or a 'V' (voltage source name).
Ah, I see. As for source, you mean adding the ".op" command? They didn't tell us to add that over at the Lab, but I went ahead and tried it earlier (I saw an example on a leaflet they gave us, and it had that) and still get the same error.

EDIT: I put V1 as the "Source", right after lin:

Circuit Of Ex1
*Circuit Topology
V1 1 0 dc 0.1
R1 1 2 4.7k
R2 2 0 4.7k
V2 2 0 ac 0.05
*Types Of Analysis
.op
.dc lin V1 500 10k 1k
*Output Statements
.probe
*Termination Control Statement
.end

and I get this graph I(V1):

db1d3485-8e65-491d-81a4-e020e88d1218
gjNgEeL.png


Is it correct?
 

Attachments

  • gjNgEeL.png
    gjNgEeL.png
    13.6 KB · Views: 424
Last edited:
  • #6
Techno_Knight said:
Is it correct?
I can't say... I don't know the specifics of what it is you're trying to achieve. Do you have a description of the Lab that explains what the goals are?

I note that both V1 and V2 in your schematic are shown as variable sources, and so is whatever component that is with the 'E' beside it. I suspect that there is more to this exercise than just sweeping the value of V1.
 
  • #7
gneill said:
I can't say... I don't know the specifics of what it is you're trying to achieve. Do you have a description of the Lab that explains what the goals are?

I note that both V1 and V2 in your schematic are shown as variable sources, and so is whatever component that is with the 'E' beside it. I suspect that there is more to this exercise than just sweeping the value of V1.
Hmm, I see. It's a Lab exercise, so we had to create the Circuit there, with real-life resistors, wires, all that, and then use some instruments to measure stuff like V2 with a set V1. We just had to create it again at home, and print some graphs, but the leaflet doesn't say which ones. I guess I'll print the important ones. I was just asking if it makes sense as a graph (ie if I have a car with a steady acceleration,a dn my a = f(t) graph shows a increasing as time goes on, it'd be faulty).

Thanks for the help though, the "Source" bit helped a ton!
 
  • #8
Is it possible that V1 and V2 are meant to be voltmeters and the E labeled component the variable voltage source? Then you would be analyzing a simple voltage divider circuit.
 
  • #9
gneill said:
Is it possible that V1 and V2 are meant to be voltmeters and the E labeled component the variable voltage source? Then you would be analyzing a simple voltage divider circuit.
Actually yeah, that's what the fine print under the image says. Does that mean I have to change anything in SPICE or am I all set?
 
  • #10
Techno_Knight said:
Actually yeah, that's what the fine print under the image says. Does that mean I have to change anything in SPICE or am I all set?
Since your netlist defines both V1 and V2 as voltage sources, yes, you need to make changes. Remove the line that defines V2, and let the V1 line define the actual source (labeled "E" on the schematic).
 
  • #11
gneill said:
Since your netlist defines both V1 and V2 as voltage sources, yes, you need to make changes. Remove the line that defines V2, and let the V1 line define the actual source (labeled "E" on the schematic).
And what should I do with V2? The Lab-Folks told me to keep that and just make changes in the .dc lin ... part. If I remove V2, am I not leaving something out of the circuit?
 
  • #12
Techno_Knight said:
And what should I do with V2? The Lab-Folks told me to keep that and just make changes in the .dc lin ... part. If I remove V2, am I not leaving something out of the circuit?
When you built your real version in the lab, how many power supplies did you use? If V1 and V2 on your schematic are really just meters then you shouldn't need to build them into the circuit.

I'm not sure if there is a separate "meter" device type in your version of Spice. In the version that I use I simply mouse to the desired node and click and the voltage curve is shown for that node, or the current through a component is plotted if I select the component.
 
  • #13
gneill said:
When you built your real version in the lab, how many power supplies did you use? If V1 and V2 on your schematic are really just meters then you shouldn't need to build them into the circuit.

I'm not sure if there is a separate "meter" device type in your version of Spice. In the version that I use I simply mouse to the desired node and click and the voltage curve is shown for that node, or the current through a component is plotted if I select the component.
This is the "blueprint" we used to construct it in the Lab:

9UPjmhu.jpg
 

Attachments

  • 9UPjmhu.jpg
    9UPjmhu.jpg
    44.9 KB · Views: 358
  • #14
Okay, from what I can see V1 and V2 are voltmeters. Assuming that they are essentially ideal meters, they will not affect the circuit behavior; they only monitor the circuit. When you simulate the circuit you can take the same "readings" by other means.

The circuit you are simulating looks like this:

upload_2018-3-18_20-48-55.png

V1 and V2 are the potential differences of interest.

You should implement only the single source E and the two resistors in your simulation. It's fine if you call the single voltage source V1, since as it happens the meter reading it is also called V1 :smile:
 

Attachments

  • upload_2018-3-18_20-48-55.png
    upload_2018-3-18_20-48-55.png
    1.3 KB · Views: 330

1. Why am I getting a "syntax error" when trying to build my circuit in SPICE?

There are a few reasons why you might be getting a syntax error in SPICE. One possibility is that you have misspelled a component name, used the wrong syntax for a particular component, or forgotten to include a necessary parameter. Another common issue is forgetting to add a node label or using an incorrect node label. Double check your circuit and make sure everything is spelled correctly and all necessary parameters and labels are included.

2. What does a "floating node" error mean in SPICE and how can I fix it?

A "floating node" error in SPICE means that there is a node in your circuit that is not connected to any other components or nodes. This can happen if you forget to connect a wire, or if you have a disconnected component. To fix this error, make sure all components are connected properly and that there are no open circuits in your design.

3. Why am I getting a "convergence error" when simulating my circuit in SPICE?

A "convergence error" in SPICE means that the simulation was unable to reach a stable solution. This can happen if your circuit is too complex or if there are non-linear components present. To fix this error, try simplifying your circuit or using smaller time steps in the simulation. You can also try adjusting the convergence parameters in SPICE to improve the simulation's performance.

4. How can I troubleshoot a "device model not found" error in SPICE?

A "device model not found" error in SPICE means that the model for a particular component is not included in the SPICE library or is not specified correctly. To troubleshoot this error, make sure you have the correct model name and that it is spelled correctly. You can also try adding the model to the SPICE library or downloading it from a reliable source.

5. Why am I getting a "time step too small" error when running my SPICE simulation?

A "time step too small" error in SPICE means that the time step you have specified for the simulation is too small for the program to handle. This can happen if your circuit has high frequency components or if your simulation time is too long. To fix this error, try increasing the time step or reducing the simulation time. You can also try using a different simulation method, such as a transient analysis instead of an AC analysis.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
15
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
6K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
Back
Top