Control system with feedback time delay - Page 1
Forum section: electronics / projects

author: akis
author_rank: Frequent Contributor
timestamp: July 02, 2014, 10:37:18 am
content: The attached circuit shows a very simple example of using an op-amp to sense the voltage on the emitter of a transistor, compare it with another value (in this case 1V) and drive the transistor so that the do values reach equilibrium, in other words, are the same. To put it differently, the op-amp will do what it can to keep the voltage at the emitter at a precise 1V.This kind of circuit works well because there is an almost immediate response from the transistor, so the equilibrium is reached very fast, uS maybe even nS.Now imagine that there is a significant time delay (say 10 seconds) between the op-amp applying some voltage at the base of the transistor and receiving a feedback in its negative input. I think, what would happen then is that the transistor would open fully, exceeding the 1V at the emitter, and would stay like that for 10 seconds. After 10 seconds the op-amp would finally sense that the emitter voltage is too high and would close the base of the transistor. The transistor now would switch off for another 10 seconds, until the op-amp realised that the emitter voltage is now 0. And the cycle would repeat, with the transistor being fully on and fully off every 10 seconds, without reaching an equilibrium.I fully understand that this exactly what happens when there is no time delay - because there is always a time delay, but when it is so small, nanoseconds, then we do not care, and the transistor stays at an equilibrium because the op-amp keeps it there. But when the time delay is huge, then, we, humans, can perceive the cycle, and it is not how we want it to work.Can you think of a simple way to control this transistor in a smooth manner, if there were a large time delay in the feedback loop?

author: dannyf
author_rank: Super Contributor
timestamp: July 02, 2014, 10:58:55 am
content: Google PID.

author: wraper
author_rank: Unknown
timestamp: July 02, 2014, 11:35:13 am
content: Yes, search for PID controller. Analog PID controller also can be made but I cannot call it simple.

author: akis
author_rank: Frequent Contributor
timestamp: July 02, 2014, 11:40:30 am
content: I readhttp://en.wikipedia.org/wiki/PID_controllerand it is spot on.It says, and I agree with it, that it is easier done in software, you can then make the algorithm as complex as you want.

author: dannyf
author_rank: Super Contributor
timestamp: July 02, 2014, 11:50:36 am
content: Both digital and analog PID can be simple and complex, depending on the rest of your loop.Analog PID can be implemented via a single opamp, but most of time, it involves more - four opamp implementation is fairly common. Digital PID can be done easily on a mcu with ADC + pwm or gpio output.Both are difficult to implement in terms of getting it to stabilize over a wide operating range. You can do fairly detailed stability analysis on an analog PID. A digital PID is basically beyond most people's ability to analyze: you basically hope that it is stable.

author: akis
author_rank: Frequent Contributor
timestamp: July 02, 2014, 11:59:02 am
content: Well this is the explanation of why I thought of using a small MCU rather than a combination of op-amps, 555s and what else. But thanks for your pointer it is exactly what I needed.

author: nctnico
author_rank: Super Contributor
timestamp: July 02, 2014, 12:22:55 pm
content: Quote from: dannyf on July 02, 2014, 11:50:36 amNonsense. The same formulas and rules apply to both kinds of PID. What you need in the digital domain is the Z transform instead of Laplace.

author: dannyf
author_rank: Super Contributor
timestamp: July 02, 2014, 02:17:34 pm
content: QuotePID is a general form of control. As such, it may not be the most efficient / effective one for your particular application.If the schematic is one where you are attempting to implement a PID-like control, I would suggest that you try to introduce another feedback path from the opamp's output to its inverting input, and use two (or three) resistors to weigh the two feedback signals: one from the opamp's output and another from the load.Adjusting the values of the resistors (and/or adding capacitors) may provide the desired behavior.

