# Constructing a block diagram for amplitude control of an oscillator

I'm building a Wien Bridge oscillator. The oscillation part works just fine, but it currently limits on the supply rails.

I want to add amplitude control, so I've added a precision rectifier which feeds an integrator that controls an LDR to change the gain of the circuit.

This setup makes the output amplitude oscillate. To get a better understanding of what happens I want to construct a block diagram of the amplitude control and use control theory to improve the design.

I'm already a bit stuck on building the block diagram. I've the following: Where the 3 is the ideal gain, to compensate the $\frac{1}{3}$ of the frequency selective network. The $\delta R$ is the change in the gain resistor due to the LDR. Since the frequency selective network has 0 phase shift at the oscillation frequency I believe there is no need to put in an actual transfer function.

I've modelled the rectifier with a gain of 1, as it doesn't really change the amplitude it just presents it in a different form. The $\frac{1}{sC}$ is the integrator.

Is this somewhat correct? How can I now add the fact that the integrator output alters the $\delta R$?

• " I've added a precision rectifier which feeds an integrator that controls an LDR to change the gain of the circuit." I suspect that deleting the precision rectifier and the integrator would fix the problem, Back in the day, people just used the nonlinear resistance of an incandescent light bulb filament to reduce the gain as the amplitude increased. Adding an integrator has introduced another time constant into the system and (presumably) that time constant has created a second oscillator that is modulating the Wein bridge amplitude. – alephzero Aug 10 '18 at 10:49
• Yes, it would fix the amplitude oscillation problem, but the distortion is then very high. I want the output to be as clean as possible. The question is also more about applying/learning control theory rather than actually fixing the oscillation problem (although I'll celebrate with a beer once it's fixed :) ). – Remco Poelstra Aug 10 '18 at 10:54

All real oscillators are unstable. They eventually either expand to the rails as you've demonstrated or decay to zero. So they indeed need a 'fix' to keep the poles on the imaginary axis.

The rectifier - good to obtain a linear feedback signal of 'peak' amplitude.

The integration of the difference between your desired amplitude and the rectified oscillation signal - necessary to reach a steady state accuracy in amplitude but you need to add a proportional component to provide damping. So basically you need a proportional-integral (PI) controller.

The integral gain will adjust your speed of amplitude convergence, the proportional gain the damping; so overshoot and settling oscillation. Check your gain/phase margin for adequate stability.

• How do I check the stability margins with the block diagram? Is there a way to measure or otherwise calculate it? – Remco Poelstra Oct 12 '18 at 17:49
• Inject a perturbation signal into the amplitude control loop and record time series and calculate the frequency response function (closed loop) derive from that the open loop frequency response function and measure the gain and phase margins at the 180 deg and 0 dB cross over frequencies, respectively. Injected perturbation either (swept) sine or random noise to excite across your operational bandwidth. Start with the block diagram to work out the process, but check it on the real system since models are never real. – docscience Oct 12 '18 at 19:58
• Thanks. I’m going to try this out. Will take a little time as I’m not familiar with these kind of thing. – Remco Poelstra Oct 13 '18 at 17:19