Planar multi-pole magnetic field decomposition method based on genetic algorithm

By using data processing based on genetic algorithms and fitting based on least squares algorithms, the accuracy and efficiency issues of planar multipole magnetic field decomposition were solved, achieving fast and accurate magnetic field decomposition, which is applicable to accelerator magnet design and improves design efficiency and accuracy.

CN121960124APending Publication Date: 2026-05-01XIAN INSTITUE OF SPACE RADIO TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XIAN INSTITUE OF SPACE RADIO TECH
Filing Date
2025-12-24
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

In existing technologies, planar multipole magnetic field decomposition methods have low accuracy, long computation time, and poor callability, making it difficult to effectively suppress high-order magnetic field components in accelerator magnet design.

Method used

A genetic algorithm-based method is used to standardize the data of the multipolar magnetic field. Through global and local search optimization, the parameters to be fitted are obtained, and the least squares algorithm is used for fitting, so as to finally realize the visualization of the multipolar magnetic field.

Benefits of technology

It achieves rapid and accurate planar multipole magnetic field decomposition, improving design efficiency. It is applicable to both permanent magnets and electromagnetic magnets, enhancing the precision and efficiency of magnet design. It can quickly determine the magnetic pole shape in the early stages of accelerator magnet design, increasing its versatility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121960124A_ABST
    Figure CN121960124A_ABST
Patent Text Reader

Abstract

The invention discloses a planar multi-pole magnetic field decomposition method based on a genetic algorithm. Quantitative decomposition of multi-pole components of a magnetic field is realized by fitting constant coefficients in a two-dimensional complex magnetic potential expression in a Maxwell equation set. The method comprises the following steps: preprocessing a two-dimensional plane complex magnetic potential obtained by actual measurement / simulation to obtain an initial population of a genetic algorithm, selecting a proper population scale, crossover and mutation probabilities and a termination evolution algebra, constructing a fitness function based on an optimization target, and carrying out iterative calculation to obtain a global better decomposition result of a multipole magnetic field. And on the basis, least square method optimization is further carried out, and finally, a globally optimal multipole magnetic field decomposition result is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a planar multipole magnetic field decomposition method based on genetic algorithms, belonging to the field of magnet design technology in accelerator physics. Background Technology

[0002] In accelerator physics, magnet design is a crucial component, especially for high-energy particle accelerators. Magnets play a key role in accelerators, not only guiding charged particles along predetermined paths but also focusing and dispersing particle beams. To achieve these functions, magnets must generate precisely controlled magnetic fields, and planar multipole magnetic field decomposition is an indispensable part of magnet design.

[0003] Higher-order components of multipole magnetic fields exert nonlinear forces on high-energy particles moving in accelerators. These nonlinear forces can distort the phase space ellipse of the particle swarm, significantly increase beam emittance, cause trajectory distortion of particles, reduce the dynamic aperture, or even lead to particle loss. Therefore, the magnitude of higher-order magnetic field components relative to the main magnetic field is a core indicator for evaluating magnet quality. Users need to suppress higher-order components of multipole magnetic fields in multiple stages, including the design, fabrication, and assembly of accelerator magnets.

[0004] Currently, common magnet designs typically rely on analytical solutions or numerical simulations, such as the finite element method (FEM). These methods, when calculating the spatial magnetic field distribution, usually do not directly calculate the magnetic field itself. Instead, they introduce the concept of magnetic scalar potential or magnetic vector potential, simplifying the calculation by solving the Poisson equation, a modified version of Maxwell's equations. The spatial distribution of the magnetic field is then derived and visualized using the obtained magnetic scalar or magnetic vector potential. Therefore, during the design process, optimizing the magnet materials and structure should minimize the higher-order components of the multipole magnetic field. This helps users improve the final performance of accelerator magnets from the outset. Summary of the Invention

[0005] The technical problem solved by this invention is: addressing the issues of low accuracy, long computation time, and poor callability of existing planar multipole magnetic field decomposition methods, a planar multipole magnetic field decomposition method based on a genetic algorithm is proposed.

