# Dynamic Compensation of a Fluxgate Magnetometer Based on a Hybrid Optimizing Algorithm
## 2 Materials and Methods  
### Construction of the Dynamic Compensator for the Fluxgate Magnetometer  
#### 2.1.1 System Identification for the Fluxgate Magnetometer  
The dynamic characteristics of the fluxgate magnetometer are tested, and its model order is determined first. The sketch diagram of the test system and the photo of the real system with the experimental apparatus is shown in Figure 1. The test system mainly consists of two parts: a magnetic field generation module (excitation signal) and a signal acquisition module (excitation and response signal acquisition). The whole system is located in the magnetic shield chamber, which can effectively reduce the influence of magnetic noise such as the geomagnetic field and environmental electromagnetic interference on the dynamic characteristics of the magnetic sensor test. The magnetic field-generating module is mainly composed of a Helmholtz coil, an AC-DC current source, and a precision resistor. By applying AC-DC current to the coil through the AC-DC current source, an alternating/constant magnetic field can be generated inside the coil as the measured signal, namely, the input signal of the magnetic sensor. The signal acquisition module is mainly composed of a PXIe acquisition card, which is responsible for collecting the voltage at both ends of the precision sampling resistor and the output voltage of the magnetic sensor. By precisely sampling the voltage at both ends of the resistor, the current flowing through the coil can be calculated, and the magnetic field generated by the coil can be obtained. Similarly, by collecting the output voltage of the magnetic sensor, the output magnetic field of the magnetic sensor can be calculated according to the conversion coefficient of the magnetic sensor. Before the dynamic response test and further compensation for magnetometer, the ambient magnetic field of the magnetic shield chamber must be measured [20], and magnetic noise influence must be reduced. Based on the closure of the shield chamber, the magnetometer is placed in the unenergized coil. The magnetic noise in the chamber is tested and the results obtained are shown in Figure 2.  
It can be seen from the time and frequency domain diagram that the average magnetic bias of the environment is \(-36.73\) nT, and the peak-to-peak value is \(215.29\) nT. In addition, there are also three main interference signals of \(50/150/250\) Hz in the chamber which should be filtered. Therefore, a Butterworth low-pass filter is utilized to filter out the noise in the frequency band above \(50\) Hz and eliminate the alternating magnetic field interference in the ambient magnetic field. Furthermore, the signal is translated according to the DC magnetic field bias. The filtered ambient magnetic field of the chamber is shown in Figure 3, and the comparison of the ambient magnetic field before/after filtering is shown in Table 1. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Ambient Magnetic Field Parameter** & **Before Filter** & **After Filter** \\ \hline Standard deviation/nT & 44.41 & 1.07 \\ Mean value/nT & \(-36.73\) & 0.32 \\ Peak-to-peak value/nT & 215.29 & 9.31 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Comparison of the ambient magnetic field before/after filtering. Figure 1: Dynamic characteristic test system for the magnetometer: (**a**) sketch diagram of the system; (**b**) photo of the real system with experimental apparatus. Figure 2: Ambient magnetic field of the magnetic shield chamber: (**a**) time domain diagram; (**b**) single-sided amplitude spectrogram. From the comparison results, it can be seen that the ambient magnetic noise has been significantly reduced after the low-pass filter so that further tests and experiments for system identification can be carried out with higher precision. The frequency characteristic curve of the magnetometer can be obtained by changing the frequency of the magnetic field while keeping the amplitude of the magnetic field unchanged [21].