ecse-4760 real-time applications in control

22
1 Rensselaer Polytechnic Institute ECSE-4760 Real-Time Applications in Control & Communications ANALOG AND DIGITAL CONTROL OF A DC MOTOR (2013) Number of Sessions – 4 INTRODUCTION Over the past several years, the digital computer has been used in a broad range of engineering applications. One of these is in Control Systems. Major advantages of using digital computers in the Control field include the great computational speed and accuracy, the relative ease with which simple parameters or even complete program modules can be modified (with virtually no new equipment cost), and the decision making capability. The last one lately has reached new heights with fuzzy controllers and expert systems, replacing delicate human operators. Large numbers of processes can be controlled simultaneously and effectively by a single computer and detailed reports can be generated, tasks previously unthinkable with an analog computer. The purpose of this experiment is to acquaint the student with the advantages and shortcomings of using microcomputers in Control System applications, by designing and implementing regulators to control the angular position of an armature controlled DC motor made by Feedback Ltd. Both analog and digital designs will be implemented so that direct comparisons can be made of the pros and the cons of each approach. It is assumed that the experimenter is reasonably familiar with the basic principles of analog feedback control, preferably root locus techniques, and can design compensators to satisfy a set of required specifications. PROBLEM FORMULATION The objective of the experiment is to design both analog as well as digital compensators to control the angular position of an armature controlled DC motor. A step input, created by changing the polarity of the motor, will be used as a reference signal. In general an armature-controlled motor can be regarded as a linear system over a finite operating range and is described by the following transfer function: For the motor in the Feedback 33-033 these constants are: For the first part of this lab, a gain factor of 25 is added in the feedforward path, resulting in the G p ( s) = K s s(τ m s + 1) K s = 3.986, τ m = 0.4839

Upload: others

Post on 08-Feb-2022

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ECSE-4760 Real-Time Applications in Control

1

Rensselaer Polytechnic Institute

ECSE-4760 Real-Time Applications in Control & Communications

ANALOG AND DIGITAL CONTROL OF A DC MOTOR (2013)

Number of Sessions – 4 INTRODUCTION Over the past several years, the digital computer has been used in a broad range of engineering applications. One of these is in Control Systems. Major advantages of using digital computers in the Control field include the great computational speed and accuracy, the relative ease with which simple parameters or even complete program modules can be modified (with virtually no new equipment cost), and the decision making capability. The last one lately has reached new heights with fuzzy controllers and expert systems, replacing delicate human operators. Large numbers of processes can be controlled simultaneously and effectively by a single computer and detailed reports can be generated, tasks previously unthinkable with an analog computer. The purpose of this experiment is to acquaint the student with the advantages and shortcomings of using microcomputers in Control System applications, by designing and implementing regulators to control the angular position of an armature controlled DC motor made by Feedback Ltd. Both analog and digital designs will be implemented so that direct comparisons can be made of the pros and the cons of each approach. It is assumed that the experimenter is reasonably familiar with the basic principles of analog feedback control, preferably root locus techniques, and can design compensators to satisfy a set of required specifications. PROBLEM FORMULATION The objective of the experiment is to design both analog as well as digital compensators to control the angular position of an armature controlled DC motor. A step input, created by changing the polarity of the motor, will be used as a reference signal. In general an armature-controlled motor can be regarded as a linear system over a finite operating range and is described by the following transfer function:

For the motor in the Feedback 33-033 these constants are:

For the first part of this lab, a gain factor of 25 is added in the feedforward path, resulting in the €

Gp (s) =Ks

s(τms+1)

Ks = 3.986, τm = 0.4839

Page 2: ECSE-4760 Real-Time Applications in Control

2

overall transfer function of the motor given by equation (1):

(1)

Due to manufacturing variations, nonlinearities, and wear of the Feedback Instruments Ltd. 33-033 DC servo system, the parameters in equation (1) are not exact. This will lead to discrepancies between the theoretical and actual responses during the course of the experiment when various controller designs are implemented. Because of this, you must justify why your results do not match the theoretical expectations. For extra credit, you may assume

and estimate K and tm for a step response for the proportional feedback case. The MATLAB System Identification toolbox provides some functions that will simplify this process. For this motor the following compensators must be designed and implemented:

• A pure proportional feedback controller. • An analog feedback compensator that will force the motor output to satisfy the following

specifications: 1) Overshoot to a step input ≤ 10%. 2) 2% settling time ≤ 0.75 seconds (or better). 3) Dead zone at the output ≤ 4˚ (or 5°). • The Tustin digital approximation to the analog compensator designed previously. • A digital controller, using the following design schemes: 1) The minimal prototype design criterion. 2) The ripple free response design criterion.

Note that for the analog part relaxing these requirements slightly permits the design of a controller that can be implemented more easily on a digital computer. To ensure success in obtaining the above desired results, it is very important that the compensator design be done on paper before the implementation is attempted. HARDWARE – SOFTWARE SETUP EQUIPMENT DESCRIPTION Available on the course web site is the 33-033 Reference Manual covering the theory and circuit details regarding the DC motor. Parts of the GP-6 Analog Computer Operator's Manual for details on programming the Comdyna have also been included on the course web site. The student is expected to read both manuals and become familiar with the systems before starting the experiment. The equipment to be used for the experiment consists of the following: 1) An armature controlled DC motor used as the process or plant to be controlled. It is called as such because a constant field current is applied to the motor, and the armature excitation is controlled. This is accomplished by means of an internal feedback path in the servo amplifier. The servo system 33-033 manufactured by Feedback Instruments Ltd. will provide the motor, the motor power supply, a servo amplifier to drive the motor, the position sensor, attenuators, and other features. 2) The Comdyna analog computer is used to build the analog compensator during the second part of the experiment. All the basic mathematical functions are available here and its usage is

ʹ G p (s) = 25Gp (s) = 25 3.986s(0.4839s +1)

= 25 8.2369s(s + 2.0664)

Gp (s) =K

s(τms+1)

Page 3: ECSE-4760 Real-Time Applications in Control

3

straightforward. In case of problems, refer to the Comdyna manual. 3) A PC running the relevant program used to implement the digital compensator. No PC specific knowledge is required other than following the instructions included. 4) A dual trace digital sampling oscilloscope (DSO), for recording the input and motor response. Some experimentation with the time scale will be necessary so that responses are recorded with maximum detail. You will want to save the screens of the digital oscilloscope to flash drive files. Setting up the hardware connections is relatively straightforward. Figure 1 shows an "extended" block diagram of the whole process containing all the necessary figures and connection links.