[0006] The present invention solves the above-mentioned technical problem through the following technical solution: A planar multipole magnetic field decomposition method based on genetic algorithm includes: The adoption and data standardization processing of multipole magnetic fields under actual or simulated environments; The standardized multipole magnetic field information is decomposed to obtain the parameters to be fitted. The global search optimization is performed on the parameters to be fitted, and the local search optimization is performed on the global search optimization results to obtain the global optimal solution of the parameters to be fitted. The global optimal solution of the parameters to be fitted is used as the fitting result, and the multipolar magnetic field components are visualized.

[0007] The multipolar magnetic field is a planar magnetic field, and the multipolar magnetic field data information is all in the Cartesian coordinate system. When setting sampling points for the multipolar magnetic field, the sampling point sorting method includes fixed sorting or random sorting.

[0008] The method for standardizing the data information at each sampling point in the multipolar magnetic field is as follows:

[0009] In the formula, In Cartesian coordinates, this represents the position vector of the dataset in the X direction. This represents the position vector of the dataset in the Y direction within the Cartesian coordinate system. It depends on the magnetic field source; if it is a permanent magnet, then... magnetic scalar potential If it is an electromagnetic field, then magnetic vector potential mean represents the operation of calculating the mean, and std represents the operation of calculating the standard deviation.

[0010] The planar magnetic field is decomposed to obtain magnetic field components and determine the parameters to be fitted. Based on the characterization of complex magnetic potential, the expression is:

[0011] In the formula, , Let be the order of the magnetic field to be decomposed. It can be a real number or a complex number. as well as These are the parameters to be fitted.

[0012] The magnetic vector potential and magnetic scalar potential The expression is:

[0013] In the formula, Re represents the operation of extracting the real part, and Im represents the operation of extracting the imaginary part; Let the order be the order to be decomposed. The coefficients are binomial coefficients.

[0014] The method for global search optimization of the parameters to be fitted is as follows: A genetic algorithm is used to fit and obtain the global search optimization results. Taking the planar magnetic field as the research object and user needs as the optimization goal, a fitness function based on the optimization goal is constructed for iterative calculation. When the preset iteration conditions are met, the global optimal decomposition result of the multipolar magnetic field is obtained.

[0015] The expression for the fitness function is:

[0016] In the formula, norm represents the norm operation. The magnetic scalar potential or magnetic vector potential fitted by the genetic algorithm. To obtain the actual magnetic scalar potential or magnetic vector potential from the simulation, during the iteration process, take... The maximum result is the direction of optimization, and a globally optimal result is obtained through evolution. and Values; The preset iteration condition is the number of generations to terminate the evolution, which is set to a fixed value. Before applying the genetic algorithm, the input dataset size, population size, crossover probability, and mutation probability are preset. The encoding format is binary. The absolute values ​​of the upper and lower limits of the parameters to be fitted decrease exponentially with the increase of the order.

[0017] The method for performing local search optimization on the global search optimization results is as follows: The least squares algorithm is used to locally optimize the parameters to be fitted within a preset range, and the trust region reflection algorithm is used to minimize the sum of squared residuals between the prediction results and the dataset to obtain the global optimal solution of the parameters to be fitted.

[0018] The visualization process is as follows: The distribution of the multipole magnetic field cloud map is reproduced based on the global optimal solution of the parameters to be fitted. Users can intuitively identify the multipole components of the planar magnetic field according to the display and user needs.

[0019] The standardization process is as follows: The multipole magnetic field data is classified according to the type of magnet in the spatial region. If it is a permanent magnet, the magnetic scalar potential data about its position in the Cartesian coordinate system is output; if it is an electromagnet, the magnetic vector potential information is input. If the data points are If there are [number], then the dataset will be processed into [number]. The matrix, with each column from left to right representing the X coordinate, Y coordinate, and the intensity of the scalar potential or magnetic vector potential; Calculate the mean and standard deviation of each column of data, and perform data preprocessing.

