## 3 Nonlinear Model Predictive Control Formulation
### Flexible-Joint Mechanism  
The dynamics model of the flexible-joint mechanism, shown in Figure 2, is given by  
\[I_{m}\ddot{q}_{m_{1}}+M_{m}gL_{m}\sin q_{m_{1}}+K_{m}(q_{m_{1}}-q_{m_{2}})=0, \ J_{m}\ddot{q}_{m_{2}}-K_{m}(q_{m_{1}}-q_{m_{2}})=u_{m} \tag{42}\]  
where \(u_{m}\) is the motor torque defined as the input signal; \(q_{m_{1}}\) is the angular displacement of the joint attached with the link defined as the output signal; \(q_{m_{2}}\) is the angular displacement of the joint attached with the motor. To perform the tracking control, one intends the angle \(q_{m_{1}}\) to reach 0.6 rad by applying the aforementioned four control schemes. The parameters applied in the simulation are defined in Table 2, and the controller parameters are selected as  
\[p=0.5,\ N=5,\ T_{p}=100,\ \mathbf{Q}=\mathbf{I},\ r=1 \tag{43}\]  
For comparisons, the controller parameters of the other three schemes are selected as  
\[\text{SDRE}:\ \mathbf{Q}=\mathbf{I},\ r=1 \tag{44}\]  
\[\text{MPC-TSF}:\ p=0.5,\ N=5,\ T_{p}=100,\ \mathbf{Q}=\mathbf{I},\ r=1 \tag{45}\]  
\[\text{LQT-FL}:\ \mathbf{Q}=\mathbf{I},\ r=1 \tag{46}\]  
Note that the controller parameter values are the same in the four control schemes. Case A: Control without input constraints for the flexible-joint mechanism  
Figure 3a shows the output responses by applying the four control schemes without input constraints. The results show that the responses of the SDRE and LQT-FL have overshoots and oscillations. In contrast, the proposed control MPC-FL and the MPC-TSF model provide smooth responses. Moreover, the proposed control has the smallest settling \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Parameters** & **Symbols** & **Values** & **Units** \\ \hline Inertia of the link & \(I_{m}\) & 1 & kg\(\cdot\)m\({}^{2}\) \\ Inertia of the motor & \(J_{m}\) & 1 & kg\(\cdot\)m\({}^{2}\) \\ Mass of the link & \(M_{m}\) & 1 & kg \\ Distance between the joint and the link center & \(L_{m}\) & 1 & m \\ Spring constant & \(K_{m}\) & 100 & N/rad \\ Gravitational constant & \(g\) & 9.81 & m/s\({}^{2}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Parameters of the flexible-joint mechanism. Figure 2: Flexible-joint mechanism. time, compared with the other three control schemes. Figure 3b shows the control signals by applying the four control schemes without input constraints, and the results show that the proposed control MPC-FL and the MPC-TSF have smoother and smaller control signals, compared with the other two control schemes. Table 3 shows the control performance comparisons by applying the four control schemes, where there are six performances indices selected for comparisons, which are the rising time, the settling time, the maximum overshoots, the ranges of input signals, the computational time, and the root-mean square errors (RMSEs). The results show that the smallest rising and settling come from the LQT-FL and the proposed MPC-FL, respectively; the proposed MPC-FL provides the smallest and near-zero overshoots; the MPC-TSF provides the smallest range of input signals; the LQT-FL takes the shortest computational time; the MPC-TSF provides the smallest RMSE. Although the proposed control scheme has only two first places in the six performance indices, the scheme has the other four second places. Therefore, speaking overall, the proposed scheme is superior to the other schemes in this example. Case B: Control with input constraints for the flexible-joint mechanism  
Similar simulations are performed in this case, except for the control with input constraints. To test the capability of enduring input constraint ranges, the range starts from a bigger value and is then followed by smaller values. One selects the input constraints as \(\pm\)4.5, \(\pm\)1.9, \(\pm\)1.8, \(\pm\)0.59, and \(\pm\)0.56, and Figures 4-8 show the output response and the input signals associated with the constraints, respectively. Regarding the input constraints \(\pm\)4.5, the constraints are active only for the LQT-FL, but the response has huge overshoots.