Author Topic: Control system with feedback time delay  (Read 7561 times)

0 Members and 1 Guest are viewing this topic.

Offline akisTopic starter

  • Frequent Contributor
  • **
  • Posts: 982
  • Country: gb
Control system with feedback time delay
« on: July 02, 2014, 10:37:18 am »
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?
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Control system with feedback time delay
« Reply #1 on: July 02, 2014, 10:58:55 am »
Google PID.
================================
https://dannyelectronics.wordpress.com/
 

Online wraper

  • Supporter
  • ****
  • Posts: 19502
  • Country: lv
Re: Control system with feedback time delay
« Reply #2 on: July 02, 2014, 11:35:13 am »
Yes, search for PID controller. Analog PID controller also can be made but I cannot call it simple.
 

Offline akisTopic starter

  • Frequent Contributor
  • **
  • Posts: 982
  • Country: gb
Re: Control system with feedback time delay
« Reply #3 on: July 02, 2014, 11:40:30 am »
I read http://en.wikipedia.org/wiki/PID_controller and 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.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Control system with feedback time delay
« Reply #4 on: July 02, 2014, 11:50:36 am »
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.
================================
https://dannyelectronics.wordpress.com/
 

Offline akisTopic starter

  • Frequent Contributor
  • **
  • Posts: 982
  • Country: gb
Re: Control system with feedback time delay
« Reply #5 on: July 02, 2014, 11:59:02 am »
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.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 30269
  • Country: nl
    • NCT Developments
Re: Control system with feedback time delay
« Reply #6 on: July 02, 2014, 12:22:55 pm »
A digital PID is basically beyond most people's ability to analyze: you basically hope that it is stable.
Nonsense. 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.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Control system with feedback time delay
« Reply #7 on: July 02, 2014, 02:17:34 pm »
Quote
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?

PID 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.

================================
https://dannyelectronics.wordpress.com/
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1290
  • Country: fi
Re: Control system with feedback time delay
« Reply #8 on: July 02, 2014, 07:43:46 pm »
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 of

Y/X = GP/(1+GPH) where

X = system input signal (command)
Y = system output signal (the process effect)
G = controller gain
P = plant gain
H =feedback gain
Bear 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 called zeros of 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 the poles of 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 be minimum-phase and 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.
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Control system with feedback time delay
« Reply #9 on: July 02, 2014, 07:58:02 pm »
Quote
Kalman predictors

For 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.
================================
https://dannyelectronics.wordpress.com/
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1290
  • Country: fi
Re: Control system with feedback time delay
« Reply #10 on: July 02, 2014, 09:54:09 pm »
Quote
Kalman predictors
[...]would be equivalent to a Kalman filter on the same state variable.
But 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.
Quote
But that's an extreme overkill for what the OP was trying to do.
Sure. 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
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Control system with feedback time delay
« Reply #11 on: July 02, 2014, 10:14:58 pm »
Quote
It is the capability of adaptation that enables performance beyond anything a PID can do.

Yes. 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.

Quote
Feedforward schemes might help in some cases

Yes, by predicting where the next error is going to be and counter it before it happens.
================================
https://dannyelectronics.wordpress.com/
 

Offline f5r5e5d

  • Frequent Contributor
  • **
  • Posts: 349
Re: Control system with feedback time delay
« Reply #12 on: July 03, 2014, 07:47:52 am »
try: https://www.google.com/#q=smith+predictor+feedback

while cmd/setpoint step response can be improved, disturbance rejection is inherently limited by Bode Integral relations
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22435
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Control system with feedback time delay
« Reply #13 on: July 03, 2014, 11:57:47 am »
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, this happens, 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 almost every case, what is meant is a dominant-pole response.[1]

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).

[1] 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
« Last Edit: July 03, 2014, 12:09:15 pm by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline miceuz

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: Control system with feedback time delay
« Reply #14 on: July 03, 2014, 12:48:46 pm »
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.

I'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.

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1290
  • Country: fi
Re: Control system with feedback time delay
« Reply #15 on: July 03, 2014, 04:10:00 pm »
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.

I'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.
OK, 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:

With state we 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. The state space of 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 a trajectory. 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...



Nothing sings like a kilovolt.
Dr W. Bishop
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->