1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

Tài liệu Pid Motor Control pptx

13 373 0
Tài liệu được quét OCR, nội dung có thể không chính xác
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Tài Liệu Pid Motor Control Pptx
Trường học Trường Đại Học Kỹ Thuật
Chuyên ngành Điện Tử
Thể loại Tài liệu
Thành phố Hà Nội
Định dạng
Số trang 13
Dung lượng 1,73 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

We hope you’ll find it gratifying to notice that today’s circuit gives you a chance to apply several subcircuits that you have met before: integrator, differentiator, summing circuit, pu

Trang 1

Lab 11PID: More Op Amp Applications: PID Motor Control 1

Lab 11PID: More Op Amp Applications: PID Motor Control

REV 3°; October 28, 2002

Reading

Proportional-Derivative-Integral (PID) Loops

We're afraid the Text doesn’t treat this topic, except very indirectly

This indirect treatment appears in the sections of Chapter 4 on op amp stability and compensation We’ll hand you our rough notes on the topic

Today’s circuit looks straightforward: a potentiometer sets a target position; a DC motor tries to

achieve that position, which is measured by a second potentiometer Lags cause the difficulty: the

correction signal is likely to arrive too late to solve a problem that the circuit senses If that

happens, the remedy can make things worse

This motor control circuit is a classic feedback network called a “PID” circuit: the circuit

response ultimately will include three functions of the circuit error signal: “proportional,”

“integral,” and “derivative.” Stability is the central issue

We hope you’ll find it gratifying to notice that today’s circuit gives you a chance to apply several

subcircuits that you have met before: integrator, differentiator, summing circuit, push-pull

brought within feedback loop, plus a differential amplifier—the behavior of this last is familiar,

but today is your first chance to build one out of op amps This exercise also provides a first

chance to use multiple op amps in one larger circuit, and it returns you to the stability problems

of Lab 10b Today, the remedies will be subtler than those we applied in the earlier lab

The task we undertake here looks simpler than it is As we’ve said, all we aim to do is control the

position of a DC motor’s shaft, by letting it drive a potentiometer and feeding back the pot’s

voltage Here’s the scheme:

V+

vt

MOTOR Pot

RS

Figure 1: Basic Motor-Position Control Loop: Very Simple!

What could be simpler? Not much, on paper But the challenge turns out to lie in keeping the

circuit stable The issue is fundamentally the same as the one you met in Lab 10b, when you

noticed that a low-pass in an op-amp’s feedback loop could turn negative feedback into positive, if

we weren’t careful The problem arose from the fact that an op amp provides -90 degrees of phase

‘Revisions: replace current- with voltage-drive, 10/02; cut active filter, 9/02; revise ckt to adjust overall gain

rather than P separately: add annotating ”balloons” to figures, & explan of D gain 3/02.

Trang 2

Lab 11PID: More Op Amp Applications: PID Motor Control 2

shift, so that just 90 degrees more can get us into trouble Another way to say that—and a way that may be more appropriate to today’s circuit—is to note that the op amp acts like an

integrator, above a few tensof Hz This integration effected by the naked op amp results from the internal “compensation” that rolls off its gain so as to keep the feedback circuit stable

In today’s circuit we are stuck with a similar -90 degree shift, or an integration This time, it comes not from the op amp We avoid that effect by not using the “naked” op amp, and so can hide from its phase shift Instead, the integration comes from the nature of the stuff we are putting inside the loop: a motor whose shaft position we are sensing We drive the motor (with a voltage); it spins for a while, at a rate proportional to the applied voltage The position it

achieves is the time integral of the spin rate That last proposition means we are stuck with an integration inside the loop

To make this last point graphically vivid, here’s a scope image showing how the position-pot responds to a square-wave input to the motor The triangular output looks a lot like what you saw in Lab 9’s integrator, doesn’t it? —apart from the inversion that Lab 9’s op-amp integrator inserted

wo?

j

1 S Gren Feedback (pasiéne)

Figure 2: Motor-drive to Position-sensing Potentiometer forms an INTEGRATOR

Here’s a block diagram of our feedback scheme, with the variables indicated, as they work their way around the loop We'll show it first in the more formal control-loop form used in our class discussion:

C"systen ga iw ")

As

@ rrr) angular posirrn )

4

cOrrech controller y ~ Reference Vanahle R if x) > Rn