[0020] The advantages of this invention compared to the prior art are: (1) The present invention provides a planar multipole magnetic field decomposition method based on genetic algorithm. By expanding the complex magnetomotive force of the planar magnetic field obtained by actual measurement / simulation into a polynomial, the magnetic scalar potential or magnetic vector potential is selected according to whether the actual magnetic field source is a permanent magnet or an electromagnet. The constant coefficients before the polynomials of different orders are extracted as fitting parameters. The global optimal solution of the fitting parameters is obtained by using genetic algorithm and least squares method. Finally, the visualization and reproduction of the multipole components of the planar magnetic field is realized according to the fitting parameters. It can quickly and accurately complete the decomposition of the planar multipole magnetic field according to the user's needs. It is effective not only for the electromagnetic field generated by electromagnets, but also for permanent magnet magnetic fields. Therefore, it can quickly determine the shape of the magnetic poles in the early stage of accelerator magnet design, thus improving design efficiency. The present invention has better callability. It can be directly integrated into the user's optimization program to complete the optimization of other targets. The optimization parameters that need to be fitted are only the constant coefficients before the polynomial expression. (2) This invention achieves quantitative decomposition of the multipole components of the magnetic field by fitting the constant coefficients in the two-dimensional complex magnetomotive force expression (complex magnetomotive force consists of scalar potential and magnetic vector potential) in Maxwell's equations. It adopts global iteration and local optimization respectively. Compared with traditional methods, it achieves a good balance of accuracy, efficiency and robustness in the decomposition of planar multipole magnetic fields, and provides a reliable technical route for obtaining the global optimal solution. Attached Figure Description

[0021] Figure 1 A schematic diagram of the finite element simulation results of the magnetic scalar potential of the permanent magnet quadrupole provided by the present invention; Figure 2 A schematic diagram showing the comparison between the finite element simulation of the magnetic scalar potential of the permanent magnet quadrupole magnet provided by this invention and the magnetic scalar potential restored using fitting parameters. Figure 3 A schematic diagram of the finite element simulation results of the magnetic vector potential of the electric quadrupole magnet provided by the present invention; Figure 4 A schematic diagram showing the comparison between the finite element simulation of the magnetic vector potential of the electric quadrupole magnet provided by this invention and the magnetic vector potential restored by fitting parameters. Figure 5 The flowchart of the planar multipole magnetic field decomposition method based on genetic algorithm provided by the present invention is shown. Detailed Implementation

[0022] A planar multipole magnetic field decomposition method based on a genetic algorithm is proposed. This method quantitatively decomposes the multipole components of the magnetic field by fitting the constant coefficients in the two-dimensional complex magnetic potential expression of Maxwell's equations. An initial population for the genetic algorithm is obtained by preprocessing the measured / simulated two-dimensional planar complex magnetic potential. By selecting appropriate population size, crossover and mutation probabilities, and the termination generation, a fitness function based on the optimization objective is constructed and iteratively calculated to obtain a globally optimal decomposition result for the multipole magnetic field. Further optimization using least squares method is then performed to finally obtain the globally optimal multipole magnetic field decomposition result.

[0023] The planar multipole magnetic field decomposition method based on genetic algorithm includes the following steps: The adoption and data standardization processing of multipole magnetic fields under actual or simulated environments; The standardized multipole magnetic field information is decomposed to obtain the parameters to be fitted. The global search optimization is performed on the parameters to be fitted, and the local search optimization is performed on the global search optimization results to obtain the global optimal solution of the parameters to be fitted. The global optimal solution of the parameters to be fitted is used as the fitting result, and the multipolar magnetic field components are visualized.

[0024] The multipole magnetic field is a planar magnetic field, and all multipole magnetic field data is in the Cartesian coordinate system. When setting sampling points for the multipole magnetic field, the sampling points can be sorted in a fixed order or in a random order.

[0025] In a multi-pole magnetic field, the method for standardizing the data information at each sampling point is as follows:

[0026] In the formula, In Cartesian coordinates, this represents the position vector of the dataset in the X direction. This represents the position vector of the dataset in the Y direction within the Cartesian coordinate system. It depends on the magnetic field source; if it is a permanent magnet, then... magnetic scalar potential If it is an electromagnetic field, then magnetic vector potential .

