A method for optimizing design of axial multi-rectangular uniform coils in a magnetic shielding cabin based on generalized mirror method and particle swarm algorithm

By optimizing the axial multi-pair square uniform coils in the magnetic shielding chamber using the generalized mirror method and particle swarm optimization algorithm, the problem of reduced magnetic field uniformity of the coils in the magnetic shielding chamber was solved, and a highly uniform axial magnetic field environment was achieved.

CN117540547BActive Publication Date: 2026-07-21BEIHANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIHANG UNIV
Filing Date
2023-11-09
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Most existing uniform coil optimization methods are carried out in environments without passive shielding, which fails to effectively solve the problem of magnetic field uniformity of axially multi-square uniform coils in magnetically shielded chambers, resulting in magnetic field distortion and reduced uniformity of the coils.

Method used

An optimization design method for axial multiple pairs of square uniform coils in a magnetically shielded cabin based on the generalized image method and particle swarm optimization algorithm is adopted. By calculating the superposition of magnetic fields, modeling with the image method, and using the particle swarm optimization algorithm, the coil structural parameters are optimized to improve the uniformity of the magnetic field.

Benefits of technology

The magnetically shielded chamber provides a highly uniform axial magnetic field environment, which improves the uniformity of the coil's magnetic field and the accuracy of calculations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117540547B_ABST
    Figure CN117540547B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on generalized mirror method and particle swarm optimization algorithm's magnetic shielding cabin inside axial multi-rectangular uniform coil optimization design method.First based on Biot-Savart law establishes a rectangular coil pair in space magnetic field calculation model, and by introducing generalized mirror method to solve the problem of magnetic field uniformity reduction due to uniform coil and magnetic shielding cabin ferromagnetic boundary coupling.Then through PSO (Particle Swarm Optimization) algorithm, the coil structure is optimized and designed, multiple target points are selected in the target area, the magnetic field generated by the coil at the target point is calculated, and then the magnetic field uniformity is calculated as the optimization objective function, with the position of each axial coil as the unknown parameter, and the PSO algorithm is optimized to maximize the magnetic field uniformity of the target area.The application can effectively improve the uniformity of the magnetic field generated by the axial multi-rectangular uniform coil in the magnetic shielding cabin.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of magnetic shielding methods and magnetic field manipulation technology. Specifically, it relates to an axial multi-pair square uniform coil optimization design method for magnetic shielding chambers based on the generalized image method and particle swarm optimization algorithm, which can be used in electronic instruments, medical equipment, scientific research and other fields. Background Technology

[0002] Atomic magnetometers, used in cardiac and cerebral magnetometry, are extremely weak magnetic measurement devices with significantly higher sensitivity compared to traditional magnetic field measurement techniques. However, due to their high sensitivity to ambient magnetic fields, these fields limit their measurement sensitivity. Therefore, providing an extremely low and highly uniform magnetic field environment for the atomic magnetometer is crucial.

[0003] Generally, the magnetic shielding system providing the magnetic field environment for an atomic magnetometer consists of active magnetic compensation and passive magnetic shielding. Passive magnetic shielding typically uses shielding chambers or cylinders made of high-permeability materials such as permalloy or aluminum alloy to create a shielding environment. Active magnetic compensation generally uses coils based on forward or reverse design as actuators to generate a magnetic field, and uses closed-loop control to reduce the ambient magnetic field and magnetic field noise. However, since the magnetic shielding layer is usually composed of high-permeability materials, the coupling between the ferromagnetic boundary and the magnetic field generated by the uniform coil can distort the calculated uniform coil magnetic field and reduce the uniformity of the coil magnetic field. Most existing uniform coil optimization methods are conducted in environments without passive shielding. Most scholars have studied the impact of the coupling between the magnetic shielding cylinder and the uniform coil on uniformity, but none have studied the optimization design of uniform coils within a magnetic shielding chamber. Therefore, this invention proposes an axial multi-pair square uniform coil optimization design method based on the generalized image method and particle swarm optimization algorithm within a magnetic shielding chamber to improve and optimize the uniformity of the coil magnetic field within the magnetic shielding chamber. Summary of the Invention

