## 2 ADCS System Model
### Attitude and Orbit Dynamics
Otherwise, the maximum Earth gravity gradient could be approximated as follows:  
\[L_{GG}=\frac{3 GM_{\oplus}}{2R_{C}^{3}}|I_{z}-I_{y}|\sin(2\theta) \tag{7}\]  
where \(I_{z}\) and \(I_{y}\) are the moments of inertia about the z- and y-axis correspondingly (shown in Table 1), and \(\theta\) is the maximum deviation of the orbit frame Z-axis. A convenient approximation can be made considering the worst-case scenario where \(\sin(2\theta)=1\) with the constants shown in Table 1.  
Aerodynamic Torque.- Due to the atmospheric density, there is an atmospheric drag that especially affects LEO spacecraft and decreases exponentially as altitude increases. Therefore, the aerodynamic force produced by drag is shown in the following equation: \begin{table}
\begin{tabular}{c c c} \hline \hline
**Name** & **Abbreviation** & **Value** \\ \hline Universal gravitational constant & \(G\) & \(6.67408\times 10^{-11}\,\mathrm{m}^{3}\,\mathrm{kg}^{-1}\,\mathrm{s}^{-2}\) \\ Mass of the Earth & \(M_{\oplus}\) & \(5.972\times 10^{24}\,\mathrm{kg}\) \\ Orbit & & Altitude: 400 km, inclination: 30\({}^{\circ}\) \\ Orbit radius & \(R_{C}\) & 6770 km \\ Atmospheric density & \(\rho\) & \(3.725\times 10^{-12}\,\mathrm{kg}/\mathrm{m}^{3}\) \\ Drag coefficient & \(\mathrm{C}_{D}\) & \(\approx 2.2\) \\ Velocity & \(V\) & \(\sqrt{\frac{GM_{\oplus}}{R_{C}}}=7669.3\,\mathrm{m}/\mathrm{s}\) \\ Incident satellite surface area & \(A_{inc}\) & \(0.01\,\mathrm{m}^{2}\) \\ Local magnetic field—Bolivia & \(\|\mathbf{B}_{\text{Earth-local}}\|\) & [18528.2, \(-3447.5,-4780.5]\) nT \\ Residual dipole & D & \(0.01\,\mathrm{Am}^{2}\) \\ Distance between \(CoM\) and \(Cpa\) & \(|r_{zero}|\) & \(0.05\,\mathrm{m}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Astrophysical parameters. \[F_{aero}=\frac{1}{2}\rho C_{D}A_{inc}V^{2} \tag{8}\]  
where \(\rho\) is the atmospheric density at a given altitude, \(V\) is the nanosatellite velocity, \(C_{D}\) is the drag coefficient, and \(A_{inc}\) is the incident satellite surface area. Hence, the aerodynamic force calculated is \(2.410\times 10^{-6}\) N and the maximum aerodynamic torque can be calculated by (9), where \(r_{aero}\) is the vector from the center of pressure (\(Cpa\)) to the center of mass (\(CoM\)) of the CubeSat (\(r_{aero}=r_{Cpa}-r_{CoM}\)). For practical purposes related to maximum disturbance analysis, we assume that \(\|r_{aero}\|=0.05[m]\). \[L_{aero}=F_{aero}\|r_{aero}\| \tag{9}\]  
Magnetic Torque.- The interaction between a magnetic dipole and a magnetic field produces a torque, which can be modeled as follows:  
\[L_{mag}=m\times B \tag{10}\]  
where \(L_{mag}\) stands for the magnetic torque vector, \(m\) the magnetic dipole moment vector, and \(B\) the magnetic field vector. Taking into account the WMM2020, the Earth's magnetic field expressed in the NED frame (North-East-Down) can be modeled as follows:  
\[{}^{NED}B_{earth}(\lambda,\phi,r,t)=-\
abla V(\lambda,\phi,r,t) \tag{11}\]  
such that  
\[\
abla V(\lambda,\phi,r,t)=a\sum_{n=1}^{N}\left(\frac{a}{r}\right)^{n+1}\sum_ {m=0}^{n}[g_{n}^{m}(t)\cos(m\lambda)+h_{n}^{m}\sin(m\lambda)]P_{n}^{m}(\sin\phi)\]  
with \(\lambda\) longitude, \(\phi\) latitude, \(r\) radius, \(N=12\), \(a=6371.2\) [Km] geomagnetic reference radius, and \(t\) time. Additionally, the maximum disturbance magnetic torque produced by the own nanosatellite structure can be approximated as follows:  
\[L_{mag}=D|B_{Earth-reference}| \tag{12}\]  
where \(D\) is the nanosatellite residual dipole in Am\({}^{2}\). Finally, all the maximum disturbance values are shown in Table 2.