A Novel Design Method of Magnetic Dipole Simulator With High Fitting Accuracy

Dipole approximation is a common simplified method in magnetic field research, which is widely used in magnetic anomaly detection, control of magnetic device and magnetic field experiment. The accuracy of magnetic dipole approximation will determine the upper limit of related applications. Previous studies have shown that the dipole approximation of a typical magnetic dipole simulator (e.g., a solenoid coil) can lead to a positioning error of up to 50% in localization of magnetic object in near field. In order to solve this problem, this paper aims to design a coil structure that fits well with the standard magnetic dipole. Firstly, the structure of cylindrical solenoid with planar symmetry and rotational symmetry is optimized and analyzed. On this basis, a multi-layer solenoid structure with rotational symmetry and plane symmetry is proposed. Then, the coil structure is optimized by gradient descent method, taking the inner and outer radius, height, layer spacing and quantity of the solenoid as variables. Compared with the traditional coil, this coil structure can greatly reduce the error of dipole approximation, and has the advantages of large magnetic moment and small geometric size. Simulation results show that the positioning error percentage can be reduced to less than 0.2% when the new-type coil is tested in the same area.


I. INTRODUCTION
Dipole approximation is a common simplified method in magnetic field research, and there are also references to explain this method based on physical theory [1]. This approximation method is often used in the field of magnetic anomaly detection, such as the positioning of medical capsule endoscope [2], magnetic anomaly detection experiment [3], magnetic sensor array calibration [4], magnetic beacon positioning in disaster rescue [5], etc. Apart from that, magnetic dipole also has application in control of magnetic device [6]. Because the rotating dipole magnetic field can generate magnetic attractive and lateral forces with the magnetic target, the rotating dipole magnetic field can be used to drive the target to realize complex motion. By the way, in some physical experiments involving dipole magnetic field, it is also necessary to use dipole approximation to simplify magnetic targets to complete experimental verification [7].
The associate editor coordinating the review of this manuscript and approving it for publication was Xiaodong Liang .
Reference [1] points out that the simplified method of dipole approximation will lead to errors, and such errors are called the error of dipole approximation (EODA). In addition, the dipole approximation usually has good fitting effect in the distant position, but will lead to large EODA in the near field. Based on these characteristics, the magnetic dipole simulators generally have defects: the EODA in the far field is small, but the magnetic induction intensity is weak; the near field magnetic flux density is large, but the EODA is large. If the EODA is too large, it will affect the accuracy, application and error analysis of various technologies or experiments. Reducing the EODA of the magnetic source device in the near field has great application value. For example, the capsule endoscope or magnetic beacon positioning technology can improve the accuracy and expand the detection range; in magnetic detection experiment or sensor array calibration, the influence of EODA can be reduced, and the error analysis can be more reasonable and accurate.
At present, most controllable magnetic sources of magnetic dipole simulators are solenoid coils. In order to show the problems caused by EODA of the solenoid coil more directly, especially in near filed, the experiment in reference [8] is taken as an example. As it has been mentioned in some literatures that the EODA can be ignored when the observation distance is larger than three times the size of the magnetic object [8], [12], the 10mm-20mm interval is taken as the concerned area, which is less than three times the size of the solenoid in [8]. In this experiment, the dipole moves along the x axis, and the position coordinates of the dipole point are solved by the measured values of the sensor matrix at the origin. The experiment is simulated by finite element analysis (FEA) and, to accurately analyze the positioning error caused by the solenoid coil, other error factors such as gradient measurement are not taken into account. With the decrease of the observation distance, the percentage of positioning error caused by the dipole approximation increases rapidly, even up to 50%.(as shown in Fig 1 a)).
There have been some researches on how to reduce the EODA. Uniformly magnetized spherical permanent magnets can generate a pure dipole magnetic field. However, the spherical permanent magnet has high cost and it is difficult to guarantee uniform magnetization. Most permanent magnets in practical application are columnar. In 2006, while studying the positioning of magnetic capsule endoscope, Wang xiaona compared the matching of two cylindrical permanent magnets (length-diameter ratio of 2 and 0.4) with the magnetic dipole model [9]. In 2010, when making a magnetic mechanical arm used for magnetic drive, Fountain et al. compared the distribution of magnetic field between permanent magnet and magnetic dipole, and found that radial magnetized permanent magnets fit the dipole model better than axial magnetized permanent magnets under the same cylindrical geometry [10]. Both of two papers only show the result of comparisons but do not propose design methods. In 2013, Petruska and Abbott solved magnetic multipole moment expansion for the magnetic fields of cylindrical, gasket and rectangular permanent magnets, and solved the geometric size ratio of the three permanent magnets with the minimum EODA [1]. In 2014, Petruska and Abbottadopted the structure of cuboid solenoid and iron core in order to design a magnetic dipole with controllable magnetic moment direction [11]. In [1] and [11], the method of multipole moment expansion is adopted to optimize the structure. However, this method is often difficult to apply to complex coil geometry.
Based on the electrodynamic theory, the magnetic vector potential generated by a given current distribution can be used for magnetic multipole expansion. The decay rate of the higher order term in the series is greater than that of the lower order term. If the distance from the source is sufficiently large, the series will be dominated by the lowest nonvanishing contribution (Magnetic dipole). That's why the dipole approximation can be used in the large distance. However, when the distance from the source is small, the contribution of higher-order terms in the series can not be ignored, leading to a large error caused by the dipole approximation. For different structures, the decay rates of higher order terms in the series are different. Therefore, from the aspect of physical nature, this paper aims to calculate a coil structure with fast decay rate of higher order terms in multipole expansion.
In this paper, the current common single-layer solenoid coil structure is analyzed, and based on this, a multi-layer solenoid coil structure is proposed, and the coil structure parameters are optimized.
The structure of this paper is as follows: In II, the construction of coil geometry is discussed. In III, the parameters in the new-type coil are optimized; In IV, the coil structure is compared with the existing coil structure to demonstrate the advantages of the new-type coil structure. V is the content of prototype production and experiment. Schematic diagram of geometric model, including current-carrying cylinder model (gray cylinder), observation arc (red line) and observation sphere (blue surface). c). Assuming H 0 = 0.1m, R 0 = 1m, r 0 = 0.1m, the magnetic field of the current-carrying cylinder is calculated by mathematical model and finite element analysis respectively, and the relative error percentage of the two results is calculated. d). Calculation results of monolayer solenoid optimization.