[0004] To address the issue of reduced coil uniformity caused by the magnetic field generated by the axially multi-square uniform coils within a magnetically shielded chamber and the coupling with the magnetically shielded chamber, an optimized design method for axially multi-square uniform coils within a magnetically shielded chamber based on the generalized image method and particle swarm optimization algorithm was designed. This method can provide a highly uniform axial magnetic field environment within the magnetically shielded chamber.

[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0006] An optimization design method for axially multi-pair square uniform coils in a magnetically shielded chamber based on the generalized image method and particle swarm optimization algorithm includes the following steps:

[0007] Step (1): Based on Biosavart's law, calculate the magnetic field generated by the square coil at the target point in space, and extend it to multiple pairs of square coils along the axis. Further express the magnetic field at the target point as the sum of the magnetic fields of multiple pairs of square coils along the axis.

[0008] Step (2): Due to the coupling between the magnetic shielding chamber and the coil, the uniformity of the magnetic field generated by the coil will decrease. In order to improve the uniformity of the magnetic field of the coil in the magnetic shielding chamber, the coil is modeled using the generalized image method inside the magnetic shielding chamber.

[0009] Step (3): Apply the magnetic field calculation formula obtained in step (1) to the generalized mirror method model in step (2), identify the target points in the target area, and set the sum of the magnetic field uniformity at each target point as the objective function to be optimized.

[0010] Step (4): Introduce the particle swarm optimization algorithm. Use the objective function in step (3) as the fitness in the particle swarm algorithm. Use the distance between each coil pair and the Y=0 plane as the parameter to be optimized, which is the position parameter in the particle swarm algorithm. After determining the algorithm parameters, perform iterative optimization to finally obtain the coil structure parameters that can make the magnetic field of the target area most uniform.

[0011] The method for calculating the magnetic field of the axial multi-pair square coils in step (1) is as follows:

[0012] A magnetic field calculation model for an axial square coil is established. A Cartesian coordinate system is established in space, with the axial direction of the coil defined as the y-axis and the origin set at point O. The magnetic field calculation formula for a single current-carrying straight conductor is determined. Taking any point P in space as the target point, the magnetic field calculation of the square coil is performed. Assuming the existence of a current-carrying straight conductor, according to Biot-Savart's law, the expression for the magnetic field produced by the current-carrying straight conductor at a point P in space is calculated as follows:

[0013]

[0014] In the formula, μ0 = 4π × 10 -7 H / m is the permeability of free space, I is the current in the coil, θ1 and θ2 are the angles between the lines connecting the two ends of the conductor to point P and the conductor, d is the distance from point P to the conductor, and the direction of the magnetic field and the direction of the current are determined by the right-hand screw rule, which is perpendicular to the plane containing point P and the current-carrying straight conductor.

[0015] Determine the formula for calculating the magnetic field of a square coil; suppose there exists a square coil ABCD in space with a side length of 2L, and the coordinates of any point P in space are P(x,y,z). Through derivation, the magnetic field in the y-axis direction produced by the square coil ABCD at point P is:

[0016]

[0017] In the formula, B ABy B BCy B CDy B DAy The magnetic fields generated at point P by the current-carrying straight conductors AB, BC, CD, and DA in coil ABCD are respectively represented. Superimposing these magnetic fields yields B. y That is, the magnetic field in the y-axis direction generated by coil ABCD at point P;

[0018] A magnetic field calculation model with multiple pairs of square coils along the y-axis is established. Each pair of square coils is symmetrical about the plane Y = 0. There are N pairs of square coils, and the distance d of each individual coil in each pair from the plane Y = 0 is d. N Then the magnetic field produced by each pair of square coils at point P can be obtained as follows:

[0019]

[0020] In the formula, the magnetic field generated by a single square coil along the positive y-axis in the coil pair is represented as B. + The magnetic field generated by a single square coil along the negative y-axis is B.

[0021] Furthermore, the coil generalized image method modeling method in step (2) is as follows:

