## 3 Methodology
### Calibration Method  
The genetic algorithm (GA) has been proven to be better in complex finding problems [7]. The genetic algorithm is an algorithm based on natural selection and reproduction [13]. Genetic algorithms can be used to find the best solution to a given problem. The main processes of the genetic algorithm are selection, crossover, and mutation. An initial population was defined in order to find solutions from the genetic algorithm. The nine unknowns to be found in this study were the three offsets of x, y, and z, gains of a, b, and c, and non-orthogonality angles of \(\lambda\), \(\rho\), and \(\phi\). The unknowns are shown in Figure 7. Definitions of the angles are shown in Figure 8 [14]. The unknowns were defined as chromosomes or genes, as shown in Figure 7. One gene was represented by 12 bits. Figure 8: Axis definition. Figure 6: Results of residual magnetic field test at ISAS/JAXA. Figure 7: Nine unknowns defined in this study. The genetic algorithm requires a fitness function to find the best match for unknowns. The difference between the observed magnetic field and the model magnetic field was defined as the fitness function. The non-orthogonality angles of \(\rho\), \(\lambda\), and \(\phi\) are shown in Figure 8. BreX, BreY, and BreZ axes are considered perfect orthogonal axes taken as calibrated values in Equations (1)-(3). Bx, By, and Bz are the non-orthogonal axes of the magnetometer sensors considered as measured values in Equations (1)-(3). \(\rho\) is the angle from the nominal Y axis to the X-Y plane. \(\lambda\) and \(\phi\) are the angles from the nominal Z-axis to the X-Z and Z-Y planes, respectively. Equations (1)-(3) show the relationship between the calibrated magnetic field in each axis, the measured values, gain, and offsets, and the non-orthogonal angles. \[\text{BreX}=\text{Bx}-\text{x}/\text{a} \tag{1}\]  
\[\text{BreY}=\frac{(\text{By}-\text{y})-\text{BreX}\times\sin{(\rho)}\times \text{b}}{\cos{(\rho)}\times\text{b}} \tag{2}\]  
\[\text{BreZ}=\frac{(\text{Bz}-\text{z})-\text{BreX}\times\sin{(\lambda)}\times \text{c}-\text{BreY}\times\sin{(\phi)}\times\cos{(\lambda)}\times\text{c}}{ \text{c}\times\cos{(\phi)}\times\cos{(\lambda)}} \tag{3}\]  
\[\text{Bt}^{2}=\text{BreX}^{2}+\text{BreY}^{2}+\text{BreZ}^{2} \tag{4}\]  
The genetic algorithm attempts to minimize the error between the total calibrated magnetic field and the WMM, which is considered to be the true solution. The RMS (root mean square) difference between track line data and the WMM was less than 200 nT [15] (p. 60). Thus, we believed this accuracy to be sufficient for us to use the WMM as the true solution. The calibrated total magnetic field Bt is shown in Equation (4). The error \"e\" is defined as Equation (5). Bwmm stands for the values taken from the WMM. In this equation, N denotes the number of data available. Figure 7.0  
The values used for the parameters in the genetic algorithm are shown in Figure 7.1 The initial population was a set of randomly chosen solutions. In this study, we selected an initial population of 1000. The initial population can be thought of as a set of genes. The number of generations denotes how many generations are iterated to find the best solution. The software stops when the given number of generations is processed. We selected the number of generations as 100 in order to find the unknowns for this study. Next, we processed the initial population to find the most suitable answers for the unknowns. In the selection operation, we selected individuals from the current population. The selection operation allows the genes to pass to the next generation. Best genes are determined using the fitness function. A selection ratio of 0.3 was used in this study. Mutation is another genetic operator. Mutation can change a gene and create a new individual. The mutation ratio is the probability of altering the bits in genes. Successful mutations survive during this process. Precision of the gene is represented by the number of bits. In the genetic algorithm, the genes are represented in binary.