[0027] The planar magnetic field is decomposed to obtain the magnetic field components and determine the parameters to be fitted. Based on the characterization of complex magnetic potential, the expression is:

[0028] In the formula, , Let be the order of the magnetic field to be decomposed. It can be a real number or a complex number. as well as These are the parameters to be fitted.

[0029] magnetic vector potential and magnetic scalar potential The expression is:

[0030] In the formula, Re represents the operation of extracting the real part, and Im represents the operation of extracting the imaginary part. Let the order be the order to be decomposed. The coefficients are binomial coefficients.

[0031] The method for global search optimization of the parameters to be fitted is as follows: A genetic algorithm is used to fit and obtain the global search optimization results. Taking the planar magnetic field as the research object and user needs as the optimization goal, a fitness function based on the optimization goal is constructed for iterative calculation. When the preset iteration conditions are met, the global optimal decomposition result of the multipolar magnetic field is obtained.

[0032] The fitness function is expressed as follows:

[0033] In the formula, norm represents the norm calculation operation. The magnetic scalar potential or magnetic vector potential fitted by the genetic algorithm. The actual magnetoscale potential or magnetic vector potential obtained from the simulation is specifically taken as a value. or During the iteration process, take The optimal result is the direction of optimization. Through multiple evolutions, a globally optimal result can be obtained. and Values.

[0034] The preset iteration condition is the number of generations to terminate the evolution, which is set to a fixed value. Before applying the genetic algorithm, the input dataset size, population size, crossover probability, and mutation probability are preset. The encoding format is binary. The absolute values ​​of the upper and lower limits of the parameters to be fitted decrease exponentially with the increase of the order.

[0035] The method for performing local search optimization on the global search optimization results is as follows: The least squares algorithm is used to locally optimize the parameters to be fitted within a preset range, and the trust region reflection algorithm is used to minimize the sum of squared residuals between the prediction results and the dataset to obtain the global optimal solution of the parameters to be fitted.

[0036] Visualization process as follows: The distribution of the multipole magnetic field cloud map is reproduced based on the global optimal solution of the parameters to be fitted. Users can intuitively identify the multipole components of the planar magnetic field according to the display and user needs.

[0037] The standardization process is as follows: The multipole magnetic field data is classified according to the type of magnet in the spatial region. If it is a permanent magnet, the magnetic scalar potential data about its position in the Cartesian coordinate system is output; if it is an electromagnet, the magnetic vector potential information is input. If the data points are If there are [number], then the dataset will be processed into [number]. The matrix, with each column from left to right representing the X coordinate, Y coordinate, and the intensity of the scalar potential or magnetic vector potential; Calculate the mean and standard deviation of each column of data, and perform data preprocessing.

[0038] The following description, in conjunction with the accompanying drawings and preferred embodiments, provides further details: In the current embodiment, a planar multipole magnetic field is taken as the research object. The specific goal is to quickly and accurately obtain the multipole components of the planar magnetic field according to the user's needs, including but not limited to a dipole magnetic field, a quadrupole magnetic field, a hexapole magnetic field, or an octupole magnetic field. The key parameter defined in this design method is the constant coefficient before each term in the expansion of the complex magnetomotive force, which is conventionally called the fitting parameter. Given that the location of the data point on the plane is determined, this parameter uniquely determines the intensity of each order of magnetic field component at that location. The purpose of this embodiment is to first use a genetic algorithm to achieve preliminary global optimization of the fitting parameters for the multipole magnetic field components, and then use the least squares method to obtain the global optimization result of the fitting parameters.

[0039] The planar magnetic field studied can be measured or simulated. All magnetic field data is in Cartesian coordinates and does not need to be sorted according to a specific sorting method, such as from top left to bottom right, to determine the sampling point sequence. Random order is allowed. The data points must first undergo standardization before proceeding to the next step, specifically using the following formula:

[0040] In Cartesian coordinates, this represents the position vector of the dataset in the X direction. Let be the position vector of the dataset in the Y direction in the Cartesian coordinate system. It depends on the magnetic field source; if it is a permanent magnet, then... magnetic scalar potential If it is an electromagnetic field, then magnetic vector potential .

[0041] Based on well-known concepts in the field of accelerator magnets, a plane magnetic field can be described by a complex magnetic potential:

[0042] in , To determine the order of the magnetic field to be decomposed, take an approximation. From 1 to Taking the integer part, (2) can be expanded as:

[0043] in, It can be a real number or a complex number. For example, remember For real numbers, It is a complex number. as well as These are the fitting parameters required by this method, and for a given plane magnetic field, they are a constant sequence.

[0044] This can be further expressed as:

[0045] Therefore, the magnetic vector potential and the magnetic scalar potential can be expressed as follows:

[0046] A plane magnetic field can be represented as (where) (vacuum permeability):

[0047] First, a genetic algorithm is used to globally optimize the fitting parameters.

[0048] The input dataset should ideally be larger than 1000 elements. The genetic algorithm should have a population size of 50, a crossover probability of 0.9, a mutation probability of 0.1, a termination generation of 20, and use binary encoding. The fitness function is defined as follows:

[0049] The absolute values ​​of the upper and lower limits of the fitted parameters decay exponentially with increasing order, for example... ; Next, the least squares algorithm is used to locally optimize the fitted parameters obtained in the previous step within a small range. Specifically, the trust region reflection algorithm is used to minimize the sum of squared residuals between the prediction results and the dataset to obtain the global optimal solution for the fitted parameters.

[0050] The distribution of the multipole magnetic field cloud map is reproduced based on the globally optimal solution of the obtained fitting parameters, so that users can intuitively identify the multipole components of the planar magnetic field as needed.

[0051] Example 1: The specific process of the planar multipole magnetic field decomposition method based on genetic algorithm is as follows: Obtain the magnetic field for which multipole component decomposition is required. Taking simulation as an example, determine the type of magnet in the calculated spatial region. If it is a permanent magnet, output the magnetic scalar potential data about its position in Cartesian coordinates; if it is an electromagnet, input the magnetic vector potential information.

[0052] The data information is processed in a new standardized manner. If the data point is... If there are [number], then the dataset will be processed into [number]. The matrix is ​​constructed, with each column representing the X-coordinate, Y-coordinate, and magnetic scalar potential / magnetic vector potential intensity from left to right. The mean and standard deviation of each column are then calculated, followed by standardization.

[0053] Based on user requirements, the planar magnetic field is decomposed into... The summation of polynomials of order X is used to extract the fitting parameters as optimization variables.

[0054] Adjust the population size, crossover, mutation probability, termination generation, and fitness function of the genetic algorithm according to the computational scale, and then perform optimization design.

[0055] The obtained fitting parameters are used as initial values ​​and substituted into the least squares algorithm to obtain the global optimal solution of the fitting parameters.

[0056] The distribution of the multipolar magnetic field cloud map is reproduced based on the globally optimal solution of the obtained fitting parameters.

[0057] A novel method for decomposing planar multipole magnetic fields using genetic algorithms is presented. This method achieves precise quantitative decomposition of the multipole components of a planar magnetic field by fitting the constant coefficients in the two-dimensional complex magnetopotential expression (composed of scalar and vector potentials) of Maxwell's equations. The specific operation process includes: first, preprocessing the two-dimensional planar magnetic field data obtained through measurement or simulation to generate an initial population; then, carefully selecting key parameters such as population size, crossover probability, mutation probability, and termination generation to construct a fitness function based on the optimization objective, and performing iterative calculations to obtain a globally optimal decomposition result for the multipole magnetic field. Based on this, the least squares method is further used for optimization, ultimately obtaining the globally optimal multipole magnetic field decomposition scheme. The following is a detailed analysis of the implementation examples: Taking a 16-body permanent magnet Heilbeck ring with four poles as an example, the multipole magnetic field components on its central transverse plane are analyzed. The parameters of the magnet are shown below: Table 1 Parameters of Permanent Magnet Quadrupole Magnet

[0058] like Figure 1The simulation results of the magnetic scalar potential plane distribution inside the Heilbeck magnetic ring are shown. It can be found that it exhibits a centrally symmetrical distribution, that is, it is positive and equal in intensity in the first and third quadrants, and negative and equal in intensity in the second and fourth quadrants. The fitting parameters obtained by decomposing the present invention using the method described below can be used to derive the following for the current permanent magnet quadrupole magnet: The coefficient is approximately -0.4, while the fitting coefficients for other higher-order components of the multipolar magnetic field are all close to 0, proving that only a vertical quadrupole magnetic field exists on this plane, a conclusion that is consistent with reality.

[0059] Table 2 Fitting parameters of the multipole components of the transverse central plane magnetic field of a permanent magnet quadrupole magnet

[0060] like Figure 2 The figure shows a comparison of the distribution of the original magnetic scalar potential and the magnetic scalar potential restored by fitting parameters on the plane. It can be found that the two data are highly consistent, and the fitting error of the vast majority (>95%) of the data points is less than 2%, which verifies the effectiveness of the planar multipole magnetic field component decomposition method proposed in this invention for permanent magnet magnetic fields.

[0061] Taking a vertical electric quadrupole magnet as an example, the multipole magnetic field components on its central transverse plane are analyzed. The magnet's parameters are shown below: Table 3 Parameters of electric quadrupole magnets

[0062] like Figure 3 The figure shows the simulation results of the planar distribution of the magnetic vector potential inside an electric quadrupole magnet. Since the magnetic field is symmetrical about the central plane, only the planar component of the magnetic field is present in the central plane, and the magnetic vector potential is along the Z direction. By comparing its intensity distribution, it can be found that it exhibits a symmetrical distribution. The fitting parameters obtained by decomposing the present invention using the method described below can be used to derive the following for the current permanent magnet quadrupole magnet: The coefficient is approximately -0.34, while the fitting coefficients for other higher-order components of the multipolar magnetic field are all close to 0, proving that only a vertical quadrupole magnetic field exists on this plane, a conclusion that is consistent with reality.

[0063] Table 4 Fitting parameters of the multipole components of the transverse central plane magnetic field of an electric quadrupole magnet

[0064] like Figure 2 The figure shows a comparison between the original data of the magnetic scalar potential and the distribution of the magnetic scalar potential restored by fitting parameters on the plane. It can be found that the two data are highly consistent, and the fitting error of the vast majority (>90%) of the data points is less than 20%, which verifies the effectiveness of the planar multipole magnetic field component decomposition method proposed in this invention for electromagnetic magnetic fields.

[0065] This model is less effective than permanent magnet decomposition for multipole magnetic fields in electric quadrupole magnets for the following reasons: 1. The electromagnetic field is constructed using a 3D model, and the extracted magnetic field distribution deviates somewhat from the ideal two-dimensional distribution; 2. Electromagnets have complex shapes, and the mesh is divided using unstructured grids, resulting in slightly lower accuracy in magnetic field calculations compared to the structured mesh of permanent magnets. However, these reasons are all caused by the data acquisition process and are unrelated to the algorithm itself.

[0066] Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make possible changes and modifications to the technical solutions of the present invention by utilizing the methods and techniques disclosed above without departing from the spirit and scope of the present invention. Therefore, any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solutions of the present invention shall fall within the protection scope of the technical solutions of the present invention.

[0067] The contents not described in detail in this specification are common knowledge to those skilled in the art.

Claims

1. A planar multipole magnetic field decomposition method based on genetic algorithm, characterized in that... include: The adoption and data standardization processing of multipole magnetic fields under actual or simulated environments; The standardized multipole magnetic field information is decomposed to obtain the parameters to be fitted. The global search optimization is performed on the parameters to be fitted, and the local search optimization is performed on the global search optimization results to obtain the global optimal solution of the parameters to be fitted. The global optimal solution of the parameters to be fitted is used as the fitting result, and the multipolar magnetic field components are visualized.

