1932

Simulating oscillators can be problematic as they often won't start in the simulator. Here is a trick that might help you out.

Oscillators are difficult to simulate because often they won't start in the simulator. The problem is due to the simulator assuming an evironment without imperfections like noise and interference. Also, the component models are usually too simple; they are intended for simulating what they are supposed to do, not what they are not supposed to do. Adding disturbances to the simulation might help you out in such a case.

As an example let's look at this classic multivibrator circuit. Although I gave it three stages for fun -- commonly used for chasing or running (LED) light applications -- it is nothing special.
 
3-stage multivibrator
Build this circuit on a breadboard and it will work just fine; run it in LTspice and nothing happens.

Build this circuit on a breadboard and it will work just fine; run it in LTspice and nothing happens. The problem is due to too much perfection, or, put in another way, lack of detail. All transistors are identical and so are the capacitors and resistors. The simulator will calculate the same state for every stage whereas in real life each stage will behave slightly differently. As a result, nothing happens in the simulator while the real-life circuit oscillates as intended (at around 5 kHz).

Note that this circuit may also fail to start in real life, but the chances that such a situation arises are slim.

Fooling around with slightly different component values or using equivalent but different transistor models may help but often at the expense of slowing down the simulator or very long start-up times. The inconvenience is, of course, that the simulated circuit no longer represents the real circuit, leading to confusion. Fiddling around also is time consuming.

What you do want is to inject a disturbance to get the oscillator started without influencing the circuit once it is running; a timed switch, for instance. Such a solution means adding a little circuit to the simulation, but by adding a comment it can be made clear what it is for.

The multivibrator above can be kickstarted by keeping one stage disabled for a short time at startup. Once the other stages have reached a stable state, you release the disabled stage and away it goes.
 
kickstarted oscillator
Add V2 and D1 to kickstart the multivibrator.
An easy way to do this is with a piece-wise linear (PWL) voltage source (V2). This is a normal voltage source, but configured through the 'Advanced' button. When configured properly it can produce a voltage step (or pulse) at a well-defined moment in time. The output of the voltage source can connect to the circuit through a diode (D1).
 
not oscillating
With the anode of D1 disconnected from Vb1 the oscillator does not start in the simulator.
V2 produces a voltage step from 0 to 6 volts 5 microseconds after simulation start, effectively blocking Q1. When V2 has ramped up enough, D1 stops conducting and liberates Q1. This starts the oscillator and the circuit finally works as intended. The value of 6 volts was chosen rather arbitrarily; it must be such that the diode disconnects completely.
 
oscillator running
Connect V2 through D1 to Vb1 and it works!
Note that the Spice directive '.startup' does not work here, probably because it ramps up everything at the same speed and in the same way; it doesn't introduce any randomness.

How to kickstart your oscillator simulation depends on its design. I've shown one method here, but there are others. The hard part is to find the sweet spot that unblocks the simulation.

The LTspice model shown here can be downloaded below.