Anda di halaman 1dari 16


Session 5 Servo Position Control Design Proje t !Position "n# R"te $ee#%" &s'
P(r)ose Position control systems are used extensively in industrial applications such as robotics and drive control. Modern position control systems are achieved using incremental encoder sensors. In this project you design and implement a position control system for low frequency square wave input. The objectives of this project are: To obtain the servo plant model To design a position control system such that the output angle trac s a commanded position using position and velocity feedbac and determine the feedbac gains to achieve the given time!domain specifications. "uild the compensated servo plant in #IM$%I&' and simulate offline to obtain the response to a square wave input and verify the design. "uild the (in)on application* implement and test the system on the real!time hardware


*ntro#( tion The position control system is a system that converts a position input command to a position output response. - schematic layout of the servomotor is shown in .igure +., La Ra .ixed field 6 vi /t 0 ! i /t 0 em /t 0 M

m /t 0
N m2ear

J m 'g!m
K m 5!s4rad = K &!m4-

Bm &!m s4rad

1utput angle o /t 0

J L 'g!m 3

N L 2ear BL &!m s4rad

$ig(re 5+1 #ervo plant schematic The first step in the design of a control system is the mathematical modeling of the physical system as follows 1+ Servo )l"nt Mo#eling The system parameters are as follows: -rmature resistance* Ra = 3.7 -rmature inductance* La = 8.,9 m: /neglected0 Motor voltage constant* K m = 8.88;7; 5!s4rad Motor torque constant* K = 8.88;7; &!m4; 3 -rmature inertia* J m = <.9; ,8 'g m ; 3 Tachometer inertia* J tach = 8.; ,8 'g m NL = ,= %ow gear ratio* K g = Nm 7 3 2ear inertia* J ;3 = +.==<+ ,8 'g m !7 3 %oad inertia* J L = </ J ;3 0 = ,7.<<< ,8 'g m -rmature frictional coefficient* Bm %oad frictional coefficient* BL 3 < >quivalent friction referred to the secondary gear Beq = K g Bm + BL ; , ,8 &m4/rad4s0 Motor efficiency due to rotational loss mr ; 8.9;


2earbox efficiency* gb ; 8.9+ .rom the s!domain motor electrical circuit shown in .igure +.3* we have La s R

6 Vi / s 0 !

I a /s0 Em / s0 M

m /s0

Tm / s 0

K &!m4= K m 5!s4rad /+.,0

$ig(re 5+, The s!domain motor electric circuit Ia = , [ Vi /s0 Em /s0] Ra + La s

.or a separately excited dc motor with constant field current or a permanent magnet dc motor* the armature produces a torque* which is proportional to the armature current* i.e.* K ia /t 0 . The gearbox efficiency as well as motor efficiency due to rotational loss would affect the output torque. The gearbox efficiency is not constant* an average value of gb = 8.9+ is assumed. Tm ( t ) = K ia ( t ) (here = mr gb = /8.9;0/8.9+0 = 8.;<?+ and K is the motor torque constant in &!m4-* which is numerically equal to K m . Thus* in s!domain we have Tm ( s ) = K m I a ( s ) /+.30

The motor emf is proportional to the angular velocity and the field current. (ith constant field* the motor emf is given by em /t 0 = K m m ( t ) or in s!domain Em / s 0 = K m m ( s ) /+.<0 .igure +.< shows the s!domain electric circuit analogy for the mechanical portion. N / J m + J tach 0 s BL JLs Bm Kg = , N3 6 o / s0 m / s0 Tm / s0 T, / s0 TL / s 0 ! $ig(re 5+3 The s!domain electric circuit analogy for the mechanical part. .igure +.= shows the circuit analogy with armature frictional coefficient and inertia referred to the secondary gear and combined with the load friction and inertia.


3 3 Beq = K g Bm + BL J eq s = ( K g / J m + J tach 0 + J L ) s

m /s0 Tm / s 0 !

o /s0

TL / s0

TL / s 0 m / s 0 N l = = = Kg Tm / s0 L / s0 N m $ig(re 5+- Motor frictional coefficient and inertia referred to the load side. .rom .igure +.= we have , o / s0 = TL / s0 Beq + J eq s m / s0 = Kg o / s0 The s!domain output angle is , o = o / s0 s ,+ Pre-l"%or"tor. Assign/ent .rom equations /+.,0!/+.70 draw a detail bloc diagram representation for the above servo system with Vi / s0 as input and o / s 0 as output showing all the variables I a / s0* Tm / s 0* TL / s 0* o / s 0 * and o / s 0 . %abel as $ig(re 5+5 #ervo plant bloc diagram La is small compared to the mechanical time constant. Ra Thus* neglect the armature inductance* obtain the closed loop transfer function and show that Km K g -rmature circuit time constant a = o / s0 = Vi / s0 Ra J eq Beq
3 3 Km Kg s+ + J eq Ra J eq o / s0 a = m Vi / s0 s + bm

/+.=0 /+.+0



3 3 Km Kg Ra J eq

(here am =

Km K g * Ra J eq

bm =

Beq J eq


1r the servo plant transfer function with the output as position o / s 0 is 1r


o /s0 am = /+.,80 Vi / s0 s / s + bm 0 3 3 ; 7 + 3 (here J eq = K g / J m + J tach 0 + J L = /,=0 /<.9; + 8.;80 ,8 + ,7.<< ,8 = ,8.+? ,8 'g m
#ubstitute for the parameters* evaluate am * and bm * and find the servo plant transfer function in terms of the numerical values. o /s0 = Vi / s0 Vi am s + bm o / s 0 , s

o / s0

$ig(re 5+0 #ervomotor transfer function model The s!domain unit step response is

o /s0 =

am , s ( s + bm ) s

o /t 0 = lim s o / s0 = . That is* the response is unbounded. The final value of the response is lim t s8
,+1 Position ontrol 1it2 )osition "n# r"te 3ee#%" & In order to control the output position to follow an input command* consider the addition of a position feedbac and a rate feedbac given by Vi / s 0 = K P @ i / s0 o / s 0A K D o / s 0 /+.,,0 as shown in .igure +.;. The purpose of this system is to have the output angle o /t 0 follow the input angle i /t 0 .

i / s0


Vi / s 0

am s + bm KD

o / s 0

, s

o / s0

$ig(re 5+7 Position )ontrol using position and rate feedbac . -pplying MasonBs gain formula and show that the overall transfer function is

o /s0 K P am = 3 i / s0 s + ( K D am + bm ) s + K P am #ubstitute for am * and bm .



,+, Position ontrol #esign %et i /t 0 be a square wave of amplitude 38o and a frequency of , :C. Design a control system and determine the gains K P and K D such that the following time!domain specifications are met: #tep response damping ratio of = 8.;8; Pea time of t p = 8.8+ second. The second!order response pea time t p * is given by

n , 3 and the theoretical pea value of the step response is , 3 i /-mplitude0 M pt = , + e .or = 8.;8; * we find n .

tp =



The servo motor transfer function has the same form as the standard second!order transfer function 3 o /s0 n = 3 /+.,+0 3 i / s0 s + 3 n s + n )omparing the plant characteristic equation given in /+.?0 with the standard second!order characteristic equation in /+.,+0* find two equations for K P and K D in terms of am * bm * * and n . #ubstitute for the parameters and obtain the values of K P * and K D for the above design specifications. ,+3 Digit"l Si/(l"tion )onstruct a #IM$%I&' diagram similar to the one shown in .igure +.9 and save it /say %ab+E#im.mdl0. $se a signal generator with amplitude 38 degrees and frequency , :C. Feplace am* bm * KP and KD with their values. -lternatively* you can place all equations in a script m! file to compute am* bm* KP* and KD which is sent to the M-T%-" (or space and then simulate the #imulin diagram. .rom the #imulin 4#imulation Parameters select the #olver page and for #olver option Type select .ixed!step and ode= /Funge!'utta0 and set the fixed step siCe to 8.88,. -ctually a 5ariable!step selection with auto or a smaller Max step siCe would produce more accurate results* but because in the implementation diagram we are using a uniform sampling rate of 8.88, second* we use the same fixed!step siCe of 8.88, second for integration.


ThetaEiEs 38 Degrees ,:C #quare pi4,98 #ignal 2enerator Deg!Fad #ervo Plant Transfer .cn


am s + bm 'EDEs
'D Fate .eedbac Position .eedbac


ThetaEoEs Integrator Fad!Deg

, s



$ig(re 5+4 #imulin diagram for the servo plant position control. #imulate and use GplotscopeB function to capture the scope plot and produce a .igure plot. To do this* type )lots o)e at the M-T%-" prompt* then clic on the #cope .igure /outside the plot area0 and hit return you will have a .igure print. Hou can add label and legend commands or edit the graph* label as .igure +.?. )hec to see if the response meets the design requirements within the simulation numerical integration accuracy. -ll the pre!lab calculations* design and simulation must be completed prior to the laboratory session. The plants transfer function and the controller values must be chec ed and verified by your instructor. -lso complete the implementation diagram as outlined in section <., and <.3. 3+ L"%or"tor. Pro e#(re (hen you have finished testing your model in #IM$%I&'* it has to be prepared for implementation on the real!time hardware. This means the plant model has to be replaced by the I41 components that form the interfaces to the real plant. 3+1 Cre"ting t2e S(%s.ste/ Blo & 3or t2e *nter3" e to SR56, The encoder is used to provide the digital phase information. This signal can also be differentiated to produce a velocity signal. This can be achieved using a low!pass band!limited differentiator. The suitable transfer function used is interface is created. .rom the #imulin %ibrary "rowser window .ile menu open a new model. Place an analog input from the Iuanser MultiI< library on this new window. The tachometer gain is ,.+ 5 per ,888 FPM. 2et a gain bloc to convert volt to FPM* and another gain bloc to convert FPM to rad4s* one gain bloc for the gear ratio. - low pass filter may also be utiliCed to bloc the high frequency noise. The tacho input is connected to analog input 3. Double!clic on the Tacho input bloc to open its dialog box and set the )hannel $se to 3. )onnect the bloc s as shown in .igure +.,8. &ow get the part >ncoder InputJ place it on the lower portion of the page. Double!clic on the >ncoder input bloc to open its dialog box and set the )hannel $se to 8. #ince the encoder has =8?7 signal periods per revolution* get a gain bloc and set its value to 3 K pi 4 =8?7 . - negative sign is used for the encoder gain* because the negative feedbac gain is already implemented in the encoder wiring /i.e. positive voltage LM negative counts0 and in the #imulin model we have used a negative feedbac loop. -cquire the remaining bloc s and
3+8s . .irst the tachometer and encoder s + 3+8


complete the diagram and label all the bloc s properly as shown in .igure +.,8. - subsystem model can be created that can be used in other applications.

Iuanser )onsulting MI< -D) #F583 Tach Input

,8884,.+ FPM45

3Kpi478 FPM to @rd4sA

,4,= ,42ear ratio

3+8 s + 3+8
%ow!pass filter

3+8s s + 3+8
Differentiator Iuanser )onsulting MI< >&) #F583 >ncoder Input !3Kpi4=8?7 Fad4count

$ig(re 5+16 Interfaces to the #F583 .eedbac #ignals. To create a subsystem* enclose the bloc s within a bounding box as shown in .igure +.,8 /Do not place any outport bloc s0. )hoose Cre"te S(%s.ste/ from the E#it /en(. #imulin replaces the selected bloc s with a subsystem bloc as shown in .igure +.,,
1ut , 1ut 3 #ubsystem

$ig(re 5+11 #ubsystem bloc for the interface to the #F583 Double!clic to open the subsystem bloc . &otice that the #imulin automatically adds two 1utport bloc s 1ut , and 1ut 3. (e need to add another port for position. .rom the #in %ibrary get an 1utport bloc and connect it to the output of the Fad4)ount gain bloc . Hou now have the 1ut < port. %abel the 1utports appropriately. Fename the title subsystem to >ncoder N Tach input* and save it as >ncoderEtach.mdl. Hou now have the following subsystem as shown in .igure +.,3.


Iuanser )onsulting MI< -D) #F583 Tach Input

,8884,.+ 5 to FPM

3Kpi478 FPM to @rd4sA

,4,= ,42ear ratio

3+8 s + 3+8
%ow!pass filter

, 5el @rd4sA* Tacho

3+8s s + 3+8
Differentiator Iuanser )onsulting MI< >&) #F583 >ncoder Input !3Kpi4=8?7 )ount to rad

3 d/Pos04dt @rd4sA* >ncoder < Pos @rdA

5el @rd4sA*Tacho d/Pos04dt @rd4sA* >ncoder Pos @rdA* >ncoder >ncoder N Tacho input

$ig(re 5+1, Interfaces to the #F583 .eedbac #ignals. 3+, Cre"ting t2e */)le/ent"tion /o#el The implementation model can be added on the previously constructed #IM$%I&' model. This would enable you to obtain the simulation and actual results simultaneously. 1pen %ab+E#im.mdl /your simulation model0* save it under a new name /say %ab+EImp.mdl0. Femove the M$O bloc . #tart constructing the implementation diagram below the simulation diagram. )opy the >ncoderEtach.mdl /constructed in part <.,0 to the clipboard and paste it on your implementation model as shown in .igure +.,<. 2et the -nalog 1utput bloc from the Iuanser MultiI< library and set the )hannel $se to 8. $se a #ignal 2enerator with -mplitude 38 degrees* and .requency , :C* and use a gain bloc to convert to radians. -dd the position and velocity feedbac gains to the signal coming from the Motor >ncoder complete the feedbac loops and connect the resulting signal to the Iuanser -nalog output. Place as many #copes as you li e to monitor the phase angle* velocity etc. Hour completed model should be the same as shown in .igure +.,<. #et the gains 'P and 'D to the values found in part /3.30* or run the m!file that returns the values of 'P and 'D. The gains in #imulin #imulation diagram are renamed to 'P, and 'P,* so that if the value of the variables 'P and 'D are changed at the M-T%-" prompt for fine tuning* the values in the #imulation diagram are not changed.


38 Degrees ,:C #quare pi4,98 #ignal 2enerator Deg!Fad

#ervo Plant Transfer .cn



am s + bm 'EDEs

, s

,984pi Fad!Deg thetaEoEs

Fate .eedbac

Position .eedbac #imulin #imulation Diagram for Position )ontrol

38 Degrees , :C pi4,98 Deg to Fad

'P 'EP

,4+ )able +

Iuanser )onsulting MI< D-) -nalog 1utput 5el rd4s

thetaEi 5el rd4s >nc 5el @rd4s A Tach

'ED 'D

Fate .eedbac

d/pos04dt @rd4sA* 5el />ncoder0

Position .eedbac
,984pi Fad to Deg thetaEo

Pos @rdA

>ncoder and Tacho input

#imulin Implementation Diagram for Position )ontrol

$ig(re 5+13 #imulation and Implementation diagram for position control. 3+3 7iring #i"gr"/ $sing the set of leads* universal power module /$PM0* #F5!83 D)!motor* and the connecting board of the MultiI< data acquisition board* complete the wiring diagram shown in .igure +.,= as follows: $ro/ >ncoder on #F583 Motor on #F583 D4- P8 on MultiI -4D P 8* ,* 3* <* on MultiI To MultiI4>ncoder 8 $PM4To %oad $PM Q .rom D4$PM! T1 -4D C"%le + pin Din to + pin Din 7 pin Din to = pin Din* 8"in 5 C"%le F)- to + Pin Din + pin Din to =xF)-


$PM #F513! Motor >ncoder .rom D4-.rom D4-

-nalog 1utput P8 D4T1 -4D

MultiI < 3,8 " F ( H

-nalog input -4D


To %oad )able + >ncoder P8

$ig(re 5+1- (iring diagram for servo motor position control system. "efore proceeding to the next part request the instructor to chec your electrical connections and the implementation diagram. 3+- Co/)iling t2e /o#el In order to run the implementation model in real!time* you must first build the code for it. Turn on the $PM. #tart (in)on* )lic on the M-T%-" icon in (in)on server. This launches M-T%-". In the )ommand menu set the )urrent Directory to the path where your model %ab+EImp.mdl is. "efore building the model* you must set the simulation parameters. Pull down the #imulation dialog box and select Parameters. #et the #tart time to 8* the #top time to +* for #olver 1ption use .ixed!step and ode= /Funge!'utta0 method set the .ixed #tep siCe* i.e.* the sampling rate to 8.88, as shown in .igure +.,+. In the #imulation drop down menu set the model to E9tern"l. Ma e sure all the controller gains are set. #tart the (in)on Server on your laptop and then use Client Conne t* in the dialog box type the proper )lient wor station IP address. 2enerate the real!time code corresponding to your diagram by selecting the RB(il#S option of the 7inCon menu from the #imulin window. The M-T%-" window displays the progress of the code generation tas . (ait until the compilation is complete. The following message then appears: R### !"ccess#"l completion o# Real$Time %or&shop b"il's proce'"re #or mo'el( Lab)*ImpS.


$ig(re 5+15 #imulation Parameters 3+5 R(nning t2e o#e .ollowing the code generation* (in)on #erver and (in)on )lient are automatically started. The generated code is automatically downloaded to the )lient and the system is ready to run. To start the controller to run in real!time* clic on the St"rt icon from the (in)on #erver window shown in .igure +.,7. It will turn red and display #T1P. )lic ing on the Sto) icon will stop the real!time code and return to the green button.

$ig(re 5+10 (in)on #erver If you hear a whining or buCCing in the motor you are feeding high frequency noise to the motor or motor is subjected to excessive voltage* immediately stop the motor. -s the instructor to chec the implementation diagram and the compensator gains before proceeding again. If you have access to the host P) you can maximiCe the (in)on )lient icon to show a window similar to the one pictured in .igure +.,;. The (in)on )lient is the real!time component of the software and it runs at the period /i.e. sampling rate0 specified under 7inCon:O)tions;:Solver:$i9e# ste) si<e from the #imulin window menu* as illustrated in .igure +.,+. In this case* a sampling period of , ms was chosen.


$ig(re 5+17 (in)on )lient Hou can also change the controller gains on the fly /i.e. while the controller is running in real! time0. To do so* double clic on the #imulin gain bloc * change to the desired new value* and select -pply* or 1'. &ote the changes in the real!time plots. 3+0 Plotting D"t" Hou can now plot in real!time any variables /e.g. angles* velocities0 of your diagram by clic ing on the RPlot=Ne1=S o)eS button in the (in)on #erver window and selecting the variable you wish to visualiCe. #elect RThetaEoS and clic 1'. This opens one real!time plot. To plot more variables in that same window* clic on R$ile:5"ri"%les;S from the #cope window menu. The names of all bloc s in the #imulin model diagram appear in a Multiple #elect 5ariable Tree. Hou can then select the variable/s0 you want to plot. In this case* select* for example* RThetaEiS and RThetaEoEs. In the #cope pull!down menu* using .reeCe you can freeCe the plot* and $pdate4"uffer can be used to change the final time to display fewer cycles. .rom the .ile menu you can #ave and Print the graph. )hoose #ave -s M!.ile* and save the plot as M!file /say .igure+E,9.m0. &ow at the M-T%-" prompt type the file name to obtain the M-T%-" .igure plot. Hou can type RgridS to place a grid on the graph or edit the .igure as you wish. Toom in to obtain a better comparison between the simulated response and the actual response. If you are sufficiently happy with your results and the actual response is close to the simulated response* you can move on and begin the report for this project. Femember there is no such a thing as a perfect model* and your calculated parameters were based on the plant model. control design usually involve some form of fine!tuning* and will more than li ely be an iterative process. If the actual response deviates from the desired response by large values you can fine tune K P and K D /only in the implementation model0 around the calculated value to get a response to meet the design specifications more closely.

$se .ile #ave* this saves the compiled controller including all plots as a +1) /(in)on project0 file. In case you want to run the experiment again* from (in)on #erver use .ile41pen to reload this +1 ) file* and run the project in real time independent of M-T%-"4#imulin . To prevent excessive wear to the motor and gearbox run the experiment for a short time. -+ Proje t Re)ort Discuss the assumption and approximations made in the modeling the servomotor. Describe the effect of adding the velocity feedbac and describe your design. In the report show the closed! loop system bloc diagram and your analysis. )omment on your resultsJ how does experimental response compare to simulated responseU )alculate the pea value of the compensated closed! loop system from /+.,=0. Toom in and estimate the pea value and the pea time for the experimental response and compare with the specified values. Discuss the reason for any deviation in the actual transient response and the simulated response. (hat is the system type* and what is the theoretical steady!state errorU >stimate the actual steady!state error if any* and discuss the reason for the steady!state error. - brief discussion of frictional forces and the amplifier saturation is included in the -ppendix* which you may find helpful for preparing the discussion of results in your project report. -fter the completion of this lab you should be confident in tuning this type of controller to achieve a desired response. Do you feel this controller can meet any arbitrary system requirementsU >xplain.


A))en#i9 The essential requirement in a position control system is for a motor to rotate an output shaft to the same angle as an input shaft. In designing a servomechanism particular attention should be given to both static and transient behavior. The sampling rate in the data acquisition board is high enough that permits continuous system analysis and design techniques. The static characteristics are the steady!state error* repeatability* resolution and stiffness. Fepeatability is the range in which the servo will come to rest whenever a given input signal is repeated. Fesolution is the smallest discrete motion* which the servo can ma e. The steady!state error is primarily limited to the accuracy of the feedbac sensors. The open!loop plan transfer function as given by /+.,80 is a type , system and the theoretical steady!state error to a step input is Cero. :owever* the actual response will have a steady state error. This is due to the static friction. "ecause of the static friction the gears will not turn until a certain amount of torque has exceeded. This is nown as the deadband* and is defined* as the minimum voltage required for getting a system to respond. The #F583 servomotor has a motor deadband about 8.,volts. -ll of the static characteristics are improved with increased proportional gain. The frictional torque between the gearing mesh depends on many factors* and an accurate mathematical description of frictional torque is difficult. The angular rotation is influenced by three type of friction. These are viscous friction* static friction and )oulomb friction. 5iscous friction is function of velocity. In the mathematical model derived we assumed viscous friction* with equivalent frictional coefficient of Beq . #tatic friction represents a retarding torque that tends to prevent motion from beginning. )oulomb friction has amplitude that reverses with the reversal of the direction of velocity. The frictional torque is largely due to )oulomb and static rather than viscous friction and is nonlinear. The transient characteristics are relative stability* maximum overshoot and the speed of the response. - satisfactory transient response can be attained by specifying: the step response damping ratio* and a specification for the speed of the response such as rise time* time constant or pea time. -nother factor* which influences the transient response* is the amplifier saturation in the D4converter. The voltage applied to the motor is proportional to the error signal. .or a large step input the initial error signal e/t 0 is also very large* resulting in a very large instantaneous voltage given by K P e/t 0 . If the voltage is beyond the saturation limit of the amplifier* then the amplifier will not put out the expected voltage and the transient response will not be as expected and will result in larger overshoot. The step change in radians for the amplifier to operate in its linear Vsat range is given by 3 i < * where i is the square wave amplitude. The saturation for this KP + o amplifier starts at about + volts. If K P = 3; * 3 i * i.e.* 3 i = 8.,9+ rad or ,8.7 * or an 3; o amplitude of +.< . (hen the step change is larger a gain cable can be used. Iuanser supplies


gain L,* + cables for the amplifier. If a gain L + cable is used the step change can be as high as +<o without saturating the amplifier. The servomechanism can never be more accurate than its instrumentation. The gain feedbac s K P and K D are deigned based on the derived model. This should give a reasonably accurate result as a first pass. In the implementation diagram* these gains can be tuned to obtain the desired response. It must also be noted that the numerical integration set at fixed step siCe 8.88, and ode= /Fung e!'utta0 will produce error in the simulation response.