# Instance and Data Generation for the Offline Nanosatellite Task Scheduling Problem
## 2 Problem Formulation
### Power Generation and Management
#### 2.2.2 Attitude  
From the earth's orbit point of view, the solar flux can be regarded as parallel; nevertheless, the kinematics of the nanosatellite can be rather complex and for prediction of energy harvesting, it is necessary to compute the orientations of the nanosatellite toward the sun along the orbit.  
Attitude refers to the pointing direction of the spin axis in satellites [17]. Even if the sun shines on the spacecraft, the absorption of solar radiation is a function of the attitude. Therefore, nanosatellites on identical orbits may have surfaces under different scenarios of solar flux as a consequence of their attitudes, e.g., some arbitrary spin, RAM (the spin axis is aligned with the velocity vector), sun-fixed (one or more sides constantly towards the sun), nadir (one or more sides constantly towards the center of the earth) or magnet (herereferring to the state obtained by passive attitude control where the nanosatellite follows the earth's magnetic field). Figure 1 illustrates these attitudes.  
For any attitude and any type of satellite, the projection of a surface \(k\) of the nanosatellite towards the sun, or in other words, its view factor, may be summarized by the parameter \(F_{k}\). Its value is between 0 (normal vector of surface \(k\) does not \"see\" the sun) and 1 (normal vector of surface \(k\) perfectly aligns with solar rays). Any other orientation will result in intermediate values (ignoring possible self-shadowing among the nanosatellite's parts).  
To simulate the attitude, the initial nanosatellite's orientation and mass distribution must be known, and the forces and torques acting on it are integrated. To simplify this process, a pseudo attitude response may be obtained by specifying rotations for the satellite's axis instead of solving the differential equations that govern it. This method is adopted here so a rotation matrix \(\mathbf{B}\) and angles are informed by the user to obtain the spin of the nanosatellite.  
To exemplify this process, the attitude of the nadir will be further described here. Assuming a cubic shape, as those from CubeSat 1U, the vector of initial orientation of each side \(k\) may be assumed as:  
\[\mathbf{n}_{k=X+} =\{+1\quad 0\quad 0\}^{T} \tag{9}\] \[\mathbf{n}_{k=X-} =\{-1\quad 0\quad 0\}^{T}\] (10) \[\mathbf{n}_{k=Y+} =\{0\quad+1\quad 0\}^{T}\] (11) \[\mathbf{n}_{k=Y-} =\{0\quad-1\quad 0\}^{T}\] (12) \[\mathbf{n}_{k=Z+} =\{0\quad 0\quad+1\}^{T}\] (13) \[\mathbf{n}_{k=Z-} =\{0\quad 0\quad-1\}^{T} \tag{14}\]  
These directions will change with time as the nanosatellite completes the orbit so that one side always faces the earth (see Figure 1d). Therefore, the orientation \(\mathbf{N}_{\overline{\tau}}\) in each side \(k\), on the perifocal frame of reference, can be calculated by:  
\[\mathbf{N}_{\overline{\tau}_{k}}=\mathbf{B}\mathbf{n}_{k} \tag{15}\]  
where, for this specific case, the matrix of rotation is:  
\[\mathbf{B}=\begin{bmatrix}\cos(\Omega)&\sin(\Omega)&0\\ -\sin(\Omega)&\cos(\Omega)&0\\ 0&0&1\end{bmatrix}\begin{bmatrix}1&0&0\\ 0&\cos(\theta^{*})&\sin(\theta^{*})\\ 0&-\sin(\theta^{*})&\cos(\theta^{*})\end{bmatrix} \tag{16}\]  
The parameter \(\theta^{*}\) is a residual spin to keep the satellite rotating but still always facing the earth. For different scenarios of attitude, the user has to combine other rotations of matrices.  
Figure 1: Examples of nanosatellites’ attitude.  
Once the directions of the sides along the orbit are known, they must be translated from the periodal frame of reference to the geocentric equatorial frame of reference [16]. Therefore:  
\[\mathbf{N}_{X_{k}}=\mathbf{Q}\mathbf{N}_{\mathbf{r}_{k}} \tag{17}\]  
Finally, the projection of any side \(k\) results from the dot product between \(\{\mathbf{N}_{X}\}_{k}\) and the solar position, given by:  
\[F_{k}=\begin{cases}\mathbf{N}_{X_{k}}.\frac{\mathbf{r}_{\text{sun}}}{|\mathbf{ r}_{\text{sun}}|},&\mathbf{N}_{X_{k}}.\frac{\mathbf{r}_{\text{sun}}}{|\mathbf{ r}_{\text{sun}}|}\geq 0\\ 0,&\text{otherwise}\end{cases} \tag{18}\]