Spice is a powerful tool for circuit analysis. But it often surprises users with
. holes in its abilities and strange definitions
. lack of industry-wide standards
. the need for the user to model the physics of their circuit, not just draw the schematic

I hope this blog will educate users and promote discussion in these areas.

### DC coupled Oscillator - sim fails

The Problem
A DC coupled oscillator (square-wave oscillator) causes simulation failure in Spice.

Spice needs to find the DC operating point of the circuit before it can simulate but a DC coupled oscillator does not have a stable DC operating point.

The user gets an error like:
DC Operating Point,
Iteration Limit reached

Typical circuit
The schematic shows a typical square-wave oscillator.

U3 is a comparator or op amp functioning as a comparator. Resistors R1 and R2 create hysteresis in the switching threshold, due to positive feedback. C1 is charged and discharged through R3.

Forcing a Stable Operating Point
We need to force the circuit to a stable (artificial) DC operating point so Spice will not fail, then release the artificial operating point after Transient analysis starts so the circuit will operate normally.

The forcing circuit inside the dashed lines uses Spice's voltage controlled switch. The switch's switching threshold is set to 0.5 volt. The switch is controlled with a voltage source that has a pulse waveform that starts at zero volts at TIME=0 and goes to 1 volt for TIME>0. The DC voltage of the source is zero. In 5Spice this is the Step waveform.

The control is a little confusing in order to use the Step waveform. The switch is OFF for DC operating point (DC Bias) and for Transient at TIME=0. However the switch's resistance parameters are reversed from normal, with the OFF resistance being 2K and the ON resistance being 1E9 ohms! Thus the switch has its high resistance in its ON state.

Hope this helps.