Electronics > PCB/EDA/CAD

Ngspice Incremental Transient Analysis

(1/3) > >>

Does Ngspice support transient analysis continually, while outputting current/voltage values at the components and nodes of a circuit?

I have looked through some documentation, and I can't seem to find this feature. The transient analysis command has the following structure:

--- Code: ---tran tstep tstop <tstart <tmax >> <uic >
--- End code ---

The tstop variable states how long the simulation should be run for. I'm wondering whether there is a way for me to omit this variable in order to run the analysis continually.

For example, consider the following scenario: An initial command is sent to begin the analysis, another command is sent such that Ngspice calculates the states of the nodes/components for the next time step of the analysis. At this stage, the states of any required nodes/components can be queried (e.g. "print i(V1)"). The previous command can be sent again to advance the simulation such that Ngspice calculates the values for the next time step.

Alternatively: A command is sent to begin the transient analysis, then Ngspice continually outputs the states of nodes/components until instructed to stop (essentially running the simulation for an unlimited length of time)

Does Ngspice support either of the scenarios above?

P.S. I'm quite new to SPICE, so apologies if these are basic questions.

There are 3 main types of simulations in SPICE:  DC, Transient, and AC. 

Depending of the SPICE flavor, some of these can be mixed by whatever GUI is there on top of the SPICE engine.

There is also Transient with initial conditions (for example when a capacitor is already charged with some voltage, or a coil is already charged with some initial current, and .tran can take that initial charge into account or disregard the initial conditions before starting the .transient simulation).

I am aware of these modes (and the initial state setting for transient). I was specifically asking about the transient analysis, and whether Ngspice could run transient analysis continuously, without having to set a fixed simulation duration.

AFAIK no SPICE based simulators run "live", forever, like a real circuit, but I never used ngspice.

It is only possible to set in advance a specified duration of analysis, then the simulation engine will start crunching numbers, step by step, while storing on the disk the results for that specified duration only.  Only the maximum step can be specified in the .tran line, but the engine can go with much finer time-step resolution when needed.

Sometimes the simulator can run faster than the physical real circuit, some other times (especially when fast transitions are present in the signal, or when for some other reasons the result of a step tends to diverge) it can take many minutes to simulate a single second for the given circuit.

Hmm... That's a real shame if that's the case. Based on my understanding, it would seem pretty trivial, technically speaking, for the simulation to run continuously, while outputting a continuous stream of data.


[0] Message Index

[#] Next page

There was an error while thanking
Go to full version