FIGURE 1. DC Motor diagram with proportional feedback. The 33-033 is divided into two sections, the Mechanical Unit 33-100 servo motor assembly unit and the Servo Fundamentals 33-125 control unit. The 33-125 provides all the electrical networks and amplifiers while the 33-100 provides the motor and the sensors. Once you have located these sections of the 33-033, follow the setup procedure outlined below: • Make sure the ribbon cable from the 33-100 is plugged into the 33-125 in the upper right corner

and that the Power Supply 01-100 is connected to the 33-100 (+5 V, +15 V, 0 V, & -15 V). • Following the wiring diagram below, on the 33-125, connect the inverted motor output (upper

right) to a 100k op-amp input resistor. Connect the op-amp output to the 2M resistor and to the Attenuator (middle left). The output of the Attenuator connects to the Power amplifier (-) input. The reference input to the summing op-amp’s other 100k input comes from EITHER the Input potentiometer OR the Sweep function generator Output amplitude potentiometer, who’s input is connected to the center Sweep function generator output (step function output). If the function generator is used for the input signal, the Output amplitude potentiometer should be set to about 0.5. The reference input is one signal to be observed on the scope along with the (non-inverted) motor output.

• The 33-125, Input potentiometer outputs a voltage proportional to the input angular position of the Mechanical Unit’s dial. The angular position is multiplied by 10 Volts/180° to convert from degrees to Volts. Thus, if the input dial on the 33-100 is moved ±90°, the voltage on the 33-125 will be ±5 Volts. The output of the potentiometer should go to the op-amp 100k input resistor and the op-amp’s output drives the Power amplifier. The servo Power amplifier in turn drives the motor. Note that the DC motor input can be wired to come from the manually adjusted dial potentiometer or the function generator’s step function output.

• The motor is not energized unless the 33-100 power switch is ON. Thus, if the motor goes unstable or into oscillations, turn the power switch OFF. Each time prior to using the motor, check and recalibrate the zero offset on the 33-125 when the power switch is ON.

• To produce clean step inputs required during the control runs, it is best to use the square wave output from the Sweep function generator with both the Min freq & Max freq dials turned all the way counter-clockwise and the amplitude adjusted appropriately with the potentiometer.

• The dashed connections from the inverted Tacho generator output, through a second Attenuator, to a 3rd 100k op-amp input will be used to provide velocity feedback. When combined with the position feedback this implements a PD controller. The Attenuator adjusts the gain on

3

of the experiment. All the basic mathematical functions are available here and its usage is

straightforward. In case of problems, refer to the Comdyna manual.

3) A PC running the relevant program used to implement the digital compensator. No PC specific

knowledge is required other than following the instructions included.

4) A dual trace digital sampling oscilloscope (DSO), for recording the input and motor response.

Some experimentation with the time scale will be necessary so that responses are recorded with

maximum detail. You will want to save the screens of the digital oscilloscope to flash drive files.

Setting up the hardware connections is relatively straightforward. Figure 1 shows an "extended"

block diagram of the whole process containing all the necessary figures and connection links.

FIGURE 1. DC Motor diagram with proportional feedback.

The 33-033 is divided into two sections, the Mechanical Unit 33-100 servo motor assembly unit

and the Servo Fundamentals 33-125 control unit. The 33-125 provides all the electrical networks and

amplifiers while the 33-100 provides the motor and the sensors. Once you have located these sections

of the 33-033, follow the setup procedure outlined below:

• Make sure the ribbon cable from the 33-100 is plugged into the 33-125 in the upper right corner

and that the Power Supply 01-100 is connected to the 33-100 (+5 V, +15 V, 0 V, & -15 V).

• Following the wiring diagram below, on the 33-125, connect the inverted motor output (upper

right) to a 100k op-amp input resistor. Connect the op-amp output to the 2M resistor and to

the Attenuator (middle left). The output of the Attenuator connects to the Power amplifier

(-) input. The reference input to the summing op-amp’s other 100k input comes from EITHER

the Input potentiometer OR the Sweep function generator Output amplitude potentiometer,

who’s input is connected to the center Sweep function generator output (step function

output). If the function generator is used for the input signal, the Output amplitude

potentiometer should be set to about 0.5. The reference input is one signal to be observed on the

scope along with the (non-inverted) motor output.

• The 33-125, Input potentiometer outputs a voltage proportional to the input angular position

of the Mechanical Unit’s dial. The angular position is multiplied by 10 Volts/180° to convert from

degrees to Volts. Thus, if the input dial on the 33-100 is moved ±90°, the voltage on the 33-125

will be ±5 Volts. The output of the potentiometer should go to the op-amp 100k input resistor and

the op-amp’s output drives the Power amplifier. The servo Power amplifier in turn drives

the motor. Note that the DC motor input can be wired to come from the manually adjusted dial

potentiometer or the function generator’s step function output.

• The motor is not energized unless the 33-100 power switch is ON. Thus, if the motor goes

unstable or into oscillations, turn the power switch OFF. Each time prior to using the motor,

check and recalibrate the zero offset on the 33-125 when the power switch is ON.

• To produce clean step inputs required during the control runs, it is best to use the square wave

output from the Sweep function generator with both the Min freq & Max freq dials turned

all the way counter-clockwise and the amplitude adjusted appropriately with the potentiometer.

• The dashed connections from the inverted Tacho generator output, through a second

Page 4: ECSE-4760 Real-Time Applications in Control

4

the derivative term. Even though adequate, the above explanation is by no means complete. The reader is urged to refer to the 33-033 manual for a more complete description of setup procedures as well as answers to probable questions.

FIGURE 2. DC Motor wiring diagram with proportional (& derivative) feedback. Note that the input to the op amp through the top 100k resistor is from EITHER the Input