[0022] ① Establish a two-dimensional plane mirror image of the coil. That is, in the established Cartesian coordinate system, on the xoz plane, with the x-axis and z-axis planes of the magnetic shielding chamber as mirror images, perform mirror iterations along the x-axis and z-axis respectively.

[0023] ②Based on the established two-dimensional mirror image, a three-dimensional mirror image is created. For the mirrored coil and the original current coil in the xoz plane, the mirror image is iterated along the y-axis, with the y-axis plane of the magnetic shielding chamber as the mirror image.

[0024] Furthermore, the non-uniformity defined in step (3) is:

[0025]

[0026] In the formula, B res (x,y,z) represents the original remanent magnetism of target point P inside the magnetically shielded chamber, B Np (x,y,z) represents the magnetic field strength generated at point P after all coils are excited by the current. The calculation method is based on the calculation of the magnetic field of a uniform coil after introducing the generalized image method; B(0,0,0) represents the remanence at the origin of the coordinate system.

[0027] The objective function to be optimized is:

[0028]

[0029] subject to di+1 -d i ≥d smin (i = 1, 2, ..., n-1)

[0030] d max ≥d i ≥d min (i = 1, 2, ..., n-1)

[0031] In the formula, f is the objective function to be optimized, and U k Let be the non-uniformity of the k-th target point in the target region; and constraints were imposed on the coil structure parameters during the optimization process, where d i d represents the distance from the i-th pair of square coils to the plane Y = 0. smin d represents the minimum distance between two adjacent coils. max and d min These represent the maximum and minimum distances of the square coil pair from the plane Y = 0, respectively, and n represents the square coil pair with the sequence number n.

[0032] Furthermore, the optimization process based on the particle swarm optimization algorithm in step (4) is as follows:

[0033] Define the variables in the Particle Swarm Optimization (PSO) algorithm. In PSO, the solution to be optimized is represented by particles in the swarm. Each particle has its own position and velocity, and finds the optimal solution by searching the solution space. The particle's position and velocity are updated iteratively based on its optimal position and the global optimal position of the entire swarm. In a search space of dimension D, the position of the i-th particle can be represented as X. i =(x i1 ,x i2 ,...,x iD The speed can be expressed as V. i =(v i1 ,v i2 ,...,v iD When the position of particle i satisfies the optimal fitness value, i.e., the optimal objective function value, this position is called the optimal previous position, denoted as P. i =(p i1 ,p i2 ,...,p iD The optimal position in the overall particle swarm is represented by P. g =(p g1 ,p g2 ,...,p gD The iterative formulas for updating the particle's position and velocity are as follows:

[0034]

[0035] Where k represents the number of iterations, ω represents the inertia weight, c1 and c2 represent the local learning factor and the local learning factor, respectively, rand1 and rand2 represent random numbers distributed in [0,1], and p id p represents the historical best position of a single particle. gd This represents the optimal position within the entire particle swarm. The position parameters are treated as coil pairs to be optimized, and the algorithm iteratively optimizes these parameters to ultimately obtain the optimal coil structure parameters that achieve the best homogenization of the magnetic field in the target region. Attached Figure Description

[0036] Figure 1 A model diagram for calculating the magnetic field of a square coil is provided. The side length of the square coil ABCD is 2L. Point P(x,y,z) is any point in space. The foot of the perpendicular between point P and the plane containing coil ABCD is point S. P0 is the foot of the perpendicular between PP0 and the current-carrying conductor AB. Based on the model information constructed in the diagram, the formula for the magnetic field generated by the square coil can be derived.

[0037] Figure 2 This is a schematic diagram of an axially oriented, multi-square uniform coil. Each pair of square coils in the diagram is symmetrical about the plane Y=0, and the Nth pair of square coils has n turns. N A current I is passed through all the coils. The distance d between coil N and the plane Y = 0 is... N .

