Electronics - Control Loop
Created; 05/02/2015, Changed; 04/03/2024, 05/03/2024
Previous page; Electronics - Designing with discrete semiconductors
In the previous page, I showed examples of linear transistor circuits with compensation capacitor networks added to improve the bandwidth. The emitter resistor set the gain, but there was no other feedback and the circuit probably could not be described as having feedback, rather it has programmed gain. In those circuits, bandwidth was improved by adding a much faster amplifier.
The best solution ran the output differential amplifier, mostly turned off except when it was doing work. In that case, the feedback resistors consumed most power 160mW = 2 * 400V^2 / 1MR. Rising to 1W = 1 * 200V^2 / 220KR or so when running. The differential amplifier consuming 12mW and the feedback resistors 40mW.
OrCAD 16.6 or 17.2, AL-0013-01B
From inspection you can see that the loop gain for the proportional control example is about 100 this is likely to be the maximum value for the total loop gain and optimum being lower gain say 50. In a simple system with one sensor, one driver, and one significant lag component such as a heating or motion control.
From inspection you can see that the loop gain for the proportional integral control example is about 50 this is likely to be the maximum and optimal value for the total loop gain. Low frequency gain be very high, virtually infinity (100,000 or higher).
For the proportional integral controller, add; dV/dT = i/C, where i = (Set point - Error voltage)/22K. This sum does not help much.
The time constant 1M x 100nF of 1/10 second is the loop time constant and is set to about double the physical rise time of the system would be the fastest time and could be just at the point of instability.
This Proportional Integral (P.I) controller requires two variables to be changed, and this gives a good starting point.
By comparison, a nudge up nudge down (P.I) software control loop requires one variable - the size of the nudge (the proportion) the Integral being the system time constant.
Generally, the filter capacitor must be a maximum of 1/5th the size of the integral capacitor. Generally 1/10th or 1/20th is normal for the filter capacitor but the smaller, the more stable the loop provided higher frequency noise is managed adequately.
There is comparability between using a low Q soft magnetic, bead or common mode choke and a C + R+C network for EMC filtering to control loop stabilisation. The term circuit damping is good.
The R or R+C components C2, 5, 11 in parallel with are not included in these diagrams. They are not required, on the set point input.
Example from CRT plate driver previous page;
Blanking is used, when the dot is moving but should not be seen such as drawing a graticule and moving the spot back to the start.
Rather than optimise the design, the drivers can be driven more slowly to avoid distortion.
Block Diagram AL-0051-01A OrCAD Capture diagram.
AL-0047-11A Feed forward control.
The left side is the input signal amplified. The right side is the correcting waveform generated by amplifying the error and applying correction. The circuit does not perform particularly well but demonstrates the point. The difference signal output and mean voltage level are constant, so the CRTs astigmatism should stay corrected compared to other examples I have created in which the mean level changes with the amount of work that the amplifier is doing.
Gaps for resistors shown may need to be fitted if more trimming is required.
Voltage mode switchmode power supply ICs usually use Feedforward to vary the pulse width to shorten as the supply voltage mains increases in the ripple thereby maintaining the same output power. Feedback then sets the precise output voltage conventionally.
The differential amplifiers on this and the previous page demonstrate different, control and compensation strategies;
AL-0047-04? And AL-0047-05? Simple differential amplifier runs open loop with differential compensation that will need trimming to correct for variation in loading and component capacitance. The circuit must be driven with a low impedance differential driver.
AL-0047-01? Feedback, with common base buffering and emitter followers, gives better compensation for loading capacitance variation. The circuit is less sensitive to load capacitance.
AL-0047-12? It is a very fast inner control. Consequently, the circuit can work very briefly at a higher frequency. Mostly only one side or the other side output is working, giving the opposite side time for the voltage to rise ready for that side to be used accurately, quickly.
Feed forward - the amplifiers' error is amplified and corrected by a second amplifier. AL-0047-11? This example does not demonstrate benefit. Right and also see further above.
The method turns out to be the same as the other circuits with feed back, except that the feedback is not cross coupled back to the first amplifier. Having said that, it is worth considering, if only to looking at your problem another way.
AL-0051-01? Feed Forward compensation block diagram (OrCAD Capture).
Feedback - AGC;
Feedback for gain control instead of distortion and speed control. A traditional radio's RF amplifier has no overall feedback for linearisation or bandwidth correction but will have low frequency automatic gain control from the detector output. In radio, the mixer and local oscillator are designed for low distortion multiplication and oscillators sine wave purity in order to minimise the detection of other channels and interference.
An FM radio may use a limiter diode instead of an automatic gain control in the RF section.
https://www.cool386.com/zn414/zn414.html TRF Radio, R1+C1 from the automatic gain control.
Control Loop Compensation
Without feedback - Called open loop;
In the case of Motor Speed control, for example, You may avoid control loops or minimise the need for a control loop, for example by;
Use a permanent magnet (PM) brush motor, which have very good self speed regulation. In the case of a PM motor, the speed is proportional to the supply voltage and is largely independent of the motor's load.
DC motor.
A shunt wound brush motor also has good speed regulation, the speed largely determined by the ratio of the voltages applied to the field and armature winding voltages. An old technique not used now but taught in engineering was to add a third series field winding opposing the shunt field winding, so tending to cause the motor to speed up under load, but set to just cancel the slowing down effect under load due to windings resistance.
I believe train drivers are offered two modes, shunt to control wheel speed and stop the wheels slipping, and series (like an electric drill) to go as fast as the voltage regulator and inclination will allow to better use the trains' momentum on hills.
More powerful magnets has lead to PM motors - generators being more common, used with switch mode motor drives that additionally recover breaking power.
Hybrid Series/Shunt motor, but with the series field winding adding to the shunt field winding. The torque increases with loading, but its speed regulation is not so good.
AC or DC motor.
Use a stepper motor, but take care to optimise ramp up rate when getting the motor to the desired speed. If the speed is increased too slowly, the stepper motor may resonate and the shaft stop rotating. This resonance issue can be minimised by avoiding loading the motor with a lot of inertia by using a flexible coupling or belt drive should resolve the issue. The electronic drive can be optimised for efficiently or low resonance, ST Microelectronics have particularly good application notes on their range of ICs. The motor will also stop and not restart if stalled by loading or if the speed is ramped up too quickly.
These run from alternating current with a phase shift capacitor or 3 phase supply. Or from a controller using a high voltage DC supply generating current pulses, there are 2/4, 3, and 5 phase variants.
Constant speed motors;
Stepper motor - old low power type. This is a 1960s or 70s model, but during the 1980s, stepper motors started using more powerful magnets.
Induction motor. Single phase supply but with direction control capacitor. The capacitor is reactive and applies leading alternating voltage in the second phase. In order for magnetism to be created in, the armature rotates a little below synchronising speed in order to generate a magnetising current in the armatures copper cage.
Permanent magnet brush motor. The supply voltage determines the speed, the brushless type works particularly well in a control loop because of their smoother running. Generally, these types of motor have quick acceleration and braking when driven from a bipolar driver, resulting in a tighter control loop, meaning fast and accurate.
Modern high power stepper motor. 2-phase with 4-phase wiring. 1980s motor, the detent force needed to rotate the shaft is more because the motor is magnetised with stronger magnets.
Central heating timer, single phase permanent magnet synchronous motor. These also have a spring-loaded ratchet mechanism to ensure they rotate in the right direction.
Disk drive 2-phase stepper motor. Has a low voltage winding for high speed running and long-lasting bearings.
Stepper motor driver operating one phase on mode. I used MOSFET power transistors plus Zener diodes because the gain would not have been high enough unless I had used darlington transistors. Power MOSFET transistors were very new in 1979 and beginning to replace the void left for very low turn on voltage, germanium power had been withdrawn a few years earlier by manufacturers. Bipolar junction transistors sustain low current over voltage pulses.
During the 1980s, Japanese manufacturers such as Sanyo introduced very good quality 200-step stepper motors that were made with smaller air gaps and more rigid construction than British makers were making. More powerful magnets were used in them. They were more efficient, quieter running, and cost a lot less. The quietest smoothest running stepper motors are five-phase motors such as; 500-step Berger Lahr, but there are some trade-off's in using these motors. A shaft encoder, motor, and control can be more precise, though that would introduce a small amount of control loop noise. Three-phase stepper motors are also made designed for smooth running.
The motors can be driven single phase on, that is with one winding energised at a time, this makes them noisy.
The motors can be driven two phase on, that is with two windings energised at a time, this makes them quieter, more stable and more powerful.
The motors can be driven half step alternating between one phase and two phases on, this is more stable.
For maximum power, the winding voltage should be low, and the windings supplied by a resistor or chopped driver from a high voltage current source. (Chopped - switch mode current regulator)
Starting a stepper motor - There is an optimum ramp up rate, too slow ramp up and the motor will resonate and stops, too fast and the motor will stop rotating. This issue is greatly improved by ensuring that the drive is coupled to the load by a flexible coupling such as a belt - toothed belt - or rubber coupling.
For example, an encoder driven from a belt driven geared down brushless DC motor rotating at 500RPM. The encoder's output divided down to 4 phases 22.5 pulses a revolution. The four phase comparators (giving 90 pulses per revolution but with a better capture range with a fast, low drive ripple voltage because the higher frequency 90 adjustments a revolution can be filtered more without compromising the loop stability so much) resulted in a more stable phase accuracy than a 200-step stepper motor has (its position varies by at least 1/4 a step with temperature when it is rotating). This edge triggered phase-locked loop was implemented partly in CPLD and included fast out of lock detection, which was an overriding frequency detector that was applied if the frequency did not match. The control loop needed to be set about right for the motor to turn then trimmed, there was, of course, very little option to under or over compensate then adjust.
The strategy used in a temperature controller;
Having two control loops is a very effective approach. The inner fast tight response, and an outer slow for accuracy. The maths given are thermoelectric device makers are based on electric current but using a voltage drive is more convenient in addition primarily a thermoelectric device is resistive so Voltage or Current control are interchangeable in this case.
A thermoelectric device has a positive temperature coefficient, but this effect is relatively marginal.
The power driver was a switch mode power supply operating from 1 or 2 volts to say 24V, the polarity of the drive power was then managed by a bridge configuration of transistors driven by logic and a linear amplifier to finally adust the required power output. There were two loop gain settings, one for when a large amount of power was used and a variable low linear gain region for when the low power was required. The control circuit used a diode to reduce the gain as the power was reduced.
There is also a fan which is turned on when cooling is required, except when the cooling drive was operating at a very low power. The fan is also used if heating is required, except when the heat sink is hotter than ambient temperature.
The driver is not usable when the product of power required and the temperature difference is high. In this case, driving the thermoelectric harder will cause it to heat rather than cool. If this aspect is not managed well, perhaps by including a learning cycle, then the thermoelectric may not reach its best cooling. This is a significant issue.
Temperature controller with ancillary functions (AL-0023-01C CADSTAR 17).
I spend some time tidying up diagrams particularly this one. It also gives me a good opportunity to review my work.
How to find the constants for the PID controller.
When you consider buying a second-hand car; Test the suspension by leaning on each corner and then releasing that corner in turn - the car should rise, fall then rise and stop this is critically damped, and the shock absorbers are okay. If your design to over damped the control loop will be stable under a range of component tolerance, in this case, the car should rise more slowly then just stop, if you set it just right that would be at the same length of time as the critically damped condition this is a good safe setting. In the case of the second-hand car that takes a long time to return, then someone has filled the shocks with treacle or heavy grease because they are worn out.
It is usually better to set the control just under damped. In that way the system settles in the same time but does not overshoot.
Include some high-frequency filtering - this is usually set to a factor of 1/5th to 1/10th the value of the integral constant, but can be 1/100th. This will compromise the loop stability a little, but it is necessary.
Start without any Integral (Capacitor shorted) or differential constant (capacitor removed)
1) Reduce the loop gain (constant or resistor) until the loop is just stable, the loop is therefore simply a proportional control. The loop error as a very broad guess might be 2% (loop gain 50-100).
2) Halve the loop gain.
If this meets the requirement, then don't go any further. You have a proportional controller (P only).
3) Add the differential capacitor (or constant) and progressively reduce its value until the loop is just stable. Double the capacitor value, and fix it at that.
The loop is now stable, just over-damped. To give yourself more margin, you can quadruple the capacitor and halve the resistor again. If that achieves the requirement, leave it at that Proportional Integral controller but with no Differential Control term.
I have not got a good strategy for the Differential control but the following works somewhat. It is rarely necessary to have a differential control term.
4) Progressively increase I and reduce the D constant, and progressively reduce loop gain P until you can go no further. Then give yourself a factor of two to four margin by reducing I and increasing D and P.
P and PI controllers can be set empirically quickly, but PID is a bit more fiddly to set up, and I am not sure of the best method. Using the above method increases the frequency of the loop jitter and reduces its amplitude.
A method of finding the approximate value of the Integral term (capacitor) is to increase the gain as (1) measure the free running frequency. Halve the gain (2), then fit a capacitor that gives a time constant equal to the period of oscillation, or double that period. Then proceed to (3).
Look at Wikipedia on PID control you will see that they show you how to derive the terms for critical damping, whereas I have described how you achieve over-damping, which gives you a good solution with a margin for variation in load and tolerance. What you need to consider and experiment with is how the PID will behave after the item under consideration has had several years of use. For example, shaft encoders often have shaft sealing which will wear in quickly and the amount of motor effort needed to turn the encoder will reduce.
----------------------------------------------------------------------------------------------------
Negative feedback to form a relaxation oscillator
The digital output stops this circuit settling at the desired output voltage but switching instead at the mean level of the desired output voltage, called a relaxation oscillator. The output which is after filtering is at the desired voltage with a more modest loss than could be achieved with a conventional linear amplifier, but less efficient than was achieved using a buck-mode switch mode power supply with output polarity switch. This type of amplifier is used in audio amplification.
AL-0021-01F Switch mode amplifier, LTspice. Variable frequency, with a maximum but with no minimum frequency. The output LC filter will also resonate at some frequencies. The circuit works fine operating over a small output voltage range, at lighter load the output filter will have higher Q and will resonate producing high voltages when the output is close to the power supply voltage and the operating frequency is consequently low.
There is little problem with using an op-amp as a comparator as above the switching is not slowed by driving to power rails but on the other hand the output is slow and will cause power wastage in the output driver. A speed-up up capacitor is fitted to improve the op-amp in comparator mode's output speed.
C1 should be moved to between 0V and Out,
Clamp diodes could be added from the output to each supply to prevent resonance generating high output voltage than the power supplies.
The op-amp should be replaced with a comparator.
AL-0021-02G Fixed 100KHz open loop. There is no feedback the circuit functions open loop, so the output voltage is a percentage of the supply voltage.
The mark space ratio is set by adjusting the input voltage. There is distortion when the output is close to the power supply rails, and distortion around mid-voltage, which I do not know the cause?
LTspice is hard to use at first, and its help tells you some of an answer but does not complete all the steps. LTspice is continually improved, and the newest user interface has some buttons that had been an obscure meaning before. On the other hand, the modelling is said to be better and faster than other simulator tools. The key thing with any simulator is to keep the circuit small.
The second pole output filter is not required and is not fitted in audio amplifier applications. A simple L.C is adequate.
AL-0021-03B Relaxation oscillator from output feedback synchronised to 100KHz.
It has now become infuriating that, for example, Texas Instrument model do not run in any other tools than their own. Specifically, the CADENCE, tool is difficult it is better used as a very good circuit design tool. Consequently, you need to model use things near enough, but then use better parts in your final design. Because I am retired, I can not ask a question, which TI may have a good answer for?
IR2109 would provide a better solution for the output transistors. It has better non-operating delays.
TI's solution; https://www.ti.com/video/5625983804001
--------------------------------------------
Analogue v Digital integrator;
A filter or control system can be modelled in Labview.
Integration is simply the time constant and is 100% or nothing after a set period compared to a simple RC filter which produces a slope.
All the data is stored in an array which has initially been cleared.
New data point is placed to the first in the array added to the running average and the last data point is removed from the array and the running average. The real average is the sum divided by the number of samples which can be varied at any time.
A pointer in moved in a circular way so it also points to the new start end of the data array.
The behaviour is almost like a multipole filter.
This model's time constant can be varied and is set fast initially and progressively increases in time. Therefore, a result is shown rapidly, then over time it becomes more precise. It also looks very good to the user.
1946 Lenton sport has a particularly good frame. The frame is very much more springy than a modern bike's frame, but there is a very good active damping that the cyclist would not be aware he is providing. Consequently, is that when I hit bumps, the bike handles them better and the bump is softer for me. The hub gears are also easier to manage, so I can pay better attention to road traffic.
Unlike a child's bike or a modern bike, a veteran adult bike is less easy to learn to ride on because it needs more speed to start going with. On the other hand, managing derailleur gears whilst cycling on busy roads is harder, or you need to use a lower gear change down early, which is all more effort.
https://blog.andrew-lohmann.me.uk/2018/10/lenton-sports-bicycle.html
Discuss this see my; Blog page Electronics
Next page; Tools measurement and tolerances.