# Design of a Morphing Aircraft Based on Model Predictive Control
## 3 Controller Design
### Model Predictive Controller Design
\[X_{i+1}(x_{0},\mathbf{u}(x_{0}))= f(X_{i}(x_{0},\mathbf{u}(x_{0})),\mathbf{u}(x_{0}))+W\] \[X_{i}(x_{0},\mathbf{u}(x_{0}))\subseteq X\] \[X_{N}(x_{0},\mathbf{u}(x_{0}))\subseteq \Omega\]  
where \(\delta>0\) is a tunable weighting coefficient. Define \(J^{*}(x_{0})\) as the minimum value of \(J(\mathbf{u},x_{0})\), and let \(\mathbf{u}^{*}(x_{0})\) be the optimal control input sequence, expressed as follows: \(\mathbf{u}^{*}(x_{0})=\{u^{*}(0,x_{0}),\cdots,u^{*}(N-1,x_{0})\}.\vec{\mathbf{X}}= \left\{ \begin{array}{l}x_{0},X_{1}(x_{0},\mathbf{u}^{*}(x_{0})),\cdots,X_{N}(x_ {0},\mathbf{u}^{*}(x_{0}))\\ \end{array} \right\}\) is the optimal predicted reachable set sequence. In practical control implementation, only \(u^{*}(0,x_{0})\) is applied to the actual system, while the control input for the next time step is determined by solving the optimization problem at the next time step. This process is repeated to obtain the receding horizon control law \(\mathbf{u}_{\text{RH}}=\{u^{*}(0,x_{0}),u^{*}(0,x_{1}),\cdots\}\). Define \(\Phi=\{x\mid P_{0}(x)\text{ has a solution}\}\) as the set of all states \(\forall x\in\Phi\) for which the corresponding predictive control optimization problem in Equation (37) is solvable. However, this is not an invariant set, meaning that at time \(k=1,2,\cdots,N-1\), the corresponding optimization problem \(x_{1}=f(x_{0},u^{*}(0,x_{0}))+w_{0}\) may not always have a solution. Therefore, a compensation strategy with gradually decreasing control is adopted. At time step \(k=1,2,\cdots,N-1\). \[\min_{u(i,x_{k})\in U}J(\mathbf{u},x_{k})= \sum_{i=0}^{N-1-k}D_{s}(X_{i}(x_{k},\mathbf{u}(x_{k})),\Omega)+\delta D _{s}(X_{N-k}(x_{k},\mathbf{u}(x_{k})),\Omega)\] (38) s.t. \[X_{i+1}(x_{k},\mathbf{u}(x_{k}))=f(X_{i}(x_{k},\mathbf{u}(x_{k})),u(i,x_ {k}))+W\] \[X_{i}(x_{k},\mathbf{u}(x_{k}))\subseteq X\] \[X_{N-k}(x_{k},\mathbf{u}(x_{k}))\subseteq\Omega\]  
When \(k\geq N\),  
\[\min_{u(0,x_{k})\in U}J(u,x_{k})= D_{s}(x_{k},\Omega)+\delta D_{s}(X_{1}(x_{k},u(0,x_{k})),\Omega)\] (39) s.t. \[X_{1}(x_{k},u(0,x_{k}))= f(x_{k},u(0,x_{k}))+W\] \[X_{1}(x_{k},u(0,x_{k}))\subseteq \Omega\]  
At time \(N\), \(x_{[N]}\) has entered \(\Omega\) (as stated in Theorem 1). Therefore, Equation (33) essentially represents the optimization problem for points within \(\Omega\). At this time, the prediction horizon is reduced to a single step. Within \(\Omega\), the control objective shifts to minimizing\(D_{s}(X_{1}(x_{k},u(0,x_{k})),\Omega)\). When \(D_{s}(0,\Omega)=0\), it indicates that the controller makes the one-step predicted reachable set as close as possible to the origin. For any \(\forall x_{0}\in\Phi\), applying the receding horizon control law \(\mathbf{u}_{RH}\), \(x_{0}\) can reach \(\Omega\) in \(N\) steps and remain within \(\Omega\) thereafter. Since at \(k=1\), the prediction horizon is \(N-1\), and \(\{u^{*}(1,x_{0}),\cdots,\)\(u^{*}(N-1,x_{0})\}\) is a feasible solution to the optimization problem \(P_{1}(x_{1})\), the problem \(P_{k}(x)\) has a solution. Similarly, for \(k=2,3,\ldots,N\), the optimization problem \(P_{1}(x_{1})\) remains solvable. When \(k=N\), \(x_{N}\) enters \(\Omega\). By Assumption 2, for \(\forall x\in\Omega\), there exists \(u\in U\), such that \(f(x,u)+w\in\Omega\). Therefore, when \(k\geq N\), the optimization problem described in Equation (39) has a solution, and \(x_{k}\) will always remain within \(\Omega\). This completes the proof. Next, the predicted reachable set and terminal state set are computed. For convenience in description, the system is reformulated as follows:  
\[x_{k+1}^{i}=f_{i}(x_{k},u_{k})+w_{k},\quad i=1,2,\cdots,n \tag{40}\]  
Compute the predicted reachable set. Assuming the current state is \(A\) and the control input is \(u\), the predicted reachable set at the next time step can be expressed as \(f(A,u)+W\). Computing the exact predicted reachable set \(f(A,u)+W\) is challenging, so an approximate predicted reachable set \(\Psi(A,u)+W\) is used instead.