[0038] Figure 3 This is a schematic diagram of a two-dimensional planar mirror model of a square coil based on the mirror method. The black border represents the ferromagnetic boundary of the magnetic shielding chamber, W. z+ W z- W x+ and W x- These represent the four planes of the ferromagnetic boundary along the positive z-axis, negative z-axis, positive x-axis, and negative x-axis directions on the xoz plane. The original coil current, after being mirrored through the ferromagnetic boundary plane, forms multi-order mirrored currents. Using B... x,z The original current and each mirror current are named, which are also used to represent the magnetic induction intensity produced by the coil.

[0039] Figure 4 This is a schematic diagram of a three-dimensional mirror model of a square coil based on the method of images. Let the original current and boundary current W be... y+ If the distance between them is L1, then the distance between them and the boundary W is... y- The distance between them is L2. Let the side length of the ferromagnetic boundary be 2L. r The length of the coil is 2L c The original current and the mirror current can now be represented by specific spatial coordinates: (2iL) r ,L r -L1+4jL r 2kLr ),(2iL r ,L r +L1+4jL r 2kL r ), where j = 0, ±2, ±4 or ±1, ±3, ±5……; i, k = 0, ±2, ±4…….

[0040] Figure 5 The target points are selected within the constructed target region, which is a cube with a side length of 2a. The selected target points are represented by black dots in the diagram, distributed at the vertices, edge centers, face centers, and center point of the cube region.

[0041] Figure 6 This is a flowchart of a design optimization method for axially oriented polygonal uniform coils in a magnetically shielded cabin based on the generalized mirror method and particle swarm optimization algorithm, according to the present invention. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.

[0043] The following is in conjunction with the appendix Figures 1-5 The present invention will be described in conjunction with the embodiments.

[0044] like Figure 6 As shown, a design optimization method for axially oriented polygonal uniform coils in a magnetically shielded cabin based on the generalized image method and particle swarm optimization algorithm includes the following steps:

[0045] Step (1): Based on Biosavart's law, calculate the magnetic field generated by the square coil at the target point in space, and extend it to multiple pairs of square coils along the axis. Further express the magnetic field at the target point as the sum of the magnetic fields of multiple pairs of square coils along the axis.

[0046] Step (2): Due to the coupling between the magnetic shielding chamber and the coil, the uniformity of the magnetic field generated by the coil will decrease. In order to improve the uniformity of the magnetic field of the coil in the magnetic shielding chamber, the coil is modeled using the generalized image method inside the magnetic shielding chamber.

[0047] Step (3): Apply the magnetic field calculation formula obtained in step (1) to the generalized mirror method model in step (2), identify the target points in the target area, and set the sum of the magnetic field uniformity at each target point as the objective function to be optimized.

[0048] Step (4): Introduce the particle swarm optimization algorithm. Use the objective function in step (3) as the fitness in the particle swarm algorithm. Use the distance between each coil pair and the Y=0 plane as the parameter to be optimized, which is the position parameter in the particle swarm algorithm. After determining the algorithm parameters, perform iterative optimization to finally obtain the coil structure parameters that can make the magnetic field of the target area most uniform.

[0049] The method for calculating the magnetic field of the system using the axial square coil in step (1) is as follows:

[0050] First, establish a magnetic field calculation model for an axial square coil pair. Establish a Cartesian coordinate system in space, defining the coil's axis as the y-axis and setting the origin at point O. Determine the magnetic field calculation formula for a single current-carrying straight conductor. Let any point P in space be the target point. Perform magnetic field calculations for the square coil. Assuming the existence of a current-carrying straight conductor, according to Biot-Savart's law, the expression for the magnetic field produced by the current-carrying straight conductor at a point P in space is as follows:

[0051]

[0052] In the formula, μ0 = 4π × 10 -7 H / m is the permeability of free space, I is the current in the coil, θ1 and θ2 are the angles between the lines connecting the two ends of the conductor to point P and the conductor, d is the distance from point P to the conductor, and the direction of the magnetic field and the direction of the current are determined by the right-hand screw rule, which is perpendicular to the plane containing point P and the current-carrying straight conductor.

