DC Motor
This manual documents the modeling of a DC motor followed by the design and simulation of a position control system for it. Finally, the controller is implemented on the hardware and evaluated.
Last updated
Was this helpful?
This manual documents the modeling of a DC motor followed by the design and simulation of a position control system for it. Finally, the controller is implemented on the hardware and evaluated.
Last updated
Was this helpful?
This laboratory experiment is designed to give the students a clear understanding of a typical DC motor control system. DC motors are used in typical flight control systems to actuate various devices (ailerons, flaps, elevator, rudder, etc). The experiment is divided into three parts:
Any control problem consists, in general, of three main phases: The first phase is modeling/system identification, the second phase is controller design, and the third phase is controller implementation, testing and evaluation. This part of the experiment involves the first phase, namely, system identification and modeling of a DC motor. Identification of a complex system can be very challenging; however, for some systems, it may be possible to find a simple model that is suitable for control design. The objective of Part A of this experiment is to find the parameters of the reduced model for the DC motor used in the lab. This process yields a transfer function description of the DC motor system that can be used to design a controller for the DC motor.
A picture of the DC motor set in the lab is shown in Fig. 2.1. Figure 2.2 is a schematic of a typical DC motor. The motor is made up of a rotor and a stator. The stator windings create a magnetic field of intensity . In a permanent magnet DC motor (of the same type used in the lab) the stator is made of magnetic material and there is no field winding.
The rotor is made up of a set of armature windings and a commutator. The commutator is used to energize an individual winding when that winding is perpendicular to the stator field. That causes the magnetic field of the armature to be always perpendicular to the field of the stator. This results in maximum torque for a given armature current. In general, the motor torque is proportional to the product of field intensities
The armature field intensity is proportional to the armature current . Hence, , and since the stator field intensity is constant, it follows that
where .
When the armature winding rotates in a magnetic field, a back voltage, (back electromotive force (EMF) voltage) is generated that is proportional to the rate of change of the flux passing through the winding, and hence, it is also proportional to the rotor speed. Therefore, it follows that
A schematic of the electrical and mechanical parts of the motor are shown in Fig. 2.2.
From the electric circuit of the armature we have
For the mechanical part of the motor we have
where
: armature inductance
: armature current
: armature resistance
: back EMF voltage
: voltage applied to the motor
: total inertial (rotor and load)
: motor torque
: disturbance torque
: damping coefficient due to friction
: angular velocity of the motor
The Laplace transform of (2.2) and (2.3) yields
and
and using (2.1) we get
Combining (2.4) and (2.5) and assuming negligible disturbance torque, one obtains that
Often, L ≈ 0 and B ≈ 0. In this case, the transfer function in (2.6) simplifies to
where,
Figure 2.3 below shows a block diagram representation of the DC motor system.
It is of interest to note that is related to . This can be shown by considering the power balance in steady state. The power input to the motor is
The power delivered to the shaft is
Equating the previous two expressions yields that . (Note that the above relationship is based on the assumption that the same units are used for both and .)
The transfer function for the DC motor as derived in (2.7) and as shown in Fig. 2.3 is
where
since
The DC gain of the system is calculated by evaluating (2.8) at . Hence
Thus, we have reduced the DC motor to a first-order system as shown in Fig. 2.4. The theoretical values of the DC gain and time constant () are given by (2.9) and (2.10). The DC gain and time constant values can also be determined experimentally, as shown in the next section.
The DC gain and the time constant value of the DC motor can be determined by subjecting the motor to a step voltage input. Typical first-order system response to a step input is illustrated in Fig. 2.5. The DC gain is obtained by dividing the steady-state value of the output by the magnitude of the input step. Recall that from the final value theorem
The time constant is the time at which the output reaches 63.2% of its steady-state value.
With the help of the TA, check and ensure that the Quanser QUARC software is linked to MATLAB. QUARC is the MATLAB plug-in that enables communication with the hardware interface boards manufactured by Quanser.
In the MATLAB directory navigation bar, go to C:\Users\Public\AE4610\DC Motor\DCMotor. Locate the file DCMotor_OL.mdl under the Current Folder section and open it. This is the block diagram for this part of the experiment.
Open the scope Theta_dot.
Turn on the power supply.
For the braked position of the magnetic brake (1 position), choose 3 different input voltages (< 5 volts).
Save the data by selecting all the data in the MATLAB window, right click and select Save as, go to the folder C:\Users\Public\AE4610\DC Motor\Lab Data<Your group number> and save the motor angular velocity data with different names. For example, DCMotor_OL_Data_3V.
Repeat steps 8, 9 for all the three step inputs.
Run the motor for 10 seconds for sinusoidal voltage input. Select the amplitude (< 5 volts) and frequency (< 5 rad/s). Save the data.
Data will be uploaded on Canvas by the TA. DO NOT DELETE THE SIMULINK MODEL. Close Simulink and DO NOT SAVE.
Plot the measured angular velocity of the DC motor vs. time for each step input. From the plot, determine the time constant and the DC gain of the DC motor as described in the above section.
Average the DC gain and time constant for the three different input voltages to get a single value of the DC gain and time constant.
Build a SIMULINK model that represents the DC motor model obtained experimentally (see Fig. 2.4). Use the time constant and DC gain from Step 2.
Simulate the sinusoidal input used in Step #11 of the Procedure in your SIMULINK model and compare the output with the experimental angular velocity obtained in the experiment. Plot the simulated and experimental angular velocity responses on the same plot. Make sure to label each response. Explain any differences in the responses (very briefly, in a couple of sentences).
The objective of Part B of the DC motor experiment is to design a position control system for the motor to meet a given set of specifications.
Now that we have identified the time constant and the DC gain for the system in the modeling part of this experiment, the next step is to design a position control system in order to convert the given DC motor into a position servo. A classical PID controller will be used to control the position of the motor subject to a given set of specifications, for example, bandwidth, steady-state error requirements, etc.
Recall that the transfer function of the motor from to in (2.8) is approximated as
Since , where is the angular position of the motor, the transfer function from the applied voltage to the motor angular position is
where DC Gain of the motor.
The block diagram of a DC motor with a proportional controller is shown in Fig. 2.6. In this case, the controller transfer function () is a simple gain . From Fig. 2.6, the closed-loop transfer function from the commanded angular position to the actual angular position is given by
Comparing the above transfer function to the standard form for a second-order system, i.e.,
we notice that the proportional gain affects the natural frequency (and hence the bandwidth) of the closed-loop system.
The block diagram of a DC motor with an inner loop angular rate (i.e., derivative) feedback and an outer loop angular position error (proportional) feedback is shown in Fig. 2.7. From Fig. 2.7, the closed-loop transfer function from the commanded angular position to the actual angular position is given by
Comparing the above transfer function with the standard form for a second-order system, we notice that the derivative gain affects the damping while the proportional gain affects the natural frequency of the closed-loop system.
The block diagram of a DC motor with an inner loop angular rate (i.e., derivative) feedback and an outer loop angular position error plus integral of angular position error (i.e., proportional plus integral) feedback is shown in Fig. 2.8.
From Fig. 2.8, the open-loop transfer function becomes
indicating that with integral feedback, the type of the system increases from 1 to 2 and hence, results in zero steady-state error to both ramp and step command inputs.
The most important difference between analog and digital control is that digital systems operate using a clock. The timing of this clock and the number of operations necessary to implement a controller place a limit on how frequently the controller can access sensors, make calculations, and modify the control inputs. (In addition, other elements of the control system themselves may introduce an additional time delay. For this reason, the sampling time of the digital system is an important parameter.) Digital controllers, in general, will have a maximum . Increasing the further will make the closed-loop system unstable.
The closed-loop DC motor system must meet the following specifications.
Bandwidth frequency of at least 10 rad/sec (Bandwidth is an important measure of the frequency range over which the system output follows well the command signal. It is defined as the frequency at which the magnitude ratio is -3 dB in the closed-loop system frequency response plot. Sinusoidal inputs with frequencies less than the bandwidth frequency are tracked ‘reasonably well’ by the system.)
Phase margin of at least 60 deg. (Gain and phase margins are stability margins to accommodate model variations. A flight control system actuator is typically subject to varying load, resulting in model variations. Hence, it is important to design a controller with sufficient stability margins to accommodate such variations and other effects such as wear with usage.)
Zero steady-state error to both step and ramp commands.
Using the model you have obtained from the prelab, input the transfer function (equation (2.11)) into MATLAB.
First consider a proportional controller, i.e., C = Kp
. Input C = 1
into MATLAB.
Run controlSystemDesigner(G,C)
(you can alternatively run rltool(G,C)
for versions R2020b and older). Select ‘New Plot -> New Step’ to launch the step response plot (if it is not automatically launched). In the time response plot, only the ‘closed loop: r to y' (blue plot) should be visible. Always do this in all the labs. Select ‘New Plot -> New Bode’ and choose the appropriate option to launch the closed-loop Bode plot. In the closed-loop Bode response window, select the magnitude plot only and readjust the magnitude plot limits to -5 dB and 0 dB under properties and limits. The bandwidth frequency (defined above) can be read from the closed-loop Bode plot. It may be useful to add a grid to the bode plot.
In Control System Designer or rltool, select ‘Open-loop Bode’ under ‘Tuning Methods -> Bode Editor’. The phase margin (PM) of the system can be read off the open-loop bode plot.
Change the controller gain by double-clicking ‘C’ under ‘Controllers and Fixed Blocks’ or by using your cursor on the root locus and check if all the design specifications can be met using a proportional controller, which would be optimal from a design standpoint. If not, at least select a value of such that bandwidth is more than 10 rad/sec. Save the root locus, open and closed-loop Bode, and time response plot. Save the gain that you used.
IMPORTANT: What is the difference between Fig. 2.7 and the control structure that you now have in Control System Designer or rltool? They are not identical. is multiplied by the derivative of the error signal in Control System Designer or rltool, yet it is multiplied directly by in Fig. 2.7. Why is this acceptable when dealing with a step input? Is there a way to mimic this structure exactly in Control System Designer or rltool? (If you attempt to change it, make certain you modify the rest of these instructions carefully to achieve the correct results.)
Readjust the proportional and derivative gains (if necessary, by modifying the zeros, not the overall gain, ) such that bandwidth and phase margin specs are met.
Save the root locus plot, open and closed-loop system Bode plots, and time response plot as graphs. Also, save your gains (you must convert from the Control System Designer or rltool compensator format, back to our conventional gain representation – , , ).
Using the controller you have designed, obtain the closed-loop transfer function and save your result. (Do this in MATLAB using the transfer function variables of and , or export the closed-loop transfer function from Control System Designer or rltool(T_r2y), using the ‘Export’.) (May be listed as ‘IOTransfer_r2y’). In MATLAB, change the exported state space into a transfer function using tf(IOTransfer_r2y)
Obtain poles of the closed-loop system. Compute the natural frequency and damping of the dominant poles of the closed-loop system. You can do all this from your exported transfer function using the function damp()
. Save your results.
Construct a SIMULINK diagram using Fig. 2.8 as a guide. However, do not use a transfer function block for anything but the plant. (This allows you to modify your gains easily when necessary.) Include the controller gains from your design. Save your Simulink model for further use in Part C of the experiment.
Run the responses to a unit ramp input first with a PD controller (by setting Ki = 0
) and then with a PID controller (Ki = 0.05
). Run the simulation for about 30 sec.
Make comparison plots of ramp responses with PD and PID controllers (on the same plot) to show any differences between the two responses, especially in steady-state response (i.e., for t>>0). The difference can be more easily spotted by plotting the error variable (i.e. error between the commanded position and the actual position) for each controller. Save the comparison plot and error plot.
You must have your work checked out by one of the TAs before leaving the lab to get credit for your work.
The objective of this part of the DC motor experiment is to implement the controller designed in part B and evaluate its performance.
The following is a list of the required equipment to perform this experiment:
With the help of the TA, check and ensure that the Quanser QUARC software is linked to MATLAB.
In the MATLAB directory navigation bar, go to C:\Users\Public\AE4610\DC Motor\DCMotor. Locate the file DCMotor_CL.mdl under the Current Folder section and open it.
P Controller Test: To understand the behaviour of a Proportional controller, implement a P controller by typing the values for and to 0 in the command window. Set as 10.
Open the Theta Command block and make sure that the Final value is equal to 5/Kp. This will limit the input to the motor to be less than a preset limit of 5 volts.
Open the scope Theta.
Turn on the power supply.
Save your data.
PD Controller Test: By introducing a derivative gain (), notice how the system characteristics change. Set to 1 and to 2. Observe the behaviour and save the data.
PID Controller: Open the controller block and change the current values of , and to match with your controller from Part B.
Make sure that the magnetic brake position of the DC motor is in braked position (Position 1). Run the motor with a step input of the selected input voltage for 10 seconds and save the data.
Repeat Step 1 with the magnetic brake set in other positions (position 0 or 2). Save the data (i.e. filename “dccloopoffdesign”).
Repeat Step 1 with the magnetic brake in the original position (position 1) and the sampling time set to 0.1 sec. To set the sampling time, you need to go to the block diagram file, choose “Simulation” -> “Model Configuration Parameters” -> “Solver”. Set the fixed step to 0.1 sec. (It should have been 0.01 previously.) Save the data (i.e. filename “dccloopslowsampling”).
Email the data to yourself and delete the data files. DO NOT DELETE THE SIMULINK MODEL. Close Simulink and DO NOT SAVE.
Run a nominal case simulation using your SIMULINK model from Part B, setting the command input to the value you used during the experiment. Compare the simulation results with corresponding experimental results for the nominal case and explain any differences between those results.
Compare the simulation results for the nominal case with the experimental results for the off-design case and explain any differences.
Modify the SIMULINK model to include a zero-order hold block at the input (labeled as in Fig. 2.8) to the DC motor in order to account for the effect of the sampling time used in the experiment. (Note this is different from the quantization error introduced by the digital encoder in measuring the angular position). Save this block diagram for inclusion in your lab report.
Run simulations with the zero-order hold set to 0.01 sec and 0.1 sec and save simulation outputs.
Compare the simulation output with a zero-order hold of 0.01 sec to the nominal case experimental results and explain any differences between this comparison and your initial nominal case simulation/experimental comparison.
Compare the simulation output with a zero-order hold of 0.1 sec to the slow sampling experimental results and explain any differences.
Include a brief synopsis of what you did in Part A, all the individual controller design work from Part B, and all your work from Part C, namely all of the plots and comparisons asked for. There is no need to repeat the lab manual, so do not spend time entering equations unless you directly used them at some point in your work.
Include the analysis questions from Part A.
Include the following in your Part C analysis section:
Effect of proportional controller gain on closed-loop system behavior
Effect of derivative controller gain on closed-loop system behavior
Effect of integral controller gain on closed-loop system behavior
Effect of sampling time on closed-loop system behavior
Controller performance in off-design conditions
To build the model, click down arrow on Monitor & Tune under Hardware tab and then Build for monitoring . This generates the controller code in the MATLAB window. If you encounter build issues, this is usually due to file permission conflicts caused by having multiple users share the same files. To resolve this, have the TA help you create a clean installation by deleting the DC Motor folder and unzipping the backed up "DC Motor - Unzip Me For Clean Install" folder (be sure to recover any stored data in the original folder before deleting).
Press Connect button under Monitor & Tune and then press Start . Run the motor with a step input of the selected input voltage for 10 seconds.
Consider a proportional and derivative controller. In the compensator editor window under ‘C’, add a zero around –10. Using the cursor or manually input values, adjust the zero location of the controller and readjust the proportional gain (if necessary) such that, at least, the bandwidth and phase margin specifications are met. (Note that with a PD controller for this system, the open-loop transfer function is still of Type 1. Hence, the zero steady-state error specification for ramp input cannot be met with a PD controller.) Save the root locus, open and closed-loop Bode and time response plot. The compensator transfer function in Control System Designer or rltool in this step is of the form shown below. Use it to determine the gains and . Save these gains.
Consider a PID controller. Using and values you have obtained from the previous steps, edit the compensator (i.e. add poles and zeros to match the format below) to include integral feedback with the integral gain set to a small value (i.e., is roughly 0.05). The controller transfer function for this step is
To build the model, click down arrow on Monitor & Tune under Hardware tab and then Build for monitoring .
Press Connect button under Monitor & Tune and then press Start . Run the motor with a step input of the selected input voltage for 10 seconds.