Tarso Kraemer

Sarzi Sartori

Hassen Fourati

Rodrigo Possamai Bastos

LEARNING-BASED MITIGATION OF SOFT ERROR EFFECTS ON QUATERNION KALMAN FILTER PROCESSING

This paper proposes a novel mitigation technique for soft error effects on the attitude estimation (AE) processing for spacecrafts, especially for satellites' application. Specially, we are focused on the soft errors that occur in space and affect, for example, the quaternion Kalman filter, running on the processor of control system of satellite, which leads to invert bits of the estimated states, miscalculations and a decreased performance. The mitigation technique detects first the presence of soft error effects on the AE algorithm output using some residuals. Then the residuals are passed to a trained Machine Learning (ML) models to estimate the quaternion error that will be used to correct the estimations. A supervised regression solution was proposed to correct the soft error effects, in which a methodology for creating a dataset for training classical ML models was developed. The results from the case-study scenario show a high reduction of soft error effects, while adding little overhead to the Kalman filter processing.

.

. However, this algorithm demands the linearization of the non-linear equations that relate the sensors' measurements with the current attitude (the measurement equation). This linearization procedure can provoke undesirable effects such as sensitivity to initial conditions, and also an increase in the computational load. Alternatively, the authors in [9] propose a novel quaternion Kalman filter (NQKF) algorithm, employing a special manipulation on the measurement equation, eliminating thus the linearization step. The AE is a critical task that must be accomplished by

Introduction

Electronic components can be upset by radiation particles in space. It creates transient faults able to invert memory bit elements of their circuits, characterizing single-event upset (SEU), or even interrupt their operation requiring a software reboot, defining a single event-functional interrupt (SEFI). Both of these events are considered as soft single-event effects or simply soft errors [START_REF]Measurement and Reporting of Alpha Particle and Terrestrial Cosmic Ray Induced Soft Errors in Semiconductor Devices[END_REF]. High-energy particles such as protons, electrons, and heavy ions, coming mainly from the Van Allen radiation belt [START_REF] Lu | A review of the space environment effects on spacecraft in different orbits[END_REF] are responsible for inducing soft errors in space environment.

Spacecrafts, such as satellites, utilize Attitude Determination and Control Systems (ADCS) to determine the vehicle's attitude, throughout sensors' measurements, and subsequent control using actuators. The ADCS components are essentially electronic systems, sometimes upset by soft errors, as shown in Figure 1. As an example, the TDRS-1 is a satellite launched by NASA in April 1983 [START_REF] Wilkinson | TDRS-1 single event upsets and the effect of the space environment[END_REF]. SEU events were observed in the ADCS Random Access Memory (RAM), during its trajectory to reach geosynchronous orbit. Some SEUs caused serious anomalies, which required ground control to keep the satellite's desired orientation.

Low Earth Orbit (LEO) spacecraft missions are also exposed to large radiation risks, due to their orbital motion inside the Van Allen inner radiation belt (600-10,000km of altitude), mainly when they pass over the South Atlantic Anomaly the satellite's ADCS. As aforementioned, this system can be upset by soft errors caused by the radiation environment, especially for the processor where the Kalman filter-based AE algorithms run. In our previous works [START_REF] Kraemer Sarzi | Assessment of radiation effects on attitude estimation processing for autonomous things[END_REF][START_REF] Kraemer Sarzi | Assessment of attitude estimation processing system under neutron radiation effects[END_REF][START_REF] Kraemer Sarzi | Effectiveness of attitude estimation processing approaches in tolerating radiation soft errors[END_REF] we have already investigated the soft error effects on AE processing and exposed results obtained during experimental radiation campaigns. Therefore, the soft error effects should be mitigated for ensuring the system reliability. A variety of works have addressed Kalman filter-based algorithms reliability [START_REF] Han | Quadratic-kalmanfilter-based sensor fault detection approach for unmanned aerial vehicles[END_REF][START_REF] Lyu | An adaptive and robust ukf approach based on gaussian process regression-aided variational bayesian[END_REF][START_REF] Li | Hmm based adaptive kalman filter for orientation estimation[END_REF]. However these works deal with faults, outliers, external perturbations, such as external accelerations [START_REF] Makni | Energy-aware adaptive attitude estimation under external acceleration for pedestrian navigation[END_REF][START_REF] Makni | Data Fusion-Based Descriptor Approach for Attitude Estimation underaccelerated maneuvers[END_REF] or magnetic distortions [START_REF] Wu | Fast complementary filter for attitude estimation using low-cost marg sensors[END_REF], and different kind of noises that may occur in the sensors' measurements over time, then are not appropriate to be used in this framework. Unlike, soft errors, more specifically SEUs, are punctual events that occur when high energy particles hit memory elements inverting its states, i.e. bit-flips. The SEU effects in a processing system running an AE algorithm may result in miscalculations, hence providing a wrong attitude estimation, as shown in [START_REF] Kraemer Sarzi | Assessment of radiation effects on attitude estimation processing for autonomous things[END_REF]. Plenty of known mitigation techniques can be employed for addressing this issue. Redundancy is one of the most common techniques, and can be applied replicating hardware, adding check bits, and even running multiple processes of the same program [START_REF] Dominik | System mitigation techniques for single event effects[END_REF]. Error detection and correction codes are also common methods applied in current processors and memories architectures. However, these techniques are not completely fail-safe, they can increase the cost, processing time, and application's weight.