ern ) = (“controller sain") Figure 3: Loop to control motor shaft position: block diagram in form used in class discussion Now, here’s the same diagram redrawn to look more like the op amp loops that we are

accustomed to seeing:

Trang 3

Lab 11PID: More Op Amp Applications: PID Motor Control 3

IAs

(“voy

( refere nce)

LO G ¬

campl tied | >>

Figure 4: Loop to control motor shaft position: block diagram in form familiar from op amp discussions

Stability We will find that we can make the circuit at least marginally stable, simply by

keeping the gain of the circuit low enough In Lab 10b, we saw the same pattern—in which

stability improved when loop-gain was reduced; in those Lab 10b experiments, we could not

control the gain of the op amp (“A”), so we varied the fraction fed back (“B”) Today, in

contrast, we will use not the usual op amp to generate the “amplified error” term, but instead will use a pseudo-op amp made from a differential amp followed by a gain block Given this

arrangement, we can control the gain (“A”) Here’s a reminder of the Lab 10b circuit that

illustrated the problem, and a solution: varying “B,” the fraction fed back

<P>

———es

lok ¢

Figure 5: Lab 10b circuit: diminishing signal fed back was able to stabilize circuit despite C-load The signal fed back was shrinking as its phase shift was growing more dangerous (approaching the

extra -90 degrees that could bring on oscillation) So, when we attenuated it further (with a

voltage divider, in exercise 10b-2), we could keep our circuit stable Today, we again regulate loop

gain (AB), but by varying not the fraction of Voyr that we send back (“B”), but rather the gain

of the home-brew “op amp” (“A”)

And here’s a reminder of today’s circuit:

al, -

‹ HG

MOTOR PoT

+

TARAT

|

as

|

Figure 6: Proportional-only drive will cause some overshoot; gain will affect this

Trang 4

Lab 11PID: More Op Amp Applications: PID Motor Control 4

Soon, much as in the active-filter case, we will try out gradually increasing the gain We should find the circuit fairly stable for low gains, then as we increase gain we should begin to see

overshoot and ringing, evidence of the circuit’s restlessness; at still higher gains, the circuit should oscillate continuously

At the end of these notes we attach some scope images describing just such responses to

variations in simple “proportional” gain

2.1 Motor Driver

Let’s start with a subcircuit that is familiar: a high-current driver, capable of driving a

substantial current (up to a couple of hundred milliamps) We'll use the power transistors you’ve

met before: 2N3055 (npn) and 2N2955 (pnp) The motor presents the kind of troublesome load

likely to induce parasitic oscillations, as in the last exercise of Lab 10b We need, therefore, the protections that we invoked there: not only decoupling of supplies, but also both a snubber and high-frequency feedback that bypasses the troublesome phase-shifting elements

We are trying hard, here, to decouple one part of the circuit from the others: the 15uF caps should prevent supply disturbances from upsetting the target signal Similar caps at the ends of the motor-driven potentiometer aim to stabilize the feedback signal We also suggest that you use

an external power supply to provide the motor’s +15V supplies; we do this not for decoupling, but because the motor’s maximum current exceeds the breadboard’s 100mA rated output, and might have disturbed those supplies even if applied plenty of decoupling caps The external supply, unlike the breadboard supply, can provide the necessary current

HSV ~

HS vu

(external supply)

+1Sv

‡ LH 38

>/SuF

Poe — tht > (Sur =3

1

IV

xẻ

RUT A^^

(extemed suppl, )

Figure 7: Motor-driver Wire up the two potentiometers, as well The resistors at the ends of the two

potentiometers—6.8k resistors on input, 4.7k resistors on the motor pot—restrict input and output range to a range of about + 7V, so as to keep all signals well within a range that keeps the

op amps happy The difference in R values makes sure that the input range cannot exceed the achievable output range

You can test this motor driver by varying the input voltage, and watching the voltage out of the motor-driven pot Any Vry more than a few tenths of a volt should evoke a change of output

Trang 5

Lab 11PID: More Op Amp Applications: PID Motor Control 5

voltage You will hear the motor whirring, and will see the shaft slowly turning (the motor drive

is geared down through a two-stage worm- and conventional- gearing scheme) A clever clutch scheme allows the motor to slip harmlessly, when the pot reaches either end of its range If the signs of Vin and the change in Voyr do not match, then be sure to interchange leads of one of the pots, so as to make them match We don’t want a hidden inversion, here, to upset our scheme when we later close the loop

Now we do a strange thing: we use three op amps to make a rather-crummy op-amp like circuit

tiSU

| (1/2 LM358) (1/2 LM 358) (1/2 LM 358)

bok

; 100k 10K R_gain (breadAourd 100k (resistor substitution box)

+ pots) 10K

L „> vở |

= ; 100k a ~ E t "Sum"

+ bik —= ¬

\⁄ FR)

-/2v 1) ground , for pseudo-differential-mode test; 2 1< gw

2) tie to other input, for common-mode test 3] — 4A7 K2)