author: Kremmen
author_rank: Super Contributor
timestamp: July 02, 2014, 07:43:46 pm
content: What you have drawn is an archetypical feedback loop. All the elements are simple analog functions so the circuit permits a traditional analysis based on the system characteristic equation. Without going into the details the aim is to be able to sketch the frequency response of the feedback loop gain. For all feedback systems the condition of stability must be met or the system will oscillate.Put in the simplest possible terms the open loop frequecy response must be such that the loop gain is below 0 dB (i.e. less than 1) when the phase shift of the feedback signal lags the command signal by 180 degrees. This i hope was common knowledge.When you close the control loop, the characteristic equation takes the form ofY/X = GP/(1+GPH) whereX = system input signal (command)Y = system output signal (the process effect)G = controller gainP = plant gainH =feedback gainBear in mind that all the gains are complex variables in frequency. Determining the gain factors is nontrivial in many cases and i won't go into that here.Looking at the equation and bearing in mind that often (esp. for opamps) G >> 1 it is the case that the (steady state) gain is determined practically alone by H.By inspection it is obvious that when the numerator - product GP - goes to zero the transfer function itself goes to zero. The point(s) where this happen are calledzerosof the transfer function.Further by inspection when the denominator 1+GPH goes to zero the the equation goes to infinity at the point of singularity. These points are called thepolesof the transfer function. In other words the poles are the solutions to the equation 1+GPH = 0.In order to achieve stability the designer must manipulate the system characteristic equation / transfer function so as to ensure the stability condition is met. Usually and especially for classical controllers such as PID, this is done by pole/zero analysis and placement. Analysis can be done by drawing a bode plot and analyzing that. Perhaps more common is to create an approximation of the characteristic equation and perform the Laplace transform to arrive at the transfer function in the frequency domain (the "normal" transfer function is stated in the time domain). From the Laplace form it is possible to place the (complex) poles and zeros in the s-coordinate plane ( X-direction, usually called the rho, corresponds to evolution of amplitude, Y-axis, usually called jw (omega) corresponds to frequency) where analysis is often very straightforward. It is a necessary condition that all poles are strictly in the left half-plane (i.e. rho < 0) signifies damped oscillations. If also all the zeros are in the left half plane the system is said to beminimum-phaseand fulfilling both conditions usually makes the system unconditionally stable. But there are non-minimum phase systems where the above conditions are not necessarily met. Should a zero be located in the right half plane a nasty thing happens as the zero increases gain by 20 dB/dec from the corner frecuency upwards but at the same time lags the phase up to 90 degrees. This is a dangerous condition because it directly undermines the criterion of stability.Loop delay introduces phase lag and/or right half plane zeros to the transfer function.While PID is probably the most common control algorithm if you include all variants (P, PI etc), it is certainly not the most efficient for all circumstances. There is only a limited set of tricks in the bag to combat the dreaded RHPZ (right half plane zero) and usually it effectively spoils the dynamics of the system. Pole-zero cancellation is one of the traditional techniques but it is far from foolproof. Read more from the interweb. The no-brainer is to reduce the loop gain until it is back to 0 dB at 180 degrees but that usually results in unsatisfactoy performance.Modern process control is mostly based on state-variable control strategies such as the NMPC or nonlinear model predictive control. Those use tools such as various observer strategies and e.g. Kalman predictors to produce the output signal in a way that is not a product of linear time invariant algorithms such as the PID. But that gets righteously complex already on the concept level so i will go into it only if you wish me to do so.

author: dannyf
author_rank: Super Contributor
timestamp: July 02, 2014, 07:58:02 pm
content: QuoteFor a linear system with infinitely long data stream, a PID (based on an error vector from the same state variables) would be equivalent to a Kalman filter on the same state variable.That equivalency breaks down when the system isn't linear (ie. every real process), or some of the state variables are non-observable, or you don't have an indefinite stream of data.But that's an extreme overkill for what the OP was trying to do.

author: Kremmen
author_rank: Super Contributor
timestamp: July 02, 2014, 09:54:09 pm
content: Quote from: dannyf on July 02, 2014, 07:58:02 pmBut where would the fun be in that?Better to implement a model based adaptive state space predictor employing the Kalman filter as one part of it. It is the capability of adaptation that enables performance beyond anything a PID can do.QuoteSure. Didn't intend it as a recommendation that he should consider. There seems to be another thread from the same poster with more details of his problem, which i didn't read before posting the previous.Anyway, delay is a bitch to PID and there is no easy way around it. Feedforward schemes might help in some cases

author: dannyf
author_rank: Super Contributor
timestamp: July 02, 2014, 10:14:58 pm
content: QuoteYes. Vectored PID over 3 variables is difficult. That's where a Kalman filter would come in, in reducing data storage and processing speed, through adaptive and recursive Kalman filters.QuoteYes, by predicting where the next error is going to be and counter it before it happens.

author: f5r5e5d
author_rank: Frequent Contributor
timestamp: July 03, 2014, 07:47:52 am
content: try:https://www.google.com/#q=smith+predictor+feedbackwhile cmd/setpoint step response can be improved, disturbance rejection is inherently limited by Bode Integral relations

