B & C. Control Design and Controller Implementation (Week 2)
Objective
The objective is to design a controller that allows rapid reorientation of the link with very little vibrations from the link flexibility. This analysis is a preliminary approach to containing structural vibrations in real-world applications like aircraft and spacecraft structures as well as robotic links/manipulators
B. Control Design
The methodology used is to design the control law assuming full state feedback to meet a given set of specifications. This will be followed by studying the loss of controller performance with servo feedback alone. The method we will use for full state feedback is based on the linear quadratic regulator (LQR) theory, which requires the given system to be controllable.
State Space Model
The equations that describe the motions of the servo and the link with respect to the servo motor voltage are obtained using the Euler-Lagrange method and can be written as
Assuming the viscous damping of the link is negligible, i.e. = 0 and substituting the torque using the expression,
the EOM can be rearranged as
The various system parameters can be found in Table 2 of Part A: System Identification.
Equations 3 and 4 can be represented in state-space form
with and, where
In the output equation, only the position of the servo and link angles are being measured.
As such, the velocities of the servo and link angles can be computed in the digital controller if required, e.g., by taking the derivative and filtering the result though a high-pass filter. Hence, with all the states of the system as outputs, the C and D matrices are
Linear Quadratic Regulator (LQR) Design
Controllability
If the control input of a system can take each state variable, where, from an initial state to a final state in finite time, then the system is controllable, otherwise it is uncontrollable. The controllability of a system can be determined using the ‘Rank Test’. According to the Rank Test, the system is controllable if the rank of its controllability matrix
equals the number of states of the system,
LQR controller
If (A,B) are controllable, then the Linear Quadratic Regular optimization method can be used to find full state feedback controller gains. Given the plant model in state-space form where represents the state vector, this technique finds a control input ‘’ that minimizes the cost function
where Q and R are the user-defined weighting matrices and . It is assumed that Q is positive semi-definite (all the eigenvalues of are non-negative) and is positive definite (all the eigenvalues of are positive). The weighting matrices affect how LQR minimizes the function and are, essentially, tuning variables. Here, is the state vector and is the servo motor voltage input .
Given the control law , the state-space of the closed loop system becomes
where is given by
is the controller gain vector. Note that the input voltage is scalar, and therefore, is also scalar. In practice, the weighting matrices and are chosen to be diagonal. A simple way for choosing and is using the Bryson's rule. This method works best when control design specifications regarding the system response and control input are given in terms of limits on excursions from equilibrium.
Assuming the time-domain design specifications are
Then one can use the Bryson’s rule to choose the weighting matrices as
Further tuning of and may be required for improving the controller performance. Note that increasing means increasing the penalty on the control input (using less control effort). Similarly, increasing means increasing the penalty on the states (states reaching equilibrium position quickly and with less overshoot). Matrix sets the weight on the states and determines how will minimize (and hence how it generates gain ).
In our case,
Substituting and in Eqn. 9 gives
where , , , ,
On observing Eq. 12, it can be seen that increasing causes control input to work harder to minimize state , which will predominately increase. If is increased, then will increase to compensate for the larger weight placed on state . Depending on the model, changing a single can affect multiple gains because each state is not independent. If is increased, then control input has to work less to minimize. In that case, LQR would generate a lower overall value of. A block diagram of the system with fill state feedback controller is shown in Figure 1.
The feedback control loop in Figure 1 is designed to stabilize the servo to a desired position,, while minimizing the deflection of the flexible link, where is the state column vector and is the gain row vector as shown earlier. Note that isidentity matrix and is column of zeros in Figure 1.
The reference state is defined as
and the controller is
Controller Specifications:
The following specifications in the time domain are to be met when the rotary arm is tracking a step change in its angular position.
Specification 1: Servo angle 2% settling time:
Specification 2: Servo angle percentage overshoot:
Specification 3: Maximum link angle deflection:
Specification 4: Maximum control effort (voltage):
Controller Design Procedure:
Note: The results from the following steps have to be included in the Analysis section of the report.
Obtain the and matrices of the system using the parameters from Part A: System identification. Check your A and B matrices with the TA.
Using Bryson’s rule (Eq. 12-15) calculate and matrices, based on the following suggested maximum values of state and control excursions:
Check if and (by finding eigenvalues of the matrix).
Using the
lqr
command in MATLAB, calculate the optimal feedback gain vector . Thelqr
command solves the Algebraic Riccati equation which is required to determine the gain vector is>>
[K,S,E] = lqr(A,B,Q,R);
where is the gain matrix, is the solution to the Riccati equation and E are closed loop system poles. Check your gain matrix K with the TA.
Using Figure 1 as a guide, develop a Simulink model of the system.
Note: SIMULINK references the current MATLAB workspace when setting variables. Use the variable names for the system matrices and and the control gain matrix from your MATLAB script file for the LQR design.
Make sure to include servo position command input, saturation blocks, and appropriate outputs. Use scopes and To Workspace blocks so that reference, output, and response signals can be tracked. (Make sure to maintain consistency between deg and rad in SIMULINK)
Using the controller gains found in step 3, simulate the closed loop system for a step servo position command of over a 10s duration.
Record (and plot for lab report) the servo angle () link angle () and voltage input .
Check if all the given specifications are met.
If not, keep adjusting the and weighting matrices parameters, till all specifications are met. Record the final Q and R matrices, the servo angle (), link angle () and voltage input plots.
Study in simulation the degradation, if any, in closed loop system performance (in meeting the given specifications) using partial feedback. For partial feedback consider feedback of servo angle () and servo angle rate ().
This is easily done by retaining the gain value of the chosen feedback loops and zeroing out the remaining gains in the gain matrix used in your Simulink model.
Check your plots with the TA.
Check if the specifications are met (no need to tune Q and R matrices.)
Record (and plot for lab report) the servo angle () link angle () and voltage input
C. Controller Implementation and Evaluation
In this experiment, the servo position is controlled while minimizing the link deflection using the LQR based control found. Measurements will then be taken to ensure that the specifications are satisfied.
Warning: In closed loop experiments, the link may swing around rather quickly. Stay clear of it during closed loop experiments.
Experiment
Turn the amplifier power on.
Download the q_flex.zip and open the Simulink file q_flex for controller implementation. This is the block diagram for this part of the experiment. Make sure you have K gain variable in the MATLAB workspace. Note: The Smooth Signal Generator block generates a 0.33 Hz square wave (with amplitude of 1) that is passed through a Rate Limiter block to smooth the signal (Rising slew rate of 100 and falling slew rate of -100). The Amplitude (deg) gain block is used to change the desired servo position command. The state-feedback gain K is set in the LQR Control gain block and is read from the MATLAB workspace.
Align the flexible link along the 0 mark on the servo stand.
Double click on the scopes and open them.
Ensure that the manual switch is connected to the full state feedback.
A periodic square wave is given as input voltage to the servo motor, causing the link to move left and right alternately for 10 seconds.
Copy the response data to your group folder. The response data is saved in variables data_theta, data_alpha, and data_vm. DO NOT DELETE or SAVE THE SIMULINK MODEL.
Connect the manual switch to the partial state feedback and repeat steps 4-9 again. Make sure your files name is different from full state feedback.
Turn the power off.
Results & Questions for Report
Control Design
Results
Include the results from the controller design procedure Steps 1-6.
Questions
Estimate the bandwidth for your full state and partial state feedback controllers.
Estimate the stability margins (gain and phase margins) of your full state and partial state feedback controllers.
Controller Implementation
Results
Plots of servo angle, link deflection angle and input voltage vs time for full state and partial state feedback. Compare the results and explain the differences.
Run the Simulink that you built in control design with the same command input used in the experiment. Compare the simulated response with the experimental response for both full state and partial state feedback and explain any differences between them. Note 1: Generate two sets of figures with one set containing the plots of simulation and experiment for full state feedback and the second set containing the plots of simulation and experiment for full state feedback. For each feedback case, the simulated response and corresponding experimental response must be on the same graph. Note 2: Average the first few seconds of the experimental data to obtain initial conditions for your state-space block in Simulink.
Questions
Explain why the link deflection angle goes opposite to servo rotation initially.
For a controllable system, can partial state feedback guarantee stability like full state feedback? Briefly explain.
Last updated
Was this helpful?