8.8: Model-Based Control Experiments

Mechatronics: Fundamentals, Design, Integration, and Validation · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From LibreTexts, under CC BY-NC 4.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    8.8: Model-Based Control Experiments
    Learning Objectives

    After completing this section, you will be able to:

    1. Tune the model-based control gain experimentally.
    2. Explain how the square-pulse sample and hold input (SPSHI) can improve mini-Segway stabilization performance.

    In order to study the feasibility of using a low-cost microcontroller (Arduino MKR 1000 Wi-Fi board), we use a mini-Segway (MS) system platform to implement a regular and special sample and hold input (SHI). In this study, the inner-loop controller is a continuous-time linear quadratic regulator (CLQR). It is implemented with a 100 Hz sample rate with zero-order sample and hold input. The outer-loop is a discrete-time linear quadratic regulator (DLQR) that uses the square pulse sample and hold input (SPSHI) with a 5 Hz sample rate. It converts a non-minimum phase (NMP) continuous-time system (mini-Segway with inner-loop CLQR controller) into a discrete-time minimum-phase (MP) system. In turn, it is possible to utilize the high-gain outer-loop DLQR to further improve stabilization performance.

    After we develop and implement the MS system platform (see Section 8.7), but before we implement the outer-loop DLQR controller with SPSHI, we implement and optimize the inner-loop CLQR with ZOSHI to stabilize the MS system. We established a baseline system performance based on CLQR weight matrices \(Q_{pci}=diag[100,\ 0.1,\ 300,\ 0.1,\ 10,\ 0.01]\) and \(R_{pci}=diag[1,\ 1]\) called the initial CLQR weighting matrices. Starting from this baseline controller with weighting matrix \(Q_{pci}\) fixed, we tuned weighting matrix \(R_{pc}\) by introducing a gain coefficient \(γ_c\) such that the tuned control weighting is as below.

    \[R_{pc}(k)=γ_c(k)\ R_{pci} \label{8.85}\]

    where \(γ_c\left(k\right)=0.6,\ 0.7,\ \dots ,\ 1.2\) for \(k=1,\ 2,\ \dots ,7\) with an increment of \(0.1\). With seven continuous-time state feedback controllers designed, we implemented these controllers as a Simulink control diagram for model-based control (see problem P8.29). We conducted experiments for all seven controllers designed with responses recorded for the first six controllers with \(k=1,\ 2,\ \dots ,\ 6\); the seventh controller is not stabilizing. The mini-Segway control inputs are DC-motor armature voltages (same for both motors). Control responses are pendulum displacement \(θ_p\) and cart displacement \(x_{cart}\). These are plotted in Figure 8.44 with control input \(u_{aL}\) on the bottom plot for the left motor, pendulum displacement \(θ_p\) on the middle, and cart displacement \(x_{cart}\) on the top. In this study, both armature voltages for the left and right motors are the same. Only the left one is plotted in Figure 8.44. By carefully study these three plots, we can see that minimal pendulum position oscillation magnitude is achieved with \(γ_c=0.8\) and minimal cart displacement oscillation magnitude is achieved with \(γ_c=0.9.\)

    A MATLAB plot showing experimental mini-Segway stabilization responses using a sequence of CLQR (continuous linear quadratic regulation) controllers with control gains from low to high.
    Figure 8.44: Mini-Segway stabilization with a sequence of CLQR controllers.

    To help find out the optimal \(γ_c\), Table 8.5 shows the mean absolute values of the cart oscillation magnitude \(avg(\left|x_{cart}\left(k\right)\right|)\), pitch angle \(avg(\left|θ_p\left(k\right)\right|)\), and the corresponding control voltage \(avg(\left|u_{eL}\left(k\right)\right|)\) for \(γ_c(k)\) with \(k=1,\ 2,\ \dots ,\ 6\). The table confirms that the best performance among the six inner-loop CLQR controllers occurred for \(k=4\) (or \(γ_c=0.9\)). The corresponding optimal control gain is shown below.

    \[K_p=\left[ \begin{array}{cc} \begin{array}{ccc} -7.45 & -9.91 & -15.35 \\ -7.45 & -9.91 & -15.35 \end{array} & \begin{array}{ccc} -0.95 & 2.36 & .088 \\ -0.95 & -2.36 & -.088 \end{array} \end{array} \right] \label{8.86}\]

    \(γ_c(k)\) \(0.6\) \(0.7\) \(0.8\) \(0.9\) \(1.0\) \(1.1\)
    \(avg\left(\left|x_{cart}\left(k\right)\right|\right)\ (mm)\) \(19.35\) \(15.32\) \(18.63\) \(12.17\) 16.58 unbounded
    \(avg(\left|θ_p\left(k\right)\right|)\ (deg)\) 4.31 2.56 1.08 0.85 0.89 unbounded
    \(avg\left(\left|u_{eL}\left(k\right)\right|\right)\ (v)\) 3.96 2.44 1.16 1.00 1.10 saturated
    Table 8.5: Average magnitudes of responses and control signals.

    Figure 8.44 shows that when \(γ_c(k)\) is 0.6 (or \(k\mathrm{=1)}\), the resulting CLQR control gain is the highest. The mini-Segway system outputs (displacement and pendulum position) oscillate at very high frequencies. When \(γ_c(k)\) is 0.7 (or \(k\mathrm{=2)}\), the control gain is slightly reduced. As a result, the oscillation magnitudes of both pendulum angle and car position are reduced, but still unstable. As a result, these two \(γ_c\) values are not feasible; they do not result in stabilization response. Next, for \(γ_c(k)\) equal to \(0.8\), the closed-loop system takes about \(5\) seconds to stabilize. Thus, the closed-loop mini-Segway system stabilizes while it is unstable with \(γ_c(k)\) equal to \(0.7\) (see Figure 8.44). The closed-loop system performance is further improved with \(γ_c\) equal to \(0.9\). The cart is also stabilized with an increased oscillation magnitude when \(γ_c\) is equal to \(1.0\). Further increasing \(γ_c\) value to \(1.1\) results in unbounded oscillation magnitude for cart displacement, indicating an unstable closed-loop system. Thus, the feasible (stabilizing) of \(γ_c\) is between \(0.8\) and \(1.0\). Comparing the CLQR control gain \(K_p\) in equation \ref{8.86} designed with \(γ_c=0.9\) with the CLQR control gain \(K_p\) in equation \ref{8.79} designed with \(γ_c=1.0\), we can see that control gain increased by about \(5.4\%\).

    In general, as the control weighting \(R_{cp}\) reduces, with the state weighting fixed, the CLQR control gain increases. If the open-loop system is stable, the CLQR optimal controller is able to stabilize the closed-loop system with very large control weighting. As the control weighting reduces, the control gain increases and closed-loop performance is improved for the design model. However, due to modeling error, when the control gain is increased to a certain point, the experimental results will be unstable. As a result, there exists an optimal control gain achieving the best experimental performance [9].

    For the open-loop unstable systems like the mini-Segway, a certain level of control gain is required to stabilize the open-loop unstable system with \(R_{cp}\) bounded from above. When the gain is increased to a certain level (or \(R_{cp}\) is reduced to certain level), the closed-loop system will become unstable again due to modeling error. This is what happened for the CLQR controllers with different \(γ_c\) levels, where large and small \(R_{cp}\) levels (low and high control gains) both lead to unstable responses.

    Now, for each stabilizing inner-loop CLQR controller with \(γ_c=0.8,\ 0.9,\) and \(1.0\), the outer-loop DLQR controller was tuned accordingly to achieved optimal experimental performance. A baseline DLQR was designed first using weighting matrices as below.

    \[Q_{db}=diag\left[100,\ 0.1,\ 80,\ 0.1,\ 10,\ 0.01\right],\ \ R_{dbi}=diag[1,\ 1] \label{8.87}\]

    With these feasible CLQR controllers (\(γ_c=0.8,\ 0.9,\) and \(1.0\)), the dual-loop feasible regions, which converts inner-loop continuous-time NMP (non-minimal phase) system into discrete-time MP (minimal phase) system, are very close to that shown on Figure 8.16. The smallest feasible sampling periods are \(0.1136\), \(0.1162\), and \(0.1184\) second, respectively, for \(γ_c=0.8,\ 0.9,\) and \(1.0\). Because the feasible regions of the closed-loop systems with CLQR controllers (\(γ_c=0.8,\ 0.9,\) and \(1.0\)) using SPSHI (square pulse sample and hold input) are barely changed, the SPSHI parameter selection remains unchanged with \(p=0.2\) (duty-cycle) and \(T_s=0.2\) second (sample period).

    \(γ_d(k)\) \(\infty\) \(0.3\) \(0.5\) \(0.7\) \(0.9\) \(1.1\)
    \(avg\left(\left|x_{cart}\left(k\right)\right|\right)\ \left(mm\right),\ γ_c=0.8\) \(18.83\) \(13.50\) \(15.46\) \(16.64\) 16.89 \(15.51\)
    \(avg\left(\left|x_{cart}\left(k\right)\right|\right)\ \left(mm\right),\ γ_c=0.9\) 12.17 \(3.85\) \(5.39\) \(6.29\) \(6.84\) \(7.36\)
    \(avg\left(\left|x_{cart}\left(k\right)\right|\right)\ \left(mm\right),\ γ_c=1.0\) 16.58 \(6.63\) \(8.00\) \(10.55\) \(12.07\) \(13.29\)
    Table 8.6: Average absolute magnitudes of cart displacement as functions of \(γ_c\) and \(γ_d\).

    An experimental search of the optimal CLQR and DLQR controller combination is conducted. The three CLQR controllers are with \(γ_c=0.8,\ 0.9,\) and \(1.0\). Let \(γ_d\left(k\right)=0.3,\ 0.5,\ 0.7,\ 0.9,\) and \(1.1\) (\(k=1,\ 2,\ \dots ,\ 5\)). For each given \(γ_c\) (\(0.8,\ 0.9,\) and \(1.0)\), five DLQR controller with SPSHI are designed with state weighting matrix \(Q_{db}\) defined in equation \ref{8.87} and the control weighting \(R_{db}\left(k\right)=\ γ_d(k)R_{dbi}\) for \(k=1,\ 2,\ \dots ,\ 5\). This results in a total of fifteen DLQR controllers. Note that smaller \(γ_d\) values (such as 0.1 and 0.2) were tested. However, the corresponding DLQR gains were too large to be implemented due to control signal saturation with application of SPSHI for the mini-Segway system.

    From the system bandwidth points of view, the cart displacement state has a natural frequency of \(1.3\) Hz. The pendulum position has a natural frequency of 33.9 Hz. The outer-loop discrete-time DLQR controller sampled at 5 Hz can only improve the cart displacement performance. Therefore, control gain tuning is focused to minimize cart oscillation magnitude during pendulum stabilization. Table 8.6 lists these results for each given \(γ_c\) and \(γ_d\). The table indicates that the best performance among the three stable inner-loop CLQR and five associated outer-loop DLQR controllers is the one with \(γ_c=0.9\) and \(γ_d=0.3\). The corresponding optimal DLQR control gain is shown below, which is quite different from the design in Section 8.4; see equation \ref{8.84}.

    \[K_d=\left[ \begin{array}{cc} \begin{array}{ccc} -7.69 & -5.34 & -1.04 \\ -7.69 & -5.34 & -1.04 \end{array} & \begin{array}{ccc} -0.246 & 1.299 & .0489 \\ -0.246 & -1.299 & -.0489 \end{array} \end{array} \right] \label{8.88}\]

    Note that the controller gains associated with the pendulum motion (columns 3 and 4) are quite small, compared with the continuous-time CLQR controller. This indicates that the DLQR does not try to improve pendulum motion performance due to its low sample rate (5 Hz).

    Table 8.6 indicates that \(γ_c=0.9\) and \(γ_d=0.3\) yield the best performance improvement. Here, the oscillation magnitude with inner-loop CLQR controller (\(γ_c=0.9\) ) only is \(12.17\) (mm), and dual-loop oscillation magnitude with inner-loop CLQR controller (\(γ_c=0.9\) ) and outer-loop DLQR controller (\(γ_d=0.3\) ) is \(3.83\) (mm). As a result, a \(68.4\%\) improvement is achieved. On the other hand, the improvement is \(28.3\%\) and \(60.0\%\) for using the inner-loop CLQR controller with \(γ_c=0.8\) and \(γ_c=1.0\), respectively.

    A MATLAB plot showing experimental mini-Segway stabilization responses utilizing a CLQR (continuous linear quadratic regulation) controller alone and combination of CLQR and a set of DLQR (discrete linear quadratic regulation) controllers.
    Figure 8.45: Mini-Segway stabilization with both CLQR and DLQR-SPSHI controllers.

    Figure 8.45 shows the experimental results of the tuned outer-loop DLQR with \(γ_c=0.9\) and \(γ_d=0.3\). The experimental results in Figure 8.45 are divided into six segments. Segment I with \(γ_d=\infty\) corresponds to the responses with inner-loop CLQR controller only; it used as the baseline controller. Ideally, with \(γ_d=\infty\), the designed discrete-time DLQR controller gain is zero, leading to only the inner-loop CLQR controller active. Between Segments II and VI, \(γ_d\) increases from \(0.3\) to \(1.1\) with a \(0.2\) increment. The dual-loop experimental results with inner-loop CLQR and outer-loop DLQR-SPSHI show that the outer-loop DLQR controller with \(γ_d=0.3\) reduces the cart displacement magnitude significantly, while keeping the pendulum displacement performance almost unchanged due to the aforementioned inadequate sample frequency for pendulum motion dynamics. From Segments II to VI, with increased \(γ_d\), the cart absolute averaged displacement magnitude increases as the DLQR-SPSHI control effort decreases.

    The bottom two plots of Figure 8.45 show the overall control signals, including the inner-loop CLQR \(u_{aL}\) and outer-loop DLQR \(u_{aL}\) with SPSHI, respectively. The DLQR control signal with SPSHI is zero in Segment I because only the inner-loop CLQR controller exists. The outer-loop DLQR controller with SPSHI is activated, starting from Segment II. As \(γ_d\ \)increases, the outer-loop DLQR control gain with SPSHI decreases and the associated mean absolute cart displacement magnitude increases. The mean absolute values of the cart displacement, inner-loop CLQR control input voltage \(u_{aL}\), and outer-loop DLQR control voltage \(u_{aL}\) with SPSHI are summarized in Table 8.7, utilizing the CLQR controller designed with \(γ_c=0.9\).

    The best (smallest) mean-absolute cart displacement is highlighted in bold in Table 8.7. From the trend shown in the top plot of Figure 8.45, when \(γ_d=0.3\), the cart oscillation magnitude reaches the local minimum. Meanwhile, the cart pitch angle is slightly larger than the single loop case with the inner-loop controller only. The numerical results show that the dual-loop controller with \(γ_c=0.9\) and \(γ_d=0.3\) reduces the mean absolute cart displacement amplitude from 12.17 (mm) to 3.85 (mm), a 68.3% reduction. The outer-loop DLQR-SPSHI control signal in the bottom plot of Figure 8.45 ranges from \(-1.0\) to \(1.0\) volt, which does not affect the inner-loop control voltage in the third plot of Figure 8.45. From the bottom plot of Figure 8.45, we can observe that dual-loop control does not increase the overall control magnitude.

    \(γ_d(k)\) \(\infty\) \(0.3\) \(0.5\) \(0.7\) \(0.9\) \(1.1\)
    \(avg\left(\left|x_{cart}\left(k\right)\right|\right)\ \left(mm\right)\) \(12.17\) \(\boldsymbol{3}.\boldsymbol{85}\) \(5.39\) \(6.29\) \(6.84\) \(7.36\)
    \(avg\left(\left|θ_p\left(k\right)\right|\right)\ \left(deg\right)\) \(0.95\) \(0.98\) \(1.00\) \(0.99\) \(1.08\) \(1.11\)
    \(avg\left(\left|CLQR\ u_{eL}\left(k\right)\right|\right)\ \left(v\right)\) \(0.69\) \(0.47\) \(0.52\) \(0.55\) \(0.56\) \(0.57\)
    \(avg\left(\left|DLQR\ u_{eL}\left(k\right)\right|\right)\ \left(v\right)\) \(0\) \(0.047\) \(0.040\) \(0.030\) \(0.027\) \(0.023\)
    Table 8.7: Average absolute magnitudes of cart displacement as functions of \(γ_c\) and \(γ_d\).

    Section Summary

    This section addresses the experimental studies of a model-based dual-loop control strategy. The inner-loop uses the standard zero-order sample and hold input (ZOSHI), and the outer-loop utilizes square-pulse sample and hold input (SPSHI) [13], [31]. Both control loops employ state-feedback controllers for regulating the mini-Segway pendulum position only. First, we use the inner-loop model-based continuous-time LQR (linear quadratic regulation) control to stabilize the pendulum; we optimize LQR input weight \(R_c\) (with fixed state weighting \(Q_c\)) to achieve the best performance experimentally. Next, we design the outer-loop discrete-time state-feedback LQR controller for the mini-Segway system. The discrete-time LQR controller is based upon the discrete-time model. It is obtained by discretizing the mini-Segway model with continuous-time LQR controller utilizing the SPSHI. See Figure 8.15 in Section 8.4 for the dual-loop LQR control system architecture using SPSHI. With the dual-loop control scheme shown in Figure 8.15, the average cart displacement magnitude is reduced by more than 68%. It uses the SPSHI for the outer-loop controller over the inner-loop only system while keeping the pendulum position performance unchanged. Even though the inner-loop CLQR is optimized for the best performance prior to implementing the outer-loop DLQR controller, a significant performance improvement can still be achieved by using the outer-loop control with SPSHI.

    Section Keywords

    Practice Problems

    1. Modify the dual-PID Simulink control strategy shown in Figure 8.37 by replacing the dual-PID controller with the model-based one shown in equation \ref{8.79}. Assume that the cart turning speed and displacement are zero.
    2. Select the correct answer below to complete the sentence. For the CLQR control design with different \(γ_c\) values, the experimental results in Figure 8.44 indicate that the closed-loop system will be stable if:
      1. \(γ_c\) is greater than 0.7.
      2. \(γ_c\) is smaller than 1.1.
      3. \(γ_c\) is between 0.8 and 1.0.

    This page titled 8.8: Model-Based Control Experiments was last modified on Mon, 24 Aug 2026 21:12:20 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) .