Machine Learning (ML) techniques have been successfully applied for improving the AE performance, or even replace the classical AE algorithms (estimation without dynamic model). In [START_REF] Tang | Reinforcement Learning Compensated Extended Kalman Filter for Attitude Estimation[END_REF] a reinforcement learning method was applied to improve the performance of an EKF algorithm, addressing inaccurate initial estimation, filter gains, and noise model. A method for training deep neural networks was developed in [START_REF] Al-Sharman | Deep-learning-based neural network training for state estimation enhancement: Application to attitude estimation[END_REF] for enhancing the AE by a Kalman filter. In [START_REF] Xiang | Attitude estimation based on recurrent neural network and vector observations for attitude and heading reference system[END_REF] a novel attitude estimator model was conceived based on recurrent neural networks able to eliminate sensor errors, while implementing dynamic AE. A long short-term memory neural network was trained in [START_REF] Liu | Attitude estimation of unmanned aerial vehicle based on LSTM neural network[END_REF] using real quadrotor sensors' data for AE, and high accuracy results were obtained. In [START_REF] Zmitri | Bilstm network-based extended kalman filter for magnetic field gradient aided indoor navigation[END_REF] a magnetic field gradientbased EKF is used along with a BiLSTM network to achieve better estimates of the velocity of a moving body using inertial sensors. To the best of our knowledge, the mitigation of SEU on AE processing is not well addressed until now in the literature. More specifically, we deal with bit-flips in the algorithm's variables occurring in the processor during the computation of quaternion from a set of measurements, that can lead to miscalculations and consequently a wrong estimated attitude. The impact of learning approaches on AE processing to mitigate soft error effects (SEU) has the merit to be studied deeply, using residuals and a correction phase. A specific and realistic soft errors injection on AE processing was proposed, followed by an effective methodology to create a training dataset for mitigation, in which a satellite's orbit and the characteristics of sensors used for the mission need to be taken into account. Finally, the paper gives a deep analysis of the effects of ML models on AE processing and the improvement rates for mitigation of SEU effects in satellite applications. This paper is organized as follows: Section II explains the framework of the novel technique developed for soft error effects mitigation, with some details on the considered quaternion Kalman filter and the methodology for creating a training dataset for ML models. Section III contains the ML models dataset generation and training results, as well as the simulation results considering the AE algorithm combined with the ML mitigation technique. Section IV presents a brief discussion about the impacts of the proposed solution on the control strategy inside the ADCS. Section V gives some conclusions of the work and possible perspectives. Finally, the Appendix I presents a brief description of three supervised ML models we used as component of the mitigation technique.

Framework for Soft Error Effects Mitigation approach on

Quaternion Kalman filter for attitude estimation

This section describes the framework of the proposed ML-based technique to mitigate soft error effects on the processor of ADCS, where the quaternion Kalman filter is implemented. This framework is presented in Figure 2 and can be summarized as follows: (1) The NQKF, for AE processing, receives a set of measurements from the used sensors. In this work we considered a 3-axis gyroscope and a star tracker as main sensors. Their measurements are assumed not disturbed by soft errors.

(2) The NQKF runs with this set of measurements using the processing resources of the ADCS. It is assumed that a SEU occurs in any variable of the NQKF during its processing, leading to miscalculations. The attitude quaternion q is then estimated, then the residuals are calculated using q and y B . We consider the star tracker will track the position of two stars, hence providing two vectors, y B 1 and y B 2 that compose y B . Therefore, the res vector is calculated as:

res = res 1 res 2 = y B 1 -A[q]r N 1 y B 2 -A[q]r N 2 (2.1)
in which r N1 and r N2 are the reference vectors in N (see section 2.1).

(4) Each residual in res pass through an evaluation step, where its norm is compared with a predefined threshold. If both residual norms are bigger than the threshold (SEU detected), the res vector will be passed to a ML model, already trained, to estimate the orientation error (q error ) caused by the soft error. Otherwise, the ML model will not be activated (SEU not detected), hence no correction will be applied. In that case, the NQKF will continue to run normally and the next iteration starts.

(5) If the SEU is detected, q is multiplied by q error throughout a quaternion multiplication producing a corrected quaternion q c . The normalized q c will then replace q, and also the error covariance matrix P is re-initialized as

P c = 0.1 • I 4 .
Detailed explanations of the variables in Figure 2, the NQKF algorithm, and the ML methodology can be found in Sections 2.1 and 2.2.

2.1. Quaternion Kalman Filter for AE.

2.1.1.

Preliminaries Necessary for AE. The objective of the AE is to determine the orientation of a moving frame fixed to the body in the application (body frame B) in relation to a reference frame (N) normally celestial or Earth-fixed, based on at least two observation vectors (measurements). The observation equation based on these vectors can be used in dynamic estimation approaches (NQKF for example). It is defined as follows:

y B = y 0 B + δy B = A[q]r N + δy B , (2.2)
where vectors y 0 B ∈ R 3×1 and r N ∈ R 3×1 are the normalized projections of physical vectors along the axes of B and N, respectively. The vector y B ∈ R 3×1 represents the output of sensors fixed on B, whereas r N is known from a physical model. The vector δy B ∈ R 3×1 is an additive measurement noise. The attitude is represented in form of quaternion q ∈ R 4×1 , which is a hypercomplex vector as follows:

q = ê q 4 = n • sin(α/2) cos(α/2) (2.3)
where q 4 and ê = [q 1 q 2 q 3 ] T ∈ R 3×1 are the quaternion real and complex components, respectively. Also, the quatrenion can be decomposed in an angle of rotation α and an unitary axis n ∈ R 3×1 , that indicates the direction of rotation. The attitude matrix A[q] ∈ R 3×3 , function of the quaternion, is represented by:

A[q] = (q 2 4 -êT ê)I 3 + 2êê T -2q 4 S[ê]. (2.4)
This matrix is able to convert a vector represented in the reference frame N into the body frame B. The matrix S[e] ∈ R 3×3 is the skew-symmetric matrix applied to the quaternion complex part, as shown in Equation 2.5, and I 3 ∈ R 3×3 is an identity matrix. Equation 2.4 is non-linear, thereby 2.2 as well.

S[e] =   0 -q 3 q 2 q 3 0 -q 1 -q 2 q 1 0   (2.5)
2.1.2. Overview of the Novel Quaternion Kalman Filter (NQKF). The NQKF algorithm studied in this paper was developped in [START_REF] Choukroun | Novel quaternion Kalman filter[END_REF]. The state vector x ∈ R 4×1 is composed only by the attitude quaternion, the sensors' biases are not estimated, i.e. x = q. Manipulating Equation 2.2 is possible to establish a linear pseudomeasurement equation that can be used in the Kalman filter algorithm, and then the linearization process is skipped. The summary of the case-study NQKF algorithm implemented is as follows:

