Hello, I don't understand how can i save the current into ammeter. How can i save the current? and t...
r
Hello, I don't understand how can i save the current into ammeter. How can i save the current? and the second question is, how can i plot Ids(VDD) for vgs_nmos=0.5, 1, 1.5? i tried also dc VDD 0 1.8 0.1 vgs_nmos 0.5 1 1.5, but i am not able to plot the chart ids(vds) for this three vgs voltage
s
You don't need to save the ammeter current. The symbol does that for you. There should be an
i(vmeas)
or (equivalent)
vmeas#branch
variable. If you look into the produced netlist you see the ammeter also generates a .save statement. Voltage sources also generate a .save statement so in your case the Vmeas is redundant, you can use i(vdd).
For using Vgs as a second sweep variable you can do:
dc VDD 0 1.8 0.1 vgs_nmos 0 1.501 0.5
To plot all curves do a:
plot all.i(vmeas)
r
if I use plot i(vmeas) is ok.... from WAVES i cannot plot.... also the current of Vmeas is not saved...
s
do a
display
command at the ngspice prompt to see the nodes that are saved.
Remove the
.end
, xschem adds a .end at end of netlist.
r
most of the signals are saved...
s
You see,
vmeas#branch
is saved, at the ngspice prompt you can plot all vmeas current curves with:
plot all.vmeas#branch
or
plot all.i(vmeas)
i(vmeas)
is equivalent to
vmeas#branch
r
the command plot in the netslist is fine... how can i get the same result with the other viewer?
s
Gaw does not understand multiple sweeps, i also have never been able to do that. You can add a graph directly inside xschem, see this manual page: https://xschem.sourceforge.io/stefan/xschem_man/graphs.html#graphs Add a graph:
Simulation -> Add simulation graph
Load spice data:
Simulation->Load/Unload spice Raw file
Add a waveform in the graph: double click the graph, select the wave from the listbox on the left, click 'add' then press '`f`' to do a full zoom on the xaxis when the mouse is inside the graph, then do a y full zoom by pressing '`f`' with the mouse to the left of the y axis.
r
How can i plot both current? i added a pmos, but now i am losing a current of the nmos. if ii have two raw file, how can i choose wich file.raw should be loaded in the chrt?
s
You can save multiple simulations in the same file:
Copy code
dc VDD 0 1.8 0.01 vgs_nmos 0.75 1.501 0.25
write ids_vds_2.raw
set appendwrite
dc VDD 0 1.8 0.01 vgs_pmos 0.75 1.501 0.25
write ids_vds_2.raw
plot dc1.i(vmeas2) dc2.i(vmeas1)
r
the .raw file is automatically created? because i deleted from temporary folder all the simulation and netlist file, and now i cannot plot anzmore the diagramm...
s
The raw file is created by ngspice when executing the write command. If you deleted netlist and raw file, create netlist again with xschem, run simulation again with ngspice.
r
i used this code:
.save all v(vg)
.options savecurrents
*
.control
dc VDD 0 1.8 0.01 vgs_nmos 0.75 1.501 0.25
write ids_vds_2.raw
set appendwrite
dc VDD 0 1.8 0.01 vgs_pmos 0.75 1.501 0.25
write ids_vds_2.raw
plot dc1.i(vmeas2) dc2.i(vmeas1)
.endc
when i do load .raw file, appear raw_read(): failed to open file /home/roberto/.xschem/simulations/ids_vds_2.raw for reading
s
Do this: • .control and .endc are commented, Remove the asterisc (*) before .control and .endc • remove dot (.) from dc commands • add a 'save all' before dc commands • save the schematic (ctrl-s) • press 'Netlist' button • press 'Simulate' button • click menu Simulation -> Load/Unload spice raw file This should hopefully work Please also have a look at the ngspice user manual
r
I will try... Maybe is an error of copy and paste from the xschem, but the asterics (*) was in a line just to create a space. The DC command has no point "." because is inside a ".control" loop. I trying to do practice with a small test cases before to go in a complex schematic. Also inside the ngspice manual everything is not very clear. At chapter 17, define how to write a table in .raw, but is not easy to switch from a tool to open source tool 😂 . It is pay full!
I tried this solution, but whz ngspice does not generate the .raw file? the directory where is generated the netlist is correct. the netlist is there, but the raw file does not appear.
@Stefan Schippers the ".options savecurrent" create a conflict with ".save all" i removed the line ".options savecurrent" and now the raw file is generated!
🙌 1
s
@Roberto Di Lorenzo you can leave
.option savecurrents
, only add
remzerovec
before the
write
command. This removes empty vectors ngspice complains about.
Copy code
.option savecurrents
...
.control
save all
dc VDD 0 1.8 0.01 .....
remzerovec
write xxxx.raw
...
.endc
c
There seems still some issue after adding remzerovec. The node voltage vout is not saved. So I use save all only and comment out *.option savecurrents. The strange part is that I can still find the resistor R1 current but it's just not under display command. Anyway, I should not expect a perfect software.
s
If you have one or more .save instructions in the netlist only the specified nodes will be saved. save all is needed in this case if you need all voltages. If no .save is present in the netlist and no save all ngspice by default saves all node voltages and all voltage source currents.
126 Views