MEEN 364 Robert Lipham Angel Gomez Last Update: Spring 2020 Lab 10 – DC Motor Position Controller Design and Implementation Introduction By now you have gained experienced in some of the practical aspects of control design. However, up to this point, the lab manuals have served as a closed framework for this process. Therefore, to show what you’ve learned, you will work on an open-ended control problem: Designing and implementing a DC motor position controller. Objectives The objective of this lab session is to design and implement a controller that will meet the following specifications: 1. 2. 3. 4. Maximum overshoot of 10% Maximum rise time of 0.2 seconds No steady state error for position step input No steady state error for disturbance step input Prelab As a group choose a controller for the system. Show on paper that the controller will meet the required specifications. This can be done by showing: 1. The steady state error of the closed loop system is zero for a position step input 2. The steady state error of the closed loop system is zero for a disturbance step input 3. 𝜔 and 𝜁 of the closed loop system can be independently adjusted Note that this prelab will serve as a good framework for “Method” section in your memo. 1 MEEN 364 Robert Lipham Angel Gomez Last Update: Spring 2020 Theory The DC motor model is shown in Figure 1. Figure 1: DC Motor Model The DC motor used in this lab is the same as the one used in labs 4 and 6. Therefore, the system can be modeled by Equation 1. 𝜏 (1) 𝑑𝜔 + 𝜔 = 𝐾 𝑣 (𝑡) 𝑑𝑡 Where 𝜏 and 𝐾 were found experimentally in lab 4. Note that for this lab 𝐾 and 𝐾 will be considered equal. Converting this to displacement form yields: 𝜏 (2) 𝑑 𝜃 𝑑𝜃 + = 𝐾 𝑣 (𝑡) 𝑑𝑡 𝑑𝑡 Where 𝜃 represents the instantaneous shaft angle. Taking the Laplace transform for zero initial conditions results in: 𝜏𝑠 θ(𝑠) + 𝑠𝜃(𝑠) = 𝐾 𝑣 (𝑠) (3) Rearranging yields the transfer function for the motor: 𝜃(𝑠)(𝜏𝑠 + 𝑠) = 𝐾 𝑣 (𝑠) 2 MEEN 364 Robert Lipham Angel Gomez Last Update: Spring 2020 𝐺(𝑠) = 𝜃(𝑠) 𝐾 = 𝑣 (𝑠) 𝜏𝑠 + 𝑠 (4) It should be noted that, for a given input voltage, the angular speed reaches a steady state value. However, the angular position will continue to increase (or decrease) if given a constant input voltage. This means that an open loop controller will not be able to meet the control objective. Therefore, a closed loop feedback system will be required. Note: For this lab, you will need to convert the units of 𝐾 from ∙ to ∙ or ∙ Lab Procedure Controller Selection Consider a typical negative feedback system of the following form: 𝑒(𝑠) 𝜃 (𝑠) + 𝑣 (𝑠) 𝐶(𝑠) 𝐺(𝑠) 𝜃(𝑠) − 𝐴 Figure 2: Typical negative feedback system Where 𝐺(𝑠) is defined in Equation 4, “𝐴" is an arbitrary constant greater than zero (typically set to unity), and 𝐶(𝑠) is the controller. Choose a controller, 𝐶(𝑠), and show that it allows you to independently vary the natural frequency and damping ratio of the closed loop system. This will verify that the controller will theoretically meet the required rise time and overshoot specifications. Additionally, show that the closed loop system has zero steady state error for a position step input. In order to study disturbance rejection, consider the following system: 3 MEEN 364 Robert Lipham Angel Gomez Last Update: Spring 2020 𝑣 (𝑠) 𝑒(𝑠) 𝜃 (𝑠) + 𝐶(𝑠) 𝑣 (𝑠) + 𝑣 (𝑠) + 𝜃(𝑠) 𝐺(𝑠) − 𝐴 Figure 3: Typical feedback system with disturbance input Where 𝑣 (𝑠) is a disturbance voltage input. In order to analyze the disturbance response, the input 𝜃 (𝑠) can be set to zero (a constant). The resulting block diagram is shown in Figure 4. 𝑣 (𝑠) 𝑣 (𝑠) + 𝐺(𝑠) 𝜃(𝑠) −𝐴 𝑒(𝑠) + 𝑣 (𝑠) 𝐶(𝑠) Figure 4: Disturbance input system Note that the constant “A” is still greater than zero. Find the closed loop transfer function for input 𝑣 (𝑠) and output 𝑒(𝑠), and show that the steady state error is zero for a step input 𝑣 (𝑠). This will verify that the system will reject a disturbance step input. Note: You must be able to show that your controller will work on paper before running a simulation. 4 MEEN 364 Robert Lipham Angel Gomez Last Update: Spring 2020 Cohort member A2. Simulink Simulation Set the working directory in MATLAB, and create a blank Simulink model. Build the feedback system shown in Figure 2. 1. Simulink Settings a. In the “Solver” tab of the “Model Configuration Parameters” menu: i. Set the stop time as appropriate ii. Set the “Type” field to “Fixed Step” iii. Set the “Solver” field to “auto (Automatic solver selection)” iv. Set the “Fixed-step size” field to “0.001” b. In the “Data Import/Export” tab: i. In the “Save to workspace or file” section, uncheck the “Single simulation output” checkbox 2. Model Components a. Use a “Constant” block for the desired position input b. Use a “Transfer FCN” block to simulate the DC motor i. Use the values of 𝜏 and 𝐾 found in lab 4. Be sure to convert the units of 𝐾 . c. Use whatever components necessary to simulate the feedback controller d. Send the system output to the MATLAB workspace. Be sure to use the “Structure With Time” format. e. You may wish to use a scope to view the response 3. Procedure a. Show that the simulated system will meet design specifications for step inputs of 30º, 90º, and 180º. You may need to adjust your controller parameters to meet the performance criteria. Cohort member B2. Simulink External Mode Model Create a blank Simulink model from your external mode template. Build the feedback system shown in Figure 2. 1. Simulink Settings a. Set the stop time as appropriate (no more than 10 seconds) 2. Model Components a. Use a “Constant” block for the desired position input b. Use an “HIL Write Analog” block to apply voltage to the motor i. Place a “Saturation” block before the “HIL Write Analog” block input 1. Set the limits to ±6 2. This is a requirement to protect the motor from overvoltage conditions c. Use an “HIL Read Encoder” block to read the motor position 5 MEEN 364 Robert Lipham Angel Gomez Last Update: Spring 2020 i. Place a “Gain” block after the “HIL Read Encoder” block output 1. If the system is designed to use degrees, set the value of the gain block to “−360/4096” 2. If the system is designed to use radians, set the value of the gain block to “−2𝜋/4096” d. Use whatever components necessary to implement the feedback controller e. Send the system output to the MATLAB workspace. Be sure to use the “Structure With Time” format. f. You may wish to use a scope to view the response g. Save and build the model 3. Procedure a. Test the real system for step inputs of 30º, 90º, and 180º. If the real system does not meet specifications, you may wish to tweak your controller gains. i. If you choose not to tweak your controller gains, be prepared to explain the reasons why the system does not behave as expected Issues to be addressed in the memo The memo for this lab will be due by the end of the lab session (due as a PDF via email). Therefore, you should focus on making the memo concise and informative. It is also advisable to get a head start on the memo before coming to lab. While completing the memo, please make sure to address the following: Controller topology used for the system Theory showing the controller should be capable of meeting specifications MATLAB plots of the controller simulation MATLAB plots of the controller implementation Did your controller simulation meet performance specifications? Did you have to tweak your controller parameters? Can you think of any sources of disturbance input for the real system? Did your controller implementation meet performance specifications? o If so, did you have to tweak your controller parameters? o If not, please explain why the real system did not meet specifications Things you learned in the lab How to apply your knowledge to an open-ended problem 6