potentiometer OR the Sweep function generator. ANALOG COMPUTER USAGE The analog controllers are to be built on the Comdyna computer. This distinguishes this lab from the other control labs where the analog computer is used as the plant to be controlled. Here the DC motor is the plant and the Comdyna is the controller. Later the PC running LabVIEW will be used as the digital controller. Special care must be taken when implementing the gains because of the sign inversions at the output of the amplifiers. The Comdyna dial must be on the Pot Set position during setup; during operation the dial must stay on Oper and pushbuttons switched between OP at the start and IC at and end of each run. You should also note that the analog controllers implemented on the Comdyna analog computer may light the "OVLD" lamp when the amps begin to saturate. There is no problem if the indicator flashes on briefly during operation. A sustained overload condition, however, will affect the controller's operation. These effects may be minimized by reducing the input step size or reducing the overall gain of the analog computer block.

One of the oscilloscope channels must be connected to the process output (with ground), and the other one to the control signal (or AO 0 port on the PC for the discrete part), or the op-amp output

To Scope

To Scope

Page 5: ECSE-4760 Real-Time Applications in Control

5

(and ground) to observe the error. Use the maximum voltage range possible for more detailed results. WARNING: Even though the D/A converters are protected from overload, an input voltage in excess of +10 or -10 Volts can result in permanent damage to the A/D converter. There will be cases where even though the control signal will be active, no response will take place. If it is suspected that the error signal is too low, then the following procedure must be very cautiously applied (the TA's presence is advised if you are unsure of what you are doing): • Start slowly incrementing the Attenuator pot and run the simulation until the output starts

responding; • Return the settings to their original positions and modify the design so that the proportional gain

is increased; • Try running the experiment again; • If problems persist, try manually adjusting the parameters around their calculated points and

rerun the experiment. The justification for this action stems from the fact that the motor model is a linear function of a nonlinear process and its parameters themselves are estimated.

DIGITAL COMPUTER USAGE To access the LabVIEW program do the following: • Turn the PC on (if off) and go to the DC_Motor subdirectory (My Computer\Local Disk):

C:\CStudio\RTA_lab\DC_Motor. • Double click New DC Motor DAQmx+.vi to load the program. A LabVIEW program will open

with several parameter fields in the front panel. • Press the right arrow icon at the top left corner of the window to start execution. To abort the

program, press the STOP button on the screen, not the stop sign at the top of the page. This will prompt the program to calculate the actual sampling time for the run, and reset the output. Not using the STOP button to halt execution may yield incorrect results on subsequent runs. There may be a few seconds delay before the VI completely halts.

• Although some values can be changed during execution by user input, it is important to note that to properly ensure correct measurements, the controller needs to be stopped (by using the STOP button) before altering input values.

• If you notice the controller isn’t working properly: o Press the stop button then run the LabVIEW program again. This should reset the program

and enable you to start from scratch. o Wiggle all connectors make sure they are good. If when wiggling wire you notice a difference in

the response, change connectors. Occasionally LabVIEW or the PC may need to be restarted. The algorithm used to derive the gains depends on appropriate values for the sampling time T. For approximating continuous implementations the general notion is the faster the sampling, the better the controller approximates the analog model (20 ms or less), but direct digital control can use much larger values for T. Values for T that are too small may result in excessively large gains. Sometimes the calculated values for the control signal exceed the ±10 Volts (D/A limits). In these cases a software-implemented clipper prevents the D/A control values from "wrapping" around by forcing them to stay at their respective max/min values. Be warned though that if the signal remains at these levels very long (saturated), then erroneous results occur. Try using a different sampling time or coefficients. Using smaller input step changes will also help. Also if the average actual sample time observed on the oscilloscope is higher than the sampling time entered in the front panel, raise it until you find a workable value. In many cases 10 ms will be around the lowest possible time. You could also simply take the average sample time as your sampling time for the test.

Page 6: ECSE-4760 Real-Time Applications in Control

6

PART I - ANALOG CONTROL PROPORTIONAL FEEDBACK CONTROLLER Even though the model of the motor is assumed linear, nonlinear (static & Coulomb) friction is present in the motor, resulting in a dead zone at the output of the motor, related to the error velocity constant[1] Kv by:

DeadZone(degrees) =~100

velocityerrorconstant =~100𝐾9

This friction can be modeled as an external disturbance and must be taken into account during the calculations. Figure 3 shows a typical block diagram with the disturbance fn and the proportional gain g, and Figure 4 shows the phase plane trajectories for such a motor. For more information on these figures and the motor friction in general see [2]. The velocity error constant Kv for a type 1 system (one free integrator) is given by equation (2):

(2)

(Note: for a type 0 system - no free integrators, Kv will be zero.) Prior to designing a dynamic compensator, it would be desirable to try a pure proportional feedback controller of the form K[u(t) - e(t)]. Despite the fact that this is a type 1 system there is a possible non-zero steady state error that depends on the size of the step input. Can you explain why this occurs? Typical phase plane trajectories are given in Figure 4.

FIGURE 3. Block diagram including friction input. Notice that once you specify the dead zone, the error velocity constant is specified. Therefore, the system is completely determined for the proportional controller. Also note that the dead zone is twice the maximum absolute value of the steady state error. To experimentally measure the dead zone move the input shaft both clockwise and counterclockwise until the output shaft barely moves and add the two displacements. For a dead zone of 4°, can you meet the specifications of overshoot ≤ 10%, or a settling time ≤ 0.84 s, one at a time? Why?

Kv =s→0limsGc (s)Gp (s)

g

Gp (s)

e + +

-

-

ΘOUT

Θ IN

fn

Page 7: ECSE-4760 Real-Time Applications in Control

7

FIGURE 4. Phase plane trajectories for the friction. Even though the questions can be answered by using only the equations in the following section, it will be helpful for further analysis if the root locus for the open loop transfer function is drawn[3]. Assume that each of the specifications is individually satisfied, solve for the resulting gain Kp and the other parameters and check your results in the locus line (see the example at the end of PART I). Use [4] for help in computing gain Kp. A detailed presentation of the root locus analysis can be found in [5]. Save response plots of the system satisfying the requirements individually. The gain in the proportional control is adjusted by simply turning the Attenuator pot. Unfortunately estimating the quantitative value for a particular setting is not trivial. At this point the best way to measure the attenuation after adjusting the gain to provide a desired control characteristic on the oscilloscope traces, is to put oscilloscope probes on both the input and output terminals of the pot and directly measure the input and output voltages, as shown in Figure 5. It may be easier to provide a fixed DC voltage from the Variable dc supply (approx. -1.35 V to +1.25 V) to facilitate the measurement. The gain (more accurately, the attenuation) will be:

(3)

FIGURE 5. Measuring Attenuator value.

e .

TERMINATION LINE

e

DEAD ZONE

fng—-fn

g—

Gc (s)Gp (s)

gain =VCH 2VCH1

To Scope CH 1

To Scope CH 2

Page 8: ECSE-4760 Real-Time Applications in Control

8

PD CONTROLLER Although not always available on every plant to be controlled, the 33-033 system does provide a velocity output that can be used to implement a derivative term in the feedback controller. Simply adding the dashed connections in Figure 2 sets up a PD controller. Optimize the response of the proportional controller by adding in the derivative damping term to achieve the required original specifications. After adjust both the overall gain and the derivative (tacho) gain for the best response, save the input & output response plots and determine the values of the attenuators. DYNAMIC FEEDBACK CONTROLLER Since pure proportional feedback cannot produce a closed loop system meeting the specified requirements, a lead compensator (called phase lead because a < b) as in equation (4) is required to relocate the roots of the closed loop characteristic equation of the system. The task is to determine the proper variables a, b, and b to satisfy the given criteria. Note that the relation between the dead zone and the error velocity constant still holds.

(4)

The analog computer simulation diagram of the compensator is shown in Figure 6. For more accurate control, it is important to note that the gain of the operational amplifiers are nominally -1 or -10 but may off by a few percent and the offsets for the power amp must be zeroed manually. This will have an effect on gain calculations for all controllers, both analog and digital, that use the op amps. It is worthwhile to devise a quick experiment with an oscilloscope and function generator to measure the actual gain and zero the offset. Also remember the nominal gain of -10 must be considered when calculating the gain A for the digital controllers. Since we're dealing with a second order process and a first order compensator, the resulting closed loop transfer function will be of third order. The overshoot and settling time specifications on the other hand, are defined for a second order process, hence a typical strategy is to choose the real closed loop transfer function pole so far away in the Left Hand plane, that the remaining (complex conjugate poles) will behave as dominant ones giving a response similar to the regular second order processes.

FIGURE 6. Analog computer simulation of the compensator.

A general second order process [6] is described by its natural frequency wn, and the damping ratio z as:

Gc (s) = β(s+ a)(s+ b)

8

PD CONTROLLER

Although not always available on every plant to be controlled, the 33-033 system does provide a

velocity output that can be used to implement a derivative term in the feedback controller. Simply

adding the dashed connections in Figure 2 sets up a PD controller. Optimize the response of the

proportional controller by adding in the derivative damping term to achieve the required original

specifications. After adjust both the overall gain and the derivative (tacho) gain for the best response,

save the input & output response plots and determine the values of the attenuators.

DYNAMIC FEEDBACK CONTROLLER

Since pure proportional feedback cannot produce a closed loop system meeting the specified

requirements, a lead compensator (called phase lead because a < b) as in equation (4) is required to

relocate the roots of the closed loop characteristic equation of the system. The task is to determine

the proper variables a, b, and β to satisfy the given criteria. Note that the relation between the dead

zone and the error velocity constant still holds.

Gc(s) = β

(s+ a)

(s+ b) (4)

The analog computer simulation diagram of the compensator is shown in Figure 6. For more

accurate control, it is important to note that the gain of the operational amplifiers are nominally -1

or -10 but may off by a few percent and the offsets for the power amp must be zeroed manually. This

will have an effect on gain calculations for all controllers, both analog and digital, that use the op

amps. It is worthwhile to devise a quick experiment with an oscilloscope and function generator to

measure the actual gain and zero the offset. Also remember the nominal gain of -10 must be

considered when calculating the gain A for the digital controllers.

Since we're dealing with a second order process and a first order compensator, the resulting

closed loop transfer function will be of third order. The overshoot and settling time specifications on

the other hand, are defined for a second order process, hence a typical strategy is to choose the real

closed loop transfer function pole so far away in the Left Hand plane, that the remaining (complex

conjugate poles) will behave as dominant ones giving a response similar to the regular second order

processes.

FIGURE 6. Analog computer simulation of the compensator.

A general second order process[6] is described by its natural frequency ωn, and the damping

Page 9: ECSE-4760 Real-Time Applications in Control

9

(5)

Important timing measures defined in relation with a second order process are:

Settling Time:

Peak Time: (6)

and response measures for a step input are:

Peak Response:

Percent Overshoot: (7)

There are various design techniques that yield an acceptable compensator satisfying all the specifications for the output, yet it must be noted that no unique solution exists and no first time success is guaranteed; a possible modification of the parameters, by trial and error, until all requirements are met might be necessary. Two techniques will briefly be mentioned here, and the student is urged to use either them or his own favorite one, applying his/her experience and initiative. An extensive analysis of both root-locus and Bode plot (phase-gain margin) techniques, even using different compensator types can be found in [7]. Remember the decisive factor for success or failure of a design is the experimental measuring of the specification values from the saved oscilloscope screen shots! The first technique[8] assumes that the third order process is described by a closed loop transfer function of the form:

(8)

and imitates a second order one if the real root g of the characteristic equation obeys the following:

(9)

Thus using the specifications given, the coefficients of the model T(s) are computed. Since Gp(s) is known the above equation can in general be solved (coefficient matching) for the unknown polynomial Gc(s). If the transfer function T(s) contains any finite zeros then the closer they are located to the dominant complex poles the less accurate the approximation becomes. The second technique[9] is a classic root locus phase-lead compensator design, and is broken down to the following steps:

1) Translate the design specifications (z, wn) into desired dominant closed loop root locations. 2) Draw the uncompensated transfer function root locus and see if it passes nearby the desired

