Opening the book…
After completing this section, you will be able to:
- Build a Simulink simulation model for the three-wheel cart to generate individual wheel speed feedback outputs.
- Develop the Simulink SiL (software-in-the-loop) environment for the three-wheel car’s duel-PID control.
- Set up the Simulink SiL environment for the three-wheel cart’s triple-PID control.
- Develop the Simulink SiL environment for the three-wheel cart’s linear quadratic tracking with integral (LQTI) control.
This section discusses the simulation studies of the three control strategies of the three-wheel cart developed in Sections 9.2 and 9.3. These are dual-PID, triple-PID, and LQTI control designs. In order to conduct simulation studies, Figure 9.13 develops a new Simulink three-wheel cart model. It makes both left and right wheel speed signals available as model outputs so that the dual- and triple-PID control strategies can be implemented.
The Simulink model in Figure 9.13 was developed based upon the state-space model developed in Section 9.3 described by equations \ref{9.44} and \ref{9.45}. When \(θ_z=0\), the linear time invariant (LTI) model is described by state-space model matrices \(A_{p0}\), \(B_{p0},\ C_p\), and \(H_p\) defined in equation \ref{9.45}. When \(θ_z\neq 0\), the effect of the wheel-slip is modeled based upon state-space matrices \(A_{pθ}\), \(B_{pθ},\ \)and \(D_p\) defined in equation \ref{9.45}. The three-wheel cart turning motion is a sum of two motions. One is the speed difference \({\dot{\phi }}_x\ \)between left and right wheels, called Phi_dot_Linear in Figure \ref{9.13}. The other is the turning due to wheel lateral-slip \({\dot{\phi }}_g\) on unleveled ground, called Phi_dot_g in Figure \ref{9.13}. We calculate both left and right wheel speed signals based upon the cart speed and turning motion due to the wheel-speed difference. The Simulink model shown in equation \ref{9.9} does not have individual wheel speed output.
The three-wheel cart Simulink model in Figure 9.13 is capable of cart turning angle and speed outputs. Now it is ready to conduct SiL (software-in-the-loop) simulation studies for the dual-PID control strategy. Figure 9.14 shows the SiL simulation Simulink diagram. It includes the details of the model from Figure 9.13 and the two PID controller models from Figure 8.11, with their outputs saturated at \(\pm 12\) volts. There are two inputs to the two PID controllers. One is the three-wheel cart speed reference and the other is its turning speed. The three-wheel cart speed reference is converted to individual wheel speed reference by dividing the wheel radius. The turning angular speed is converted to the positive and negative wheel reference signals by dividing two times of wheel radius over the cart turning radius. Both saturation blocks limit the motor armature voltages to \(\pm 12\) volts. Zero-order sample and hold devices are used to send control signals to both DC motors and read feedback signals for both PID controllers with a sample period of \(0.01\) second. The simulated sixteen outputs are saved to a MATLAB data structure named as “out.mat.”
The PID control gains of the left and right wheel speed controllers, shown in Figure 9.14, are carefully tuned. Table 9.2 shows the resulting gains. The gains listed in the last column are not for this study; they will be used later for the triple-PID control strategy.
| PID type | Left wheel speed | Right wheel speed | Turning speed |
|---|---|---|---|
| Proportional | \(K_{pL}=3\) | \(K_{pR}=3\) | \(K_{pT}=300\) |
| Integral | \(K_{dL}=0.1\) | \(K_{dR}=0.1\) | \(K_{dT}=20\) |
| Derivative | \(K_{iL}=1\) | \(K_{iR}=1\) | \(K_{iT}=100\) |
For the dual-PID control strategy, we will conduct two simulation studies with the same reference signals for both three-wheel cart speed and turning speed, but with different ground level angles of \(θ_z\) and \(θ_y\). For the first study, we set both \(θ_z\) and \(θ_y\) to zero. That is, there is no wheel-slip due to leveled ground. For the second study, we set \(θ_z\) and \(θ_y\) to \(0.02\ rad\) and zero respectively. Figure 9.15 shows the simulation result for the first study.
Figure 9.15 has six subplots. From top to bottom, they are three-wheel cart speed \({\dot{x}}_{cart}\); cart combined turning speed \(\dot{\phi }\ \)and turning speed \({\dot{\phi }}_g\) due to wheel lateral-slip; cart angle \(\phi\); left and right wheel speed signals (\({\dot{θ}}_{wL}\) and \({\dot{θ}}_{wR}\)); cart speed and turning speed references (\(r_{cart}\) and \(r_{\phi }\)); and left and right motor control signals (\(u_{aL}\) and \(u_{aR}\)). We can see that the first two seconds of simulations are with the zero reference speeds for both cart and turning speeds. As a result, all signals shown are at rest (zero). Between the 2nd and 4th second, the card reference speed \(r_{cart}\) becomes \(0.1\) (\(m/s\)); see the fifth plot. Held at \(0.1\), we can see that the car speed accelerates to \(0.1\) (\(m/s\)) and decelerates to zero within about \(0.4\) second, with similar patterns for both left and right wheel speeds. Large motor control voltages are used during acceleration and deceleration.
Between the 5th and 7.5th second, the card reference turning speed becomes \(0.2\) (rad/s); see the fifth plot. Held at \(0.2\), we can see that the car tried to accelerate its turning speed to \(0.2\) (rad/s), but did not reach its \(0.2\) (rad/s) target at the 7.5th second. Deceleration starts at the 7.5th second; see the second plot. Both left and right wheel speeds have similar patterns; see the fourth plot. The cart turning angle keeps increasing during this process. Due to relatively slow dynamics of cart turning, the turning response is relatively slow compared with the cart speed. The turning response will be significantly improved by the triple-PID strategy. In addition, during the turning, we can see that the motor control voltages are in opposite directions.
The second simulation of the dual-PID control strategy is for the case with \(θ_z\mathrm{=0.02\ (rad)}\) and \(θ_{\mathrm{y}}\mathrm{=0}\). That is, the ground is slightly unleveled with about \(3.6\) degrees. PID wheel speed control gains used are the same as these used for the study shown in Figure 9.15 and Table 9.2. The only change is the change of \(θ_z\) from zero to \(\mathrm{0.02\ (rad)}\).
Figure 9.16 shows the results of this study. It again has six subplots. These are three-wheel cart speed; cart turning speed and turning speed due to wheel lateral-slip; cart angle; left and right wheel speed signals; cart speed and turning speed references; and left and right motor control signals. The first two seconds of simulations are with the zero-reference speed for both cart and turning speeds. As a result, all signals simulated are at rest (zero). Between the 2nd and 4th second, the card reference speed becomes \(0.1\) (\(m/s\)); see the fifth plot. Held at \(0.1\), we can see that the car speed accelerates to \(0.1\) (m/s) and decelerates to zero within about 0.4 second with similar patterns for both left and right wheel speeds. Similar to the case of \(θ_z=0\), we can see large transient motor control voltages at the beginning of acceleration and deceleration. Unlike the case of \(θ_z=0\) in Figure 9.15, and due to \(θ_z\mathrm{=0.02\ (rad)}\), wheel lateral-slip occurs between the 2nd and 4th second, peaks at the 4th second (about \(-0.18\ rad/s\)), and recovers after the 4th second (or between the 4th and 5th) due to reduced cart speed.
Between the 5th and 7.5th second, the card reference turning speed becomes \(0.2\) (rad/s); see the fifth plot. Held at \(0.2\), we can see that the car turn speed accelerates to \(0.2\) (rad/s) slowly, but does not reach its target. Deceleration starts at the 7.5th second; see the second plot. There are opposite patterns for the left and right wheel speeds. see the fourth plot. The cart turning angle keeps increasing. Similar to the previous case, the turning response is relatively slow compared with the cart speed due to relatively slow dynamics of the cart turning.
Using the three-wheel cart Simulink model developed in Figure 9.13, we can now conduct an SiL simulation for the triple-PID control strategy. Figure 9.17 shows the Simulink diagram. The details of the three-wheel cart model were shown in Figure 9.13. The two PID controller models used for controlling both left and right motors have their output saturated at \(\pm 12\) volts (see Figure 8.11). An additional PID controller is added. Its cart turning speed error is input and its corrected wheel speed difference is output; see Figure 9.11 for control strategy architecture.
The three PID controllers have two inputs. One is the three-wheel cart speed reference and the other is its turning speed; see the left side of Figure 9.17. The three-wheel cart speed reference is converted to individual wheel speed reference by dividing the wheel radius. The turning reference speed is used by the third PID controller directly to generate the turning speed error. Both voltage saturation blocks limit the motor armature voltages to \(\pm 12\) volts. Zero-order sample and hold devices are used for control signals going to the DC motors and three feedback signals going to the PID controllers with a sample period of \(0.01\) second. The simulated fifteen outputs are saved to a MATLAB data structure named as “out.mat.”
For the triple-PID control strategy, we will conduct two simulation studies with the same reference signals for both three-wheel cart speed and turning speed, but with different ground level angles of \(θ_z\) and \(θ_y\). For the first study, both \(θ_z\) and \(θ_y\) are set to zero. There is no wheel lateral-slip due to leveled ground. For the second study, both \(θ_z\) and \(θ_y\) are set to \(0.02\) rad and zero, respectively.
Figure 9.18 shows the simulation result for the first study. It has six subplots. From top to bottom, they are three-wheel cart speed; cart turning speed and turning speed due to wheel lateral slip; cart angle; left and right wheel speed signals; cart speed and turning speed references; and left and right motor control signals. As before, we can see that the first two seconds of simulations are with the zero reference speeds for both cart and turning speeds. As a result, all signals shown are at rest (zero).
Between the 2nd and 4th second, the card reference speed becomes \(0.1\) (m/s); see the fifth plot. Held at \(0.1\), we can see that the car speed accelerates to \(0.1\) (m/s) and decelerates to zero within about \(0.3\) second, with similar patterns for both left and right wheel speeds. Large motor control voltages are used at the beginning of acceleration and deceleration. Between the 5th and 7.5th second, the card reference turning speed becomes \(0.2\) (rad/s); see the fifth plot. Held at \(0.2\), we can see that the car turning speed accelerates to \(0.2\) (rad/s) and reaches its target in about one second. Deceleration starts at the 7.5th second (second plot from top) with an opposite pattern for left and right wheel speeds (fourth plot from top). The turning response is much fast than the dual-PID control case, but is relatively slow compared with the cart speed due to slow dynamics of cart turning. In addition, during the turning, the motor control voltages are in the opposite direction and saturated at the beginning of acceleration and deceleration (see the bottom plot).
The second simulation of the triple-PID control strategy is for the case with \(θ_z\mathrm{=0.02\ (rad)}\) and \(θ_{\mathrm{y}}\mathrm{=0}\). That is, the ground is slightly unleveled with about \(3.6\) degrees. Table 9.2 shows the gains of the three PID controllers used in this study. The only change is the change of \(θ_z\) from zero to \(\mathrm{0.02\ (rad)}\).
Figure 9.19 shows the results of this study. It has six subplots. They are from top to bottom three-wheel cart speed; cart turning speed and turning speed due to wheel lateral slip; cart angle; left and right wheel speed signals; cart speed and turning speed references; and left and right motor control signals. The first two seconds of simulations are with the zero-reference speed for both cart and turning speeds. As a result, all signals simulated are at rest (zero). Between the 2nd and 4th second, the card reference speed becomes \(0.1\) (m/s); see the fifth plot. Held at \(0.1\), we can see that the car speed accelerates to \(0.1\) (m/s) and decelerates to zero within about 0.5 second with similar patterns for both left and right wheel speeds. Due to wheel lateral-slip, the cart speed response becomes slow. Similar to the case of \(θ_z=0\), large transient motor control voltages can be observed at the beginning of acceleration and deceleration.
This is different from the case of \(θ_z=0\). Because \(θ_z\mathrm{=0.02\ (rad)}\), wheel-slip occurs between the 2nd and 4th second; see the red-line in the second plot. It recovers after the 4th second (or between the 4th and 5th). However, due to the third PID controller, the overall cart turning speed remains close to zero (peak at \(0.03\ rad/s\)) between the 2nd and 5th second. The associated turning angle is close to zero; see the third plot. Left and right wheel speeds are quite different to compensate for the wheel slip. Between the 5th and 7.5th second, the card reference turning speed becomes 0.2 (rad/s); see the fifth plot. It is held at \(0.2\). We can see that the car turning speed is accelerating to \(0.2\) (rad/s) within one second and decelerating at the 7.5th (2nd plot) with similar patterns for both left and right wheel speeds (fourth plot). The cart turning angle keeps increasing. In this case, the turning response remains relatively close to the cart speed due to closed-loop control.
Our last simulation study is for the model-based LQTI strategy presented in Section 9.3. See equation \ref{9.60} for the state feedback gain and equation \ref{9.61} for the associated closed-loop pole locations. We found that the LQTI control gain in equation \ref{9.60} is small and cannot reach desired performance. As a result, the set of LQTI weighting matrices \(Q_{cpi}\) and \(R_{cpi}\) was adjusted to \(Q_{cpi}=diag\ \left[{10}^4,\ {10}^6,\ {10}^3,\ {10}^3\right]\) and \(R_{cpi}=1\ \)with \(A_{cpi}\left(3:4,3:4\right)\) set to \(A_{cpi}\left(3:4,3:4\right)=-0.001I_{2\times 2}=-εI_{2\times 2}\). Thus, a positive definite solution for Riccati equation \ref{9.59} exists. Large weightings on the cart and turning speed errors (\(q_{11}\) and \(q_{22}\)) are used to increase proportional gains associated with these errors. The resulting state feedback gain is shown below with control \(\Delta u_{cpi}=-K_{cpi}{\Delta x}_{cpi}\).
\[K_{cpi}=\left[ \begin{array}{cccc} 70.7185 & 708.5808 & -22.2894 & -21.6632 \\ 70.7185 & -708.5808 & -22.2894 & 21.6632 \end{array} \right] \label{9.62}\]
The control gains in equation \ref{9.62} are significantly increased, compared with these shown in equation \ref{9.60}. These weighting coefficients in matrix \(Q_{cpi}\) are manually adjusted based on the simulation results.
The associated closed-loop system pole locations are listed in equation \ref{9.63}. The closed-loop system is asymptotically stable. Poles \(s_1\) and \(s_2\) are associated with the closed-loop turning dynamics, and \(s_3\) and \(s_4\) are associated with the closed-loop driving dynamics. The four real-pole locations are comparable with those for the LQTI design in equation \ref{9.52} with two very fast pole locations, indicating that the closed-loop system is stable.
\[\begin{aligned} s_1 &=-0.0316, \\[4pt] s_2 &=-0.3162 \\[4pt] s_3 &=-13.5764, \\[4pt] s_4 &=-34.9452 \end{aligned} \label{9.63}\]
This study utilizes the same three-wheel cart Simulink model from Figure 9.13. The simulation results are comparable with the dual- and triple-PID control strategies. For the LQTI controller implementation, we use a sample rate of \(100\ Hz\) (or sample period of \(0.01\) second) for both control inputs and feedback measurements. Zero-order sample and hold devices are used. For the LQTI control strategy implementation, these four feedback states are multiplied by control gain \(K_{cpi}\). The first two states are formed by cart and turning speed signals, sampled at \(100\ Hz\) from the three-wheel cart model, minus their references. We calculate the other two states (integrals of cart and turning speed signal) as part of the control strategy using digital integration logics. In the integration calculation, coefficients \(K\) and \(T_s\) are set to \(1.0\) and \(0.01\) second, respectively; see Figure 9.20 for the digital integration blocks. The feedforward control signals \(u_{aL0}\) and \(u_{aR0}\) are set to zero. Nonzero feedforward control will be used in experimental validation in Section 9.6. Figure 9.20 shows the entire Simulink block diagram. The simulated data are saved into a MATLAB data structure in a data file called “out.mat.” To ensure that both motors are within their operational ranges, motor armature voltages (control outputs) are saturated to \(\pm 12\) volts.
For the LQTI control strategy, we will conduct two simulations with the same reference signals as those for the triple-PID strategy, but with different ground level angles of \(θ_z\) and \(θ_y\). For the first study, both \(θ_z\) and \(θ_y\) are set to zero. That is, there is no wheel lateral-slip due to unleveled ground. For the second study, both \(θ_z\) and \(θ_y\) are set to \(0.02\ rad\) and zero, respectively.
Figure 9.21 shows the simulation result for the first study. The figure has six subplots. From top to bottom, they are three-wheel cart speed; cart turning speed and turning speed due to wheel lateral slip; cart angle; left and right wheel speed signals; cart speed and turning speed references; and left and right motor control signals. As before, we can see that the first two seconds of simulations are with the zero reference speeds for both cart and turning speeds. As a result, all signals shown are at rest (zero). Between the 2nd and 4th second, the card reference speed becomes \(0.1\) (m/s); see the fifth plot. Held at \(0.1\), we can see that the car speed accelerates to \(0.1\) (m/s) and decelerates to zero within about \(0.15\) second response time with similar patterns for both left and right wheel speeds. This response is faster than the triple-PID case of \(0.3\) second (see Figure 9.18) mainly due to the coordinated control of both three-wheel cart speed and its turning rate and high control gain. This fast response is achieved with smaller transient armature voltage peak and valley of both DC motors than those of the triple-PID strategy.
Between the 5th and 7.5th second, the card reference turning speed becomes \(0.2\) (rad/s); see the fifth plot. Held at \(0.2\), we can see that the car turning speed accelerates to \(0.2\) (rad/s). It reaches its target in about one second, which is similar to the triple-PID control case. In this case, both motor armature voltages are saturated with the best performance possible. The turning deceleration starts at the 7.5th second; see the second plot. It has similar patterns for both left and right wheel speeds; see the fourth plot. There is no overshoot for both cart speed and turning rate responses due to all real closed-loop system poles. Similar to the triple PID case, during the turning, the motor control voltages are in the opposite direction and saturated at the beginning of acceleration and deceleration (see the bottom plot). In addition, both cartwheels spin in the opposite direction during the turning, as expected.
The second simulation of the LQTI control strategy is for the case with \(θ_z\mathrm{=0.02\ (rad)}\) and \(θ_{\mathrm{y}}\mathrm{=0}\) with the same LQTI controller shown in equation \ref{9.62}. That is, the ground is slightly unleveled with about \(3.6\) degrees. The only change made in this simulation is the change of \(θ_z\) from zero to \(\mathrm{0.02\ (rad)}\).
Figure 9.22 shows the simulation results of this study. It has six subplots. They are, from top to bottom, three-wheel cart speed; cart turning speed and turning speed due to wheel lateral slip; cart angle; left and right wheel speed signals cart speed and turning speed references; and left and right motor control signals. The first two seconds of simulations are with the zero-reference speed for both cart and turning speeds. As a result, all signals simulated are at rest (zero). Between the 2nd and 4th second, the card reference speed becomes \(0.1\) (\(m/s\)); see the fifth plot. Held at \(0.1\), we can see that the car speed accelerates to \(0.1\) (\(m/s\)) and decelerates to zero within about \(0.5\) second with similar patterns for both left and right wheel speeds. Due to wheel lateral-slip, the cart speed response slows from \(0.15\) to \(0.5\) second (\(θ_z\mathrm{=0.02}\)), which is comparable to the triple-PID case. Different from the case of \(θ_z=0\), due to \(θ_z\mathrm{=0.02\ (rad)}\), wheel lateral-slip occurs between the 2nd and 4th (see red line in the second plot) and recovers after the 4th second (or between4th and 5th), resulting in large opposite motor controls used to compensate the wheel-slip; see the bottom plot. Here, the overall cart turning speed remains close to zero (peak at \(0.015\ rad/s\) and smaller than that of triple-PID case) between 2nd and 5th second. The associated turning angle remains close to zero; see the third plot. Compared with the triple-PID case (see Figure 9.19), the LQTI control uses less control effort at the beginning (between 2nd and 2.35th second) with smaller turning speed error magnitude than the triple-PID case. This shows the advantage of the LQTI control strategy.
Between the 5th and 7.5th second, the card reference turning speed becomes \(0.2\) (rad/s); see the fifth plot. We can see that the car turning speed accelerates to its target of \(0.2\) (rad/s) within \(0.8\) second (similar to the triple-PID case). Deceleration starts at the 7.5th second (second plot) with similar patterns for both left and right wheel speeds (fourth plot). The cart turning angle keeps increasing. The turning response is much slower than the cart speed due to slow closed-loop pole locations associated with the turning motion.
Section Summary
This section conducts simulations to validate the designed controllers, including dual-PID control (Method 1), triple-PID control (Method 2), and LQTI control strategies. The dual-PID control strategy is validated with leveled and unleveled (\(θ_z\neq 0\) and \(θ_y\neq 90{}^\circ\)) ground. The triple-PID control strategy is validated next with unleveled ground, showing it is able to compensate for lateral gravity force over the dual-PID strategy. The LQTI strategy is then validated with improved performance over the triple-PID strategy. Both triple-PID and LQTI strategies can compensate for wheel lateral-slip introduced by lateral force due to unleveled ground surface. Without compensation, the cart will move to the side even though the two wheels have the same linear speed due to unleveled ground. As a summary, without wheel lateral-slip, these three control strategies present close performance, where the LQTI is the best. However, with wheel lateral-slip, the LQTI performs slightly better than the triple-PID with dual-PID strategy being the worst. In addition, the LQTI control uses less control effort than the triple-PID. The main reasons that the LQTI strategy outer-performs the triple-PID strategy are coordinated control of cart and turning speeds as well as optimal control to minimize the weighted control effort and performance. Note that LQTI strategy can handle the coupled dynamics better than the dual- and triple-PID controllers, but the control design weight selection requires certain experience to handle it.
Section Keywords
Practice Problems
- The Simulink three-wheel cart model in Figure 9.9 cannot be used for SiL simulation study. Select the answer that correctly explains why it cannot be used.
- The model is nonlinear.
- The model does not have two driving wheel speed outputs.
- The model does not consider the wheel lateral-slip dynamics.
- What is the main disadvantage of the dual-PID control strategy? Select the correct answer.
- The strategy cannot track the reference cart speed.
- The strategy has a slow cart turning response.
- The strategy cannot compensate for wheel slip motion.
- How can the triple-PID controller compensate for the wheel-slip dynamics? Select the correct answer.
- Two wheel-speed PID controllers are used to compensate for the wheel-slip motion.
- The third PID controller takes the turning speed error as input. It then generates difference wheel speed reference, used to compensate wheel-slip motion, for the two-wheel speed PID controllers.
- The third PID controller takes the turning speed error as input. It then controls left and right DC motors directly.
- Why does the LQTI controller have better performance than the triple-PID controller? Select the correct answer.
- The LQTI design weighting matrix \(Q_{cpi}\) is not optimized.
- The slow response of the sequential PID controllers.
- The LQTI control weighting is optimized with coordinated control for both cart and turning speeds.
This page titled 9.4: Simulation Study of PID and Model-Based Control Strategies was last modified on Thu, 23 Jul 2026 04:32:28 GMT and is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Guoming Zhu (Co-DREAM OER) .
The book could not be loaded just now.