modeling and control of the rotary servo motor
TRANSCRIPT
Modeling and Control of
the Rotary Servo Motor
Department of Electrical Engineering
Sharif University of Technology, Tehran, Iran
Linear Control Systems Laboratory, Sharif University of Technology
1 Introduction
1.1 Overview
The rotary servo motor consists of a DC motor that is encased in a solid frame. The servo motor
is equipped with an optical encoder and a potentiometer to measure the output shaft position,
and a tachogenerator to measure the velocity of the motor. The present rotary servo platform
can also be utilized as a base unit for several add-on modules to perform a wide range of control
experiments.
The aim of this set of experiments is to familiarize with servo characteristics, obtain a reliable
model for the system, and to design output feedback controllers with desired closed-loop speci-
fications. The system can be configured to work with either position control or velocity control
feedback loops.
Electromechanical position control systems are the basis of most motion control systems used
in industry. The servo motor represents a simplified electromechanical system to demonstrate the
influence of damping, elasticity and friction.
The servo motor operates with a PC-based controller. The PC communicates with the sensors
and the motor using the data acquisition board and the power interface. The data acquisition
board is controlled by a real-time software which operates in the MATLAB/Simulink RTW/RTWT
environment. The installed QUARC software also adds powerful tools and capabilities to MAT-
LAB and Simulink to make the development and deployment of real-time control applications
easier. QUARC generates real-time code directly from Simulink-designed controllers and runs it
in real-time on the Windows target.
1.2 General Instructions
The students are required to (a) work through all laboratory exercises, (b) carry out the instruc-
tions indicated in italics, and (c) record the results indicated in underlined italic in the results
sheet provided. Where the instructions state plot and print a signal or function, that signal or
function should be plotted in MATLAB, labeled appropriately, printed on the lab printer, and
submitted with the results sheet.
Each group is required to submit a full set of prints and the results sheet. Extra credit will be
awarded to students who make a reasonable attempt at the further experiment sections.
2
Linear Control Systems Laboratory, Sharif University of Technology
Figure 1: Rotary servo motor.
2 Rotary Servo Plant
2.1 Arrangement
The rotary servo plant consists of a DC motor that is encased in a solid frame. This DC motor
drives the smaller pinion gear through an internal gear box. The pinion gear is fixed to a larger
middle gear that rotates on the load shaft. The servo is equipped with three sensors: potentiome-
ter, encoder, and tachogenerator. The potentiometer and encoder sensors measure the angular
position of the load gear and the tachogenerator can be used to measured its velocity. The tacho-
generator is connected directly to the DC motor and generates a voltage signal proportional to
the angular velocity. The setup is demonstrated in Figure 1.
Note: The servo motor incorporates a 3.23 W Faulhaber Coreless DC motor which is a high
efficiency, low inductance (Lm = 0.18 mH) motor. The motor’s rotor inertia and the gear
viscous damping equal to 3.9 × 10−7kg.m2 and 0.015 N.m/(rad/s), respectively, which
lead to a much faster response than a conventional DC motor.
2.2 Control Signal and Sensed Outputs
In this experiment, a linear voltage-controlled amplifier derives the DC motor. The control signal
u(t) must satisfy the saturation limits imposed by the amplifier and data acquisition board. As-
suming that the amplifier gain is set to 1, the control signal must satisfy |u(t)| ≤ 10 V . During
the experiments, you should make sure that the amplifier gain is set to 1. The sensed outputs are,
1. Angular velocity of the load shaft.
2. Angular position of the load shaft.
3
Linear Control Systems Laboratory, Sharif University of Technology
3 Calibration
The motor is equipped with a tachogenerantor directly attached to the DC motor. A tacho-
generator consists of an armature that is wrapped around with multiple loops of wire. When the
shaft of the tachogenerantor rotates, the wire wrappings pass through a magnetic field, typically
provided by a fixed permanent magnet, and this movement produces a voltage according to the
Faraday effect. The voltage produced is proportional to the angular velocity of the shaft.
The servo motor also has a 1024 incremental encoder installed that measures the relative
angular position of the load shaft.
1. • Make sure that the encoder is directly connected to the data-acquisition board. Open the
Simulink file Servo openloop.mdl. Familiarize yourself with the servo motor and how
it relates to the Simulink file.
• Start by running the MATLAB script setup lab servo for initialization.
• Build the model by pressing CTRL+B. In the External Mode Control Panel click on
Connect. Click on Start Real-Time Code to start the real-time execution. Use the disk
attached to the shaft and perform up to three measurements to check if the measured
angles of DC motor shaft by the encoder are reported correctly. Inform the lab assistant
if the encoder is not working properly.
2. Record the encoder output and the load shaft angle for three measurements. Try to rotate
the shaft both clockwise and counter-clockwise.
3. Find the encoder calibration gain block and record the encoder resolution, (counts/rev).
Note: The counters on this data acquisition board measure in quadrature, i.e., they measure
a total of four times the number of encoder lines per rotation.
4. The set is equipped with a tachogenerator. Make sure that the analog sensor signal goes
through the amplifier before going to the data-acquisition device. Apply 0.5 V , 1.0 V , 2.0 V
and 3.0 V input signals in Servo openloop.mdl (both polarities). For each test, wait until
the servo reaches its steady-state. Measure the angular velocity in rev/minute and read the
tachogenerator voltage from Servo openloop.mdl. (When applying 2.0 V to the motor, the
tacho should be measuring a value of approximately 3.0 V .) Record the set of tachogenerator
voltages and the measured angular velocities.
Note: The internal brushes of the tachogenerator create high-frequency noise as they run
along the commutator ring. A low-pass filter on the tachogenerator signal is needed
to provide a suitable signal for calibration, identification and feedback control.
4
Linear Control Systems Laboratory, Sharif University of Technology
5. Plot and print the tachogenerator voltage as a function of the measured shaft velocity (rad/s).
Use the plot to determine the tachogenerator calibration gain KT in V/(rad/s) using a linear
approximation. Change the calibration gain in Servo openloop.mdl if necessary.
Note: Following changes made to the Simulink model or scope parameters, the model should
be rebuilt (CTRL+B). Otherwise, Simulink will issue an error message that the model
checksum is invalid and the code must be rebuilt.
6. An ideal dead-zone nonlinearity of the DC motor is shown in Figure 2. The rotational sys-
tem exhibits this type of nonlinearity when the armature voltage is around zero. When the
signal applied to the armature of the driving DC motor goes through zero volts, the system
stays motionless for some time. This is a result of the fact that at very low voltages, the
torque generated by the DC motor is not sufficient to overcome friction. Such characteristic
forms a dead-zone nonlinearity in servo motor. The DC motor steady-state characteristics
Figure 2: Dead-zone nonlinearity.
to be investigated is the relationship between the applied input voltage and the steady-state
angular velocity of the shaft. To derive the steady-state characteristics of the loaded DC
motor, you should gradually increase the input signal applied to the system in small steps
and record the steady-state velocities.
7. Open the Simulink file Servo openloop.mdl. Generate a gradually increasing step signal
sequence with levels
[−3 − 2 − 1 − 0.5 − 0.2 − 0.15 − 0.10 − 0.05 − 0.01 0.01 0.05 0.10 0.15 0.2
0.5 1 2, 3]. Apply the input signal to the servo motor and observe the output response
(shaft velocity) on the scope. Record the associated steady-state values of the angular velocity.
Notice the dead-zone nonlinearity in the motor characteristic.
Note: To build the input signal sequence, you may use for example a slider gain block in
5
Linear Control Systems Laboratory, Sharif University of Technology
Simulink.
Note: In this experiment, the system response is important when the armature voltage is
around zero. Noisy output of tachogenerator cannot provide sufficient accuracy in
this setting. Instead, try to use the encoder in the Simulink file.
8. Plot and print the resultant steady-state characteristic.
Note: If the scope is not displaying traces, or the amount of data that can be displayed is not
sufficient, you need to configure the signal & triggering properties from Tools External
Model Control Panel, Signal and Triggering button. The “Duration” specifies the
number of points that are plotted. If the buffer is set to 10, 000 points and the
controller runs at a sampling rate of 1 KHz, then the scope will plot up to 10 seconds
of data. To view up to 20 seconds, the duration would have to be changed to 20, 000.
6
Linear Control Systems Laboratory, Sharif University of Technology
4 Mathematical Model of the Servo System
Let Rm, Lm and Km be the motor resistance, the motor inductance and the back-emf constant
as shown in Figure 3. Using Kirchoff’s Voltage Law, we can write,
Vm(t)−RmIm(t)− LmdImdt−Kmω(t) = 0. (1)
Moreover, recall Newton’s Second Law of Motion which can be written as,
Figure 3: DC motor armature circuit.
Jdω
dt= τt, (2)
where J is the moment of inertia of the body (about its center of mass) and τt is the sum of the
torques being applied to the body. For the case that the servo motor can be accurately modeled
without considering the major nonlinear effects by the friction and dead-zone, the mechanical
equation of the model can be described by,
Jdω
dt+ bω(t) = τ, (3)
where the torque at the load shaft, denoted by τ , can be written as τ = KgIm.
1. Use the derived electrical and mechanical equations of the servo motor to express the angular
velocity of the load in terms of the applied motor voltage.
2. Coulomb friction: It is well established that the Coulomb friction torque is a function of
the angular velocity. In systems operating at relatively high speeds, the Coulomb friction is
expressed as a signum function dependent on the rotational velocity,
Tf (ω) = αsgn(ω). (4)
The function sgn (the signum function) is defined as
sgn(ω) =
1 ω > 0
0 ω = 0
−1 ω < 0
(5)
7
Linear Control Systems Laboratory, Sharif University of Technology
This characteristic is sufficient for representing rotational systems that operate at relatively
high speeds but lacks accuracy when the operation is condensed around the zero speed. To
represent the transition from static to kinetic friction by an exponential term in velocity, a
more general model of this form, including Coulomb friction, is given by,
Tf (ω) = α1Sgn(ω) + α2e−α3|ω|. (6)
With the introduction of the nonlinear Coulomb friction and dead-zone friction, the system
model should be improved to represent the nonlinear system characteristics.
Determine the modified equations of system dynamics by including the velocity dependent
friction.
8
Linear Control Systems Laboratory, Sharif University of Technology
5 Time Domain Identification
A linear model of the servo motor can also be determined experimentally. The objective is to
experimentally observe how a system reacts to different inputs, determine a suitable model and
parameter values to obtain a reasonable fit. In this section the identification with step input will
be considered and in the next section, frequency response method will be considered.
1. Assume that (1) the motor inductance Lm is negligible, (2) the effects of Coulomb friction is
negligible and (3) the dead-zone is excluded from operational condition. Simplify the derived
block diagram in Section 4 and write down the resultant first order system.
2. Determine the steady-state gain and time constant of the model parametrically.
3. Generate a square wave with period 1 sec, offset of 0 and amplitude of 0.7. From the
response of the system, record the steady-state gain and the time constant for the high and
low values. Calculate the average of these two time constants. Set the time constant τ at a
given operating point as this average value.
Note: Note that the steady-state gain is computed as the steady-state change in the output
variable divided by the steady-state change in the manipulated variable. The time
constant is determined as the time it takes the step response to reach 63.2% of the
final steady-state value.
4. Generate a square wave with period of 1 sec, offset of 2.0 and amplitude of 0.7. From the
response of the system, record the steady-state gain and the time constant for the high and
low values. Calculate the average of these two time constants.
5. Let the first order system Gp(s) be defined by,
Gp(s) =K0
τ0s+ 1. (7)
• Determine Gp(s) based on the results for the case offset=2.0.
• Validate the derived model in a real-time experiment. Plot and print the responses of
the linear model and the servo on the same pair of axes by applying a small step change
from Vop = 2.0 in your Simulink model.
• Compare the results. Does the response of the linear model reasonably fit the measured
data? Explain the differences and revise your derived model if necessary.
• Determine the revised transfer function Gp(s).
9
Linear Control Systems Laboratory, Sharif University of Technology
6 Frequency Domain Identification
This experiment will help you understand the response of a first order model to sinusoidal input.
This would thereby enable you to predict the response of a first order system for any arbitrary
periodic input.
1. • Excite the system with sinusoidal inputs at an appropriate range of frequencies. Wait
for transients to die out. Collect the magnitude and phase measurements. You should
have both input (command) and output (response) sinusoidal signals on the scope. To
get a more accurate reading, you may need to rescale the horizontal axis of the graph
such that 2 to 3 cycles are shown on the graph.
• Record the excitation magnitude, excitation frequency, transfer function magnitude and
transfer function phase measurements.
Note: Set the “Offset” to a level for which the high and low rotations are in the same
direction, and nonzero. In this way you will avoid the effects of Coulomb friction.
Note: To choose appropriate range of frequencies, you may use the time constant of the
system from previous experiments.
Note: If you are using the tachogenerator, the voltage fluctuation may affect the results. In
this case, the signal amplitudes should be calculated by dividing the distance between
the maximum and the minimum values by 2. Moreover, the measurements can be
made directly from the scope or, preferably, calculated using a MATLAB script or
function.
2. Plot and print the bode diagram of the servo motor based on the experimental data.
Note: You may use semilogx(f ,20 log 10(mag)) and semilogx(f ,phase) where f , mag and
phase are the frequency vector, amplitude vector (in linear non-decibel range) and
phase vector, obtained from experimental data respectively.
3. The cut-off frequency, is defined as the frequency at which the gain is 3 dB less than the
maximum gain (i.e. the steady-state gain). When working in the linear non-decibel range,
the 3 dB frequency is defined as the frequency at which the gain is1√2
, or about 0.707, of
the maximum gain.
• Record the system bandwidth, steady-state gain, gain margin and phase margin based
on the obtained bode diagram.
10
Linear Control Systems Laboratory, Sharif University of Technology
• Determine the transfer function Gf (s) from frequency response data.
4. • Plot and print on the same pair of axes, the bode diagram of the experiment, and the
bode diagrams of the Gp(s) and Gf (s).
• Select the model (based on time domain or frequency domain identification) which more
accurately fits the physical system and denote it by Ga(s).
This transfer function will be used in output feedback controller design.
11
Linear Control Systems Laboratory, Sharif University of Technology
7 Controller Design
7.1 Position Control
The objective of this experiment is to develop a Proportional-Derivative (PD) controller for posi-
tion control of the servo load shaft according to a set of specifications. The time domain require-
ments for controlling the position of the servo motor are,
� Zero steady-state error,
� Settling time (with a 2% criterion) (Ts) ≤ 270ms,
� Overshoot (PO%) ≤ 5%.
The servo voltage-to-velocity transfer function is already derived and denoted by Ga(s). To find
the voltage-to-position transfer function, you can put an integrator
(1
s
)in series with the velocity
transfer function (effectively integrating the velocity output to get position).
When this second order system is placed in series with a proportional controller in the feedback
loop, the resulting closed-loop transfer function can be expressed as,
T (s) =ω2n
s2 + 2ξωns+ ω2n
(8)
where ωn is the natural frequency and ξ is the damping ratio.
In a second-order system, the amount of overshoot of the step response depends only on the
damping ratio parameter and it can be calculated using the equation,
PO% = 100e
−πξ√1− ξ2
. (9)
The peak time and the settling time depend on both the damping ratio and natural frequency of
the system and they can be derived as,
Tp =π
ωn√
1− ξ2, (10)
and,
Ts =4
ξωn, (11)
respectively.
1. Illustrate a control system block diagram including dynamics of the system, control loop,
reference signal, probable disturbance signal, control signal and output signal(s).
12
Linear Control Systems Laboratory, Sharif University of Technology
2. Proportional position Control: Let the feedback controller be a proportional gain Kp. Determine
the closed-loop transfer function in terms of Kp. Comment on whether a proportional con-
troller can simultaneously satisfy the three time domain specifications.
3. • Apply the proportional controller in a real-time closed-loop experiment. Set the reference
signal to a square wave with frequency of 0.4Hz.
• In this section we investigate proportional control only. Start by Kp = 0.05 and incre-
mentally increase the proportional gain until you start seeing a second order response.
• Record the experimental value of Kpc that results in a critically damped response.
• Compare the value of Kpc to its expected value calculated from the obtained transfer
function. How can you justify the difference?
• Record the experimental value of Kpsat where the control signal saturates.
• Explain whether or not the steady-state error is exactly zero in practice.
• Discuss the effects of changing Kp on the closed-loop step response.
• Plot and print the reference signal and the shaft position response, for Kp = Kpc and
Kp = 3Kpc on the same pair of axes.
4. Using the root locus, determine which types of compensation (lead, lag, P, I, PI, PD, PID)
are appropriate to satisfy the required time domain specifications.
5. PD Position Control: The PD controller has the following structure,
u(t) = kp(r(t)− y(t))− kdd
dty(t). (12)
where kp is the proportional control gain, kd is the velocity control gain,r(t) is the reference
load shaft angle, y(t) is the measured load shaft angle, and u(t) is the motor input voltage.
Note: Derivative of step-like reference signals may cause a large, initial peak in the control
signal. Thus, in this experiment, the derivative term kd acts only on the output y(t)
and not on the error term r(t)− y(t).
• Determine the closed-loop transfer function in terms of kp and kd.
• Determine kp and kd in terms of ξ and ωn.
• Calculate the control gains kp and kd to satisfy the time domain requirements. The
design procedure should be implemented as a MATLAB script or function.
13
Linear Control Systems Laboratory, Sharif University of Technology
6. • Verify the performance of the PD controller with the developed models (nonlinear and
linearized) by simulations. Find the simulated percent overshoot and settling time. If
the response of the system is not satisfactory, adjust the controller parameters and try
a new controller.
• Record your final suggestions for the control gains.
• Plot and print the reference signal and the simulated closed-loop response on the same
pair of axes.
7. Only after the simulated closed-loop response meets the requirements, test the controller in
a real-time experiment.
• Set the reference signal to a square wave with frequency of 0.4Hz.
Note: When implementing a controller on hardware, it is generally not advised to
take the direct derivative of a measured signal. Any noise or spikes in the
signal becomes amplified and gets multiplied by a gain and fed into the motor.
This may damage the motor and/or the motor brushes. To remove any high-
frequency noise components in the velocity signal, a low-pass filter is placed in
series with the derivative, i.e. taking the high-pass filter of the measured signal.
• Apply a high-pass filter instead of direct derivative. Because of some model-plant mis-
match, you may need to fine-tune the controller by changing the design parameters
to meet the performance requirements for the system. In this case, record the revised
control gains kp and kd.
• Plot and print the closed-loop shaft position response with PD controller.
8. As you can see, with a controller, the filter must also be tuned properly. In addition, the filter
has some adverse affects. It will introduce phase-lag in the feedback loop and so as a rule
the bandwidth must be greater than crossover frequency of the system to avoid instability.
Discuss the effect of the filter on the response of the servo motor and record your final
suggestion for the filter.
7.2 Velocity Control
The objective of this experiment is to design a Proportional-Integral (PI) controller that regulates
the angular velocity of the servo load shaft according to a set of specifications. The time domain
requirements for controlling the angular velocity are,
� Zero steady-state error,
14
Linear Control Systems Laboratory, Sharif University of Technology
� Settling time (with a 2% criterion) (Ts) ≤ 70ms,
� Overshoot (PO%) ≤ 10%.
1. PI Velocity Control: The PI compensator to control the velocity of the servo motor has the
following structure,
u(t) = kp(βr(t)− y(t)) + ki
∫ t
0
(r(τ)− y(τ))dτ, (13)
where kp is the proportional control gain, ki is the integral control gain, r(t) is the reference
of angular velocity, β is the setpoint weight, y(t) is the measured angular velocity, and u(t)
is the control signal.
In this controller, proportional term acts only on a fraction β of the reference. Integral
action has to act on the error to make sure that the error goes to zero in steady-state. For
the choice of β = 1, a traditional PI control is achieved.
• Determine the closed-loop transfer function in terms of kp and ki.
• Let β = 0. Determine kp and ki in terms of ξ and ωn.
• Calculate the control gains needed to satisfy the time domain response requirements.
The design procedure should be implemented as a MATLAB script or function.
2. • Verify the performance of the PI controller with the developed models (nonlinear and
linearized) by simulations. Find the simulated percent overshoot and settling time. If
the response of the system is not satisfactory, adjust the controller parameters and try
a new controller.
• Record your final suggestions for the control gains.
• Plot and print the reference signal and the simulated closed-loop response on the same
pair of axes.
3. Only after the simulated closed-loop response meets the requirements, test the controller in
a real-time experiment.
• Apply the PI controller in a real-time closed-loop experiment. Set the reference signal
to a step with initial value of 3 rad/s and final value of 8 rad/s. Because of some
model-plant mismatch, you may need to fine-tune the controller by changing the design
parameters to meet the performance requirements for the system. In this case, record
the revised control gains kp and ki.
15
Linear Control Systems Laboratory, Sharif University of Technology
• Plot and print the closed-loop velocity response and the control signal of PI controller
with β = 0.
4. • Adjust β between 0 and 1. Discuss how β affects the step response of the servo motor.
• Try to apply a load disturbance to the servo motor. Discuss the effect of β on the
response of the closed-loop system to load disturbances. Justify your observations.
• Try to find an optimal value for β based on your experiments. Record your final
suggestion for β.
• Plot and print the closed-loop shaft position response with PI controller for optimal
selection of β.
16
Linear Control Systems Laboratory, Sharif University of Technology
8 Further Experiments
The objective of this section is to control the angular velocity through a lead control plus an
integrator. The following frequency domain requirements are to be met when designing the lead
control+integrator:
PM ≥ 75 deg, ωc = 75 rad/s, (14)
where PM is the phase margin and ωc is the crossover frequency (the frequency at which the gain
of the Bode plot is 0 dB). The phase margin mainly affects the shape of the response. Having a
higher phase margin implies that the system is more stable and the corresponding time response
will have less overshoot.
The phase margin and crossover frequency specifications can then be satisfied using a proportional
gain Kc and the lead transfer function,1 + aTs
1 + Ts. The a and T parameters change the location of
the pole and the zero of the lead compensator which changes the gain and phase margins of the
system. The final controller is in the form of
K(s) = Kc1 + aTs
(1 + Ts)s. (15)
1. Let Gi(s) =Ga(s)
sbe the transfer function of the uncompensated system plus integrator.
Determine the crossover frequency symbolically in terms of model parameters and determine
the crossover frequency for numerical values of parameters in Gi(s).
2. The proportional gain Kc is designed to attain a certain crossover frequency. Increasing the
gain crossover frequency essentially increases the bandwidth of the system which makes the
response faster. Determine how much more gain is required such that the gain crossover
frequency is 50 rad/s.
3. In the next step, the value of the gain needed to achieve 75 degrees phase margin should be
found. Also, to ensure the desired specifications are reached, we’ll add another 5 degrees to
the maximum phase of the lead. To attain the necessary phase margin, the maximum phase
of the lead can be calculated using,
φm = PMdes − PMmeas + 5. (16)
The lead compensator has to add 20log10(a) of gain. This is determined using,
a = − 1 + sin(φm)
−1 + sin(φm). (17)
Calculate the maximum phase lead φm and a for the design.
17
Linear Control Systems Laboratory, Sharif University of Technology
4. The frequency at which the maximum phase lead occurs must be placed at the new gain
crossover frequency. This is the crossover frequency after the lead compensator is applied.
Let ωm be the maximum phase frequency. The parameter T is given by T =1
ωm√a
.
Determine the lead controller by finding ωm and T .
5. Plot and print the bode plots of the lead controller and the compensated loop transfer func-
tion. Record the phase margin of the compensated system.
6. Only after the simulated closed-loop response meets the requirements, test the controller in
a real-time experiment.
• Apply the lead+integrator controller in a real-time closed-loop experiment. Set the
reference signal to a step with initial value of 3 rad/s and final value of 8 rad/s.
• Plot and print the closed-loop velocity response with lead+integrator controller.
• Discuss the effect of changing Kc, T and a on the time domain specifications of the
closed-loop response.
18