C. Control Design (Week 2)
Last updated
Was this helpful?
Last updated
Was this helpful?
The objective of this experiment is to design a position control system for the motor to meet a given set of specifications in frequency-domain.
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 Modelling is approximated as
let , DC gain of the motor.
Since , where is the angular position of the motor, the transfer function from the applied voltage to the motor angular position is
Comparing the above transfer function to the standard form for a second-order system, i.e.,
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. 3.
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 limitations of the actuator must be taken into account when designing a controller. For instance, the voltage entering the Rotary Servo Base Unit motor should never exceed V_{\text{max}} = 10.0 V \qquad \qquad \qquad \tag{3.2}
The closed-loop DC motor system must meet the following specifications.
Bandwidth frequency of at least 25 rad/s (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 70 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.
Save root locus open-loop Bode, closed-loop bode and step response plots as separate figures.
In open-loop or closed-loop Bode plots, you should show Bandwidth frequency and Phase margin values.
In the step response plot, you should show the steady-state value.
Only for controlSystemDesigner or rltool only, you may use the Snipping tool and save the figures in a Word document.
For other Simulink-generated data, you need to use the plot
MATLAB command.
Results from each step below must be checked with TAs before proceeding to the next:
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 -3.5 dB and -2.5 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.
Note: If the closed-loop Bode plot is not visible after adjusting magnitude plot limits, it indicates that the design specification is not met, which would require gain tuning. This will be performed in Step 5.
If Open-loop Bode Editor is not automatically launched. 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. Note: The LoopTransfer_C Bode is the open-loop Bode.
Save a screenshot of the control structure that you now have in Control System Designer or rltool (go to Edit Architecture tab). This screenshot will be required to answer a question for the report (refer to Questions for Report).
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. 3 as a guide. Use a transfer function block for the plant (use K and tau from the model validation). Add saturation of max 10V and min -10V block before the Plant transfer function. Set the solver type to Fixed-step with size of 0.002. Include the controller gains from your design. Do not use the transfer function block or the inbuilt PID controller block for the controller gains. Save your Simulink model for further use in Part C of the experiment. Save the Simulink block diagram as a .jpg or .png image.
Run the responses to a unit ramp input first with a PD controller (by setting Ki = 0
) and then with a PID controller (Ki = 1% Kp
). 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, also you may zoom in to see the difference clearly). 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.
Note:
The plots for controller design, i.e., root locus, open-loop Bode, closed-loop Bode, and step response, must be shown as separate figures.
In open-loop or closed-loop Bode plots, you should show Bandwidth frequency and Phase margin values.
In the step response plot, you should show the steady-state value. This can be done by right-clicking on the plot -> "Characteristics" -> "Steady-state".
Only for controlSystemDesigner or rltool plots, you can include the plots as obtained using the Snipping tool.
For other Simulink-generated data, you need to use the plot
MATLAB command.
Root locus plot
Open-loop Bode plot
Closed-loop Bode plot
Time response plot
P (proportional) gain
Root locus plot
Open-loop Bode plot
Closed-loop Bode plot
Time response plot
PD (proportional and derivative) gains
Root locus plot
Open-loop Bode plot
Closed-loop Bode plot
Time response plot
PID (proportional, derivative and integral) gain values (mention if the gains are the same values or readjusted values from Step 8)
Closed-loop transfer function
Poles of the closed-loop system
Natural frequency of the closed-loop system dominant poles
Damping of the closed-loop system dominant poles
PID controller SIMULINK block diagram (image)
Plots comparing the ramp responses of PD and PID controllers (on the same figure)
Plots comparing the error variable of PD and PID controllers (on the same figure)
Step responses (two plots on the same figure)
Ramp responses (two plots on the same figure)
Derivative of error signal and speed value in one figure for the step input from both models
Derivative of error signal and speed value in one figure for the ramp input from both models
The block diagram of a DC motor with a proportional controller is shown in Fig.1. In this case, the controller transfer function () is a simple gain . From Fig. 1, the closed-loop transfer function from the commanded angular position to the actual angular position is given by
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. From Fig. 2, 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.
From Fig. 3, the open-loop transfer function becomes
In control design, a factor to be considered is saturation. This is a nonlinear element and is represented by a saturation block as shown in Figure 4. In a system like the Rotary Servo Base Unit, the computer calculates a numeric control voltage value. This value is then converted into a voltage, , by the digital-to-analog converter of the data-acquisition device in the computer. The voltage is then amplified by a power amplifier by a factor of . If the amplified voltage, , is greater than the maximum output voltage of the amplifier or the input voltage limits of the motor (whichever is smaller), then it is saturated (limited) at . Therefore, the input voltage is the effective voltage being applied to the Rotary Servo Base Unit motor.
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.
Using the model, i.e., K and tau values, you have obtained from the Modeling - Model Validation, input the transfer function (Equation 3.1) into MATLAB. Use K and tau from the model validation values.
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 the bandwidth is more than 25 rad/sec. Save the root locus, open and closed-loop Bode, time response plot and P gain.
Consider a proportional and derivative controller. In the compensator editor window under ‘C’, add a zero around -60. Using the cursor or manually input values, adjust the zero location of the controller first and see if the specification can be met. If adjusting the zero location cannot achieve the specification, 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, time response plot and PD gains. 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 1% of ). The controller transfer function for this step is Hint: We have all PID values, plug into above controller transfer function and solve for A and B in form. This should give you value of . To put it in the compensator the zero locations are -1/A and -1/B.
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 (if you readjusted any values in Step 8, 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)
What is the difference between Fig. 2 and the control structure screenshot that you saved in Step 6? Hint: Focus on where is located in the control loop and what it is multiplied by.
Why is this difference between the two control structures acceptable when dealing with a step input?
Use and modify the Simulink model that you built in Step 12 for the two control structure cases (i.e., is multiplied by the derivative of error or speed directly). You may create two separate Simulink files or build two models within the same Simulink file. Run each Simulink with a unit step input and a unit ramp input for 5 seconds. Use the PD gains found in Step 6 (Result B.5) and set Ki = 0
. Create plots below to help you explain the question asked above: