I am running a simulation and it seems like it is stuck at a point. How do i detect where the problem is the circuit. Is there a setting to allow ng spice to provide more info like a -V option or something simular? Current_sense_opamp.kicad_sch (129.8 KB)
.tran 0.01u 10m 0
Reference value : 1.99948e-09
Reference value : 1.99958e-09
Reference value : 1.99975e-09
Reference value : 1.99992e-09
Reference value : 2.01787e-09
Reference value : 2.01808e-09
Reference value : 2.01814e-09
Reference value : 2.01820e-09
Reference value : 2.01826e-09
Reference value : 2.01832e-09
Reference value : 2.01838e-09
Reference value : 2.01844e-09
Reference value : 2.01850e-09
Reference value : 2.01856e-09
Reference value : 2.01857e-09
Reference value : 2.01857e-09
Reference value : 2.01857e-09
Reference value : 2.01857e-09
I am unsure about your simulation issue but many others here are ngspice experts. I don’t run much spice these days though I have spent time on ltspice. Before then, (when I loaded fortran spice into the vax from 9-track 6250), I had to tweak lots of convergence settings on tricky sims. I presume ngspice has a selection of tweaks as well. Slowing rise/fall times and taking larger timesteps sometimes helped get things started. Running a crude-timestep sim until everything stabilized so I could grab cap-voltages/inductor-currents, also helped so I could plug those as initial conditions for a higher-precision sim. Perhaps such tricks are not needed these days.
Opamp is single supply but bias is at neg rail. Need to split rails or does this opamp have common-mode down that far? Also might add G-S resistors on the transistors to ensure turn-off (probably depends on the model you use).