author: T3sl4co1l
author_rank: Super Contributor
timestamp: July 03, 2014, 11:57:47 am
content: 1. In a vast number of cases,it is not a pure time delay.The most common systems exhibit one or two dominant poles (and no nearby zeros) at some lowest frequency, which do not exhibit a constant group delay or linear phase shift or whatever.People very often talk in terms of "and then, a little time later,thishappens, and...", which is extremely misleading. The real world is not made of discrete events and fixed time delays. It should be understood very early in ones' career that, in almosteverycase, what is meant is a dominant-pole response.2. Whether a time delay, simple pole, or many complex poles, the simplest solution (though hardly the optimal control strategy) is an R+C from op-amp output to -in.In the example shown, if we assume the transistor exhibits very large capacitance (a simple pole), say from base to ground, then a somewhat larger resistor between opamp output and base will help the opamp produce its own voltage, independent of the state of the transistor; and a resistor from emitter to -in is necessary to allow the feedback network to control the op-amp.If the transistor needs more drive current, a buffer stage (with a cutoff frequency over three times that of the transistor stuff) will be needed, to compensate for the relatively large series resistance used between amp and load. (Since the point is to reduce loading on the op-amp, an ideal buffer doesn't need a resistor at all. A kind-of-half-assed buffer, like another transistor to make a darlington, should still use a resistor, in which case the higher resistance is just fine, because hFE of a darlington is so much higher.)The R+C feedback network implements a "type 2" pole-zero control, which works very nicely with simple pole "plants" (the "plant" is "the thing that's being controlled", the transistor in this case). The resulting system is second order (two poles), with response time and and peaking adjustable by the R and C values. (A dominant pole controller would be just C (R = 0), which necessarily goes very much slower than the plant itself responds.)You can also do a lead-lag controller, where the feedback resistor (from "plant" to -in) is not just a resistor, but has an R+C in parallel with it, and you stagger the break frequencies of both R+C networks to give a phase boost at some frequency of interest. This helps significantly with complex two-pole plants, i.e., anything that naturally resonates (a voltage mode forward converter SMPS is a prime example -- the output is LC filtered). However, this may be partially or fully turned on its head for RF circuitry, where poles may be used as approximations of lossy transmission lines. Fundamentally, E&M is transmission lines (pure time delay) going at the speed of light (or something near there), but any real circuit exhibits an infinite combination of delays, losses, poles and zeros, which means that's not a very useful model either.Tim

author: miceuz
author_rank: Frequent Contributor
timestamp: July 03, 2014, 12:48:46 pm
content: Quote from: Kremmen on July 02, 2014, 07:43:46 pmI'm fascinated by the control theory, never learned it in university, just catched glimpses here and there. I'd be very interested in a brief explanation of state-variable control principles.

author: Kremmen
author_rank: Super Contributor
timestamp: July 03, 2014, 04:10:00 pm
content: Quote from: miceuz on July 03, 2014, 12:48:46 pmOK, but it'll have to be a short intro. I am in fact in the middle of packing my gear for a fishing trip up 70 North in the Arctic Sea with a few stout friends and a sturdy boat. But to the point:Withstatewe mean a snapshot of an abstract description of a real world entity whose behavior in some fashion evolves over time. More to the point, the state describes the relation of the system input to the output, however those are defined in each particular case. The simp0le systems are what is called SISO - Single Input, Single Output. More advanced cases and those where state control comes to its own, are the MIMO sytems - M for Multiple. Due to the complex internal interactions the state of such systems are not describable using single variables; instead vectors and matrices are used to handle the simultaneous progression of individual factors or elements of state. Thus the entity under investigation is in principle described by the set of input-output pairs that fully (or sufficiently) define the behavior of the entity.So a state variable is a vector whose elements indicate the value of the variable at specific points in time. Thestate spaceof the system is the collection of all such state vectors and ideally, fully describes the system (though seldom in practice).The state variable is a function in time, dependent on the initial state of the system, and the input. This dependency creates what is called atrajectory. Trajectories can be plotted in the (multidimensional) state space to describe the evolution of state of the system.All kinds of interesting deductions can be made from the state equations (matrices) once they are known, such as properties of linearity and time invariance, or otherwise. There are established methos of obtaining the state equations, some of which are trivial and others not so much but i won't go into that now.To produce the output of a system you need to create the transition matrix of the system, describing how the output is produced as the combination of the system inputs and its preceding internal states. In a linear time-invariant case this is sometimes straightforward, often not.But I'm afraid im really out of time and anyway the topic is maybe a bit too much for a forum post. Before really "getting it", one should be reasonably familiar with the core of classical control theory - itself a decidedly nontrivial topic. I should know, having majored in just that all those long years ago... After that state control is "just" exasperatingly convolved linear algebra. Or not...