Im trying to do a transient response analysis with ngspice/gnucap and gspice UI of the next RLC circuit (corrected the source polarity), to find the damping effect in the system.
That with the next command
gnetlist -g spice-sdb -o rlc.net RLC.sch
writes the next spice file
* gnetlist -g spice-sdb -o rlc2.net rLC2.sch
*********************************************************
* Spice file generated by gnetlist *
* spice-sdb version 4.28.2007 by SDB -- *
* provides advanced spice netlisting capability. *
* Documentation at http://www.brorson.com/gEDA/SPICE/ *
*********************************************************
*vvvvvvvv Included SPICE model from 1N3880.mod vvvvvvvv
.MODEL 1N3880 D (IS=2.01E-11 N=1.70 BV=1.33E+02 IBV=1.00E-05 RS=1.24E-02 CJO=1.19E-10 VJ=.75 M=.26 TT=1.44E-07)
*^^^^^^^^ End of included SPICE model from 1N3880.mod ^^^^^^^^
*
*============== Begin SPICE netlist of main design ============
V1 1 0 pulse 0 220 0 1u 1u 1k 2k
.options TEMP=25
C1 4 0 2m
L1 3 4 0.05u
R1 2 3 160
D1 1 2 1N3880
.end
then inside ngspice running in a terminal
>source rlc.net
Circuit: * gnetlist -g spice-sdb -o rlc.net rlc.sch
Try to do the transient analysis
tran 0.1ms 5ms
Warning: v1: no DC value, transient time 0 value used
Initial Transient Solution
--------------------------
Node Voltage
---- -------
1 0
4 -2.3973e-18
3 -2.3973e-18
2 -2.3973e-18
l1#branch 0
v1#branch 1.0148e-36
No. of Data Rows : 79
ngspice 65 -> plot 1 2 3 4
Still gives something like this
Still different from what I was expecting for, at this point what I want to see is the current in the resistor. I have updated with a pulse source as suggested, but it still does not work as desired.
Update 2
There were various things that was messing around.
From the beginning I was trying to plot the current not the voltage, so ngspice did not do this, as explained and suggested here. I'm using ngspice 30 so the work around of adding the directive
.options savecurrents
should work but when trying the order
plot @R1[i] vs v(1)
does not worked too.
wrong syntax's
From another circuits done, and as commented by @sstobe, the right way to plot would beplot v(1)
This indeed plot the voltage 1, the voltage at node 1 and so on... The way i did before I was telling to ngspice to plot the integers 1,2,3.. that's why the graphs.
- Wrong source
I changed from a DC to a pulse one since its a transient simulation, as noted by @a concerned citizen.
- The time of simulation
I was choosing wrong the values with
tran 0.1ms 5ms
But this was too much time and the response is so fast that in this period cant be seen.
So I adjusted to
tran 0.1us 5us
That finally yield but since the idea was to plot the current this could not be done.
uic
. \$\endgroup\$