II. COIL GEOMETRY DESIGN A. MATHEMATICAL MODEL OF MAGNETIC FIELD
In general, the solenoid magnetic model is related to the number of turns, the wire radius and other parameters. In order to simplify the solenoid coil model, the solenoid coil is simplified as a uniform hollow current-carrying cylinder model with inner radius r 0 , outer radius R 0 and height H 0 , current density J, as shown in Fig. 1 b) [11]. According to this model, a mathematical model of magnetic field is established based on Biot-Savart law.
The formula of magnetic flux density of current-carrying cylinder in Cartesian coordinate system refers to (1), as shown at the bottom of the next page, where B = [B x , B y , B z ] is the flux density vector at the observation point, (x, y, z) is the coordinate of the observation point, R 0 is the outer radius of the current-carrying cylinder, r 0 is the inner radius, H 0 is the height of the current-carrying cylinder, µ 0 is the relative magnetic conductivity of the air, J is the current density of the current-carrying cylinder. Finite element analysis(FEA) is used to verify the above mathematical model. The relative error between finite element analysis model and mathematical model is shown in Fig 1 c). The relative error is less than 1%, which prove that the above mathematical model are correct.

B. QUANTIFY THE ERROR OF DIPOLE APPROXIMATION
In order to quantitatively describe the degree of fitting between coil and standard magnetic dipole, the relative error is used to calculate the EODA [1]. The formula for calculating the error of dipole approximation (EODA) at a certain point refers to (2).
where B s is the magnetic flux density generated by the coil at a certain point, while and B p is the magnetic flux density generated by the magnetic dipole at the same point. Based on formula (2), the average error of the dipole approximation at a certain sphere with radius ρ (AEODA at ρ), is calculated by the mean error of M points uniformly taken on the sphere with the sphere center at the coil center and the radius ρ.
Since the magnetic field generated by the solenoid structure and the magnetic dipole in space are both rotationally symmetric about the central axis, and symmetric about the central xOz plane, the intersecting arc of the first quadrant of the spherical xOz plane (as red line shown in Fig. 1 b)) can be used to replace the sphere for calculation, which is called the observation arc. The distribution of EODA with the pitch angle ϕ (as shown in Fig 1 b)) on the arc, can also represent the distribution of the sphere.
As it has been mentioned in some literatures that EODA can be ignored when the observation distance is larger than three times the size of the magnetic object [8], [12], this paper focuses on the average dipole approximation error when ρ < 3 or ρ = 3, if the coil geometric size is used for normalization.

