E Design Study: Block on Beam

Figure 20.1 shows the system. The position of the block measured from the pivot point is \(z\) and the speed of the block along the direction of the beam is \(\dot{z}\). The angle of the beam from level is \(\theta\) and the angular speed of the beam is \(\dot{\theta}\). Gravity acts in the down direction. The mass of the block is \(m_1\) and the mass of the beam is \(m_2\). The length of the beam is \(\ell\). An external vertical force is applied at the end of the beam as shown in Fig. 20.1.
Use the following physical parameters: \(m_1=0.35\) kg, \(m_2=2\) kg, \(\ell=0.5\) m, \(g=9.8\) m/s\(^2\).
E.2 Kinetic energy.
E.3 Equations of Motion.
E.4 Linearize equations of motion.
E.5 Transfer function model.
E.6 State-space model.
E.8 Successive loop closure.
E.9 Integrators and system type.
E.P.6 Root locus PID.
E.10 Digital PID.
E.11 Full state feedback.
E.12 Full state with integrator.
E.13 Observer based control.
E.14 Disturbance observer.
E.15 Frequency Response.
E.16 Loop gain.
E.17 Stability margins.
E.18 Loopshaping design.
Homework E.2
(a) Using the configuration variables \(z\) and \(\theta\), write an expression for the kinetic energy of the system. Assume that the block is a point mass with mass concentrated near the surface of the beam (i.e., it is not a tall block).
(b) Create an animation of the block on beam system. The inputs should be \(z\) and \(\theta\). Turn in a screen capture of the animation.
Homework E.3
(a) Find the potential energy for the system.
(b) Define the generalized coordinates.
(c) Find the generalized forces and damping forces.
(d) Derive the equations of motion using the Euler-Lagrange equations.
(e) Referring to Appendices 25, 26, and 27, write a class or s-function that implements the equations of motion. Simulate the system using a variable force input. The output should connect to the animation function developed in homework E.2. Do not be surprised if the system does not behave well (i.e., the block seems to go off to infinity in one direction).
Homework E.4
For the block-beam system:
(a) Find the equilibria of the system.
(b) Linearize the system about the equilibria using Jacobian linearization.
(c) If possible, linearize the system using feedback linearization.
Homework E.5
For the block on beam system:
(a) Start with the linearized equations and use the Laplace transform to convert the equations of motion to the s-domain.
(b) Find the transfer functions from the input \(\tilde{F}(s)\) to the outputs \(\tilde{Z}(s)\) and \(\tilde{\Theta}(s)\). Find the transfer function from the input \(\tilde{\Theta}(s)\) to the output \(\tilde{Z}(s)\).
(c) Assume that deviations in the gravity torque away from the equilibrium torque due to motions of the block along the beam are small compared to the torque required to hold up the beam. This will allow you to ignore the \(m_1 g \tilde{z}\) term in the second equation of motion. How does this simplify your transfer functions?
(d) Draw a block diagram of your simplified system transfer functions in a cascade from the input \(\tilde{F}(s)\) to the intermediate state \(\tilde{\Theta}(s)\) and then to the output \(\tilde{Z}(s)\) .
Homework E.6
Defining the states as \(\tilde{x}=(\tilde{z},\tilde{\theta},\dot{\tilde{z}},\dot{\tilde{\theta}})^{\top}\), the input as \(\tilde{u}=\tilde{F}\), and the measured output as \(\tilde{y}=(\tilde{z},\tilde{\theta})^{\top}\), find the linear state-space equations in the form \[\begin{aligned} \dot{\tilde{x}} &= A\tilde{x} + B\tilde{u} \\ \tilde{y} &= C\tilde{x} + D\tilde{u}. \end{aligned}\]
Homework E.8
For the block and beam problem, do the following:
(a) Using the principle of successive loop closure, draw a block diagram that uses PD control for both inner loop control and outer loop control. For design purposes, let the equilibrium position for the block be \(z_e=\frac{\ell}{2}\). The input to the outer loop controller is the desired block position \(z_r\) and the output of the controller is the desired beam angle \(\tilde{\theta}_r\). The input to the inner loop controller is the desired beam angle \(\tilde{\theta}_r\) and the output is the force \(\tilde{F}\) on the end of the beam.
(b) Focusing on the inner loop, find the PD gains \(k_{P_\theta}\) and \(k_{D_\theta}\) so that the rise time of the inner loop is \(t_{r_\theta}=0.25\) second, and the damping ratio is \(\zeta_{\theta}=0.707\).
(c) Find the DC gain \(k_{DC_\theta}\) of the inner loop.
(d) Replacing the inner loop by its DC gain, find the PD gains \(k_{P_z}\) and \(k_{D_z}\) so that the rise time of the outer loop is \(t_{r_z}=10 t_{r_\theta}\) and the damping ratio is \(\zeta_z=0.707\).
(e) Implement the successive loop closure design for the block and beam in simulation where the commanded block position is given by a square wave with magnitude \(0.25\pm 0.15\) meters and frequency \(0.05\) Hz. Use the actual position in the block as a feedback linearizing term for the equilibrium force.
(f) Suppose that the size of the input force on the beam is limited to \(F_{\max}=15\) N. Modify the simulation to include a saturation block on the force \(F\). Using the rise time of the outer loop, tune the PD control law to get the fastest possible response without input saturation when a step of size \(0.25\) meter is placed on \(\tilde{z}^r\).
Homework E.9
(a) When the inner loop controller for the block-beam system is PD control, what is the system type of the inner loop? Characterize the steady-state error when \(\tilde{\theta}^d\) is a step, a ramp, and a parabola. What is the system type with respect to an input disturbance?
(b) When the outer loop controller for the block-beam is PD control, what is the system type of the outer loop? Characterize the steady-state error when \(z^d\) is a step, a ramp, and a parabola. How does this change if you add an integrator? What is the system type with respect to an input disturbance for both PD and PID control?
Homework E.P.6
Add an integrator to obtain PID control for the outer loop of the
block-beam system. Put the characteristic equation in Evans’ form and
use the MATLAB rlocus command to plot the root locus versus
the integrator gain \(k_I\). Note that
since the integrator gain will be negative, the transfer function in
Evans’ form must be negated because the MATLAB rlocus
command only plots the return for \(k_I>0\). Select a value for \(k_I\) that does not significantly change
the other locations of the closed-loop poles.
Homework E.10
The objective of this problem is to implement the PID controller using only measured outputs of the system.
(a) Modify the system dynamics file so that the parameters \(m_1\), \(m_2\), and \(\ell\) vary by up to 20% of their nominal value each time they are run (uncertainty parameter = 0.2). Also add a disturbance step input of magnitude \(0.5 N\).
(b) Change the simulation files so that the input to the controller is the output and not the state. Implement the nested PID loops in Problems E.11 in a separate class. Use the dirty derivative gain of \(\sigma=0.05\). Tune the integrators so that there is no steady-state error. The controller should only assume knowledge of the position \(z\), the angle \(\theta\), and the reference position \(z_r\).
(c) Note that the integrator gain will need to be negative which will cause problems for the anti-windup scheme that we have been implementing. Remove the old anti-windup scheme and implement a new scheme where the integrator only winds up when \(|\dot{z}|\) is small. You may also need to re-tune the rise time for the inner loop (due to the parameter uncertainty and disturbance input). Some combinations of uncertain parameters are very hard to recover from, so run your simulation multiple times before changing your gains significantly.
Homework E.11
The objective of this problem is to implement a state feedback controller for the block and beam problem. Start with the simulation files developed in Homework E.10.
(a) Using the values for \(\omega_{n_z}\) and \(\zeta_z\) from Homework E.8, choose the desired locations of the four closed-loop poles so that their natural frequency is greater than \(\omega_{n_z}\) and damping ratio is greater than \(\zeta_z\).
(b) Add the state-space matrices \(A\), \(B\), \(C\), \(D\) derived in Homework E.6 to your param file.
(c) Verify that the state-space system is controllable by checking that \(\text{rank}(\mathcal{C}_{A,B})=n\).
(d) Find the feedback gain \(K\) such that the eigenvalues of \((A-BK)\) are equal to the desired closed-loop poles. Find the reference gain \(k_r\) so that the DC gain from \(z_r\) to \(z\) is equal to one.
(e) Implement the state feedback scheme in simulation and tune the closed-loop poles to vary the response of the system. Notice the effect of pole locations on the speed of response and the control effort required.
Homework E.12
(a) Modify the state feedback solution developed in Homework E.11 to add an integrator with anti-windup to the feedback loop for \(z\).
(b) Add a constant input disturbance of 1 Newtons to the input of the plant and allow the plant parameters to vary up to 20%.
(c) Tune the integrator pole (and other gains if necessary) to get good tracking performance.
Homework E.13
The objective of this problem is to design an observer that estimates the state of the system and to use the estimated state in the controller designed in Homework E.12.
(a) For the sake of understanding the function of the observer, for this problem we will use exact parameters, without an input disturbance. Modify the block beam dynamics so that the parameters known to the controller are the actual plant parameters (uncertainty parameter \(\alpha=0\)).
(b) Verify that the state-space system is observable by checking that \(\text{rank}(\mathcal{O}_{A,C})=n\).
(c) In the control block, add an observer to estimate the state \(\hat{x}\), and use the estimate of the state in your feedback controller. Tune the poles of the controller and observer to obtain good performance.
(d) Modify the simulation files so that the controller outputs both \(u\) and \(\hat{x}\). Add a plotting routine to plot both the state and the estimated state of the system on the same graph.
(e) As motivation for the next chapter, add an input disturbance to the system of \(0.5\) and observe that there is steady-state error in the response even though there is an integrator. This is caused by a steady-state error in the observation error. In the next chapter we will show how to remove the steady-state error in the observation error.
Homework E.14
(a) Modify your solution from HW E.13 so that the uncertainty parameter is \(\alpha=0.2\), representing 20% inaccuracy in the knowledge of the system parameters, and so that the input disturbance is \(0.5\). Also, add noise to the output channels \(z_m\) and \(\theta_m\) with standard deviation of \(0.001\).
(b) Add a disturbance observer to the controller, and verify that the steady-state error in the estimator has been removed. Tune the system to get good response.
Homework E.15
(a) Draw by hand the Bode plot of the inner loop transfer function from
force \(\tilde{F}\) to angle \(\tilde{\theta}\) for the block-beam system.
Use the bode command from MATLAB or Python and compare your
results.
(b) Draw by hand the Bode plot of the outer loop transfer function from
angle \(\tilde{\theta}\) to position
\(\tilde{z}(t)\) for the block-beam
system. Use the bode command and compare your results.
Homework E.16
For the inner loop of the block-beam system, use the MATLAB or Python
bode command to create a graph that simultaneously displays
the Bode plots for (1) the plant, and (2) the plant under PD control,
using the control gains calculated in
Homework E.8. Use the dirty derivative
when implementing the derivative portion of the PD control.
(a) To what percent error can the closed-loop system under PD control track the desired input if all of the frequency content of \(\theta_r(t)\) is below \(\omega_r = 1.0\) radians per second?
(b) If the frequency content of the input disturbance is all contained below \(\omega_{d_{in}}=0.8\) radians per second, what percentage of the input disturbance shows up in the output?
(c) If all of the frequency content of the noise \(n(t)\) is greater than \(\omega_{no} = 300\) radians per second, what percentage of the noise shows up in the output signal \(\theta\)?
For the outer loop of the block-beam, use the MATLAB or Python
bode command to create a graph that simultaneously displays
the Bode plots for (1) the plant, and (2) the plant under PID control
using the control gains calculated in
Homework E.10. Use the dirty
derivative when implementing the derivative portion of the PID
control.
(d) If the frequency content of an output disturbance is contained below \(\omega_{d_{out}}=0.1\) radian/sec, what percentage of the output disturbance will be contained in the output under PID control?
(e) If the reference signal is \(y_r(t) = 2\sin(0.6 t)\) what is the output error under PID control?
Homework E.17
For this problem, use the gains found in HW E.10.
For the inner loop of the block-beam system, use the
bodeandmargincommands (from MATLAB or Python) to find the phase and gain margin for the inner loop system under PD control. On the same graph, plot the open-loop Bode plot and the closed-loop Bode plot. What is the bandwidth of the closed-loop system, and how does this relate to the crossover frequency?For the outer loop of the block-beam system, use the
bodeandmargincommands to find the phase and gain margin for the outer loop system under PID control. Plot the open and closed-loop Bode plots for the outer loop on the same plot as the open and closed-loop Bode plots for the inner loop. What is the bandwidth of the closed-loop system, and how does this relate to the crossover frequency?What is the bandwidth separation between the inner (fast) loop, and the outer (slow) loop? For this design, is successive loop closure justified?
Homework E.18
For this homework assignment we will use the loopshaping design technique to design a successive loop closure controller for the block and beam problem.
First consider the inner loop, where \(P_{in}(s)\) is the transfer function of the inner loop derived in HW E.5. Design the inner control system \(C_{in}(s)\) to stabilize the system with a phase margin close to 60 degrees, and to ensure that reference inputs with frequency below \(\omega_r=1\) radians/sec have tracking error \(\gamma_r=0.0032\), and to ensure that noise above \(\omega_n=1000\) radians/second is rejected by \(\gamma_n=0.0032\).
Now consider the design of the controller for the outer loop system. The ‘plant’ for the design of the outer loop controller is \[P = P_{out}\frac{P_{in}C_{in}}{1+P_{in}C_{in}}.\] Design the outer loop controller \(C_{out}\) so that the system is stable with phase margin close to \(PM=60\) degrees, and so that constant input disturbances are rejected, reference signals with frequency below \(\omega_r=0.1\) radians/sec are tracked with error \(\gamma_r=0.01\), and noise with frequency content above \(\omega_n=100\) radians/sec are rejected with \(\gamma_n=0.001\). Add a prefilter \(F(s)\) to reduce peaking in the closed-loop transfer function.
Implement the developed control strategy in simulation using the state-space equivalents of \(C(s)\) and \(F(s)\).