• Time Propagation: -Initialize the state vector x 0/0 = q 0/0 and the error covariance matrix P 0/0 . -Given x k/k calculate the predicted state vector:

x k+1/k = Φ k x k/k = e (1/2)O[w k ]Ts x k/k , where O[w k ] = [-S[w k ] w k ; -w k
T 0] is a matrix operator, function of the angular velocity vector w k ∈ R 3×1 measured at the instant k, and the T s is the sensors' sampling time. S[w k ] is the skewsymmetric matrix applied to w k .

-Given P k/k calculate the predicted error covariance matrix:

P k+1/k = Φ k P k/k Φ T k + 0.25T 2 s E[x k/k ]QE[x k/k ] T , where E[x k/k ] = [S[e k/k ] + q 4 k/k I 3 ; -e k/k
T ] is a quaternion-matrix operator, and Q = σ 2 w I 3 is the noise covariance matrix of the state q k , following a normal distribution ∼ N (0, σ w ).

• Measurement Update:

-Given y B k+1 and r N k+1 compute:

s k+1 = 0.5(y B k+1 + r N k+1 ). d k+1 = 0.5(y B k+1 -r N k+1 ).
-Build the observation matrix:

H k+1 = -S[s k+1 ] d k+1 -d k+1 T 0 .
-Compute the Kalman gain:

K k+1 = P k+1/k H T k+1 (H k+1 P k+1 H T k+1 + R k+1 ) -1 , where R k+1 = 0.25 T 2 s E[x k+1/k ] R E[x k+1/k ]
T is the measurement noise covariance matrix, and R = σ 2 v I 3 is the covariance matrix associated to the measurement noise, assumed to have a normal distribution ∼ N (0, σ v ).

-Calculate the estimated state vector:

x k+1/k+1 = x k+1/k -K k+1 H k+1 x k+1/k .
-Calculate the estimated error covariance matrix:

P k+1/k+1 = (I 4 -K k+1 H k+1 )P k+1/k (I 4 -K k+1 H k+1 ) T +K k+1 R k+1 K T k+1 .
-Normalize the state vector (the quaternion):

x k+1/k+1 = x k+1/k+1 ||x k+1/k+1 || .
For the sake of simplicity, from now on the estimated state vector x k+1/k+1 will be referred as just the quaternion q, the state predicted x k+1/k as q m , the predicted covariance matrix P k+1/k as P m , the Kalman gain K k+1 as K, and the estimated covariance matrix P k+1/k+1 as P.

ML Models and the Methodology for Creating a Training Dataset.

The ML model needs to accomplish the following task: given a set of residuals (input), find the respective quaternion error (output) associated to these residuals. This scenario can be modeled as a supervised ML regression problem. Three classical ML models used for this task were implemented and tested: Artificial Neural Network (ANN), Decision Trees (DT), and Random Forest (RF) (see Ap-pendix6 for detailed description of these models).

For implementing the proposed mitigation approach, it is necessary to train the ML models with a training dataset. Due to the non-availability of real satellite data under radiation effects and the complexity to obtain such dataset, a methodology for creating a training dataset was conceived as follows: (1) Casestudy scenario definition; (2) Sensor measurements acquisition (3) Soft errors injection on AE processing; (4) Training dataset samples generation.

2.2.1.

Case-Study Scenario Definition. As aforementioned, the case-study scenario we are considering is a satellite orbit. In Figure 3, three important reference frames for defining a satellite's orbit are represented. The celestial frame is an Earth-centered stationary reference frame. Usually, this frame has its X-axis pointing to the fixed direction of the vernal equinox, Z-axis normal to the equatorial plane, and Y-axis completing the the orthogonal triad (XY contained in the equatorial plane). The perifocal frame (N) lies on the orbital plane, having its x N -axis pointing towards the periapsis point (see Figure 3), the location in the orbit where the satellite is the closest to the Earth, z N -axis is normal to the orbital plane, and y N -axis completes the orthogonal system. Finally, the body frame (B) is fixed on the satellite center of mass. The satellites' orbits are actually ellipses, having one of its focuses located on the planet's center of mass. An orbit can be defined by six classical orbital elements [START_REF] Tewari | Atmospheric and Space Flight Dynamics: Modeling and Simulation with MAT-LAB and Simulink[END_REF]. The ellipsoidal shape is defined by its eccentricity e and its semi-major axis a. Moreover, the Euler angles Ω, i, ω, called right ascension, inclination, and perigee argument respectively, indicate the orientation of N in relation to the celestial frame. The last orbital element is called time of periapsis τ , which represents either the time that the satellite last passed by the periapsis point (τ < 0) or the remaining time to reach the periapsis (τ ≥ 0). The satellite desired attitude in the present study depends on the satellite's position over time in the orbit. The defined attitude objective is: maintain the negative x B -axis pointing towards the center of the Earth, while keeping thez B -axis aligned with the z N -axis during all the orbit.

2.2.2.

Sensor's Measurements Acquisition. In this work the sensor measurements were obtained throughout simulation. The satellite's positions and velocities in a given orbit in relation to the celestial frame could be obtained by implementing the equations of motion for the two-body problem exposed in [START_REF] Tewari | Atmospheric and Space Flight Dynamics: Modeling and Simulation with MAT-LAB and Simulink[END_REF]. Only the Earth-satellite system was considered, being the Earth's gravitational force the only force acting on the satellite. For keeping the desired orientation, a control system was designed. Knowing the satellite's angular velocity and initial orientation (q 0 ), the true quaternion representing the orientation of B with respect to N can be calculated by solving:

q true = e (1/2)O[wtrue]t q 0 , (2.6
) where w true is the satellite's true angular velocity (without any noise added), t is the time, and the matrix operator O is defined in Section 2.1. The satellite's true positions and orientations were used for generating the sensors' measurements. The gyroscope measurements were modeled as:

