Research on Coil Identification Algorithm of Wireless Power Transfer System Based on Magnetic Field Features

In the practical application of wireless power transfer (WPT), the identification of the secondary coil and the analysis of the space magnetic field of the coil will affect the matching scheme of the coil, which will further affect the performance of energy transmission. At present, the establishment of the coil space magnetic field model mainly adopts the finite element method (FEM). The accuracy of the results is limited by the computer performance and the specific settings during calculation, which usually takes a long time. Additionally, it can only analyze and establish the space magnetic field of the coil with specific parameters. Especially when the coil structure and parameters change, it is difficult to quickly establish the spatial magnetic field. This paper presents a secondary side coil identification method of a wireless charging system based on the magnetic field cloud image characteristics. The image feature extraction algorithm is used to extract features of a certain height magnetic field cloud image of an unknown structure type coil obtained by FEM. Further, by matching with the characteristics of the magnetic field cloud image of the known coil, the identification of the unknown coil structure type is realized. The effectiveness and accuracy of the proposed method is verified by an example. This algorithm is helpful to extract the characteristics of the coil space magnetic field, and can establish coil space magnetic field models with different structure types and different coil parameters combined with deep learning to guide the matching scheme of the primary and secondary coils, and realize efficient energy transmission.


Introduction
Wireless power transfer (WPT) technology has been rapidly developed in recent years as a flexible and convenient new charging method. It is a transmission mode that transfers electric energy from the power source to the power consumer by means of an invisible soft medium in space (such as electric field, magnetic field, sound wave, etc.). Among the current WPT methods, the most theoretical research and the faster application process is mainly the magnetic coupling wireless power method [1]. The current research on magnetic coupling WPT in the industry mainly focuses on system transmission characteristics, coupling mechanism design, electromagnetic shielding, and foreign body detection, etc. [2][3][4][5]. In the design of the coupling mechanism, various designs such as circular coils, square coils, spiral coils, DD (Double-D type) coils [6], and composite coils have emerged. Different coils have different magnetic field characteristics. The electromagnetic shielding, electromagnetic exposure, and electromagnetic environment of the coils are different. In the evaluation, the finite element method (FEM) is generally used to check the distribution of the magnetic field cloud map near the coil. Compared with the analytic results, the magnetic field cloud images obtained by FEM calculation are more intuitive and efficient. The characteristics of the magnetic field distribution of the coil can be found, and the information contained in it is also richer, which is deeply loved by researchers. However, the current researches are performed on known coils to obtain a cloud map of magnetic field distribution. The magnetic field cloud map contains information such as magnetic induction intensity values and magnetic field distribution rules at different spatial locations. The information contained in the magnetic field distribution cloud map can be used to obtain more information, such as identifying unknown coil types and sizes, and using magnetic field distribution to obtain magnetic field requirements to guide coils design and matching of primary and secondary coils and other functions. In addition, there are some electromechanical devices that use a multi-coil network structure that also need to analyze their magnetic field distribution to assist in improving the control strategy of the system [7]. At present, in the fields of atmospheric observation and geographic information systems, researchers have realized weather prediction and geological activity prediction through the analysis of remote sensing images, but few scholars have adopted the idea of image processing to analyze magnetic field cloud images.
This paper analyzes the magnetic field cloud images obtained by the FEM and proposes research on the secondary coil recognition algorithm of the wireless charging system based on the characteristics of the magnetic field cloud image. The identification is performed by analyzing the image pixel changes of the cloud image and the contour characteristics of the isomagnetic induction intensity line. To guide the design of the coil and the matching mechanism of the primary and secondary sides and even analyze the dynamic change law of the magnetic field, the first thing is to obtain the characteristics of the magnetic field near a single coil in a static state to realize the identification of the coil type. In the future, through deep learning and other methods, we hope to establish a magnetic field distribution point cloud model library of different coils and different sizes, to realize the identification of unknown coil type, size, and other parameters, and through this method, we hope to further study the magnetic field distribution help to guide the design of the coil and the matching mechanism of the primary and secondary sides. In Section 1, we mainly introduce the current research situation of coil recognition in the field of wireless power transmission and proposes a coil recognition algorithm of wireless charging system based on the characteristics of magnetic field cloud image. In Section 2, the basic algorithm of image recognition is introduced. In Section 3, based on the cloud image characteristics of the WPT coil, we designed the secondary coil identification algorithm flow of the wireless charging system based on the magnetic field cloud image characteristics. In Section 4, we conducted experiments on the algorithm to verify the feasibility of the algorithm proposed in this article. According to the proposed algorithm, we can distinguish the coil polarity through the changes of pixel value of the symmetrical axis along the Y direction of the unknown coil cloud image, and obtain the unknown coil type by judging the similarity of the contours from template sets and test sets. In Section 5, we have summarized the content of the full text and put forward some thoughts on the follow-up work.

