I am attempting to simulate the following code: ``...
# xschem
d
I am attempting to simulate the following code:
Copy code
spice
.control 
	dc v2 1.0 2.1 0.1
	plot i(vden)
.endc
However, I consistently encounter the error "Error: no such vector i(vden)." Despite various attempts such as "i(den)" and "i(v(den))," the issue persists. Intriguingly, using "V(den)" appears to resolve the problem. I tried to find similar question in this channel then I tried i(vden), but I could not reach the result
r
by default ngspice doesn't save your output, did you have a
.save i(den)
or
.options savecurrents
in your spice code?
a
It seems that ngspice doesn't store currents, only voltages. In xschem there's this device "`ammeter.sym`" as a 0 volt source with savecurrents enabled. Yeah, you need to put
.save i(vden)
or replace vden with a ammeter
s
If you run a simulation and there is no single
save
or
.save
instruction by default ngspice saves all voltages and all currents through voltage sources. However if you place one or some
.save
or
save
instructions then only the specified nodes will be saved. If you place the
spice_probe.sym
and/or the
ammeter.sym
symbols the voltage of the node attached to the spice_probe.sym and the current through the ammeter are specifically saved using .save instructions in the netlist. Ammeters have an attribute
savecurrent
to print or not the .save instruction in the netlist. The
spice_probe.sym
is used to save only a small selected set of nodes to reduce the output data. If you have ammeters in the circuit and they generate the .save lines in the netlist but you want all nodes to be saved add a
save all
instruction. Add also a .option savecurrents if you want all device currents to be saved (in addition to voltage source currents).
d
Thank you for your answers, it solved my problem