roots; if yes then evaluate the proportional gain K required by algebraically summing the lengths of the vectors from the open loop poles and zeros to the desired root (root locus magnitude criterion).

3) Else a compensator is needed to modify the locus curves. Place its zero directly under the desired roots.

4) Place the compensator pole in such a location that the algebraic sum of the angles of all vectors from poles and zeros to the desired root is an odd multiple of 180° (root locus angle criterion).

Gc (s) =ωn2

s2 + 2ζωns+ωn2

Ts =4

ζω n

Tp =π

ω n 1−ζ 2

M pt= 1+exp

−ζπ

1−ζ 2

⎜ ⎜

⎟ ⎟

P.O. =M pt

−11

×100%

T (s) =Gc (s)Gp (s)

1+Gc (s)Gp (s)=

ω n2

(s2 + 2ζω n s +ω n2 )(γs +1)

1γ ≥10ζωn

Page 10: ECSE-4760 Real-Time Applications in Control

10

5) Evaluate the new gain K as in step (2) and compare the design results with the specifications set. If they are not admissible start the procedure again.

The DC motor compensated open loop transfer function F(s), for use in the root locus is:

(10)

The block diagram for the DC motor containing the compensator block is shown in Figure 7 and matching wiring in Figure 8. Note that the summing op-amp is reconfigured for 1x or 5x gain. If the compensator requires a gain larger than 10, use the 5x setting and b/5 in the compensator (pot=b/50).