Subsection
Histograms are widely used in many computer vision applications to detect changes in scenes by marking significant edge and color statistical changes between images. Set a "label" composed of a histogram with similar features at each point of interest to determine the point of interest in the image. Histograms such as edges, colors, and angles constitute a common feature type that can be passed to the target recognition classifier. The histogram sequence of colors and edges can also be used to identify whether the network video has been copied.
To put it simply, the histogram is a method of visualizing statistical data, and the statistical values are organized into a series of implementation-defined bins. The value is the feature statistics calculated from the data, these data can be such as gradient, direction, color, or any other features. In any case, the histogram obtains a statistical graph of the data distribution. Usually, the dimensionality of the histogram is lower than the original data. If a matrix contains information about an image, it is known that the range of each number contains 256 values from 0 to 255, so this range can be divided into sub-regions according to certain rules, such as: (1) Then count the number of pixels in each bin to obtain the histogram of the image. The histogram of the image can realize simple analysis and search of image similarity and can realize image segmentation through back projection. As the image content of the magnetic field cloud image of the secondary coil in the WPT system is relatively simple, the color distribution is relatively regular, and the connected area within the same color range is large, it is more convenient to use the back projection based on histogram to achieve image segmentation. Common histogram metric matching methods are as follows: N is the quantization level, H(i) is the pixel value.

Contour Matching Algorithm
Contour is a good external feature of an image target. This feature is of great significance for deeper processing such as image analysis, target recognition, and understanding. Simply put, an outline is a series of points connected to form a shape, and they have the same color. Contour discovery is a very useful tool in image object analysis and object detection.
Based on contour recognition, it is necessary to split the image into channels, find edges, and convert them into contours (polygon approximation, feature generalization, etc.), and then perform contour matching (image and image matching, image, and template matching).
Contour matching is mainly used to solve the matching problems between images with different sizes, positions, rotation angles, and accuracy. Methods include contour moments, paired geometric histograms, convex hulls and convex defects, level matching World Electr. Veh. J. 2021, 12, 140 4 of 12 and so on. Since the content of the magnetic field cloud image of WPT system is simple and the shape feature is relatively prominent, the contour moment is mainly used as the feature of shape matching.
The n-th moment of the real function relative to the value c is: The moments used in contour processing are mainly used in statistics. The above formula is a one-element case, and it is extended to the two elements where the picture is located. For an image matrix, after finding the edge and converting the contour, the value of each value point f (x,y) in the matrix is either 0 (not a contour point), or 1 (it is the contour point), when f (x,y) is 0, the integral term is also 0, so we do not need to calculate it. Therefore, only f (x,y) = 1 is meaningful to us n points are contour points. In the following formula, it is denoted as I(x,y), x,y are the coordinates in the figure, and point c is extended to binary, which can be regarded as the center point of the contour. The so-called n-th order central moment obtained is just as shown in the above formula; the weight of the integral is the nth power of each point on the contour relative to the center position c.
At this time, we can obtain some statistical laws, such as: contour boundary length (zero-order moment), mean value in the x/y direction (i.e., centroid, calculated from the first-order moment), variance (calculated from the second-order central moment), shape characteristics (Hu moment) Commonly used moments include space moment, center distance, normalized center distance, and shape moment, etc.
Spatial moments can only be used to compare contours with the same position, size, and angle, such as Equation (9): I(x, y)x p y q (9) m p,q represents the moment of (p + q) order of the image, and generally calculates all moments of order 3 (p + q ≤ 3).
Where I(x,y) is the value of the pixel (x, y), generally 1, n is the number of points on the contour, p and q are the moments in the x and y dimensions, namely m 00 , m 10 , m 01 ...m 03 .
The zero-order moment m 00 is a simple accumulation of points on the contour, that is, how many points are there on the contour.
The first moments m 10 and m 01 are the accumulation in the x and y directions. The central moment, x avg and y avg are calculated from the ratio of the first-order moment and the zero-order moment. It is the coordinate of the center of gravity. The center moment is the moment obtained from the relative position of x, y, and the center of gravity. It makes the result and the image relative to x, The position of the y axis has nothing to do with translation x avg = m 10 /m 00 (11) The normalized central moment uses the power of m 00 to normalize the central distance, making the result independent of the image size. The formula is as follows: World Electr. Veh. J. 2021, 12, 140