w = w true + δ w (2.7)
where δ w is an additive white Gaussian noise ∼ N (0, σ w ). The star tracker's measurement model was implemented for tracking the position of two stars, thus generating two other references (as observations) for the NQKF. These references are vectors pointing towards the chosen reference stars. Figure 4 illustrates the process for obtaining the position vectors of the stars with respect to the satellite in the perifocal frame (r N ). Having the satellite's and stars' positions in the celestial reference frame, R SAT and R STAR respectively, it is possible to obtain the relative position of the star with respect to the satellite in the perifocal frame (r N ) as:

r = R STAR -R SAT r N = C 3 (ω)C 1 (i)C 3 (Ω)r/||r||,
where C 1 and C 3 are the fundamental rotation matrices for rotating a vector in the x and z axis respectively [START_REF] Tewari | Atmospheric and Space Flight Dynamics: Modeling and Simulation with MAT-LAB and Simulink[END_REF]. Finally for generating the star tracker measurements r B , the following model was used: r B = A[q true ]r N + δ s (2.8) where δ s is an additive white Gaussian noise ∼ N (0, σ s ). The gyroscope measurements are used in the time propagation step of the NQKF, whereas the star tracker signals in the measurement update step as:

y B = r B 1 r B 2 = A[q true ]r N 1 + δ s A[q true ]r N 2 + δ s (2.9)
in which r B 1 and r B 2 are the positions of the two stars provided by the star tracker in B, whereas r N 1 and r N 2 are the position vectors of the same stars represented in N.

2.2.3. Soft Errors Injection on AE processing. Among the different types of soft errors that can be provoked by radiation particles in electronic systems, the SEUs will be object of study. This kind of soft error is characterized by the inversion of a single or multiple bits in a memory element at a time [START_REF] Jedec | Measurement and Reporting of Alpha Particle and Terrestrial Cosmic Ray Induced Soft Errors in Semiconductor Devices[END_REF]. Modern processor architectures usually handle variables with 32 or 64 bits. Arithmetic and logic unities and floating-point unities are present in modern CPUs to perform floating point operations, in which real numbers are usually expressed in the IEEE-754 standard [START_REF] Maniatakos | Low-cost concurrent error detection for floating-point unit (fpu) controllers[END_REF]. Figure 5 shows the binary representation of a double precision floating-point number in the IEEE-754 standard. The number is represented in a sequence of 64 bits, 1 bit dedicated to the sign, 11 bits to the exponent and 52 bits to the mantissa. Equation 2.10 can be used to convert the binary number to decimal representation.

n decimal = (-1) s • (1 + i=52 i=1 b 52-i 2 -i ) • 2 E-1023
(2.10)

In Equation 2.10, s represents the sign bit, b inside the summation represents the respective mantissa bit, and E is the decimal format of the exponent binary representation. The value stored in the bits relative to the exponent has a bias added to be possible storing both positive and negative exponents. For this representation, a bias of 1023 is added. Consequently, when converting back to decimal, a factor of 1023 needs to be subtracted from E, as Equation 2.10 shows.

It was necessary to observe the SEU effects directly on the algorithm's response, the faults could not be masked, and should be produced frequently. Therefore, in this work a high level method for injecting soft errors on the AE algorithm's execution was adopted. The sensor's measurements were split in windows of 5 sec and then processed by the NQKF. During the computation, a SEU was injected in a NQKF variable (such as one component of the Kalman gain or the error covariance matrices, or even the estimated quaternion for example, cf. Section 2.1) right in the middle of the time window. The selected variable was firstly converted into its binary double precision representation (cf. Figure 5), and then a single bit was inverted. After, the variable was converted back to its decimal representation using Equation 2.10, and passed to the algorithm to continue the computation.

2.2.4.

Training Dataset Samples Generation. Finally, with the quaternions estimated by the AE algorithm under SEU effects, the quaternion error could be calculated through:

q error = q true * q -1 (2.11)
where * represents the quaternion multiplication. Furthermore, the residuals res (cf. Figure 2) are then computed using the estimated quaternion q and the star tracker's measurements from the two tracked stars considered.

In conclusion, the training dataset is composed of samples made with the inputs res ∈ R 6×1 and the outputs q error ∈ R 4×1 . It will be used for training the ML models.

Main Results of the Mitigation Approach

In this section, we give the parameters defined for creating the training dataset, show some results of the ML models selection/training, and finally propose a performance evaluation of the ML-based AE technique for soft error effects mitigation.

3.1.

