AE4610
  • Welcome
  • Experiments
  • Lab 0: MATLAB & SIMULINK
  • Lab 1: Rotary Servo Base
    • A. Integration (Week 1)
    • B. Modeling (Week 1)
    • C. Control Design (Week 2)
    • D. Controller Implementation & Evaluation (Week 3)
  • Lab 2: 3 DOF Gyroscope
    • A & B. Modeling and Control Design (Week 1)
    • C. Controller Implementation (Week 2)
  • Lab 3: Rotary Flexible Link
    • A. System Identification (Week 1)
    • B & C. Control Design and Controller Implementation (Week 2)
  • Lab 4: Rotary Inverted Pendulum
    • A & B. Modeling and Balance Control
    • C. Swing-up Control (Demo)
  • Final Project
  • Archive
    • Old Lab 1 Model Validation
    • Problem Set
    • DC Motor
    • Lab 1: Rotary Servo Base (Older Version)
      • A. Integration (Week 1)
      • B. Modelling (Week 1)
      • C. Position Control (Week 2)
    • Quadcopter
    • Gyroscope
    • Inverted Pendulum
    • 3DOF Helicopter
    • Torsional Pendulum
    • Aero LQR
      • A. System Identification
      • A. System Identification (Week 1) last check
      • B. Control Design & Implementation (Week 2)
    • Rotary Gyro
      • Rotary Gyro
    • 2 DOF AERO
      • A. System Identification
      • B. Control Design
      • C. Controller Implementation
    • Copy of Lab 4: Rotary Inverted Pendulum
      • Week 1
      • Week 2
Powered by GitBook
On this page
  • Objective
  • Experiment Notes
  • Design Specifications
  • Procedure
  • Results for Report
  • (A) From Step 5
  • (B) From Step 6
  • (C) From Step 9
  • (D) From Step 10
  • (E) From Step 11
  • (F) From Step 12
  • (G) From Step 13
  • Questions for Report

Was this helpful?

Export as PDF
  1. Lab 1: Rotary Servo Base

C. Control Design (Week 2)

PreviousB. Modeling (Week 1)NextD. Controller Implementation & Evaluation (Week 3)

Last updated 8 months ago

Was this helpful?

Objective

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.

Experiment Notes

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 VmV_mVm​ to Ωl\Omega_lΩl​ in is approximated as

Ωl(s)Vm(s)=Aτs+1(2.1)\displaystyle\frac{\Omega_l(s)}{V_m(s)} = \frac{A}{\tau s+1} \qquad \qquad \qquad \tag{2.1}Vm​(s)Ωl​(s)​=τs+1A​(2.1)

let A=KA = KA=K, DC gain of the motor.

Proportional (P) Control

Since θ˙=Ω\dot{\theta} = \Omegaθ˙=Ω, where θ\thetaθ is the angular position of the motor, the transfer function from the applied voltage to the motor angular position is

G(s)=θ(s)Vm(s)=As(τs+1)(3.1)G(s) = \displaystyle\frac{\theta (s)}{V_m (s)} = \frac{A}{s(\tau s+1)} \qquad \qquad \qquad \tag{3.1}G(s)=Vm​(s)θ(s)​=s(τs+1)A​(3.1)

Comparing the above transfer function to the standard form for a second-order system, i.e.,

Proportional-plus-Derivative (PD) Control

Proportional-plus-Integral-plus-Derivative (PID) Control

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.

Controller Gain Limits

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}

Sampling Time

Design Specifications

The closed-loop DC motor system must meet the following specifications.

  1. 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.)

  2. 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.)

  3. Zero steady-state error to both step and ramp commands.

Guidelines for saving plots

  1. Save root locus open-loop Bode, closed-loop bode and step response plots as separate figures.

  2. In open-loop or closed-loop Bode plots, you should show Bandwidth frequency and Phase margin values.

  3. In the step response plot, you should show the steady-state value.

  4. Only for controlSystemDesigner or rltool only, you may use the Snipping tool and save the figures in a Word document.

  5. 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:

Procedure

  1. First consider a proportional controller, i.e., C = Kp. Input C = 1 into MATLAB.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

Results for Report

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.

(A) From Step 5

  1. Root locus plot

  2. Open-loop Bode plot

  3. Closed-loop Bode plot

  4. Time response plot

  5. P (proportional) gain

(B) From Step 6

  1. Root locus plot

  2. Open-loop Bode plot

  3. Closed-loop Bode plot

  4. Time response plot

  5. PD (proportional and derivative) gains

(C) From Step 9

  1. Root locus plot

  2. Open-loop Bode plot

  3. Closed-loop Bode plot

  4. Time response plot

  5. PID (proportional, derivative and integral) gain values (mention if the gains are the same values or readjusted values from Step 8)

