# Instance and Data Generation for the Offline Nanosatellite Task Scheduling Problem
## 2 Problem Formulation
### Power Generation and Management
#### 2.2.1 Orbit Model  
One major aspect of every satellite mission of any type and size is the orbital parameters. The orbit governs the nanosatellite's position, an essential parameter to estimate the irradiance field and, consequently, the power generation through photovoltaic cells. When the interest is for short periods, e.g., around one day or less, the ideal Keplerian orbit model provides relevant results for orbits higher than 300 km. This model also usually generates reasonable values for longer periods if the apogee exceeds 600 km. However, the Keplerian model cannot be adopted for more precise results and to extend its range of applications. The Keplerian orbit assumes that the only existing force comes from the gravity acceleration between two ideal bodies, i.e., the earth and the nanosatellite. In fact, a precise orbit model should include perturbations, such as the atmospheric drag, the oblateness of the earth, and solar pressure, but all of them introduce further complexities [16]. To simulate the position of a satellite in orbit, the user must always inform six orbital elements and may use the following equation:  
\[\mathbf{r}_{X}=\mathbf{Q}\mathbf{r}_{\mathbf{Y}} \tag{2}\]  
where \(\mathbf{Q}\) is the direct cosine matrix to transform the vector from the perifocal frame to the geocentric equatorial frame, as established by the Euler angle sequence [16]: \begin{table}
\begin{tabular}{l l} \hline \hline
**Notation** & **Definition** \\ \hline \(V_{b}\) & Battery voltage, in Volts. \\ \(Q\) & Battery capacity, in Ampere-hour. \\ \(\rho\) & Battery level lower bound. \\ \(e_{cd}\) & Battery charge/discharge efficiency. \\ \(\gamma\) & Upper bound for battery discharge current, in Ampere. \\ \(r_{t}\) & Energy harvested and available for tasks at time \(t\). \\ \(q_{j}\) & Power drained running task \(j\). \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Power management parameters. \[\mathbf{Q}=\left[ \begin{array}{ccc}-\sin\Omega\cos i\sin\omega+\cos\Omega\cos\omega& -\sin\Omega\cos i\cos\omega-\cos\Omega\sin\omega&\sin\Omega\sin i\\ \cos\Omega\cos i\sin\omega+\sin\Omega\cos\omega&\cos\Omega\cos i\cos\omega-\sin \Omega\sin\omega&-\cos\Omega\sin i\\ \sin i\sin\omega&\sin i\cos\omega&\cos i\end{array} \right] \tag{3}\]  
Three orbital elements required are the ascending node \(\Omega\) (\({}^{\circ}\)), the orbit inclination \(i\) (\({}^{\circ}\)), and the argument of perigee \(\omega\) (\({}^{\circ}\)). The remaining vector \(\{\mathbf{r}\}_{\overline{x}}\) is the position of the nanosatellite in the perifocal frame of reference, calculated by:  
\[\mathbf{r}_{\overline{x}}=\frac{h^{2}}{\mu(1+e\cos\theta)}\left\{ \begin{array} []{c}\cos\theta\\ \sin\theta\\ 0\end{array} \right\} \tag{4}\]  
where \(h\) is the specific relative angular momentum (km\({}^{2}\)/s), \(\theta\) is the true anomaly (\({}^{\circ}\)), and \(e\) is the eccentricity of the orbit (-). These and the previous parameters complete the six orbital elements. The term \(\mu\) is the gravitational parameter (389,600 km\({}^{3}\)/s\({}^{2}\) for geocentric orbits). By definition, \(\theta=0^{\circ}\) at the perigee (closest position to the earth), while \(\theta=180^{\circ}\) at the apogee (furthest position to the earth), and by making \(0^{\circ}\leq\theta\leq 360^{\circ}\) a complete orbit is covered. Another option is to provide a time step and increase it until the orbit period (Period) is reached. For each time there is a respective value for \(\theta\), calculated as [16]:  
\[M=2\pi\frac{t}{\text{Period}} \tag{5}\]  
\[E=M+e\sin(E) \tag{6}\]  
\[\theta=2\tan^{-1}\left(\sqrt{\frac{1+e}{1-e}}\tan\frac{E}{2}\right)+\theta_{0} \tag{7}\]  
where \(M\) is the mean anomaly (rad), \(t\) is time (s), \(E\) is the eccentric anomaly, and \(\theta_{0}\) is the initial true anomaly. To estimate the nanosatellite's passage under the earth's shadow, it is crucial to determine its position and the position of the sun (\(\mathbf{r}_{\text{sun}}\)).