Training Dataset Generation Results. The orbit used for generating the training dataset samples for the ML models is defined by the following orbital elements:e = 0.0001, a = Re+1111 km (Re is the Earth's equatorial radius ∼ 6371 km), τ = 1000 sec, Ω = 0°, i = 63°, ω = 0°. A Python program was implemented for generating the orbital data, the sensors' measurements and further soft error injection, as described in Section 2. Figure 6 shows the attitude quaternions obtained for a section of the reference orbit. The abrupt variation of quaternion at the beginning of the simulation is due to the control's action trying to direct the satellite. Alpha Centauri and Sirius were the chosen stars for the star tracker monitoring, considering their positions in the J2000 celestial referential, in which the axis are oriented following the Earth's mean vernal equinox and mean rotation axis in the year 2000. The sampling time for the used sensors was chosen as 0.1 sec, and the noises for the gyroscope and star tracker following ∼ N (0, σ w = 10 -3 rad/s) and ∼ N (0, σ s = 10 -4 ), respectively. Moreover, the measurement error of the attitude from the utilized star sensors was calculated theoretically to be about 20 arcsec, which is in accordance with the precision of commercial star trackers. If different sensors are used in such application with different orbit parameters, new data needs to be acquired and added to the database to train the ML models.

For executing the soft errors injection procedure described in Section 2.2.3, different NQKF variables were assessed. A testing dataset with 30 sec of simulation for the same sensors previously defined and the same orbit was created, with τ = 0. SEUs were injected following the procedure described each 5 sec, i.e. a single bit of the different assessed variables was changed. For each variable, 500 simulations were performed, in which the bit (only signal and exponent) and the variable component were chosen randomly. Table 1 shows the results for simulations made to find the most critical variables to be disturbed by the SEU effects. The performance of the NQKF algorithm under SEU effects was

RM SE = N i=1 (y true i -y i ) 2 N , (3.1)
where y true i and y i represent the Euler angles obtained converting the estimated quaternion q without and with the SEU effects, respectively, following the Yaw-Pitch-Roll sequence. N is the number of points in the simulations. The RMSE for each angle in each simulation was then averaged. The most impacting effects were observed when injecting soft errors in the estimated quaternion q, more specifically in the real component q 4 , in which the largest RMSEs were observed. Finally, the training dataset contains the data in which SEUs were injected in the real components of the estimated quaternion, in the bits b 63 , b 61 , b 60 , b 59 , and b 58 (See Figure 5). A dataset 1 with 2000 sec of simulation and a dataset 2 with multiple simulations of 70 sec each, were created. Both are simulations for the same orbit, with the same sensors, and same bits chosen for injecting SEUs. Nevertheless, Table 2 shows the parameters that differentiate the two datasets. All the parameters combinations were simulated. The final training dataset is a merge of these two, therefore containing the residuals and quaternion errors for training the ML models. In total, the final training dataset contained 310,000 samples, 100,000 from the dataset 1, and 210,000 from the dataset 2.

Table 2. Different parameters for generating the training dataset. The "batch size" for the ANN training is the number of inputs that will be considered before the ANN weights are updated. The "dropout" layers are used only while training, and basically they randomly eliminate at each step a percentage of neurons to be considered, which helps preventing overfitting. The optimization algorithm used was "Adam", and the rectified linear ("ReLU") was set as activation function for the neurons. For the DT model, the "max depth" limits the depth of the tree, whereas "min samples leaf" defines the minimum number of samples required to be at a leaf node. These hyper-parameters help to smooth the model, preventing overfitting. The hyper-parameters tested for the RF model were the same as for the DT with addition of the "number of estimators", that defines the number of trees in the model. This range of hyper-parameters was chosen through experimentation, trying to achieve the best performances with a reasonable computation time, that will be further discussed.

Datasets Initial orientation

(q 0 ) τ (sec) Simulation time (sec) Dataset 1 [0,0,0,1] 1000 2000 Dataset 2 n = [[0,0,1], [0,1,0], [1,0,0]] 1000,
Table 3 shows the results of the nested CV method. An outer loop using a 5-fold CV was used for measuring the ML models' performances, considering the mean squared error (MSE) as metric, whereas an inner-loop consisting of a 3-fold CV was used to select the best hyper-parameters for each model. The scikit-learn function "GridSearchCV" was used to accomplish this task. This function performs the CV, testing exhaustively the combinations of hyper-parameters under test. Due to the large training dataset obtained, and the limited hardware resources available, just half of the samples were used in the nested CV process, i.e. the training dataset was copied taking one sample and ignoring the next. 3 shows, the average MSE of the three models were similar, however the RF and DT performed better. Using the best hyper-parameters obtained in the nested CV process, the models were trained with the full training dataset. As the CV was made shuffling the training dataset, the samples used in each fold to evaluate each ML model were not the same. Because of this, the performances given by the average MSE may be biased. For approaching this issue, a testing dataset was created to evaluate the generalization performances of the NQKF coupled to the ML models.

ML-based NQKF for Soft Error Mitigation Results

. The trained ML models were used in the framework of the NQKF, following the schema illustrated in Figure 2. For testing the generalization of the resulting algorithms obtained through the CV procedure, a testing dataset was created. This testing dataset is based on the same orbit and sensors' models previously defined, however, now the sensors are sampled with a frequency of 50 Hz for estimation purpose. Different combinations of initial satellite's positions in the orbit and orientations are considered. Remembering that the objective of the orientation is always pointing the negative x B to the center of the Earth, keeping z B perpendicular to the orbit's plane. Table 4 shows the parameters for the testing dataset.

Table 4. Parameters for creating the testing dataset.

Initial orientation

(q 0 ) τ (sec) n = [[1,0,0], [0,1,0], [0,0,1], [1,1,1]/ √ 3, [0,1,1]/ √ 2 [1,0,1]/ √ 2, [1,1,0]/ √ 2]]
600, 300, 0, -300, -600 α = 90 o In total 35 simulations of 60 sec composed the testing dataset, which were executed 50 times for each ML-based NQKF while SEUs were injected in a component of the estimated quaternion. The time instant, the quaternion component, the amount of bit flips, and the target bits (considering only signal and exponent bits) were chosen randomly. However, for the three ML models, SEUs were identical, i.e. they were injected at the same time, quaternion component, and bits in the simulation. Moreover, it was ensured that the ML models were activated. For the sake of having a better interpretation, the quaternions were converted into Euler angles (following the Yaw-Pitch-Roll sequence), and the performance was measured throughout the RMSE (Equation 3.1) and the mean absolute error (MAE) calculated as:

M AE = N i=1 |y true i -y i | N , (3.2)
where y true i represents the Euler angle obtained by converting q true . The term y i either represent the Euler angle obtained by converting q from the simulation of the ML-based NQKF under SEU effects or the Euler angle calculated only with the NQKF under the same effects. N represents the number of points in the simulation. The simulations have 60 sec each, with a sampling time of 0.02 sec (50Hz), N = 3000. Moreover, the RMSE and MAE were averaged considering the total number of executions of the simulations in the testing dataset (35 different simulations × 50 executions of each simulation = 1750 total executions for each learning-based NQKF). The results are shown in Table 5.