C. COIL GEOMETRY DESIGN
For ordinary single-layer solenoid (Fig. 1 b)), the geometric parameters mainly include coil inner radius r 0 , coil outer radius R 0 and coil height H 0 . In the simulation environment, the following simulation analysis is carried out: Firstly, the prize length variable is normalized by the outer radius of the coil R 0 [1], [11], and the inner radius of the coil and the height of the coil are taken as independent variables. The distribution of AEODA at ρ = 3 is observed, and the minimum point is obtained. The simulation results are shown in Fig 1 d). According to the simulation results, when R 0 = 0 and H 0 = 1.3, the solenoid coil has a minimum dipole AEODA of 0.59% at ρ = 3. The model with this parameter is called the optimal single-layer solenoid model. The advantage of the solenoid coil is that the magnetic field generated by it has the same symmetry as the magnetic dipole field: it is rotationally symmetric about the central axis and symmetry about the central plane. The disadvantage of solenoid coil is that the geometry structure is relatively single and the model parameters are few. Its optimal parameters are the local optimization results of a better geometry structure under special conditions, leading to the optimization results cannot be further improved.
Based on the above analysis, on the basis of the original single-layer solenoid model (Fig. 1 b)), a new-type multilayer solenoid structure (Fig. 2) is proposed. The number of (1) VOLUME 10, 2022 layers is set as N , the inner radius of each layer is R i , the outer radius is R i , the height is H i , and the layer spacing is d i .
According to the symmetry of magnetic field of magnetic dipole, the geometric parameters, which are symmetric on center plane in multilayer solenoid, are equal. The optimal parameter of the single-layer solenoid is the local optimal solution when the multi-layer solenoid meets N = 1. Therefore, the multi-layer solenoid structure keeps the symmetry advantage of single-layer solenoid, and at the same time enlarges the solution range and has higher optimization value.

III. OPTIMIZATION CALCULATION
The optimization model is established by taking the structural parameters in Fig. 2 (all length variables are normalized by the central-layer radius R 0 ) as independent variables and AEODA at ρ = 3 as the objective function. Layer N is a special parameter. It is a parameter itself, but it also determines the sum of parameters in the model, which makes it difficult to directly import layer into the optimization algorithm for solving. At the same time, when N is large, the new-type coil structure is more diversified, including more solution sets, and the optimization value is greater. Based on this, a progressive method is adopted for optimization and solution (as shown in Fig. 3): Step 1: N = 1. Gradient descent method is used to optimize and solve each parameter, and solution x is obtained.
Step 2: Judge the convergence result. If the objective function is less than K (K = 0.1% in this paper), then output solution x, otherwise repeat step 1. According to the above optimization ideas, the output result is finally obtained when N = 3. Parameters of the new-type coil are shown in Table 1 Coil (1).
The AEODA of the optimized coil decays rapidly with the increase of ρ (Fig. 4 a)). AEODA at ρ = 3 can be reduced to less than 0.03%, which is much smaller than that of the single-layer solenoid(0.59%).
Coil optimization results show that the inner radius of the coil is 0, which means, the coil is solid structure. However, solid structure has the following two problems in practical application: first, winding is more difficult; second, it is difficult to fasten to the experimental platform. Based on this, the coil structure needs to be further improved by setting the inner radius of the coil to a constant value. In addition, in order to facilitate the actual production, processing and manufacturing, let the inner radius of the coil of each layer be equal, let it be r 0 , that is, r 1 = r 2 = r 0 . If the coil inner diameter R 0 is directly set to a fixed value and then recalculated, the optimization algorithm will take a long time. And if the initial value is not reasonable, there may be non-convergence or poor convergence effect. To solve this problem, the following method can be used to quickly find a reasonable set of initial values.
There is such a phenomenon. If other parameters of the coil remain unchanged in Table 1 Coil (1). and only the inner radius r 0 of the coil is increased, the EODA will increase. The coil structure can be improved by adjusting the coil layer spacing. When the inner radius of the coil r 0 is fixed, the layer spacing d1 of the coil is adjusted, and AEODA at ρ = 3 decreases first and then increases with the increase of d 1 . For example, when r 0 = 0.44, the variation pattern is shown in Fig. 4 b). The layer spacing at the minimum point is called the optimal layer spacing (OLS). The OLS at the inner radius of each coil can be calculated in the same way (Fig. 5 a)). After the OLS is introduced, the recalculated mean AEODA at ρ = 3 still shows an increasing trend with the change of the inner radius of the coil, but it has significantly decreased compared with the structure without OLS, as shown in Fig. 5 b).
Using the above law, we can get a set of the coil parameters that satisfy the following two conditions: 1. The inner diameter of the coil is non-zero; 2. AEODA is smaller. Nonzero inner diameter of the coil means that the coil meets the actual processing conditions. Small AEODA means that the parameters can be used as the initial value of the optimization algorithm. In this paper, the parameter when R 0 = 0.44 is taken as the initial value, and the gradient descent method is used to recalculate. The parameters in Table 1 Coil (2) are obtained. This method solves the problem of selecting the initial value and can quickly calculate the optimization parameters of the coil under different conditions.