of 12
The Hu invariant moment is a linear combination of the normalized center distance. It is invariant to scaling, rotation, and mirror mapping, and is suitable for shape matching of magnetic field cloud images. The formula is as follows: By calculating and comparing Hu invariant moments, the similarity of the contours can be obtained. Define the similarity S of the two contours of A and B as and h A i ,h B i are the Hu moments of A and B, respectively.

Algorithm Design
Analysis of the WPT system coil magnetic field cloud diagram obtained by FEM shows that the unipolar coil has a single magnetic field direction, while the bipolar coil has two opposite polarities in the plane perpendicular to the coil, which is reflected in the cloud diagram, it can be found that two areas of similar size but complementary colors appear on the symmetry axis along the Y-direction, which can be used as the basis for judging the polarity of the coil.
As for the magnetic field contours generated by different coils, there are obvious differences in intuitive perception, and the contour similarity S can be used as a basis for judging whether the contours of the two coils are similar.
The secondary coil identification algorithm of the wireless charging system based on the magnetic field cloud image features mainly compares and matches the unknown coil magnetic field cloud image with the known coil magnetic field cloud image to obtain the unknown coil type.
The main algorithm flow is as follows: • In the finite element software, simulate circular, square, DD, and solenoid coils of different sizes, and the coil size is fixed at 100 mm × 100 mm; • Choose a square plane with the same size as the coil at a certain height from the coil to obtain the magnetic field cloud image at that position; • Pre-process the coil magnetic field cloud image and down sample the image to 1024 × 1024 size; • Divide the obtained magnetic field cloud image into a test set and a template set according to the coil type; • Calculate the pixel value of the symmetrical axis along the Y direction of the unknown coil cloud image, and analyze the change of the pixel value on the axis, compare it with the template set, and determine whether it is unipolar or bipolar; • For unknown unipolar coils, the image segmentation algorithm is used to obtain the contours of different isomagnetic induction intensity lines, and the Hu invariant moments of the contours are calculated, and compared with the template set, it is judged whether it is a circular or a square coil; • For the unknown bipolar coil, the image segmentation algorithm is used to obtain the contours of the different isomagnetic induction intensity lines, the Hu invariant moment of the contour is calculated, and the shape template is compared to determine whether it is a DD coil or a spiral coil.
The following is the processing of the template set: • Image pre-processing;

Magnetic Field Acquisition
In the finite element software, different types of coils are calculated. We set the coils on the XOY plane, the diameter of the coil is 100 mm, the working frequency is 100 kHz, and the working current is 1 A. The magnetic field cloud images of different coils at different positions are obtained as shown in Figure 2. Figure 2a-

