# Optimal Design of a New Rotating Magnetic Beacon Structure Based on Halbach Array
## 4 The Effect of Changing the Size of the Permanent Magnet on the Magnetic Field Distribution  
Assuming that the measurement point P (x, y, z) is known, the height \(h\), width \(w\), and magnetization direction \(\alpha\) of each permanent magnet are fixed, the material of the permanent magnet is consistent, and only the length l of each permanent magnet is changed, then the total magnetic field is an expression B(l) on the \(l\) variable, and the length \(l\) satisfies the constraint that:  
\[\left\{ \begin{array}{c}l_{1}=l_{7}\\ l_{2}=l_{6}\\ l_{3}=l_{5}\\ l_{4}>l_{3}>l_{2}>l_{1}\\ l_{1}+l_{2}+l_{3}+l_{4}+l_{5}+l_{6}+l_{7}=14\text{ cm}\end{array} \right.\]  
The length \(l\) is optimized by the particle swarm optimization algorithm, and the optimization process is shown in Figure 14.  
Figure 14: Flow chart of particle swarm optimization. Figure 13: Magnetic field intensity on both sides of the Y-axis of the seven-element array under different magnetization directions. The optimal solution can be obtained through optimization as follows: \(l_{1}=l_{7}=1.55\) cm, \(l_{2}=l_{6}=1.95\) cm, \(l_{3}=l_{5}=2.2\) cm, \(l_{4}=2.6\) cm. Set the measurement point as: from P\({}_{9}\) (\(-\)8, \(-\)4.5, 0) to P\({}_{10}\) (8, \(-\)4.5, 0); from P\({}_{11}\) (\(-\)8, 4.5, 0) to P\({}_{12}\) (8, \(-\)4.5, 0). The parameters obtained by optimization are substituted into the model to obtain the magnetic field intensity change curve in the positive and negative directions of the Y-axis of the array structure, and are compared with the structure before optimization, as shown in Figure 15.  
It can be seen from the figure that the optimized array produces a stronger magnetic field aggregation in the direction of the negative half-axis of the Y-axis, a weaker magnetic field in the direction of the positive half-axis of the Y-axis, and a stronger characteristic of the total magnetic field. On this basis, the linear array is changed to a non-linear array, as shown in Figure 16. Each permanent magnet differs in Z-axis in turn; firstly, set \(\Delta\)h = 0.5 cm, then simulate and collect the magnetic field intensity on both positive and negative sides of the Y-axis, as shown in Figure 17.  
Figure 16: Non-linear array. Figure 15: Comparison of magnetic field strength before and after optimization. The comparison graph shows that adjusting the linear array to a non-linear array can significantly enhance the magnetic field aggregation in the negative half-axis of the Y-axis by about 8 times, and there is no significant change in the magnetic field in the positive half-axis of the Y-axis. Therefore, the characteristics of the total magnetic field can be further enhanced by adjusting the parameter \(h\). Let the permanent magnets be translated along the Y-axis and set \(\Delta\)h as 0.5 cm, 1 cm, 1.5 cm, 2 cm respectively, and set the measurement point as: from P\({}_{9}\) (\(-\)8, \(-\)4.5, 0) to P\({}_{10}\) (8, \(-\)4.5, 0); from P\({}_{11}\) (\(-\)8, 4.5, 0) to P\({}_{12}\) (8, \(-\)4.5, 0). The corresponding magnetic field intensity variation curves are shown in Figure 18.  
It can be seen from the figure that as \(\Delta\)h increases, the magnetic field intensity in the negative half-axis direction of the Y-axis becomes larger and more aggregated, but the corresponding magnetic field intensity at both ends of the array in the positive half-axis direction keeps increasing and the characteristic of the total magnetic field weakens. By analyzing the data, it can be concluded that the magnetic field is better characterized when \(\Delta\)h = 1.5 cm.