Each column in Table 5 presents a different combination of the NQKF with a ML technique for the metrics relative to each respective Euler angle in each row. The values shown inside the parenthesis represent the error reduction of the ML-based NQKF compared to the second column, where only the NQKF was acting under the SEU effects. The three techniques acted very well, reducing both the MAE and the RMSE in a similar percentage compared to the NQKF alone. The MAE reduction for the ML-based NQKF reached a maximum of 75.7%, 82.5%, and 80.5% for the angles ϕ, θ, and ψ, respectively, considering all the ML models. For the sake of comparison and to demonstrate the efficiency of the technique, another recent AE algorithm was also implemented within the ML-based framework. The algorithm described in [START_REF] Barrau | Three examples of the stability properties of the invariant extended kalman filter **this work is supported by the company safran[END_REF] is an invariant extended Kalman filter (IEKF), which provides the attitude in the form of a rotation matrix. The implementation of the IEKF can be found in [START_REF]Ghadeer-SHAABAN/AttitudeEstimation-IEKF[END_REF]. As the mitigation technique needs a quaternion attitude representation, the IEKF was normally executed, and its outputs were converted into quaternions. The same framework described in Figure 2 was implemented, as well as the same soft error injection performed for the NQKF (see Table 5) was applied to generate the results in Table 6. In the first column of Tables 5 and6, only the AE algorithms were executed under SEUs (without mitigation), we can see that the IEKF achieved lower RMSE and MAE compared to the NQKF. But the final errors, when both algorithms were implemented within the mitigation technique, were similar. The NQKF is a classic linear AE algorithm, being simple to implement and fast to compute, since the traditional linearization of the measurement equations are not necessary. The IEKF is a recent algorithm successfully applied for AE, gyrocompass, and camera localization [START_REF] Barrau | Three examples of the stability properties of the invariant extended kalman filter **this work is supported by the company safran[END_REF], for example. However, its implementation and the concepts behind the algorithm, which rely on Lie groups and the SO(3) orthogonal groups, are quite complex and request higher computation time and cost, than the NQKF. It is clear from this comparison that the NQKF, even if it becomes old in the domain, is still competitive and efficient (especially when coupled to the mitigation technique) and can continue to be used successfully within this framework.

The effects of the SEUs on the NQKF and IEKF are characterized as a peak when the soft error occurs, and a settling time where the algorithm tries to recover. Figure 7 shows an example of the SEU effects. In the schema of the proposed work (see Fig. 2), the star sensors were used for correction and estimation of the state vector, followed by the injection of the soft errors in the real component q 4 . Then the accuracy brought by these sensors in the estimation/correction step is degraded by the injected soft errors after. Since the RMSE in the two Tables are calculated including the observed peaks, the attitude errors from the learning-based NQKF or the learning-based IEKF are little larger than the accuracy of the star sensors. Without the injection of soft errors, the attitude errors are found to be in the same range of star sensors' accuracy. 5, simulations of 60 sec were considered, in which just one SEU was applied. As the errors naturally do not last more than 5 sec, the average error will be low. However the error magnitudes surpassed 100°in many cases in Figure 7, which cannot be neglected. Considering the other curves representing the ML models-based NQKF, all the combinations practically mitigated completely the SEU effects after 50 sec of simulation, period where the satellite's orientation varied very slowly. During the transitory phase, where the satellite was moving from a random orientation trying to point to the center of the Earth, the performance of ML techniques is less, specially the RF and DT, however in most cases better than the NQKF alone.

Here lies the importance of the block "Evaluation" in Figure 2. The function of this block is to activate or deactivate the ML model, for reducing the overload, and also possible deterioration of the AE performance in case of multiple activation of the ML models. This block monitors the residuals magnitude, calculated using the star tracker information of the two stars considered. It was found throughout simulations that when any of the two norms of residual's vectors was bigger than 0.1, the ML models should be activated. This threshold provided was used for producing the results in Table 5 and in Figure 7.

Implications of the Soft Error Mitigation Technique

An AE system does not act independently. Figure 8 shows a schema of an ADCS, considering the AE and the control system. Basically the objective of the ADCS is to determine and control the satellite's attitude based on a target/reference. The AE block provides outputs, calculated based on the sensor's measurements, that will be compared to the reference and the error between them will serve as input for the control system. The control system will send commands to the actuators, finally controlling the satellite's orientation. In this paper, only the AE algorithm under soft error effects was studied. When the SEU disturbs directly the AE algorithm, it can cause large errors that will be passed to the control system. The effects of these errors on the control part need to be investigated, because the information that the control system receives may be largely wrong, during the SEU effect periods, capable of leading to dangerous scenarios in safety critical applications, such as satellites. Another point important to be mentioned is the overhead caused by the ML techniques in the AE algorithms. The impact of the ML in the processing time of the AE algorithms will be noticed just when the residuals norm surpassed the threshold. The average execution time of the trained models is about 0.12 ms for the NN, 7.7 ms for the RF, and 0.06 ms for the DT, whereas one iteration of the NQKF is about 1.47 ms in the machine used for generating the results. The NN and DT techniques are much faster than the NQKF itself, about 11 and 23 times respectively, unlike the RF. One solution would be to simply run again the NQKF iteration in which a large residual error was observed. However, for this it would be necessary to use values stored in the RAM memory from the previous iteration. The SEUs are completely random, so it is difficult to identify which variable is corrupted, being possible to use again a corrupted parameter in the new NQKF iteration. The advantage of the proposed soft error mitigation technique is that it only needs the orientation error information contained in the residuals, not being necessary to monitor or protect the Kalman filter's variables.

The chances of a particle strike provoke a soft error in the AE algorithm's calculation are much higher than in the residuals or in the ML calculation, since the execution time of the Kalman filter-based algorithm is much higher, hence its variables remain more time exposed to the radiation environment. However, if a soft error occurs during the residuals calculation, a simple solution would be to perform this step twice, and then to compare the residuals to decide if the residuals are corrupted. Otherwise, if a soft error occurs in the ML calculations, the new residual vector can be calculated with the corrected quaternion, provided by the ML model, and compared with the first residuals (before the ML correction). Some actions could be taken, for example, if the new residuals' norm are higher than the previous one, the old quaternions could feed the next AE algorithm's iteration, or the ML correction could be performed a second time.

Conclusions