IV. SIMULATION ANALYSIS
The magnetic anomaly detection experiment was conducted with the new-type coil as the magnetic target in simulation. The size of the coil used is shown in Table 3 new-type coil (1), which has the same magnetic moment with the coil in the reference [8]. The simulation results of positioning error percentage are shown in Fig. 6, which are all less than 0.2% in the concerned area. Compared with ordinary solenoid, the percentage of positioning error is greatly reduced. In order to further demonstrate the advantages of the coil design in this paper, the new-type coil is compared with the coil in [11] (called traditional coil in this paper).
Effective comparison requires a reasonable comparison method. For a magnetic dipole simulator, the most important parameters are geometric size, magnetic moment and EODA. Based on the analysis, two aspects are compared in this paper. On the one hand, under the same magnetic moment requirements, the new-type coil and the traditional coil are designed and their magnetic moment and EODA are compared. On the other hand, under the same geometric size requirements, two kinds of coils are designed to compare their geometric size and dipole approximation EODA. The minimum radius of the outer ball of the coil is used to measure the geometric size [1], defined as S.
Assume that the magnetic moment is 1A·m 2 and the coil current density is 1A/mm 2 . The actual size of the new-type coil is shown as new-type coil (2) in Table 3. The actual size of the traditional coil is shown in Table 3. The magnetic field of the traditional coil is calculated by COMSOL finite element analysis software, while the magnetic field of the newtype coil is calculated by the mathematical model in III.A. Simulation results show (Fig. 7 e)) that the AEODA of both the traditional magnetic field and the new-type magnetic field decays with the increase of distance, but AEODA of the newtype magnetic field decays faster. At ρ = 5.73cm × 2 and ρ = 5.73cm × 3(the geometric size of traditional coil is 5.73cm), the variation of EODA along the observation arc with the pitch angle ϕ is shown in Fig. 7 a-b). The EODA of the new-type coil at each position is smaller than those of the traditional coil. The AEODA of the new-type coil at ρ = 5.73cm × 2 and ρ = 5.73cm × 3 are 0.06% and 0.02%, while those of the traditional coil are 1.74% and 1.05%. The calculation results in the table show that the new-type coil has a smaller geometry. This shows that the new-type coil has the advantages of smaller EODA and smaller geometric size under the same magnetic moment requirements. It is assumed that the geometrical size of two coils is the same as that in Table 3, and the current density of the coil is 1 A/mm2. The actual size of the traditional coil is still shown in new-type coil(3) Table 3, and the actual size of the new-type coil is shown as in Table 3. Simulation results show (Fig. 7 f)) that when ρ < 0.1m, the AEODA of the new-type coil is slightly larger than that of the traditional coil, but the decay rate of the new-type coil is faster. When ρ = 5.73cm × 2 and ρ = 5.73cm × 3, the EODA of the two coils along the observation arc with the pitching angle ϕ is shown in Fig. 7 c-d). The EODA of the new-type coil at each position are smaller than those of the traditional coil. The AEODA of the new-type coil at ρ = 5.73cm × 2 and  ρ = 5.73cm × 3 are 0.45% and 0.1%, respectively, while those of the traditional coil are 1.74% and 1.05%. Meanwhile, the theoretical calculated magnetic moment of the new-type coil is 7.27 A·m 2 , which is about 7 times that of the traditional coil. The new-type coil also has a larger calculated magnetic moment. This shows that the new-type coil has the advantages of smaller EODA and larger magnetic moment under the same geometric size requirements.

