When we use print command as print out then it will display the value of node at particular time t
Is there any relation between two time like after what time step we will get node value. Or NgSpice just randomly calculate it. Please let me know if there is any relation between two time.
if you need equidistant time steps, you may use the 'linearize' command, provided your tran command
tran Tstep Tstop
has a sufficient small TStep.
Time deltas (steps between to sequential time-value pairs) are not calculated randomly. They depend on the change rate of signals in devices, and on breakpoints set e.g. by your input signal.
a nice eplanation for HSPICE is found here (different for ngspice though)
A breakpoint, e.g. the start time of a pulse, will inforce a time point. After that, the delta is increased slowly. Maximum delta is given by TStep.
If you want to find out yourself, have a look at ckt->CKTdelta in dctran.c, which is exactly the delta between two consecutive time steps.
In a .tran analysis, is there a way to force the raw file data output to only be at tstep intervals?
Spectre has the .option printstep=yes
SmartSpice has the .option interp
My circuit is driven by ~900MHz rf carrier so I want the internal timestep calculations to be as fine as necessary to get the accuracy, but only want to printout at tstep times. Otherwise the dataset becomes far too large even with only those nodes ~50 and currents I want selected by .save statements when the internal timestep hovers around 10ps.
.tran 1n 300u
ought to produce 300k values/node, but this grows to 30M values/node.
in batch mode (-b -r command line options) I do not see a means to reduce the amount of data. This would be a nice 'feature request'.
In control mode there is a way. If you add a control section similar to:
save aa bb cc
run ; simulates and generates plot tran1 with lots of data
linearize aa bb cc ; linearizes and generated a new plot tran2
destroy tran1.aa tran1.bb tran1.cc ; optinally removes the original simulation data
write outfile aa bb cc
you have a data set with equidistant time steps (based on TSTEP of the .tran command) in the rawfile 'outfile'. The disadvantage of this approach is that to be able to print, all data have to be saved in main memory. So you need lots of memory and probably a 64 bit ngspice executable to handle the amount of data.
Yes its working. Still effectively running ngspice in -b (batch mode) but having a control block to linearize now writes out a smaller rawfile at those tstep intervals, but as you say I do need the 64bit machine with lots of memory rather than my laptop. A disadvantage is that I do not see the rawfile building as everything is only written out at the end.
That nice feature request would be to have an option to apply the linearize function on the fly.
there is now the option 'interp' available in the git sources, which stores data only at fixed time intervals during transient simulation, determined by TSTEP.
I have a similar question. Is it possible for ngspice to print out only the value at a fixed time (such as the middle time or the last two time steps) during transient simulation?
perhaps this will do as an example:
print last timestep of a tran simulation
* ngspice thisfile.cir
V1 1 0 DC=1V
R1 1 2 1k
C1 2 0 1u
tran 10u 1ms uic
let k = length(time) - 1
print time[k] v(2)[k] v1#branch[k]