## 2 Spacecraft Attitude Dynamics, Determination and Control
To fully control the three-dimensional state of a spacecraft, at least three reaction wheels are needed, with the components of the spinning axes along any orthogonal body frame direction. Then, the overall angular momentum of \(n\) identical reaction wheels becomes:  
\[\mathbf{h}_{w}=\sum_{i=1}^{n}\mathbf{h}_{w_{i}}=I_{w}\mathbb{W}_{w}\bm  
where the actuation is executed by commanding a proper variation of the reaction wheel spin, \(\mathbf{\hat{\Omega}}_{w}\), which can be computed inverting the previous equation, knowing the desired control torque \(\mathbf{t}_{{}_{EWL}}\).  
The actuation by means of magnetic torquers, the control torque is generated by the interaction between a desired magnetic dipole moment, \(\mathbf{d}\), and an external magnetic field. In fact, magnetic torquers create a dipole moment by letting an electric current flow in electromagnetic coils, according to [PERSON]'s circuital law. Then, the control torque results in Equation (1) as:  
\[\mathbf{t}_{{}_{M\Omega}}=\mathbf{d}\times\mathbf{b}, \tag{5}\]  
where \(\mathbf{b}\) is the external magnetic field vector interfaced with the magnetic torquers. As evident from the previous equation, the magnetic torque is always perpendicular to both dipole moment and magnetic field vector. If the dipole moment can be in any desired direction, with at least three orthogonal magnetic torquers, the external magnetic field typically limits the feasible control torque directions. Namely, a magnetic control torque must lie in the plane orthogonal to \(\mathbf{b}\), and the system is under-actuated unless full actuation is achieved in an integral sense along an entire orbit [30]. The control torque \(\mathbf{t}_{\mathrm{c}}\) is the final output of the proposed ADCS, which is applied to the system according to Equation (4) or to Equation (5), depending on the used actuation method. The torque \(\mathbf{t}_{\mathrm{c}}\) is computed with a pulse modulated PD control on the angle the Sun has with respect to the solar arrays. In fact, the solar arrays generate an electrical current almost proportional to the cosine of the Sun angle with respect to the sensor normal, \(\alpha_{S}\), as:  
\[I_{S}\simeq I_{0}\,\cos(\alpha_{S}), \tag{6}\]  
where \(I_{0}\) is the maximum current produced when the Sun is perfectly perpendicular above the solar arrays, being \(\alpha_{S}\) expressed as:  
\[\alpha_{S}=\arccos(\mathbf{\hat{s}}\cdot\mathbf{\hat{n}}_{S}), \tag{7}\]  
where \(\mathbf{\hat{s}}\) is the Sun direction unit vector, as seen in body frame \(B\). Thus, the solar arrays are correctly oriented to the Sun, producing the maximum electric power, when:  
\[\alpha_{S}=0\quad\longleftrightarrow\quad\frac{I_{S}}{I_{0}}=1. \tag{8}\]  
Note that \(\alpha_{S}\geq 0\) since the angle direction is unknown, and the domain of the angle is \(\alpha_{S}\in[0,90]\)deg. The PD control is designed to have a null \(\alpha_{S}\) angle, being:  
\[\mathbf{t}_{\mathrm{c}}=-k_{P}\,f(\alpha_{S})\,\mathbf{\hat{m}}-k_{D}\, \boldsymbol{\omega}, \tag{9}\]  
where \(f(\alpha_{S})\) is a function of the Sun angle that is equal to zero whenever \(\alpha_{S}=0\), or \(I_{S}=I_{0}\); \(\mathbf{\hat{m}}\) is the control modulation term, which defines the control axis according to a pulsed modulation sequence; \(k_{P}\) and \(k_{D}\) are positive scalar gains. The proportional action drives the solar arrays to be aligned with the Sun, with a derivative term directly dependent from the angular velocity of the spacecraft. Inserting Equation (9) in Equation (1), and neglecting the disturbance torques, the dynamics can be expressed as:  
\[\dot{\boldsymbol{\omega}}=-\mathbb{I}^{-1}(\boldsymbol{\omega}\times\mathbb{I }\boldsymbol{\omega}+k_{P}\,f(\alpha_{S})\,\mathbf{\hat{m}}+k_{D}\,\boldsymbol{ \omega}), \tag{10}\]  
which has an equilibrium point only for \(\alpha_{S}=0\) and \(\boldsymbol{\omega}=\mathbf{0}\). Note that this control formulation assumes the Sun as fixed in the inertial reference frame.