Magnetic Field Acquisition
In the finite element software, different types of coils are calculated. We set the coils on the XOY plane, the diameter of the coil is 100 mm, the working frequency is 100 kHz, and the working current is 1 A. The magnetic field cloud images of different coils at different positions are obtained as shown in Figure 2. Figure 2a-d represent circular coils, square coils, DD coils, solenoid coils, and magnetic field cloud diagrams, respectively, at a distance of 15 mm from the coil. The magnetic field shown in Figure 2 indicates that the circular coil and the square coil are unipolar coils, and the DD coil and the solenoid coil are bipolar coils. In the cloud diagrams, the red area and blue area represent high magnetic induction intensity in opposite directions. From the cloud diagram, we can intuitively see the law of the magnetic field passing through the plane. The magnetic field of the unipolar coil traverses once from the center of the plane. The magnetic field of the bipolar coil goes out from one side of the plane and then goes in from the other side. It appears that a unipolar coil cloud diagram has one center, the bipolar coil cloud diagram has two centers.
For different types of coils, under the premise of ensuring that the outer dimensions of the coils are consistent, the number of turns and the pitch of the coils are changed, and FEM calculation is carried out. A total of 32 coils are simulated. Among them, there are nine circular coils, nine square coils, nine DD coils, and four solenoid coils. The coil parameters are shown in Table 1.  The magnetic field shown in Figure 2 indicates that the circular coil and the square coil are unipolar coils, and the DD coil and the solenoid coil are bipolar coils. In the cloud diagrams, the red area and blue area represent high magnetic induction intensity in opposite directions. From the cloud diagram, we can intuitively see the law of the magnetic field passing through the plane. The magnetic field of the unipolar coil traverses once from the center of the plane. The magnetic field of the bipolar coil goes out from one side of the plane and then goes in from the other side. It appears that a unipolar coil cloud diagram has one center, the bipolar coil cloud diagram has two centers.
For different types of coils, under the premise of ensuring that the outer dimensions of the coils are consistent, the number of turns and the pitch of the coils are changed, and FEM calculation is carried out. A total of 32 coils are simulated. Among them, there are nine circular coils, nine square coils, nine DD coils, and four solenoid coils. The coil parameters are shown in Table 1.

Algorithm Verification
Some cloud images are randomly selected as the template set (No. 1,4,7,12,15,18,19,21,22,28,30), and the other cloud images are used as the test set, which are verified by the proposed algorithm.
The verification platform is based on the Ubuntu20.04 platform with the help of the image algorithm API provided by Opencv.
First, judge the polarity of the coil. Figure 3 shows the distribution of pixels on the symmetry axis of different coil cloud images. The abscissa represents the coordinates of each point on the symmetry axis, and the ordinate represents the value of the green component of each pixel on the symmetry axis. The green component of the unipolar coil has two flat top waves, and the green component of the bipolar coil has three flat top waves. Based on this, it can be determined whether the test coil is a bipolar coil or a unipolar coil.