Figure 8: Differential Amp Followed by Gain Stage and an inversion

The first stage you recognize as a standard differential amp It shows unity gain The second stage simply inverts’; the third stage seems to be doing no more than undoing the inversion of the preceding circuit That is true, at this stage; but we include this circuit because soon we will use

it, fed by two more inputs, as a summing circuit So used, it will put together the three elements

of the PJD controller: Proportional, Integral, and Derivative

This circuit is a differential amplifier, with gain that is adjustable, but never anything like so high

as what we are accustomed to in op amps We need this modest gain, and we need a virtue of this simple circuit: no appreciable phase-shift between input and output Both characteristics contrast with those of an ordinary op amp, as you know: the ordinary op amp shows fixed, high gain, and integrator behavior beginning at 10 or 20 Hz We cannot afford to include such an integrator in our loop, because—as we have noted above—we are stuck with another integration, and two integrations in series would get us into trouble, turning negative feedback into positive

We suggest that you use a resistor substitution box to set the summing circuit’s gain Set the gain at ten, and see whether a common-mode signal—a volt or so applied from the input pot, applied to both inputs—evokes the output you would expect (Do you expect zero output?) Then ground one input (the 100k that feeds the first op amp’s inverting input, using the level from the potentiometer as input Watch that input, and the circuit output, with the R substitution box

?This inversion is included so as to let this signal share a polarity with the “Derivative” and “Integral” signals, soon to be generated; these signals will come from circuits that necessarily invert.

Trang 6

Lab 11PID: More Op Amp Applications: PID Motor Control

values set to 100k: see if you get the expected gain of +10

A couple of features of this test may bear explaining:

e Yes, the gain is positive when the input pot drives the non-inverting input to this

home-made op amp, since two inverting stages follow the diff amp;

e we are applying a “pseudo-differential” signal by grounding one input of the diff amp and

driving the other (You did this also in Lab 7, as you drove the JFET differential amp of

your own design.) Since the differential gain is so much higher than the common-mode, this pseudo-differential signal is treated almost as a true differential signal would be An applied signal of v appears as a differential signal of magnitude v, combined with a common-mode

signal of magnitude v/2 Given even a mediocre CMRR, this modest common-mode signal

mixed with the differential is harmless

A DVM may be handier than a scope, at this point, to confirm that the output of this chain of

three op-amp circuits shows a pseudo-differential gain of +10, while you drive the input with the

input potentiometer voltage When you finish this test, leave the output voltage close to zero

volts

2.3 Drive the Motor

You have already tested the motor driver Let’s now check the three new stages—the pseudo op

amp—by letting its output feed the motor-driver Confirm that you can make the motor spin one way, then the other, by adjusting the input pot slightly above and then below zero volts (The

motor-driven pot fortunately can take the pot to its limit without damaging pot or motor: the

motor continues to spin, once the pot has hits its stop; as we’ve noted already, the motor’s

gearing has been designed to permit this slippage.)

wey ⁄Z temporarily grounded: for pseudo-differential operation

| (1/2 LM 358) (/2LM358) — (/2LM358) (12 LM358) “EYeenal supply)

2 oan R substitution box T nhà

