Why is the uic parameter necessary in this oscillator for correct output ?

Thread Starter

silv3r.m00n

Joined Apr 15, 2010
48
Hi

I am playing with a simple LC oscillator (Credits: @Danko )



Here is the spice netlist.

Code:
* LC oscillator

.model bjt_npn npn

V1 nPower gnd dc 12
C_sink nQ1Base gnd 1u
R_bias nPower nQ1Base 50k
C_tank1 nPower nVout 1u
L_tank nPower nVout 27m
C_tank2 nVout 5 0.05u
C_tank3 5 gnd 0.1u

Q1 nVout nQ1Base 4 bjt_npn
R_feedback 5 4 510
R_E 4 gnd 100

* Note: circuit does not oscillate without uic
.tran 1u 1 uic

.plot nVout
.end
The simulation (LTSpice) does not give the correct output if uic is not used. It just shows a steady dc voltage as output without uic.

I understand that the uic parameter tells spice to use the initial conditions on components like caps and inductors.

But isn't an LC oscillator like "self starting". Does it not start up without any noise/disturbance ?
 
Last edited:

Danko

Joined Nov 22, 2017
768
But isn't an LC oscillator like "self starting". Does it not start up without any noise/disturbance ?
In LTSpice it does not start easily. But in reality you can not eliminate, for example, self-noise of transistor.
Use UIC or STARTUP directive to imitate real word conditions.
EDIT:
You can improve self start ability by changing circuit:
upload_2019-9-22_18-16-9.png
So you can simulate without UIC and STARTUP.
 
Last edited:

Thread Starter

silv3r.m00n

Joined Apr 15, 2010
48
In LTSpice it does not start easily. But in reality you can not eliminate, for example, self-noise of transistor.
Use UIC or STARTUP directive to imitate real word conditions.
seems so.
somewhere i read that -
"Oscillators are difficult to simulate because often they have a metastable non-oscillating state which spice finds".

i guess it finds stable dc points in the absence of uic by seeing the inductance as a short and after that, the maths fails to produce oscillations.
 

Thread Starter

silv3r.m00n

Joined Apr 15, 2010
48
In LTSpice it does not start easily. But in reality you can not eliminate, for example, self-noise of transistor.
Use UIC or STARTUP directive to imitate real word conditions.
EDIT:
You can improve self start ability by changing circuit:
View attachment 186704
So you can simulate without UIC and STARTUP.
The self start modification did not work in ltspice, here is my net list :

Code:
* Danko's oscillator

.model bjt_npn npn bf=300
* .lib standard.bjt

V1 nPower gnd dc 12
C_sink nQ1Base nPower 1u

* self starting edit
*R_bias nPower nQ1Base 50k
R_bias nVout nQ1Base 100k

L_tank nPower nVout 27m
C_tank1 nPower nVout 1u
C_tank2 nVout 5 .05u
C_tank3 5 gnd .1u

Q1 nVout nQ1Base 4 bjt_npn
R_feedback 5 4 510
R_E 4 gnd 100

.tran 10s

* output from n_vout node, nice sine wave
.plot nVout

.end
Adding the uic parameter, makes it work again.
 

Thread Starter

silv3r.m00n

Joined Apr 15, 2010
48
Somebody showed me a trick to use a PWL source instead of DC.
This helps spice get more realistic in the simulation.

This netlist starts the oscillations without uic parameter:

Code:
* Danko's oscillator
* With PWL voltage source and no uic

.model bjt_npn npn bf=300

V1 nPower gnd PWL(0 5 1m 12)
C_sink nQ1Base nPower 1u

R_bias nPower nQ1Base 50k

L_tank nPower nVout 27m
C_tank1 nPower nVout 1u
C_tank2 nVout 5 .05u
C_tank3 5 gnd .1u

Q1 nVout nQ1Base 4 bjt_npn
R_feedback 5 4 510
R_E 4 gnd 100

.tran 10s

* output from n_vout node, nice sine wave
.plot nVout

.end
 

Bordodynov

Joined May 20, 2015
2,356
There's a so-called "hard" oscillation launch. You need a push. In the real circuit at the initial moment there is no voltage on the circuit. And switching on the supply voltage gives this push. When this shock is not present (when using TRAN without options) there may be no oscillation. I've been developing chips for watches. In some experiments I slowly and smoothly increased the supply voltage up to 3 V and there was no oscillation of the quartz generator. If I simply connected a 1.5 V power supply, then there were oscillations.
 

Thread Starter

silv3r.m00n

Joined Apr 15, 2010
48
In post #2 it is .tran 0.5s
Also try .tran 0 10s 0 1ms
Changing tran time does produce oscillations, but then you don't need the modified circuit.
It works with the original circuit too. Making the modification of R1 irrelevant.

This leads me to believe, that oscillator circuits should be tested with different time spans in spice for confirmation.
 

eetech00

Joined Jun 8, 2013
1,635
Using "startup" directive works just as well.
Don't need "uic" directive

Code:
* Danko's oscillator
* Voltage source with .trans startup directive

.model bjt_npn npn bf=300

*V1 nPower gnd PWL(0 5 1m 12)
V1 nPower gnd 12
C_sink nQ1Base nPower 1u

R_bias nPower nQ1Base 50k

L_tank nPower nVout 27m
C_tank1 nPower nVout 1u
C_tank2 nVout 5 .05u
C_tank3 5 gnd .1u

Q1 nVout nQ1Base 4 bjt_npn
R_feedback 5 4 510
R_E 4 gnd 100

*.tran 10s
.tran 10s startup

* output from n_vout node, nice sine wave
.plot nVout

.end
 

eetech00

Joined Jun 8, 2013
1,635
what is the difference between uic and startup ?
STARTUP forces all voltage and current sources to ramp up from 0 over 20u sec.

UIC suppresses DC operating point analysis at the start of the sim. You should avoid using this directive.

Also, you should add a small serial resistance (~100m) to the voltage source. All voltage sources have some resistance.

eT
 

Thread Starter

silv3r.m00n

Joined Apr 15, 2010
48
STARTUP forces all voltage and current sources to ramp up from 0 over 20u sec.

UIC suppresses DC operating point analysis at the start of the sim. You should avoid using this directive.

Also, you should add a small serial resistance (~100m) to the voltage source. All voltage sources have some resistance.

eT
so startup behaves somewhat like pwl voltage
 

Veracohr

Joined Jan 3, 2011
685
A real oscillator is self starting because of noise & imbalances in the circuit that are unavoidable. There’s no such thing inherent in the mathematical realm of simulation.
 

Bordodynov

Joined May 20, 2015
2,356
I'm looking at the launch process a little differently. When I was actively engaged in (designing) oscillators with quartz (in the clock chip), I always used a source like PWL. As I wrote earlier, there may be no oscillation with a slow increase in supply voltage.
 

Thread Starter

silv3r.m00n

Joined Apr 15, 2010
48
I'm looking at the launch process a little differently. When I was actively engaged in (designing) oscillators with quartz (in the clock chip), I always used a source like PWL. As I wrote earlier, there may be no oscillation with a slow increase in supply voltage.
what was the frequency of those oscillators ?
were they LC tank or RC phase shift oscillators ?
 

LvW

Joined Jun 13, 2013
840
A real oscillator is self starting because of noise & imbalances in the circuit that are unavoidable. There’s no such thing inherent in the mathematical realm of simulation.
When the simulation is as real as possible, each oscillator will safely start also in simulation.
What means "real"? Of course, with a supply voltage that is switched on at t=0 (as in realty).
No other kick is necessary.
 
Top