# Failure Identification Method and LMI-Based Control System for Small Spacecraft
## 2 System Dynamics  
In this section, the satellite mathematical model is described. The considered spacecraft falls within the small satellite definition, and it is equipped with an MED to achieve a high attitude accuracy during maneuvers. The spacecraft's ability to modify its orientation arises in the use of the MED system, particularly when reaction wheels are considered. These devices apply torque through an electric motor that sets a wheel to rotate while an equal and opposite torque is applied on the spacecraft, which allows the wheel to rotate. The spacecraft attitude is expressed by means of quaternions and by considering the rotation of the body reference frame with respect to an inertial reference frame. Quaternions were chosen to describe the spatial rotations due to their compact nature, lower computational cost, and lack of singularity, as seen in [31]. In this paper, they are represented through the scalar plus the three-vector representation, as follows  
\[q=\{q_{0},q_{v}\}^{T}\]  
where \(q_{0}\in\mathbb{R}\) and \(q_{v}\in\mathbb{R}^{3}\). The system kinematics are expressed by the evolution of quaternions in time, and it is defined as a function of the system angular velocity  
\[\dot{q}=\frac{1}{2} \begin{bmatrix}0&-\omega_{1}&-\omega_{2}&-\omega_{3}\\ \omega_{1}&0&-\omega_{3}&\omega_{2}\\ \omega_{2}&\omega_{3}&0&-\omega_{1}\\ \omega_{3}&-\omega_{2}&\omega_{1}&0\end{bmatrix} q\]  
where \(\omega=\{\omega_{1},\omega_{2},\omega_{3}\}^{T}\in\mathbb{R}^{3}\) is the spacecraft angular velocity expressed in the body reference frame. Starting from the rigid body dynamics theory, as performed in [31], the spacecraft attitude dynamics is expressed as the conservation of the total angular momentum as the sum of the spacecraft's elements and MED elements. In the inertial reference frame, the conservation of the angular momentum is given as  
\[u_{ext}^{I}=h^{I}=h_{s/c}^{I}+h_{med}^{I}\]  
where \(u_{ext}^{I}\in\mathbb{R}^{3}\) is the resultant external torque, and \(h_{s/c}^{I}\in\mathbb{R}^{3}\) and \(h_{med}^{I}\in\mathbb{R}^{3}\) are the spacecraft's and resultant MED elements' angular momentum, respectively. It is useful to express this relationship in the body reference frame (parameters with no apex are expressed in this reference frame). In this case, the attitude dynamics is expressed by  
\[\dot{\omega}=J^{-1}\big{(}u_{ext}-h_{med}-\omega\times J\omega\big{)} \tag{1}\]  
where \(J\in\mathbb{R}^{3,3}\) is the spacecraft inertia matrix and \(h_{med}\in\mathbb{R}^{3}\) is the resultant MED elements' angular momentum. For each reaction wheel, the applied torque is equal to the variation in time of the angular momentum, expressed in the wheels reference frame as  
\[\tau=\dot{h}_{med}^{w}\]  
where \(\tau,h_{med}^{w}\in\mathbb{R}^{4}\). Components \(\tau_{i}\) and \(h_{med,i}^{w}\) represent the applied torque and angular momentum, respectively, of the i-th reaction wheel. The definition of a rotation matrix is necessary to move from the wheels reference frame to the body reference frame, and it is properly defined from the geometric configuration. For this application, four reaction wheels are considered and are arranged in a pyramidal configuration. So, the spin axes of the wheels are pointing towards the faces of a pyramid with a square base. This means that the wheels are inclined with a fixed angle with respect to the base of the pyramid, generating torque along the height of the pyramid; the projections of the wheels' momentum lie in the pyramid base, which generates torque along the last two directions. Thus, the rotation matrix is defined as  
\[Z= \begin{bmatrix}cos(\beta)cos(\alpha)&-cos(\beta)sin(\alpha)&- cos(\beta)cos(\alpha)&cos(\beta)sin(\alpha)\\ cos(\beta)sin(\alpha)&cos(\beta)cos(\alpha)&-cos(\beta)sin(\alpha)&-cos(\beta) cos(\alpha)\\ sin(\beta)&sin(\beta)&sin(\beta)&sin(\beta)\end{bmatrix}