# Stabilization of an Unconventional Large Airship When Hovering
## 4 Control Allocation
### Numerical Approach  
To check this approximate approach, we compare our results here with a numerical method. We used the fixed-step gradient method to compute the solution numerically. This algorithm is iterative based on the minimization of a cost function \(J(U_{1})\).  
The principle of the algorithm is to generate a vector series \(U_{1,k}\) from an arbitrary point \(U_{1,0}\) such that the cost value of the function \(J(U_{1})\) decreases with each iteration, i.e.,:  
\[J(U_{1,k+1})<J(U_{1,k})\]  
For the fixed-step gradient method, the vector \(U_{1,k}\) is updated in this way:  
\[U_{1,k+1}=U_{1,k}-\frac{1}{2}\mu\frac{\partial J(U_{1,k})}{\partial U_{1}} \tag{45}\]  
The index k denotes the iteration and \(\mu\) is a positive constant parameter.  
To solve the linear system in Equation (32) we propose the use of the cost function \(J\) defined by:  
\[J(\tau)=\sum_{i=1}^{6}\bigl{(}\alpha^{\prime}{}_{i}-\tau_{i}\bigr{)}^{2} \tag{46}\]  
The terms of the quadratic function penalize the error \(e_{i}=\alpha^{\prime}{}_{i}-\tau_{i}\) between the control vector, the vector forces \(\tau_{1}\), and the torques \(\tau_{2}\) (see Equation (29)).  
We can see that when the quadratic function is minimal, the terms \(e_{i}\) tend toward zero, then \(\tau_{i}\) tend to \(\alpha^{\prime}{}_{i}\).  
Hence, the intermediate parameters obtained, \(l_{i}\), \(m_{i}\), and \(n_{i}\), are the components of the vector that minimize the cost function.  
Figure 6: Block diagram of the proposed control system.  
By using the matrix relations in Equation (32)-(34), the cost function \(J\) can be written as:  
\[J(U_{1})=\sum\limits_{i=1}^{6}\left(\alpha^{\prime}{}_{i}-C_{i}U_{1}\right)^{2} \tag{47}\]  
With \(C_{i}\) is the \(i\)th line of the matrix C.  
The gradient of J is:  
\[\
abla J(U_{1})=-2\sum\limits_{i=1}^{6}C_{i}^{t}\left(\alpha^{\prime}{}_{i}-C_{ i}U_{1}\right) \tag{48}\]  
Then, Equation (45) becomes:  
\[U_{1,k+1}=U_{1,k}+2\mu\sum\limits_{i=1}^{6}C_{i}^{t}\left(\alpha^{\prime}{}_{i} -C_{i}U_{1,k}\right) \tag{49}\]  
This method has the advantage of being easy to implement. Unfortunately, the convergence of this method is generally slow. The steps for obtaining the numerical solution are detailed in Algorithm 1:  
```
Step 1:Initialization k = 0: Choice of \(l_{i,0}\), \(m_{i,0}\), \(n_{i,0}\) and \(\mu\), \(\varepsilon>0\) Step 2:Iteration k (\(i=1,\cdots,4\)) \(\left[l_{i,k+1},m_{i,k+1},n_{i,k+1}\right]^{t}=\left[l_{i,k},m_{i,k},n_{i,k} \right]^{t}+\ 2\mu\sum\limits_{i=1}^{6}C_{i}^{t}\left(\alpha^{\prime}{}_{i}-C_{i} \left[l_{i,k},m_{i,k},n_{i,k}\right]^{t}\right)\) Step 3:Stop criterion: \(\left|\left|\left[l_{i,k+1},m_{i,k+1},n_{i,k+1}\right]^{t},-,\left[l_{i,k},m_{ i,k},n_{i,k}\right]^{t}\right|\right|<\varepsilon\)
```  
Note:  
1. In order to implement the proposed algorithm, the convergence of it is an important factor to take into account. The gradient algorithm that minimizes the quadratic function in Equation (46) converges if: \(0\prec\mu\prec\frac{2M_{0}}{M_{1}^{2}}\) with \(M_{1}=\max(\lambda_{i})\); \(M_{2}=\min(\lambda_{i})\), Where \((\lambda_{i})_{1\leq i\leq 12}\) are the eigenvalues of the symmetric matrix \(C_{1}=2\sum\limits_{i=1}^{6}C_{i}^{T}C_{i}\).  
For both the analytical and the numerical methods, we have succeeded in stabilizing the airship. However, during a short transient phase, the actuators' capacities were exceeded. In this first approach, we have introduced a saturation block assuming that the propellers are in saturation abutment. Further studies are underway to solve this problem using constrained optimization techniques. This will be dealt with in future work.