[0053] Then, determine the formula for calculating the magnetic field of the square coil; such as Figure 1 Suppose there exists a square coil ABCD in space with a side length of 2L, and the coordinates of any point P in space are P(x,y,z). Through derivation, the magnetic field in the y-axis direction produced by the square coil ABCD at point P is:

[0054]

[0055] In the formula, B ABy B BCy B CDy B DAy The magnetic fields generated at point P by the current-carrying straight conductors AB, BC, CD, and DA in coil ABCD are respectively represented. Superimposing these magnetic fields yields B. y That is, the magnetic field in the y-axis direction generated by coil ABCD at point P;

[0056] Establish a calculation model for the magnetic field of multiple pairs of square coils along the y-axis; such as Figure 2 Each pair of square coils is symmetrical about the plane Y = 0. There are N pairs of square coils, and the distance d of each individual coil in each pair from the plane Y = 0 is... N Then the magnetic field produced by each pair of square coils at point P is:

[0057]

[0058] In the formula, the magnetic field generated by a single square coil along the positive y-axis in the coil pair is represented as B. + The magnetic field generated by a single square coil along the negative y-axis is B.

[0059] The coil mirror modeling method in step (2) is as follows:

[0060] (2.1) Create a mirror image of the coil in a two-dimensional plane. For example... Figure 3 In the established Cartesian coordinate system, on the xoz plane, with the x-axis and z-axis planes of the magnetic shielding chamber as mirror images, mirror iterations are performed along the x-axis and z-axis respectively. Let the magnetic field strength generated by the original current and all mirror currents in the xoz plane, when the y-axis coordinate is fixed at y0, be given by...

[0061]

[0062] Among them, f i,0,k (2iL r ,y0,2kL r ) represents coordinates (2iL r ,y0,2kL r The magnetic field strength produced by a single coil.

[0063] (2.2) Based on the established two-dimensional mirror, a three-dimensional mirror is created, such as... Figure 4 For the mirrored coil in the xoz plane and the original current coil, with the y-axis plane of the magnetically shielded cabin as the mirror, a mirror iteration is performed along the y-axis. In this model, let the original current and boundary W be... y+ If the distance between them is L1, then the distance between them and the boundary W is... y- The distance between them is L2, and the side length of the ferromagnetic boundary is 2L. r The length of the coil is 2L c The original current and the mirror current can now be represented by specific spatial coordinates: (2iL) r ,L r -L1+4jL r 2kL r ),(2iL r ,L r +L1+4jL r 2kL r ), where j = 0, ±2, ±4 or ±1, ±3, ±5……; i, k = 0, ±2, ±4…….

[0064] Extending the expression for calculating the magnetic field in a two-dimensional plane to a three-dimensional plane, we get:

[0065]

[0066] The calculated magnetic field obtained after modeling using the method of images is:

[0067] B = B1 + B2

[0068] This yields the correspondence between coil current and magnetic field under ferromagnetic boundary coupling conditions obtained by the image method.

[0069] The non-uniformity defined in step (3) is:

[0070]

[0071] In the formula, B res (x,y,z) represents the original remanent magnetism of target point P inside the magnetically shielded chamber, B Np (x,y,z) represents the magnetic field strength generated at point P by all coils after current excitation, calculated based on the uniform coil magnetic field calculation after introducing the generalized image method; B(0,0,0) represents the remanence at the origin of the coordinate system. Figure 5 As shown, a cubic target region with a side length of 2a is defined. The selected target points are distributed at the vertices, edge centers, face centers, and center point of the cubic region. The optimization objective function is:

[0072]

[0073] subject to d i+1 -d i ≥d smin (i = 1, 2, ..., n-1)

[0074] d max ≥d i ≥d min (i = 1, 2, ..., n-1)

[0075] In the formula, f is the objective function to be optimized, and U k Let be the non-uniformity of the k-th target point in the target region; and constraints were imposed on the coil structure parameters during the optimization process, where d i d represents the distance from the i-th pair of square coils to the plane Y = 0. smin d represents the minimum distance between two adjacent coils. max and d min These represent the maximum and minimum distances of the square coil pair from the plane Y = 0, respectively, and n represents the square coil pair with the sequence number n.

[0076] The optimization process based on the particle swarm optimization algorithm in step (4) is as follows:

[0077] Define the variables in the Particle Swarm Optimization (PSO) algorithm. In PSO, the solution to be optimized is represented by particles in the swarm. Each particle has its own position and velocity, and finds the optimal solution by searching the solution space. The particle's position and velocity are updated iteratively based on its optimal position and the global optimal position of the entire swarm. In a search space of dimension D, the position of the i-th particle can be represented as X. i =(x i1 ,x i2 ,...,x iD The speed can be expressed as V. i =(v i1 ,v i2 ,...,v iD When the position of particle i satisfies the optimal fitness value, i.e., the optimal objective function value, this position is called the optimal previous position, denoted as P. i =(p i1 ,p i2 ,...,p iD The optimal position in the overall particle swarm is represented by P. g =(p g1 ,p g2 ,...,p gD The iterative formulas for updating the particle's position and velocity are as follows:

[0078]

[0079] Where k represents the number of iterations, ω represents the inertia weight, c1 and c2 represent the local learning factor and the local learning factor, respectively, rand1 and rand2 represent random numbers distributed in [0,1], and p id p represents the historical best position of a single particle. gd This represents the optimal position within the entire particle swarm. The position parameters are treated as coil pairs to be optimized, and the algorithm iteratively optimizes these parameters to ultimately obtain the optimal coil structure parameters that achieve the best homogenization of the magnetic field in the target region.

Claims

1. A method for optimizing the design of axially arranged multiple pairs of square uniform coils within a magnetically shielded chamber based on the generalized image method and particle swarm optimization algorithm, characterized in that... Includes the following steps: Step (1): Based on Biot-Savart's law, calculate the magnetic field generated by the square coil at the target point in space, and extend it to multiple pairs of square coils along the axis. Further, express the magnetic field at the target point as the sum of the magnetic fields of multiple pairs of square coils along the axis. Step (2): Due to the coupling between the magnetic shielding chamber and the coil, the uniformity of the magnetic field generated by the coil will decrease. In order to improve the uniformity of the magnetic field of the coil in the magnetic shielding chamber, the coil is modeled using the generalized image method inside the magnetic shielding chamber. Step (3): Apply the magnetic field calculation formula obtained in step (1) to the generalized mirror method model in step (2), identify the target points in the target area, and set the sum of magnetic field inhomogeneity at each target point as the objective function to be optimized. Step (4): Introduce the particle swarm optimization algorithm, using the objective function from step (3) as the fitness in the particle swarm algorithm; each coil pair and plane The distance is used as the parameter to be optimized, which is the position parameter in the particle swarm algorithm. After determining the algorithm parameters, iterative optimization is performed to finally obtain the coil structure parameters that can make the magnetic field homogenization of the target area optimal. The generalized image modeling method for the coil in step (2) is as follows: Step (2.1) Establish a two-dimensional plane mirror image of the coil. In the established Cartesian coordinate system, on the xoz plane, with the x-axis and z-axis planes of the magnetic shielding chamber as mirror images, perform mirror iterations along the x-axis and z-axis respectively. Let the fixed y-axis coordinate be... At that time, the magnetic field strength produced by the original current and all mirror currents in the xoz plane within that plane space is: in, Indicates coordinates as The magnetic field strength produced by a single coil; Step (2.2) Based on the established two-dimensional mirror, a three-dimensional mirror is established; for the mirror coil and the original current coil in the xoz plane, the mirror is iterated along the y-axis with the y-axis plane of the magnetic shielding chamber as the mirror. In this model, the original current and boundary are set. If the distance between them is L1, then the boundary... The distance between them is L2. Let the side length of the ferromagnetic boundary be 2Lr, and the length of the coil be 2Lc. The original current and the mirror current are represented by specific spatial coordinates: , , where j = 0, ±2, ±4 or ±1, ±3, ±5……; i, k = 0, ±2, ±4……; Extending the expression for calculating the magnetic field in a two-dimensional plane to a three-dimensional plane, we get: The calculated magnetic field obtained after modeling using the method of images is: This yields the correspondence between coil current and magnetic field under ferromagnetic boundary coupling conditions obtained by the image method.

2. The method according to claim 1, characterized in that, The method for calculating the magnetic field of the axial multi-pair square coils in step (1) is as follows: A magnetic field calculation model for an axial square coil is established. A Cartesian coordinate system is established in space, with the axial direction of the coil defined as the y-axis and the origin set at point O. The magnetic field calculation formula for a current-carrying straight conductor is determined. Taking any point P in space as the target point, the magnetic field calculation of the square coil is performed. Assuming the existence of a current-carrying straight conductor, according to Biot-Savart's law, the expression for the magnetic field produced by the current-carrying straight conductor at a point P in space is calculated as follows: In the formula, The permeability of free space, The current in the coil, , Let be the angle between the lines connecting the two ends of the conductor to point P and the conductor itself. Let P be the distance from point P to the conductor. The direction of the magnetic field and the direction of the current are determined by the right-hand screw rule, and it is perpendicular to the plane containing point P and the current-carrying straight conductor. Determine the formula for calculating the magnetic field of a square coil; assume a square coil exists in space. Its side length is any point in space The coordinates are Based on the formula for calculating the magnetic field of a current-carrying straight conductor, the square coil is derived. The magnetic field generated at point P in the y-axis direction is: In the formula, , , , The magnetic fields generated at point P by the current-carrying straight conductors AB, BC, CD, and DA in coil ABCD, respectively, can be obtained by superimposing them. That is, the magnetic field in the y-axis direction generated by coil ABCD at point P; Establish a calculation model for the magnetic field of multiple pairs of square coils along the y-axis; each pair of square coils about the plane Symmetrical, with For square coils, the distance of each individual coil in each pair of square coils from the plane The distance is Then the magnetic field produced by each pair of square coils at point P is: In the formula, the magnetic field generated by a single square coil along the positive y-axis in the coil pair is expressed as: The magnetic field generated by a single square coil along the negative y-axis is .

3. The method according to claim 1, characterized in that, The non-uniformity defined in step (3) is: In the formula, Indicates the target point The original residual magnetism inside the magnetically shielded chamber This represents the magnetic field strength generated at point P by all coils after being excited by current. The calculation method is based on the calculation of the magnetic field of a uniform coil after introducing the generalized image method. Represents the remanence at the origin of the coordinate system; The objective function to be optimized is: In the formula, The objective function to be optimized is... For the target area, the first The non-uniformity at each target point was assessed; and constraints were imposed on the coil structure parameters during the optimization process, among which... Represents the i-th pair of square coils and planes distance, This represents the minimum distance between two adjacent coils. and These represent the square coils relative to the plane. Maximum and minimum distances Indicates the sequence number is A pair of square coils.

4. The method according to claim 1, characterized in that, The optimization process based on the particle swarm optimization algorithm in step (4) is as follows: Define the variables in the particle swarm optimization (PSO) algorithm. In PSO, the solution to be optimized is represented as particles in the swarm, each with its own position and velocity. The optimal solution is found by searching the solution space. The position and velocity of each particle are updated using its optimal position and the global optimal position of the entire swarm during the iteration process. In a search space of dimension D, the position of the i-th particle is represented as... The speed can be expressed as When the position of particle i satisfies the optimal fitness value (i.e., the optimal objective function value), this position is called the optimal previous position, denoted as: The optimal position in the overall particle swarm is represented as The update formulas for the particle's position and velocity are as follows: Where k represents the number of iterations. Indicates inertia weight, and These represent the local learning factor and the regional learning factor, respectively. and Indicates distribution in random numbers, This represents the historical best position of a single particle. This represents the optimal position within the entire particle swarm. The position parameters are treated as coils to be optimized, and the algorithm iteratively optimizes the position parameters to ultimately obtain the coil structure parameters that best homogenize the magnetic field in the target region.