



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A lab exercise focused on proportional, proportional-integral, and proportional-integral-derivative control laws for regulating velocity and position in a DC motor system. Emphasis is placed on transient responses, steady-state errors, and the effects of gain values on system performance. Students will derive equations, calculate gain values, and test the control laws using the dSpace experiment.
Typology: Study notes
1 / 6
This page cannot be seen from the preview
Don't miss anything!




The objective of this lab is to study basic design issues for proportional- integral-derivative control laws. Emphasis is placed on transient responses and steady-state errors. The first control problem consists in the regulation of velocity for brush DC motors and is solved using proportional-integral control. The second problem consists in the regulation of position and requires derivative compensation in the form of velocity feedback.
In the lab on first-order systems, the response of a brush DC motor with the voltage v ( V or volts ) considered as an input and the angular velocity • (rad/s or s• 1) considered as an output was found to be approximately described by a model . s a k v(s)
P(s) ++
A proportional control law (P) consists in having
== (^) p −− (8.17) where r is the reference input for the velocity, in rad/s. kP is called the proportional gain. The resulting closed-loop transfer function is given by s (a kk ) k k r(s) (s) P (s) P P CL ++ ++
ω (8.18) Note that the closed-loop pole is given by • ( a+ kkP ). In theory, it would appear that the closed-loop pole could be moved arbitrarily far in the left-half plane through the use of a sufficiently large proportional gain. The response of the system could be made arbitrarily fast in that manner. As this lab will show, there are limits on the gains that can be applied, however, these limits are due to effects that are neglected in the model (such as the inductance of the motor and the limit on the voltage), but are nevertheless present in the physical system.
The DC gain in (8.18) is equal to kkP / ( a+ kkP ). For large kP , this gain approaches 1, but large gains are impractical. Therefore, it is useful to modify the control law in order to adjust the DC gain. Specifically, replacing (8.17) by
== (^) p F −− (8.19)
yields a closed-loop transfer function s (a kk ) k k k r(s) (s) P (s) P F P CL ++ ++
ωω (8.20) The closed-loop pole is equal to the original one, but the DC gain can now be adjusted to 1 by setting P P F kk (a kk ) k
We will call kF the feedforward gain. Despite the capability of adjusting the feedforward gain kF in order to obtain a DC gain of 1, perfect tracking of reference inputs is usually not achieved because the parameters of the system are not exactly known or may vary, and because disturbances may affect the response of the system. These problems can be resolved through the use of a proportional-integral (PI) control law of the form
where kP and kI are called the proportional gain and the integral gain , respectively. Then, the closed-loop transfer function becomes P I 2 P I P CL s (a kk )s kk
k k kk ( s r(s) (s) P (s) ++ ++ ++
ωω (8.23) The DC gain is equal to 1, regardless of what the parameters of the system or of the control law are. Of course, it should be remembered that the DC gain reflects the steady-state conditions only if the closed-loop system is stable, i.e., if the poles of (8.23) are all in the open left-half plane. Generally, the responses cannot be made as fast for a PI control law, so that the benefit of a zero steady-state error has to be weighted against that of the speed of response.
To control position , instead of velocity, it is common to use proportional-integral- derivative (PID) control law .
(r dt d dt k
k (r
Note that the derivative term can be viewed as a proportional feedback acting on the velocity error. In general, derivative feedback improves the stability and the damping of the closed-loop system. In practice, the control law (8.24) is often modified in two ways. First, the derivative action is applied only to the output • , and not to the reference input. This is done because reference inputs often change in steps, and the derivative is then either zero or not defined (infinite). Second, a feedforward gain is often applied to the reference input. This is not done to adjust the DC gain (as for the control law without integral term), but
Carry out the same testing procedure as in the lab on first-order systems.
For this experiment control of the velocity of the motor will be explored using Proportional and Proportional-Integral (PI) control. Control of the motor position will be explored using Proportional-Integral-Differential (PID) control. The dSpace experiment designed to perform this lab is setup to allow a choice between the different control types. Values for each of the proportional gains can also be entered into the Layout. A reference value of either speed or position is available to be used with the control law type. In the case of the PID controller, you will implement the equation for the control law by modifying the underlying C/C++ code and rebuilding the software that will be provided to the board.
Load the experiment PID_control_DC_motor, It should open with the proportional control type selected. The reference input for the Proportional control is a reference speed, given in RPM. It should be noted that any gains not used for the selected control law are ignored. First, experiment with proportional control by setting kP and kF according to the pre-lab calculations, and apply a reference input that steps from 0 to 1000 rpm and then to 2000 rpm and then back to zero. Repeat the experiment for all three cases, capture the data and plot the results. Discuss what happens when the gain kP becomes large?
Change the control type to “PI” and apply the values calculated for the PI control law, setting kF = 1 in the experiment. You may also experiment with other values of kP and kI , in particular those resulting in faster responses. Plot the results for your best experiment.
The programs used by the dSpace board to implement experiments are created using C/C++ code and a compiler/linker provided with the system. For each of the labs the code for an experiment is available in main.c and driver.c. All of the control algorithms and the main loop are found in the main.c file, which will be referred to as the “lab code”. Any code that supports the hardware interface to the system is found in driver.c file, which will be called the “driver code”. Looking at the lab code it can be broken down in to three sections. The first section contains global variables that are used for connection to the buttons, plot windows and displays in the layout window. The next section is the “main()” function that is processed when the board is loaded. Last is a function called
“user_isr()”, this function contains the logic and equations that implement the control laws for the experiments. For an embedded system, like dSpace, most of the code that does the work is not located in the “main()” function. The main includes initializations for the system that sets up the framework of hardware interrupts or ISR’s. An ISR is a signal that tells the system that data is ready to be sent/received or that a certain function should be performed. In the case of the lab experiments, a built-in timer provides an ISR every 2 msec to perform the operations of getting the current position for the incremental encoder (INC1) and setting the output value of ADCH1. The function “isr_srt()” in the driver code performs the commands to read and write the encoder and ADC respectively. “Isr_srt()” also runs the function from the lab code “user_isr()” which performs the control processing. The system sits and waits for the next ISR. The lab code and driver code must be compiled/linked to be used by the system. This requires a MSDOS prompt window. A shortcut to MSDOS is provided in the directory with the lab experiments. From the DOS prompt the program “down1104.exe” can be used to compile/link and load the program for the system. The syntax for this command is: > down1104 filename1.c fileaname2.c … All the .c files created to implement the experiment software must be listed as arguments to down1104.exe. In turn, they are used to generate a .ppc file that contains the machine code used on the board. Because of how the experiments are set up the first filename argument should be main.c followed by driver.c. With a valid execute of “down1104” the board should be loaded and ready to perform experiments.
Adjust the file main.c in order to implement the PID control law for position. All of the required variables and the location of the control law are outlines inside the user_isr() function of the “.c” file. As a hint, you should remember the relations between position and velocity. Both position and velocity are provided with radian measure by the encoder. For the case of integration in a discrete system, think of it as a Riemann Sum. Look at the control law for the PI controller to get an idea of how integration is performed in that case. Once the experiment is compiled, linked and downloaded, you may apply the calculated values of the PID parameters, with kF = 1, and a reference input step of 90 degrees. The settling time should be approximately 100ms, with an overshoot response. Adjusting the parameter kF should yield a better response. Plot the results for a few values of kF on a single graph. Indicate what value of kF that gives the best response (minimum settling time with negligible overshoot). DEMONSTRATE YOUR FINAL EXPERIMENT TO THE TA