In this work three machine learning models were assessed in a framework for mitigation of soft error effects in the AE processing, more specifically SEU effects. The results show that the learning-based technique combined with an AE algorithm based on the Kalman filter, accomplished very well the task of minimizing the SEU effects, thus reducing the risks of passing large errors to the control system. The performances of the trained neural network, decision tree, and random forest models were quite similar, while adding little overhead to the AE algorithm's computation. Increasing the variety of samples data in the training dataset, including different initial orientations and positions in the orbit, probably will enhance the generalization capacity of the models, hence improving the SEU effects mitigation mainly in the phase in which the attitude varies more abruptly. Furthermore, the re-initialization of the error covariance matrix in this paper was made by only setting this matrix as a constant multiplied by an identity matrix. Re-initializing the error covariance matrix with values that reflect better the current states of the system is another point of improvement of the mitigation framework. the algorithm cannot reduce the cost). This algorithm is prone to overfitting, and because of this, the constraints in the training may be applied, such as limiting the tree maximum depth, and setting the minimum number of samples for splitting the nodes. For making a prediction with the training tree, the input needs to traverse the DT nodes, being conducted by the decision rules of each node, until it reaches a leaf. The resulting output, for regression tasks, will be the average of the samples in the leaf.

Random Forests (RF). The RF model uses a technique called model ensembling, that consists of combining multiple fundamental models in order to have better predictions [START_REF] Acharya | A comparison of regression models for prediction of graduate admissions[END_REF]. In the case of RF regression, multiple decision trees are used as base models. Each tree is trained independently, as previously described, and a method called bootstrap aggregating (bagging) is applied. In this method, random sub-samples with replacement of the input dataset are used to build the decision tree structure (creation of decision nodes and leaves). For RF regression, the predictions of the independent trees are averaged, providing the final prediction. The bagging method provides to the RF training datasets with more randomness, which can improve the generalization.

Cross-Validation for ML model selection.

When training a ML model, a set o parameters and hyper-parameters need to be adjusted so that the model will be able to better fit the data. The training should be adapted in such a way the model has enough examples to train on, but at the same time avoid overfitting the training data, being able to make predictions on unseen data. Cross-validation (CV) is the most common method used for evaluate the performance of ML models [START_REF] Yadav | Analysis of k-fold cross-validation over hold-out validation on colossal datasets for quality classification[END_REF]. Furthermore, CV can be used for model selection, in which several ML models are compared and the one with the best performance is selected [START_REF] Zhang | Cross-validation for selecting a model selection procedure[END_REF]. The CV consists of splitting the data, in which part of it is be used for training and the remaining for testing and performance measurement. Many different CV procedures exist, being one of the most common called k-fold CV. In this method the data is divided into k folds of the same size. Training and testing are done in k iterations, in which k-1 folds are used for training, leaving one fold for testing. The performance in each iteration is calculated and the results are averaged, providing the average model performance.

Nested CV is a method that consists on using two CV loops, one inside the other. The inner loop is used to select the best model hyper-parameters in a given set, whereas the outer loop computes the error. Instead of using CV for estimating the performance of a single ML model, nested CV estimates the performance of an optimized model, and it is a method that reduces the bias considerably [START_REF] Varma | Bias in error estimation when using cross-validation for model selection[END_REF], providing a better estimate of the true error of a ML model. After selecting the model through CV, the model parameters are then calculated using the entire dataset for training.

1

 1

Figure 1 .

 1 Figure 1. Satellite's ADCS under soft errors caused by radiation (VTS Timeloop software from Centre National d' Études Spatiales (CNES)).

Figure 2 .

 2 Figure 2. ML-based AE processing for soft error mitigation.

Figure 3 .

 3 Figure 3. Satellite reference frames and orbital elements for dataset generation.

Figure 4 .

 4 Figure 4. Satallite's and star's position vectors.

Figure 5 .

 5 Figure 5. IEEE-754 double precision floating-point number binary representation.

Figure 6 .

 6 Figure 6. True quaternion and estimated one by the NQKF algorithm without soft error effects for partial satellite's orbit.

  o , -45 o , 45 o , 90 o ] 3.2. ML Models Training and Selection Results. In this work, Python Keras 2.4.3/Tensorflow 2.3 alongside with scikit-learn 1.0.2 were used for training, testing and validation the ML models. Nested Cross-Validation (CV) (see 6) was used for selecting the models' hyper-parameters, and subsequently evaluate the performance of each approach. The hyper-parameters tested are summarized as follows: • Artificial Neural Network (ANN): -Number of hidden layers: [1, 2, 3] -Batch size: [50, 100] -Number of neurons in each hidden layer: [150, 200, 300] -Dropout rate in between each layer: [10%, 20%] • Decision Tree (DT): -Max depth: [50, 100, 300, 500] -Min samples leaf: [10, 25, 50] • Random Forest (RF): -Number of estimators: [25, 50, 100] -Max depth: [50, 100, 300]-Min samples leaf:[START_REF] Kraemer Sarzi | Assessment of radiation effects on attitude estimation processing for autonomous things[END_REF][START_REF] Tewari | Atmospheric and Space Flight Dynamics: Modeling and Simulation with MAT-LAB and Simulink[END_REF] 50]

Figure 7 .

 7 Figure 7. Illustration of the SEU effects on the different ML models-based NQKF.

Figure 7

 7 Figure 7 is an example in which multiple SEUs were injected. It is important to highlight that is very unlikely that multiple sequential SEUs will occur like in this example, however this is just a theoretical simulation to illustrate the SEU effects on different time instants of the orbit, and how the proposed technique acts mitigating these effects. The true angle represents the ideal result of the NQKF algorithm, without any compensation of the soft error effects, and the other curves represent the ML trained models-based NQKF. The SEU injected in the real component of the estimated quaternions q 4 , leads to change different exponent or signal bits, which effects were reflected in the Euler angles obtained by converting the estimated quaternions q. The time between each injected SEU was 10 sec. Observing the blue curve, where just the NQKF was acting, each SEU provoked a huge peak, resulting in large instantaneous errors. Most errors lasted about 3 sec or even less before converging to zero, what explains why the values of the MAE and RMSE are relatively low. For generating Table5, simulations of 60 sec were considered, in which just one SEU was applied. As the errors naturally

Figure 8 .

 8 Figure 8. Block diagram of ADCS.