(D) From Step 10

  1. Closed-loop transfer function

(E) From Step 11

  1. Poles of the closed-loop system

  2. Natural frequency of the closed-loop system dominant poles

  3. Damping of the closed-loop system dominant poles

(F) From Step 12

  1. PID controller SIMULINK block diagram (image)

(G) From Step 13

  1. Plots comparing the ramp responses of PD and PID controllers (on the same figure)

  2. Plots comparing the error variable of PD and PID controllers (on the same figure)

Questions for Report

    1. Step responses (two plots on the same figure)

    2. Ramp responses (two plots on the same figure)

    3. Derivative of error signal and speed value in one figure for the step input from both models

    4. 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 (HHH) is a simple gain KPK_PKP​. From Fig. 1, the closed-loop transfer function from the commanded angular position θc\theta_cθc​ to the actual angular position θ\thetaθ is given by

θ(s)θc(s)=AKpτs2+s+AKp=AKpτs2+1τs+AKpτ\frac{\theta(s)}{\theta_c(s)} = \frac{AK_p}{\tau s^2 + s + AK_p} = \frac{\cfrac{AK_p}{\tau}}{s^2 + \cfrac{1}{\tau}s + \cfrac{AK_p}{\tau}} θc​(s)θ(s)​=τs2+s+AKp​AKp​​=s2+τ1​s+τAKp​​τAKp​​​
θ(s)θc(s)=ωn2s2+2ζωns+ωn2\frac{\theta(s)}{\theta_c(s)} = \frac{\omega_n^2}{s^2 + 2\zeta \omega_n s + \omega_n^2}θc​(s)θ(s)​=s2+2ζωn​s+ωn2​ωn2​​

we notice that the proportional gain KpK_pKp​ 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 θc\theta_cθc​ to the actual angular position θ\thetaθ is given by

θ(s)θc(s)=AKpτms2+(1+AKd)s+AKp=AKpτms2+(1+AKd)τms+AKpτm\frac{\theta(s)}{\theta_c(s)} = \frac{AK_p}{\tau_m s^2 + (1 + AK_d)s + AK_p} = \frac{\cfrac{AK_p}{\tau_m}}{s^2 + \cfrac{(1 + AK_d)}{\tau_m}s + \cfrac{AK_p}{\tau_m}}θc​(s)θ(s)​=τm​s2+(1+AKd​)s+AKp​AKp​​=s2+τm​(1+AKd​)​s+τm​AKp​​τm​AKp​​​

Comparing the above transfer function with the standard form for a second-order system, we notice that the derivative gain KdK_dKd​ affects the damping while the proportional gain KpK_pKp​ affects the natural frequency of the closed-loop system.

From Fig. 3, the open-loop transfer function GHGHGH becomes

GH=(Kps+Ki)sA(τms+1+AKd)1sGH = \frac{(K_ps+K_i)}{s} \frac{A}{(\tau_ms+1+AK_d)}\frac{1}{s}GH=s(Kp​s+Ki​)​(τm​s+1+AKd​)A​s1​

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, Vdac(t)V_{\text{dac}}(t)Vdac​(t), 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 KaK_aKa​. If the amplified voltage, Vamp(t)V_{\text{amp}}(t)Vamp​(t), 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 VmaxV_{\text{max}}Vmax​. Therefore, the input voltage Vm(t)V_m(t)Vm​(t) 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 TsT_sTs​ of the digital system is an important parameter.) Digital controllers, in general, will have a maximum TsT_sTs​. Increasing the TsT_sTs​ 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 G(s)G(s)G(s) (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 KpK_pKp​ 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 GCGCGC 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 KpK_pKp​ and KdK_dKd​. Save these gains.

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 ).

Consider a PID controller. Using KpK_pKp​ and KdK_dKd​ 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., KiK_iKi​ is 1% of KpK_pKp​). 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 Ki(1+As)(1+Bs)sK_i\frac{(1+As)(1+Bs)}{s}Ki​s(1+As)(1+Bs)​ form. This should give you value of AB=KdKi,A+B=KpKiAB = \frac{K_d}{K_i}, A+B = \frac{K_p}{K_i}AB=Ki​Kd​​,A+B=Ki​Kp​​. 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, KiK_iKi​) 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 – KpK_pKp​ , KdK_dKd​ , KiK_iKi​).

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 GGG and CCC , 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 KdK_dKd​ 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.,KdK_dKd​ 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:

Questions for Report
Modelling
Figure 1: Closed-loop block diagram for the position control of a DC motor using a proportional controller
Figure 2: Closed-loop block diagram for the position control of a DC motor using a proportional-plus-derivative (PD) controller.
Figure 3: Closed-loop block diagram for the position control of the DC motor using a proportional-plus-Integral-plus-derivative (PID) controller
Figure 4. Actuator saturation.