FIGURE 7. Extended Block Diagram including the compensator.

FIGURE 8. DC Motor phase lead & digital control wiring diagram.

F(s) = KGc (s)Gp (s) = βs+ as+ b

×8.2369

s(s+ 2.0664)=

K(s+ a)s(s+ 2.0664)(s+ b)

10

from poles and zeros to the desired root is an odd multiple of 180° (root locus angle criterion).

5) Evaluate the new gain K as in step (2) and compare the design results with the specifications

set. If they are not admissible start the procedure again.

The DC motor compensated open loop transfer function F(s), for use in the root locus is:

F(s) = KGc (s)Gp (s) = βs+ a

s+ b×

8.2369

s(s+ 2.0664)=

K(s+ a)

s(s+ 2.0664)(s+ b) (10)

The block diagram for the DC motor containing the compensator block is shown in Figure 7 and

matching wiring in Figure 8. Note that the summing op-amp is reconfigured for 1x or 5x gain. If the

compensator requires a gain larger than 10, use the 5x setting and β/5 in the compensator (pot=β/50).

FIGURE 7. Extended Block Diagram including the compensator.

FIGURE 8. DC Motor phase lead & digital control wiring diagram.

To Scope

To Scope

Control output FROM

Analog Computer -OR-

LabVIEW AO 0

Error input TO

Analog Computer -OR-

LabVIEW AI 0

Yellow jumper: gain=5 -OR-

Green Jumper: gain=1

To Scope

To Scope

Control output FROM

Analog Computer -OR-

LabVIEW AO 0

Error input TO

Analog Computer -OR-

LabVIEW AI 0

Yellow jumper: gain=5 -OR-

Green Jumper: gain=1

Page 11: ECSE-4760 Real-Time Applications in Control

11

From (10) it's clear that .

The admissibility criterion for any design meeting the P.O. and settling time requirements, will be the error velocity constant Kv which is computed using (2) as:

(11)

The student must be warned that the only design that is automatically rendered unacceptable is the pole cancellation process (compensator zeros coinciding with process poles) for reasons[10][11] extending far beyond the scope of this experiment. The following example should clarify the methods described above, and serve as a model for the DC motor design. EXAMPLE We are given a second order process . A feedback compensator is to be designed

so that the process response satisfies the following specifications: settling time Ts = 0.8 sec; percent overshoot P.O. = 10%; position error constant1 .

The specifications are translated using equations (6) and (7) as follows:

which means The product (for 2nd order systems) is equal to the real part of the closed loop complex conjugate roots. A. Pure Proportional Control Figure 9 is the root locus of the open loop transfer function The open loop poles p1, p2 are located at -1 and -2. The root locus for the closed loop system consists of two straight line segments that start from -1 and -2 respectively, going towards each other, meet at -1.5 and split, one following a course parallel to the Im[s] axis and the other parallel to the -Im[s] axis. For simplicity only the upper Left Half Plane is shown in Figure 9 as the lower one is symmetric. From the locus it is obvious that any closed loop complex roots will have the -1.5 intersection point as their real part, therefore the settling time requirement cannot be met by any proportional gain. •Satisfying the P.O. requirement yields a and an angle , as shown in Figure 9. The proportional gain is then calculated by applying the gain criterion (and standard trigonometry),

1 The system is of type 0 (no free integrator) hence the error characteristic is defined as the position error constant .

β =K

8.2369

Kv = lims→0

sGc (s)Gp (s) =Ka

2.0664b

Gp (s) =1

(s +1)(s + 2)

K p = 100

Ts = 0.8 =4

ζω n

⇒ζω n = 5 (desired)

P.O. = 10 = 100exp−ζπ

1−ζ 2

⎜ ⎜

⎟ ⎟ ⇒ζ = 0.6

θ = cos−1ζ = 53.13° (desired)

−ζω n

F(s) = KGp (s) =K

(s +1)(s + 2)

ζ = 0.6

θ = cos−1ζ = 53.13°

K p = lims→0

Gc (s)Gp (s)

Page 12: ECSE-4760 Real-Time Applications in Control

12

and from the gain the position error constant is evaluated:

FIGURE 9. Root locus for proportional feedback.

Obviously the position error constant Kp is not satisfied since the resulting 2.125 is far below the required 100. •Satisfying the position error constant immediately defines the gain K. From the gain and equations (6) and (7), z and q are calculated, yielding the P.O.: Therefore and

Again the Percent Overshoot is unacceptable compared with the 10% requirement. B. Feedback Compensator Design Method #1. From equation (8) the compensator general solution can be found as:

The only problem with the above formula is that it doesn't guarantee that the resulting compensator will be a lead compensator, in fact it probably won't be, unless very careful manipulations of the coefficients take place. For the scope of this experiment the analysis will stop here.

K = (0.5)2 + (1.5tanθ )2 (−0.5)2 + (1.5tanθ )2 = 4.25

K p = Gc (0)Gp (0) =K2

= 2.125

−ζωn

-1.5θ

Im[s]

-Re[s] -1-2

P1

s1

s'1

P2

ω’n

ωn

K = 2K p = 200

200 = (0.5)2 + (1.5tanθ )2 (−0.5)2 + (1.5tanθ )2 ⇒ tanθ = 9.422

θ = 83.94°⇒ cosθ =ζ = 0.1055

P.O. = 71.65%

Gc (s)Gp (s)1+Gc (s)Gp (s)

=T (s)⇒ Gc (s) =T (s)

[1−T (s)]Gp (s)

Page 13: ECSE-4760 Real-Time Applications in Control

13

C. Feedback Compensator Design Method #2. Figure 10 is the root locus of the transfer function with the process

poles at p1 = -1 and p2 = -2. Since the compensator pole pc = -b and zero zc = -a are variable the locus itself is variable and is not drawn at any instance. Again only the upper Left Hand plane is drawn due to symmetry. Two attempts for a solution (pc, zc), (pc', zc') were made and for readability reasons the second attempt was drawn "mirror image like" on the lower Left Half Plane. The student is requested to neglect this inconvenience and assume that all regular upper plane conventions (length and angle signs) are unaltered in this case too. As mentioned before, in order to satisfy the settling time criterion the dominant complex roots must have real parts ≤ -5, defined by the vertical line LM at -5 in Figure 10. In order to satisfy the P.O. criterion z must be ≥ .6 hence the angle q must be less than 53.13° defined by the angle K0N in Figure 10. This means that all admissible solutions should lie to the left of the boundary defined by the points K, L, M, N.

FIGURE 10. Root locus diagram containing solution trials (pc, zc) & (pc', zc').

F(s) = Gc (s)Gp ( p) =K(s +a)

(s +1)(s + 2)(s + b)

ζ = 1pc

p'c

p2 p1

Page 14: ECSE-4760 Real-Time Applications in Control

14

Let the point s1 (-5, 5) be selected as a closed loop root, and place the compensator zero zc at (-5, 0) according to the method instructions. Applying the locus angle criterion, we find the angle of the compensator pole qc and its position on the -Im[s] axis as follows: therefore

Applying the locus magnitude criterion the gain K and from it the Kp, are calculated as follows:

Comparing the result with the requested Kp = 100 the solution is not accepted. As a second attempt the point sc' (-7, 7) is selected. The compensator zero is placed at zc' (-7, 0). Again the same angle calculations take place: therefore

And the magnitude criterion gives for the K and Kp:

The position error criterion is met since 100 ≤ 165.54, thus the design is acceptable and the unknown compensator coefficients are a = -7 and b = -35.37. The complex conjugate roots of the closed loop transfer function are -7 ± 7j and since the difference between the open loop poles (3) and the zeros (1) is 2, the third real closed loop root can be found[12] from the sum of the poles as:

A final note about the design: from the way the roots were selected it's obvious that there are infinite valid solutions. An important hidden restriction is the power requirements (translated in increased gain K) needed for moving the complex poles to the desired positions. As a compromise, the best solution seems to be an acceptable design with the smallest gain K required. EXPERIMENTAL PROCEDURE Follow the setup under the HARDWARE-SOFTWARE SETUP section for analog feedback control and modified as shown in Figures 7 and 8 for B. For all runs, the error output voltage should be monitored to insure that it doesn’t try to exceed the range of op amp (saturate & clip the control). A. Proportional Control Using equation (2) and the preceding Dead Zone equation calculate the required feedback gain to

θ1 = arctan 5−4 = 128.66°, θ 2 = arctan 5

−3 = 120.96°, φc = 90°

θ1 +θ 2 +θ c −φc = q180°, (q = 1, 3,5,...)⇒θ c = 20.34°

pc = −5− 5tanθ c

= −18.49

K =52 + (5−1)2 52 + (5− 2)2 52 + (18.49−5)2

52 + 02= 107.43⇒ K p =

K2

= 53.72

ʹ θ 1 = arctan 7−6 = 130.6°, ʹ θ 2 = arctan 7

−5 = 125.54°, ʹ φ c = 90°

ʹ θ 1 + ʹ θ 2 + ʹ θ c − ʹ φ c = q180°, (q = 1, 3,5,...)⇒ ʹ θ c = 13.86°

ʹ p c = −7 − 7tan ʹ θ c

= −35.37

K =7 2 + (7 −1)2 7 2 + (7 − 2)2 7 2 + (35.37 − 7)2

7 2 + 02= 331.7 ⇒ K p =

K2

= 165.54

Σsi = Σpi ⇒ s3 − 7 + j7 − 7 − j7 = −35.37 − 2 −1⇒ s3 = −24.37

Page 15: ECSE-4760 Real-Time Applications in Control

15

meet the Dead Zone specification. Using a root locust plot for the system and z from equation (6) find the gain that meets the percent overshoot specified. Try other values for the feedback gain in the range and note the system’s response, commenting on the limitations of pure proportional feedback. After investigating pure proportional control, add in the tacho feedback for PD control and find a set of near-optimal gains for low overshoot and fast settling time. B. Phase Lead Compensation Using either method #1 or #2, design a phase lead compensator meeting all the specifications simultaneously. PART II – DIGITAL CONTROL TUSTIN APPROXIMATION Once an acceptable analog compensator has been found, its digital approximation can be derived by using the Tustin approximation, (an approximation of the differential by a difference equation). By substituting into the continuous compensator equation (4) a discrete transfer

function is obtained: (12)

Since the rest of the experiment will extensively use z-transforms, it is recommended that the student review the relevant material by reading [13] or his/her favorite book. Using an approach similar to that of PART I, a relation between the dead zone and the digital controller D(z) can be found: (13)

This relation will be used to calculate the third specification (velocity error constant). MINIMAL PROTOTYPE COMPENSATOR This part of the experiment deals with the design and implementation of a digital controller based on the minimal prototype method[14]. For a zero order hold D/A converter and a system with the transfer function: (14)

the corresponding z-transform (using z = esT) is given by:

Z Z

or

s =2( z −1)T ( z +1)

D( z) = A z +cz + d

Dead Zone (degrees) =0.70D(1)

G(s) =Kv

s(τ ms +1)

G0(s)G(s){ } = 1− z−1( )G(z) = 1− z−1( )

G(s)s

⎧ ⎨ ⎩

⎫ ⎬ ⎭

= (1− z−1)Z Kv

s2(τms+1)⎧ ⎨ ⎩

⎫ ⎬ ⎭

= (1− z−1)Z Kv1s2−τms

+τm

(s+ 1τm)

⎝ ⎜ ⎜

⎠ ⎟ ⎟

⎧ ⎨ ⎪

⎩ ⎪

⎫ ⎬ ⎪

⎭ ⎪

G(z) = Z Kv1s2 −

τms

+τm