2. The planar multipole magnetic field decomposition method based on genetic algorithm according to claim 1, characterized in that: The multipolar magnetic field is a planar magnetic field, and the multipolar magnetic field data information is all in the Cartesian coordinate system. When setting sampling points for the multipolar magnetic field, the sampling point sorting method includes fixed sorting or random sorting.

3. The planar multipole magnetic field decomposition method based on genetic algorithm according to claim 2, characterized in that: The method for standardizing the data information at each sampling point in the multipolar magnetic field is as follows: In the formula, In Cartesian coordinates, this represents the position vector of the dataset in the X direction. This represents the position vector of the dataset in the Y direction within the Cartesian coordinate system. It depends on the magnetic field source; if it is a permanent magnet, then... magnetic scalar potential If it is an electromagnetic field, then magnetic vector potential mean represents the operation of calculating the mean, and std represents the operation of calculating the standard deviation.

4. The planar multipole magnetic field decomposition method based on genetic algorithm according to claim 3, characterized in that: The planar magnetic field is decomposed to obtain magnetic field components and determine the parameters to be fitted. Based on the characterization of complex magnetic potential, the expression is: In the formula, , Let be the order of the magnetic field to be decomposed. It can be a real number or a complex number. as well as These are the parameters to be fitted.

5. The planar multipole magnetic field decomposition method based on genetic algorithm according to claim 3, characterized in that: The magnetic vector potential and magnetic scalar potential The expression is: In the formula, Re represents the operation of extracting the real part, and Im represents the operation of extracting the imaginary part; Let the order be the order to be decomposed. The coefficients are binomial coefficients.

6. The planar multipole magnetic field decomposition method based on genetic algorithm according to claim 3, characterized in that: The method for global search optimization of the parameters to be fitted is as follows: A genetic algorithm is used to fit and obtain the global search optimization results. Taking the planar magnetic field as the research object and user needs as the optimization goal, a fitness function based on the optimization goal is constructed for iterative calculation. When the preset iteration conditions are met, the global optimal decomposition result of the multipolar magnetic field is obtained.

7. The planar multipole magnetic field decomposition method based on genetic algorithm according to claim 6, characterized in that: The expression for the fitness function is: In the formula, norm represents the norm operation. The magnetic scalar potential or magnetic vector potential fitted by the genetic algorithm. To obtain the actual magnetic scalar potential or magnetic vector potential from the simulation, during the iteration process, take... The maximum result is the direction of optimization, and a globally optimal result is obtained through evolution. and Values; The preset iteration condition is the number of generations to terminate the evolution, which is set to a fixed value. Before applying the genetic algorithm, the input dataset size, population size, crossover probability, and mutation probability are preset. The encoding format is binary. The absolute values ​​of the upper and lower limits of the parameters to be fitted decrease exponentially with the increase of the order.

8. The planar multipole magnetic field decomposition method based on genetic algorithm according to claim 7, characterized in that: The method for performing local search optimization on the global search optimization results is as follows: The least squares algorithm is used to locally optimize the parameters to be fitted within a preset range, and the trust region reflection algorithm is used to minimize the sum of squared residuals between the prediction results and the dataset to obtain the global optimal solution of the parameters to be fitted.

9. The planar multipole magnetic field decomposition method based on genetic algorithm according to claim 8, characterized in that: The visualization process is as follows: The distribution of the multipole magnetic field cloud map is reproduced based on the global optimal solution of the parameters to be fitted. Users can intuitively identify the multipole components of the planar magnetic field according to the display and user needs.

10. The planar multipole magnetic field decomposition method based on genetic algorithm according to claim 3, characterized in that: The standardization process is as follows: The multipole magnetic field data is classified according to the type of magnet in the spatial region. If it is a permanent magnet, the magnetic scalar potential data about its position in the Cartesian coordinate system is output; if it is an electromagnet, the magnetic vector potential information is input. If the data points are If there are [number], then the dataset will be processed into [number]. The matrix, with each column from left to right representing the X coordinate, Y coordinate, and the intensity of the scalar potential or magnetic vector potential; Calculate the mean and standard deviation of each column of data, and perform data preprocessing.