Algorithm Verification
Some cloud images are randomly selected as the template set (No. 1,4,7,12,15,18,19,21,22,28,30), and the other cloud images are used as the test set, which are verified by the proposed algorithm.
The verification platform is based on the Ubuntu20.04 platform with the help of the image algorithm API provided by Opencv.
First, judge the polarity of the coil. Figure 3 shows the distribution of pixels on the symmetry axis of different coil cloud images. The abscissa represents the coordinates of each point on the symmetry axis, and the ordinate represents the value of the green component of each pixel on the symmetry axis. The green component of the unipolar coil has two flat top waves, and the green component of the bipolar coil has three flat top waves. Based on this, it can be determined whether the test coil is a bipolar coil or a unipolar coil. Next, the contour of the test set coil is extracted and the similarity S between the contour moment value of the coil of the same polarity and the contour moment value of the template set coil is calculated. Figure 4 is a schematic diagram of contour extraction. Based on the proposed algorithm, the contour of the magnetic field cloud image is drawn, and the disordered and incomplete contours at the edge of the cloud image is removed to obtain a more reasonable contour of the coil cloud image. Figure 4a-d shows the magnetic field cloud image of circular coil, square coil, DD coil, solenoid coil, respectively, with the contour of the extracted magnetic field cloud image.  Next, the contour of the test set coil is extracted and the similarity S between the contour moment value of the coil of the same polarity and the contour moment value of the template set coil is calculated. Figure 4 is a schematic diagram of contour extraction. Based on the proposed algorithm, the contour of the magnetic field cloud image is drawn, and the disordered and incomplete contours at the edge of the cloud image is removed to obtain a more reasonable contour of the coil cloud image. Figure 4a-d shows the magnetic field cloud image of circular coil, square coil, DD coil, solenoid coil, respectively, with the contour of the extracted magnetic field cloud image. the template set coil is calculated. Figure 4 is a schematic diagram of contour extraction. Based on the proposed algorithm, the contour of the magnetic field cloud image is drawn, and the disordered and incomplete contours at the edge of the cloud image is removed to obtain a more reasonable contour of the coil cloud image. Figure 4a-d shows the magnetic field cloud image of circular coil, square coil, DD coil, solenoid coil, respectively, with the contour of the extracted magnetic field cloud image.  Table 2 shows the similarity S between the different coil contours obtained and the contour of the template set. Since the foregoing has already determined the polarity of the coil, the calculation and comparison of the similarity S can only be carried out between coils of the same polarity.   Table 2 shows the similarity S between the different coil contours obtained and the contour of the template set. Since the foregoing has already determined the polarity of the coil, the calculation and comparison of the similarity S can only be carried out between coils of the same polarity. By calculating the contour moments in the cloud image, it is found that the Hu invariant moments of some contours in the same cloud image are similar. This is because the Hu invariant moments are scale-invariant. When there are contours with similar shapes but different sizes and positions, their Hu invariant moments also similar. By analyzing the similarity S between different coils' Hu invariant moments according to Equations (15)-(17), it can be obtained that for a unipolar coil, when matched with a circular coil, the contour Hu invariant moment's similarity S is within [0, 0.094080], which can be judged as a circular coil. When matched with a square coil, the similarity S of constant moment of the contour Hu is within [0, 0.097492], which can be judged as a square coil; For bipolar coils, when matched with DD-type coils, the similarity S of constant moment of contour Hu is within [0, 0.297330], which can be judged as DD-type coils. When matched with the solenoid coil, the similarity S of constant moment of the profile Hu is within [0, 0.173247], which can be judged as a solenoid coil.

Conclusions
This paper proposes a coil recognition algorithm of WPT system based on the characteristics of magnetic field cloud image. We analyzed the different magnetic field cloud images characteristics of different types of coils at different positions obtained by FEM, and proposes a secondary coil identification algorithm of the wireless charging system with the characteristics of the magnetic field cloud image. By analyzing the histogram information of the cloud image and the Hu profile moment of the contours of different magnetic induction intensity lines in the cloud image, the characteristics of various cloud images are obtained, and the characteristics of the unknown coil and the known coil cloud image are compared to obtain the coil type. Through this algorithm, we can distinguish the coil polarity through the changes of pixel value of the symmetrical axis along the Y direction of the unknown coil cloud image, and get the unknown coil type by judging the similarity of the contours from template sets and test sets. The recognition success rate of the test coil can reach 100%. This algorithm still has certain limitations. Firstly, the magnetic field cloud image is an image of a specific location and size. In actual operation, only the magnetic induction intensity value at some locations can be obtained; secondly, the current recognition method can only identify the unknown coil type, and cannot obtain the size, turns, distance, and other information of the unknown coil through the cloud image. In the follow-up, we will combine deep learning and other methods to gradually analyze the distribution law of the magnetic field cloud image when multiple coils form a coil network, realize the extraction of coil space magnetic field characteristics, establish coil space magnetic field models of different structure types with different coil parameters, and guide the matching scheme of the primary and secondary coils to achieve efficient energy transmission.
Author Contributions: F.W. conceived and designed the study, and this work was performed under the advice of and regular feedback from him. C.H. and Q.L. was responsible for the models, simulations and C.H. wrote the article. Z.C. and W.Z. was responsible for the experiments. S.W., X.Z. and W.P. was responsible for the data analysis. All authors have read and agreed to the published version of the manuscript.

Conflicts of Interest:
The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.