(s+ 1τm

)

⎝ ⎜ ⎜

⎠ ⎟ ⎟

⎧ ⎨ ⎪

⎩ ⎪

⎫ ⎬ ⎪

⎭ ⎪ = Kv 1− z−1( ) Tz−1

(1− z−1)2 −τm

1− z−1 +τm

1− z−1e−T /τm

⎣ ⎢

⎦ ⎥ = Kv 1− z−1( ) Tz−1

(1− z−1)2 −τm 1− e−T /τm( )z−1

1− z−1( ) 1− z−1e−T /τm( )⎡

⎣ ⎢ ⎢

⎦ ⎥ ⎥

Page 16: ECSE-4760 Real-Time Applications in Control

16

Simplifying the above expression,

And finally:

For a minimal prototype response to a step input, we want the overall transfer function K(z) to be selected such that . Therefore The digital compensator D(z) is related to G(z) by the relation:

Substitution of K(z) and G(z) gives:

This controller has the same general form as equation (12) in the discrete approximation. Thus exactly the same procedure is used for this part of the experiment as in the Tustin approximation. RIPPLE FREE COMPENSATOR The last part of the experiment is to design and run a digital controller based on the ripple free (also called Finite Settling Time) design method[15]. This derivation is based on the z-transform method. A derivation in the time domain may be found in [14]. From the minimal prototype part it is known that the z-transform of the motor response with zero order hold is:

where for clarity:

Let c equal the zero of G(z), i.e.,

(15)

For ripple free response, there are two requirements. The first requirement is the error sequence e2(k) be of finite length, so that K(z) must contain all the zeros of G(z). If the system is to reach steady state within 2 sample periods, the following equation must hold:

(16)

G(z) = KvT

(z −1)−τm 1− e

−T /τm( )z − e−T /τm( )

⎣ ⎢ ⎢

⎦ ⎥ ⎥

= 3.986 T(z −1)

−0.4839 1− e−2.0664T( )

z − e−2.0664T( )⎡

⎣ ⎢ ⎢

⎦ ⎥ ⎥

G(z) = 3.986 T − 0.4839 1− e−2.0664T( )[ ]z − Te

−2.0664T − 0.4839(1− e−2.0664T )T − 0.4839(1− e−2.0664T )(z −1)(z − e−2.0664T )

1−K( z) = 1− z −1( )

K( z) = z −1

D( z) =K( z)

G( z)[1−K( z)]

D(z) =1

(z −1)G(z)=

13.986 T − 0.4839 1− e−2.0664T( )[ ]

×z − e−2.0664T

z −Te−2.0664T − 0.4839 1− e−2.0664T( )

T − 0.4839 1− e−2.0664T( )

G( z) = Kv T −τ m(1−E )[ ]z −

TE −τ m(1−E )T −τ m(1−E )

( z −1)( z −E )

E = e−2.0664T = e−T /τm

c =TE −τ m(1−E )T −τ m(1−E )

K( z) = 1−cz −1( ) a0 +a1 z −1( )

Page 17: ECSE-4760 Real-Time Applications in Control

17

where a0 and a1 must be determined. The second requirement for Ripple Free response is that the system be able to follow a step input with zero steady state error. This gives the second relation:

(17) To determine a0, a1, and b0 substitute (16) into (17):

and applying coefficient matching:

(18)

As previously derived, the compensator transfer function is:

Substituting equations (16), (17) and (18) in the transfer function above we get:

which reduces to:

Substituting for c from (15) and further reducing:

gives

Again this controller has the same general form as equation (12) in the discrete approximation. Thus exactly the same procedure is used for this part of the experiment as in the Tustin approximation. EXPERIMENTAL PROCEDURE Follow the setup under the HARDWARE-SOFTWARE SETUP section for feedback control. The hardware implementation is exactly the same as in the continuous feedback part (Figures 7 and 8), yet now the controller will be implemented on the PC. To setup and execute the program, follow the instructions under DIGITAL COMPUTER USAGE. The data input menu consists of the sampling period T, the proportional gain offset A, the discrete compensator zero c and pole d. NOTE: the LabVIEW digital controller works very well with the 33-125 op-amp set for unity gain (100k feedback

1−K( z) = 1− z −1( ) 1+ b0 z −1( )

1− 1−cz −1( ) a0 +a1 z −1( ) = 1− z −1( ) 1+ b0 z −1( )

a0 = 0

a1 =1

1−c

b0 =−c

1−c

D( z) =K( z)

G( z)[1−K( z)]

D( z) =

1−cz −1( ) 11−c

z −1⎛

⎝ ⎜

⎠ ⎟

Kv T −τ m(1−E )[ ] z −c( z −1)( z −E )

1− z −1( ) 1− 11−c

z −1⎛

⎝ ⎜

⎠ ⎟

D( z) =

11−c

( z −E )

Kv [T −τ m(1−E )] z − c1−c

⎝ ⎜

⎠ ⎟

D( z) =1

KvT (1−E )×

z −E

z +τ m

T−

E1−E

⎝ ⎜

⎠ ⎟

D(z) =1

3.986T(1− e−2.0664T )×

z − e−2.0664T

z +0.4839T

−e−2.0664T

1− e−2.0664T⎛

⎝ ⎜

⎠ ⎟

Page 18: ECSE-4760 Real-Time Applications in Control

18

resistor). Make sure the wiring is consistent with your controller gain value calculations. If the 5x gain is used the overall compensator gain must take it into consideration. A. Tustin Approximation Compensation Calculate the Tustin approximation coefficients A, c, and d. By choosing an appropriate sampling period, you should find a digital approximation that will satisfactory control the motor's position. It is suggested that you begin with a sampling time of about 100 ms and decrease it by steps of approximately 20 ms down to 5 ms. The step input may be applied using the S1 switch as before. Watch the oscilloscope traces to note their position when the step is applied (apply the step when the traces cross a line on the screen). B. Ripple Free Compensation Using the Ripple Free coefficients, it is recommended that appropriate sampling times for this controller range from 1.0 to .01 seconds. Again, record the motor's response by using an oscilloscope on the input signal on one channel and another channel on the motor position output. C. Minimal Prototype Compensation Using the Minimal Prototype coefficients, try to find the useful range of T for this controller. What happens for large values of T (> 2 s)? Include saved oscilloscope screen shots and compare the response with that of the minimal prototype case for a given T. WRITE-UP The write-up is one of the most important items when an experiment is performed. It is intended that a part of the write-up be done during the lab session. Results of all three parts of the experiment must be submitted in a formal write-up. The following are minimum requirements to be included in the report: 1) Detailed description of the design of the analog compensator and the derivations of the