(Greadh (readhowrd 100k 100k 10K (R R=470 = 470k => moderate gain) ` lerate øai = ax

> vty ~ IR ye

+ 4&—— + > wt, Dy oe re t 2N3055 * 2/SuF

= † 100k Error A k "Sum" l> << Tường

-/$

v

(extermed suppl, )

Figure 9: Try making motor spin, to test the diff amp, gain stage, sum and motor drive

Trang 7

~]

Lab 11PID: More Op Amp Applications: PID Motor Control

Now reduce the gain, using the R substitution box: set gain to about 1.5 Replace the ground

connection to the inverting input of our “pseudo op amp” with the voltage from the output

potentiometer

ĩ v

(1/2 LM358) (1/2 LM358) (1/2 LM 358) (112 LM358) “Covernal supply)

ie Tổ 100k ox 10K (1M for Gain of 10)

>/c A Sor 2—— L : 26 +-^/ oH TY

ur

{100k

p7

AIF Ft

tên Ps position feedback

"24 tuk

4k

4 2N3055 7 >1%x

2N2955 ig

+ại +

PC extemned suy/'s ) A

Figure 10: The loop closed, at last: Proportional only

Watch Vin on one channel of the scope, Voutput—pot on the other channel If a digital scope is

available, this 1s a good time to use it, because a very-slow sweep rate is desirable: as low as 0.5

second- or even 1 second -per division

Several ways to test the loop: Manual or Function-Generator Steps? Two or three

methods are available to you, to test the new setup:

e Two ways to drive the input:

— square wave from function generator: a function generator can provide a small

square wave (+0.5V, say), at the lowest available frequency (about 0.2Hz) This input

can replace the manual input potentiometer, temporarily This is probably the best

choice, since it provides consistency you cannot achieve by hand

— Manual step input: you may, however, prefer the simplicity of manually applying a

“step input” from the input pot: a step of perhaps a volt

The output pot should follow—showing a few cycles of overshoot and damped oscillation

e An alternative test: Disturb the output, and watch recovery: a second way to test

the circuit’s response is available, if you prefer (and you may want to try this in any case,

after looking at the response to a step input): leave the input voltage constant, then

manually force the pot away from its resting position, simply by turning the knob of the

output pot Let go, and watch the knob return to its initial position—showing some

overshoot and oscillation, as when the change was applied at the input pot

Start with a very low gain, which should make the circuit stable, even in this P-only form Try

Rgum = 100k; now use the substitution box to dial up increasing gain At Rgym = 220k we saw

some overshoot and a cycle or two of oscillation That oscillation is evident in the motion of the

Trang 8

Lab 11PID: More Op Amp Applications: PID Motor Control 8

motor and pot shaft; if this shaft were controlling, say, the rudder of an airplane, this effect would

be pretty unsettling The circuit works—but it would be nice if we could get it to settle faster and to overshoot less

Increasing the gain, at Roum = 680k, we were able to make out several cycles of oscillation (the bigger, uglier trace shows the motor drive voltage; there the oscillation is more obvious):

SE EW 2

AK I IT): q

“f ne chi PID: E, | & D:

voltage drive ° I we ckt revised 3/6/02 4 P.R=680kK:P only > D LEONL-D aah,

|

X | ¡_JIput (yellow)

|

J4 ad

+

a PRP qed yt odes ' mee

|

No a rr cae ira Nag pe SRR ORL Zest a OT a aS sự

+ GREEN:Fsedhack (positian)

Oe

|

|

|

|

PINK: motor drive

PT ie == FIDNT EW

A—(1) = 358.6363 ms 433.238 mự B -(1) = 676.8180 ms 414.385 mự

A= 318.1817 mẹ -18.8534 mV

l/àa = 3.142858 Hz

Figure 11: P only: gain is high enough to take us to the edge of oscillation

With a little more gain (Rgum = 1M, in our case) and the application of either a step change at the input, or a displacement of the output pot by hand we saw a continuous oscillation Find the gain that sets your circuit oscillating, and then note the period of oscillation, at the lowest gain that will give sustained oscillation We will call this the period of “natural oscillation,” and soon

we will use it to scale the remedies that we’ll apply against oscillation

Markers |IEGEIES

3 Adding a Derivative of the Error

Well, of course we can get it to settle faster; we can improve performance (If we couldn’t, would

the name of this sort of controller include the “I” and “D” in its name, ‘PID”?)

We can speed up the settling markedly, and even crank up the “P” gain (“proportional”) a good

deal once we have added this derivative Thinking of the stability problem as a problem of taming the phase shifts of sinusoids—as we did for op amps generally—we can see that inserting a

derivative into the feedback loop will tend to undo an integration, at least to some degree

The integrations are the hazard, here: one is built in, the translation from motor rotation to motor position Additional integrations resulting from lagging phase shifts can carry us to the deadly minus-180-degree shift that transmogrifies nice feedback into nasty, and that brings on the oscillation you have just seen

Trang 9

Lab 11PID: More Op Amp Applications: PID Motor Control 9

3.1 Derivative Circuit

The standard op amp differentiator shown below can contribute its output to the summing

circuit Here, we show the entire prior circuit, with the differentiator added Its gain is rolled off

at about 1kHz

tisv

| (1/2 LM358) (1/2 LM 358) (1/2 LM 358) (1/2 LM 358) Ven waan | supply)

((SxeadÁsxr4 10K (R = 470k => moderate gain) -

“e:

"Tt + < b,¢k one >

R substitution box

(R = 220k ==> moderate gain)

(s'bsttn box?)

3° tewanaad suppl, )

|

1k 0.1 “>”

Figure 12: Derivative added to Loop

How Much Derivative?

Our goal, in adding derivative, is to cancel the extra phase shift otherwise caused by a low-pass

effect that brings on instability How do we know at what frequency this trouble occurs, and

therefore how to set the frequency-response or (equivalently) gain of the differentiator? We have

that information: we got it by looking at the frequency (or period) of “natural” oscillation, back

in section 3.4 There, as you know, you gradually increased the P-only gain till you saw that an

input disturbance would evoke either an output that took a long time to settle, or a continuous

oscillation When we ran that experiment, we got a “natural oscillation” period of roughly 0.6

second

To avoid complications, let’s assume that the gain of the “P” path is unity Then our goal is to

arrange things so that the derivative contribution, D, is equal to the Pcontribution, at the

frequency where trouble otherwise would occur The D should keep the loop stable, until yet

another low-pass cuts in; at that point, we should have arranged to make the loop gain safely low: less than unity, so that a disturbance must die away

Let’s start by reminding ourselves what we mean by differentiator “gain;” then we’ll calculate

what RC we need for stability Gain for a differentiator, by definition is

Vout /(dVirn /dt) We know that

VOUT =Ïx Rr eedback

and this J is just

C x dVrn /dt

Trang 10

Lab 11PID: More Op Amp Applications: PID Motor Control 10

So

RxCx đVIN (dt "

đdVỊN (dt

So, RC defines the differentiator’s gain? A differentiator’s output amplitude grows linearly with frequency; Voyr, in other words is proportional to w:

VOUT periv CX wRC

We want this VouTp.,;, to equal VoUTp, portional Which we've assumed is just equal to Vr If we

set these quantities equal, then

wRC=1

2nfRC=1

RC = 1/(2rf)

In words, this suggests that RC should be about 1/6 of the period of natural oscillation In our case, where Thsciliation = 0.68, we’d set RC to about 0.1 s, or a bit less.4 If we use a convenient C value of 0.1 uF, the R we need is about 1M Let’s make this value adjustable, though—because

we want to be able to try the effect of more or less than the usual derivative weight: if you have a second resistor substitution box, use it to set the differentiator’s gain (RC) Otherwise, use a 1M variable resistor Watching the position of the rotator will let you estimate R to perhaps 20 percent; the midpoint value certainly is 500k, and 750k is close to the 3/4-rotation position The differentiator’s output goes into the summing circuit installed earlier, through a resistor chosen to give this “D” term weight equal to the “P”’s

We hope you will find this “D” to be strong and effective medicine Once it has tamed your circuit’s response—eliminating the overshoot and ringing—crank up the “P” gain, to ten Is the circuit still stable? If not, try more “D.” Does an excess of “D” cause trouble? The scope image

of the circuit’s response will let you judge whether you have too much or too little “D”: too little, and you’ll see remnants of the overshoot you saw with “P-only”; too much D, and you'll see an RC-ish curve in the output voltage as it approaches the target: it chickens out as it gets close

Switch The toggle switch across the feedback resistor will let us cut “D” in and out; the switch seems preferable to relying, say, on a very-large variable R to feed the summing circuit We find it can be hard to keep track of multiple pot settings, to know whether we’re contributing “D” or

not A switch makes the ON/OFF condition easier to note

3Perhaps you find this a rehearsal of the obvious! Just a look at units make it very plausible that RC should be the differentiator’s gain: input is volts/second; output is volts; the conversion factor needs units of seconds

“See., e.g., Tietsche and Schenk (sp?) A less formal approach appears in St.Clair’s paperback tutorial, self- published (” Controller Tuning and Control Loop Performance” By David W St Clair ISBN 0-9669703-6 Straight-

Line Controls, Inc.; from his website (members.aol.com/pidcontrol/) one can download a simulator that allows one

to try his rules The easiest simulator, along with a good tutorial, appears in a University of Exeter, U.K., site

(http://newton.ex.ac.uk/teaching/CDHW/Feedback/) The simulation lets you try (as you would expect!) the

effect of varying P gain and of adding in D and I—just as we do in today’s lab.

Ngày đăng: 25/12/2013, 05:17

TỪ KHÓA LIÊN QUAN

w