Optimization of Geomagnetic and Solar Reference Vector Algorithms for Micro-Nano Satellites

To optimize the geomagnetic reference vector and the solar reference vector calculation method, this paper proposes a geomagnetic fitting algorithm and simplifies the DE430 ephemeris structure to speed up the determination rate of the geomagnetic and solar reference vectors. The two optimized reference vector determination methods are simulated on the Attitude Measurement Unit (AMU). The simulation results show that the single-step elapsed time of the geomagnetic fitting algorithm is reduced by 99.5% compared with the IGRF-13 geomagnetic model algorithm, and the data capacity is reduced by 97.3% compared with the look-up table method. The data capacity of the simplified ephemeris algorithm is 66.9% lower than that of the DE430 ephemeris algorithm, and the calculation accuracy is nearly 3 orders of magnitude higher than that of the approximate calculation method. This method can significantly shorten the attitude determination time and increase the attitude determination frequency, dramatically improving attitude determination accuracy and attitude control accuracy. The AMU supported by these two algorithms has sound engineering practical value.


Introduction
The satellite's attitude determines whether the on-board payload can complete the scheduled task. Hence, the satellite needs to accurately control its attitude at all times to ensure the high-quality completion of the mission objective [1][2]. Determining the attitude of the body coordinate system relative to a reference coordinate system is the prerequisite for attitude control. This process needs to establish the connection between the two given coordinate systems through the directions of several vectors. Therefore, calculating the vectors in the reference coordinate system is one of the most basic tasks in attitude control. Magnetometer and sun sensor is common sensor combination on micro-nano satellites [3][4][5][6]. The geomagnetic reference vector and sun reference vector need to be calculated when they determine the attitude. To date, the look-up table method [7][8] and real-time calculation using the geomagnetic  [5][6]9] are the main methods for the geomagnetic reference vector calculation, among which the look-up table method has the problems of large data capacity and low calculation accuracy, and the calculation rate of the geomagnetic model algorithm is relatively low. The solar reference vector is generally calculated using mature ephemeris [6,[10][11] or approximate calculation formulas [5,9,12]. The former has a high calculation accuracy but a large data capacity, and the latter has a slightly faster calculation rate but a lower accuracy. To optimize the geomagnetic reference vector and the solar reference vector calculation method, this paper proposes a geomagnetic fitting algorithm and simplifies the structure of DE430 ephemeris.
The Attitude Determination and Control System (ADCS) calculation work in traditional micro-nano satellites is mainly completed in the On-Board Computer (OBC). However, the OBC also needs to control other subsystems and complete relevant calculations [3][4]13]. Due to this fact, the improvement of the control rate is subjected to the computing resources. However, with the development of chips and micro-electromechanical technology, single-chip micro-computers' computing power and data capacity have improved further. Therefore, the calculation of attitude determination can be transferred to singlechip microcomputers, eliminating the constraints of computing resources in the OBC. The AMU is based on a high-performance single-chip microcomputer as the core, integrates several attitude determination components of attitude sensors, and can calculate the current attitude of the satellite independently [14]. The modular AMU can be widely used in various micro-nano satellites. It can be used as the primary attitude determination component of CubeSat smaller than 6U. AMU can also be used as a spare attitude determination component for CubeSat larger than 6U or cooperate with a variety of high-precision attitude sensors to determine the satellite attitude.
Micro-nano satellites' precision and speed requirements for attitude control are directly related to the satellite's scientific missions. For missions with low accuracy requirements, ADCS needs to achieve the pointing accuracy of 2-10° [6,[15][16][17][18] and the control cycle of 0.5-2Hz [15,[18][19]. The satellite attitude determination accuracy and update rate must be higher than the pointing accuracy and the control cycle to meet the satellite's attitude control requirements. In the same way, satellites need higher reference vector determination accuracy and update rate to meet the needs of attitude determination. Therefore, the reference vector determination accuracy should be less than 1°, and the update rate should be higher than 20 Hz. Section 2 of this article introduces the basic principles of two reference vector determination algorithms. Section 3 introduces the AMU and tests the operation effect of two different reference vector determination algorithms in the AMU. Section 4 summarizes the content of this article.

Geomagnetic Fitting Algorithm
The geomagnetic reference vector, the longitude and the latitude of the satellite, and the orbital altitude all change continuously. Therefore, it is possible to bring the latitude, the longitude, and the orbital altitude of six consecutive positions with a time interval T into the IGRF-13 geomagnetic model and calculate the geomagnetic reference vector of each position [20]. Then use the latitude, the longitude, and the geomagnetic reference vector of each location to perform least-squares surface fitting, and obtain three fitting equations for the distribution of the geomagnetic reference vector in the longitude and the latitude. Each location participating in the fitting is called the fitting point. Because the change of orbital altitude in a short time is much smaller than the change of latitude and longitude and has little influence on the geomagnetic vector, the influence of orbital altitude change is ignored in the fitting to reduce the calculation amount.
When the satellite moves to a certain position between the two fitting points, the fitting equations estimate the geomagnetic reference vector at that position. The estimation formulas are as follows: Where  and  are the latitude and the longitude of the estimated point; 11 a -16 a , 21 a -26 a , and 31 a -36 a are the coefficients of the fitting equations; geomagnetic reference vector of the estimated point in the NED coordinate system; t means that the fitting equations are obtained from the data of 6 fitting points from 5 t T  to t . In the process of fitting and estimation, the longitude and the latitude difference between the estimated point and the adjacent fitting point and between the two fitting points will all change with the value of T . However, to ensure the accuracy of the geomagnetic reference vector of the estimated point, this difference should not be too large, so 5-25s is more appropriate T . To perform real-time geomagnetic fitting on the satellite, this paper designs the specific software process of the geomagnetic fitting algorithm, as shown in figure 1. When the satellite's real-time latitude, longitude, and orbital altitude are input into the algorithm, it is necessary first to determine whether the time is a fitting point and then perform the geomagnetic fitting or geomagnetic estimation process, respectively. In both processes, it is necessary to determine whether the satellite has crossed the east longitude 180° at that moment. Because when the satellite crosses 180°E, even though the actual distance between the satellite and the last fitting point is very close, the theoretical longitude difference is 360     , which expands the theoretical distance between the satellite and the fitting point and causes the value of the geomagnetic reference vector to change significantly. Therefore, the following formula is needed to correct this error: 360 The in  is the input longitude. However, the correction terms are not the same in the two processes: the longitude of the other five fitting points needs to be corrected in the geomagnetic fitting; the longitude of the estimated point itself needs to be corrected in the geomagnetic estimation.
After that, the algorithm needs to update the fitting equation to obtain new fitting equation coefficients and geomagnetic reference vector in the geomagnetic fitting process. In the geomagnetism estimation process, the algorithm needs to estimate the geomagnetism reference vector according to the fitting equation and the latitude and longitude at that moment. Finally, the algorithm will output the realtime geomagnetic reference vector at that moment obtained after the execution of the two processes and wait for the next moment to execute the algorithm again.
Since the estimation accuracy of the geomagnetic reference vector will rapidly decrease as the satellite moves away from the fitting point, the fitting equations need to be periodically updated to ensure a high estimation accuracy of the geomagnetic reference vector in the long term. The updating process is shown in , each satellite position uses the above three updated fitting equations to estimate the geomagnetic reference vector. The update of the fitting equation after that can be deduced by analogy. Figure 2. Schematic of the process for updating the fitting equations.

Simplified Ephemeris Algorithm
The DE430 ephemeris stores the Chebyshev coefficients of each star from December 21, 1549, to January 25, 2650, in a cycle of 32 days. The coefficients can be retrieved by Julian Day. The Chebyshev polynomial calculates the position vector of each star in the Heliocentric Coordinate System [21][22].
The solar reference vector can be obtained by transforming the coordinate system of the position vectors of the Earth-Moon barycenter, the sun, and the moon. Therefore, calculating the solar reference vector through the DE430 ephemeris needs to store their Chebyshev coefficients. However, the data capacity of the Chebyshev coefficient related to the moon is enormous and has little influence on the calculation of the solar reference vector. In addition, the periodicity of the moon's position in the geocentric celestial coordinate system is very obvious. Therefore, the long-term changes of the moon's position can be ignored, and only the Chebyshev coefficients of one moon's period are used to estimate the position vector. In the calculation, the Julian day Where n is the recursion coefficient; 0 T is the termination Julian date of the ephemeris data; m T is the lunar cycle, taking 27.32.
The simplified ephemeris algorithm will first calculate the position vector of the sun and the Earth-Moon barycenter based on p JD and their Chebyshev coefficients. The above two Chebyshev coefficients stored in the algorithm are the complete coefficients in the satellite's expected life. After that, the algorithm uses equation (5) and equation (6) to calculate r JD , and uses r JD and the Chebyshev coefficients of one moon's period stored in the algorithm to estimate the moon's position vector. Finally, the estimated solar reference vector can be obtained by changing the coordinates of the above three position vectors.
According to the simplified ephemeris algorithm's principle, the algorithm can only store the 32-day moon's Chebyshev coefficients instead of storing the coefficients during the entire satellite life, significantly reducing the ephemeris' data capacity. But the accuracy of the solar reference vector will decrease over time.

AMU
AMU can collect multi-channel attitude information, determine the current satellite's attitude information, and judge the attitude deviation to drive the various satellite's actuators to coordinate work to achieve the effect of attitude control and stability. AMU can also use different sensor combinations and attitude determination algorithms according to the satellite's working environment to ensure the stability and reliability of attitude information. Table 1 is the specifications of AMU. Power ＜100mW The AMU shown in figure 4 adopts an integrated design and integrates the core processor, sun sensor, magnetometer, and gyroscope. The core processor uses ST's STM32F103, a high-performance ARM CoretxTM-M3 32-bit RISC core with a maximum operating frequency of 72MHz. The sun sensor uses a four-quadrant silicon photodiode as the photosensitive device. It uses four 16-bit high-precision ADC chips to collect voltage signals and transmit them to the core processor. The 3-axis MEMS    When the satellite is in orbit, the real-time longitude, latitude, orbital altitude, and time data required by the AMU to determine the above two reference vectors are provided by the on-board GPS. Therefore, the ground experiment conducted in this article is shown in figure 5. In the geomagnetic reference vector's experiment, the GPS simulator will be used to simulate the on-board GPS's real-time output data in a sun-synchronous orbit and will input the above data into the AMU at a frequency of 10 Hz. In the solar reference vector's experiment, the GPS simulator will simulate hourly time data from 2021 to 2024 and input it into the AMU. After that, the AMU will calculate the two reference vectors in realtime based on the GPS data and output them to the upper computer. Two ground experiment was carried out three times, and each experiment used a different geomagnetic reference vector determination algorithms and solar reference vector determination algorithms.

Simulation of Geomagnetic Reference Vector Determining Algorithm
The geomagnetic reference vector determination algorithms simulated by the ground experiment are the IGRF-13 geomagnetic model algorithm, the geomagnetic fitting algorithm ( T =10s), and the look-up table method. The simulation results are shown in table 2, figure 6, and figure 7. In the above simulation, the result of the geomagnetic model algorithm is used as the actual value of the satellite's geomagnetic reference vector at that position.
The data in table 2 and figure 6 shows that the single-step elapsed time of the geomagnetic fitting algorithm is reduced by 99.5% compared with the geomagnetic model algorithm, but the data capacity is only increased by 7.3%, and the geomagnetic fitting algorithm's accuracy only slightly drops to 0.0782°. Its calculation accuracy has not seriously decreased. Therefore, compared with the geomagnetic model algorithm, the geomagnetic fitting algorithm can significantly increase the calculation rate without significant changes in the data capacity and calculation accuracy. Although 7 some data's error is more extensive than 0.1°, the accuracy of the magnetometer itself is low, so it will not have a significant impact on the attitude determination. Therefore, the accuracy and update rate of the geomagnetic fitting algorithm can meet the needs of satellites.   The data capacity of the geomagnetic fitting algorithm is reduced by 97.3% compared with the lookup table method, and the geomagnetic fitting algorithm's accuracy is increased by 82.3%, but its singlestep elapsed time only increases 0.012ms. Therefore, the geomagnetic fitting algorithm can significantly reduce the data capacity, improve calculation accuracy, and maintain a higher calculation rate compared with the look-up table method.
These conditions all show that the comprehensive performance of the geomagnetic fitting algorithm in the above three aspects is better than the geomagnetic model algorithm and the look-up table method.
The geomagnetic reference vector's determination accuracy and calculation rate of the geomagnetic fitting algorithm are higher than the requirements of attitude determination.

Simulation of Solar Reference Vector Determining Algorithm
The solar reference vector determination algorithms simulated by the ground experiment are the DE430 ephemeris algorithm, simplified ephemeris algorithm, and approximate calculation method. The simulation results are shown in table 3, figure 8, and figure 9. In the above two simulation diagrams, the result of the DE430 ephemeris algorithm is taken as the actual value of the satellite's solar reference vector at that position, and the angular error is compared with the simplified ephemeris algorithm and approximate calculation method. The data in table 3 firstly shows no noticeable difference in the single-step elapsed time of the three algorithms. The simulation results can also show that the data capacity of the simplified ephemeris algorithm is 66.9% lower than that of the DE430 ephemeris algorithm. Although the accuracy declines over time, it is still less than 4×10 -4°. In addition, the simplified ephemeris algorithm can also meet the satellite's requirements for accuracy and update rate. Therefore, the simplified ephemeris algorithm is more suitable for the AMU platform than the DE430 ephemeris algorithm.  Although the approximate calculation method does not require additional data storage, its accuracy is 3 orders of magnitude lower than that of the simplified ephemeris algorithm. Therefore, the simplified ephemeris algorithm can significantly improve calculation accuracy and maintain a higher calculation rate compared with the approximate calculation method.
The above simulation results show that the comprehensive performance of the simplified ephemeris algorithm running on the AMU is better than the other two algorithms.

Conclusions
Aiming at the shortage of computing resources on micro-nano satellites, using AMU to calculate the geomagnetic and solar reference vector is proposed in this paper. To make full use of AMU's hardware resources when AMU calculates reference vectors, this paper also proposes a geomagnetic fitting algorithm and simplifies the structure of DE430 ephemeris. And two optimized reference vector determination algorithms and other algorithms are simulated on the AMU.
The characteristics of the optimized algorithm are as follows: (1) The geomagnetic fitting algorithm can greatly increase the speed of calculating the geomagnetic reference vector, but the calculation accuracy of the reference vector is slightly reduced. However, the decrease in calculation accuracy caused by the geomagnetic fitting algorithm will not affect the normal operation of the micro-nano satellite.
(2) The simplified ephemeris algorithm can solve the problem of excessive ephemeris data capacity. The resulting decrease in calculation accuracy can be ignored.
(3) After running the above two algorithms in AMU, the determination accuracy and calculation rate can be higher than the attitude determination's requirements.
The reference vector determination algorithm involved in this paper is only a part of the satellite attitude determination. If all the satellite attitude determination work is transferred to the AMU, subsequent research needs to focus on achieving efficient and high-precision attitude determination.