approximation and the discrete compensators, with analytical calculations and explanations of the assumptions made.

2) Digital oscilloscope printouts of all runs, with appropriate scales and labels (set of coefficients used) with short comments/explanations for each run.

3) Observations regarding the rising time, percent overshoot, settling time, steady state error, dead zone, and even backlash and quantizing error must be noted for each run.

4) Comparisons of the various runs among different controllers using the same sampling period, and among different periods for the same controller.

5) Answer to all questions raised in the handout. 6) A table summarizing the pros and cons of each controller along with its characteristics. This table

should serve as a guide for a "design engineer", so that using his own set of requirements he would be able to select the proper controller.

NOTE: For practical discrete models of the analog motor system with sampling periods on the order of hundreds of milliseconds, a significant delay of a few tenths of a second between when the input step function is applied and when the digital controller first responds to it will impact the perceived settling time of the implemented controller. It is appropriate to start at the leading edge of the first controller output pulse after the step was applied to measure the system’s settling time.

Page 19: ECSE-4760 Real-Time Applications in Control

19

REFERENCES In addition to context specific references listed below with their relevant numbers on the left, the first two entries contain general information pertaining to the broader area this experiment covers. Melsa, Shultz, Linear Control Systems, McGraw Hill, 1969. Shinners S.M., Modern Control System Theory and Application, Addison Wesley, 1972. [1] Dorf, R. C., Modern control Systems, A. Wesley 1980, pp. 119-122. [2] Cosgriff, R. L., Nonlinear Control Systems, Sections 6.8 and 5.4. [3] Frederick, D. K. and Carlson, A. B., Linear Systems in Communication and Control, J.

Wiley & Sons, 1971, pp. 364-366. [4] Dorf, R. C., Modern control Systems, A. Wesley 1980, p. 118. [5] Frederick, D. K. and Carlson, A. B., Linear Systems in Communication and Control, J.

Wiley & Sons, 1971, pp. 357-369. [6] Dorf, R. C., Modern control Systems, A. Wesley 1980, pp. 112-115. [7] Dorf, R. C., Modern control Systems, A. Wesley 1980, pp. 357-394. [8] Dorf, R. C., Modern control Systems, A. Wesley 1980, pp. 116-119. [9] Dorf, R. C., Modern control Systems, A. Wesley 1980, pp. 372-279. [10] Kailath, T., Linear Systems, Prentice Hall, 1980, pp. 31-35. [11] Frederick, D. K. and Carlson, A. B., Linear Systems in Communication and Control, J.

Wiley & Sons, 1971, pp. 83-84. [12] Frederick, D. K. and Carlson, A. B., Linear Systems in Communication and Control, J.

Wiley & Sons, 1971, pp. 382-383. [13] Cadzow, J. A., and Martens, H. R., Discrete-Time and Computer Control Systems,

Prentice Hall, 1970, Chapter 3. [14] Cadzow, J. A., and Martens, H. R., Discrete-Time and Computer Control Systems,

Prentice Hall, 1970, Chapter 7 and 9. [15] Ragazzini, J. R., and Franklin, G. F., Sampled Data Control Systems, McGraw Hill, 1958,

Chapter 7.

Page 20: ECSE-4760 Real-Time Applications in Control

20

APPENDIX A – ANALOG COMPUTER WIRING DIAGRAM & 33-033 FIGURES

FIGURE 11. Comdyna GP-6 phase lead controller patch panel wiring.

FIGURE 12. Phase lead controller GP-6 device-annotated block diagram.

8

PD CONTROLLER

Although not always available on every plant to be controlled, the 33-033 system does provide a

velocity output that can be used to implement a derivative term in the feedback controller. Simply

adding the dashed connections in Figure 2 sets up a PD controller. Optimize the response of the

proportional controller by adding in the derivative damping term to achieve the required original

specifications. After adjust both the overall gain and the derivative (tacho) gain for the best response,

save the input & output response plots and determine the values of the attenuators.

DYNAMIC FEEDBACK CONTROLLER

Since pure proportional feedback cannot produce a closed loop system meeting the specified

requirements, a lead compensator (called phase lead because a < b) as in equation (4) is required to

relocate the roots of the closed loop characteristic equation of the system. The task is to determine

the proper variables a, b, and β to satisfy the given criteria. Note that the relation between the dead

zone and the error velocity constant still holds.

Gc(s) = β

(s+ a)

(s+ b) (4)

The analog computer simulation diagram of the compensator is shown in Figure 6. For more

accurate control, it is important to note that the gain of the operational amplifiers are nominally -1

or -10 but may off by a few percent and the offsets for the power amp must be zeroed manually. This

will have an effect on gain calculations for all controllers, both analog and digital, that use the op

amps. It is worthwhile to devise a quick experiment with an oscilloscope and function generator to

measure the actual gain and zero the offset. Also remember the nominal gain of -10 must be

considered when calculating the gain A for the digital controllers.

Since we're dealing with a second order process and a first order compensator, the resulting

closed loop transfer function will be of third order. The overshoot and settling time specifications on

the other hand, are defined for a second order process, hence a typical strategy is to choose the real

closed loop transfer function pole so far away in the Left Hand plane, that the remaining (complex

conjugate poles) will behave as dominant ones giving a response similar to the regular second order

processes.

FIGURE 6. Analog computer simulation of the compensator.

A general second order process[6] is described by its natural frequency ωn, and the damping

Page 21: ECSE-4760 Real-Time Applications in Control

21

FIGURE 13. Feedback Instruments Ltd. 33-100 Mechanical Unit.

FIGURE 14. Feedback Instruments Ltd. 33-125 Servo Fundamentals.

Page 22: ECSE-4760 Real-Time Applications in Control

22

APPENDIX B – Feedback Instruments LTD. 33-033 Reference Manual Make sure the Reference Manual for the 33-033 DC Motor system has been downloaded from the class web site (http:/www.rpi.edu/dept/ecse/rta/) and has been read in preparation for this experiment.