Table 1 .

 1 NQKF RMSE results for SEUs injected in different variables.

	Variables of NQKF RMSE ϕ( o ) RMSE θ( o ) RMSE ψ( o )
	q	0.058624	0.035259	0.049740
	K	0.006429	0.001981	0.006429
	q m	0.051221	0.033385	0.038866
	P m	0.006440	0.002054	0.006436
	P	0.006435	0.001992	0.006438
	q 4	0.167030	0.092891	0.150951
	q m4	0.143919	0.088078	0.109431

Table 3 .

 3 Cross-validation results of the implemented ML models.

	ML model Average MSE Best hyper-parameters
			Hidden layers: 3
	ANN	0.012	Neurons: 200 Batch size: 100
			Dropout: 10%
	DT	0.008	Max depth: 50 Min samples leaf: 10
			Number of estimators: 50
	RF	0.008	Max depth: 100
			Min samples leaf: 10
	As Table

Table 5 .

 5 Testing results of the ML models-based NQKF under SEU effects.

	Errors( o ) NQKF NQKF+NN NQKF+DT NQKF+RF
	RMSE ϕ 5.65	2.961(-47.6%) 2.999(-46.9%) 2.941(-47.9%)
	RMSE θ	2.65	1.442(-45.6%) 1.37(-48.3%) 1.365(-48.5%)
	RMSE ψ 5.78	2.516(-56.5%) 2.375(-58.9%) 2.363(-59.1%)
	MAE ϕ	0.64	0.158(-75.4%) 0.157(-75.5%) 0.155(-75.7%)
	MAE θ	0.54	0.097(-82.0%) 0.095(-82.5%) 0.095(-82.5%)
	MAE ψ	0.65	0.134(-79.5%) 0.127(-80.5%) 0.127(-80.5%)

Table 6 .

 6 Testing results of the ML models-based IEKF under SEU effects.

	Errors ( o ) IEKF IEKF+NN IEKF+DT IEKF+RF
	RMSE ϕ 3.924335 2.07(-47.2%) 2.05(-47.8%) 2.22(-43.5%)
	RMSE θ 1.875859 1.12(-40.1%) 1.07(-42.9%) 1.04(-44.5%)
	RMSE ψ	3.734788 2.22(-40.4%) 1.79(-52.0%) 1.84(-50.7%)
	MAE ϕ	0.503304 0.16(-68.5%) 0.15(-71.0%) 0.15(-70.2%)
	MAE θ	0.252329 0.08(-67.1%) 0.08(-69.0%) 0.07(-70.3%)
	MAE ψ	0.447838 0.16(-64.3%) 0.13(-71.5%) 0.13(-70.6%)

Univ. Grenoble Alpes, CNRS, Grenoble INP, TIMA, 38000, Grenoble, France.

Univ. Grenoble Alpes, Inria, CNRS, Grenoble INP, GIPSA-Lab,

38000, Grenoble, France.Email address: tarso.kraemer-sarzi-sartori@univ-grenoble-alpes.fr, hassen.fourati@gipsa-lab, rodrigo.bastos@univ-grenoble-alpes

Acknowledgements

This work was supported in part by: the MultiRad project of the région Auvergne-Rhône-Alpes's international ambition pack (PAI); the French national research agency within the France-2030 program (ANR-15-IDEX-0002); the LabEx PERSYVAL-Lab (ANR-11-LABX-0025-01); the IRT Nanoelec (ANR-10-AIRT-05) of the French national program PIA ("Programme d'Investissements d'Avenir).

Appendix I: Overview on the selected Machine Learning (ML) Models and Cross-Validation (CV)

This section discusses three ML models commonly used for both supervised classification and regression tasks: Artificial Neural Networks, Decision Trees, and Random Forests. Moreover, an overview of Cross-Validation for ML model selection and evaluation is also presented.

Artificial Neural Networks (ANN). An ANN, more specifically a multilayer perceptron (MLP) consists of neurons arranged in layers and connected by weights. The output of each layer serves as input to the next one. The inputs are multiplied by the weights and passed through activation functions. The MLP architecture, which combines nonlinear activation equations in each neuron, allows the approximation of extremely complex functions [START_REF] Gardner | Artificial neural networks (the multilayer perceptron)-a review of applications in the atmospheric sciences[END_REF]. To accomplish this task it is necessary to train the network, i.e. adjust the weights and biases of each layer so that the ANN is able to connect a set of input vectors (input dataset) to a set of associated output vectors (output dataset). Backpropagation is the most used algorithm for training neural networks [START_REF] Paeedeh | Improving the backpropagation algorithm with consequentialism weight updates over mini-batches[END_REF]. In simple terms, the weights are initialized, then a set of input vectors are forward propagated through the neural network generating predictions. The error between the predictions and the actual output vectors is accumulated in a cost function. It is then backward propagated, obtaining the gradients of the cost function with respect to the weights and biases. The weights are adjusted trying to minimize the overall error, throughout an optimization algorithm. ANNs may present a problem called overfitting, that is when the model fits very well the training dataset, however it cannot perform well on new data. Moreover, underffiting problems may occur, that unlike overfitting, the model does not fit well even the training dataset. Regularization techniques, different model structures, and more data might be required for solving this kind of problems.

Decision Trees (DT).

The DT is a ML algorithm that can perform both classification and regression tasks, and it is capable of training using complex datasets [START_REF] Géiron | Hands-on machine learning with Scikit-Learn, Keras and TensorFlow: concepts, tools, and techniques to build intelligent systems[END_REF]. It is composed of nodes and leaves. Each node has a decision boundary for a determined feature. The DT structure, e.g. amount of nodes, tree height, and leaves, is determined during the DT training. Usually the Classification And Regression Tree (CART) algorithm [START_REF] Géiron | Hands-on machine learning with Scikit-Learn, Keras and TensorFlow: concepts, tools, and techniques to build intelligent systems[END_REF] is used for training DT. Basically it starts splitting the training dataset in two, based on the feature and threshold that minimizes a cost function, that is usually the mean squared error for regression tasks. The split subsets samples are assigned to its respective nodes, and the same logic is applied recursively until a leaf is produced (due to constraints or