V. EXPERIMENT
A. THE PROTOTYPE R1 = 3.00cm in the prototype, and the actual size of the prototype in Table 3 was calculated according to the proportions of the size of the new-type coil (Table 1 Coil (2)). In order to reduce the error between the prototype solenoid and the multi-layer energized cylinder model, the coil is tightly wound, and the maximum outer diameter of the wire used is 0.334mm. The coil skeleton is non-metallic nonconductive material. In the experiment, the AEODA of the coil at the observation distance of 30.4 × 2mm and 30.4 × 3mm (geometric size S = 30.4mm) was measured to verify the effectiveness of the design. The experimental schematic diagram is shown in Fig 9 a). The actual experimental Fig is shown in  Fig 9 b), wherein the coil and sensor are fixed by the clamp; A positioning plate is provided below, and slots are cut on the plate for placing the fixture and locating the coil and sensor. All fixtures and positioning plates are made of 3D printed materials and are not magnetically conductive.
The coil is put into the matching slot of the positioning plate, and the current is passed through. The sensors are put into the slots of different positions of the positioning plate and the data of each point is measured in turn.

C. EXPERIMENTAL DATA PROCESSING
Due to the error between the energized cylinder model and the actual winding solenoid, biot-savart law is used to re-calculate the coil magnetic field and compare it with the experimental data, as shown in Fig. 10 a) and Fig. 10 b). The measured data basically agree with the simulation data. The deviation between the experimental data and the simulation data is mainly caused by the following aspects: 1. There are errors in the coil manufacturing process, resulting in the actual coil is not completely consistent with the simulation model; 2. There are errors in the processing of the experimental fixture, leading to the position and attitude deviation of the coil and sensor when they are fixed in the experiment; 3, there is background magnetic field noise. The calculated and simulated values of EODA are shown in Fig.11 (a) and Fig.11 (b). Table 4 records the measured and simulated values of the new-type coil EODA and the simulated values of the traditional coil EODA. The deviation between the measured value of the new-type coil and the simulation value still comes from the machining error of the coil and fixture and the noise interference. However, the deviation is less than 0.1%, which proves that the prototype coil is basically consistent with the analytical results. Meanwhile, the measured and simulated values of the EODA of the new-type coil are much smaller than those of the traditional coil. Based on the above analysis, the designed coil achieves the purpose of reducing the EODA.

VI. CONCLUSION
Dipole approximation is a common approximation method in magnetic field research. This approximation fits well at a long distance, but results in a large error of dipole approximation at a short distance. In this paper, the problems of the dipole approximation in magnetic detection and other technologies are analyzed, and it is pointed out that the simplified method may lead to up to 50% positioning error percentage.
First, to solve this problem, the common monolayer solenoid structure is analyzed and optimized. Based on the optimization results, the single-layer solenoid has the advantages of good symmetry, but also has the limitations of single structure and low optimization value. Furthermore, a multilayer solenoid structure with good symmetry and higher upper limit of optimization is proposed. Then the new-type coil parameters are optimized iteratively by gradient descent method and the new-type coil size parameters are obtained.
Then, the new-type coil is simulated and compared in many aspects. Compared with the traditional coil, the new-type coil can greatly reduce the EODA, and has the advantages of small geometric volume and large magnetic moment. If the newtype coil is used for the same localization simulation, the percentage of positioning error can be reduced to less than 0.2% in the same area.
Finally, according to the optimized new-type coil parameters, a prototype coil was made, and the magnetic field characteristics of the coil were measured. The experimental results show that the magnetic field measurement results of the new-type coil are consistent with the simulation results, and the EODA of the new-type coil is much smaller than that of the traditional coil, which proves that the coil design method is effective and the new-type coil can greatly improve the fitting precision of the magnetic dipole.