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

AI Thread Summary
The user is attempting to build a circuit in SPICE but encounters an error related to the .dc command, which indicates a missing source name. The discussion reveals that the user initially defined both V1 and V2 as voltage sources, but they are actually intended to be voltmeters in the circuit. The error arises because the .dc command requires a specific source to sweep, which was not properly defined. After clarifying the circuit's purpose, it is suggested that the user should only include the actual voltage source and resistors in the simulation, omitting the voltmeter definitions. The user is advised to adjust their netlist accordingly to resolve the error and accurately reflect the circuit's intended function.
Const@ntine
Messages
285
Reaction score
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: 797
Last edited by a moderator:
Physics news on Phys.org
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
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.
 
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).
 
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: 480
Last edited:
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.
 
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!
 
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.
 
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: 417
  • #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: 386

Similar threads

Replies
5
Views
2K
Replies
15
Views
4K
Replies
3
Views
2K
Replies
3
Views
2K
Replies
7
Views
4K
Replies
2
Views
4K
Back
Top